Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding related items to plannings and events #2110

Open
wants to merge 43 commits into
base: feature/multiple-events-in-planning
Choose a base branch
from

Conversation

tomaskikutis
Copy link
Member

@tomaskikutis tomaskikutis commented Oct 10, 2024

STT-67
STT-8

Front-end checklist

  • This pull request is adding missing TypeScript types to modified code segments where it's easy to do so with confidence
  • This pull request is using TypeScript interfaces instead of prop-types and updates usages where it's quick to do so
  • This pull request is using memo or PureComponent to define new React components (and updates existing usages in modified code segments)
  • This pull request is replacing lodash.get with optional chaining and nullish coalescing for modified code segments
  • This pull request is not importing anything from client-core directly (use superdeskApi)
  • This pull request is importing UI components from superdesk-ui-framework and superdeskApi when possible instead of using ones defined in this repository.
  • This pull request is not using planningApi where it is possible to use superdeskApi
  • This pull request is not adding redux based modals
  • In this pull request, properties of redux state are not being passed as props to components; instead, we connect it to the component that needs them. Except components where using a react key is required - do not connect those due to performance reasons.
  • This pull request is not adding redux actions that do not modify state (e.g. only calling angular services; those should be moved to planningApi)

@tomaskikutis
Copy link
Member Author

@MarkLark86 If an existing planning item gets drag and dropped as related to an event, I'm adding it using the secondary link. Should it be possible to add coverages to planning items linked using the secondary link type?

Copy link
Collaborator

@MarkLark86 MarkLark86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, mostly just suggestion about implementing logic around the link config in the front-end

client/actions/events/api.ts Outdated Show resolved Hide resolved
client/actions/events/api.ts Outdated Show resolved Hide resolved
client/components/Events/EventMetadata/index.tsx Outdated Show resolved Hide resolved
client/components/fields/editor/AssociatedEvent.tsx Outdated Show resolved Hide resolved
client/utils/events.ts Show resolved Hide resolved
client/utils/events.ts Outdated Show resolved Hide resolved
@MarkLark86
Copy link
Collaborator

@MarkLark86 If an existing planning item gets drag and dropped as related to an event, I'm adding it using the secondary link. Should it be possible to add coverages to planning items linked using the secondary link type?

I might need a little more context here, as I'm not sure I understand the scenario entirely. When adding a Coverage to a Planning item, there is no logic involved around any linked Events that alllows or denies adding these Coverages. Am I missing something here, could you maybe explain more please

@tomaskikutis tomaskikutis force-pushed the adding-related-items-to-plannings-and-events branch from 61bceb8 to d64ce28 Compare October 28, 2024 12:14
@tomaskikutis
Copy link
Member Author

FYI I've force-pushed to revert a bad merge. I had by mistake merged develop to this branch, instead of feature/multiple-events-in-planning

@tomaskikutis
Copy link
Member Author

I might need a little more context here, as I'm not sure I understand the scenario entirely. When adding a Coverage to a Planning item, there is no logic involved around any linked Events that alllows or denies adding these Coverages. Am I missing something here, could you maybe explain more please

That's what I wanted to know in the end - whether coverages have some relation to the planning item and its link type. Because in the UI they look attached to planning items. Since you say they're not connected - all good then - I don't have to do anything special to address it.

const ageSeconds = (now.getTime() - createdAt.getTime()) / 1000;
const tooRecent = ageSeconds > 30;

if (tooRecent) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MarkLark86 any idea how to avoid this hack?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only thing that comes to mind is if you also pass in the original associatedPlanning IDs. Check non-temp IDs (aka not "fake ID") that are in original that are not in updates are to be unlinked.

@tomaskikutis
Copy link
Member Author

@MarkLark86 besides the hack, anything else you'd like me to address here?

Copy link
Collaborator

@MarkLark86 MarkLark86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tomaskikutis Looks good to me.

return Promise.resolve([updatedEvent]);
}

// return Promise.resolve([updatedEvent]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove commented code


// KEEP IN SYNC WITH client/planning-extension/src/globals.d.ts
declare module 'superdesk-api' {
interface ISuperdeskGlobalConfig {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one 👍 Removes the need for the hack const appConfig = config.appConfig as IPlanningConfig;.
Though, where is it getting the references to types from client/interfaces.ts (such as IPlanningItem)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I forgot to import it so it wasn't getting references and evaluating to any

@@ -242,6 +242,9 @@ def init_app(app):
"default_create_planning_series_with_event_series"
] = get_config_default_create_planning_series_with_event_series(app)

# TODO: use get_planning_event_link_method
app.client_config["planning_event_link_method"] = "one_primary_many_secondary"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO action needs to be fixed

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@petrjasek can you fix this one for me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants