From a70e317ae3d85e41265095ca77dae13d1d03827e Mon Sep 17 00:00:00 2001 From: Anukriti Singh Date: Thu, 7 Dec 2023 11:55:09 +0530 Subject: [PATCH] [MNT-23433] removed close button from toolbar --- docs/extending/rules.md | 1 - .../context-submenus-ext.json | 17 -------------- .../document-presets-ext.json | 17 -------------- .../extensibility-configs/header-ext.json | 17 -------------- .../info-drawer-ext.json | 17 -------------- .../info-drawer-no-tabs-ext.json | 17 -------------- .../extensibility-configs/metadata-ext.json | 17 -------------- .../extensibility-configs/viewer-ext.json | 17 -------------- .../aca-content/assets/app.extensions.json | 17 -------------- projects/aca-content/assets/i18n/en.json | 3 +-- .../aca-content/src/lib/aca-content.module.ts | 1 - .../components/viewer/viewer.component.html | 2 +- .../components/viewer/viewer.component.scss | 6 ++++- .../components/viewer.component.ts | 2 +- .../aca-shared/rules/src/app.rules.spec.ts | 22 ------------------- projects/aca-shared/rules/src/app.rules.ts | 12 ---------- .../src/components/viewer/viewer.ts | 4 ++-- 17 files changed, 10 insertions(+), 179 deletions(-) diff --git a/docs/extending/rules.md b/docs/extending/rules.md index 8b09985270..2c63e0d030 100644 --- a/docs/extending/rules.md +++ b/docs/extending/rules.md @@ -168,7 +168,6 @@ The button will be visible only when the linked rule evaluates to `true`. | 1.8.0 | user.isAdmin | Checks if user is admin. | | 1.9.0 | app.canShowLogout | Whether logout action should be present or not. | | 1.12.0 | app.isLibraryManager | Checks if user is library manager. | -| 4.4.0 | canClosePreview | Conditionally show/hide the right side viewer close button. | ## Navigation Evaluators diff --git a/e2e/protractor/resources/extensibility-configs/context-submenus-ext.json b/e2e/protractor/resources/extensibility-configs/context-submenus-ext.json index d4a5839247..336f324a71 100644 --- a/e2e/protractor/resources/extensibility-configs/context-submenus-ext.json +++ b/e2e/protractor/resources/extensibility-configs/context-submenus-ext.json @@ -1058,23 +1058,6 @@ } } ] - }, - { - "id": "app.viewer.separator.1", - "type": "separator", - "order": 11000 - }, - { - "id": "app.viewer.close", - "order": 12000, - "title": "APP.ACTIONS.CLOSE", - "icon": "close", - "actions": { - "click": "CLOSE_PREVIEW" - }, - "rules": { - "visible": "canClosePreview" - } } ], "shared": { diff --git a/e2e/protractor/resources/extensibility-configs/document-presets-ext.json b/e2e/protractor/resources/extensibility-configs/document-presets-ext.json index a0b0994c15..84229b582a 100644 --- a/e2e/protractor/resources/extensibility-configs/document-presets-ext.json +++ b/e2e/protractor/resources/extensibility-configs/document-presets-ext.json @@ -986,23 +986,6 @@ } } ] - }, - { - "id": "app.viewer.separator.1", - "type": "separator", - "order": 11000 - }, - { - "id": "app.viewer.close", - "order": 12000, - "title": "APP.ACTIONS.CLOSE", - "icon": "close", - "actions": { - "click": "CLOSE_PREVIEW" - }, - "rules": { - "visible": "canClosePreview" - } } ], "shared": { diff --git a/e2e/protractor/resources/extensibility-configs/header-ext.json b/e2e/protractor/resources/extensibility-configs/header-ext.json index a0f1fcade9..7d265f8289 100644 --- a/e2e/protractor/resources/extensibility-configs/header-ext.json +++ b/e2e/protractor/resources/extensibility-configs/header-ext.json @@ -1013,23 +1013,6 @@ } } ] - }, - { - "id": "app.viewer.separator.1", - "type": "separator", - "order": 11000 - }, - { - "id": "app.viewer.close", - "order": 12000, - "title": "APP.ACTIONS.CLOSE", - "icon": "close", - "actions": { - "click": "CLOSE_PREVIEW" - }, - "rules": { - "visible": "canClosePreview" - } } ], "shared": { diff --git a/e2e/protractor/resources/extensibility-configs/info-drawer-ext.json b/e2e/protractor/resources/extensibility-configs/info-drawer-ext.json index 4ef3fc8de4..3339338772 100644 --- a/e2e/protractor/resources/extensibility-configs/info-drawer-ext.json +++ b/e2e/protractor/resources/extensibility-configs/info-drawer-ext.json @@ -986,23 +986,6 @@ } } ] - }, - { - "id": "app.viewer.separator.1", - "type": "separator", - "order": 11000 - }, - { - "id": "app.viewer.close", - "order": 12000, - "title": "APP.ACTIONS.CLOSE", - "icon": "close", - "actions": { - "click": "CLOSE_PREVIEW" - }, - "rules": { - "visible": "canClosePreview" - } } ], "shared": { diff --git a/e2e/protractor/resources/extensibility-configs/info-drawer-no-tabs-ext.json b/e2e/protractor/resources/extensibility-configs/info-drawer-no-tabs-ext.json index 79b600cf5b..531c134f54 100644 --- a/e2e/protractor/resources/extensibility-configs/info-drawer-no-tabs-ext.json +++ b/e2e/protractor/resources/extensibility-configs/info-drawer-no-tabs-ext.json @@ -986,23 +986,6 @@ } } ] - }, - { - "id": "app.viewer.separator.1", - "type": "separator", - "order": 11000 - }, - { - "id": "app.viewer.close", - "order": 12000, - "title": "APP.ACTIONS.CLOSE", - "icon": "close", - "actions": { - "click": "CLOSE_PREVIEW" - }, - "rules": { - "visible": "canClosePreview" - } } ], "shared": { diff --git a/e2e/protractor/resources/extensibility-configs/metadata-ext.json b/e2e/protractor/resources/extensibility-configs/metadata-ext.json index f4fc101034..3fc4312a94 100644 --- a/e2e/protractor/resources/extensibility-configs/metadata-ext.json +++ b/e2e/protractor/resources/extensibility-configs/metadata-ext.json @@ -986,23 +986,6 @@ } } ] - }, - { - "id": "app.viewer.separator.1", - "type": "separator", - "order": 11000 - }, - { - "id": "app.viewer.close", - "order": 12000, - "title": "APP.ACTIONS.CLOSE", - "icon": "close", - "actions": { - "click": "CLOSE_PREVIEW" - }, - "rules": { - "visible": "canClosePreview" - } } ], "shared": { diff --git a/e2e/protractor/resources/extensibility-configs/viewer-ext.json b/e2e/protractor/resources/extensibility-configs/viewer-ext.json index e981c93d01..141e1c8c31 100644 --- a/e2e/protractor/resources/extensibility-configs/viewer-ext.json +++ b/e2e/protractor/resources/extensibility-configs/viewer-ext.json @@ -1012,23 +1012,6 @@ } } ] - }, - { - "id": "app.viewer.separator.1", - "type": "separator", - "order": 11000 - }, - { - "id": "app.viewer.close", - "order": 12000, - "title": "APP.ACTIONS.CLOSE", - "icon": "close", - "actions": { - "click": "CLOSE_PREVIEW" - }, - "rules": { - "visible": "canClosePreview" - } } ], "shared": { diff --git a/projects/aca-content/assets/app.extensions.json b/projects/aca-content/assets/app.extensions.json index 4b3e5ad5bf..6469d51f20 100644 --- a/projects/aca-content/assets/app.extensions.json +++ b/projects/aca-content/assets/app.extensions.json @@ -1180,23 +1180,6 @@ } } ] - }, - { - "id": "app.viewer.separator.1", - "type": "separator", - "order": 11000 - }, - { - "id": "app.viewer.close", - "order": 12000, - "title": "APP.ACTIONS.CLOSE", - "icon": "close", - "actions": { - "click": "CLOSE_PREVIEW" - }, - "rules": { - "visible": "canClosePreview" - } } ], "shared": { diff --git a/projects/aca-content/assets/i18n/en.json b/projects/aca-content/assets/i18n/en.json index 786e0265d2..a3a48e7ad3 100644 --- a/projects/aca-content/assets/i18n/en.json +++ b/projects/aca-content/assets/i18n/en.json @@ -259,8 +259,7 @@ "LEAVE": "Leave Library", "EDIT_OFFLINE": "Edit Offline", "EDIT_OFFLINE_CANCEL": "Cancel Editing", - "CHANGE_ASPECT": "Edit Aspects", - "CLOSE": "Close" + "CHANGE_ASPECT": "Edit Aspects" }, "DIALOGS": { "CONFIRM_PURGE": { diff --git a/projects/aca-content/src/lib/aca-content.module.ts b/projects/aca-content/src/lib/aca-content.module.ts index da41f27624..87ade007ff 100644 --- a/projects/aca-content/src/lib/aca-content.module.ts +++ b/projects/aca-content/src/lib/aca-content.module.ts @@ -194,7 +194,6 @@ export class ContentServiceExtensionModule { canEditAspects: rules.canEditAspects, canInfoPreview: rules.canInfoPreview, showInfoSelectionButton: rules.showInfoSelectionButton, - canClosePreview: rules.canClosePreview, 'app.selection.canDelete': rules.canDeleteSelection, 'app.selection.file.canUnlock': rules.canUnlockFile, diff --git a/projects/aca-content/viewer/src/lib/components/viewer/viewer.component.html b/projects/aca-content/viewer/src/lib/components/viewer/viewer.component.html index f34e00c0c8..7b0793b48f 100644 --- a/projects/aca-content/viewer/src/lib/components/viewer/viewer.component.html +++ b/projects/aca-content/viewer/src/lib/components/viewer/viewer.component.html @@ -13,7 +13,7 @@ [allowDownload]="false" [allowFullScreen]="false" [overlayMode]="true" - [allowGoBack]="'viewer.isCloseButtonOnLeft' | adfAppConfig: true" + [allowGoBack]="'viewer.isCloseButtonOnLeft' | adfAppConfig: false" (showViewerChange)="onViewerVisibilityChanged()" [canNavigateBefore]="!!previousNodeId" [canNavigateNext]="!!nextNodeId" diff --git a/projects/aca-content/viewer/src/lib/components/viewer/viewer.component.scss b/projects/aca-content/viewer/src/lib/components/viewer/viewer.component.scss index 31ae358f5d..f2fcaea1c1 100644 --- a/projects/aca-content/viewer/src/lib/components/viewer/viewer.component.scss +++ b/projects/aca-content/viewer/src/lib/components/viewer/viewer.component.scss @@ -16,8 +16,12 @@ } } + .adf-viewer-close-button { + padding-left: 12px; + } + // todo: remove this when viewer supports extensions - .adf-viewer-toolbar > * > button:last-child { + .adf-viewer-toolbar > * > button:nth-last-child(3) { display: none; } diff --git a/projects/aca-playwright-shared/src/page-objects/components/viewer.component.ts b/projects/aca-playwright-shared/src/page-objects/components/viewer.component.ts index a5114193e2..8c06ae37a4 100644 --- a/projects/aca-playwright-shared/src/page-objects/components/viewer.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/viewer.component.ts @@ -31,7 +31,7 @@ export class ViewerComponent extends BaseComponent { private static rootElement = 'adf-viewer'; private viewerLocator = this.getChild('.adf-viewer-render-layout-content'); - public closeButtonLocator = this.getChild('button[title="Close"]'); + public closeButtonLocator = this.getChild('.adf-viewer-close-button'); public fileTitleButtonLocator = this.getChild('.adf-viewer__file-title'); public pdfViewerContentPages = this.getChild('.adf-pdf-viewer__content .page'); public shareButton = this.getChild('button[id="share-action-button"]'); diff --git a/projects/aca-shared/rules/src/app.rules.spec.ts b/projects/aca-shared/rules/src/app.rules.spec.ts index 14301d421f..4f3a848a60 100644 --- a/projects/aca-shared/rules/src/app.rules.spec.ts +++ b/projects/aca-shared/rules/src/app.rules.spec.ts @@ -519,28 +519,6 @@ describe('app.evaluators', () => { }); }); - describe('canClosePreview', () => { - it('should return false when viewer.isCloseButtonOnLeft is true', () => { - const context: any = { - appConfig: { - get: () => true - } - }; - - expect(app.canClosePreview(context)).toBe(false); - }); - - it('should return true when viewer.isCloseButtonOnLeft is false', () => { - const context: any = { - appConfig: { - get: () => false - } - }; - - expect(app.canClosePreview(context)).toBe(true); - }); - }); - describe('isLibraryManager', () => { it('should return true when role is SiteManager', () => { const context: any = { diff --git a/projects/aca-shared/rules/src/app.rules.ts b/projects/aca-shared/rules/src/app.rules.ts index 1df3e53c81..df9e89374d 100644 --- a/projects/aca-shared/rules/src/app.rules.ts +++ b/projects/aca-shared/rules/src/app.rules.ts @@ -448,18 +448,6 @@ export const isTrashcanItemSelected = (context: RuleContext): boolean => [naviga */ export const canViewFile = (context: RuleContext): boolean => [hasFileSelected(context), navigation.isNotTrashcan(context)].every(Boolean); -/** - * Checks if user can **Close** opened file. - * JSON ref: `canClosePreview` - * - * @param context Rule execution context - */ -export const canClosePreview = (context: AcaRuleContext): boolean => { - const flag = context.appConfig.get('viewer.isCloseButtonOnLeft', true); - - return !flag; -}; - /** * Checks if user can **Leave** selected library. * JSON ref: `canLeaveLibrary` diff --git a/projects/aca-testing-shared/src/components/viewer/viewer.ts b/projects/aca-testing-shared/src/components/viewer/viewer.ts index 84bd82525a..54d0467dda 100755 --- a/projects/aca-testing-shared/src/components/viewer/viewer.ts +++ b/projects/aca-testing-shared/src/components/viewer/viewer.ts @@ -32,7 +32,7 @@ export class Viewer extends Component { root = browser.$('adf-viewer'); viewerLayout = this.byCss('.adf-viewer-render-layout-content'); viewerContainer = this.byCss('.adf-viewer-render-content-container'); - closeButton = this.byCss('button[title="Close"]'); + closeButton = this.byCss('.adf-viewer-close-button'); fileTitle = this.byCss('.adf-viewer__file-title'); viewerExtensionContent = this.byCss('adf-preview-extension'); txtViewerContent = this.byCss('.adf-txt-viewer-content'); @@ -103,7 +103,7 @@ export class Viewer extends Component { } async clickCloseButton(): Promise { - const closeButton: ElementFinder = element(by.css('button[title="Close"]')); + const closeButton: ElementFinder = element(by.css('button[data-automation-id="adf-toolbar-back"]')); await BrowserActions.click(closeButton); } }