From 92c036af10ed786c1e03f6eef73f165d51d3a2ae Mon Sep 17 00:00:00 2001 From: Konstantin Markov Date: Mon, 11 Nov 2024 14:00:44 +0200 Subject: [PATCH 01/35] Fix article content profile switch in authoring --- .../authoring-integration-wrapper.tsx | 20 ++++++++- .../apps/authoring-react/authoring-react.tsx | 41 ++++++++----------- scripts/core/superdesk-api.d.ts | 3 ++ 3 files changed, 38 insertions(+), 26 deletions(-) diff --git a/scripts/apps/authoring-react/authoring-integration-wrapper.tsx b/scripts/apps/authoring-react/authoring-integration-wrapper.tsx index 157c7f9acf..f570bc38c9 100644 --- a/scripts/apps/authoring-react/authoring-integration-wrapper.tsx +++ b/scripts/apps/authoring-react/authoring-integration-wrapper.tsx @@ -56,8 +56,8 @@ const defaultToolbarItems: Array void; }>> = [ - CreatedModifiedInfo, -]; + CreatedModifiedInfo, + ]; interface IProps { itemId: IArticle['_id']; @@ -361,6 +361,22 @@ export class AuthoringIntegrationWrapper extends React.PureComponent { dispatchCustomEvent('articleEditEnd', article); }} + customHeader={((options) => ( +
+ { + if (options.hasUnsavedChanges()) { + options.handleUnsavedChanges().then(() => { + options.onChangeToolbarWidget(item); + }); + } else { + options.onChangeToolbarWidget(item); + } + }} + /> +
+ ))} getActions={({ item, contentProfile, diff --git a/scripts/apps/authoring-react/authoring-react.tsx b/scripts/apps/authoring-react/authoring-react.tsx index 08264f2c62..5257c862b2 100644 --- a/scripts/apps/authoring-react/authoring-react.tsx +++ b/scripts/apps/authoring-react/authoring-react.tsx @@ -58,7 +58,6 @@ import {IFontSizeOption, ITheme, ProofreadingThemeModal} from './toolbar/proofre import {showModal} from '@superdesk/common'; import ng from 'core/services/ng'; import {focusFirstChildInput} from 'utils/focus-first-child-input'; -import {ContentProfileDropdown} from './subcomponents/content-profile-dropdown'; export function getFieldsData( item: T, @@ -309,6 +308,7 @@ export class AuthoringReact extends React.PureCo this.setLoadingState = this.setLoadingState.bind(this); this.reinitialize = this.reinitialize.bind(this); this.setRef = this.setRef.bind(this); + this.onChangeToolbarWidget = this.onChangeToolbarWidget.bind(this); const setStateOriginal = this.setState.bind(this); @@ -1175,6 +1175,18 @@ export class AuthoringReact extends React.PureCo )); } + + onChangeToolbarWidget(item: T) { + const state = this.state; + + if (state.initialized === true) { + this.props.authoringStorage.getContentProfile(item, this.props.fieldsAdapter) + .then((res) => { + this.reinitialize(state, item, res); + }); + } + }; + render() { const state = this.state; const {authoringStorage, fieldsAdapter, storageAdapter, getLanguage, getSidePanel} = this.props; @@ -1219,6 +1231,7 @@ export class AuthoringReact extends React.PureCo }); } }, + onChangeToolbarWidget: this.onChangeToolbarWidget, addValidationErrors: (moreValidationErrors) => { this.setState({ ...state, @@ -1416,13 +1429,6 @@ export class AuthoringReact extends React.PureCo }, }; - const onChangeSideWidget = (item: T) => { - authoringStorage.getContentProfile(item, this.props.fieldsAdapter) - .then((res) => { - this.reinitialize(state, item, res); - }); - }; - return (
{ @@ -1465,10 +1471,10 @@ export class AuthoringReact extends React.PureCo reinitialize={(item) => { if (this.hasUnsavedChanges()) { exposed.handleUnsavedChanges().then(() => { - onChangeSideWidget(item); + this.onChangeToolbarWidget(item); }); } else { - onChangeSideWidget(item); + this.onChangeToolbarWidget(item); } }} item={state.itemWithChanges} @@ -1505,20 +1511,7 @@ export class AuthoringReact extends React.PureCo headerPadding={{top: 8}} authoringHeader={(
-
- { - if (this.hasUnsavedChanges()) { - exposed.handleUnsavedChanges().then(() => { - onChangeSideWidget(item); - }); - } else { - onChangeSideWidget(item); - } - }} - /> -
+ {this.props.customHeader(exposed)} >; + customHeader?: (options: IExposedFromAuthoring) => JSX.Element; + disableWidgetPinning?: boolean; // defaults to false getSidebarWidgetsCount(options: IExposedFromAuthoring): number; From bd800ca06537d51881492d2bf51b6a1e393eb01e Mon Sep 17 00:00:00 2001 From: Konstantin Markov Date: Mon, 11 Nov 2024 14:02:50 +0200 Subject: [PATCH 02/35] Fix lint --- .../apps/authoring-react/authoring-integration-wrapper.tsx | 4 ++-- scripts/apps/authoring-react/authoring-react.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/apps/authoring-react/authoring-integration-wrapper.tsx b/scripts/apps/authoring-react/authoring-integration-wrapper.tsx index f570bc38c9..776ef65f7f 100644 --- a/scripts/apps/authoring-react/authoring-integration-wrapper.tsx +++ b/scripts/apps/authoring-react/authoring-integration-wrapper.tsx @@ -56,8 +56,8 @@ const defaultToolbarItems: Array void; }>> = [ - CreatedModifiedInfo, - ]; + CreatedModifiedInfo, +]; interface IProps { itemId: IArticle['_id']; diff --git a/scripts/apps/authoring-react/authoring-react.tsx b/scripts/apps/authoring-react/authoring-react.tsx index 5257c862b2..8abd36802c 100644 --- a/scripts/apps/authoring-react/authoring-react.tsx +++ b/scripts/apps/authoring-react/authoring-react.tsx @@ -1185,7 +1185,7 @@ export class AuthoringReact extends React.PureCo this.reinitialize(state, item, res); }); } - }; + } render() { const state = this.state; From fd9c4e5541a41e89653109ba33d9874c82594f5b Mon Sep 17 00:00:00 2001 From: Konstantin Markov Date: Wed, 13 Nov 2024 09:29:30 +0200 Subject: [PATCH 03/35] Changes after review --- .../authoring-integration-wrapper.tsx | 41 +++++++++++-------- .../apps/authoring-react/authoring-react.tsx | 6 ++- scripts/core/superdesk-api.d.ts | 2 +- 3 files changed, 29 insertions(+), 20 deletions(-) diff --git a/scripts/apps/authoring-react/authoring-integration-wrapper.tsx b/scripts/apps/authoring-react/authoring-integration-wrapper.tsx index dfb412af4d..334f2c9b4f 100644 --- a/scripts/apps/authoring-react/authoring-integration-wrapper.tsx +++ b/scripts/apps/authoring-react/authoring-integration-wrapper.tsx @@ -56,8 +56,8 @@ const defaultToolbarItems: Array void; }>> = [ - CreatedModifiedInfo, -]; + CreatedModifiedInfo, + ]; interface IProps { itemId: IArticle['_id']; @@ -359,22 +359,27 @@ export class AuthoringIntegrationWrapper extends React.PureComponent item.extra?.[fieldId] ?? null, }} - customHeader={((options) => ( -
- { - if (options.hasUnsavedChanges()) { - options.handleUnsavedChanges().then(() => { - options.onChangeToolbarWidget(item); - }); - } else { - options.onChangeToolbarWidget(item); - } - }} - /> -
- ))} + customHeader={((exposed) => [{ + component: ({entity}) => ( +
+ { + if (exposed.hasUnsavedChanges()) { + exposed.handleUnsavedChanges().then(() => { + exposed.onChangeToolbarWidget(item); + }); + } else { + exposed.onChangeToolbarWidget(item); + } + }} + /> +
+ ), + availableOffline: false, + group: 'start', + priority: 1 + }])} getLanguage={(article) => article.language ?? 'en'} onEditingStart={(article) => { dispatchCustomEvent('articleEditStart', article); diff --git a/scripts/apps/authoring-react/authoring-react.tsx b/scripts/apps/authoring-react/authoring-react.tsx index 0f4a09eaeb..0e3a2c6e47 100644 --- a/scripts/apps/authoring-react/authoring-react.tsx +++ b/scripts/apps/authoring-react/authoring-react.tsx @@ -1512,7 +1512,11 @@ export class AuthoringReact extends React.PureCo headerPadding={{top: 8}} authoringHeader={(
- {this.props.customHeader(exposed)} + >; - customHeader?: (options: IExposedFromAuthoring) => JSX.Element; + customHeader?: (options: IExposedFromAuthoring) => Array>; disableWidgetPinning?: boolean; // defaults to false From cfdac74fceeca8320a9ffff7110c48222c9d9e13 Mon Sep 17 00:00:00 2001 From: Konstantin Markov Date: Wed, 13 Nov 2024 10:36:14 +0200 Subject: [PATCH 04/35] Lint --- .../apps/authoring-react/authoring-integration-wrapper.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/apps/authoring-react/authoring-integration-wrapper.tsx b/scripts/apps/authoring-react/authoring-integration-wrapper.tsx index 334f2c9b4f..3f9d9889e5 100644 --- a/scripts/apps/authoring-react/authoring-integration-wrapper.tsx +++ b/scripts/apps/authoring-react/authoring-integration-wrapper.tsx @@ -56,8 +56,8 @@ const defaultToolbarItems: Array void; }>> = [ - CreatedModifiedInfo, - ]; + CreatedModifiedInfo, +]; interface IProps { itemId: IArticle['_id']; @@ -378,7 +378,7 @@ export class AuthoringIntegrationWrapper extends React.PureComponent article.language ?? 'en'} onEditingStart={(article) => { From d0f3fa6edf94ffa95f89a3a098ba9889d0ec8546 Mon Sep 17 00:00:00 2001 From: Konstantin Markov Date: Wed, 13 Nov 2024 11:58:22 +0200 Subject: [PATCH 05/35] Changes v2 --- .../authoring-integration-wrapper.tsx | 52 +++++++++++-------- .../apps/authoring-react/authoring-react.tsx | 19 ++----- 2 files changed, 34 insertions(+), 37 deletions(-) diff --git a/scripts/apps/authoring-react/authoring-integration-wrapper.tsx b/scripts/apps/authoring-react/authoring-integration-wrapper.tsx index 3f9d9889e5..4256bf316d 100644 --- a/scripts/apps/authoring-react/authoring-integration-wrapper.tsx +++ b/scripts/apps/authoring-react/authoring-integration-wrapper.tsx @@ -359,27 +359,37 @@ export class AuthoringIntegrationWrapper extends React.PureComponent item.extra?.[fieldId] ?? null, }} - customHeader={((exposed) => [{ - component: ({entity}) => ( -
- { - if (exposed.hasUnsavedChanges()) { - exposed.handleUnsavedChanges().then(() => { - exposed.onChangeToolbarWidget(item); - }); - } else { - exposed.onChangeToolbarWidget(item); - } - }} - /> -
- ), - availableOffline: false, - group: 'start', - priority: 1, - }])} + customHeader={((exposed) => { + const getProfileAndReinitialize = (item: IArticle) => + this.props.authoringStorage.getContentProfile( + item, + exposed.fieldsAdapter, + ).then((profile) => { + exposed.reinitialize(item, profile); + }); + + return [{ + component: ({entity}) => ( +
+ { + if (exposed.hasUnsavedChanges()) { + exposed.handleUnsavedChanges().then(() => { + getProfileAndReinitialize(item); + }); + } else { + getProfileAndReinitialize(item); + } + }} + /> +
+ ), + availableOffline: false, + group: 'start', + priority: 1, + }] + })} getLanguage={(article) => article.language ?? 'en'} onEditingStart={(article) => { dispatchCustomEvent('articleEditStart', article); diff --git a/scripts/apps/authoring-react/authoring-react.tsx b/scripts/apps/authoring-react/authoring-react.tsx index 0e3a2c6e47..025ba84209 100644 --- a/scripts/apps/authoring-react/authoring-react.tsx +++ b/scripts/apps/authoring-react/authoring-react.tsx @@ -308,7 +308,6 @@ export class AuthoringReact extends React.PureCo this.setLoadingState = this.setLoadingState.bind(this); this.reinitialize = this.reinitialize.bind(this); this.setRef = this.setRef.bind(this); - this.onChangeToolbarWidget = this.onChangeToolbarWidget.bind(this); const setStateOriginal = this.setState.bind(this); @@ -1178,18 +1177,6 @@ export class AuthoringReact extends React.PureCo )); } - - onChangeToolbarWidget(item: T) { - const state = this.state; - - if (state.initialized === true) { - this.props.authoringStorage.getContentProfile(item, this.props.fieldsAdapter) - .then((res) => { - this.reinitialize(state, item, res); - }); - } - } - render() { const state = this.state; const {authoringStorage, fieldsAdapter, storageAdapter, getLanguage, getSidePanel} = this.props; @@ -1232,7 +1219,7 @@ export class AuthoringReact extends React.PureCo pinnedId: id === activeWidgetId ? activeWidgetId : this.props.sideWidget?.pinnedId, }); }, - onChangeToolbarWidget: this.onChangeToolbarWidget, + reinitialize: (item, profile) => this.reinitialize(state, item, profile), addValidationErrors: (moreValidationErrors) => { this.setState({ ...state, @@ -1472,10 +1459,10 @@ export class AuthoringReact extends React.PureCo reinitialize={(item) => { if (this.hasUnsavedChanges()) { exposed.handleUnsavedChanges().then(() => { - this.onChangeToolbarWidget(item); + this.reinitialize(state, item); }); } else { - this.onChangeToolbarWidget(item); + this.reinitialize(state, item); } }} item={state.itemWithChanges} From 570e447a5311eac80c6b805d5becac4465382a74 Mon Sep 17 00:00:00 2001 From: Konstantin Markov Date: Wed, 13 Nov 2024 13:52:15 +0200 Subject: [PATCH 06/35] Cleanup authoring for planning integration and more --- .../authoring-angular-integration.tsx | 2 +- ...authoring-angular-template-integration.tsx | 1 - .../authoring-integration-wrapper.tsx | 102 +++++++++--- .../apps/authoring-react/authoring-react.tsx | 150 ++++++------------ .../subcomponents/created-modified-info.tsx | 5 +- .../authoring/authoring-topbar-react.tsx | 2 +- .../authoring/authoring-topbar2-react.tsx | 42 +++-- .../apps/authoring/authoring/created-info.tsx | 8 +- .../authoring/authoring/modified-info.tsx | 8 +- scripts/core/superdesk-api.d.ts | 40 ++--- 10 files changed, 177 insertions(+), 183 deletions(-) diff --git a/scripts/apps/authoring-react/authoring-angular-integration.tsx b/scripts/apps/authoring-react/authoring-angular-integration.tsx index bd182e0267..ff3232d778 100644 --- a/scripts/apps/authoring-react/authoring-angular-integration.tsx +++ b/scripts/apps/authoring-react/authoring-angular-integration.tsx @@ -809,7 +809,7 @@ export function getAuthoringPrimaryToolbarWidgets( return { ...item, component: (props: {entity: IArticle}) => ( - + ), }; }) diff --git a/scripts/apps/authoring-react/authoring-angular-template-integration.tsx b/scripts/apps/authoring-react/authoring-angular-template-integration.tsx index e85db92689..e50fdf1e9c 100644 --- a/scripts/apps/authoring-react/authoring-angular-template-integration.tsx +++ b/scripts/apps/authoring-react/authoring-angular-template-integration.tsx @@ -16,7 +16,6 @@ export class AuthoringAngularTemplateIntegration extends React.PureComponent { this.props.template.data = computeLatestEntity(); diff --git a/scripts/apps/authoring-react/authoring-integration-wrapper.tsx b/scripts/apps/authoring-react/authoring-integration-wrapper.tsx index 4256bf316d..8739f06acf 100644 --- a/scripts/apps/authoring-react/authoring-integration-wrapper.tsx +++ b/scripts/apps/authoring-react/authoring-integration-wrapper.tsx @@ -44,6 +44,7 @@ import {PINNED_WIDGET_USER_PREFERENCE_SETTINGS, closedIntentionally} from 'apps/ import {AuthoringIntegrationWrapperSidebar} from './authoring-integration-wrapper-sidebar'; import {assertNever} from 'core/helpers/typescript-helpers'; import {ContentProfileDropdown} from './subcomponents/content-profile-dropdown'; +import {IconButton} from 'superdesk-ui-framework'; export function getWidgetsFromExtensions(article: IArticle): Array { return Object.values(extensions) @@ -52,16 +53,68 @@ export function getWidgetsFromExtensions(article: IArticle): Array a.order - b.order); } -const defaultToolbarItems: Array void; -}>> = [ - CreatedModifiedInfo, -]; - interface IProps { itemId: IArticle['_id']; } + +const getAuthoringCosmeticActions = (exposed: IExposedFromAuthoring): Array> => [{ + availableOffline: true, + component: () => ( + { + exposed.printPreview(); + }} + /> + ), + group: 'end', + priority: 1, + keyBindings: { + 'ctrl+shift+i': () => { + exposed.printPreview(); + } + }, +}, +{ + availableOffline: true, + component: () => ( + { + exposed.toggleTheme(); + }} + /> + ), + group: 'end', + priority: 2, + keyBindings: { + 'ctrl+shift+t': () => { + exposed.toggleTheme(); + } + } +}, +{ + availableOffline: true, + component: () => ( + { + exposed.configureTheme(); + }} + /> + ), + group: 'end', + priority: 3, + keyBindings: { + 'ctrl+shift+c': () => { + exposed.configureTheme(); + } + }, +}]; + export type ISideWidget = { activeId?: string; pinnedId?: string; @@ -221,9 +274,6 @@ interface IPropsWrapper extends IProps { actions: Array>; }; - // Hides the toolbar which includes the "Print Preview" button. - hideSecondaryToolbar?: boolean; - // If it's not passed then the sidebar is shown expanded and can't be collapsed. // If hidden is passed then it can't be expanded. // If it's set to true or false then it can be collapsed/expanded back. @@ -329,16 +379,11 @@ export class AuthoringIntegrationWrapper extends React.PureComponent activationResult?.contributions?.authoringTopbar2Widgets ?? []); - const secondaryToolbarWidgetsReady = defaultToolbarItems.concat(secondaryToolbarWidgetsFromExtensions) - .map((Component) => (props) => ); - return ( {(panelState, panelActions) => ( { this.authoringReactRef = component; }} @@ -359,7 +404,7 @@ export class AuthoringIntegrationWrapper extends React.PureComponent item.extra?.[fieldId] ?? null, }} - customHeader={((exposed) => { + headerToolbar={((exposed) => { const getProfileAndReinitialize = (item: IArticle) => this.props.authoringStorage.getContentProfile( item, @@ -374,13 +419,13 @@ export class AuthoringIntegrationWrapper extends React.PureComponent { - if (exposed.hasUnsavedChanges()) { - exposed.handleUnsavedChanges().then(() => { - getProfileAndReinitialize(item); - }); - } else { + const handledChanges = exposed.hasUnsavedChanges() + ? exposed.handleUnsavedChanges() + : Promise.resolve(); + + handledChanges.then(() => { getProfileAndReinitialize(item); - } + }); }} />
@@ -550,7 +595,18 @@ export class AuthoringIntegrationWrapper extends React.PureComponent )} - secondaryToolbarWidgets={secondaryToolbarWidgetsReady} + getSecondaryToolbarWidgets={(exposed) => [ + { + availableOffline: true, + component: () => ( + + ), + group: 'start', + priority: 1, + }, + ...secondaryToolbarWidgetsFromExtensions, + ...getAuthoringCosmeticActions(exposed), + ]} validateBeforeSaving={false} getSideWidgetIdAtIndex={(article, index) => { return getWidgetsFromExtensions(article)[index]._id; diff --git a/scripts/apps/authoring-react/authoring-react.tsx b/scripts/apps/authoring-react/authoring-react.tsx index 025ba84209..f2259c8406 100644 --- a/scripts/apps/authoring-react/authoring-react.tsx +++ b/scripts/apps/authoring-react/authoring-react.tsx @@ -1211,6 +1211,22 @@ export class AuthoringReact extends React.PureCo storageAdapter: storageAdapter, fieldsAdapter: fieldsAdapter, sideWidget: this.props.sideWidget?.activeId, + toggleTheme: () => { + this.setState({ + ...state, + proofreadingEnabled: !state.proofreadingEnabled, + }); + }, + printPreview: () => { + previewAuthoringEntity( + state.profile, + state.profile, + state.fieldsDataWithChanges, + ) + }, + configureTheme: () => { + this.showThemeConfigModal(state); + }, toggleSideWidget: (id) => { const activeWidgetId = this.props.sideWidget?.activeId; @@ -1343,53 +1359,23 @@ export class AuthoringReact extends React.PureCo }; } - const primaryToolbarWidgets: Array> = authoringOptions?.actions != null ? [ - ...authoringOptions.actions, - { + const primaryToolbarWidgets: Array> = authoringOptions.actions ?? []; + + if (authoringActions.length > 0) { + primaryToolbarWidgets.push({ group: 'end', priority: 0.4, - component: () => { - return ( - authoringActions} /> - ); - }, + component: () => ( + authoringActions} /> + ), availableOffline: true, - }, - ] : []; - - const printPreviewAction = (() => { - const execute = () => { - previewAuthoringEntity( - state.itemWithChanges, - state.profile, - state.fieldsDataWithChanges, - ); - }; - - const preview = { - jsxButton: () => { - return ( - { - execute(); - }} - /> - ); - }, - keybindings: { - 'ctrl+shift+i': () => { - execute(); - }, - }, - }; + }); + } - return preview; - })(); + const extraPrimaryToolbarWidgets = this.props.getAuthoringPrimaryToolbarWidgets?.(exposed) ?? []; + const secondaryToolbarWidgets = this.props.getSecondaryToolbarWidgets(exposed); const allKeyBindings: IKeyBindings = { - ...printPreviewAction.keybindings, ...getKeyBindingsFromActions(authoringOptions?.actions ?? []), ...keyBindingsFromAuthoringActions, ...widgetKeybindings, @@ -1429,79 +1415,37 @@ export class AuthoringReact extends React.PureCo {() => ( - - - ) - } + header={primaryToolbarWidgets.length < 1 + && extraPrimaryToolbarWidgets?.length < 1 ? null : ( + + + + )} main={( - {this.props.secondaryToolbarWidgets.map((Component, i) => ( - { - if (this.hasUnsavedChanges()) { - exposed.handleUnsavedChanges().then(() => { - this.reinitialize(state, item); - }); - } else { - this.reinitialize(state, item); - } - }} - item={state.itemWithChanges} - /> - ))} - - {printPreviewAction.jsxButton()} - {this.props.themingEnabled === true && ( - <> - { - this.setState({ - ...state, - proofreadingEnabled: - !state.proofreadingEnabled, - }); - }} - /> - { - this.showThemeConfigModal(state); - }} - /> - - )} - - -
+ toolBar={secondaryToolbarWidgets == null ? null : ( + + + )} headerPadding={{top: 8}} authoringHeader={(
void; } export class CreatedModifiedInfo extends React.PureComponent { render() { return (
- + - +
); } diff --git a/scripts/apps/authoring/authoring/authoring-topbar-react.tsx b/scripts/apps/authoring/authoring/authoring-topbar-react.tsx index 1d2ec72db0..3d64548765 100644 --- a/scripts/apps/authoring/authoring/authoring-topbar-react.tsx +++ b/scripts/apps/authoring/authoring/authoring-topbar-react.tsx @@ -84,7 +84,7 @@ export class AuthoringTopbarReact extends React.PureComponent { return ( > = [CreatedInfo, ModifiedInfo]; +const getDefaultToolbarItems = (item: IArticle): Array> => [{ + availableOffline: true, + component: () => ( + + ), + group: 'start', + priority: 1, +}, { + availableOffline: true, + component: () => ( + + ), + group: 'start', + priority: 2, +}]; interface IProps { article: IArticle; @@ -56,7 +75,7 @@ export class AuthoringTopbar2React extends React.PureComponent { return null; // fetching article from the server } - const articleDisplayWidgets = defaultToolbarItems.concat( + const articleDisplayWidgets = getDefaultToolbarItems(this.props.article).concat( flatMap( Object.values(extensions), (extension) => extension.activationResult?.contributions?.authoringTopbar2Widgets ?? [], @@ -67,19 +86,10 @@ export class AuthoringTopbar2React extends React.PureComponent { const articleUpdatedReference = {...this.props.article}; return ( -
- {articleDisplayWidgets.map( - (Component, i) => ( -
- -
- ), - )} -
+ ); } } diff --git a/scripts/apps/authoring/authoring/created-info.tsx b/scripts/apps/authoring/authoring/created-info.tsx index fd89b287da..d5399d1ebc 100644 --- a/scripts/apps/authoring/authoring/created-info.tsx +++ b/scripts/apps/authoring/authoring/created-info.tsx @@ -5,7 +5,7 @@ import {TimeElem} from 'apps/search/components/TimeElem'; import {dataApi} from 'core/helpers/CrudManager'; interface IProps { - article: IArticle; + entity: IArticle; } interface IState { @@ -27,7 +27,7 @@ export class CreatedInfo extends React.PureComponent { componentDidMount() { this._mounted = true; - dataApi.findOne('users', this.props.article.original_creator).then((user) => { + dataApi.findOne('users', this.props.entity.original_creator).then((user) => { if (this._mounted) { this.setState({user}); } @@ -37,7 +37,7 @@ export class CreatedInfo extends React.PureComponent { this._mounted = false; } render() { - const {article} = this.props; + const {entity} = this.props; const {user} = this.state; if (user == null) { @@ -48,7 +48,7 @@ export class CreatedInfo extends React.PureComponent {
{gettext('Created')}
{' '} -
+
{' '}
{gettext('by')}
{' '} diff --git a/scripts/apps/authoring/authoring/modified-info.tsx b/scripts/apps/authoring/authoring/modified-info.tsx index 9a095a5a39..e9ba87e194 100644 --- a/scripts/apps/authoring/authoring/modified-info.tsx +++ b/scripts/apps/authoring/authoring/modified-info.tsx @@ -4,14 +4,14 @@ import {gettext} from 'core/utils'; import {TimeElem} from 'apps/search/components/TimeElem'; interface IProps { - article: IArticle; + entity: IArticle; } export class ModifiedInfo extends React.PureComponent { render() { - const {article} = this.props; + const {entity} = this.props; - if (article.versioncreated == null) { + if (entity.versioncreated == null) { return null; } @@ -19,7 +19,7 @@ export class ModifiedInfo extends React.PureComponent {
{gettext('Modified')}
{' '} -
+
); } diff --git a/scripts/core/superdesk-api.d.ts b/scripts/core/superdesk-api.d.ts index f18baf2285..f378ce3807 100644 --- a/scripts/core/superdesk-api.d.ts +++ b/scripts/core/superdesk-api.d.ts @@ -147,6 +147,9 @@ declare module 'superdesk-api' { * we are passing a function instead. */ getLatestItem(options?: {preferIncomplete?: IStoreValueIncomplete}): T; + toggleTheme: () => void; + printPreview: () => void; + configureTheme: () => void; toggleSideWidget(id: string | null): void; contentProfile: IContentProfileV2; fieldsData: IFieldsData; @@ -161,7 +164,7 @@ declare module 'superdesk-api' { initiateClosing(): void; keepChangesAndClose(): void; stealLock(): void; - onChangeToolbarWidget(item: T): void; + reinitialize(item: T, profile?: IContentProfileV2): void; addValidationErrors(validationErrors: IAuthoringValidationErrors): void; } @@ -188,8 +191,6 @@ declare module 'superdesk-api' { */ resourceNames: Array; - // Hides the toolbar which includes the "Print Preview" button. - hideSecondaryToolbar?: boolean; getLanguage(entity: T): string; onClose(): void; authoringStorage: IAuthoringStorage; @@ -197,9 +198,10 @@ declare module 'superdesk-api' { fieldsAdapter: IFieldsAdapter; getActions?(options: IExposedFromAuthoring): Array; // three dots menu actions getInlineToolbarActions?(options: IExposedFromAuthoring): IAuthoringOptions; - getAuthoringPrimaryToolbarWidgets?( - options: IExposedFromAuthoring, - ): Array>; + + getAuthoringPrimaryToolbarWidgets?(options: IExposedFromAuthoring): Array>; + getSecondaryToolbarWidgets: (exposed: IExposedFromAuthoring) => Array>; + onEditingStart?(item: T): void; onEditingEnd?(item: T): void; @@ -211,12 +213,8 @@ declare module 'superdesk-api' { // used for side widgets getSidePanel?(options: IExposedFromAuthoring, readOnly: boolean): React.ReactNode; - secondaryToolbarWidgets: Array>; - customHeader?: (options: IExposedFromAuthoring) => Array>; + headerToolbar?: (options: IExposedFromAuthoring) => Array>; disableWidgetPinning?: boolean; // defaults to false @@ -238,11 +236,7 @@ declare module 'superdesk-api' { ): IFieldsData; validateBeforeSaving?: boolean; // will block saving if invalid. defaults to true - headerCollapsed?: boolean; // initial value - - themingEnabled?: boolean; // only works with article; default false - autoFocus?: boolean; // defaults to true; will focus first input } @@ -763,22 +757,14 @@ declare module 'superdesk-api' { articleGridItemWidgets?: Array>; /** - * Display custom components at the top of authoring panel + * First toolbar of authoring panel */ - authoringTopbarWidgets?: Array<{ - component: React.ComponentType<{article: IArticle}>; - availableOffline: boolean; - priority: IDisplayPriority; - group: 'start' | 'middle' | 'end'; - }>; + authoringTopbarWidgets?: Array>; /** - * Display custom components in the second toolbar in authoring panel + * Second toolbar of authoring panel */ - authoringTopbar2Widgets?: Array void; - }>>; + authoringTopbar2Widgets?: Array>; authoringSideWidgets?: Array; From a5ef6ab2d1e9d2a4e47ff64d91fac31f4e7aeaad Mon Sep 17 00:00:00 2001 From: Konstantin Markov Date: Wed, 13 Nov 2024 14:44:10 +0200 Subject: [PATCH 07/35] Lint --- .../authoring-integration-wrapper.tsx | 27 ++++++++----------- .../apps/authoring-react/authoring-react.tsx | 26 +++++++++--------- .../authoring/authoring-topbar2-react.tsx | 2 ++ scripts/core/superdesk-api.d.ts | 2 +- .../src/rundown-templates/template-edit.tsx | 1 - .../src/rundowns/rundown-view-edit.tsx | 1 - 6 files changed, 28 insertions(+), 31 deletions(-) diff --git a/scripts/apps/authoring-react/authoring-integration-wrapper.tsx b/scripts/apps/authoring-react/authoring-integration-wrapper.tsx index 8739f06acf..a6baa0bbf3 100644 --- a/scripts/apps/authoring-react/authoring-integration-wrapper.tsx +++ b/scripts/apps/authoring-react/authoring-integration-wrapper.tsx @@ -1,5 +1,6 @@ /* eslint-disable react/no-multi-comp */ /* eslint-disable no-case-declarations */ +/* eslint-disable react/display-name */ import React from 'react'; import { IArticle, @@ -70,11 +71,9 @@ const getAuthoringCosmeticActions = (exposed: IExposedFromAuthoring): ), group: 'end', priority: 1, - keyBindings: { - 'ctrl+shift+i': () => { - exposed.printPreview(); - } - }, + keyBindings: {'ctrl+shift+i': () => { + exposed.printPreview(); + }}, }, { availableOffline: true, @@ -89,11 +88,9 @@ const getAuthoringCosmeticActions = (exposed: IExposedFromAuthoring): ), group: 'end', priority: 2, - keyBindings: { - 'ctrl+shift+t': () => { - exposed.toggleTheme(); - } - } + keyBindings: {'ctrl+shift+t': () => { + exposed.toggleTheme(); + }}, }, { availableOffline: true, @@ -108,11 +105,9 @@ const getAuthoringCosmeticActions = (exposed: IExposedFromAuthoring): ), group: 'end', priority: 3, - keyBindings: { - 'ctrl+shift+c': () => { - exposed.configureTheme(); - } - }, + keyBindings: {'ctrl+shift+c': () => { + exposed.configureTheme(); + }}, }]; export type ISideWidget = { @@ -433,7 +428,7 @@ export class AuthoringIntegrationWrapper extends React.PureComponent article.language ?? 'en'} onEditingStart={(article) => { diff --git a/scripts/apps/authoring-react/authoring-react.tsx b/scripts/apps/authoring-react/authoring-react.tsx index f2259c8406..09a26b0361 100644 --- a/scripts/apps/authoring-react/authoring-react.tsx +++ b/scripts/apps/authoring-react/authoring-react.tsx @@ -1222,7 +1222,7 @@ export class AuthoringReact extends React.PureCo state.profile, state.profile, state.fieldsDataWithChanges, - ) + ); }, configureTheme: () => { this.showThemeConfigModal(state); @@ -1373,9 +1373,10 @@ export class AuthoringReact extends React.PureCo } const extraPrimaryToolbarWidgets = this.props.getAuthoringPrimaryToolbarWidgets?.(exposed) ?? []; - const secondaryToolbarWidgets = this.props.getSecondaryToolbarWidgets(exposed); + const secondaryToolbarWidgets = this.props.getSecondaryToolbarWidgets?.(exposed) ?? []; const allKeyBindings: IKeyBindings = { + ...getKeyBindingsFromActions(secondaryToolbarWidgets), ...getKeyBindingsFromActions(authoringOptions?.actions ?? []), ...keyBindingsFromAuthoringActions, ...widgetKeybindings, @@ -1417,22 +1418,23 @@ export class AuthoringReact extends React.PureCo - - - )} + + + + ) + } main={( + ): IAuthoringOptions; getAuthoringPrimaryToolbarWidgets?(options: IExposedFromAuthoring): Array>; - getSecondaryToolbarWidgets: (exposed: IExposedFromAuthoring) => Array>; + getSecondaryToolbarWidgets?: (exposed: IExposedFromAuthoring) => Array>; onEditingStart?(item: T): void; onEditingEnd?(item: T): void; diff --git a/scripts/extensions/broadcasting/src/rundown-templates/template-edit.tsx b/scripts/extensions/broadcasting/src/rundown-templates/template-edit.tsx index 377f9de1c9..7bcaf7a146 100644 --- a/scripts/extensions/broadcasting/src/rundown-templates/template-edit.tsx +++ b/scripts/extensions/broadcasting/src/rundown-templates/template-edit.tsx @@ -600,7 +600,6 @@ export class RundownTemplateViewEdit extends React.PureComponent }} getSideWidgetIdAtIndex={() => ''} getAuthoringPrimaryToolbarWidgets={() => []} - secondaryToolbarWidgets={[]} disableWidgetPinning /> ) diff --git a/scripts/extensions/broadcasting/src/rundowns/rundown-view-edit.tsx b/scripts/extensions/broadcasting/src/rundowns/rundown-view-edit.tsx index 8d8ebd4967..03b74eba49 100644 --- a/scripts/extensions/broadcasting/src/rundowns/rundown-view-edit.tsx +++ b/scripts/extensions/broadcasting/src/rundowns/rundown-view-edit.tsx @@ -665,7 +665,6 @@ export class RundownViewEditComponent extends React.PureComponent []} - secondaryToolbarWidgets={[]} getSidebarWidgetsCount={({item}) => { return getAvailableSideWidgets(item).length; }} From 5ddb0b3e2fa50f04946b8f5f93ad6aaff6ba33a9 Mon Sep 17 00:00:00 2001 From: Konstantin Markov Date: Wed, 13 Nov 2024 15:13:42 +0200 Subject: [PATCH 08/35] Fix more lint issues --- scripts/core/superdesk-api.d.ts | 4 ++-- scripts/extensions/markForUser/src/show-marked-user.tsx | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/core/superdesk-api.d.ts b/scripts/core/superdesk-api.d.ts index 3cf0b9138a..fc1b03767d 100644 --- a/scripts/core/superdesk-api.d.ts +++ b/scripts/core/superdesk-api.d.ts @@ -753,8 +753,8 @@ declare module 'superdesk-api' { editor3?: { annotationInputTabs?: Array; } - articleListItemWidgets?: Array>; - articleGridItemWidgets?: Array>; + articleListItemWidgets?: Array['component']>; + articleGridItemWidgets?: Array['component']>; /** * First toolbar of authoring panel diff --git a/scripts/extensions/markForUser/src/show-marked-user.tsx b/scripts/extensions/markForUser/src/show-marked-user.tsx index 9db20d0c94..3067a9c7b9 100644 --- a/scripts/extensions/markForUser/src/show-marked-user.tsx +++ b/scripts/extensions/markForUser/src/show-marked-user.tsx @@ -6,19 +6,19 @@ export function getDisplayMarkedUserComponent(superdesk: ISuperdesk) { const {UserAvatar} = superdesk.components; const {hasPrivilege} = superdesk.privileges; - return class DisplayMarkedUser extends React.PureComponent<{article: IArticle}> { + return class DisplayMarkedUser extends React.PureComponent<{entity: IArticle}> { render() { - if (this.props.article.marked_for_user == null) { + if (this.props.entity.marked_for_user == null) { return null; } else { return ( ); } From 7f632fcc8538c9b7cb8f6e22ca6e250413fcdbb1 Mon Sep 17 00:00:00 2001 From: Konstantin Markov Date: Wed, 13 Nov 2024 15:29:29 +0200 Subject: [PATCH 09/35] Don't render collapse header button if header has no fields defined --- package-lock.json | 6 +++--- package.json | 2 +- .../apps/authoring-react/authoring-react.tsx | 20 ++++++++++++------- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index b798a3f603..19fefedbf1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13955,9 +13955,9 @@ } }, "superdesk-ui-framework": { - "version": "3.1.28", - "resolved": "https://registry.npmjs.org/superdesk-ui-framework/-/superdesk-ui-framework-3.1.28.tgz", - "integrity": "sha512-H/DE7gcJviHE5jR2vhuiTB2WLUxmpFstomFoEHWE5zGDqkcqGyPZUwRrwDTvtZLnMuMZXj1czeShbhJr9AxMhg==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/superdesk-ui-framework/-/superdesk-ui-framework-4.0.1.tgz", + "integrity": "sha512-Ft1uL6iayL1CEEUH5IkPbMNnSseTgSHENGKXQ0NAxGUtbbpIOKno/lENuqSahqbMv0sHWQbbGG7YUOrhACI3xQ==", "requires": { "@popperjs/core": "^2.4.0", "@superdesk/common": "0.0.28", diff --git a/package.json b/package.json index 4ec785dce4..6f01d0d6d0 100644 --- a/package.json +++ b/package.json @@ -123,7 +123,7 @@ "sass-loader": "6.0.6", "shortid": "2.2.8", "style-loader": "0.20.2", - "superdesk-ui-framework": "^3.1.28", + "superdesk-ui-framework": "^4.0.1", "ts-loader": "3.5.0", "typescript": "4.9.5", "uuid": "8.3.1", diff --git a/scripts/apps/authoring-react/authoring-react.tsx b/scripts/apps/authoring-react/authoring-react.tsx index 09a26b0361..9b94dded0e 100644 --- a/scripts/apps/authoring-react/authoring-react.tsx +++ b/scripts/apps/authoring-react/authoring-react.tsx @@ -1431,9 +1431,10 @@ export class AuthoringReact extends React.PureCo main={( extends React.PureCo /> )} - headerPadding={{top: 8}} + headerPadding={{ + top: 8, + bottom: state.profile.header.count() < 1 ? 8 : undefined, + }} authoringHeader={(
- + {this.props.headerToolbar != null && ( + + )} Date: Wed, 13 Nov 2024 15:35:13 +0200 Subject: [PATCH 10/35] Fix secondary toolbar --- scripts/apps/authoring-react/authoring-react.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/apps/authoring-react/authoring-react.tsx b/scripts/apps/authoring-react/authoring-react.tsx index 9b94dded0e..a8dd10e506 100644 --- a/scripts/apps/authoring-react/authoring-react.tsx +++ b/scripts/apps/authoring-react/authoring-react.tsx @@ -1434,7 +1434,7 @@ export class AuthoringReact extends React.PureCo hideCollapseButton={state.profile.header.count() < 1} headerCollapsed={this.props.headerCollapsed} toolbarCustom - toolBar={null == null ? null : ( + toolBar={secondaryToolbarWidgets.length === 0 ? null : ( Date: Wed, 13 Nov 2024 15:43:27 +0200 Subject: [PATCH 11/35] More lint fixes --- scripts/apps/search/components/ListItemInfo.tsx | 8 +++----- scripts/apps/search/components/PhotoDeskInfo.tsx | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/scripts/apps/search/components/ListItemInfo.tsx b/scripts/apps/search/components/ListItemInfo.tsx index a8599928ff..660491d822 100644 --- a/scripts/apps/search/components/ListItemInfo.tsx +++ b/scripts/apps/search/components/ListItemInfo.tsx @@ -76,11 +76,9 @@ export class ListItemInfo extends React.PureComponent { { articleDisplayWidgets.length < 1 ? null : (
- { - articleDisplayWidgets.map((Component, i) => - , - ) - } + {articleDisplayWidgets.map((Component, i) => + , + )}
) } diff --git a/scripts/apps/search/components/PhotoDeskInfo.tsx b/scripts/apps/search/components/PhotoDeskInfo.tsx index d728aba908..158651396b 100644 --- a/scripts/apps/search/components/PhotoDeskInfo.tsx +++ b/scripts/apps/search/components/PhotoDeskInfo.tsx @@ -45,7 +45,7 @@ export const PhotoDeskInfo: React.StatelessComponent = (props) => {
{ articleDisplayWidgets.map((Component, i) => - , + , ) }
From a4c889cadba3d7d5f24983b86dd78188194b84bc Mon Sep 17 00:00:00 2001 From: Konstantin Markov Date: Wed, 13 Nov 2024 16:28:35 +0200 Subject: [PATCH 12/35] Fix lint --- scripts/apps/archive/controllers/file-upload-error-modal.tsx | 1 - scripts/apps/archive/show-spike-dialog.tsx | 1 - .../versions-and-item-history/transmission-details.tsx | 1 - .../apps/authoring-react/authoring-angular-integration.tsx | 2 -- .../authoring-react/compare-articles/compare-articles.tsx | 1 - scripts/apps/authoring-react/multi-edit-modal.tsx | 3 --- .../apps/authoring-react/toolbar/compare-article-versions.tsx | 1 - scripts/apps/authoring-react/toolbar/export-modal.tsx | 1 - scripts/apps/authoring-react/toolbar/highlights-modal.tsx | 1 - .../toolbar/mark-for-desks/mark-for-desks-modal.tsx | 1 - .../authoring-react/toolbar/multi-edit-toolbar-action.tsx | 2 -- .../apps/authoring-react/toolbar/proofreading-theme-modal.tsx | 1 - scripts/apps/authoring-react/toolbar/template-modal.tsx | 1 - scripts/apps/authoring-react/toolbar/translate-modal.tsx | 1 - scripts/apps/authoring/attachments/AttachmentsEditorModal.tsx | 1 - scripts/apps/authoring/attachments/UploadAttachmentsModal.tsx | 1 - .../authoring/components/CharacterCountConfigButton.tsx | 1 - .../authoring/components/publish-warning-confirm-modal.tsx | 1 - .../authoring/components/unpublish-confirm-modal.tsx | 1 - .../apps/authoring/authoring/services/quick-publish-modal.tsx | 1 - .../components/SetHighlightsForMultipleArticlesModal.tsx | 1 - .../apps/ingest/directives/authenticate-ingest-provider.tsx | 1 - scripts/apps/publish-preview/previewModal.tsx | 1 - scripts/apps/search/components/fields/authors.tsx | 1 - scripts/apps/search/controllers/get-bulk-actions.tsx | 1 - scripts/apps/vocabularies/components/UploadConfigModal.tsx | 1 - .../apps/workspace/content/components/new-field-select.tsx | 1 - .../workspace/content/views/FormattingOptionsMultiSelect.tsx | 1 - scripts/core/ArticlesListByQueryWithFilters.tsx | 4 ++-- scripts/core/editor3/components/toolbar/index.tsx | 1 - .../subcomponents/publishing-target-select.tsx | 1 - scripts/core/services/modalService.tsx | 1 - scripts/core/ui-utils.tsx | 1 - scripts/core/ui/components/IgnoreCancelSaveDialog.tsx | 1 - scripts/core/ui/components/Modal/ModalPrompt.tsx | 1 - scripts/core/ui/components/MultiSelectTreeWithTemplate.tsx | 2 -- .../generic-form/input-types/select_multiple_values.tsx | 1 - scripts/core/ui/components/modal-simple.tsx | 1 - scripts/core/ui/components/options-modal.tsx | 1 - scripts/core/ui/components/select-filterable.tsx | 1 - scripts/core/ui/show-confirmation-prompt.tsx | 1 - scripts/validate-instance-configuration.tsx | 1 - 42 files changed, 2 insertions(+), 48 deletions(-) diff --git a/scripts/apps/archive/controllers/file-upload-error-modal.tsx b/scripts/apps/archive/controllers/file-upload-error-modal.tsx index 7fce2bd3f6..6f2aa6af37 100644 --- a/scripts/apps/archive/controllers/file-upload-error-modal.tsx +++ b/scripts/apps/archive/controllers/file-upload-error-modal.tsx @@ -24,7 +24,6 @@ export function fileUploadErrorModal( return ( ( openModal( { showModal(({closeModal}) => ( @@ -450,7 +449,6 @@ function getInlineToolbarActions( component: () => ( <> extends React.PureComponent, return ( { priority: 0.1, component: () => ( { const leaf: IMenuItem = { @@ -205,7 +204,6 @@ export class MultiEditModal extends React.PureComponent { return ( { {availableArticles.length > 0 && (
{ const leaf: IMenuItem = { onClick: () => this.add(a._id), diff --git a/scripts/apps/authoring-react/toolbar/compare-article-versions.tsx b/scripts/apps/authoring-react/toolbar/compare-article-versions.tsx index 1344f23f9f..14adfbb14b 100644 --- a/scripts/apps/authoring-react/toolbar/compare-article-versions.tsx +++ b/scripts/apps/authoring-react/toolbar/compare-article-versions.tsx @@ -126,7 +126,6 @@ export class CompareArticleVersionsModal extends React.PureComponent diff --git a/scripts/apps/authoring-react/toolbar/export-modal.tsx b/scripts/apps/authoring-react/toolbar/export-modal.tsx index 10e3963bb1..8905ba073c 100644 --- a/scripts/apps/authoring-react/toolbar/export-modal.tsx +++ b/scripts/apps/authoring-react/toolbar/export-modal.tsx @@ -79,7 +79,6 @@ export class ExportModal extends React.PureComponent { size="medium" onHide={this.props.closeModal} visible - zIndex={1050} headerTemplate={gettext('Export')} > diff --git a/scripts/apps/authoring-react/toolbar/highlights-modal.tsx b/scripts/apps/authoring-react/toolbar/highlights-modal.tsx index a071d3658b..7029780661 100644 --- a/scripts/apps/authoring-react/toolbar/highlights-modal.tsx +++ b/scripts/apps/authoring-react/toolbar/highlights-modal.tsx @@ -69,7 +69,6 @@ export class HighlightsModal extends React.PureComponent { return ( { return ( { return ( { label="" inlineLabel labelHidden - zIndex={1050} optionLabel={(article) => getArticleLabel(article)} value={this.state.selectedArticles} onChange={(values) => { diff --git a/scripts/apps/authoring-react/toolbar/proofreading-theme-modal.tsx b/scripts/apps/authoring-react/toolbar/proofreading-theme-modal.tsx index fd2ded06d3..04ff5cb332 100644 --- a/scripts/apps/authoring-react/toolbar/proofreading-theme-modal.tsx +++ b/scripts/apps/authoring-react/toolbar/proofreading-theme-modal.tsx @@ -84,7 +84,6 @@ export class ProofreadingThemeModal extends React.Component { return ( { visible onHide={() => this.props.closeModal()} size="medium" - zIndex={1050} headerTemplate={gettext('Save as template')} > diff --git a/scripts/apps/authoring-react/toolbar/translate-modal.tsx b/scripts/apps/authoring-react/toolbar/translate-modal.tsx index 6c00d80dd0..26879b2846 100644 --- a/scripts/apps/authoring-react/toolbar/translate-modal.tsx +++ b/scripts/apps/authoring-react/toolbar/translate-modal.tsx @@ -97,7 +97,6 @@ export class TranslateModal extends React.PureComponent { visible onHide={() => this.props.closeModal()} size="small" - zIndex={1050} headerTemplate={gettext('Translate')} > diff --git a/scripts/apps/authoring/attachments/AttachmentsEditorModal.tsx b/scripts/apps/authoring/attachments/AttachmentsEditorModal.tsx index 3c64a7e7ba..03a83de2c3 100644 --- a/scripts/apps/authoring/attachments/AttachmentsEditorModal.tsx +++ b/scripts/apps/authoring/attachments/AttachmentsEditorModal.tsx @@ -35,7 +35,6 @@ export class AttachmentsEditorModal extends React.Component { return ( return ( ): Promise { return ( , deskId: { return ( { title={gettext('Authors')} placement="bottom-end" triggerSelector="#more-authors-button" - zIndex={1031} > diff --git a/scripts/apps/search/controllers/get-bulk-actions.tsx b/scripts/apps/search/controllers/get-bulk-actions.tsx index 68fe5e7f9c..f7c427aede 100644 --- a/scripts/apps/search/controllers/get-bulk-actions.tsx +++ b/scripts/apps/search/controllers/get-bulk-actions.tsx @@ -159,7 +159,6 @@ export function getBulkActions( onTrigger: () => { showModal(({closeModal}) => ( { : <>{label}; }} getLabel={({label}) => label} - zIndex={1050} getOptions={() => availableFields .map((field) => ({ value: field, diff --git a/scripts/apps/workspace/content/views/FormattingOptionsMultiSelect.tsx b/scripts/apps/workspace/content/views/FormattingOptionsMultiSelect.tsx index b3c8a6fa8e..c0eaef2283 100644 --- a/scripts/apps/workspace/content/views/FormattingOptionsMultiSelect.tsx +++ b/scripts/apps/workspace/content/views/FormattingOptionsMultiSelect.tsx @@ -34,7 +34,6 @@ export class FormattingOptionsTreeSelect extends React.Component { label={gettext('Formatting options')} labelHidden inlineLabel - zIndex={1051} /> ); } diff --git a/scripts/core/ArticlesListByQueryWithFilters.tsx b/scripts/core/ArticlesListByQueryWithFilters.tsx index 9e057c4ab5..41030e3aec 100644 --- a/scripts/core/ArticlesListByQueryWithFilters.tsx +++ b/scripts/core/ArticlesListByQueryWithFilters.tsx @@ -230,7 +230,7 @@ export class ArticlesListByQueryWithFilters extends React.PureComponent {(dimensions) => ( - + {getTypeFilteringComponent(dimensions.width < COMPACT_WIDTH)} { return (
- +

{ return (
options} getLabel={(item) => item} getId={(item) => item} diff --git a/scripts/core/interactive-article-actions-panel/subcomponents/publishing-target-select.tsx b/scripts/core/interactive-article-actions-panel/subcomponents/publishing-target-select.tsx index 7b27357ced..765645e291 100644 --- a/scripts/core/interactive-article-actions-panel/subcomponents/publishing-target-select.tsx +++ b/scripts/core/interactive-article-actions-panel/subcomponents/publishing-target-select.tsx @@ -107,7 +107,6 @@ export class PublishingTargetSelect extends React.PureComponent
{message} diff --git a/scripts/core/ui/components/IgnoreCancelSaveDialog.tsx b/scripts/core/ui/components/IgnoreCancelSaveDialog.tsx index d7af417221..36e56fac06 100644 --- a/scripts/core/ui/components/IgnoreCancelSaveDialog.tsx +++ b/scripts/core/ui/components/IgnoreCancelSaveDialog.tsx @@ -45,7 +45,6 @@ class IgnoreCancelSaveDialog extends React.PureComponent { return ( { return ( extends React.PureComponent ); } else if (props.kind === 'asynchronous') { @@ -90,7 +89,6 @@ export class MultiSelectTreeWithTemplate extends React.PureComponent } allowMultiple={this.props.allowMultiple} readOnly={this.props.readOnly} - zIndex={1051} /> ); } else { diff --git a/scripts/core/ui/components/generic-form/input-types/select_multiple_values.tsx b/scripts/core/ui/components/generic-form/input-types/select_multiple_values.tsx index f08efa1434..cc4e3f7c1b 100644 --- a/scripts/core/ui/components/generic-form/input-types/select_multiple_values.tsx +++ b/scripts/core/ui/components/generic-form/input-types/select_multiple_values.tsx @@ -71,7 +71,6 @@ export class SelectMultipleValues extends React.Component { label={this.props.formField.label} inlineLabel labelHidden - zIndex={1051} data-test-id={this.props.formField.component_parameters?.dataTestId} /> diff --git a/scripts/core/ui/components/modal-simple.tsx b/scripts/core/ui/components/modal-simple.tsx index f3f4ff6e57..6842b5f580 100644 --- a/scripts/core/ui/components/modal-simple.tsx +++ b/scripts/core/ui/components/modal-simple.tsx @@ -18,7 +18,6 @@ export class ModalSimple extends React.PureComponent { return ( this.props.closeModal()} diff --git a/scripts/core/ui/components/options-modal.tsx b/scripts/core/ui/components/options-modal.tsx index 425643f2b4..2f70f81186 100644 --- a/scripts/core/ui/components/options-modal.tsx +++ b/scripts/core/ui/components/options-modal.tsx @@ -33,7 +33,6 @@ export function showOptionsModal(title: string, message: string, options: Array< return ( extends React.PureComponent> { getId={getLabel} required={required} disabled={disabled} - zIndex={zIndex} data-test-id={this.props['data-test-id']} inputWidth="100%" /> diff --git a/scripts/core/ui/show-confirmation-prompt.tsx b/scripts/core/ui/show-confirmation-prompt.tsx index f66e006927..47186f36cb 100644 --- a/scripts/core/ui/show-confirmation-prompt.tsx +++ b/scripts/core/ui/show-confirmation-prompt.tsx @@ -14,7 +14,6 @@ export function showConfirmationPrompt({title, message}: {title: string; message closeModal(); resolve(false); }} - zIndex={2001} headerTemplate={title} footerTemplate={( diff --git a/scripts/validate-instance-configuration.tsx b/scripts/validate-instance-configuration.tsx index b01343228d..288d7197ab 100644 --- a/scripts/validate-instance-configuration.tsx +++ b/scripts/validate-instance-configuration.tsx @@ -71,7 +71,6 @@ export function maybeDisplayInvalidInstanceConfigurationMessage() { )} onHide={closeModal} - zIndex={9999} > {error.content} From 1a18bf61a3cdc9fe3784ac54f96dc12b3feada6b Mon Sep 17 00:00:00 2001 From: Konstantin Markov Date: Thu, 14 Nov 2024 11:33:17 +0200 Subject: [PATCH 13/35] Lint fix --- .../ai-widget/src/translations/translations-footer.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/extensions/ai-widget/src/translations/translations-footer.tsx b/scripts/extensions/ai-widget/src/translations/translations-footer.tsx index 3be3b6fab6..9a1f684c40 100644 --- a/scripts/extensions/ai-widget/src/translations/translations-footer.tsx +++ b/scripts/extensions/ai-widget/src/translations/translations-footer.tsx @@ -64,7 +64,6 @@ export default class TranslationFooter extends React.Component { getId={({_id}) => _id} valueTemplate={({label}) => {gettext('To: {{ language }}', {language: label})}} getLabel={({label}) => label} - zIndex={1050} getOptions={() => availableLanguages.map((language) => ({value: language}))} kind="synchronous" onChange={(value) => { From 34b05390e8df911b5c941278e13752f61314ae86 Mon Sep 17 00:00:00 2001 From: Konstantin Markov Date: Thu, 14 Nov 2024 11:55:24 +0200 Subject: [PATCH 14/35] test fix --- scripts/apps/authoring-react/article-adapter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/apps/authoring-react/article-adapter.ts b/scripts/apps/authoring-react/article-adapter.ts index 542c7ac06a..23f847dced 100644 --- a/scripts/apps/authoring-react/article-adapter.ts +++ b/scripts/apps/authoring-react/article-adapter.ts @@ -25,7 +25,7 @@ interface IAuthoringReactArticleAdapter { * to prevent duplicate IDs, thus prefixing was never necessary. Adapter removes the prefixes. */ export function getArticleAdapter(): IAuthoringReactArticleAdapter { - const customFieldVocabularies = sdApi.vocabularies.getCustomFieldVocabularies(); + const customFieldVocabularies = sdApi.vocabularies.getCustomFieldVocabularies?.() ?? []; const oldFormatCustomFieldIds: Set = new Set( customFieldVocabularies From 1ca8807c92d3117098ff01902bee44ecc737ba6f Mon Sep 17 00:00:00 2001 From: Konstantin Markov Date: Thu, 14 Nov 2024 12:07:25 +0200 Subject: [PATCH 15/35] One more fix --- scripts/apps/authoring-react/field-adapters/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/apps/authoring-react/field-adapters/index.tsx b/scripts/apps/authoring-react/field-adapters/index.tsx index 34c0c6f2d9..8a2fc6f9bc 100644 --- a/scripts/apps/authoring-react/field-adapters/index.tsx +++ b/scripts/apps/authoring-react/field-adapters/index.tsx @@ -182,7 +182,7 @@ export function storeEditor3ValueBase( * to {@link IAuthoringFieldV2} */ export function getFieldsAdapter(authoringStorage: IAuthoringStorage): IFieldsAdapter { - const customFieldVocabularies = sdApi.vocabularies.getCustomFieldVocabularies(); + const customFieldVocabularies = sdApi.vocabularies.getCustomFieldVocabularies?.() ?? []; const adapter: IFieldsAdapter = getBaseFieldsAdapter(); for (const vocabulary of customFieldVocabularies) { From 6e7290f2664a022048ad08282bd778256882d8a6 Mon Sep 17 00:00:00 2001 From: Tomas Kikutis Date: Thu, 14 Nov 2024 13:15:03 +0100 Subject: [PATCH 16/35] fix unit tests --- scripts/apps/authoring-react/field-adapters/index.spec.ts | 1 + scripts/apps/authoring/tests/authoring.spec.ts | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/apps/authoring-react/field-adapters/index.spec.ts b/scripts/apps/authoring-react/field-adapters/index.spec.ts index 942e061efc..82d42325e6 100644 --- a/scripts/apps/authoring-react/field-adapters/index.spec.ts +++ b/scripts/apps/authoring-react/field-adapters/index.spec.ts @@ -36,6 +36,7 @@ describe('field adapters', () => { return testVocabularies; }, + getCustomFieldVocabularies: () => [], getVocabularyItemLabel: (term) => term.name, }; diff --git a/scripts/apps/authoring/tests/authoring.spec.ts b/scripts/apps/authoring/tests/authoring.spec.ts index 8971537ff5..95d7fc6e41 100644 --- a/scripts/apps/authoring/tests/authoring.spec.ts +++ b/scripts/apps/authoring/tests/authoring.spec.ts @@ -1857,8 +1857,9 @@ describe('authoring container directive', () => { })); describe('authoring embed directive', () => { - beforeEach(inject(($templateCache) => { + beforeEach(inject(($templateCache, preferencesService) => { $templateCache.put('scripts/apps/authoring/views/authoring.html', '
'); + spyOn(preferencesService, 'getSync').and.returnValue(null); })); it('applies kill template', From 539ab62c7161aef99a68e086749b006b99fa38ad Mon Sep 17 00:00:00 2001 From: Konstantin Markov Date: Thu, 14 Nov 2024 14:21:17 +0200 Subject: [PATCH 17/35] Remove fix --- scripts/apps/authoring-react/article-adapter.ts | 2 +- scripts/apps/authoring-react/field-adapters/index.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/apps/authoring-react/article-adapter.ts b/scripts/apps/authoring-react/article-adapter.ts index 23f847dced..542c7ac06a 100644 --- a/scripts/apps/authoring-react/article-adapter.ts +++ b/scripts/apps/authoring-react/article-adapter.ts @@ -25,7 +25,7 @@ interface IAuthoringReactArticleAdapter { * to prevent duplicate IDs, thus prefixing was never necessary. Adapter removes the prefixes. */ export function getArticleAdapter(): IAuthoringReactArticleAdapter { - const customFieldVocabularies = sdApi.vocabularies.getCustomFieldVocabularies?.() ?? []; + const customFieldVocabularies = sdApi.vocabularies.getCustomFieldVocabularies(); const oldFormatCustomFieldIds: Set = new Set( customFieldVocabularies diff --git a/scripts/apps/authoring-react/field-adapters/index.tsx b/scripts/apps/authoring-react/field-adapters/index.tsx index 8a2fc6f9bc..34c0c6f2d9 100644 --- a/scripts/apps/authoring-react/field-adapters/index.tsx +++ b/scripts/apps/authoring-react/field-adapters/index.tsx @@ -182,7 +182,7 @@ export function storeEditor3ValueBase( * to {@link IAuthoringFieldV2} */ export function getFieldsAdapter(authoringStorage: IAuthoringStorage): IFieldsAdapter { - const customFieldVocabularies = sdApi.vocabularies.getCustomFieldVocabularies?.() ?? []; + const customFieldVocabularies = sdApi.vocabularies.getCustomFieldVocabularies(); const adapter: IFieldsAdapter = getBaseFieldsAdapter(); for (const vocabulary of customFieldVocabularies) { From 0334e1b8508242247b68efae9c71044096c9aa25 Mon Sep 17 00:00:00 2001 From: Konstantin Markov Date: Thu, 14 Nov 2024 14:42:31 +0200 Subject: [PATCH 18/35] Remove zIndex --- .../src/ImageTaggingComponent/ImageTaggingComponent.tsx | 1 - scripts/extensions/auto-tagging-widget/src/auto-tagging.tsx | 1 - 2 files changed, 2 deletions(-) diff --git a/scripts/extensions/auto-tagging-widget/src/ImageTaggingComponent/ImageTaggingComponent.tsx b/scripts/extensions/auto-tagging-widget/src/ImageTaggingComponent/ImageTaggingComponent.tsx index 9bc3c2077b..dcea4fab15 100644 --- a/scripts/extensions/auto-tagging-widget/src/ImageTaggingComponent/ImageTaggingComponent.tsx +++ b/scripts/extensions/auto-tagging-widget/src/ImageTaggingComponent/ImageTaggingComponent.tsx @@ -293,7 +293,6 @@ export class ImageTagging extends React.PureComponent { title={gettext('Information')} placement="bottom-end" triggerSelector="#image-suggestions-info-btn" - zIndex={999} > {gettext( 'Image suggestions are based on generated tags' diff --git a/scripts/extensions/auto-tagging-widget/src/auto-tagging.tsx b/scripts/extensions/auto-tagging-widget/src/auto-tagging.tsx index d22d72a715..fe4344ecf8 100644 --- a/scripts/extensions/auto-tagging-widget/src/auto-tagging.tsx +++ b/scripts/extensions/auto-tagging-widget/src/auto-tagging.tsx @@ -103,7 +103,6 @@ function showImatricsServiceErrorModal(superdesk: ISuperdesk, errors: Array ( Date: Thu, 14 Nov 2024 15:07:32 +0200 Subject: [PATCH 19/35] Final fix --- scripts/extensions/broadcasting/src/page.tsx | 5 ++--- .../src/rundown-templates/manage-rundown-templates.tsx | 1 - .../src/rundowns/create-rundown-from-template.tsx | 1 - .../broadcasting/src/rundowns/manage-rundown-items.tsx | 2 +- .../extensions/broadcasting/src/rundowns/rundowns-list.tsx | 5 +---- .../broadcasting/src/shows/create-show-after-modal.tsx | 1 - .../extensions/broadcasting/src/shows/create-show-modal.tsx | 1 - .../extensions/markForUser/src/get-mark-for-user-modal.tsx | 1 - .../extensions/sams/src/components/sets/manageSetsModal.tsx | 2 +- scripts/extensions/sams/src/components/workspaceSubnav.tsx | 6 +++--- 10 files changed, 8 insertions(+), 17 deletions(-) diff --git a/scripts/extensions/broadcasting/src/page.tsx b/scripts/extensions/broadcasting/src/page.tsx index 2eeda1fa9c..80df2bc52b 100644 --- a/scripts/extensions/broadcasting/src/page.tsx +++ b/scripts/extensions/broadcasting/src/page.tsx @@ -187,7 +187,7 @@ export class RundownsPage extends React.PureComponent { - + { onHide={() => { closeModal(); }} - zIndex={1050} > @@ -296,7 +295,7 @@ export class RundownsPage extends React.PureComponent { - + this.props.closeModal(); } }} - zIndex={1050} > diff --git a/scripts/extensions/broadcasting/src/rundowns/create-rundown-from-template.tsx b/scripts/extensions/broadcasting/src/rundowns/create-rundown-from-template.tsx index 35e404bd7f..ce43fafd7b 100644 --- a/scripts/extensions/broadcasting/src/rundowns/create-rundown-from-template.tsx +++ b/scripts/extensions/broadcasting/src/rundowns/create-rundown-from-template.tsx @@ -105,7 +105,6 @@ export class CreateRundownFromTemplate extends React.PureComponent exten } return ( - + { }; return ( - + { return ( { {(form, save) => ( { > +
) : ( - + +
@@ -11,4 +11,4 @@
-
\ No newline at end of file + From 32123df978f423aa869b6ba085445a17494a1d34 Mon Sep 17 00:00:00 2001 From: Konstantin Markov Date: Wed, 20 Nov 2024 13:27:59 +0200 Subject: [PATCH 24/35] Pin chrome version, adjust workflow file --- .github/workflows/tests.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a1651d824f..3e401acb13 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -71,6 +71,13 @@ jobs: # protractor start + - name: Setup Chrome + uses: browser-actions/setup-chrome@v1 + with: + chrome-version: 127.0.6533.99 + install-dependencies: true + install-chromedriver: true + - name: Protractor run: npx protractor-flake --parser standard --max-attempts=3 -- protractor.conf.js --suite=${{ matrix.suite }} env: From a18df9b0d20196f7ad053837b113650a8239af30 Mon Sep 17 00:00:00 2001 From: Konstantin Markov Date: Wed, 20 Nov 2024 13:33:05 +0200 Subject: [PATCH 25/35] Fix lint --- e2e/client/specs/helpers/monitoring.ts | 3 --- e2e/client/specs/helpers/pages.ts | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/e2e/client/specs/helpers/monitoring.ts b/e2e/client/specs/helpers/monitoring.ts index d53b621b3f..1da3f9d12d 100644 --- a/e2e/client/specs/helpers/monitoring.ts +++ b/e2e/client/specs/helpers/monitoring.ts @@ -471,15 +471,12 @@ class Monitoring { * @param {number} item */ this.actionOnItemSubmenu = function(action, submenu, group, item) { - console.log(action, submenu) const menu: ElementFinder = this.openItemMenu(group, item); const header = menu.element(by.buttonText(action)); const btn = menu.element(by.partialButtonText(submenu)); browser.actions().mouseMove(header, {x: -50, y: -50}).mouseMove(header).perform(); - // debugger - waitFor(btn, 1000); btn.click(); }; diff --git a/e2e/client/specs/helpers/pages.ts b/e2e/client/specs/helpers/pages.ts index 2de968871a..b71dd5c0a3 100644 --- a/e2e/client/specs/helpers/pages.ts +++ b/e2e/client/specs/helpers/pages.ts @@ -252,7 +252,7 @@ class IngestSettings { timezoneLabel: element(by.id('timezone')), timezoneDeleteBtn: element(by.css('[ng-click="clearSelectedTimeZone()"]')), - timezoneInput: element(by.model("term")), + timezoneInput: element(by.model('term')), timezoneList: $('.item-list').all(by.tagName('li')), }; } From c8cae9f9f681bb738a5d6298f130f6b2a99fcb6f Mon Sep 17 00:00:00 2001 From: Konstantin Markov Date: Wed, 20 Nov 2024 14:17:06 +0200 Subject: [PATCH 26/35] Fix workflow v2 --- .github/workflows/tests.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3e401acb13..505dc24e23 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -71,14 +71,12 @@ jobs: # protractor start - - name: Setup Chrome + - name: Setup Chrome & Run Protractor uses: browser-actions/setup-chrome@v1 with: chrome-version: 127.0.6533.99 install-dependencies: true install-chromedriver: true - - - name: Protractor run: npx protractor-flake --parser standard --max-attempts=3 -- protractor.conf.js --suite=${{ matrix.suite }} env: TRAVIS: ci From ce75f68aec6c110f870d4a440454ea6824174794 Mon Sep 17 00:00:00 2001 From: Konstantin Markov Date: Thu, 21 Nov 2024 11:48:51 +0200 Subject: [PATCH 27/35] Empty commit --- scripts/apps/dictionaries/views/settings.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/apps/dictionaries/views/settings.html b/scripts/apps/dictionaries/views/settings.html index 8eea373caf..65ba04fdb8 100644 --- a/scripts/apps/dictionaries/views/settings.html +++ b/scripts/apps/dictionaries/views/settings.html @@ -5,10 +5,10 @@

Dictionary management

- + - +
- +
  • From 42956c814a4170d41a21b869fcaedfe7e0a0a936 Mon Sep 17 00:00:00 2001 From: Konstantin Markov Date: Thu, 21 Nov 2024 11:49:11 +0200 Subject: [PATCH 28/35] Fix workflow file attempt 1 --- .github/workflows/tests.yml | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 505dc24e23..2bbde7d67a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -71,17 +71,19 @@ jobs: # protractor start - - name: Setup Chrome & Run Protractor - uses: browser-actions/setup-chrome@v1 - with: - chrome-version: 127.0.6533.99 - install-dependencies: true - install-chromedriver: true - run: npx protractor-flake --parser standard --max-attempts=3 -- protractor.conf.js --suite=${{ matrix.suite }} - env: - TRAVIS: ci - SCREENSHOTS_DIR: /tmp - working-directory: e2e/client + - name: Setup Chrome + uses: browser-actions/setup-chrome@v1 + with: + chrome-version: 127.0.6533.99 + install-dependencies: true + install-chromedriver: true + + - name: Run Protractor + run: npx protractor-flake --parser standard --max-attempts=3 -- protractor.conf.js --suite=${{ matrix.suite }} + env: + TRAVIS: ci + SCREENSHOTS_DIR: /tmp + working-directory: e2e/client - name: Upload screenshots if: ${{ failure() }} From e726ca6623fdea44d5e135652e8e8f86a67a4235 Mon Sep 17 00:00:00 2001 From: Konstantin Markov Date: Thu, 21 Nov 2024 11:51:22 +0200 Subject: [PATCH 29/35] Fix wf file formatting --- .github/workflows/tests.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2bbde7d67a..9de481f436 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -85,12 +85,12 @@ jobs: SCREENSHOTS_DIR: /tmp working-directory: e2e/client - - name: Upload screenshots - if: ${{ failure() }} - uses: actions/upload-artifact@v3 - with: - name: screenshots-e2e-${{ matrix.suite }} - path: /tmp/*.png + - name: Upload screenshots + if: ${{ failure() }} + uses: actions/upload-artifact@v3 + with: + name: screenshots-e2e-${{ matrix.suite }} + path: /tmp/*.png # protractor end From 59f72ce9d4ce6cdc1e2f8e7ac25b7669be932108 Mon Sep 17 00:00:00 2001 From: Konstantin Markov Date: Thu, 21 Nov 2024 12:21:46 +0200 Subject: [PATCH 30/35] Fix formatting --- .github/workflows/tests.yml | 40 ++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9de481f436..4615b419cc 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -71,26 +71,26 @@ jobs: # protractor start - - name: Setup Chrome - uses: browser-actions/setup-chrome@v1 - with: - chrome-version: 127.0.6533.99 - install-dependencies: true - install-chromedriver: true - - - name: Run Protractor - run: npx protractor-flake --parser standard --max-attempts=3 -- protractor.conf.js --suite=${{ matrix.suite }} - env: - TRAVIS: ci - SCREENSHOTS_DIR: /tmp - working-directory: e2e/client - - - name: Upload screenshots - if: ${{ failure() }} - uses: actions/upload-artifact@v3 - with: - name: screenshots-e2e-${{ matrix.suite }} - path: /tmp/*.png + - name: Setup Chrome + uses: browser-actions/setup-chrome@v1 + with: + chrome-version: 127.0.6533.99 + install-dependencies: true + install-chromedriver: true + + - name: Run Protractor + run: npx protractor-flake --parser standard --max-attempts=3 -- protractor.conf.js --suite=${{ matrix.suite }} + env: + TRAVIS: ci + SCREENSHOTS_DIR: /tmp + working-directory: e2e/client + + - name: Upload screenshots + if: ${{ failure() }} + uses: actions/upload-artifact@v3 + with: + name: screenshots-e2e-${{ matrix.suite }} + path: /tmp/*.png # protractor end From 4dade8be3019f7178c44334a5fc2f6bcfc5ee046 Mon Sep 17 00:00:00 2001 From: Konstantin Markov Date: Thu, 21 Nov 2024 13:17:09 +0200 Subject: [PATCH 31/35] Change workflow for protractor --- .github/workflows/tests.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4615b419cc..098971eec1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -71,14 +71,12 @@ jobs: # protractor start - - name: Setup Chrome + - name: Run Protractor uses: browser-actions/setup-chrome@v1 with: chrome-version: 127.0.6533.99 install-dependencies: true install-chromedriver: true - - - name: Run Protractor run: npx protractor-flake --parser standard --max-attempts=3 -- protractor.conf.js --suite=${{ matrix.suite }} env: TRAVIS: ci From a418e486c214c5f6622ecc4b86160cbe2fc0d23a Mon Sep 17 00:00:00 2001 From: Konstantin Markov Date: Thu, 21 Nov 2024 13:58:19 +0200 Subject: [PATCH 32/35] Try again --- .github/workflows/tests.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 098971eec1..13a5d15f39 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -71,13 +71,11 @@ jobs: # protractor start + - name: Pin chrome version + run: node ./node_modules/.bin/webdriver-manager update --versions.chrome=127.0.6533.99 + - name: Run Protractor - uses: browser-actions/setup-chrome@v1 - with: - chrome-version: 127.0.6533.99 - install-dependencies: true - install-chromedriver: true - run: npx protractor-flake --parser standard --max-attempts=3 -- protractor.conf.js --suite=${{ matrix.suite }} + run: npx protractor-flake --parser standard --max-attempts=3 -- protractor.conf.js --suite=${{ matrix.suite }} --webdriver-update false env: TRAVIS: ci SCREENSHOTS_DIR: /tmp From 8e501ba91216874418715dc5bb0ca8f16e297744 Mon Sep 17 00:00:00 2001 From: Konstantin Markov Date: Thu, 21 Nov 2024 13:58:58 +0200 Subject: [PATCH 33/35] Add working directory --- .github/workflows/tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 13a5d15f39..4b6503baff 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -73,6 +73,7 @@ jobs: - name: Pin chrome version run: node ./node_modules/.bin/webdriver-manager update --versions.chrome=127.0.6533.99 + working-directory: e2e/client - name: Run Protractor run: npx protractor-flake --parser standard --max-attempts=3 -- protractor.conf.js --suite=${{ matrix.suite }} --webdriver-update false From b397f46adb0e138bf654b1a256c92d019b03f268 Mon Sep 17 00:00:00 2001 From: Konstantin Markov Date: Mon, 25 Nov 2024 12:38:31 +0200 Subject: [PATCH 34/35] Fix tests --- e2e/client/specs/helpers/pages.ts | 6 +++--- e2e/client/specs/helpers/workspace.ts | 2 +- e2e/client/specs/ingest_provider_spec.ts | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/e2e/client/specs/helpers/pages.ts b/e2e/client/specs/helpers/pages.ts index b71dd5c0a3..8e447b0dd2 100644 --- a/e2e/client/specs/helpers/pages.ts +++ b/e2e/client/specs/helpers/pages.ts @@ -119,7 +119,7 @@ class IngestDashboard { var self = this; this.dropDown = element(by.id('ingest-dashboard-dropdown')); - this.ingestDashboard = element(by.className('ingest-dashboard-list')); + this.ingestDashboard = element(by.css('.ingest-dashboard-list')); this.openDropDown = function() { return self.dropDown.click(); @@ -148,7 +148,7 @@ class IngestDashboard { }; this.getDashboardSettingsButton = function(dashboard) { - return dashboard.element(by.className('dropdown')); + return dashboard.element(by.css('.dropdown')); }; this.getDashboardSettingsStatusButton = function(settings) { @@ -252,7 +252,7 @@ class IngestSettings { timezoneLabel: element(by.id('timezone')), timezoneDeleteBtn: element(by.css('[ng-click="clearSelectedTimeZone()"]')), - timezoneInput: element(by.model('term')), + timezoneInput: $('[term="tzSearchTerm"]').element(by.model('term')), timezoneList: $('.item-list').all(by.tagName('li')), }; } diff --git a/e2e/client/specs/helpers/workspace.ts b/e2e/client/specs/helpers/workspace.ts index 6c0f08e918..1207e8d45e 100644 --- a/e2e/client/specs/helpers/workspace.ts +++ b/e2e/client/specs/helpers/workspace.ts @@ -152,7 +152,7 @@ class Workspace { .mouseMove(menu) .perform(); - return menu.element(by.buttonText(name)); + return menu.element(by.partialButtonText(name)); }; /** diff --git a/e2e/client/specs/ingest_provider_spec.ts b/e2e/client/specs/ingest_provider_spec.ts index 4c39de4c05..d154002211 100644 --- a/e2e/client/specs/ingest_provider_spec.ts +++ b/e2e/client/specs/ingest_provider_spec.ts @@ -74,7 +74,7 @@ describe('ingest_provider', () => { var settings = ingestDashboard.getDashboardSettingsButton(dashboard); settings.click(); - settings.element(by.className('icon-pencil')).click(); + settings.element(by.css('.icon-pencil')).click(); browser.wait(() => element(by.id('ingest-settings')).isDisplayed(), 1000).then(() => { expect(element(by.id('ingest-settings')).isDisplayed()).toBe(true); @@ -87,7 +87,7 @@ describe('ingest_provider', () => { var ingestProvider = element.all(by.repeater('provider in providers._items')).first(); browser.actions().mouseMove(ingestProvider).perform(); - ingestProvider.all(by.className('icon-pencil')).first().click(); - expect(element(by.className('modal__dialog')).element(by.id('provider-name')).isDisplayed()).toBe(true); + ingestProvider.all(by.css('.icon-pencil')).first().click(); + expect(element(by.css('.modal__dialog')).element(by.id('provider-name')).isDisplayed()).toBe(true); }); }); From a3fd9793df055c5d166e4f6a4fbd8cbfc775f911 Mon Sep 17 00:00:00 2001 From: Konstantin Markov Date: Mon, 25 Nov 2024 16:32:34 +0200 Subject: [PATCH 35/35] Changes after review --- scripts/apps/authoring-react/authoring-react.tsx | 7 +++---- .../subcomponents/authoring-toolbar.tsx | 11 +++++------ .../authoring/authoring/authoring-topbar2-react.tsx | 2 +- scripts/apps/ingest/views/dashboard/dashboard.html | 2 +- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/scripts/apps/authoring-react/authoring-react.tsx b/scripts/apps/authoring-react/authoring-react.tsx index a8dd10e506..95f95d2c8c 100644 --- a/scripts/apps/authoring-react/authoring-react.tsx +++ b/scripts/apps/authoring-react/authoring-react.tsx @@ -1421,8 +1421,7 @@ export class AuthoringReact extends React.PureCo @@ -1438,7 +1437,7 @@ export class AuthoringReact extends React.PureCo @@ -1452,7 +1451,7 @@ export class AuthoringReact extends React.PureCo {this.props.headerToolbar != null && ( )} diff --git a/scripts/apps/authoring-react/subcomponents/authoring-toolbar.tsx b/scripts/apps/authoring-react/subcomponents/authoring-toolbar.tsx index ccdd8e4854..70eaa7b12d 100644 --- a/scripts/apps/authoring-react/subcomponents/authoring-toolbar.tsx +++ b/scripts/apps/authoring-react/subcomponents/authoring-toolbar.tsx @@ -3,24 +3,23 @@ import {ITopBarWidget} from 'superdesk-api'; interface IProps { entity: T; - coreWidgets?: Array>; - extraWidgets?: Array>; + widgets?: Array>; backgroundColor?: React.CSSProperties['backgroundColor']; } export class AuthoringToolbar extends React.PureComponent> { render() { - const topbarWidgets = (this.props.coreWidgets ?? []).concat(this.props.extraWidgets ?? []); + const {widgets} = this.props; - const topbarWidgetsStart = topbarWidgets + const topbarWidgetsStart = widgets .filter(({group}) => group === 'start') .sort((a, b) => a.priority - b.priority); - const topbarWidgetsMiddle = topbarWidgets + const topbarWidgetsMiddle = widgets .filter(({group}) => group === 'middle') .sort((a, b) => a.priority - b.priority); - const topbarWidgetsEnd = topbarWidgets + const topbarWidgetsEnd = widgets .filter(({group}) => group === 'end') .sort((a, b) => a.priority - b.priority); diff --git a/scripts/apps/authoring/authoring/authoring-topbar2-react.tsx b/scripts/apps/authoring/authoring/authoring-topbar2-react.tsx index b31933c7bd..6370a00bef 100644 --- a/scripts/apps/authoring/authoring/authoring-topbar2-react.tsx +++ b/scripts/apps/authoring/authoring/authoring-topbar2-react.tsx @@ -90,7 +90,7 @@ export class AuthoringTopbar2React extends React.PureComponent { return ( ); } diff --git a/scripts/apps/ingest/views/dashboard/dashboard.html b/scripts/apps/ingest/views/dashboard/dashboard.html index 435b56c59c..c5854105dd 100644 --- a/scripts/apps/ingest/views/dashboard/dashboard.html +++ b/scripts/apps/ingest/views/dashboard/dashboard.html @@ -2,7 +2,7 @@