mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2026-09-09 18:02:54 +00:00
[ACA-2704] move Locked By to aca-shared library (#1322)
* move component to aca-shared * use aca-shared import * update e2e * fix selector prefix * remove * move node utils to aca-shared * update reference * fix lint * fix linting
This commit is contained in:
committed by
Denys Vuika
parent
4c7a95c7e6
commit
5102f7d64d
@@ -26,7 +26,7 @@
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CustomNameColumnComponent } from './name-column/name-column.component';
|
||||
import { LockByComponent } from './locked-by/locked-by.component';
|
||||
import { LockedByModule } from '@alfresco/aca-shared';
|
||||
import { ContentModule } from '@alfresco/adf-content-services';
|
||||
import { MaterialModule } from '../../material.module';
|
||||
import { CoreModule } from '@alfresco/adf-core';
|
||||
@@ -36,10 +36,11 @@ import { CoreModule } from '@alfresco/adf-core';
|
||||
BrowserModule,
|
||||
CoreModule.forChild(),
|
||||
ContentModule.forChild(),
|
||||
MaterialModule
|
||||
MaterialModule,
|
||||
LockedByModule
|
||||
],
|
||||
declarations: [CustomNameColumnComponent, LockByComponent],
|
||||
exports: [CustomNameColumnComponent, LockByComponent],
|
||||
entryComponents: [CustomNameColumnComponent, LockByComponent]
|
||||
declarations: [CustomNameColumnComponent],
|
||||
exports: [CustomNameColumnComponent],
|
||||
entryComponents: [CustomNameColumnComponent]
|
||||
})
|
||||
export class DocumentListCustomComponentsModule {}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
.aca-locked-by {
|
||||
.locked_by--icon {
|
||||
font-size: 14px;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
}
|
||||
|
||||
.locked_by--name {
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2020 Alfresco Software Limited
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {
|
||||
Component,
|
||||
Input,
|
||||
OnInit,
|
||||
ChangeDetectionStrategy,
|
||||
ViewEncapsulation
|
||||
} from '@angular/core';
|
||||
|
||||
import { NodeEntry } from '@alfresco/js-api';
|
||||
|
||||
@Component({
|
||||
selector: 'aca-locked-by',
|
||||
template: `
|
||||
<mat-icon class="locked_by--icon">lock</mat-icon>
|
||||
<span class="locked_by--name">{{ writeLockedBy() }}</span>
|
||||
`,
|
||||
styleUrls: ['./locked-by.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
encapsulation: ViewEncapsulation.None,
|
||||
host: {
|
||||
class: 'aca-locked-by'
|
||||
}
|
||||
})
|
||||
export class LockByComponent implements OnInit {
|
||||
@Input()
|
||||
context: any;
|
||||
|
||||
node: NodeEntry;
|
||||
|
||||
constructor() {}
|
||||
|
||||
ngOnInit() {
|
||||
this.node = this.context.row.node;
|
||||
}
|
||||
|
||||
writeLockedBy() {
|
||||
return (
|
||||
this.node &&
|
||||
this.node.entry.properties &&
|
||||
this.node.entry.properties['cm:lockOwner'] &&
|
||||
this.node.entry.properties['cm:lockOwner'].displayName
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,7 @@ import { Actions, ofType } from '@ngrx/effects';
|
||||
import { Subject } from 'rxjs';
|
||||
import { filter, takeUntil } from 'rxjs/operators';
|
||||
import { NodeActionTypes } from '@alfresco/aca-shared/store';
|
||||
import { isLocked } from '../../../utils/node.utils';
|
||||
import { isLocked } from '@alfresco/aca-shared';
|
||||
|
||||
@Component({
|
||||
selector: 'aca-custom-name-column',
|
||||
|
||||
@@ -25,8 +25,7 @@
|
||||
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { MinimalNodeEntryEntity } from '@alfresco/js-api';
|
||||
import { NodePermissionService } from '@alfresco/aca-shared';
|
||||
import { isLocked } from '../../../utils/node.utils';
|
||||
import { NodePermissionService, isLocked } from '@alfresco/aca-shared';
|
||||
|
||||
@Component({
|
||||
selector: 'app-comments-tab',
|
||||
|
||||
@@ -31,11 +31,10 @@ import {
|
||||
OnDestroy
|
||||
} from '@angular/core';
|
||||
import { MinimalNodeEntryEntity } from '@alfresco/js-api';
|
||||
import { NodePermissionService } from '@alfresco/aca-shared';
|
||||
import { NodePermissionService, isLocked } from '@alfresco/aca-shared';
|
||||
import { AppStore, infoDrawerMetadataAspect } from '@alfresco/aca-shared/store';
|
||||
import { AppExtensionService } from '../../../extensions/extension.service';
|
||||
import { AppConfigService, NotificationService } from '@alfresco/adf-core';
|
||||
import { isLocked } from '../../../utils/node.utils';
|
||||
import { Observable, Subject } from 'rxjs';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { ContentMetadataService } from '@alfresco/adf-content-services';
|
||||
|
||||
@@ -47,7 +47,7 @@ import {
|
||||
ViewNodeExtras,
|
||||
SetSelectedNodesAction
|
||||
} from '@alfresco/aca-shared/store';
|
||||
import { isLocked, isLibrary } from '../utils/node.utils';
|
||||
import { isLocked, isLibrary } from '@alfresco/aca-shared';
|
||||
|
||||
export abstract class PageComponent implements OnInit, OnDestroy {
|
||||
onDestroy$: Subject<boolean> = new Subject<boolean>();
|
||||
|
||||
@@ -32,7 +32,7 @@ import {
|
||||
} from '@angular/core';
|
||||
import { NodeEntry, NodeBodyLock, SharedLinkEntry } from '@alfresco/js-api';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { isLocked } from '../utils/node.utils';
|
||||
import { isLocked } from '@alfresco/aca-shared';
|
||||
|
||||
@Directive({
|
||||
selector: '[acaLockNode]',
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2020 Alfresco Software Limited
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Node } from '@alfresco/js-api';
|
||||
|
||||
export function isLocked(node: { entry: Node }): boolean {
|
||||
const { entry } = node;
|
||||
|
||||
return (
|
||||
(entry && entry.isLocked) ||
|
||||
(entry.properties &&
|
||||
(entry.properties['cm:lockType'] === 'READ_ONLY_LOCK' ||
|
||||
entry.properties['cm:lockType'] === 'WRITE_LOCK'))
|
||||
);
|
||||
}
|
||||
|
||||
export function isLibrary(node: { entry: Node | any }): boolean {
|
||||
const { entry } = node;
|
||||
|
||||
return (
|
||||
(entry.guid &&
|
||||
entry.id &&
|
||||
entry.preset &&
|
||||
entry.title &&
|
||||
entry.visibility) ||
|
||||
entry.nodeType === 'st:site'
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user