[ACS-5540] Modified changes

This commit is contained in:
Yasa-Nataliya
2023-09-05 21:22:45 +05:30
parent 3e435be1d0
commit bcd2d1c147
6 changed files with 60 additions and 10 deletions

View File

@@ -13,7 +13,7 @@
<span class="acs-details-breadcrumb-item">{{ 'APP.INFO_DRAWER.TITLE' | translate }}</span>
</div>
<div>
<button
<button *ngIf="!isNodeLocked"
mat-icon-button
(click)="openAspectDialog()"
[attr.title]="'CORE.METADATA.ACTIONS.EDIT_ASPECTS' | translate"

View File

@@ -24,8 +24,8 @@
import { Component, OnInit, ViewEncapsulation, OnDestroy, Input } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { ContentApiService, PageComponent, PageLayoutComponent, ToolbarComponent } from '@alfresco/aca-shared';
import { NavigateToPreviousPage, SetSelectedNodesAction } from '@alfresco/aca-shared/store';
import { ContentApiService, PageComponent, PageLayoutComponent, ToolbarComponent, isLocked } from '@alfresco/aca-shared';
import { NavigateToPreviousPage, SetSelectedNodesAction, getAppSelection } from '@alfresco/aca-shared/store';
import { Subject } from 'rxjs';
import { BreadcrumbModule, PermissionManagerModule, NodeAspectService } from '@alfresco/adf-content-services';
import { CommonModule } from '@angular/common';
@@ -36,6 +36,8 @@ import { MatProgressBarModule } from '@angular/material/progress-bar';
import { MatButtonModule } from '@angular/material/button';
import { MetadataTabComponent } from '../info-drawer/metadata-tab/metadata-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';
@Component({
standalone: true,
@@ -66,10 +68,15 @@ export class DetailsComponent extends PageComponent implements OnInit, OnDestroy
isLoading: boolean;
onDestroy$ = new Subject<boolean>();
activeTab = 1;
editAspectSupported = false;
hasAllowableOperations = false;
selectionState: NodeEntry;
isNodeLocked: boolean;
constructor(private route: ActivatedRoute, private contentApi: ContentApiService, private nodeAspectService: NodeAspectService) {
constructor(
private route: ActivatedRoute,
private contentApi: ContentApiService,
private nodeAspectService: NodeAspectService,
private nodeActionsService: NodeActionsService
) {
super();
}
@@ -90,6 +97,14 @@ export class DetailsComponent extends PageComponent implements OnInit, OnDestroy
this.store.dispatch(new SetSelectedNodesAction([{ entry: this.node }]));
});
});
this.store.select(getAppSelection).subscribe(({ file }) => {
this.selectionState = file;
const isNodeLockedFromStore = this.selection && isLocked(this.selectionState);
this.nodeActionsService.isNodeLocked().subscribe((isNodeLockedFromService) => {
this.isNodeLocked = isNodeLockedFromStore || isNodeLockedFromService;
});
});
}
setActiveTab(tabName: string) {

View File

@@ -39,6 +39,7 @@ import { CommonModule } from '@angular/common';
import { TranslateModule } from '@ngx-translate/core';
import { MatMenuModule } from '@angular/material/menu';
import { MatIconModule } from '@angular/material/icon';
import { NodeActionsService } from '../../../services/node-actions.service';
@Component({
standalone: true,
@@ -59,7 +60,7 @@ export class ToggleEditOfflineComponent implements OnInit {
nodeTitle = '';
isNodeLocked = false;
constructor(private store: Store<AppStore>, private alfrescoApiService: AlfrescoApiService) {
constructor(private store: Store<AppStore>, private alfrescoApiService: AlfrescoApiService, private nodeActionsService: NodeActionsService) {
this.nodesApi = new NodesApi(this.alfrescoApiService.getInstance());
}
@@ -119,6 +120,7 @@ export class ToggleEditOfflineComponent implements OnInit {
}
lockNode(nodeId: string) {
this.nodeActionsService.setNodeLocked(true);
return this.nodesApi.lockNode(nodeId, {
type: 'ALLOW_OWNER_CHANGES',
lifetime: 'PERSISTENT'
@@ -126,6 +128,7 @@ export class ToggleEditOfflineComponent implements OnInit {
}
unlockNode(nodeId: string) {
this.nodeActionsService.setNodeLocked(false);
return this.nodesApi.unlockNode(nodeId);
}

View File

@@ -24,7 +24,7 @@
import { Injectable } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { Observable, Subject, of, zip, from } from 'rxjs';
import { Observable, Subject, of, zip, from, BehaviorSubject } from 'rxjs';
import { AlfrescoApiService, TranslationService, ThumbnailService } from '@alfresco/adf-core';
import {
DocumentListService,
@@ -49,6 +49,7 @@ export class NodeActionsService {
contentMoved: Subject<any> = new Subject<any>();
moveDeletedEntries: any[] = [];
isSitesDestinationAvailable = false;
private isNodeLockedSubject: BehaviorSubject<boolean>;
_nodesApi: NodesApi;
get nodesApi(): NodesApi {
@@ -64,7 +65,9 @@ export class NodeActionsService {
private apiService: AlfrescoApiService,
private translation: TranslationService,
private thumbnailService: ThumbnailService
) {}
) {
this.isNodeLockedSubject = new BehaviorSubject<boolean>(false);
}
/**
* Copy node list
@@ -88,6 +91,14 @@ export class NodeActionsService {
return this.doBatchOperation(NodeAction.MOVE, contentEntities, permission, focusedElementOnCloseSelector);
}
setNodeLocked(isLocked: boolean) {
this.isNodeLockedSubject.next(isLocked);
}
isNodeLocked(): Observable<boolean> {
return this.isNodeLockedSubject.asObservable();
}
/**
* General method for performing the given operation (copy|move) to multiple nodes
*

View File

@@ -12,3 +12,22 @@
}
}
}
.adf-info-drawer-layout-content .app-metadata-tab .adf-metadata-properties .mat-expansion-panel {
border: 1px solid var(--adf-metadata-property-panel-border-color);
border-radius: 12px;
margin-bottom: 12px;
}
.acs-details-container {
.mat-tab-body-content {
.adf-metadata-properties {
.mat-expansion-panel {
width: 755px;
border: 1px solid var(--adf-metadata-property-panel-border-color);
margin: 24px;
border-radius: 12px;
}
}
}
}

View File

@@ -38,6 +38,7 @@ $disabled-chip-background-color: #f5f5f5;
$contrast-gray: #646569;
$adf-metadata-property-panel-border-color: rgba(0, 0, 0, 0.12);
$adf-metadata-buttons-background-color: rgba(33, 33, 33, 0.05);
$adf-snackbar-message-background-color: #ba1b1b;
// CSS Variables
$defaults: (
@@ -80,7 +81,8 @@ $defaults: (
--theme-disabled-chip-background-color: $disabled-chip-background-color,
--theme-contrast-gray: $contrast-gray,
--adf-metadata-property-panel-border-color: $adf-metadata-property-panel-border-color,
--adf-metadata-buttons-background-color: $adf-metadata-buttons-background-color
--adf-metadata-buttons-background-color: $adf-metadata-buttons-background-color,
--adf-snackbar-message-background-color: $adf-snackbar-message-background-color
);
// propagates SCSS variables into the CSS variables scope