Skip to content

Commit

Permalink
[MNT-23433] removed close button from toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
AnukritiGL committed Dec 12, 2023
1 parent 47a044e commit a70e317
Show file tree
Hide file tree
Showing 17 changed files with 10 additions and 179 deletions.
1 change: 0 additions & 1 deletion docs/extending/rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
17 changes: 0 additions & 17 deletions e2e/protractor/resources/extensibility-configs/header-ext.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
17 changes: 0 additions & 17 deletions e2e/protractor/resources/extensibility-configs/metadata-ext.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
17 changes: 0 additions & 17 deletions e2e/protractor/resources/extensibility-configs/viewer-ext.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
17 changes: 0 additions & 17 deletions projects/aca-content/assets/app.extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
3 changes: 1 addition & 2 deletions projects/aca-content/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
1 change: 0 additions & 1 deletion projects/aca-content/src/lib/aca-content.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"]');
Expand Down
22 changes: 0 additions & 22 deletions projects/aca-shared/rules/src/app.rules.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
12 changes: 0 additions & 12 deletions projects/aca-shared/rules/src/app.rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<boolean>('viewer.isCloseButtonOnLeft', true);

return !flag;
};

/**
* Checks if user can **Leave** selected library.
* JSON ref: `canLeaveLibrary`
Expand Down
4 changes: 2 additions & 2 deletions projects/aca-testing-shared/src/components/viewer/viewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -103,7 +103,7 @@ export class Viewer extends Component {
}

async clickCloseButton(): Promise<void> {
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);
}
}

0 comments on commit a70e317

Please sign in to comment.