mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-10-01 14:41:14 +00:00
[ACS-5540] modified the aspect button changes
This commit is contained in:
@@ -1261,7 +1261,7 @@
|
|||||||
"click": "EXPAND_INFO_DRAWER"
|
"click": "EXPAND_INFO_DRAWER"
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
"visible": "app.navigation.isNotLibraries"
|
"visible": "canNotShowExpand"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@@ -192,6 +192,7 @@ export class ContentServiceExtensionModule {
|
|||||||
canToggleFavorite: rules.canToggleFavorite,
|
canToggleFavorite: rules.canToggleFavorite,
|
||||||
isLibraryManager: rules.isLibraryManager,
|
isLibraryManager: rules.isLibraryManager,
|
||||||
canEditAspects: rules.canEditAspects,
|
canEditAspects: rules.canEditAspects,
|
||||||
|
canNotShowExpand: rules.canNotShowExpand,
|
||||||
canInfoPreview: rules.canInfoPreview,
|
canInfoPreview: rules.canInfoPreview,
|
||||||
showInfoSelectionButton: rules.showInfoSelectionButton,
|
showInfoSelectionButton: rules.showInfoSelectionButton,
|
||||||
|
|
||||||
|
@@ -12,21 +12,11 @@
|
|||||||
-
|
-
|
||||||
<span class="acs-details-breadcrumb-item">{{ 'APP.INFO_DRAWER.TITLE' | translate }}</span>
|
<span class="acs-details-breadcrumb-item">{{ 'APP.INFO_DRAWER.TITLE' | translate }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="acs-details-buttons">
|
||||||
<button *ngIf="!isNodeLocked"
|
<aca-toolbar [items]="actionsAspect" info-drawer-buttons></aca-toolbar>
|
||||||
mat-icon-button
|
<button class="aca-close-details-button" mat-icon-button data-automation-id="close-library"
|
||||||
(click)="openAspectDialog()"
|
title="{{ 'APP.INFO_DRAWER.CLOSE' | translate }}" (click)="goBack()">
|
||||||
[attr.title]="'CORE.METADATA.ACTIONS.EDIT_ASPECTS' | translate"
|
<mat-icon>close</mat-icon>
|
||||||
[attr.aria-label]="'CORE.METADATA.ACCESSIBILITY.EDIT_ASPECTS' | translate"
|
|
||||||
data-automation-id="meta-data-edit-aspect">
|
|
||||||
<mat-icon>playlist_add</mat-icon>
|
|
||||||
</button>
|
|
||||||
<button mat-icon-button
|
|
||||||
class="aca-close-details-button"
|
|
||||||
data-automation-id="close-library"
|
|
||||||
title="{{ 'APP.INFO_DRAWER.CLOSE' | translate }}"
|
|
||||||
(click)="goBack()">
|
|
||||||
<mat-icon>fullscreen_exit</mat-icon>
|
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -1,19 +1,29 @@
|
|||||||
app-details-manager {
|
app-details-manager {
|
||||||
.aca-close-details-button {
|
.acs-details-buttons {
|
||||||
margin-right: 15px;
|
display: flex;
|
||||||
margin-top: 2px;
|
|
||||||
outline: none;
|
|
||||||
border-radius: 4px;
|
|
||||||
|
|
||||||
&:focus {
|
.aca-close-details-button {
|
||||||
background-color: var(--theme-selected-background-color);
|
margin-right: 15px;
|
||||||
outline: 2px solid var(--theme-blue-button-color);
|
margin-top: 2px;
|
||||||
|
outline: none;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
|
||||||
|
|
||||||
&:focus-visible {
|
&:focus {
|
||||||
outline: 2px solid var(--theme-blue-button-color);
|
background-color: var(--theme-selected-background-color);
|
||||||
border-radius: 4px;
|
outline: 2px solid var(--theme-blue-button-color);
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:focus-visible {
|
||||||
|
outline: 2px solid var(--theme-blue-button-color);
|
||||||
|
border-radius: 4px;
|
||||||
|
margin-top: 12px;
|
||||||
|
|
||||||
|
&:focus-visible {
|
||||||
|
outline: 2px solid var(--theme-blue-button-color);
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -31,10 +31,10 @@ import { NO_ERRORS_SCHEMA } from '@angular/core';
|
|||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { ContentApiService } from '@alfresco/aca-shared';
|
import { ContentApiService } from '@alfresco/aca-shared';
|
||||||
import { STORE_INITIAL_APP_DATA, SetSelectedNodesAction } from '@alfresco/aca-shared/store';
|
import { STORE_INITIAL_APP_DATA, SetSelectedNodesAction } from '@alfresco/aca-shared/store';
|
||||||
import { Node, NodeEntry } from '@alfresco/js-api';
|
import { NodeEntry } from '@alfresco/js-api';
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
import { AuthenticationService, PageTitleService } from '@alfresco/adf-core';
|
import { AuthenticationService, PageTitleService } from '@alfresco/adf-core';
|
||||||
import { NodeAspectService, SearchQueryBuilderService } from '@alfresco/adf-content-services';
|
import { SearchQueryBuilderService } from '@alfresco/adf-content-services';
|
||||||
|
|
||||||
describe('DetailsComponent', () => {
|
describe('DetailsComponent', () => {
|
||||||
let component: DetailsComponent;
|
let component: DetailsComponent;
|
||||||
@@ -42,7 +42,6 @@ describe('DetailsComponent', () => {
|
|||||||
let contentApiService: ContentApiService;
|
let contentApiService: ContentApiService;
|
||||||
let store: Store;
|
let store: Store;
|
||||||
let node: NodeEntry;
|
let node: NodeEntry;
|
||||||
let nodeAspectService: NodeAspectService;
|
|
||||||
|
|
||||||
const mockStream = new Subject();
|
const mockStream = new Subject();
|
||||||
const storeMock = {
|
const storeMock = {
|
||||||
@@ -87,8 +86,6 @@ describe('DetailsComponent', () => {
|
|||||||
fixture = TestBed.createComponent(DetailsComponent);
|
fixture = TestBed.createComponent(DetailsComponent);
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
contentApiService = TestBed.inject(ContentApiService);
|
contentApiService = TestBed.inject(ContentApiService);
|
||||||
nodeAspectService = TestBed.inject(NodeAspectService);
|
|
||||||
component.node = { id: 'test-id' } as Node;
|
|
||||||
store = TestBed.inject(Store);
|
store = TestBed.inject(Store);
|
||||||
|
|
||||||
node = {
|
node = {
|
||||||
@@ -106,7 +103,6 @@ describe('DetailsComponent', () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
spyOn(contentApiService, 'getNode').and.returnValue(of(node));
|
spyOn(contentApiService, 'getNode').and.returnValue(of(node));
|
||||||
spyOn(nodeAspectService, 'updateNodeAspects');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -132,26 +128,4 @@ describe('DetailsComponent', () => {
|
|||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
expect(store.dispatch).toHaveBeenCalledWith(new SetSelectedNodesAction([node]));
|
expect(store.dispatch).toHaveBeenCalledWith(new SetSelectedNodesAction([node]));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should call updateNodeAspects when the aspect dialog is opened', () => {
|
|
||||||
component.openAspectDialog();
|
|
||||||
fixture.detectChanges();
|
|
||||||
expect(nodeAspectService.updateNodeAspects).toHaveBeenCalledWith('test-id');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should subscribe to store and update isNodeLocked', () => {
|
|
||||||
const mockSelection = { file: { entry: { name: 'test', properties: {}, isLocked: false } } };
|
|
||||||
spyOn(store, 'select').and.returnValue(of(mockSelection));
|
|
||||||
fixture.detectChanges();
|
|
||||||
expect(store.select).toHaveBeenCalled();
|
|
||||||
expect(component.isNodeLocked).toBe(false);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should unsubscribe from observables on component destroy', () => {
|
|
||||||
spyOn(component.onDestroy$, 'next');
|
|
||||||
spyOn(component.onDestroy$, 'complete');
|
|
||||||
fixture.detectChanges();
|
|
||||||
component.ngOnDestroy();
|
|
||||||
expect(component.onDestroy$.complete).toHaveBeenCalled();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
@@ -22,12 +22,12 @@
|
|||||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, OnInit, ViewEncapsulation, OnDestroy, ChangeDetectorRef } from '@angular/core';
|
import { Component, OnInit, ViewEncapsulation, OnDestroy } from '@angular/core';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
import { ContentApiService, PageComponent, PageLayoutComponent, ToolbarComponent, isLocked } from '@alfresco/aca-shared';
|
import { ContentApiService, PageComponent, PageLayoutComponent, ToolbarComponent } from '@alfresco/aca-shared';
|
||||||
import { NavigateToPreviousPage, SetSelectedNodesAction, getAppSelection } from '@alfresco/aca-shared/store';
|
import { NavigateToPreviousPage, SetSelectedNodesAction } from '@alfresco/aca-shared/store';
|
||||||
import { Subject } from 'rxjs';
|
import { Subject } from 'rxjs';
|
||||||
import { BreadcrumbModule, PermissionManagerModule, NodeAspectService } from '@alfresco/adf-content-services';
|
import { BreadcrumbModule, PermissionManagerModule } from '@alfresco/adf-content-services';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
@@ -36,9 +36,8 @@ import { MatProgressBarModule } from '@angular/material/progress-bar';
|
|||||||
import { MatButtonModule } from '@angular/material/button';
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
import { MetadataTabComponent } from '../info-drawer/metadata-tab/metadata-tab.component';
|
import { MetadataTabComponent } from '../info-drawer/metadata-tab/metadata-tab.component';
|
||||||
import { CommentsTabComponent } from '../info-drawer/comments-tab/comments-tab.component';
|
import { CommentsTabComponent } from '../info-drawer/comments-tab/comments-tab.component';
|
||||||
import { NodeActionsService } from '../../services/node-actions.service';
|
|
||||||
import { NodeEntry } from '@alfresco/js-api';
|
|
||||||
import { takeUntil } from 'rxjs/operators';
|
import { takeUntil } from 'rxjs/operators';
|
||||||
|
import { ContentActionRef } from '@alfresco/adf-extensions';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
@@ -66,16 +65,9 @@ export class DetailsComponent extends PageComponent implements OnInit, OnDestroy
|
|||||||
isLoading: boolean;
|
isLoading: boolean;
|
||||||
onDestroy$ = new Subject<boolean>();
|
onDestroy$ = new Subject<boolean>();
|
||||||
activeTab = 1;
|
activeTab = 1;
|
||||||
selectionState: NodeEntry;
|
actionsAspect: Array<ContentActionRef> = [];
|
||||||
isNodeLocked = false;
|
|
||||||
|
|
||||||
constructor(
|
constructor(private route: ActivatedRoute, private contentApi: ContentApiService) {
|
||||||
private route: ActivatedRoute,
|
|
||||||
private contentApi: ContentApiService,
|
|
||||||
private nodeAspectService: NodeAspectService,
|
|
||||||
private nodeActionsService: NodeActionsService,
|
|
||||||
private cdr: ChangeDetectorRef
|
|
||||||
) {
|
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,14 +88,12 @@ export class DetailsComponent extends PageComponent implements OnInit, OnDestroy
|
|||||||
this.store.dispatch(new SetSelectedNodesAction([{ entry: this.node }]));
|
this.store.dispatch(new SetSelectedNodesAction([{ entry: this.node }]));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
this.store.select(getAppSelection).subscribe(({ file }) => {
|
this.extensions
|
||||||
this.selectionState = file;
|
.getAllowedSidebarActions()
|
||||||
const isNodeLockedFromStore = this.selection && isLocked(this.selectionState);
|
.pipe(takeUntil(this.onDestroy$))
|
||||||
this.nodeActionsService.isNodeLocked$.pipe(takeUntil(this.onDestroy$)).subscribe((isNodeLockedFromService) => {
|
.subscribe((actionsAspect) => {
|
||||||
this.isNodeLocked = isNodeLockedFromStore || isNodeLockedFromService;
|
this.actionsAspect = actionsAspect;
|
||||||
this.cdr.detectChanges();
|
|
||||||
});
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setActiveTab(tabName: string) {
|
setActiveTab(tabName: string) {
|
||||||
@@ -124,10 +114,6 @@ export class DetailsComponent extends PageComponent implements OnInit, OnDestroy
|
|||||||
this.store.dispatch(new NavigateToPreviousPage());
|
this.store.dispatch(new NavigateToPreviousPage());
|
||||||
}
|
}
|
||||||
|
|
||||||
openAspectDialog() {
|
|
||||||
this.nodeAspectService.updateNodeAspects(this.node.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
this.store.dispatch(new SetSelectedNodesAction([]));
|
this.store.dispatch(new SetSelectedNodesAction([]));
|
||||||
this.onDestroy$.next();
|
this.onDestroy$.next();
|
||||||
|
@@ -26,10 +26,9 @@ import { ToggleEditOfflineComponent } from './toggle-edit-offline.component';
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
import { of } from 'rxjs';
|
import { of } from 'rxjs';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { NodeEntry, NodesApi } from '@alfresco/js-api';
|
import { NodeEntry } from '@alfresco/js-api';
|
||||||
import { DownloadNodesAction, EditOfflineAction, SnackbarErrorAction } from '@alfresco/aca-shared/store';
|
import { DownloadNodesAction, EditOfflineAction, SnackbarErrorAction } from '@alfresco/aca-shared/store';
|
||||||
import { AppTestingModule } from '../../../testing/app-testing.module';
|
import { AppTestingModule } from '../../../testing/app-testing.module';
|
||||||
import { NodeActionsService } from '../../../services/node-actions.service';
|
|
||||||
|
|
||||||
describe('ToggleEditOfflineComponent', () => {
|
describe('ToggleEditOfflineComponent', () => {
|
||||||
let fixture: ComponentFixture<ToggleEditOfflineComponent>;
|
let fixture: ComponentFixture<ToggleEditOfflineComponent>;
|
||||||
@@ -39,49 +38,6 @@ describe('ToggleEditOfflineComponent', () => {
|
|||||||
let selectSpy: jasmine.Spy;
|
let selectSpy: jasmine.Spy;
|
||||||
let selection: any;
|
let selection: any;
|
||||||
|
|
||||||
const lockedNodeEntry: NodeEntry = {
|
|
||||||
entry: {
|
|
||||||
isFile: true,
|
|
||||||
createdByUser: {
|
|
||||||
id: 'hruser',
|
|
||||||
displayName: 'hruser'
|
|
||||||
},
|
|
||||||
modifiedAt: new Date('2023-09-08T11:54:48.325+0000'),
|
|
||||||
nodeType: 'cm:content',
|
|
||||||
content: {
|
|
||||||
mimeType: 'image/jpeg',
|
|
||||||
mimeTypeName: 'JPEG Image',
|
|
||||||
sizeInBytes: 128473,
|
|
||||||
encoding: 'UTF-8'
|
|
||||||
},
|
|
||||||
parentId: '5a2d88ec-a29c-408a-874d-6394940c51d7',
|
|
||||||
aspectNames: ['cm:versionable', 'cm:lockable', 'cm:auditable', 'cm:taggable', 'exif:exif'],
|
|
||||||
createdAt: new Date('2023-09-07T11:10:48.788+0000'),
|
|
||||||
isFolder: false,
|
|
||||||
modifiedByUser: {
|
|
||||||
id: 'hruser',
|
|
||||||
displayName: 'hruser'
|
|
||||||
},
|
|
||||||
name: 'e2e_favorite_file.jpg',
|
|
||||||
id: '36e5b5ad-3fa0-47e2-b256-016b868ac772',
|
|
||||||
properties: {
|
|
||||||
'cm:lockType': 'WRITE_LOCK',
|
|
||||||
'cm:lockOwner': {
|
|
||||||
id: 'hruser',
|
|
||||||
displayName: 'hruser'
|
|
||||||
},
|
|
||||||
'cm:versionType': 'MAJOR',
|
|
||||||
'cm:versionLabel': '1.0',
|
|
||||||
'cm:lockLifetime': 'PERSISTENT',
|
|
||||||
'exif:pixelYDimension': 1253,
|
|
||||||
'exif:pixelXDimension': 1024
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const nodesApiMock = jasmine.createSpyObj('nodesApi', ['lockNode', 'unlockNode']);
|
|
||||||
const nodeActionsServiceMock = jasmine.createSpyObj('nodeActionsService', ['setNodeLocked']);
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [AppTestingModule, ToggleEditOfflineComponent],
|
imports: [AppTestingModule, ToggleEditOfflineComponent],
|
||||||
@@ -92,9 +48,7 @@ describe('ToggleEditOfflineComponent', () => {
|
|||||||
select: () => {},
|
select: () => {},
|
||||||
dispatch: () => {}
|
dispatch: () => {}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
{ provide: NodesApi, useValue: nodesApiMock },
|
|
||||||
{ provide: NodeActionsService, useValue: nodeActionsServiceMock }
|
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -179,51 +133,4 @@ describe('ToggleEditOfflineComponent', () => {
|
|||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should call setNodeLocked with true when a node is locked', () => {
|
|
||||||
const nodeId = 'testNode1';
|
|
||||||
nodesApiMock.lockNode.and.returnValue(Promise.resolve(lockedNodeEntry));
|
|
||||||
|
|
||||||
component.lockNode(nodeId).then((result) => {
|
|
||||||
expect(nodesApiMock.lockNode).toHaveBeenCalledWith(nodeId, {
|
|
||||||
type: 'ALLOW_OWNER_CHANGES',
|
|
||||||
lifetime: 'PERSISTENT'
|
|
||||||
});
|
|
||||||
expect(nodeActionsServiceMock.setNodeLocked).toHaveBeenCalledWith(true);
|
|
||||||
expect(result).toEqual(lockedNodeEntry);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should call setNodeLocked with false when a node is unlocked', () => {
|
|
||||||
const nodeId = 'testNode2';
|
|
||||||
nodesApiMock.unlockNode.and.returnValue(Promise.resolve(lockedNodeEntry));
|
|
||||||
|
|
||||||
component.unlockNode(nodeId).then((result) => {
|
|
||||||
expect(nodesApiMock.unlockNode).toHaveBeenCalledWith(nodeId);
|
|
||||||
expect(nodeActionsServiceMock.setNodeLocked).toHaveBeenCalledWith(false);
|
|
||||||
expect(result).toEqual(lockedNodeEntry);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle errors when locking a node encounters an error', () => {
|
|
||||||
const nodeId = 'testNode1';
|
|
||||||
const error = new Error('Locking failed');
|
|
||||||
nodesApiMock.lockNode.and.returnValue(Promise.reject(error));
|
|
||||||
component.lockNode(nodeId).catch((err) => {
|
|
||||||
expect(nodesApiMock.lockNode).toHaveBeenCalledWith(nodeId, { type: 'ALLOW_OWNER_CHANGES', lifetime: 'PERSISTENT' });
|
|
||||||
expect(nodeActionsServiceMock.setNodeLocked).not.toHaveBeenCalled();
|
|
||||||
expect(err).toEqual(error);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle errors when unlocking a node encounters an error', () => {
|
|
||||||
const nodeId = 'testNode1';
|
|
||||||
const error = new Error('Unlocking failed');
|
|
||||||
nodesApiMock.unlockNode.and.returnValue(Promise.reject(error));
|
|
||||||
component.unlockNode(nodeId).catch((err) => {
|
|
||||||
expect(nodesApiMock.lockNode).toHaveBeenCalledWith(nodeId);
|
|
||||||
expect(nodeActionsServiceMock.setNodeLocked).not.toHaveBeenCalled();
|
|
||||||
expect(err).toEqual(error);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
@@ -31,7 +31,7 @@ import {
|
|||||||
getAppSelection
|
getAppSelection
|
||||||
} from '@alfresco/aca-shared/store';
|
} from '@alfresco/aca-shared/store';
|
||||||
import { NodeEntry, SharedLinkEntry, Node, NodesApi } from '@alfresco/js-api';
|
import { NodeEntry, SharedLinkEntry, Node, NodesApi } from '@alfresco/js-api';
|
||||||
import { ChangeDetectorRef, Component, OnInit, ViewEncapsulation } from '@angular/core';
|
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { AppExtensionService, isLocked } from '@alfresco/aca-shared';
|
import { AppExtensionService, isLocked } from '@alfresco/aca-shared';
|
||||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||||
@@ -39,7 +39,6 @@ import { CommonModule } from '@angular/common';
|
|||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { MatMenuModule } from '@angular/material/menu';
|
import { MatMenuModule } from '@angular/material/menu';
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
import { NodeActionsService } from '../../../services/node-actions.service';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
@@ -60,13 +59,7 @@ export class ToggleEditOfflineComponent implements OnInit {
|
|||||||
nodeTitle = '';
|
nodeTitle = '';
|
||||||
isNodeLocked = false;
|
isNodeLocked = false;
|
||||||
|
|
||||||
constructor(
|
constructor(private store: Store<AppStore>, private alfrescoApiService: AlfrescoApiService, private extensions: AppExtensionService) {
|
||||||
private store: Store<AppStore>,
|
|
||||||
private alfrescoApiService: AlfrescoApiService,
|
|
||||||
private nodeActionsService: NodeActionsService,
|
|
||||||
private cdr: ChangeDetectorRef,
|
|
||||||
private extensions: AppExtensionService
|
|
||||||
) {
|
|
||||||
this.nodesApi = new NodesApi(this.alfrescoApiService.getInstance());
|
this.nodesApi = new NodesApi(this.alfrescoApiService.getInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,7 +68,6 @@ export class ToggleEditOfflineComponent implements OnInit {
|
|||||||
this.selection = file;
|
this.selection = file;
|
||||||
this.isNodeLocked = this.selection && isLocked(this.selection);
|
this.isNodeLocked = this.selection && isLocked(this.selection);
|
||||||
this.nodeTitle = this.isNodeLocked ? 'APP.ACTIONS.EDIT_OFFLINE_CANCEL' : 'APP.ACTIONS.EDIT_OFFLINE';
|
this.nodeTitle = this.isNodeLocked ? 'APP.ACTIONS.EDIT_OFFLINE_CANCEL' : 'APP.ACTIONS.EDIT_OFFLINE';
|
||||||
this.cdr.detectChanges();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,27 +119,15 @@ export class ToggleEditOfflineComponent implements OnInit {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
lockNode(nodeId: string): Promise<NodeEntry> {
|
lockNode(nodeId: string) {
|
||||||
return this.nodesApi.lockNode(nodeId, { type: 'ALLOW_OWNER_CHANGES', lifetime: 'PERSISTENT' }).then(
|
return this.nodesApi.lockNode(nodeId, {
|
||||||
(res: NodeEntry) => {
|
type: 'ALLOW_OWNER_CHANGES',
|
||||||
this.nodeActionsService.setNodeLocked(true);
|
lifetime: 'PERSISTENT'
|
||||||
return res;
|
});
|
||||||
},
|
|
||||||
(error) => {
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
unlockNode(nodeId: string): Promise<NodeEntry> {
|
|
||||||
return this.nodesApi.unlockNode(nodeId).then(
|
unlockNode(nodeId: string) {
|
||||||
(res: NodeEntry) => {
|
return this.nodesApi.unlockNode(nodeId);
|
||||||
this.nodeActionsService.setNodeLocked(false);
|
|
||||||
return res;
|
|
||||||
},
|
|
||||||
(error) => {
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private update(data: Node) {
|
private update(data: Node) {
|
||||||
|
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
import { Observable, Subject, of, zip, from, BehaviorSubject } from 'rxjs';
|
import { Observable, Subject, of, zip, from } from 'rxjs';
|
||||||
import { AlfrescoApiService, TranslationService, ThumbnailService } from '@alfresco/adf-core';
|
import { AlfrescoApiService, TranslationService, ThumbnailService } from '@alfresco/adf-core';
|
||||||
import {
|
import {
|
||||||
DocumentListService,
|
DocumentListService,
|
||||||
@@ -49,7 +49,6 @@ export class NodeActionsService {
|
|||||||
contentMoved: Subject<any> = new Subject<any>();
|
contentMoved: Subject<any> = new Subject<any>();
|
||||||
moveDeletedEntries: any[] = [];
|
moveDeletedEntries: any[] = [];
|
||||||
isSitesDestinationAvailable = false;
|
isSitesDestinationAvailable = false;
|
||||||
private isNodeLockedSubject = new BehaviorSubject<boolean>(false);
|
|
||||||
isNodeLocked$: Observable<any>;
|
isNodeLocked$: Observable<any>;
|
||||||
|
|
||||||
_nodesApi: NodesApi;
|
_nodesApi: NodesApi;
|
||||||
@@ -66,9 +65,7 @@ export class NodeActionsService {
|
|||||||
private apiService: AlfrescoApiService,
|
private apiService: AlfrescoApiService,
|
||||||
private translation: TranslationService,
|
private translation: TranslationService,
|
||||||
private thumbnailService: ThumbnailService
|
private thumbnailService: ThumbnailService
|
||||||
) {
|
) {}
|
||||||
this.isNodeLocked$ = this.isNodeLockedSubject.asObservable();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy node list
|
* Copy node list
|
||||||
@@ -92,10 +89,6 @@ export class NodeActionsService {
|
|||||||
return this.doBatchOperation(NodeAction.MOVE, contentEntities, permission, focusedElementOnCloseSelector);
|
return this.doBatchOperation(NodeAction.MOVE, contentEntities, permission, focusedElementOnCloseSelector);
|
||||||
}
|
}
|
||||||
|
|
||||||
setNodeLocked(isLocked: boolean) {
|
|
||||||
this.isNodeLockedSubject.next(isLocked);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* General method for performing the given operation (copy|move) to multiple nodes
|
* General method for performing the given operation (copy|move) to multiple nodes
|
||||||
*
|
*
|
||||||
|
@@ -511,6 +511,8 @@ export const canEditAspects = (context: RuleContext): boolean =>
|
|||||||
repository.isMajorVersionAvailable(context, '7')
|
repository.isMajorVersionAvailable(context, '7')
|
||||||
].every(Boolean);
|
].every(Boolean);
|
||||||
|
|
||||||
|
export const canNotShowExpand = (context: RuleContext): boolean => [!navigation.isLibraries(context), !navigation.isDetails(context)].every(Boolean);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if user can manage permissions for the selected node.
|
* Checks if user can manage permissions for the selected node.
|
||||||
* JSON ref: `canManagePermissions`
|
* JSON ref: `canManagePermissions`
|
||||||
|
@@ -110,6 +110,11 @@ export function isLibraryContent(context: RuleContext): boolean {
|
|||||||
return url && (url.endsWith('/libraries') || url.includes('/libraries/') || url.startsWith('/search-libraries'));
|
return url && (url.endsWith('/libraries') || url.includes('/libraries/') || url.startsWith('/search-libraries'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isDetails(context: RuleContext): boolean {
|
||||||
|
const { url } = context.navigation;
|
||||||
|
return url && (url.endsWith('/details') || url.includes('/details/') || url.startsWith('/details'));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the activated route is neither **Libraries** nor **Library Search Results**.
|
* Checks if the activated route is neither **Libraries** nor **Library Search Results**.
|
||||||
* JSON ref: `app.navigation.isNotLibraries`
|
* JSON ref: `app.navigation.isNotLibraries`
|
||||||
|
Reference in New Issue
Block a user