Skip to content

Commit

Permalink
Merge branch 'develop' into dev-akashrathod28-viewer-test-migration
Browse files Browse the repository at this point in the history
  • Loading branch information
akashrathod28 authored Jan 3, 2024
2 parents 99a910f + 6da7152 commit b89b6a6
Show file tree
Hide file tree
Showing 9 changed files with 108 additions and 55 deletions.
3 changes: 2 additions & 1 deletion app/src/app.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -1137,6 +1137,7 @@
"downloadPromptDelay": 50,
"downloadPromptReminderDelay": 30,
"enableFileAutoDownload": true,
"fileAutoDownloadSizeThresholdInMB": 15
"fileAutoDownloadSizeThresholdInMB": 15,
"closeButtonPosition": "right"
}
}
72 changes: 36 additions & 36 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
},
"private": true,
"dependencies": {
"@alfresco/adf-content-services": ">=6.6.0-7307998972",
"@alfresco/adf-core": ">=6.6.0-7307998972",
"@alfresco/adf-extensions": ">=6.6.0-7307998972",
"@alfresco/eslint-plugin-eslint-angular": ">=6.6.0-7307998972",
"@alfresco/js-api": ">=7.5.0-7307998972",
"@alfresco/adf-content-services": ">=6.6.0-7386887320",
"@alfresco/adf-core": ">=6.6.0-7386887320",
"@alfresco/adf-extensions": ">=6.6.0-7386887320",
"@alfresco/eslint-plugin-eslint-angular": ">=6.6.0-7386887320",
"@alfresco/js-api": ">=7.5.0-7386887320",
"@angular/animations": "14.1.3",
"@angular/cdk": "14.1.3",
"@angular/common": "14.1.3",
Expand Down Expand Up @@ -65,8 +65,8 @@
"zone.js": "0.11.8"
},
"devDependencies": {
"@alfresco/adf-cli": ">=6.6.0-7307998972",
"@alfresco/adf-testing": ">=6.6.0-7307998972",
"@alfresco/adf-cli": ">=6.6.0-7386887320",
"@alfresco/adf-testing": ">=6.6.0-7386887320",
"@angular-devkit/build-angular": "14.2.11",
"@angular-devkit/core": "14.1.2",
"@angular-devkit/schematics": "14.1.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div class="aca-details-title">
<div class="aca-details-breadcrumb" role="heading" aria-level="2" *ngIf="node">
<span class="aca-details-breadcrumb-library">
<img class="aca-details-breadcrumb-icon" alt="{{ 'APP.INFO_DRAWER.ICON' | translate }}" src="{{ nodeIcon }}">
<img class="aca-details-breadcrumb-icon" alt="{{ 'APP.INFO_DRAWER.ICON' | translate }}" src="{{ nodeIcon }}">
{{ node.name }} </span>
</div>
<div class="acs-details-buttons">
Expand All @@ -36,7 +36,7 @@
<app-comments-tab *ngIf="node && !isLoading; else loading" [node]="node"></app-comments-tab>
</ng-template>
</mat-tab>
<mat-tab label="{{ 'APP.INFO_DRAWER.TABS.PERMISSIONS' | translate }}">
<mat-tab [disabled]="!canManagePermissions" label="{{ 'APP.INFO_DRAWER.TABS.PERMISSIONS' | translate }}">
<ng-template matTabContent>
<adf-permission-list *ngIf="node && !isLoading; else loading" [nodeId]="node.id"></adf-permission-list>
</ng-template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { BehaviorSubject, of, Subject } from 'rxjs';
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { Store } from '@ngrx/store';
import { ContentApiService } from '@alfresco/aca-shared';
import { STORE_INITIAL_APP_DATA, SetSelectedNodesAction, NavigateToFolder } from '@alfresco/aca-shared/store';
import { NavigateToFolder, SetSelectedNodesAction, STORE_INITIAL_APP_DATA } from '@alfresco/aca-shared/store';
import { NodeEntry, PathElement } from '@alfresco/js-api';
import { RouterTestingModule } from '@angular/router/testing';
import { AuthenticationService, PageTitleService } from '@alfresco/adf-core';
Expand Down Expand Up @@ -201,4 +201,45 @@ describe('DetailsComponent', () => {
fail(`An error occurred: ${error}`);
});
});

