diff --git a/projects/adf-office-services-ext/src/lib/aos-extension.service.ts b/projects/adf-office-services-ext/src/lib/aos-extension.service.ts index 3c89204cc..6d5e84961 100644 --- a/projects/adf-office-services-ext/src/lib/aos-extension.service.ts +++ b/projects/adf-office-services-ext/src/lib/aos-extension.service.ts @@ -26,7 +26,9 @@ export class AosEditOnlineService { // const checkedOut = node.aspectNames.find( // (aspect: string) => aspect === 'cm:checkedOut' // ); - const checkedOut = node.properties['cm:lockType'] === 'WRITE_LOCK'; + const checkedOut = + node.properties['cm:lockType'] === 'WRITE_LOCK' || + node.properties['cm:lockType'] === 'READ_ONLY_LOCK'; const lockOwner = node.properties['cm:lockOwner']; const differentLockOwner = lockOwner.id !== this.alfrescoAuthenticationService.getEcmUsername(); diff --git a/projects/adf-office-services-ext/src/lib/evaluators.ts b/projects/adf-office-services-ext/src/lib/evaluators.ts index 992e672de..7b39cd568 100644 --- a/projects/adf-office-services-ext/src/lib/evaluators.ts +++ b/projects/adf-office-services-ext/src/lib/evaluators.ts @@ -32,7 +32,10 @@ export function canOpenWithOffice( } */ - if (file.entry.properties['cm:lockType'] === 'WRITE_LOCK') { + if ( + file.entry.properties['cm:lockType'] === 'WRITE_LOCK' || + file.entry.properties['cm:lockType'] === 'READ_ONLY_LOCK' + ) { return false; } diff --git a/src/app.config.json b/src/app.config.json index 259970ab0..c3de27da7 100644 --- a/src/app.config.json +++ b/src/app.config.json @@ -20,7 +20,6 @@ "logo": "assets/images/alfresco-logo-flower.svg", "copyright": "© 2017 - 2018 Alfresco Software, Inc. All rights reserved." }, - "experimental": {}, "headerColor": "#2196F3", "languagePicker": false, "pagination": { 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 138c85de2..e23b9b41d 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 @@ -28,6 +28,7 @@ import { EDIT_OFFLINE } from '../../../store/actions'; import { NodeEntry } from '@alfresco/js-api'; import { Subject } from 'rxjs'; import { filter, takeUntil } from 'rxjs/operators'; +import { isLocked } from '../../../utils/node.utils'; @Component({ selector: 'aca-custom-name-column', @@ -84,11 +85,6 @@ export class CustomNameColumnComponent implements OnInit, OnDestroy { } isFileWriteLocked() { - return !!( - this.node && - this.node.entry && - this.node.entry.properties && - this.node.entry.properties['cm:lockType'] === 'WRITE_LOCK' - ); + return isLocked(this.node); } } diff --git a/src/app/components/favorite-libraries/favorite-libraries.component.html b/src/app/components/favorite-libraries/favorite-libraries.component.html index 19e6c06f7..c8efa09f2 100644 --- a/src/app/components/favorite-libraries/favorite-libraries.component.html +++ b/src/app/components/favorite-libraries/favorite-libraries.component.html @@ -4,10 +4,6 @@ - - diff --git a/src/app/components/favorite-libraries/favorite-libraries.component.spec.ts b/src/app/components/favorite-libraries/favorite-libraries.component.spec.ts index f21ea0cc1..a1b7f4403 100644 --- a/src/app/components/favorite-libraries/favorite-libraries.component.spec.ts +++ b/src/app/components/favorite-libraries/favorite-libraries.component.spec.ts @@ -39,7 +39,6 @@ import { DocumentListComponent } from '@alfresco/adf-content-services'; import { FavoriteLibrariesComponent } from './favorite-libraries.component'; import { AppTestingModule } from '../../testing/app-testing.module'; import { ContentApiService } from '../../services/content-api.service'; -import { ExperimentalDirective } from '../../directives/experimental.directive'; import { ContentManagementService } from '../../services/content-management.service'; import { EffectsModule } from '@ngrx/effects'; import { LibraryEffects, RouterEffects } from '../../store/effects'; @@ -77,8 +76,7 @@ describe('FavoriteLibrariesComponent', () => { NodeFavoriteDirective, DocumentListComponent, FavoriteLibrariesComponent, - AppConfigPipe, - ExperimentalDirective + AppConfigPipe ], providers: [ContentManagementService, UserPreferencesService], schemas: [NO_ERRORS_SCHEMA] diff --git a/src/app/components/favorites/favorites.component.spec.ts b/src/app/components/favorites/favorites.component.spec.ts index a2fdfd4ad..2d2ab6fa2 100644 --- a/src/app/components/favorites/favorites.component.spec.ts +++ b/src/app/components/favorites/favorites.component.spec.ts @@ -40,7 +40,6 @@ import { of } from 'rxjs'; import { FavoritesComponent } from './favorites.component'; import { AppTestingModule } from '../../testing/app-testing.module'; import { ContentApiService } from '../../services/content-api.service'; -import { ExperimentalDirective } from '../../directives/experimental.directive'; describe('FavoritesComponent', () => { let fixture: ComponentFixture; @@ -83,8 +82,7 @@ describe('FavoritesComponent', () => { NodeFavoriteDirective, DocumentListComponent, FavoritesComponent, - AppConfigPipe, - ExperimentalDirective + AppConfigPipe ], schemas: [NO_ERRORS_SCHEMA] }); diff --git a/src/app/components/files/files.component.spec.ts b/src/app/components/files/files.component.spec.ts index fd2365ccd..7fb0c79c0 100644 --- a/src/app/components/files/files.component.spec.ts +++ b/src/app/components/files/files.component.spec.ts @@ -46,7 +46,6 @@ import { NodeActionsService } from '../../services/node-actions.service'; import { FilesComponent } from './files.component'; import { AppTestingModule } from '../../testing/app-testing.module'; import { ContentApiService } from '../../services/content-api.service'; -import { ExperimentalDirective } from '../../directives/experimental.directive'; import { of, throwError } from 'rxjs'; describe('FilesComponent', () => { @@ -70,8 +69,7 @@ describe('FilesComponent', () => { NodeFavoriteDirective, DocumentListComponent, FileSizePipe, - AppConfigPipe, - ExperimentalDirective + AppConfigPipe ], providers: [ { diff --git a/src/app/components/files/files.component.ts b/src/app/components/files/files.component.ts index a907e2915..ffd442bf8 100644 --- a/src/app/components/files/files.component.ts +++ b/src/app/components/files/files.component.ts @@ -156,11 +156,6 @@ export class FilesComponent extends PageComponent implements OnInit, OnDestroy { return; } - if (PageComponent.isLockedNode(node.entry)) { - event.preventDefault(); - return; - } - this.showPreview(node); } } 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 a92b6730f..d7a6825c0 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 @@ -26,6 +26,7 @@ import { Component, Input } from '@angular/core'; import { MinimalNodeEntryEntity } from '@alfresco/js-api'; import { NodePermissionService } from '../../../services/node-permission.service'; +import { isLocked } from '../../../utils/node.utils'; @Component({ selector: 'app-comments-tab', @@ -42,7 +43,11 @@ export class CommentsTabComponent { constructor(private permission: NodePermissionService) {} - get canUpdateNode() { - return this.node && this.permission.check(this.node, ['update']); + get canUpdateNode(): boolean { + if (this.node && this.node.isFile && !isLocked({ entry: this.node })) { + return this.permission.check(this.node, ['update']); + } + + return false; } } 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 5e04507a6..b9bc7bedc 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 @@ -28,6 +28,7 @@ import { MinimalNodeEntryEntity } from '@alfresco/js-api'; import { NodePermissionService } from '../../../services/node-permission.service'; import { AppExtensionService } from '../../../extensions/extension.service'; import { AppConfigService } from '@alfresco/adf-core'; +import { isLocked } from '../../../utils/node.utils'; @Component({ selector: 'app-metadata-tab', @@ -64,26 +65,11 @@ export class MetadataTabComponent { } } - get canUpdateNode() { - if (this.node) { - if (this.fileIsLocked()) { - return false; - } + get canUpdateNode(): boolean { + if (this.node && this.node.isFile && !isLocked({ entry: this.node })) { return this.permission.check(this.node, ['update']); } return false; } - - private fileIsLocked() { - if (!this.node.isFile) { - return false; - } - - return ( - this.node.isLocked || - (this.node.properties && - this.node.properties['cm:lockType'] === 'READ_ONLY_LOCK') - ); - } } diff --git a/src/app/components/libraries/libraries.component.spec.ts b/src/app/components/libraries/libraries.component.spec.ts index e2b23fde6..afc63620b 100644 --- a/src/app/components/libraries/libraries.component.spec.ts +++ b/src/app/components/libraries/libraries.component.spec.ts @@ -37,7 +37,6 @@ import { import { DocumentListComponent } from '@alfresco/adf-content-services'; import { LibrariesComponent } from './libraries.component'; import { AppTestingModule } from '../../testing/app-testing.module'; -import { ExperimentalDirective } from '../../directives/experimental.directive'; import { EffectsModule } from '@ngrx/effects'; import { LibraryEffects } from '../../store/effects'; @@ -67,8 +66,7 @@ describe('LibrariesComponent', () => { NodeFavoriteDirective, DocumentListComponent, LibrariesComponent, - AppConfigPipe, - ExperimentalDirective + AppConfigPipe ], schemas: [NO_ERRORS_SCHEMA] }); diff --git a/src/app/components/page.component.ts b/src/app/components/page.component.ts index 9c9f406fc..267b196b9 100644 --- a/src/app/components/page.component.ts +++ b/src/app/components/page.component.ts @@ -44,6 +44,7 @@ import { sharedUrl } from '../store/selectors/app.selectors'; import { AppStore } from '../store/states/app.state'; +import { isLocked, isLibrary } from '../utils/node.utils'; export abstract class PageComponent implements OnInit, OnDestroy { onDestroy$: Subject = new Subject(); @@ -64,28 +65,6 @@ export abstract class PageComponent implements OnInit, OnDestroy { protected subscriptions: Subscription[] = []; - static isLockedNode(node) { - return ( - node.isLocked || - (node.properties && node.properties['cm:lockType'] === 'READ_ONLY_LOCK') - ); - } - - static isWriteLockedNode(node) { - return node.properties && node.properties['cm:lockType'] === 'WRITE_LOCK'; - } - - static isLibrary(entry) { - return ( - (entry.guid && - entry.id && - entry.preset && - entry.title && - entry.visibility) || - entry.nodeType === 'st:site' - ); - } - constructor( protected store: Store, protected extensions: AppExtensionService, @@ -137,16 +116,11 @@ export abstract class PageComponent implements OnInit, OnDestroy { } imageResolver(row: ShareDataRow): string | null { - const entry: MinimalNodeEntryEntity = row.node.entry; - - if ( - PageComponent.isLockedNode(entry) || - PageComponent.isWriteLockedNode(entry) - ) { + if (isLocked(row.node)) { return 'assets/images/baseline-lock-24px.svg'; } - if (PageComponent.isLibrary(entry)) { + if (isLibrary(row.node)) { return 'assets/images/baseline-library_books-24px.svg'; } diff --git a/src/app/components/preview/preview.component.spec.ts b/src/app/components/preview/preview.component.spec.ts index e6898ce5f..c8489df5a 100644 --- a/src/app/components/preview/preview.component.spec.ts +++ b/src/app/components/preview/preview.component.spec.ts @@ -42,7 +42,6 @@ import { import { PreviewComponent } from './preview.component'; import { of, throwError } from 'rxjs'; import { EffectsModule } from '@ngrx/effects'; -import { ExperimentalDirective } from '../../directives/experimental.directive'; import { NodeEffects } from '../../store/effects/node.effects'; import { AppTestingModule } from '../../testing/app-testing.module'; import { ContentApiService } from '../../services/content-api.service'; @@ -63,12 +62,7 @@ describe('PreviewComponent', () => { TestBed.configureTestingModule({ imports: [AppTestingModule, EffectsModule.forRoot([NodeEffects])], providers: [AlfrescoApiService, ContentManagementService], - declarations: [ - AppConfigPipe, - PreviewComponent, - NodeFavoriteDirective, - ExperimentalDirective - ], + declarations: [AppConfigPipe, PreviewComponent, NodeFavoriteDirective], schemas: [NO_ERRORS_SCHEMA] }); diff --git a/src/app/components/recent-files/recent-files.component.spec.ts b/src/app/components/recent-files/recent-files.component.spec.ts index 525081ae1..5c208eed8 100644 --- a/src/app/components/recent-files/recent-files.component.spec.ts +++ b/src/app/components/recent-files/recent-files.component.spec.ts @@ -38,7 +38,6 @@ import { ContentManagementService } from '../../services/content-management.serv import { RecentFilesComponent } from './recent-files.component'; import { AppTestingModule } from '../../testing/app-testing.module'; -import { ExperimentalDirective } from '../../directives/experimental.directive'; describe('RecentFilesComponent', () => { let fixture: ComponentFixture; @@ -66,8 +65,7 @@ describe('RecentFilesComponent', () => { NodeFavoriteDirective, DocumentListComponent, RecentFilesComponent, - AppConfigPipe, - ExperimentalDirective + AppConfigPipe ], schemas: [NO_ERRORS_SCHEMA] }); diff --git a/src/app/components/recent-files/recent-files.component.ts b/src/app/components/recent-files/recent-files.component.ts index 95e4996ef..4d90a2e3e 100644 --- a/src/app/components/recent-files/recent-files.component.ts +++ b/src/app/components/recent-files/recent-files.component.ts @@ -79,11 +79,6 @@ export class RecentFilesComponent extends PageComponent implements OnInit { onNodeDoubleClick(node: MinimalNodeEntity) { if (node && node.entry) { - if (PageComponent.isLockedNode(node.entry)) { - event.preventDefault(); - return; - } - this.showPreview(node); } } diff --git a/src/app/components/search/search-results/search-results.component.ts b/src/app/components/search/search-results/search-results.component.ts index dcbb5c35b..f197c0633 100644 --- a/src/app/components/search/search-results/search-results.component.ts +++ b/src/app/components/search/search-results/search-results.component.ts @@ -177,11 +177,6 @@ export class SearchResultsComponent extends PageComponent implements OnInit { return; } - if (PageComponent.isLockedNode(node.entry)) { - event.preventDefault(); - return; - } - this.showPreview(node); } } diff --git a/src/app/components/settings/settings.component.html b/src/app/components/settings/settings.component.html index 9dd037030..5ad4451a4 100644 --- a/src/app/components/settings/settings.component.html +++ b/src/app/components/settings/settings.component.html @@ -81,22 +81,4 @@ Language Picker - - - - - - {{ 'APP.SETTINGS.EXPERIMENTAL-FEATURES' | translate }} - - -
- - {{ flag.key }} - -
-
-
diff --git a/src/app/components/settings/settings.component.ts b/src/app/components/settings/settings.component.ts index f4af45cfa..3c3eba535 100644 --- a/src/app/components/settings/settings.component.ts +++ b/src/app/components/settings/settings.component.ts @@ -64,7 +64,6 @@ export class SettingsComponent implements OnInit { appName$: Observable; headerColor$: Observable; languagePicker$: Observable; - experimental: Array<{ key: string; value: boolean }> = []; constructor( private store: Store, @@ -96,15 +95,6 @@ export class SettingsComponent implements OnInit { }); this.reset(); - - const settings = this.appConfig.get('experimental'); - this.experimental = Object.keys(settings).map(key => { - const value = this.appConfig.get(`experimental.${key}`); - return { - key, - value: value === true || value === 'true' - }; - }); } apply(model: RepositoryConfig, isValid: boolean) { @@ -142,8 +132,4 @@ export class SettingsComponent implements OnInit { this.storage.setItem('languagePicker', event.checked.toString()); this.store.dispatch(new SetLanguagePickerAction(event.checked)); } - - onToggleExperimentalFeature(key: string, event: MatCheckboxChange) { - this.storage.setItem(`experimental.${key}`, event.checked.toString()); - } } diff --git a/src/app/components/shared-files/shared-files.component.spec.ts b/src/app/components/shared-files/shared-files.component.spec.ts index 058d550ba..acf4bc9fd 100644 --- a/src/app/components/shared-files/shared-files.component.spec.ts +++ b/src/app/components/shared-files/shared-files.component.spec.ts @@ -37,7 +37,6 @@ import { DocumentListComponent } from '@alfresco/adf-content-services'; import { ContentManagementService } from '../../services/content-management.service'; import { SharedFilesComponent } from './shared-files.component'; import { AppTestingModule } from '../../testing/app-testing.module'; -import { ExperimentalDirective } from '../../directives/experimental.directive'; describe('SharedFilesComponent', () => { let fixture: ComponentFixture; @@ -65,8 +64,7 @@ describe('SharedFilesComponent', () => { NodeFavoriteDirective, DocumentListComponent, SharedFilesComponent, - AppConfigPipe, - ExperimentalDirective + AppConfigPipe ], schemas: [NO_ERRORS_SCHEMA] }); diff --git a/src/app/components/trashcan/trashcan.component.spec.ts b/src/app/components/trashcan/trashcan.component.spec.ts index 8879a92fb..2f539f563 100644 --- a/src/app/components/trashcan/trashcan.component.spec.ts +++ b/src/app/components/trashcan/trashcan.component.spec.ts @@ -36,7 +36,6 @@ import { DocumentListComponent } from '@alfresco/adf-content-services'; import { ContentManagementService } from '../../services/content-management.service'; import { TrashcanComponent } from './trashcan.component'; import { AppTestingModule } from '../../testing/app-testing.module'; -import { ExperimentalDirective } from '../../directives/experimental.directive'; describe('TrashcanComponent', () => { let fixture: ComponentFixture; @@ -64,8 +63,7 @@ describe('TrashcanComponent', () => { NodeFavoriteDirective, DocumentListComponent, TrashcanComponent, - AppConfigPipe, - ExperimentalDirective + AppConfigPipe ], schemas: [NO_ERRORS_SCHEMA] }); diff --git a/src/app/directives/directives.module.ts b/src/app/directives/directives.module.ts index 718bea3fd..f7413529e 100644 --- a/src/app/directives/directives.module.ts +++ b/src/app/directives/directives.module.ts @@ -24,7 +24,6 @@ */ import { NgModule } from '@angular/core'; -import { ExperimentalDirective } from './experimental.directive'; import { DocumentListDirective } from './document-list.directive'; import { PaginationDirective } from './pagination.directive'; import { LibraryMembershipDirective } from './library-membership.directive'; @@ -33,7 +32,6 @@ import { LockNodeDirective } from './lock-node.directive'; export function directives() { return [ - ExperimentalDirective, DocumentListDirective, PaginationDirective, LibraryMembershipDirective, diff --git a/src/app/directives/document-list.directive.ts b/src/app/directives/document-list.directive.ts index 2a9dd4152..332979bbc 100644 --- a/src/app/directives/document-list.directive.ts +++ b/src/app/directives/document-list.directive.ts @@ -29,9 +29,7 @@ import { ActivatedRoute, Router } from '@angular/router'; import { UserPreferencesService } from '@alfresco/adf-core'; import { Subscription } from 'rxjs'; import { Store } from '@ngrx/store'; -import { AppStore } from '../store/states/app.state'; import { SetSelectedNodesAction } from '../store/actions'; -import { MinimalNodeEntryEntity } from '@alfresco/js-api'; @Directive({ selector: '[acaDocumentList]' @@ -45,7 +43,7 @@ export class DocumentListDirective implements OnInit, OnDestroy { } constructor( - private store: Store, + private store: Store, private documentList: DocumentListComponent, private preferences: UserPreferencesService, private route: ActivatedRoute, @@ -104,11 +102,6 @@ export class DocumentListDirective implements OnInit, OnDestroy { @HostListener('node-select', ['$event']) onNodeSelect(event: CustomEvent) { if (!!event.detail && !!event.detail.node) { - const node: MinimalNodeEntryEntity = event.detail.node.entry; - if (node && this.isLockedNode(node)) { - this.unSelectLockedNodes(this.documentList); - } - this.updateSelection(); } } @@ -123,47 +116,11 @@ export class DocumentListDirective implements OnInit, OnDestroy { } private updateSelection() { - const selection = this.documentList.selection - .filter(node => !this.isLockedNode(node.entry)) - .map(node => { - node['isLibrary'] = this.isLibrary; - return node; - }); + const selection = this.documentList.selection.map(node => { + node['isLibrary'] = this.isLibrary; + return node; + }); this.store.dispatch(new SetSelectedNodesAction(selection)); } - - private isLockedNode(node): boolean { - return ( - node.isLocked || - (node.properties && node.properties['cm:lockType'] === 'READ_ONLY_LOCK') - ); - } - - private isLockedRow(row): boolean { - return ( - row.getValue('isLocked') || - (row.getValue('properties') && - row.getValue('properties')['cm:lockType'] === 'READ_ONLY_LOCK') - ); - } - - private unSelectLockedNodes(documentList: DocumentListComponent) { - documentList.selection = documentList.selection.filter( - item => !this.isLockedNode(item.entry) - ); - - const dataTable = documentList.dataTable; - if (dataTable && dataTable.data) { - const rows = dataTable.data.getRows(); - - if (rows && rows.length > 0) { - rows.forEach(r => { - if (this.isLockedRow(r)) { - r.isSelected = false; - } - }); - } - } - } } diff --git a/src/app/directives/experimental.directive.ts b/src/app/directives/experimental.directive.ts deleted file mode 100644 index d61578c5a..000000000 --- a/src/app/directives/experimental.directive.ts +++ /dev/null @@ -1,105 +0,0 @@ -/*! - * @license - * Alfresco Example Content Application - * - * Copyright (C) 2005 - 2018 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 { - Directive, - TemplateRef, - ViewContainerRef, - Input, - EmbeddedViewRef -} from '@angular/core'; -import { AppConfigService, StorageService } from '@alfresco/adf-core'; -import { environment } from '../../environments/environment'; - -@Directive({ - // tslint:disable-next-line:directive-selector - selector: '[ifExperimental]' -}) -export class ExperimentalDirective { - private elseTemplateRef: TemplateRef; - private elseViewRef: EmbeddedViewRef; - private shouldRender: boolean; - - constructor( - private templateRef: TemplateRef, - private viewContainerRef: ViewContainerRef, - private storage: StorageService, - private config: AppConfigService - ) {} - - @Input() - set ifExperimental(featureKey: string) { - const key = `experimental.${featureKey}`; - - const override = this.storage.getItem(key); - - if (override === 'true') { - this.shouldRender = true; - } - - if (!environment.production) { - const value = this.config.get(key); - if (value === true || value === 'true') { - this.shouldRender = true; - } - } - - if (override !== 'true' && environment.production) { - this.shouldRender = false; - } - - this.updateView(); - } - - @Input() - set ifExperimentalElse(templateRef: TemplateRef) { - this.elseTemplateRef = templateRef; - this.elseViewRef = null; - this.updateView(); - } - - private updateView() { - if (this.shouldRender) { - this.viewContainerRef.clear(); - this.elseViewRef = null; - - if (this.templateRef) { - this.viewContainerRef.createEmbeddedView(this.templateRef); - } - } else { - if (this.elseViewRef) { - return; - } - - this.viewContainerRef.clear(); - - if (this.elseTemplateRef) { - this.elseViewRef = this.viewContainerRef.createEmbeddedView( - this.elseTemplateRef - ); - } - } - } -} diff --git a/src/app/directives/lock-node.directive.ts b/src/app/directives/lock-node.directive.ts index d89ae8f98..3bb5e818d 100644 --- a/src/app/directives/lock-node.directive.ts +++ b/src/app/directives/lock-node.directive.ts @@ -32,6 +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'; @Directive({ selector: '[acaLockNode]', @@ -52,33 +53,28 @@ export class LockNodeDirective { constructor(private alfrescoApiService: AlfrescoApiService) {} - isNodeLocked() { - return !!( - this.node && - this.node.entry.properties && - this.node.entry.properties['cm:lockType'] === 'WRITE_LOCK' - ); + isNodeLocked(): boolean { + return isLocked(this.node); } private async toggleLock(node: NodeEntry | SharedLinkEntry) { const id = (node).entry.nodeId || node.entry.id; - if (this.isNodeLocked()) { + + if (isLocked(this.node)) { try { const response = await this.unlockNode(id); - const isLocked = false; this.update(response.entry); - this.toggle.emit(isLocked); + this.toggle.emit(false); } catch (error) { this.unlockError.emit(error); } } else { try { const response = await this.lockNode(id); - const isLocked = true; this.update(response.entry); - this.toggle.emit(isLocked); + this.toggle.emit(true); } catch (error) { this.lockError.emit(error); } diff --git a/src/app/extensions/evaluators/app.evaluators.ts b/src/app/extensions/evaluators/app.evaluators.ts index 19c5a5a55..79d97a390 100644 --- a/src/app/extensions/evaluators/app.evaluators.ts +++ b/src/app/extensions/evaluators/app.evaluators.ts @@ -310,7 +310,9 @@ export function isWriteLocked( context.selection.file && context.selection.file.entry && context.selection.file.entry.properties && - context.selection.file.entry.properties['cm:lockType'] === 'WRITE_LOCK' + (context.selection.file.entry.properties['cm:lockType'] === 'WRITE_LOCK' || + context.selection.file.entry.properties['cm:lockType'] === + 'READ_ONLY_LOCK') ); } diff --git a/src/app/services/experimental-guard.service.spec.ts b/src/app/services/experimental-guard.service.spec.ts deleted file mode 100644 index 146251cef..000000000 --- a/src/app/services/experimental-guard.service.spec.ts +++ /dev/null @@ -1,32 +0,0 @@ -/*! - * @license - * Alfresco Example Content Application - * - * Copyright (C) 2005 - 2018 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 { ExperimentalGuard } from './experimental-guard.service'; - -describe('ExperimentalGuard', () => { - it('should be defined', () => { - expect(ExperimentalGuard).toBeDefined(); - }); -}); diff --git a/src/app/services/experimental-guard.service.ts b/src/app/services/experimental-guard.service.ts deleted file mode 100644 index 9aff27859..000000000 --- a/src/app/services/experimental-guard.service.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { CanActivate, ActivatedRouteSnapshot, Router } from '@angular/router'; -import { Injectable } from '@angular/core'; -import { AppConfigService, StorageService } from '@alfresco/adf-core'; -import { environment } from '../../environments/environment'; - -@Injectable() -export class ExperimentalGuard implements CanActivate { - constructor( - private config: AppConfigService, - private storage: StorageService, - private router: Router - ) {} - - canActivate(route: ActivatedRouteSnapshot) { - const key = `experimental.${route.data.ifExperimentalKey}`; - const value = this.config.get(key); - const override = this.storage.getItem(key); - - if (override === 'true') { - return true; - } - - if (!environment.production) { - if (value === true || value === 'true') { - return true; - } - - this.router.navigate(['/']); - } - - this.router.navigate(['/']); - - return false; - } -} diff --git a/src/app/directives/experimental.directive.spec.ts b/src/app/utils/node.utils.ts similarity index 65% rename from src/app/directives/experimental.directive.spec.ts rename to src/app/utils/node.utils.ts index 4fd02d3cc..0a0f5b297 100644 --- a/src/app/directives/experimental.directive.spec.ts +++ b/src/app/utils/node.utils.ts @@ -23,10 +23,28 @@ * along with Alfresco. If not, see . */ -import { ExperimentalDirective } from './experimental.directive'; +import { Node } from '@alfresco/js-api'; -describe('ExperimentalDirective', () => { - it('should be defined', () => { - expect(ExperimentalDirective).toBeDefined(); - }); -}); +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' + ); +} diff --git a/src/assets/i18n/de.json b/src/assets/i18n/de.json index 18feb9a09..f0d16c14d 100644 --- a/src/assets/i18n/de.json +++ b/src/assets/i18n/de.json @@ -41,7 +41,6 @@ "TITLE": "Einstellungen", "APPLICATION-SETTINGS": "Anwendungseinstellungen", "REPOSITORY-SETTINGS": "Repository-Einstellungen", - "EXPERIMENTAL-FEATURES": "Testfunktionen", "INVALID-VALUE-FORMAT": "Wert in ungültigem Format", "REQUIRED-FIELD": "Dieses Feld ist erforderlich.", "RESET": "Zurücksetzen", diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index aebad16ee..6f214673e 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -41,7 +41,6 @@ "TITLE": "Settings", "APPLICATION-SETTINGS": "Application Settings", "REPOSITORY-SETTINGS": "Repository Settings", - "EXPERIMENTAL-FEATURES": "Experimental Features", "INVALID-VALUE-FORMAT": "Invalid value format", "REQUIRED-FIELD": "This field is required", "RESET": "Reset", diff --git a/src/assets/i18n/es.json b/src/assets/i18n/es.json index 44046e828..fbffc424a 100644 --- a/src/assets/i18n/es.json +++ b/src/assets/i18n/es.json @@ -41,7 +41,6 @@ "TITLE": "Configuración", "APPLICATION-SETTINGS": "Configuración de la aplicación", "REPOSITORY-SETTINGS": "Configuración del repositorio", - "EXPERIMENTAL-FEATURES": "Funciones experimentales", "INVALID-VALUE-FORMAT": "Formato de valor no válido", "REQUIRED-FIELD": "Este campo es obligatorio", "RESET": "Reiniciar", diff --git a/src/assets/i18n/fr.json b/src/assets/i18n/fr.json index fb6a8f5c9..1d40dfe46 100644 --- a/src/assets/i18n/fr.json +++ b/src/assets/i18n/fr.json @@ -41,7 +41,6 @@ "TITLE": "Paramètres", "APPLICATION-SETTINGS": "Paramètres de l'application", "REPOSITORY-SETTINGS": "Paramètres de l'entrepôt", - "EXPERIMENTAL-FEATURES": "Fonctionnalités expérimentales", "INVALID-VALUE-FORMAT": "Format de valeur non valide", "REQUIRED-FIELD": "Ce champ doit être renseigné", "RESET": "Réinitialiser", diff --git a/src/assets/i18n/it.json b/src/assets/i18n/it.json index 855cf0f9b..f1f4ff301 100644 --- a/src/assets/i18n/it.json +++ b/src/assets/i18n/it.json @@ -41,7 +41,6 @@ "TITLE": "Impostazioni", "APPLICATION-SETTINGS": "Impostazioni applicazione", "REPOSITORY-SETTINGS": "Impostazioni repository", - "EXPERIMENTAL-FEATURES": "Funzioni sperimentali", "INVALID-VALUE-FORMAT": "Formato valore non valido", "REQUIRED-FIELD": "Questo campo è obbligatorio", "RESET": "Reimposta", diff --git a/src/assets/i18n/ja.json b/src/assets/i18n/ja.json index 8f728e208..5d19358cc 100644 --- a/src/assets/i18n/ja.json +++ b/src/assets/i18n/ja.json @@ -41,7 +41,6 @@ "TITLE": "設定", "APPLICATION-SETTINGS": "アプリケーションの設定", "REPOSITORY-SETTINGS": "リポジトリの設定", - "EXPERIMENTAL-FEATURES": "試験的な機能", "INVALID-VALUE-FORMAT": "無効な値形式", "REQUIRED-FIELD": "このフィールドは必須です", "RESET": "リセット", diff --git a/src/assets/i18n/nb.json b/src/assets/i18n/nb.json index e9b8d94de..e5ea2b3bf 100644 --- a/src/assets/i18n/nb.json +++ b/src/assets/i18n/nb.json @@ -41,7 +41,6 @@ "TITLE": "Innstillinger", "APPLICATION-SETTINGS": "Programinnstillinger", "REPOSITORY-SETTINGS": "Databaseinnstillinger", - "EXPERIMENTAL-FEATURES": "Eksperimentelle funksjoner", "INVALID-VALUE-FORMAT": "Ugyldig verdiformat", "REQUIRED-FIELD": "Dette feltet er obligatorisk", "RESET": "Tilbakestill", diff --git a/src/assets/i18n/nl.json b/src/assets/i18n/nl.json index 42c7ac0f0..9668428e7 100644 --- a/src/assets/i18n/nl.json +++ b/src/assets/i18n/nl.json @@ -41,7 +41,6 @@ "TITLE": "Instellingen", "APPLICATION-SETTINGS": "Toepassingsinstellingen", "REPOSITORY-SETTINGS": "Opslagplaatsinstellingen", - "EXPERIMENTAL-FEATURES": "Experimentele onderdelen", "INVALID-VALUE-FORMAT": "Ongeldige indeling van waarde", "REQUIRED-FIELD": "Dit veld is vereist", "RESET": "Opnieuw instellen", diff --git a/src/assets/i18n/pt-BR.json b/src/assets/i18n/pt-BR.json index bf07c62fc..aa2c29179 100644 --- a/src/assets/i18n/pt-BR.json +++ b/src/assets/i18n/pt-BR.json @@ -41,7 +41,6 @@ "TITLE": "Configurações", "APPLICATION-SETTINGS": "Configurações do aplicativo", "REPOSITORY-SETTINGS": "Configurações do repositório", - "EXPERIMENTAL-FEATURES": "Recursos experimentais", "INVALID-VALUE-FORMAT": "Formato de valor inválido", "REQUIRED-FIELD": "Este campo é obrigatório", "RESET": "Redefinir", diff --git a/src/assets/i18n/ru.json b/src/assets/i18n/ru.json index a0b6207ce..e7bb88a86 100644 --- a/src/assets/i18n/ru.json +++ b/src/assets/i18n/ru.json @@ -41,7 +41,6 @@ "TITLE": "Параметры", "APPLICATION-SETTINGS": "Настройки приложений", "REPOSITORY-SETTINGS": "Настройки репозитория", - "EXPERIMENTAL-FEATURES": "Экспериментальные функции", "INVALID-VALUE-FORMAT": "Недопустимый формат значения", "REQUIRED-FIELD": "Это обязательное поле", "RESET": "Сброс", diff --git a/src/assets/i18n/zh-CN.json b/src/assets/i18n/zh-CN.json index b5f79d686..f239a8e88 100644 --- a/src/assets/i18n/zh-CN.json +++ b/src/assets/i18n/zh-CN.json @@ -41,7 +41,6 @@ "TITLE": "设置", "APPLICATION-SETTINGS": "应用程序设置", "REPOSITORY-SETTINGS": "存储库设置", - "EXPERIMENTAL-FEATURES": "试验性功能", "INVALID-VALUE-FORMAT": "值格式无效", "REQUIRED-FIELD": "此字段为必填字段", "RESET": "重置",