From 597525e3ddc19d4334c2afb3017b98112233c87d Mon Sep 17 00:00:00 2001 From: dzonidoo Date: Thu, 12 Dec 2024 16:38:01 +0100 Subject: [PATCH] imrpvoe panels config --- scripts/appConfig.ts | 36 +++++++++++++---- .../actions/publish-tab.tsx | 39 +++++++++++-------- .../actions/send-to-tab.tsx | 1 + .../subcomponents/publishing-date-options.tsx | 3 +- scripts/core/superdesk-api.d.ts | 10 +++++ 5 files changed, 63 insertions(+), 26 deletions(-) diff --git a/scripts/appConfig.ts b/scripts/appConfig.ts index 11eaee563e..7d08a64f7f 100644 --- a/scripts/appConfig.ts +++ b/scripts/appConfig.ts @@ -12,6 +12,34 @@ if (appConfig.shortTimeFormat == null) { appConfig.shortTimeFormat = 'HH:mm'; // 24h format } +if (appConfig.ui == null) { + appConfig.ui = {}; +} + +if (appConfig.ui.sendEmbargo == null) { + appConfig.ui.sendEmbargo = false; +} + +if (appConfig.ui.italicAbstract == null) { + appConfig.ui.italicAbstract = true; +} + +if (appConfig.authoring == null) { + appConfig.authoring = {}; +} + +if (appConfig.authoring.panels == null) { + appConfig.authoring.panels = {}; +} + +if (appConfig.authoring.panels.sendTo == null) { + appConfig.authoring.panels.sendTo = {}; +} + +if (appConfig.authoring.panels.sendTo.publishSchedule == null) { + appConfig.authoring.panels.sendTo.publishSchedule = false; +} + const defaultDateFormat = 'MM/DD'; const defaultTimeFormat = 'hh:mm'; @@ -34,14 +62,6 @@ if (appConfig.longDateFormat == null) { appConfig.longDateFormat = 'LLL'; } -if (appConfig.ui == null) { - appConfig.ui = {}; - - if (appConfig.ui.italicAbstract == null) { - appConfig.ui.italicAbstract = true; - } -} - if (appConfig.features == null) { appConfig.features = {}; } diff --git a/scripts/core/interactive-article-actions-panel/actions/publish-tab.tsx b/scripts/core/interactive-article-actions-panel/actions/publish-tab.tsx index 172c8190fa..ff349afad8 100644 --- a/scripts/core/interactive-article-actions-panel/actions/publish-tab.tsx +++ b/scripts/core/interactive-article-actions-panel/actions/publish-tab.tsx @@ -224,25 +224,30 @@ export class WithPublishTab extends React.PureComponent { ); }} allowSettingEmbargo={appConfig.ui.publishEmbargo !== false} + allowSettingPublishSchedule={ + appConfig.authoring.panels.publish.publishSchedule !== false + } /> - { - this.setState( - {publishingTarget: val}, - () => { - this.props.onDataChange?.({ - ...this.props.item, - ...getPublishingTargetPatch( - this.props.item, - this.state.publishingTarget, - ), - }); - }, - ); - }} - /> + {appConfig.authoring.panels.publish.publishingTarget !== false && ( + { + this.setState( + {publishingTarget: val}, + () => { + this.props.onDataChange?.({ + ...this.props.item, + ...getPublishingTargetPatch( + this.props.item, + this.state.publishingTarget, + ), + }); + }, + ); + }} + /> + )} { diff --git a/scripts/core/interactive-article-actions-panel/actions/send-to-tab.tsx b/scripts/core/interactive-article-actions-panel/actions/send-to-tab.tsx index 07efe50690..a0304d9477 100644 --- a/scripts/core/interactive-article-actions-panel/actions/send-to-tab.tsx +++ b/scripts/core/interactive-article-actions-panel/actions/send-to-tab.tsx @@ -147,6 +147,7 @@ export class SendToTab extends React.PureComponent { this.setState({publishingDateOptions: val}); }} allowSettingEmbargo={appConfig.ui.sendEmbargo !== false} + allowSettingPublishSchedule={appConfig.authoring.panels.sendTo.publishSchedule} /> ) } diff --git a/scripts/core/interactive-article-actions-panel/subcomponents/publishing-date-options.tsx b/scripts/core/interactive-article-actions-panel/subcomponents/publishing-date-options.tsx index b747176c01..4fcc86083a 100644 --- a/scripts/core/interactive-article-actions-panel/subcomponents/publishing-date-options.tsx +++ b/scripts/core/interactive-article-actions-panel/subcomponents/publishing-date-options.tsx @@ -60,6 +60,7 @@ interface IProps { value: IPublishingDateOptions; onChange(value: IPublishingDateOptions): void; allowSettingEmbargo: boolean; + allowSettingPublishSchedule?: boolean; } export class PublishingDateOptions extends React.PureComponent { @@ -76,7 +77,7 @@ export class PublishingDateOptions extends React.PureComponent { && this.props.allowSettingEmbargo && sdApi.user.hasPrivilege('embargo'); - const canSetPublishSchedule = embargo == null; + const canSetPublishSchedule = embargo == null && this.props.allowSettingPublishSchedule; return (
diff --git a/scripts/core/superdesk-api.d.ts b/scripts/core/superdesk-api.d.ts index be14ae9e89..6dd1c37c27 100644 --- a/scripts/core/superdesk-api.d.ts +++ b/scripts/core/superdesk-api.d.ts @@ -3410,6 +3410,16 @@ declare module 'superdesk-api' { preview?: { hideContentLabels: boolean; }; + + panels?: { + publish?: { + publishSchedule?: boolean + publishingTarget?: boolean; + } + sendTo?: { + publishSchedule?: boolean; + } + } }; ui: { /**