From 5102f7d64d29899bf08dc6c66c88df91f347ddc8 Mon Sep 17 00:00:00 2001 From: Cilibiu Bogdan Date: Tue, 28 Jan 2020 09:00:48 +0200 Subject: [PATCH] [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 --- .../locked-by/locked-by.component.scss | 6 ++++ .../locked-by/locked-by.component.ts | 2 +- .../components/locked-by/locked-by.module.ts | 36 +++++++++++++++++++ .../aca-shared/src/lib}/utils/node.utils.ts | 0 projects/aca-shared/src/public-api.ts | 4 +++ .../document-list-custom-components.module.ts | 11 +++--- .../name-column/name-column.component.ts | 2 +- .../comments-tab/comments-tab.component.ts | 3 +- .../metadata-tab/metadata-tab.component.ts | 3 +- src/app/components/page.component.ts | 2 +- src/app/directives/lock-node.directive.ts | 2 +- 11 files changed, 58 insertions(+), 13 deletions(-) rename {src/app/components/dl-custom-components => projects/aca-shared/src/lib/components}/locked-by/locked-by.component.scss (52%) rename {src/app/components/dl-custom-components => projects/aca-shared/src/lib/components}/locked-by/locked-by.component.ts (97%) create mode 100644 projects/aca-shared/src/lib/components/locked-by/locked-by.module.ts rename {src/app => projects/aca-shared/src/lib}/utils/node.utils.ts (100%) diff --git a/src/app/components/dl-custom-components/locked-by/locked-by.component.scss b/projects/aca-shared/src/lib/components/locked-by/locked-by.component.scss similarity index 52% rename from src/app/components/dl-custom-components/locked-by/locked-by.component.scss rename to projects/aca-shared/src/lib/components/locked-by/locked-by.component.scss index 95483bd13..d8af3451a 100644 --- a/src/app/components/dl-custom-components/locked-by/locked-by.component.scss +++ b/projects/aca-shared/src/lib/components/locked-by/locked-by.component.scss @@ -1,4 +1,9 @@ .aca-locked-by { + display: flex; + align-items: center; + padding: 0 10px; + color: var(--theme-text-color, rgba(0, 0, 0, 0.54)); + .locked_by--icon { font-size: 14px; width: 14px; @@ -7,5 +12,6 @@ .locked_by--name { font-size: 12px; + padding: 0 2px; } } diff --git a/src/app/components/dl-custom-components/locked-by/locked-by.component.ts b/projects/aca-shared/src/lib/components/locked-by/locked-by.component.ts similarity index 97% rename from src/app/components/dl-custom-components/locked-by/locked-by.component.ts rename to projects/aca-shared/src/lib/components/locked-by/locked-by.component.ts index 96e88b65e..664dea37c 100644 --- a/src/app/components/dl-custom-components/locked-by/locked-by.component.ts +++ b/projects/aca-shared/src/lib/components/locked-by/locked-by.component.ts @@ -46,7 +46,7 @@ import { NodeEntry } from '@alfresco/js-api'; class: 'aca-locked-by' } }) -export class LockByComponent implements OnInit { +export class LockedByComponent implements OnInit { @Input() context: any; diff --git a/projects/aca-shared/src/lib/components/locked-by/locked-by.module.ts b/projects/aca-shared/src/lib/components/locked-by/locked-by.module.ts new file mode 100644 index 000000000..578023565 --- /dev/null +++ b/projects/aca-shared/src/lib/components/locked-by/locked-by.module.ts @@ -0,0 +1,36 @@ +/*! + * @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 . + */ + +import { NgModule } from '@angular/core'; +import { LockedByComponent } from './locked-by.component'; +import { MatIconModule } from '@angular/material/icon'; +import { CommonModule } from '@angular/common'; + +@NgModule({ + imports: [CommonModule, MatIconModule], + declarations: [LockedByComponent], + exports: [LockedByComponent] +}) +export class LockedByModule {} diff --git a/src/app/utils/node.utils.ts b/projects/aca-shared/src/lib/utils/node.utils.ts similarity index 100% rename from src/app/utils/node.utils.ts rename to projects/aca-shared/src/lib/utils/node.utils.ts diff --git a/projects/aca-shared/src/public-api.ts b/projects/aca-shared/src/public-api.ts index de7d4d9aa..a3a2a55b1 100644 --- a/projects/aca-shared/src/public-api.ts +++ b/projects/aca-shared/src/public-api.ts @@ -28,6 +28,8 @@ export * from './lib/components/page-layout/page-layout-error.component'; export * from './lib/components/page-layout/page-layout-header.component'; export * from './lib/components/page-layout/page-layout.component'; export * from './lib/components/page-layout/page-layout.module'; +export * from './lib/components/locked-by/locked-by.component'; +export * from './lib/components/locked-by/locked-by.module'; export * from './lib/routing/app.routes.strategy'; export * from './lib/routing/shared.guard'; @@ -42,4 +44,6 @@ export * from './lib/components/generic-error/generic-error.module'; export * from './lib/directives/contextmenu/contextmenu.directive'; export * from './lib/directives/contextmenu/contextmenu.module'; +export * from './lib/utils/node.utils'; + export * from './lib/shared.module'; diff --git a/src/app/components/dl-custom-components/document-list-custom-components.module.ts b/src/app/components/dl-custom-components/document-list-custom-components.module.ts index c1c27ce62..12058e56a 100644 --- a/src/app/components/dl-custom-components/document-list-custom-components.module.ts +++ b/src/app/components/dl-custom-components/document-list-custom-components.module.ts @@ -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 {} diff --git a/src/app/components/dl-custom-components/name-column/name-column.component.ts b/src/app/components/dl-custom-components/name-column/name-column.component.ts index b26577c25..e23ce9723 100644 --- a/src/app/components/dl-custom-components/name-column/name-column.component.ts +++ b/src/app/components/dl-custom-components/name-column/name-column.component.ts @@ -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', diff --git a/src/app/components/info-drawer/comments-tab/comments-tab.component.ts b/src/app/components/info-drawer/comments-tab/comments-tab.component.ts index d8c4ee8ce..4a42d4f8f 100644 --- a/src/app/components/info-drawer/comments-tab/comments-tab.component.ts +++ b/src/app/components/info-drawer/comments-tab/comments-tab.component.ts @@ -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', diff --git a/src/app/components/info-drawer/metadata-tab/metadata-tab.component.ts b/src/app/components/info-drawer/metadata-tab/metadata-tab.component.ts index 190e2242e..33fc05e35 100644 --- a/src/app/components/info-drawer/metadata-tab/metadata-tab.component.ts +++ b/src/app/components/info-drawer/metadata-tab/metadata-tab.component.ts @@ -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'; diff --git a/src/app/components/page.component.ts b/src/app/components/page.component.ts index 9f0765f9a..ed0e259d2 100644 --- a/src/app/components/page.component.ts +++ b/src/app/components/page.component.ts @@ -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 = new Subject(); diff --git a/src/app/directives/lock-node.directive.ts b/src/app/directives/lock-node.directive.ts index 6953a7c35..15e701e5a 100644 --- a/src/app/directives/lock-node.directive.ts +++ b/src/app/directives/lock-node.directive.ts @@ -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]',