it('should disable the permissions tab for smart folders based on aspects', () => {
node.entry.isFolder = true;
node.entry.aspectNames = ['smf:customConfigSmartFolder'];
fixture.detectChanges();
component.ngOnInit();
expect(component.canManagePermissions).toBeFalse();
expect(component.activeTab).not.toBe(2);
});

it('should enable the permissions tab for regular folders based on aspects', () => {
node.entry.isFolder = true;
node.entry.aspectNames = [];
fixture.detectChanges();
component.ngOnInit();

expect(component.canManagePermissions).toBeTrue();
});

it('should change active tab based on canManagePermissions and tabName', () => {
component.nodeId = 'someNodeId';
component.activeTab = 0;

node.entry.isFolder = true;
node.entry.aspectNames = [];

fixture.detectChanges();
component.ngOnInit();

component.setActiveTab('permissions');
expect(component.activeTab).toBe(2);

node.entry.isFolder = true;
node.entry.aspectNames = ['smf:customConfigSmartFolder'];

fixture.detectChanges();
component.ngOnInit();

component.setActiveTab('permissions');
expect(component.activeTab).not.toBe(2);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/

import { Component, OnInit, ViewEncapsulation, OnDestroy } from '@angular/core';
import { Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { ContentApiService, PageComponent, PageLayoutComponent, ToolbarComponent } from '@alfresco/aca-shared';
import { NavigateToFolder, NavigateToPreviousPage, SetSelectedNodesAction } from '@alfresco/aca-shared/store';
Expand Down Expand Up @@ -68,6 +68,7 @@ export class DetailsComponent extends PageComponent implements OnInit, OnDestroy
activeTab = 1;
aspectActions: Array<ContentActionRef> = [];
nodeIcon: string;
canManagePermissions = true;

constructor(private route: ActivatedRoute, private contentApi: ContentApiService, private contentService: ContentService) {
super();
Expand All @@ -79,14 +80,15 @@ export class DetailsComponent extends PageComponent implements OnInit, OnDestroy
const { route } = this;
const { data } = route.snapshot;
this.title = data.title;

this.route.params.subscribe((params) => {
this.isLoading = true;
this.setActiveTab(params.activeTab);
this.nodeId = params.nodeId;
this.contentApi.getNode(this.nodeId).subscribe((node) => {
this.node = node.entry;
this.isLoading = false;
this.canManagePermissions = !this.isSmartFolder();
this.setActiveTab(params.activeTab);
this.store.dispatch(new SetSelectedNodesAction([{ entry: this.node }]));
this.nodeIcon = this.contentService.getNodeIcon(this.node);
});
Expand All @@ -105,6 +107,10 @@ export class DetailsComponent extends PageComponent implements OnInit, OnDestroy
this.activeTab = 1;
break;
case 'permissions':
if (!this.canManagePermissions) {
this.activeTab = 0;
break;
}
this.activeTab = 2;
break;
case 'metadata':
Expand All @@ -126,4 +132,12 @@ export class DetailsComponent extends PageComponent implements OnInit, OnDestroy
this.onDestroy$.next();
this.onDestroy$.complete();
}

private isSmartFolder(): boolean {
if (!this.node?.isFolder) {
return false;
}
const nodeAspects = this.node.aspectNames ?? [];
return nodeAspects.includes('smf:customConfigSmartFolder') || nodeAspects.includes('smf:systemConfigSmartFolder');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
[allowDownload]="false"
[allowFullScreen]="false"
[overlayMode]="true"
[hideInfoButton]="true"
[closeButtonPosition]="'viewer.closeButtonPosition' | adfAppConfig: 'right'"
(showViewerChange)="onViewerVisibilityChanged()"
[canNavigateBefore]="!!previousNodeId"
[canNavigateNext]="!!nextNodeId"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@
}
}

// todo: remove this when viewer supports extensions
.adf-viewer-toolbar > * > button:last-child {
display: none;
}

.adf-alfresco-viewer.aca-right_side--hide .adf-viewer__sidebar__right {
width: 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export class Viewer extends Component {
}

async clickCloseButton(): Promise<void> {
const closeButton: ElementFinder = element(by.css('button[data-automation-id="adf-toolbar-back"]'));
const closeButton: ElementFinder = element(by.css('button.adf-viewer-close-button'));
await BrowserActions.click(closeButton);
}
}

0 comments on commit b89b6a6

Please sign in to comment.