mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2026-09-09 18:02:54 +00:00
shared library (#1080)
* shared project scaffold * rules package * move evaluators to shared lib * add rxjs peer dependency * use dedicated material namespaces * create store package, move actions * move selectors to shared library * move generic effects to shared lib * move routing extensions * minor code reorg * fix unit tests * move content-api service * move permission service * update tests * update plint config * move page layout * css variables * use dedicated css property * move generic error component to shared lib * fix test
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
*/
|
||||
|
||||
import { AppComponent } from './app.component';
|
||||
import { SetInitialStateAction } from './store/actions';
|
||||
import { SetInitialStateAction } from '@alfresco/aca-shared/store';
|
||||
|
||||
describe('AppComponent', () => {
|
||||
let component: AppComponent;
|
||||
|
||||
@@ -35,24 +35,21 @@ import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||
import { ActivatedRoute, NavigationEnd, Router } from '@angular/router';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppExtensionService } from './extensions/extension.service';
|
||||
import {
|
||||
SnackbarErrorAction,
|
||||
SetCurrentUrlAction,
|
||||
SetInitialStateAction,
|
||||
CloseModalDialogsAction,
|
||||
SetRepositoryInfoAction,
|
||||
SetUserProfileAction
|
||||
} from './store/actions';
|
||||
import {
|
||||
AppStore,
|
||||
AppState,
|
||||
INITIAL_APP_STATE
|
||||
} from './store/states/app.state';
|
||||
SetCurrentUrlAction,
|
||||
SetInitialStateAction,
|
||||
SetUserProfileAction,
|
||||
SnackbarErrorAction,
|
||||
CloseModalDialogsAction,
|
||||
SetRepositoryInfoAction
|
||||
} from '@alfresco/aca-shared/store';
|
||||
import { filter, takeUntil } from 'rxjs/operators';
|
||||
import { ContentApiService } from './services/content-api.service';
|
||||
import { AppService, ContentApiService } from '@alfresco/aca-shared';
|
||||
import { DiscoveryEntry, GroupsApi, Group } from '@alfresco/js-api';
|
||||
import { AppService } from './services/app.service';
|
||||
import { Subject } from 'rxjs';
|
||||
import { INITIAL_APP_STATE } from './store/initial-state';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
|
||||
@@ -41,6 +41,7 @@ import {
|
||||
LibraryDialogComponent,
|
||||
ContentModule
|
||||
} from '@alfresco/adf-content-services';
|
||||
import { AppRouteReuseStrategy, SharedModule } from '@alfresco/aca-shared';
|
||||
|
||||
import { AppComponent } from './app.component';
|
||||
import { APP_ROUTES } from './app.routes';
|
||||
@@ -55,7 +56,6 @@ import { AppStoreModule } from './store/app-store.module';
|
||||
import { MaterialModule } from './material.module';
|
||||
import { AppExtensionsModule } from './extensions.module';
|
||||
import { CoreExtensionsModule } from './extensions/core.extensions.module';
|
||||
import { AppRouteReuseStrategy } from './app.routes.strategy';
|
||||
import { AppInfoDrawerModule } from './components/info-drawer/info.drawer.module';
|
||||
import { DirectivesModule } from './directives/directives.module';
|
||||
import { ContextMenuModule } from './components/context-menu/context-menu.module';
|
||||
@@ -89,6 +89,7 @@ import { environment } from '../environments/environment';
|
||||
MaterialModule,
|
||||
CoreModule.forRoot(),
|
||||
ContentModule.forRoot(),
|
||||
SharedModule.forRoot(),
|
||||
AppStoreModule,
|
||||
CoreExtensionsModule.forRoot(),
|
||||
ExtensionsModule,
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2019 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 { AppRouteReuseStrategy } from './app.routes.strategy';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { AppTestingModule } from './testing/app-testing.module';
|
||||
|
||||
describe('AppRouteReuseStrategy', () => {
|
||||
let appRouteReuse: AppRouteReuseStrategy;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [AppTestingModule],
|
||||
providers: [AppRouteReuseStrategy]
|
||||
});
|
||||
|
||||
appRouteReuse = TestBed.get(AppRouteReuseStrategy);
|
||||
});
|
||||
|
||||
it('should allow detach if route is configured to be reused', () => {
|
||||
const route = <any>{
|
||||
routeConfig: {
|
||||
data: {
|
||||
reuse: true
|
||||
},
|
||||
path: 'tested-path'
|
||||
}
|
||||
};
|
||||
expect(appRouteReuse.shouldDetach(<any>route)).toBe(true);
|
||||
});
|
||||
|
||||
it('should store on routeCache', () => {
|
||||
const route = <any>{
|
||||
url: [],
|
||||
routeConfig: {
|
||||
data: {
|
||||
reuse: true
|
||||
},
|
||||
path: 'tested-path',
|
||||
component: {}
|
||||
},
|
||||
firstChild: null,
|
||||
children: []
|
||||
};
|
||||
appRouteReuse.store(route, { route: {} });
|
||||
expect(appRouteReuse.shouldAttach(<any>route)).toBe(true);
|
||||
});
|
||||
|
||||
it('should clear routeCache on resetCache', () => {
|
||||
const route = <any>{
|
||||
url: [],
|
||||
routeConfig: {
|
||||
data: {
|
||||
reuse: true
|
||||
},
|
||||
path: 'tested-path',
|
||||
component: {}
|
||||
},
|
||||
firstChild: null,
|
||||
children: []
|
||||
};
|
||||
appRouteReuse.store(route, { route: {} });
|
||||
appRouteReuse.resetCache();
|
||||
expect(appRouteReuse.shouldAttach(<any>route)).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -1,142 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2019 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 {
|
||||
RouteReuseStrategy,
|
||||
DetachedRouteHandle,
|
||||
ActivatedRouteSnapshot
|
||||
} from '@angular/router';
|
||||
import { ComponentRef } from '@angular/core';
|
||||
|
||||
interface RouteData {
|
||||
reuse: boolean;
|
||||
}
|
||||
|
||||
interface RouteInfo {
|
||||
handle: DetachedRouteHandle;
|
||||
data: RouteData;
|
||||
}
|
||||
|
||||
export class AppRouteReuseStrategy implements RouteReuseStrategy {
|
||||
private routeCache = new Map<string, RouteInfo>();
|
||||
|
||||
resetCache() {
|
||||
this.routeCache.forEach(value => {
|
||||
this.deactivateComponent(value.handle);
|
||||
});
|
||||
this.routeCache.clear();
|
||||
}
|
||||
|
||||
private deactivateComponent(handle: DetachedRouteHandle): void {
|
||||
if (!handle) {
|
||||
return;
|
||||
}
|
||||
const componentRef: ComponentRef<any> = handle['componentRef'];
|
||||
if (componentRef) {
|
||||
componentRef.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
shouldReuseRoute(
|
||||
future: ActivatedRouteSnapshot,
|
||||
curr: ActivatedRouteSnapshot
|
||||
): boolean {
|
||||
const ret = future.routeConfig === curr.routeConfig;
|
||||
if (ret) {
|
||||
this.addRedirectsRecursively(future); // update redirects
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
shouldDetach(route: ActivatedRouteSnapshot): boolean {
|
||||
const data = this.getRouteData(route);
|
||||
return data && data.reuse;
|
||||
}
|
||||
|
||||
store(route: ActivatedRouteSnapshot, handle: DetachedRouteHandle): void {
|
||||
const url = this.getFullRouteUrl(route);
|
||||
const data = this.getRouteData(route);
|
||||
this.routeCache.set(url, { handle, data });
|
||||
this.addRedirectsRecursively(route);
|
||||
}
|
||||
|
||||
shouldAttach(route: ActivatedRouteSnapshot): boolean {
|
||||
const url = this.getFullRouteUrl(route);
|
||||
return this.routeCache.has(url);
|
||||
}
|
||||
|
||||
retrieve(route: ActivatedRouteSnapshot): DetachedRouteHandle {
|
||||
const url = this.getFullRouteUrl(route);
|
||||
const data = this.getRouteData(route);
|
||||
return data && data.reuse && this.routeCache.has(url)
|
||||
? this.routeCache.get(url).handle
|
||||
: null;
|
||||
}
|
||||
|
||||
private addRedirectsRecursively(route: ActivatedRouteSnapshot): void {
|
||||
const config = route.routeConfig;
|
||||
if (config) {
|
||||
if (!config.loadChildren) {
|
||||
const routeFirstChild = route.firstChild;
|
||||
const routeFirstChildUrl = routeFirstChild
|
||||
? this.getRouteUrlPaths(routeFirstChild).join('/')
|
||||
: '';
|
||||
const childConfigs = config.children;
|
||||
if (childConfigs) {
|
||||
const childConfigWithRedirect = childConfigs.find(
|
||||
c => c.path === '' && !!c.redirectTo
|
||||
);
|
||||
if (childConfigWithRedirect) {
|
||||
childConfigWithRedirect.redirectTo = routeFirstChildUrl;
|
||||
}
|
||||
}
|
||||
}
|
||||
route.children.forEach(childRoute =>
|
||||
this.addRedirectsRecursively(childRoute)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private getFullRouteUrl(route: ActivatedRouteSnapshot): string {
|
||||
return this.getFullRouteUrlPaths(route)
|
||||
.filter(Boolean)
|
||||
.join('/');
|
||||
}
|
||||
|
||||
private getFullRouteUrlPaths(route: ActivatedRouteSnapshot): string[] {
|
||||
const paths = this.getRouteUrlPaths(route);
|
||||
return route.parent
|
||||
? [...this.getFullRouteUrlPaths(route.parent), ...paths]
|
||||
: paths;
|
||||
}
|
||||
|
||||
private getRouteUrlPaths(route: ActivatedRouteSnapshot): string[] {
|
||||
return route.url.map(urlSegment => urlSegment.path);
|
||||
}
|
||||
|
||||
private getRouteData(route: ActivatedRouteSnapshot): RouteData {
|
||||
return route.routeConfig && (route.routeConfig.data as RouteData);
|
||||
}
|
||||
}
|
||||
@@ -28,11 +28,13 @@ import { AppLayoutComponent } from './components/layout/app-layout/app-layout.co
|
||||
import { FilesComponent } from './components/files/files.component';
|
||||
import { LibrariesComponent } from './components/libraries/libraries.component';
|
||||
import { FavoriteLibrariesComponent } from './components/favorite-libraries/favorite-libraries.component';
|
||||
import { GenericErrorComponent } from './components/common/generic-error/generic-error.component';
|
||||
import { SearchResultsComponent } from './components/search/search-results/search-results.component';
|
||||
import { SearchLibrariesResultsComponent } from './components/search/search-libraries-results/search-libraries-results.component';
|
||||
import { LoginComponent } from './components/login/login.component';
|
||||
import { AppSharedRuleGuard } from './guards/shared.guard';
|
||||
import {
|
||||
AppSharedRuleGuard,
|
||||
GenericErrorComponent
|
||||
} from '@alfresco/aca-shared';
|
||||
import { AuthGuardEcm } from '@alfresco/adf-core';
|
||||
|
||||
export const APP_ROUTES: Routes = [
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<app-page-layout>
|
||||
<app-page-layout-content [scrollable]="true">
|
||||
<aca-page-layout>
|
||||
<aca-page-layout-content [scrollable]="true">
|
||||
<div class="main-content">
|
||||
<article>
|
||||
<header>{{ 'application.name' | adfAppConfig }}</header>
|
||||
@@ -43,5 +43,5 @@
|
||||
<app-package-list [data]="dependencyEntries"></app-package-list>
|
||||
</article>
|
||||
</div>
|
||||
</app-page-layout-content>
|
||||
</app-page-layout>
|
||||
</aca-page-layout-content>
|
||||
</aca-page-layout>
|
||||
|
||||
@@ -29,7 +29,7 @@ import { RepositoryInfo } from '@alfresco/js-api';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { AppExtensionService } from '../../extensions/extension.service';
|
||||
import { ContentApiService } from '../../services/content-api.service';
|
||||
import { ContentApiService } from '@alfresco/aca-shared';
|
||||
import { version, dependencies } from '../../../../package.json';
|
||||
@Component({
|
||||
selector: 'app-about',
|
||||
|
||||
@@ -29,7 +29,7 @@ import { AboutComponent } from './about.component';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { CoreModule } from '@alfresco/adf-core';
|
||||
import { AppLayoutModule } from '../layout/layout.module';
|
||||
import { MatTableModule } from '@angular/material';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
import { PackageListComponent } from './package-list/package-list.component';
|
||||
import { ExtensionListComponent } from './extension-list/extension-list.component';
|
||||
import { StatusListComponent } from './status-list/status-list.component';
|
||||
|
||||
@@ -23,23 +23,22 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { GenericErrorComponent } from './generic-error/generic-error.component';
|
||||
import { CoreModule } from '@alfresco/adf-core';
|
||||
import { LocationLinkComponent } from './location-link/location-link.component';
|
||||
import { MatIconModule } from '@angular/material';
|
||||
import { ExtensionsModule } from '@alfresco/adf-extensions';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { GenericErrorModule } from '@alfresco/aca-shared';
|
||||
import { LocationLinkComponent } from './location-link/location-link.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
CoreModule.forChild(),
|
||||
MatIconModule,
|
||||
ExtensionsModule
|
||||
ExtensionsModule,
|
||||
GenericErrorModule
|
||||
],
|
||||
declarations: [GenericErrorComponent, LocationLinkComponent],
|
||||
exports: [ExtensionsModule, GenericErrorComponent, LocationLinkComponent],
|
||||
declarations: [LocationLinkComponent],
|
||||
exports: [ExtensionsModule, LocationLinkComponent, GenericErrorModule],
|
||||
entryComponents: [LocationLinkComponent]
|
||||
})
|
||||
export class AppCommonModule {}
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
<mat-icon>ic_error</mat-icon>
|
||||
<p class="generic-error__title">
|
||||
{{ 'APP.MESSAGES.ERRORS.MISSING_CONTENT' | translate }}
|
||||
</p>
|
||||
@@ -1,32 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2019 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 { GenericErrorComponent } from './generic-error.component';
|
||||
|
||||
describe('GenericErrorComponent', () => {
|
||||
it('should be defined', () => {
|
||||
expect(GenericErrorComponent).toBeDefined();
|
||||
});
|
||||
});
|
||||
@@ -1,27 +0,0 @@
|
||||
@mixin aca-generic-error-theme($theme) {
|
||||
$warn: map-get($theme, warn);
|
||||
$foreground: map-get($theme, foreground);
|
||||
|
||||
.aca-generic-error {
|
||||
color: mat-color($foreground, text, 0.54);
|
||||
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
&__title {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
mat-icon {
|
||||
color: mat-color($warn);
|
||||
direction: rtl;
|
||||
font-size: 52px;
|
||||
height: 52px;
|
||||
width: 52px;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2019 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,
|
||||
ViewEncapsulation,
|
||||
ChangeDetectionStrategy
|
||||
} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'aca-generic-error',
|
||||
templateUrl: './generic-error.component.html',
|
||||
encapsulation: ViewEncapsulation.None,
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
host: { class: 'aca-generic-error' }
|
||||
})
|
||||
export class GenericErrorComponent {}
|
||||
@@ -35,9 +35,8 @@ import { PathInfo, MinimalNodeEntity } from '@alfresco/js-api';
|
||||
import { Observable, BehaviorSubject, of } from 'rxjs';
|
||||
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppStore } from '../../../store/states/app.state';
|
||||
import { NavigateToParentFolder } from '../../../store/actions';
|
||||
import { ContentApiService } from '../../../services/content-api.service';
|
||||
import { AppStore, NavigateToParentFolder } from '@alfresco/aca-shared/store';
|
||||
import { ContentApiService } from '@alfresco/aca-shared';
|
||||
import { TranslationService } from '@alfresco/adf-core';
|
||||
|
||||
@Component({
|
||||
|
||||
@@ -32,11 +32,10 @@ import {
|
||||
ViewChild,
|
||||
AfterViewInit
|
||||
} from '@angular/core';
|
||||
import { MatMenuTrigger } from '@angular/material';
|
||||
import { MatMenuTrigger } from '@angular/material/menu';
|
||||
|
||||
import { AppExtensionService } from '../../extensions/extension.service';
|
||||
import { AppStore } from '../../store/states';
|
||||
import { appSelection } from '../../store/selectors/app.selectors';
|
||||
import { AppStore, getAppSelection } from '@alfresco/aca-shared/store';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
@@ -91,7 +90,7 @@ export class ContextMenuComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||
|
||||
ngOnInit() {
|
||||
this.store
|
||||
.select(appSelection)
|
||||
.select(getAppSelection)
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(selection => {
|
||||
if (selection.count) {
|
||||
|
||||
@@ -23,22 +23,19 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { NgModule } from '@angular/core';
|
||||
import {
|
||||
MatMenuModule,
|
||||
MatListModule,
|
||||
MatIconModule,
|
||||
MatButtonModule
|
||||
} from '@angular/material';
|
||||
import { CoreModule } from '@alfresco/adf-core';
|
||||
import { CoreExtensionsModule } from '../../extensions/core.extensions.module';
|
||||
|
||||
import { ContextActionsDirective } from './context-menu.directive';
|
||||
import { ContextMenuComponent } from './context-menu.component';
|
||||
import { ExtensionsModule } from '@alfresco/adf-extensions';
|
||||
import { OutsideEventDirective } from './context-menu-outside-event.directive';
|
||||
import { ContextMenuItemComponent } from './context-menu-item.component';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatListModule } from '@angular/material/list';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { CoreExtensionsModule } from '../../extensions/core.extensions.module';
|
||||
import { AppCommonModule } from '../common/common.module';
|
||||
import { ContextMenuItemComponent } from './context-menu-item.component';
|
||||
import { OutsideEventDirective } from './context-menu-outside-event.directive';
|
||||
import { ContextMenuComponent } from './context-menu.component';
|
||||
import { ContextActionsDirective } from './context-menu.directive';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
||||
@@ -31,10 +31,9 @@ import {
|
||||
ViewEncapsulation
|
||||
} from '@angular/core';
|
||||
import { ContentActionRef } from '@alfresco/adf-extensions';
|
||||
import { AppStore } from '../../store/states';
|
||||
import { AppStore, getCurrentFolder } from '@alfresco/aca-shared/store';
|
||||
import { AppExtensionService } from '../../extensions/extension.service';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { currentFolder } from '../../store/selectors/app.selectors';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { Subject } from 'rxjs';
|
||||
|
||||
@@ -62,7 +61,7 @@ export class CreateMenuComponent implements OnInit, OnDestroy {
|
||||
|
||||
ngOnInit() {
|
||||
this.store
|
||||
.select(currentFolder)
|
||||
.select(getCurrentFolder)
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(() => {
|
||||
this.createActions = this.extensions.getCreateActions();
|
||||
|
||||
@@ -26,14 +26,14 @@
|
||||
import { Component, ViewEncapsulation } from '@angular/core';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { Observable } from 'rxjs';
|
||||
import {
|
||||
selectUser,
|
||||
appLanguagePicker
|
||||
} from '../../store/selectors/app.selectors';
|
||||
import { AppStore } from '../../store/states';
|
||||
import { ProfileState } from '@alfresco/adf-extensions';
|
||||
import { SetSelectedNodesAction } from '../../store/actions';
|
||||
import { AppService } from '../../services/app.service';
|
||||
import {
|
||||
AppStore,
|
||||
SetSelectedNodesAction,
|
||||
getUserProfile,
|
||||
getLanguagePickerState
|
||||
} from '@alfresco/aca-shared/store';
|
||||
import { AppService } from '@alfresco/aca-shared';
|
||||
|
||||
@Component({
|
||||
selector: 'aca-current-user',
|
||||
@@ -50,8 +50,8 @@ export class CurrentUserComponent {
|
||||
}
|
||||
|
||||
constructor(private store: Store<AppStore>, private appService: AppService) {
|
||||
this.profile$ = this.store.select(selectUser);
|
||||
this.languagePicker$ = store.select(appLanguagePicker);
|
||||
this.profile$ = this.store.select(getUserProfile);
|
||||
this.languagePicker$ = store.select(getLanguagePickerState);
|
||||
}
|
||||
|
||||
onLogoutEvent() {
|
||||
|
||||
@@ -28,7 +28,7 @@ import {
|
||||
import { Actions, ofType } from '@ngrx/effects';
|
||||
import { Subject } from 'rxjs';
|
||||
import { filter, takeUntil } from 'rxjs/operators';
|
||||
import { EDIT_OFFLINE } from '../../../store/actions';
|
||||
import { NodeActionTypes } from '@alfresco/aca-shared/store';
|
||||
import { isLocked } from '../../../utils/node.utils';
|
||||
|
||||
@Component({
|
||||
@@ -75,7 +75,7 @@ export class CustomNameColumnComponent extends NameColumnComponent
|
||||
|
||||
this.actions$
|
||||
.pipe(
|
||||
ofType<any>(EDIT_OFFLINE),
|
||||
ofType<any>(NodeActionTypes.EditOffline),
|
||||
filter(val => {
|
||||
return this.node.entry.id === val.payload.entry.id;
|
||||
}),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<app-page-layout>
|
||||
<app-page-layout-header>
|
||||
<aca-page-layout>
|
||||
<aca-page-layout-header>
|
||||
<adf-breadcrumb root="APP.BROWSE.LIBRARIES.MENU.FAVORITE_LIBRARIES.TITLE">
|
||||
</adf-breadcrumb>
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
<aca-toolbar-action [actionRef]="entry"></aca-toolbar-action>
|
||||
</ng-container>
|
||||
</adf-toolbar>
|
||||
</app-page-layout-header>
|
||||
</aca-page-layout-header>
|
||||
|
||||
<app-page-layout-content>
|
||||
<aca-page-layout-content>
|
||||
<div class="main-content">
|
||||
<adf-document-list
|
||||
#documentList
|
||||
@@ -91,5 +91,5 @@
|
||||
<div class="sidebar" *ngIf="(infoDrawerOpened$ | async)">
|
||||
<aca-info-drawer [node]="selection.last"></aca-info-drawer>
|
||||
</div>
|
||||
</app-page-layout-content>
|
||||
</app-page-layout>
|
||||
</aca-page-layout-content>
|
||||
</aca-page-layout>
|
||||
|
||||
@@ -36,11 +36,12 @@ import {
|
||||
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 { ContentApiService } from '@alfresco/aca-shared';
|
||||
import { ContentManagementService } from '../../services/content-management.service';
|
||||
import { EffectsModule } from '@ngrx/effects';
|
||||
import { LibraryEffects, RouterEffects } from '../../store/effects';
|
||||
import { RouterEffects } from '@alfresco/aca-shared/store';
|
||||
import { of, throwError } from 'rxjs';
|
||||
import { LibraryEffects } from '../../store/effects';
|
||||
|
||||
describe('FavoriteLibrariesComponent', () => {
|
||||
let fixture: ComponentFixture<FavoriteLibrariesComponent>;
|
||||
|
||||
@@ -29,9 +29,8 @@ import { Store } from '@ngrx/store';
|
||||
import { SiteEntry, FavoritePaging, Pagination } from '@alfresco/js-api';
|
||||
import { AppExtensionService } from '../../extensions/extension.service';
|
||||
import { ContentManagementService } from '../../services/content-management.service';
|
||||
import { ContentApiService } from '../../services/content-api.service';
|
||||
import { NavigateLibraryAction } from '../../store/actions';
|
||||
import { AppStore } from '../../store/states/app.state';
|
||||
import { ContentApiService } from '@alfresco/aca-shared';
|
||||
import { NavigateLibraryAction } from '@alfresco/aca-shared/store';
|
||||
import { PageComponent } from '../page.component';
|
||||
import { UserPreferencesService } from '@alfresco/adf-core';
|
||||
@Component({
|
||||
@@ -47,7 +46,7 @@ export class FavoriteLibrariesComponent extends PageComponent
|
||||
|
||||
constructor(
|
||||
content: ContentManagementService,
|
||||
store: Store<AppStore>,
|
||||
store: Store<any>,
|
||||
extensions: AppExtensionService,
|
||||
private contentApiService: ContentApiService,
|
||||
private breakpointObserver: BreakpointObserver,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<app-page-layout>
|
||||
<app-page-layout-header>
|
||||
<aca-page-layout>
|
||||
<aca-page-layout-header>
|
||||
<adf-breadcrumb root="APP.BROWSE.FAVORITES.TITLE"> </adf-breadcrumb>
|
||||
|
||||
<adf-toolbar class="adf-toolbar--inline">
|
||||
@@ -7,9 +7,9 @@
|
||||
<aca-toolbar-action [actionRef]="entry"></aca-toolbar-action>
|
||||
</ng-container>
|
||||
</adf-toolbar>
|
||||
</app-page-layout-header>
|
||||
</aca-page-layout-header>
|
||||
|
||||
<app-page-layout-content>
|
||||
<aca-page-layout-content>
|
||||
<div class="main-content">
|
||||
<adf-document-list
|
||||
#documentList
|
||||
@@ -78,5 +78,5 @@
|
||||
<div class="sidebar" *ngIf="(infoDrawerOpened$ | async)">
|
||||
<aca-info-drawer [node]="selection.last"></aca-info-drawer>
|
||||
</div>
|
||||
</app-page-layout-content>
|
||||
</app-page-layout>
|
||||
</aca-page-layout-content>
|
||||
</aca-page-layout>
|
||||
|
||||
@@ -36,7 +36,7 @@ import { DocumentListComponent } from '@alfresco/adf-content-services';
|
||||
import { of } from 'rxjs';
|
||||
import { FavoritesComponent } from './favorites.component';
|
||||
import { AppTestingModule } from '../../testing/app-testing.module';
|
||||
import { ContentApiService } from '../../services/content-api.service';
|
||||
import { ContentApiService } from '@alfresco/aca-shared';
|
||||
|
||||
describe('FavoritesComponent', () => {
|
||||
let fixture: ComponentFixture<FavoritesComponent>;
|
||||
|
||||
@@ -23,23 +23,23 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
|
||||
import { ContentApiService } from '@alfresco/aca-shared';
|
||||
import { AppStore } from '@alfresco/aca-shared/store';
|
||||
import { UploadService } from '@alfresco/adf-core';
|
||||
import {
|
||||
MinimalNodeEntity,
|
||||
MinimalNodeEntryEntity,
|
||||
PathElementEntity,
|
||||
PathInfo
|
||||
} from '@alfresco/js-api';
|
||||
import { ContentManagementService } from '../../services/content-management.service';
|
||||
import { AppStore } from '../../store/states/app.state';
|
||||
import { PageComponent } from '../page.component';
|
||||
import { ContentApiService } from '../../services/content-api.service';
|
||||
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { debounceTime, map } from 'rxjs/operators';
|
||||
import { AppExtensionService } from '../../extensions/extension.service';
|
||||
import { map, debounceTime } from 'rxjs/operators';
|
||||
import { UploadService } from '@alfresco/adf-core';
|
||||
import { ContentManagementService } from '../../services/content-management.service';
|
||||
import { PageComponent } from '../page.component';
|
||||
|
||||
@Component({
|
||||
templateUrl: './favorites.component.html'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<app-page-layout [hasError]="!isValidPath">
|
||||
<app-page-layout-header>
|
||||
<aca-page-layout [hasError]="!isValidPath">
|
||||
<aca-page-layout-header>
|
||||
<adf-breadcrumb
|
||||
[root]="title"
|
||||
[folderNode]="node"
|
||||
@@ -13,13 +13,13 @@
|
||||
<aca-toolbar-action [actionRef]="entry"></aca-toolbar-action>
|
||||
</ng-container>
|
||||
</adf-toolbar>
|
||||
</app-page-layout-header>
|
||||
</aca-page-layout-header>
|
||||
|
||||
<app-page-layout-error>
|
||||
<aca-page-layout-error>
|
||||
<aca-generic-error></aca-generic-error>
|
||||
</app-page-layout-error>
|
||||
</aca-page-layout-error>
|
||||
|
||||
<app-page-layout-content>
|
||||
<aca-page-layout-content>
|
||||
<div class="main-content">
|
||||
<adf-upload-drag-area [rootFolderId]="node?.id" [disabled]="!canUpload">
|
||||
<adf-document-list
|
||||
@@ -87,5 +87,5 @@
|
||||
<div class="sidebar" *ngIf="(infoDrawerOpened$ | async)">
|
||||
<aca-info-drawer [node]="selection.last"></aca-info-drawer>
|
||||
</div>
|
||||
</app-page-layout-content>
|
||||
</app-page-layout>
|
||||
</aca-page-layout-content>
|
||||
</aca-page-layout>
|
||||
|
||||
@@ -41,7 +41,7 @@ import { DocumentListComponent } from '@alfresco/adf-content-services';
|
||||
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 { ContentApiService } from '@alfresco/aca-shared';
|
||||
import { of, throwError } from 'rxjs';
|
||||
|
||||
describe('FilesComponent', () => {
|
||||
|
||||
@@ -35,14 +35,13 @@ import {
|
||||
} from '@alfresco/js-api';
|
||||
import { ContentManagementService } from '../../services/content-management.service';
|
||||
import { NodeActionsService } from '../../services/node-actions.service';
|
||||
import { AppStore } from '../../store/states/app.state';
|
||||
import { AppStore } from '@alfresco/aca-shared/store';
|
||||
import { PageComponent } from '../page.component';
|
||||
import { ContentApiService } from '../../services/content-api.service';
|
||||
import { ContentApiService } from '@alfresco/aca-shared';
|
||||
import { AppExtensionService } from '../../extensions/extension.service';
|
||||
import { SetCurrentFolderAction } from '../../store/actions';
|
||||
import { SetCurrentFolderAction, isAdmin } from '@alfresco/aca-shared/store';
|
||||
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
|
||||
import { debounceTime, takeUntil } from 'rxjs/operators';
|
||||
import { isAdmin } from '../../store/selectors/app.selectors';
|
||||
import { ShareDataRow } from '@alfresco/adf-content-services';
|
||||
|
||||
@Component({
|
||||
|
||||
@@ -32,14 +32,14 @@ import {
|
||||
} from '@angular/core';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { Observable } from 'rxjs';
|
||||
import {
|
||||
selectHeaderColor,
|
||||
selectAppName,
|
||||
selectLogoPath
|
||||
} from '../../store/selectors/app.selectors';
|
||||
import { ContentActionRef } from '@alfresco/adf-extensions';
|
||||
import { AppExtensionService } from '../../extensions/extension.service';
|
||||
import { AppStore } from '../../store/states';
|
||||
import {
|
||||
AppStore,
|
||||
getHeaderColor,
|
||||
getAppName,
|
||||
getLogoPath
|
||||
} from '@alfresco/aca-shared/store';
|
||||
|
||||
@Component({
|
||||
selector: 'app-header',
|
||||
@@ -61,9 +61,9 @@ export class AppHeaderComponent implements OnInit {
|
||||
store: Store<AppStore>,
|
||||
private appExtensions: AppExtensionService
|
||||
) {
|
||||
this.headerColor$ = store.select(selectHeaderColor);
|
||||
this.appName$ = store.select(selectAppName);
|
||||
this.logo$ = store.select(selectLogoPath);
|
||||
this.headerColor$ = store.select(getHeaderColor);
|
||||
this.appName$ = store.select(getAppName);
|
||||
this.logo$ = store.select(getLogoPath);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
@@ -27,7 +27,7 @@ import { CommentsTabComponent } from './comments-tab.component';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { AppTestingModule } from '../../../testing/app-testing.module';
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { NodePermissionService } from '../../../services/node-permission.service';
|
||||
import { NodePermissionService } from '@alfresco/aca-shared';
|
||||
|
||||
describe('CommentsTabComponent', () => {
|
||||
let component: CommentsTabComponent;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { MinimalNodeEntryEntity } from '@alfresco/js-api';
|
||||
import { NodePermissionService } from '../../../services/node-permission.service';
|
||||
import { NodePermissionService } from '@alfresco/aca-shared';
|
||||
import { isLocked } from '../../../utils/node.utils';
|
||||
|
||||
@Component({
|
||||
|
||||
@@ -26,10 +26,10 @@ import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { InfoDrawerComponent } from './info-drawer.component';
|
||||
import { TestBed, ComponentFixture, async } from '@angular/core/testing';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { SetInfoDrawerStateAction } from '../../store/actions';
|
||||
import { SetInfoDrawerStateAction } from '@alfresco/aca-shared/store';
|
||||
import { AppTestingModule } from '../../testing/app-testing.module';
|
||||
import { AppExtensionService } from '../../extensions/extension.service';
|
||||
import { ContentApiService } from '../../services/content-api.service';
|
||||
import { ContentApiService } from '@alfresco/aca-shared';
|
||||
import { of } from 'rxjs';
|
||||
|
||||
describe('InfoDrawerComponent', () => {
|
||||
|
||||
@@ -29,11 +29,11 @@ import {
|
||||
MinimalNodeEntryEntity,
|
||||
SiteEntry
|
||||
} from '@alfresco/js-api';
|
||||
import { ContentApiService } from '../../services/content-api.service';
|
||||
import { ContentApiService } from '@alfresco/aca-shared';
|
||||
import { AppExtensionService } from '../../extensions/extension.service';
|
||||
import { SidebarTabRef } from '@alfresco/adf-extensions';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { SetInfoDrawerStateAction } from '../../store/actions';
|
||||
import { SetInfoDrawerStateAction } from '@alfresco/aca-shared/store';
|
||||
|
||||
@Component({
|
||||
selector: 'aca-info-drawer',
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ import {
|
||||
tick
|
||||
} from '@angular/core/testing';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { UpdateLibraryAction } from '../../../store/actions';
|
||||
import { UpdateLibraryAction } from '@alfresco/aca-shared/store';
|
||||
import { AppTestingModule } from '../../../testing/app-testing.module';
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { Site, SiteBody } from '@alfresco/js-api';
|
||||
|
||||
+1
-2
@@ -27,8 +27,7 @@ import { Component, Input, OnInit, OnChanges, OnDestroy } from '@angular/core';
|
||||
import { FormGroup, FormControl, Validators } from '@angular/forms';
|
||||
import { SiteEntry, SitePaging } from '@alfresco/js-api';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { UpdateLibraryAction } from '../../../store/actions';
|
||||
import { AppStore } from '../../../store/states/app.state';
|
||||
import { AppStore, UpdateLibraryAction } from '@alfresco/aca-shared/store';
|
||||
import { debounceTime, mergeMap, takeUntil } from 'rxjs/operators';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { Observable, from, Subject } from 'rxjs';
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
*/
|
||||
|
||||
import { MetadataTabComponent } from './metadata-tab.component';
|
||||
import { NodePermissionService } from '../../../services/node-permission.service';
|
||||
import { NodePermissionService } from '@alfresco/aca-shared';
|
||||
import { Node } from '@alfresco/js-api';
|
||||
|
||||
describe('MetadataTabComponent', () => {
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
import { Component, Input, ViewEncapsulation } from '@angular/core';
|
||||
import { MinimalNodeEntryEntity } from '@alfresco/js-api';
|
||||
import { NodePermissionService } from '../../../services/node-permission.service';
|
||||
import { NodePermissionService } from '@alfresco/aca-shared';
|
||||
import { AppExtensionService } from '../../../extensions/extension.service';
|
||||
import { AppConfigService } from '@alfresco/adf-core';
|
||||
import { isLocked } from '../../../utils/node.utils';
|
||||
|
||||
@@ -29,10 +29,12 @@ import { AppConfigService, UserPreferencesService } from '@alfresco/adf-core';
|
||||
import { AppLayoutComponent } from './app-layout.component';
|
||||
import { AppTestingModule } from '../../../testing/app-testing.module';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppStore } from '../../../store/states';
|
||||
import { SetSelectedNodesAction } from '../../../store/actions';
|
||||
import {
|
||||
AppStore,
|
||||
SetSelectedNodesAction,
|
||||
getAppSelection
|
||||
} from '@alfresco/aca-shared/store';
|
||||
import { Router, NavigationStart } from '@angular/router';
|
||||
import { appSelection } from '../../../store/selectors/app.selectors';
|
||||
import { Subject } from 'rxjs';
|
||||
|
||||
class MockRouter {
|
||||
@@ -145,7 +147,7 @@ describe('AppLayoutComponent', () => {
|
||||
|
||||
router.navigateByUrl('somewhere/over/the/rainbow');
|
||||
fixture.detectChanges();
|
||||
store.select(appSelection).subscribe(state => {
|
||||
store.select(getAppSelection).subscribe(state => {
|
||||
expect(state.isEmpty).toBe(true);
|
||||
done();
|
||||
});
|
||||
@@ -158,7 +160,7 @@ describe('AppLayoutComponent', () => {
|
||||
|
||||
router.navigateByUrl('/search;q=');
|
||||
fixture.detectChanges();
|
||||
store.select(appSelection).subscribe(state => {
|
||||
store.select(getAppSelection).subscribe(state => {
|
||||
expect(state.isEmpty).toBe(false);
|
||||
done();
|
||||
});
|
||||
|
||||
@@ -39,11 +39,13 @@ import { NavigationEnd, Router, NavigationStart } from '@angular/router';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { Subject, Observable } from 'rxjs';
|
||||
import { filter, takeUntil, map, withLatestFrom } from 'rxjs/operators';
|
||||
import { NodePermissionService } from '../../../services/node-permission.service';
|
||||
import { currentFolder } from '../../../store/selectors/app.selectors';
|
||||
import { AppStore } from '../../../store/states';
|
||||
import { NodePermissionService } from '@alfresco/aca-shared';
|
||||
import { BreakpointObserver } from '@angular/cdk/layout';
|
||||
import { SetSelectedNodesAction } from '../../../store/actions';
|
||||
import {
|
||||
AppStore,
|
||||
SetSelectedNodesAction,
|
||||
getCurrentFolder
|
||||
} from '@alfresco/aca-shared/store';
|
||||
|
||||
@Component({
|
||||
selector: 'app-layout',
|
||||
@@ -97,7 +99,7 @@ export class AppLayoutComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
this.store
|
||||
.select(currentFolder)
|
||||
.select(getCurrentFolder)
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(node => {
|
||||
this.currentFolderId = node ? node.id : null;
|
||||
|
||||
@@ -33,11 +33,8 @@ import { AppSidenavModule } from '../sidenav/sidenav.module';
|
||||
import { AppUploadingDialogModule } from '../upload-dialog/upload.module';
|
||||
import { AppCommonModule } from '../common/common.module';
|
||||
import { AppHeaderModule } from '../header/header.module';
|
||||
import { PageLayoutComponent } from './page-layout/page-layout.component';
|
||||
import { PageLayoutHeaderComponent } from './page-layout/page-layout-header.component';
|
||||
import { PageLayoutContentComponent } from './page-layout/page-layout-content.component';
|
||||
import { PageLayoutErrorComponent } from './page-layout/page-layout-error.component';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { PageLayoutModule } from '@alfresco/aca-shared';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
@@ -49,21 +46,10 @@ import { HttpClientModule } from '@angular/common/http';
|
||||
AppSidenavModule,
|
||||
AppHeaderModule,
|
||||
HttpClientModule,
|
||||
AppUploadingDialogModule
|
||||
AppUploadingDialogModule,
|
||||
PageLayoutModule
|
||||
],
|
||||
declarations: [
|
||||
AppLayoutComponent,
|
||||
PageLayoutComponent,
|
||||
PageLayoutHeaderComponent,
|
||||
PageLayoutContentComponent,
|
||||
PageLayoutErrorComponent
|
||||
],
|
||||
exports: [
|
||||
AppLayoutComponent,
|
||||
PageLayoutComponent,
|
||||
PageLayoutHeaderComponent,
|
||||
PageLayoutContentComponent,
|
||||
PageLayoutErrorComponent
|
||||
]
|
||||
declarations: [AppLayoutComponent],
|
||||
exports: [AppLayoutComponent, PageLayoutModule]
|
||||
})
|
||||
export class AppLayoutModule {}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
@import './app-layout/app-layout.theme.scss';
|
||||
@import './page-layout/page-layout.theme.scss';
|
||||
|
||||
@mixin layout-theme($theme) {
|
||||
@include app-layout-theme($theme);
|
||||
@include app-page-layout-theme($theme);
|
||||
}
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2019 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,
|
||||
ViewEncapsulation,
|
||||
ChangeDetectionStrategy,
|
||||
Input,
|
||||
HostBinding
|
||||
} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-page-layout-content',
|
||||
template: `
|
||||
<ng-content></ng-content>
|
||||
`,
|
||||
encapsulation: ViewEncapsulation.None,
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
host: { class: 'app-page-layout-content' }
|
||||
})
|
||||
export class PageLayoutContentComponent {
|
||||
@Input()
|
||||
@HostBinding('class.scrollable')
|
||||
scrollable = false;
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2019 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,
|
||||
ViewEncapsulation,
|
||||
ChangeDetectionStrategy
|
||||
} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-page-layout-error',
|
||||
template: `
|
||||
<ng-content></ng-content>
|
||||
`,
|
||||
encapsulation: ViewEncapsulation.None,
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
host: { class: 'app-page-layout-error' }
|
||||
})
|
||||
export class PageLayoutErrorComponent {}
|
||||
@@ -1,39 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2019 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,
|
||||
ViewEncapsulation,
|
||||
ChangeDetectionStrategy
|
||||
} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-page-layout-header',
|
||||
template: '<ng-content></ng-content>',
|
||||
encapsulation: ViewEncapsulation.None,
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
host: { class: 'app-page-layout-header' }
|
||||
})
|
||||
export class PageLayoutHeaderComponent {}
|
||||
@@ -1,3 +0,0 @@
|
||||
<ng-content select="app-page-layout-header"></ng-content>
|
||||
<ng-content select="app-page-layout-error" *ngIf="hasError"></ng-content>
|
||||
<ng-content select="app-page-layout-content" *ngIf="!hasError"></ng-content>
|
||||
@@ -1,43 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2019 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,
|
||||
ViewEncapsulation,
|
||||
ChangeDetectionStrategy,
|
||||
Input
|
||||
} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-page-layout',
|
||||
templateUrl: 'page-layout.component.html',
|
||||
encapsulation: ViewEncapsulation.None,
|
||||
host: { class: 'app-page-layout' },
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
export class PageLayoutComponent {
|
||||
@Input()
|
||||
hasError = false;
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
@mixin app-page-layout-theme($theme) {
|
||||
$foreground: map-get($theme, foreground);
|
||||
|
||||
.app-page-layout {
|
||||
@include flex-column;
|
||||
|
||||
.app-page-layout-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 0 0 65px;
|
||||
flex-basis: 48px;
|
||||
background: #fafafa;
|
||||
border-bottom: 1px solid mat-color($foreground, text, 0.07);
|
||||
padding: 0 24px;
|
||||
}
|
||||
|
||||
.app-page-layout-content {
|
||||
@include flex-row;
|
||||
}
|
||||
|
||||
.app-page-layout-error {
|
||||
@include flex-row;
|
||||
}
|
||||
|
||||
.main-content {
|
||||
@include flex-column;
|
||||
border-right: 1px solid mat-color($foreground, text, 0.07);
|
||||
}
|
||||
|
||||
.scrollable {
|
||||
overflow: auto !important;
|
||||
|
||||
.main-content {
|
||||
overflow: auto !important;
|
||||
}
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
display: block;
|
||||
height: 100%;
|
||||
overflow-y: scroll;
|
||||
max-width: 350px;
|
||||
width: 350px;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
<app-page-layout>
|
||||
<app-page-layout-header>
|
||||
<aca-page-layout>
|
||||
<aca-page-layout-header>
|
||||
<adf-breadcrumb root="APP.BROWSE.LIBRARIES.MENU.MY_LIBRARIES.TITLE">
|
||||
</adf-breadcrumb>
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
<aca-toolbar-action [actionRef]="entry"></aca-toolbar-action>
|
||||
</ng-container>
|
||||
</adf-toolbar>
|
||||
</app-page-layout-header>
|
||||
</aca-page-layout-header>
|
||||
|
||||
<app-page-layout-content>
|
||||
<aca-page-layout-content>
|
||||
<div class="main-content">
|
||||
<adf-document-list
|
||||
#documentList
|
||||
@@ -80,5 +80,5 @@
|
||||
<div class="sidebar" *ngIf="(infoDrawerOpened$ | async)">
|
||||
<aca-info-drawer [node]="selection.library"></aca-info-drawer>
|
||||
</div>
|
||||
</app-page-layout-content>
|
||||
</app-page-layout>
|
||||
</aca-page-layout-content>
|
||||
</aca-page-layout>
|
||||
|
||||
@@ -23,14 +23,13 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { AppStore, NavigateLibraryAction } from '@alfresco/aca-shared/store';
|
||||
import { SiteEntry } from '@alfresco/js-api';
|
||||
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { SiteEntry } from '@alfresco/js-api';
|
||||
import { AppExtensionService } from '../../extensions/extension.service';
|
||||
import { ContentManagementService } from '../../services/content-management.service';
|
||||
import { NavigateLibraryAction } from '../../store/actions';
|
||||
import { AppStore } from '../../store/states/app.state';
|
||||
import { PageComponent } from '../page.component';
|
||||
|
||||
@Component({
|
||||
|
||||
@@ -35,15 +35,16 @@ import { Observable, Subject, Subscription } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { AppExtensionService } from '../extensions/extension.service';
|
||||
import { ContentManagementService } from '../services/content-management.service';
|
||||
import { ViewFileAction, ReloadDocumentListAction } from '../store/actions';
|
||||
import {
|
||||
appSelection,
|
||||
currentFolder,
|
||||
documentDisplayMode,
|
||||
infoDrawerOpened,
|
||||
sharedUrl
|
||||
} from '../store/selectors/app.selectors';
|
||||
import { AppStore } from '../store/states/app.state';
|
||||
AppStore,
|
||||
ViewFileAction,
|
||||
ReloadDocumentListAction,
|
||||
getCurrentFolder,
|
||||
getAppSelection,
|
||||
getDocumentDisplayMode,
|
||||
isInfoDrawerOpened,
|
||||
getSharedUrl
|
||||
} from '@alfresco/aca-shared/store';
|
||||
import { isLocked, isLibrary } from '../utils/node.utils';
|
||||
|
||||
export abstract class PageComponent implements OnInit, OnDestroy {
|
||||
@@ -72,12 +73,12 @@ export abstract class PageComponent implements OnInit, OnDestroy {
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.sharedPreviewUrl$ = this.store.select(sharedUrl);
|
||||
this.infoDrawerOpened$ = this.store.select(infoDrawerOpened);
|
||||
this.documentDisplayMode$ = this.store.select(documentDisplayMode);
|
||||
this.sharedPreviewUrl$ = this.store.select(getSharedUrl);
|
||||
this.infoDrawerOpened$ = this.store.select(isInfoDrawerOpened);
|
||||
this.documentDisplayMode$ = this.store.select(getDocumentDisplayMode);
|
||||
|
||||
this.store
|
||||
.select(appSelection)
|
||||
.select(getAppSelection)
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(selection => {
|
||||
this.selection = selection;
|
||||
@@ -89,7 +90,7 @@ export abstract class PageComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
|
||||
this.store
|
||||
.select(currentFolder)
|
||||
.select(getCurrentFolder)
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(node => {
|
||||
this.canUpload = node && this.content.canUploadContent(node);
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
*/
|
||||
|
||||
import { Component, Inject, ViewEncapsulation } from '@angular/core';
|
||||
import { MAT_DIALOG_DATA } from '@angular/material';
|
||||
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
|
||||
@Component({
|
||||
templateUrl: './node-permissions.dialog.html',
|
||||
|
||||
@@ -23,17 +23,16 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { AppStore, SnackbarErrorAction } from '@alfresco/aca-shared/store';
|
||||
import {
|
||||
NodePermissionDialogService,
|
||||
PermissionListComponent
|
||||
} from '@alfresco/adf-content-services';
|
||||
import { Component, Input, OnInit, ViewChild } from '@angular/core';
|
||||
import { MatDialog } from '@angular/material';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { MinimalNodeEntryEntity } from '@alfresco/js-api';
|
||||
import { ContentApiService } from '../../../services/content-api.service';
|
||||
import { SnackbarErrorAction } from '../../../store/actions/snackbar.actions';
|
||||
import { AppStore } from '../../../store/states/app.state';
|
||||
import { Component, Input, OnInit, ViewChild } from '@angular/core';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { ContentApiService } from '@alfresco/aca-shared';
|
||||
import { NodePermissionsDialogComponent } from '../permission-dialog/node-permissions.dialog';
|
||||
|
||||
@Component({
|
||||
|
||||
@@ -44,7 +44,7 @@ import { of, throwError } from 'rxjs';
|
||||
import { EffectsModule } from '@ngrx/effects';
|
||||
import { NodeEffects } from '../../store/effects/node.effects';
|
||||
import { AppTestingModule } from '../../testing/app-testing.module';
|
||||
import { ContentApiService } from '../../services/content-api.service';
|
||||
import { ContentApiService } from '@alfresco/aca-shared';
|
||||
import { ContentManagementService } from '../../services/content-management.service';
|
||||
|
||||
describe('PreviewComponent', () => {
|
||||
|
||||
@@ -46,10 +46,10 @@ import {
|
||||
AlfrescoApiService
|
||||
} from '@alfresco/adf-core';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppStore } from '../../store/states/app.state';
|
||||
import { SetSelectedNodesAction } from '../../store/actions';
|
||||
import { AppStore } from '@alfresco/aca-shared/store';
|
||||
import { SetSelectedNodesAction } from '@alfresco/aca-shared/store';
|
||||
import { PageComponent } from '../page.component';
|
||||
import { ContentApiService } from '../../services/content-api.service';
|
||||
import { ContentApiService } from '@alfresco/aca-shared';
|
||||
import { AppExtensionService } from '../../extensions/extension.service';
|
||||
import { ContentManagementService } from '../../services/content-management.service';
|
||||
import { ContentActionRef, ViewerExtensionRef } from '@alfresco/adf-extensions';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<app-page-layout>
|
||||
<app-page-layout-header>
|
||||
<aca-page-layout>
|
||||
<aca-page-layout-header>
|
||||
<adf-breadcrumb root="APP.BROWSE.RECENT.TITLE"> </adf-breadcrumb>
|
||||
|
||||
<adf-toolbar class="adf-toolbar--inline">
|
||||
@@ -7,9 +7,9 @@
|
||||
<aca-toolbar-action [actionRef]="entry"></aca-toolbar-action>
|
||||
</ng-container>
|
||||
</adf-toolbar>
|
||||
</app-page-layout-header>
|
||||
</aca-page-layout-header>
|
||||
|
||||
<app-page-layout-content>
|
||||
<aca-page-layout-content>
|
||||
<div class="main-content">
|
||||
<adf-document-list
|
||||
#documentList
|
||||
@@ -79,5 +79,5 @@
|
||||
<div class="sidebar" *ngIf="(infoDrawerOpened$ | async)">
|
||||
<aca-info-drawer [node]="selection.last"></aca-info-drawer>
|
||||
</div>
|
||||
</app-page-layout-content>
|
||||
</app-page-layout>
|
||||
</aca-page-layout-content>
|
||||
</aca-page-layout>
|
||||
|
||||
@@ -29,7 +29,7 @@ import { MinimalNodeEntity } from '@alfresco/js-api';
|
||||
import { ContentManagementService } from '../../services/content-management.service';
|
||||
import { PageComponent } from '../page.component';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppStore } from '../../store/states/app.state';
|
||||
import { AppStore } from '@alfresco/aca-shared/store';
|
||||
import { AppExtensionService } from '../../extensions/extension.service';
|
||||
import { UploadService } from '@alfresco/adf-core';
|
||||
import { debounceTime } from 'rxjs/operators';
|
||||
|
||||
@@ -35,7 +35,10 @@ import {
|
||||
import { SearchInputComponent } from './search-input.component';
|
||||
import { AppTestingModule } from '../../../testing/app-testing.module';
|
||||
import { Actions, ofType } from '@ngrx/effects';
|
||||
import { SEARCH_BY_TERM, SearchByTermAction } from '../../../store/actions';
|
||||
import {
|
||||
SearchByTermAction,
|
||||
SearchActionTypes
|
||||
} from '@alfresco/aca-shared/store';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { SearchQueryBuilderService } from '@alfresco/adf-content-services';
|
||||
import { SearchLibrariesQueryBuilderService } from '../search-libraries-results/search-libraries-query-builder.service';
|
||||
@@ -90,7 +93,7 @@ describe('SearchInputComponent', () => {
|
||||
const searchedTerm = 's';
|
||||
const currentSearchOptions = [{ key: 'test' }];
|
||||
actions$.pipe(
|
||||
ofType<SearchByTermAction>(SEARCH_BY_TERM),
|
||||
ofType<SearchByTermAction>(SearchActionTypes.SearchByTerm),
|
||||
map(action => {
|
||||
expect(action.searchOptions[0].key).toBe(currentSearchOptions[0].key);
|
||||
done();
|
||||
@@ -103,7 +106,7 @@ describe('SearchInputComponent', () => {
|
||||
it('should call search action with correct searched term', fakeAsync(done => {
|
||||
const searchedTerm = 's';
|
||||
actions$.pipe(
|
||||
ofType<SearchByTermAction>(SEARCH_BY_TERM),
|
||||
ofType<SearchByTermAction>(SearchActionTypes.SearchByTerm),
|
||||
map(action => {
|
||||
expect(action.payload).toBe(searchedTerm);
|
||||
done();
|
||||
@@ -119,7 +122,7 @@ describe('SearchInputComponent', () => {
|
||||
const searchedTerm = 's';
|
||||
const currentSearchOptions = [{ key: 'test' }];
|
||||
actions$.pipe(
|
||||
ofType<SearchByTermAction>(SEARCH_BY_TERM),
|
||||
ofType<SearchByTermAction>(SearchActionTypes.SearchByTerm),
|
||||
map(action => {
|
||||
expect(action.searchOptions[0].key).toBe(currentSearchOptions[0].key);
|
||||
done();
|
||||
@@ -132,7 +135,7 @@ describe('SearchInputComponent', () => {
|
||||
it('should call search action with correct searched term', fakeAsync(done => {
|
||||
const searchedTerm = 's';
|
||||
actions$.pipe(
|
||||
ofType<SearchByTermAction>(SEARCH_BY_TERM),
|
||||
ofType<SearchByTermAction>(SearchActionTypes.SearchByTerm),
|
||||
map(action => {
|
||||
expect(action.payload).toBe(searchedTerm);
|
||||
done();
|
||||
|
||||
@@ -23,6 +23,14 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {
|
||||
AppStore,
|
||||
SearchByTermAction,
|
||||
SearchOptionIds,
|
||||
SearchOptionModel
|
||||
} from '@alfresco/aca-shared/store';
|
||||
import { SearchQueryBuilderService } from '@alfresco/adf-content-services';
|
||||
import { AppConfigService } from '@alfresco/adf-core';
|
||||
import {
|
||||
Component,
|
||||
OnDestroy,
|
||||
@@ -30,6 +38,7 @@ import {
|
||||
ViewChild,
|
||||
ViewEncapsulation
|
||||
} from '@angular/core';
|
||||
import { MatMenuTrigger } from '@angular/material/menu';
|
||||
import {
|
||||
NavigationEnd,
|
||||
PRIMARY_OUTLET,
|
||||
@@ -39,21 +48,12 @@ import {
|
||||
UrlSegmentGroup,
|
||||
UrlTree
|
||||
} from '@angular/router';
|
||||
import { SearchInputControlComponent } from '../search-input-control/search-input-control.component';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppStore } from '../../../store/states/app.state';
|
||||
import { SearchByTermAction } from '../../../store/actions';
|
||||
import { filter, takeUntil } from 'rxjs/operators';
|
||||
import { SearchQueryBuilderService } from '@alfresco/adf-content-services';
|
||||
import { ContentManagementService } from '../../../services/content-management.service';
|
||||
import { Subject } from 'rxjs';
|
||||
import { filter, takeUntil } from 'rxjs/operators';
|
||||
import { ContentManagementService } from '../../../services/content-management.service';
|
||||
import { SearchInputControlComponent } from '../search-input-control/search-input-control.component';
|
||||
import { SearchLibrariesQueryBuilderService } from '../search-libraries-results/search-libraries-query-builder.service';
|
||||
import { MatMenuTrigger } from '@angular/material';
|
||||
import { AppConfigService } from '@alfresco/adf-core';
|
||||
import {
|
||||
SearchOptionModel,
|
||||
SearchOptionIds
|
||||
} from '../../../store/models/searchOption.model';
|
||||
|
||||
@Component({
|
||||
selector: 'aca-search-input',
|
||||
|
||||
+6
-6
@@ -1,14 +1,14 @@
|
||||
<app-page-layout>
|
||||
<app-page-layout-header>
|
||||
<aca-page-layout>
|
||||
<aca-page-layout-header>
|
||||
<adf-breadcrumb root="APP.BROWSE.SEARCH_LIBRARIES.TITLE"> </adf-breadcrumb>
|
||||
<adf-toolbar class="adf-toolbar--inline">
|
||||
<ng-container *ngFor="let entry of actions; trackBy: trackByActionId">
|
||||
<aca-toolbar-action [actionRef]="entry"></aca-toolbar-action>
|
||||
</ng-container>
|
||||
</adf-toolbar>
|
||||
</app-page-layout-header>
|
||||
</aca-page-layout-header>
|
||||
|
||||
<app-page-layout-content>
|
||||
<aca-page-layout-content>
|
||||
<div class="main-content">
|
||||
<div class="adf-search-results">
|
||||
<div class="adf-search-results__content">
|
||||
@@ -123,5 +123,5 @@
|
||||
<div class="sidebar" *ngIf="(infoDrawerOpened$ | async)">
|
||||
<aca-info-drawer [node]="selection.last"></aca-info-drawer>
|
||||
</div>
|
||||
</app-page-layout-content>
|
||||
</app-page-layout>
|
||||
</aca-page-layout-content>
|
||||
</aca-page-layout>
|
||||
|
||||
+5
-5
@@ -23,17 +23,17 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { NavigateLibraryAction } from '@alfresco/aca-shared/store';
|
||||
import { NodePaging, Pagination, SiteEntry } from '@alfresco/js-api';
|
||||
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute, Params } from '@angular/router';
|
||||
import { PageComponent } from '../../page.component';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppStore } from '../../../store/states/app.state';
|
||||
import { NavigateLibraryAction } from '../../../store/actions';
|
||||
import { AppExtensionService } from '../../../extensions/extension.service';
|
||||
import { ContentManagementService } from '../../../services/content-management.service';
|
||||
import { AppStore } from '@alfresco/aca-shared/store';
|
||||
import { PageComponent } from '../../page.component';
|
||||
import { SearchLibrariesQueryBuilderService } from './search-libraries-query-builder.service';
|
||||
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
|
||||
|
||||
@Component({
|
||||
selector: 'aca-search-results',
|
||||
|
||||
@@ -32,9 +32,8 @@ import {
|
||||
OnDestroy
|
||||
} from '@angular/core';
|
||||
import { MinimalNodeEntity } from '@alfresco/js-api';
|
||||
import { ViewFileAction } from '../../../store/actions';
|
||||
import { ViewFileAction, NavigateToFolder } from '@alfresco/aca-shared/store';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { NavigateToFolder } from '../../../store/actions';
|
||||
import { BehaviorSubject, Subject } from 'rxjs';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<app-page-layout>
|
||||
<app-page-layout-header>
|
||||
<aca-page-layout>
|
||||
<aca-page-layout-header>
|
||||
<adf-breadcrumb root="APP.BROWSE.SEARCH.TITLE"> </adf-breadcrumb>
|
||||
<adf-toolbar class="adf-toolbar--inline">
|
||||
<ng-container *ngFor="let entry of actions; trackBy: trackByActionId">
|
||||
<aca-toolbar-action [actionRef]="entry"></aca-toolbar-action>
|
||||
</ng-container>
|
||||
</adf-toolbar>
|
||||
</app-page-layout-header>
|
||||
</aca-page-layout-header>
|
||||
|
||||
<app-page-layout-content>
|
||||
<aca-page-layout-content>
|
||||
<div class="main-content">
|
||||
<div class="adf-search-results">
|
||||
<adf-search-filter
|
||||
@@ -114,5 +114,5 @@
|
||||
<div class="sidebar" *ngIf="(infoDrawerOpened$ | async)">
|
||||
<aca-info-drawer [node]="selection.last"></aca-info-drawer>
|
||||
</div>
|
||||
</app-page-layout-content>
|
||||
</app-page-layout>
|
||||
</aca-page-layout-content>
|
||||
</aca-page-layout>
|
||||
|
||||
@@ -16,7 +16,10 @@ import {
|
||||
TranslationService
|
||||
} from '@alfresco/adf-core';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { NavigateToFolder, SnackbarErrorAction } from '../../../store/actions';
|
||||
import {
|
||||
NavigateToFolder,
|
||||
SnackbarErrorAction
|
||||
} from '@alfresco/aca-shared/store';
|
||||
import { Pagination } from '@alfresco/js-api';
|
||||
import { SearchQueryBuilderService } from '@alfresco/adf-content-services';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
||||
@@ -32,14 +32,16 @@ import {
|
||||
} from '@alfresco/adf-content-services';
|
||||
import { PageComponent } from '../../page.component';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppStore } from '../../../store/states/app.state';
|
||||
import { NavigateToFolder } from '../../../store/actions';
|
||||
import {
|
||||
AppStore,
|
||||
NavigateToFolder,
|
||||
SnackbarErrorAction,
|
||||
showFacetFilter
|
||||
} from '@alfresco/aca-shared/store';
|
||||
import { AppExtensionService } from '../../../extensions/extension.service';
|
||||
import { ContentManagementService } from '../../../services/content-management.service';
|
||||
import { AppConfigService, TranslationService } from '@alfresco/adf-core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { showFacetFilter } from '../../../store/selectors/app.selectors';
|
||||
import { SnackbarErrorAction } from '../../../store/actions';
|
||||
|
||||
@Component({
|
||||
selector: 'aca-search-results',
|
||||
|
||||
@@ -32,15 +32,15 @@ import {
|
||||
import { Validators, FormGroup, FormBuilder } from '@angular/forms';
|
||||
import { Observable, BehaviorSubject } from 'rxjs';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppStore } from '../../store/states';
|
||||
import { MatCheckboxChange } from '@angular/material/checkbox';
|
||||
import {
|
||||
appLanguagePicker,
|
||||
selectHeaderColor,
|
||||
selectAppName,
|
||||
selectUser
|
||||
} from '../../store/selectors/app.selectors';
|
||||
import { MatCheckboxChange } from '@angular/material';
|
||||
import { SetLanguagePickerAction } from '../../store/actions';
|
||||
AppStore,
|
||||
SetLanguagePickerAction,
|
||||
getHeaderColor,
|
||||
getAppName,
|
||||
getUserProfile,
|
||||
getLanguagePickerState
|
||||
} from '@alfresco/aca-shared/store';
|
||||
import { ProfileState } from '@alfresco/adf-extensions';
|
||||
|
||||
interface RepositoryConfig {
|
||||
@@ -72,10 +72,10 @@ export class SettingsComponent implements OnInit {
|
||||
private storage: StorageService,
|
||||
private fb: FormBuilder
|
||||
) {
|
||||
this.profile$ = store.select(selectUser);
|
||||
this.appName$ = store.select(selectAppName);
|
||||
this.languagePicker$ = store.select(appLanguagePicker);
|
||||
this.headerColor$ = store.select(selectHeaderColor);
|
||||
this.profile$ = store.select(getUserProfile);
|
||||
this.appName$ = store.select(getAppName);
|
||||
this.languagePicker$ = store.select(getLanguagePickerState);
|
||||
this.headerColor$ = store.select(getHeaderColor);
|
||||
}
|
||||
|
||||
get logo() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<app-page-layout>
|
||||
<app-page-layout-header>
|
||||
<aca-page-layout>
|
||||
<aca-page-layout-header>
|
||||
<adf-breadcrumb root="APP.BROWSE.SHARED.TITLE"> </adf-breadcrumb>
|
||||
|
||||
<adf-toolbar class="adf-toolbar--inline">
|
||||
@@ -7,9 +7,9 @@
|
||||
<aca-toolbar-action [actionRef]="entry"></aca-toolbar-action>
|
||||
</ng-container>
|
||||
</adf-toolbar>
|
||||
</app-page-layout-header>
|
||||
</aca-page-layout-header>
|
||||
|
||||
<app-page-layout-content>
|
||||
<aca-page-layout-content>
|
||||
<div class="main-content">
|
||||
<adf-document-list
|
||||
#documentList
|
||||
@@ -77,5 +77,5 @@
|
||||
<div class="sidebar" *ngIf="(infoDrawerOpened$ | async)">
|
||||
<aca-info-drawer [node]="selection.last"></aca-info-drawer>
|
||||
</div>
|
||||
</app-page-layout-content>
|
||||
</app-page-layout>
|
||||
</aca-page-layout-content>
|
||||
</aca-page-layout>
|
||||
|
||||
@@ -28,7 +28,6 @@ import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
|
||||
import { ContentManagementService } from '../../services/content-management.service';
|
||||
import { PageComponent } from '../page.component';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppStore } from '../../store/states/app.state';
|
||||
import { AppExtensionService } from '../../extensions/extension.service';
|
||||
import { debounceTime } from 'rxjs/operators';
|
||||
import { UploadService } from '@alfresco/adf-core';
|
||||
@@ -42,7 +41,7 @@ export class SharedFilesComponent extends PageComponent implements OnInit {
|
||||
columns: any[] = [];
|
||||
|
||||
constructor(
|
||||
store: Store<AppStore>,
|
||||
store: Store<any>,
|
||||
extensions: AppExtensionService,
|
||||
content: ContentManagementService,
|
||||
private uploadService: UploadService,
|
||||
|
||||
@@ -36,7 +36,7 @@ import { ActivatedRoute } from '@angular/router';
|
||||
import { of } from 'rxjs';
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { SetSelectedNodesAction } from '../../store/actions';
|
||||
import { SetSelectedNodesAction } from '@alfresco/aca-shared/store';
|
||||
import { AppExtensionService } from '../../extensions/extension.service';
|
||||
|
||||
describe('SharedLinkViewComponent', () => {
|
||||
|
||||
@@ -1,15 +1,42 @@
|
||||
import { Component, ViewEncapsulation, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { ContentActionRef } from '@alfresco/adf-extensions';
|
||||
import { AppExtensionService } from '../../extensions/extension.service';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppStore } from '../../store/states/app.state';
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2019 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 {
|
||||
AppStore,
|
||||
SetSelectedNodesAction,
|
||||
getAppSelection
|
||||
} from '@alfresco/aca-shared/store';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { ContentActionRef } from '@alfresco/adf-extensions';
|
||||
import { SharedLinkEntry } from '@alfresco/js-api';
|
||||
import { SetSelectedNodesAction } from '../../store/actions';
|
||||
import { flatMap, catchError } from 'rxjs/operators';
|
||||
import { forkJoin, of, from } from 'rxjs';
|
||||
import { appSelection } from '../../store/selectors/app.selectors';
|
||||
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { forkJoin, from, of } from 'rxjs';
|
||||
import { catchError, flatMap } from 'rxjs/operators';
|
||||
import { AppExtensionService } from '../../extensions/extension.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-shared-link-view',
|
||||
@@ -48,7 +75,7 @@ export class SharedLinkViewComponent implements OnInit {
|
||||
this.sharedLinkId = sharedId;
|
||||
});
|
||||
|
||||
this.store.select(appSelection).subscribe(selection => {
|
||||
this.store.select(getAppSelection).subscribe(selection => {
|
||||
if (!selection.isEmpty)
|
||||
this.viewerToolbarActions = this.extensions.getSharedLinkViewerToolbarActions();
|
||||
});
|
||||
|
||||
@@ -17,7 +17,11 @@
|
||||
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { TestBed, fakeAsync, async, tick } from '@angular/core/testing';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA, MatDialog } from '@angular/material';
|
||||
import {
|
||||
MatDialogRef,
|
||||
MAT_DIALOG_DATA,
|
||||
MatDialog
|
||||
} from '@angular/material/dialog';
|
||||
import { of } from 'rxjs';
|
||||
import {
|
||||
setupTestBed,
|
||||
|
||||
@@ -23,11 +23,14 @@ import {
|
||||
ViewChild,
|
||||
OnDestroy
|
||||
} from '@angular/core';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef, MatDialog } from '@angular/material';
|
||||
import {
|
||||
MAT_DIALOG_DATA,
|
||||
MatDialogRef,
|
||||
MatDialog
|
||||
} from '@angular/material/dialog';
|
||||
import { FormGroup, FormControl } from '@angular/forms';
|
||||
import { Subscription, Observable, throwError } from 'rxjs';
|
||||
import { SnackbarErrorAction } from '../../../store/actions';
|
||||
import { AppStore } from '../../../store/states/app.state';
|
||||
import { AppStore, SnackbarErrorAction } from '@alfresco/aca-shared/store';
|
||||
import { Store } from '@ngrx/store';
|
||||
import {
|
||||
skip,
|
||||
|
||||
@@ -26,10 +26,12 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppStore } from '../../../store/states/app.state';
|
||||
import { appSelection } from '../../../store/selectors/app.selectors';
|
||||
import { SelectionState } from '@alfresco/adf-extensions';
|
||||
import { ShareNodeAction } from '../../../store/actions';
|
||||
import {
|
||||
AppStore,
|
||||
ShareNodeAction,
|
||||
getAppSelection
|
||||
} from '@alfresco/aca-shared/store';
|
||||
|
||||
@Component({
|
||||
selector: 'app-toggle-shared',
|
||||
@@ -41,7 +43,7 @@ export class ToggleSharedComponent implements OnInit {
|
||||
constructor(private store: Store<AppStore>) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.selection$ = this.store.select(appSelection);
|
||||
this.selection$ = this.store.select(getAppSelection);
|
||||
}
|
||||
|
||||
isShared(selection: SelectionState) {
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
import { Directive, Input, HostListener } from '@angular/core';
|
||||
import { PRIMARY_OUTLET, Router } from '@angular/router';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppStore } from '../../../store/states/app.state';
|
||||
|
||||
@Directive({
|
||||
/* tslint:disable-next-line */
|
||||
@@ -41,18 +40,14 @@ export class ActionDirective {
|
||||
if (this.action.route) {
|
||||
this.router.navigate(this.getNavigationCommands(this.action.route));
|
||||
} else if (this.action.click) {
|
||||
this.dispatchAction(this.action.click);
|
||||
this.store.dispatch({
|
||||
type: this.action.click.action,
|
||||
payload: this.getNavigationCommands(this.action.click.payload)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
constructor(private router: Router, private store: Store<AppStore>) {}
|
||||
|
||||
private dispatchAction(action) {
|
||||
this.store.dispatch({
|
||||
type: action.action,
|
||||
payload: this.getNavigationCommands(action.payload)
|
||||
});
|
||||
}
|
||||
constructor(private router: Router, private store: Store<any>) {}
|
||||
|
||||
private getNavigationCommands(url: string): any[] {
|
||||
const urlTree = this.router.parseUrl(url);
|
||||
|
||||
@@ -35,7 +35,6 @@ import { filter, takeUntil } from 'rxjs/operators';
|
||||
import { Subject } from 'rxjs';
|
||||
import { MatExpansionPanel } from '@angular/material/expansion';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppStore } from '../../../store/states/app.state';
|
||||
|
||||
@Directive({
|
||||
selector: '[acaExpansionPanel]',
|
||||
@@ -63,7 +62,7 @@ export class ExpansionPanelDirective implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
constructor(
|
||||
private store: Store<AppStore>,
|
||||
private store: Store<any>,
|
||||
private router: Router,
|
||||
private expansionPanel: MatExpansionPanel
|
||||
) {}
|
||||
|
||||
@@ -34,7 +34,6 @@ import { Router, NavigationEnd, PRIMARY_OUTLET } from '@angular/router';
|
||||
import { filter, takeUntil } from 'rxjs/operators';
|
||||
import { Subject } from 'rxjs';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppStore } from '../../../store/states/app.state';
|
||||
|
||||
@Directive({
|
||||
selector: '[acaMenuPanel]',
|
||||
@@ -61,7 +60,7 @@ export class MenuPanelDirective implements OnInit, OnDestroy {
|
||||
}
|
||||
}
|
||||
|
||||
constructor(private store: Store<AppStore>, private router: Router) {}
|
||||
constructor(private store: Store<any>, private router: Router) {}
|
||||
|
||||
hasActiveLinks() {
|
||||
if (this.acaMenuPanel && this.acaMenuPanel.children) {
|
||||
|
||||
@@ -37,8 +37,7 @@ import { ExpandedTemplateDirective } from './directives/expanded-template.direct
|
||||
import { AppExtensionService } from '../../extensions/extension.service';
|
||||
import { NavBarGroupRef } from '@alfresco/adf-extensions';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppStore } from '../../store/states';
|
||||
import { sidenavState } from '../../store/selectors/app.selectors';
|
||||
import { AppStore, getSideNavState } from '@alfresco/aca-shared/store';
|
||||
import { Subject } from 'rxjs';
|
||||
import { takeUntil, distinctUntilChanged, debounceTime } from 'rxjs/operators';
|
||||
|
||||
@@ -68,7 +67,7 @@ export class SidenavComponent implements OnInit, OnDestroy {
|
||||
|
||||
ngOnInit() {
|
||||
this.store
|
||||
.select(sidenavState)
|
||||
.select(getSideNavState)
|
||||
.pipe(
|
||||
debounceTime(300),
|
||||
distinctUntilChanged(),
|
||||
|
||||
@@ -26,9 +26,11 @@
|
||||
import { Component, ViewEncapsulation } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppStore } from '../../../store/states';
|
||||
import { documentDisplayMode } from '../../../store/selectors/app.selectors';
|
||||
import { ToggleDocumentDisplayMode } from '../../../store/actions';
|
||||
import {
|
||||
AppStore,
|
||||
ToggleDocumentDisplayMode,
|
||||
getDocumentDisplayMode
|
||||
} from '@alfresco/aca-shared/store';
|
||||
|
||||
@Component({
|
||||
selector: 'app-document-display-mode',
|
||||
@@ -45,7 +47,7 @@ export class DocumentDisplayModeComponent {
|
||||
displayMode$: Observable<string>;
|
||||
|
||||
constructor(private store: Store<AppStore>) {
|
||||
this.displayMode$ = store.select(documentDisplayMode);
|
||||
this.displayMode$ = store.select(getDocumentDisplayMode);
|
||||
}
|
||||
|
||||
onClick() {
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ import {
|
||||
DownloadNodesAction,
|
||||
EditOfflineAction,
|
||||
SnackbarErrorAction
|
||||
} from '../../../store/actions';
|
||||
} from '@alfresco/aca-shared/store';
|
||||
|
||||
describe('ToggleEditOfflineComponent', () => {
|
||||
let fixture;
|
||||
|
||||
@@ -23,16 +23,16 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Component, ViewEncapsulation, OnInit } from '@angular/core';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppStore } from '../../../store/states';
|
||||
import { appSelection } from '../../../store/selectors/app.selectors';
|
||||
import {
|
||||
AppStore,
|
||||
DownloadNodesAction,
|
||||
EditOfflineAction,
|
||||
SnackbarErrorAction
|
||||
} from '../../../store/actions';
|
||||
SnackbarErrorAction,
|
||||
getAppSelection
|
||||
} from '@alfresco/aca-shared/store';
|
||||
import { MinimalNodeEntity } from '@alfresco/js-api';
|
||||
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
||||
import { Store } from '@ngrx/store';
|
||||
|
||||
@Component({
|
||||
selector: 'app-toggle-edit-offline',
|
||||
@@ -70,7 +70,7 @@ export class ToggleEditOfflineComponent implements OnInit {
|
||||
constructor(private store: Store<AppStore>) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.store.select(appSelection).subscribe(({ file }) => {
|
||||
this.store.select(getAppSelection).subscribe(({ file }) => {
|
||||
this.selection = file;
|
||||
});
|
||||
}
|
||||
|
||||
+2
-3
@@ -25,8 +25,7 @@
|
||||
|
||||
import { Component, ViewEncapsulation, OnInit } from '@angular/core';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppStore } from '../../../store/states';
|
||||
import { appSelection } from '../../../store/selectors/app.selectors';
|
||||
import { AppStore, getAppSelection } from '@alfresco/aca-shared/store';
|
||||
import { Observable } from 'rxjs';
|
||||
import { SelectionState } from '@alfresco/adf-extensions';
|
||||
import { ContentManagementService } from '../../../services/content-management.service';
|
||||
@@ -73,7 +72,7 @@ export class ToggleFavoriteLibraryComponent implements OnInit {
|
||||
'/favorite/libraries'
|
||||
);
|
||||
|
||||
this.selection$ = this.store.select(appSelection).pipe(
|
||||
this.selection$ = this.store.select(getAppSelection).pipe(
|
||||
distinctUntilChanged(),
|
||||
map(selection => {
|
||||
// favorite libraries list should already be marked as favorite
|
||||
|
||||
@@ -25,11 +25,13 @@
|
||||
|
||||
import { Component, ViewEncapsulation } from '@angular/core';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppStore } from '../../../store/states';
|
||||
import { appSelection } from '../../../store/selectors/app.selectors';
|
||||
import { Observable } from 'rxjs';
|
||||
import { SelectionState } from '@alfresco/adf-extensions';
|
||||
import { ReloadDocumentListAction } from '../../../store/actions';
|
||||
import {
|
||||
AppStore,
|
||||
ReloadDocumentListAction,
|
||||
getAppSelection
|
||||
} from '@alfresco/aca-shared/store';
|
||||
|
||||
@Component({
|
||||
selector: 'app-toggle-favorite',
|
||||
@@ -56,7 +58,7 @@ export class ToggleFavoriteComponent {
|
||||
selection$: Observable<SelectionState>;
|
||||
|
||||
constructor(private store: Store<AppStore>) {
|
||||
this.selection$ = this.store.select(appSelection);
|
||||
this.selection$ = this.store.select(getAppSelection);
|
||||
}
|
||||
|
||||
onToggleEvent() {
|
||||
|
||||
@@ -26,9 +26,10 @@
|
||||
import { Component, ViewEncapsulation } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppStore } from '../../../store/states';
|
||||
import { infoDrawerOpened } from '../../../store/selectors/app.selectors';
|
||||
import { ToggleInfoDrawerAction } from '../../../store/actions';
|
||||
import {
|
||||
ToggleInfoDrawerAction,
|
||||
isInfoDrawerOpened
|
||||
} from '@alfresco/aca-shared/store';
|
||||
|
||||
@Component({
|
||||
selector: 'app-toggle-info-drawer',
|
||||
@@ -48,8 +49,8 @@ import { ToggleInfoDrawerAction } from '../../../store/actions';
|
||||
export class ToggleInfoDrawerComponent {
|
||||
infoDrawerOpened$: Observable<boolean>;
|
||||
|
||||
constructor(private store: Store<AppStore>) {
|
||||
this.infoDrawerOpened$ = this.store.select(infoDrawerOpened);
|
||||
constructor(private store: Store<any>) {
|
||||
this.infoDrawerOpened$ = this.store.select(isInfoDrawerOpened);
|
||||
}
|
||||
|
||||
onClick() {
|
||||
|
||||
+12
-12
@@ -23,22 +23,22 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {
|
||||
AppStore,
|
||||
SetSelectedNodesAction,
|
||||
SnackbarErrorAction,
|
||||
SnackbarInfoAction,
|
||||
getAppSelection
|
||||
} from '@alfresco/aca-shared/store';
|
||||
import { SelectionState } from '@alfresco/adf-extensions';
|
||||
import { Component, ViewEncapsulation } from '@angular/core';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppStore } from '../../../store/states';
|
||||
import { appSelection } from '../../../store/selectors/app.selectors';
|
||||
import { Observable } from 'rxjs';
|
||||
import { SelectionState } from '@alfresco/adf-extensions';
|
||||
import { ContentManagementService } from '../../../services/content-management.service';
|
||||
import {
|
||||
SnackbarErrorAction,
|
||||
SnackbarInfoAction
|
||||
} from '../../../store/actions/snackbar.actions';
|
||||
import { SetSelectedNodesAction } from '../../../store/actions/node.actions';
|
||||
import {
|
||||
LibraryMembershipToggleEvent,
|
||||
LibraryMembershipErrorEvent
|
||||
LibraryMembershipErrorEvent,
|
||||
LibraryMembershipToggleEvent
|
||||
} from '../../../directives/library-membership.directive';
|
||||
import { ContentManagementService } from '../../../services/content-management.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-toggle-join-library-button',
|
||||
@@ -73,7 +73,7 @@ export class ToggleJoinLibraryButtonComponent {
|
||||
private store: Store<AppStore>,
|
||||
private content: ContentManagementService
|
||||
) {
|
||||
this.selection$ = this.store.select(appSelection);
|
||||
this.selection$ = this.store.select(getAppSelection);
|
||||
}
|
||||
|
||||
onToggleEvent(event: LibraryMembershipToggleEvent) {
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@
|
||||
|
||||
import { Component, ViewEncapsulation } from '@angular/core';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppStore } from '../../../store/states';
|
||||
import { AppStore } from '@alfresco/aca-shared/store';
|
||||
import { ContentManagementService } from '../../../services/content-management.service';
|
||||
import { ToggleJoinLibraryButtonComponent } from './toggle-join-library-button.component';
|
||||
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import {
|
||||
SnackbarErrorAction,
|
||||
SnackbarInfoAction
|
||||
} from '../../../store/actions/snackbar.actions';
|
||||
} from '@alfresco/aca-shared/store';
|
||||
import { AppTestingModule } from '../../../testing/app-testing.module';
|
||||
import { ContentManagementService } from '../../../services/content-management.service';
|
||||
import { ToggleJoinLibraryButtonComponent } from './toggle-join-library-button.component';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<app-page-layout>
|
||||
<app-page-layout-header>
|
||||
<aca-page-layout>
|
||||
<aca-page-layout-header>
|
||||
<adf-breadcrumb root="APP.BROWSE.TRASHCAN.TITLE"> </adf-breadcrumb>
|
||||
|
||||
<adf-toolbar class="adf-toolbar--inline">
|
||||
@@ -7,9 +7,9 @@
|
||||
<aca-toolbar-action [actionRef]="entry"></aca-toolbar-action>
|
||||
</ng-container>
|
||||
</adf-toolbar>
|
||||
</app-page-layout-header>
|
||||
</aca-page-layout-header>
|
||||
|
||||
<app-page-layout-content>
|
||||
<aca-page-layout-content>
|
||||
<div class="main-content">
|
||||
<adf-document-list
|
||||
#documentList
|
||||
@@ -86,5 +86,5 @@
|
||||
|
||||
<adf-pagination acaPagination [target]="documentList"> </adf-pagination>
|
||||
</div>
|
||||
</app-page-layout-content>
|
||||
</app-page-layout>
|
||||
</aca-page-layout-content>
|
||||
</aca-page-layout>
|
||||
|
||||
@@ -23,16 +23,15 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { AppStore, getUserProfile } from '@alfresco/aca-shared/store';
|
||||
import { ProfileState } from '@alfresco/adf-extensions';
|
||||
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { Observable } from 'rxjs';
|
||||
import { AppExtensionService } from '../../extensions/extension.service';
|
||||
import { ContentManagementService } from '../../services/content-management.service';
|
||||
import { PageComponent } from '../page.component';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { selectUser } from '../../store/selectors/app.selectors';
|
||||
import { AppStore } from '../../store/states/app.state';
|
||||
import { AppExtensionService } from '../../extensions/extension.service';
|
||||
import { Observable } from 'rxjs';
|
||||
import { ProfileState } from '@alfresco/adf-extensions';
|
||||
|
||||
@Component({
|
||||
templateUrl: './trashcan.component.html'
|
||||
@@ -50,7 +49,7 @@ export class TrashcanComponent extends PageComponent implements OnInit {
|
||||
private breakpointObserver: BreakpointObserver
|
||||
) {
|
||||
super(store, extensions, content);
|
||||
this.user$ = this.store.select(selectUser);
|
||||
this.user$ = this.store.select(getUserProfile);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
@@ -23,21 +23,21 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Component, OnInit, OnDestroy, ViewEncapsulation } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { ContentActionRef, SelectionState } from '@alfresco/adf-extensions';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppStore } from '../../store/states';
|
||||
import { ContentApiService } from '@alfresco/aca-shared';
|
||||
import {
|
||||
appSelection,
|
||||
infoDrawerOpened
|
||||
} from '../../store/selectors/app.selectors';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { Subject, Observable, from } from 'rxjs';
|
||||
import { AppExtensionService } from '../../extensions/extension.service';
|
||||
AppStore,
|
||||
getAppSelection,
|
||||
isInfoDrawerOpened,
|
||||
SetSelectedNodesAction
|
||||
} from '@alfresco/aca-shared/store';
|
||||
import { ContentActionRef, SelectionState } from '@alfresco/adf-extensions';
|
||||
import { MinimalNodeEntryEntity } from '@alfresco/js-api';
|
||||
import { ContentApiService } from '../../services/content-api.service';
|
||||
import { SetSelectedNodesAction } from '../../store/actions';
|
||||
import { Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { from, Observable, Subject } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { AppExtensionService } from '../../extensions/extension.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-viewer',
|
||||
@@ -66,7 +66,7 @@ export class AppViewerComponent implements OnInit, OnDestroy {
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.infoDrawerOpened$ = this.store.select(infoDrawerOpened);
|
||||
this.infoDrawerOpened$ = this.store.select(isInfoDrawerOpened);
|
||||
|
||||
from(this.infoDrawerOpened$)
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
@@ -75,7 +75,7 @@ export class AppViewerComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
|
||||
this.store
|
||||
.select(appSelection)
|
||||
.select(getAppSelection)
|
||||
.pipe(takeUntil(this.onDestroy$))
|
||||
.subscribe(selection => {
|
||||
this.selection = selection;
|
||||
|
||||
@@ -23,12 +23,11 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Component, Inject, ViewEncapsulation } from '@angular/core';
|
||||
import { MAT_DIALOG_DATA } from '@angular/material';
|
||||
import { SnackbarErrorAction } from '@alfresco/aca-shared/store';
|
||||
import { MinimalNodeEntryEntity } from '@alfresco/js-api';
|
||||
import { Component, Inject, ViewEncapsulation } from '@angular/core';
|
||||
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppStore } from '../../store/states/app.state';
|
||||
import { SnackbarErrorAction } from '../../store/actions';
|
||||
|
||||
@Component({
|
||||
templateUrl: './node-versions.dialog.html',
|
||||
@@ -38,10 +37,7 @@ import { SnackbarErrorAction } from '../../store/actions';
|
||||
export class NodeVersionsDialogComponent {
|
||||
node: MinimalNodeEntryEntity;
|
||||
|
||||
constructor(
|
||||
@Inject(MAT_DIALOG_DATA) data: any,
|
||||
private store: Store<AppStore>
|
||||
) {
|
||||
constructor(@Inject(MAT_DIALOG_DATA) data: any, private store: Store<any>) {
|
||||
this.node = data.node;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { UserPreferencesService } from '@alfresco/adf-core';
|
||||
import { Subject } from 'rxjs';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { SetSelectedNodesAction } from '../store/actions';
|
||||
import { SetSelectedNodesAction } from '@alfresco/aca-shared/store';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { ContentManagementService } from '../services/content-management.service';
|
||||
|
||||
|
||||
@@ -27,9 +27,7 @@ import { CoreModule, AuthGuardEcm } from '@alfresco/adf-core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { APP_INITIALIZER, ModuleWithProviders, NgModule } from '@angular/core';
|
||||
import { AppLayoutComponent } from '../components/layout/app-layout/app-layout.component';
|
||||
import * as repository from './evaluators/repository.evaluators';
|
||||
import * as app from './evaluators/app.evaluators';
|
||||
import * as nav from './evaluators/navigation.evaluators';
|
||||
import * as rules from '@alfresco/aca-shared/rules';
|
||||
import { AppExtensionService } from './extension.service';
|
||||
import { ToggleInfoDrawerComponent } from '../components/toolbar/toggle-info-drawer/toggle-info-drawer.component';
|
||||
import { ToggleFavoriteComponent } from '../components/toolbar/toggle-favorite/toggle-favorite.component';
|
||||
@@ -109,63 +107,63 @@ export class CoreExtensionsModule {
|
||||
});
|
||||
|
||||
extensions.setEvaluators({
|
||||
canCopyNode: app.canCopyNode,
|
||||
canToggleJoinLibrary: app.canToggleJoinLibrary,
|
||||
canEditFolder: app.canEditFolder,
|
||||
isTrashcanItemSelected: app.isTrashcanItemSelected,
|
||||
canViewFile: app.canViewFile,
|
||||
canLeaveLibrary: app.canLeaveLibrary,
|
||||
canToggleSharedLink: app.canToggleSharedLink,
|
||||
canShowInfoDrawer: app.canShowInfoDrawer,
|
||||
canManageFileVersions: app.canManageFileVersions,
|
||||
canManagePermissions: app.canManagePermissions,
|
||||
canToggleEditOffline: app.canToggleEditOffline,
|
||||
canToggleFavorite: app.canToggleFavorite,
|
||||
canCopyNode: rules.canCopyNode,
|
||||
canToggleJoinLibrary: rules.canToggleJoinLibrary,
|
||||
canEditFolder: rules.canEditFolder,
|
||||
isTrashcanItemSelected: rules.isTrashcanItemSelected,
|
||||
canViewFile: rules.canViewFile,
|
||||
canLeaveLibrary: rules.canLeaveLibrary,
|
||||
canToggleSharedLink: rules.canToggleSharedLink,
|
||||
canShowInfoDrawer: rules.canShowInfoDrawer,
|
||||
canManageFileVersions: rules.canManageFileVersions,
|
||||
canManagePermissions: rules.canManagePermissions,
|
||||
canToggleEditOffline: rules.canToggleEditOffline,
|
||||
canToggleFavorite: rules.canToggleFavorite,
|
||||
|
||||
'app.selection.canDelete': app.canDeleteSelection,
|
||||
'app.selection.file.canUnlock': app.canUnlockFile,
|
||||
'app.selection.file.canLock': app.canLockFile,
|
||||
'app.selection.canDownload': app.canDownloadSelection,
|
||||
'app.selection.notEmpty': app.hasSelection,
|
||||
'app.selection.canUnshare': app.canUnshareNodes,
|
||||
'app.selection.canAddFavorite': app.canAddFavorite,
|
||||
'app.selection.canRemoveFavorite': app.canRemoveFavorite,
|
||||
'app.selection.first.canUpdate': app.canUpdateSelectedNode,
|
||||
'app.selection.file': app.hasFileSelected,
|
||||
'app.selection.file.canShare': app.canShareFile,
|
||||
'app.selection.file.isShared': app.isShared,
|
||||
'app.selection.file.isLocked': app.hasLockedFiles,
|
||||
'app.selection.file.isLockOwner': app.isUserWriteLockOwner,
|
||||
'app.selection.file.canUploadVersion': app.canUploadVersion,
|
||||
'app.selection.library': app.hasLibrarySelected,
|
||||
'app.selection.isPrivateLibrary': app.isPrivateLibrary,
|
||||
'app.selection.hasLibraryRole': app.hasLibraryRole,
|
||||
'app.selection.hasNoLibraryRole': app.hasNoLibraryRole,
|
||||
'app.selection.folder': app.hasFolderSelected,
|
||||
'app.selection.folder.canUpdate': app.canUpdateSelectedFolder,
|
||||
'app.selection.canDelete': rules.canDeleteSelection,
|
||||
'app.selection.file.canUnlock': rules.canUnlockFile,
|
||||
'app.selection.file.canLock': rules.canLockFile,
|
||||
'app.selection.canDownload': rules.canDownloadSelection,
|
||||
'app.selection.notEmpty': rules.hasSelection,
|
||||
'app.selection.canUnshare': rules.canUnshareNodes,
|
||||
'app.selection.canAddFavorite': rules.canAddFavorite,
|
||||
'app.selection.canRemoveFavorite': rules.canRemoveFavorite,
|
||||
'app.selection.first.canUpdate': rules.canUpdateSelectedNode,
|
||||
'app.selection.file': rules.hasFileSelected,
|
||||
'app.selection.file.canShare': rules.canShareFile,
|
||||
'app.selection.file.isShared': rules.isShared,
|
||||
'app.selection.file.isLocked': rules.hasLockedFiles,
|
||||
'app.selection.file.isLockOwner': rules.isUserWriteLockOwner,
|
||||
'app.selection.file.canUploadVersion': rules.canUploadVersion,
|
||||
'app.selection.library': rules.hasLibrarySelected,
|
||||
'app.selection.isPrivateLibrary': rules.isPrivateLibrary,
|
||||
'app.selection.hasLibraryRole': rules.hasLibraryRole,
|
||||
'app.selection.hasNoLibraryRole': rules.hasNoLibraryRole,
|
||||
'app.selection.folder': rules.hasFolderSelected,
|
||||
'app.selection.folder.canUpdate': rules.canUpdateSelectedFolder,
|
||||
|
||||
'app.navigation.folder.canCreate': app.canCreateFolder,
|
||||
'app.navigation.folder.canUpload': app.canUpload,
|
||||
'app.navigation.isTrashcan': nav.isTrashcan,
|
||||
'app.navigation.isNotTrashcan': nav.isNotTrashcan,
|
||||
'app.navigation.isLibraries': nav.isLibraries,
|
||||
'app.navigation.isLibraryFiles': nav.isLibraryFiles,
|
||||
'app.navigation.isPersonalFiles': nav.isPersonalFiles,
|
||||
'app.navigation.isNotLibraries': nav.isNotLibraries,
|
||||
'app.navigation.isSharedFiles': nav.isSharedFiles,
|
||||
'app.navigation.isNotSharedFiles': nav.isNotSharedFiles,
|
||||
'app.navigation.isFavorites': nav.isFavorites,
|
||||
'app.navigation.isNotFavorites': nav.isNotFavorites,
|
||||
'app.navigation.isRecentFiles': nav.isRecentFiles,
|
||||
'app.navigation.isNotRecentFiles': nav.isNotRecentFiles,
|
||||
'app.navigation.isSearchResults': nav.isSearchResults,
|
||||
'app.navigation.isNotSearchResults': nav.isNotSearchResults,
|
||||
'app.navigation.isPreview': nav.isPreview,
|
||||
'app.navigation.isSharedPreview': nav.isSharedPreview,
|
||||
'app.navigation.isFavoritesPreview': nav.isFavoritesPreview,
|
||||
'app.navigation.isSharedFileViewer': nav.isSharedFileViewer,
|
||||
'app.navigation.folder.canCreate': rules.canCreateFolder,
|
||||
'app.navigation.folder.canUpload': rules.canUpload,
|
||||
'app.navigation.isTrashcan': rules.isTrashcan,
|
||||
'app.navigation.isNotTrashcan': rules.isNotTrashcan,
|
||||
'app.navigation.isLibraries': rules.isLibraries,
|
||||
'app.navigation.isLibraryFiles': rules.isLibraryFiles,
|
||||
'app.navigation.isPersonalFiles': rules.isPersonalFiles,
|
||||
'app.navigation.isNotLibraries': rules.isNotLibraries,
|
||||
'app.navigation.isSharedFiles': rules.isSharedFiles,
|
||||
'app.navigation.isNotSharedFiles': rules.isNotSharedFiles,
|
||||
'app.navigation.isFavorites': rules.isFavorites,
|
||||
'app.navigation.isNotFavorites': rules.isNotFavorites,
|
||||
'app.navigation.isRecentFiles': rules.isRecentFiles,
|
||||
'app.navigation.isNotRecentFiles': rules.isNotRecentFiles,
|
||||
'app.navigation.isSearchResults': rules.isSearchResults,
|
||||
'app.navigation.isNotSearchResults': rules.isNotSearchResults,
|
||||
'app.navigation.isPreview': rules.isPreview,
|
||||
'app.navigation.isSharedPreview': rules.isSharedPreview,
|
||||
'app.navigation.isFavoritesPreview': rules.isFavoritesPreview,
|
||||
'app.navigation.isSharedFileViewer': rules.isSharedFileViewer,
|
||||
|
||||
'repository.isQuickShareEnabled': repository.hasQuickShareEnabled
|
||||
'repository.isQuickShareEnabled': rules.hasQuickShareEnabled
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,365 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2019 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 * as app from './app.evaluators';
|
||||
|
||||
describe('app.evaluators', () => {
|
||||
describe('isWriteLocked', () => {
|
||||
it('should return [true] if lock type is set', () => {
|
||||
const context: any = {
|
||||
selection: {
|
||||
file: {
|
||||
entry: {
|
||||
properties: {
|
||||
'cm:lockType': 'WRITE_LOCK'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.isWriteLocked(context)).toBe(true);
|
||||
});
|
||||
|
||||
it('should return [false] if lock type is not set', () => {
|
||||
const context: any = {
|
||||
selection: {
|
||||
file: {
|
||||
entry: {
|
||||
properties: {}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.isWriteLocked(context)).toBe(false);
|
||||
});
|
||||
|
||||
it('should return [false] if selection not present', () => {
|
||||
const context: any = {};
|
||||
|
||||
expect(app.isWriteLocked(context)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('hasLockedFiles', () => {
|
||||
it('should return [false] if selection not present', () => {
|
||||
const context: any = {};
|
||||
expect(app.hasLockedFiles(context)).toBe(false);
|
||||
});
|
||||
|
||||
it('should return [false] if nodes not present', () => {
|
||||
const context: any = {
|
||||
selection: {
|
||||
nodes: null
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.hasLockedFiles(context)).toBe(false);
|
||||
});
|
||||
|
||||
it('should return [false] if no files selected', () => {
|
||||
const context: any = {
|
||||
selection: {
|
||||
nodes: [
|
||||
{
|
||||
entry: {
|
||||
isFile: false
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: {
|
||||
isFile: false
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.hasLockedFiles(context)).toBe(false);
|
||||
});
|
||||
|
||||
it('should return [true] when one of files is locked', () => {
|
||||
const context: any = {
|
||||
selection: {
|
||||
nodes: [
|
||||
{
|
||||
entry: {
|
||||
isFile: true,
|
||||
isLocked: true
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: {
|
||||
isFile: true,
|
||||
isLocked: false
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.hasLockedFiles(context)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
it('should return [true] when one of files has readonly lock', () => {
|
||||
const context: any = {
|
||||
selection: {
|
||||
nodes: [
|
||||
{
|
||||
entry: {
|
||||
isFile: true,
|
||||
isLocked: false
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: {
|
||||
isFile: true,
|
||||
isLocked: false,
|
||||
properties: {
|
||||
'cm:lockType': 'READ_ONLY_LOCK'
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.hasLockedFiles(context)).toBe(true);
|
||||
});
|
||||
|
||||
describe('canUpdateSelectedNode', () => {
|
||||
it('should return [false] if selection not preset', () => {
|
||||
const context: any = {};
|
||||
|
||||
expect(app.canUpdateSelectedNode(context)).toBe(false);
|
||||
});
|
||||
|
||||
it('should return [false] if selection is empty', () => {
|
||||
const context: any = {
|
||||
selection: {
|
||||
isEmpty: true
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.canUpdateSelectedNode(context)).toBe(false);
|
||||
});
|
||||
|
||||
it('should return [false] if first selection is not a file', () => {
|
||||
const context: any = {
|
||||
permissions: {
|
||||
check: () => false
|
||||
},
|
||||
selection: {
|
||||
isEmpty: false,
|
||||
first: {
|
||||
entry: {
|
||||
isFile: false
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.canUpdateSelectedNode(context)).toBe(false);
|
||||
});
|
||||
|
||||
it('should return [false] if the file is locked', () => {
|
||||
const context: any = {
|
||||
permissions: {
|
||||
check: () => true
|
||||
},
|
||||
selection: {
|
||||
isEmpty: false,
|
||||
nodes: [
|
||||
{
|
||||
entry: {
|
||||
isFile: true,
|
||||
isLocked: true
|
||||
}
|
||||
}
|
||||
],
|
||||
first: {
|
||||
entry: {
|
||||
isFile: true,
|
||||
isLocked: true
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.canUpdateSelectedNode(context)).toBe(false);
|
||||
});
|
||||
|
||||
it('should evaluate allowable operation for the file', () => {
|
||||
const context: any = {
|
||||
permissions: {
|
||||
check: () => true
|
||||
},
|
||||
selection: {
|
||||
isEmpty: false,
|
||||
nodes: [
|
||||
{
|
||||
entry: {
|
||||
isFile: true,
|
||||
allowableOperationsOnTarget: []
|
||||
}
|
||||
}
|
||||
],
|
||||
first: {
|
||||
entry: {
|
||||
isFile: true,
|
||||
allowableOperationsOnTarget: []
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.canUpdateSelectedNode(context)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('canUploadVersion', () => {
|
||||
it('should return [true] if user has locked it previously', () => {
|
||||
const context: any = {
|
||||
navigation: {
|
||||
url: '/personal-files'
|
||||
},
|
||||
profile: {
|
||||
id: 'user1'
|
||||
},
|
||||
selection: {
|
||||
file: {
|
||||
entry: {
|
||||
properties: {
|
||||
'cm:lockType': 'WRITE_LOCK',
|
||||
'cm:lockOwner': {
|
||||
id: 'user1'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.canUploadVersion(context)).toBe(true);
|
||||
});
|
||||
|
||||
it('should return [false] if other user has locked it previously', () => {
|
||||
const context: any = {
|
||||
navigation: {
|
||||
url: '/personal-files'
|
||||
},
|
||||
profile: {
|
||||
id: 'user2'
|
||||
},
|
||||
selection: {
|
||||
file: {
|
||||
entry: {
|
||||
properties: {
|
||||
'cm:lockType': 'WRITE_LOCK',
|
||||
'cm:lockOwner': {
|
||||
id: 'user1'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.canUploadVersion(context)).toBe(false);
|
||||
});
|
||||
|
||||
it('should check the [update] operation when no write lock present', () => {
|
||||
let checked = false;
|
||||
const context: any = {
|
||||
navigation: {
|
||||
url: '/personal-files'
|
||||
},
|
||||
permissions: {
|
||||
check: () => (checked = true)
|
||||
},
|
||||
selection: {
|
||||
file: {},
|
||||
isEmpty: false,
|
||||
nodes: [
|
||||
{
|
||||
entry: {
|
||||
isFile: true
|
||||
}
|
||||
}
|
||||
],
|
||||
first: {
|
||||
entry: {
|
||||
isFile: true
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.canUploadVersion(context)).toBe(true);
|
||||
expect(checked).toBe(true);
|
||||
});
|
||||
|
||||
it('should return [true] if route is `/favorites`', () => {
|
||||
const context: any = {
|
||||
selection: {
|
||||
file: {}
|
||||
},
|
||||
navigation: {
|
||||
url: '/favorites'
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.canUploadVersion(context)).toBe(true);
|
||||
});
|
||||
|
||||
it('should return [true] if route is `/favorites`', () => {
|
||||
const context: any = {
|
||||
selection: {
|
||||
file: {}
|
||||
},
|
||||
navigation: {
|
||||
url: '/favorites'
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.canUploadVersion(context)).toBe(true);
|
||||
});
|
||||
|
||||
it('should return [true] if route is `/shared`', () => {
|
||||
const context: any = {
|
||||
selection: {
|
||||
file: {}
|
||||
},
|
||||
navigation: {
|
||||
url: '/shared'
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.canUploadVersion(context)).toBe(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,528 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2019 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 { RuleContext } from '@alfresco/adf-extensions';
|
||||
import * as navigation from './navigation.evaluators';
|
||||
import * as repository from './repository.evaluators';
|
||||
|
||||
/**
|
||||
* Checks if user can copy selected node.
|
||||
* JSON ref: `app.canCopyNode`
|
||||
* @param context Rule execution context
|
||||
*/
|
||||
export function canCopyNode(context: RuleContext): boolean {
|
||||
return [
|
||||
hasSelection(context),
|
||||
navigation.isNotTrashcan(context),
|
||||
navigation.isNotLibraries(context)
|
||||
].every(Boolean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if user can mark selected nodes as **Favorite**.
|
||||
* JSON ref: `app.selection.canAddFavorite`
|
||||
*/
|
||||
export function canAddFavorite(context: RuleContext): boolean {
|
||||
if (!context.selection.isEmpty) {
|
||||
if (
|
||||
navigation.isFavorites(context) ||
|
||||
navigation.isLibraries(context) ||
|
||||
navigation.isTrashcan(context)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
return context.selection.nodes.some(node => !node.entry.isFavorite);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if user can un-mark selected nodes as **Favorite**.
|
||||
* JSON ref: `app.selection.canRemoveFavorite`
|
||||
*/
|
||||
export function canRemoveFavorite(context: RuleContext): boolean {
|
||||
if (!context.selection.isEmpty && !navigation.isTrashcan(context)) {
|
||||
if (navigation.isFavorites(context)) {
|
||||
return true;
|
||||
}
|
||||
return context.selection.nodes.every(node => node.entry.isFavorite);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if user can share selected file.
|
||||
* JSON ref: `app.selection.file.canShare`
|
||||
*/
|
||||
export function canShareFile(context: RuleContext): boolean {
|
||||
return [
|
||||
context.selection.file,
|
||||
navigation.isNotTrashcan(context),
|
||||
repository.hasQuickShareEnabled(context),
|
||||
!isShared(context)
|
||||
].every(Boolean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if user can perform "Join" or "Cancel Join Request" on a library.
|
||||
* JSON ref: `canToggleJoinLibrary`
|
||||
*/
|
||||
export function canToggleJoinLibrary(context: RuleContext): boolean {
|
||||
return [
|
||||
hasLibrarySelected(context),
|
||||
!isPrivateLibrary(context),
|
||||
hasNoLibraryRole(context)
|
||||
].every(Boolean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if user can edit the selected folder.
|
||||
* JSON ref: `canEditFolder`
|
||||
* @param context Rule execution context
|
||||
*/
|
||||
export function canEditFolder(context: RuleContext): boolean {
|
||||
return [
|
||||
canUpdateSelectedFolder(context),
|
||||
navigation.isNotTrashcan(context)
|
||||
].every(Boolean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the selected file is already shared.
|
||||
* JSON ref: `app.selection.file.isShared`
|
||||
*/
|
||||
export function isShared(context: RuleContext): boolean {
|
||||
if (navigation.isSharedFiles(context) && !context.selection.isEmpty) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (
|
||||
(navigation.isNotTrashcan(context),
|
||||
!context.selection.isEmpty && context.selection.file)
|
||||
) {
|
||||
return !!(
|
||||
context.selection.file.entry &&
|
||||
context.selection.file.entry.properties &&
|
||||
context.selection.file.entry.properties['qshare:sharedId']
|
||||
);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if user can delete selected nodes.
|
||||
* JSON ref: `app.selection.canDelete`
|
||||
*/
|
||||
export function canDeleteSelection(context: RuleContext): boolean {
|
||||
if (
|
||||
navigation.isNotTrashcan(context) &&
|
||||
navigation.isNotLibraries(context) &&
|
||||
navigation.isNotSearchResults(context) &&
|
||||
!context.selection.isEmpty
|
||||
) {
|
||||
if (hasLockedFiles(context)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// temp workaround for Search api
|
||||
if (navigation.isFavorites(context)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (navigation.isPreview(context)) {
|
||||
return context.permissions.check(context.selection.nodes, ['delete']);
|
||||
}
|
||||
|
||||
// workaround for Shared Files
|
||||
if (navigation.isSharedFiles(context)) {
|
||||
return context.permissions.check(context.selection.nodes, ['delete'], {
|
||||
target: 'allowableOperationsOnTarget'
|
||||
});
|
||||
}
|
||||
|
||||
return context.permissions.check(context.selection.nodes, ['delete']);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if user can un-share selected nodes.
|
||||
* JSON ref: `app.selection.canUnshare`
|
||||
*/
|
||||
export function canUnshareNodes(context: RuleContext): boolean {
|
||||
if (!context.selection.isEmpty) {
|
||||
return context.permissions.check(context.selection.nodes, ['delete'], {
|
||||
target: 'allowableOperationsOnTarget'
|
||||
});
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if user selected anything.
|
||||
* JSON ref: `app.selection.notEmpty`
|
||||
*/
|
||||
export function hasSelection(context: RuleContext): boolean {
|
||||
return !context.selection.isEmpty;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if user can create a new folder with current path.
|
||||
* JSON ref: `app.navigation.folder.canCreate`
|
||||
*/
|
||||
export function canCreateFolder(context: RuleContext): boolean {
|
||||
const { currentFolder } = context.navigation;
|
||||
if (currentFolder) {
|
||||
return context.permissions.check(currentFolder, ['create']);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if user can upload content to current folder.
|
||||
* JSON ref: `app.navigation.folder.canUpload`
|
||||
*/
|
||||
export function canUpload(context: RuleContext): boolean {
|
||||
const { currentFolder } = context.navigation;
|
||||
if (currentFolder) {
|
||||
return context.permissions.check(currentFolder, ['create']);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if user can download selected nodes (either files or folders).
|
||||
* JSON ref: `app.selection.canDownload`
|
||||
*/
|
||||
export function canDownloadSelection(context: RuleContext): boolean {
|
||||
if (!context.selection.isEmpty && navigation.isNotTrashcan(context)) {
|
||||
return context.selection.nodes.every((node: any) => {
|
||||
return (
|
||||
node.entry &&
|
||||
(node.entry.isFile || node.entry.isFolder || !!node.entry.nodeId)
|
||||
);
|
||||
});
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if user has selected a folder.
|
||||
* JSON ref: `app.selection.folder`
|
||||
*/
|
||||
export function hasFolderSelected(context: RuleContext): boolean {
|
||||
const folder = context.selection.folder;
|
||||
return folder ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if user has selected a library (site).
|
||||
* JSON ref: `app.selection.library`
|
||||
*/
|
||||
export function hasLibrarySelected(context: RuleContext): boolean {
|
||||
const library = context.selection.library;
|
||||
return library ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if user has selected a **private** library (site)
|
||||
* JSON ref: `app.selection.isPrivateLibrary`
|
||||
*/
|
||||
export function isPrivateLibrary(context: RuleContext): boolean {
|
||||
const library = context.selection.library;
|
||||
return library
|
||||
? !!(
|
||||
library.entry &&
|
||||
library.entry.visibility &&
|
||||
library.entry.visibility === 'PRIVATE'
|
||||
)
|
||||
: false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the selected library has a **role** property defined.
|
||||
* JSON ref: `app.selection.hasLibraryRole`
|
||||
*/
|
||||
export function hasLibraryRole(context: RuleContext): boolean {
|
||||
const library = context.selection.library;
|
||||
return library ? !!(library.entry && library.entry.role) : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the selected library has no **role** property defined.
|
||||
* JSON ref: `app.selection.hasNoLibraryRole`
|
||||
*/
|
||||
export function hasNoLibraryRole(context: RuleContext): boolean {
|
||||
return !hasLibraryRole(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if user has selected a file.
|
||||
* JSON ref: `app.selection.file`
|
||||
*/
|
||||
export function hasFileSelected(context: RuleContext): boolean {
|
||||
if (context && context.selection && context.selection.file) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if user can update the first selected node.
|
||||
* JSON ref: `app.selection.first.canUpdate`
|
||||
*/
|
||||
export function canUpdateSelectedNode(context: RuleContext): boolean {
|
||||
if (context.selection && !context.selection.isEmpty) {
|
||||
const node = context.selection.first;
|
||||
|
||||
if (node.entry.isFile && hasLockedFiles(context)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return context.permissions.check(node, ['update']);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if user can update the first selected folder.
|
||||
* JSON ref: `app.selection.folder.canUpdate`
|
||||
*/
|
||||
export function canUpdateSelectedFolder(context: RuleContext): boolean {
|
||||
const { folder } = context.selection;
|
||||
if (folder) {
|
||||
return (
|
||||
// workaround for Favorites Api
|
||||
navigation.isFavorites(context) ||
|
||||
context.permissions.check(folder.entry, ['update'])
|
||||
);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if user has selected a **locked** file node.
|
||||
* JSON ref: `app.selection.file.isLocked`
|
||||
*/
|
||||
export function hasLockedFiles(context: RuleContext): boolean {
|
||||
if (context && context.selection && context.selection.nodes) {
|
||||
return context.selection.nodes.some(node => {
|
||||
if (!node.entry.isFile) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (
|
||||
node.entry.isLocked ||
|
||||
(node.entry.properties &&
|
||||
node.entry.properties['cm:lockType'] === 'READ_ONLY_LOCK')
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the selected file has **write** or **read-only** locks specified.
|
||||
* JSON ref: `app.selection.file.isLocked`
|
||||
*/
|
||||
export function isWriteLocked(context: RuleContext): boolean {
|
||||
return !!(
|
||||
context &&
|
||||
context.selection &&
|
||||
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'] ===
|
||||
'READ_ONLY_LOCK')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the selected file has **write** or **read-only** locks specified,
|
||||
* and that current user is the owner of the lock.
|
||||
* JSON ref: `app.selection.file.isLockOwner`
|
||||
*/
|
||||
export function isUserWriteLockOwner(context: RuleContext): boolean {
|
||||
return (
|
||||
isWriteLocked(context) &&
|
||||
(context.selection.file.entry.properties['cm:lockOwner'] &&
|
||||
context.selection.file.entry.properties['cm:lockOwner'].id ===
|
||||
context.profile.id)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if user can lock selected file.
|
||||
* JSON ref: `app.selection.file.canLock`
|
||||
*/
|
||||
export function canLockFile(context: RuleContext): boolean {
|
||||
return !isWriteLocked(context) && canUpdateSelectedNode(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if user can unlock selected file.
|
||||
* JSON ref: `app.selection.file.canLock`
|
||||
*/
|
||||
export function canUnlockFile(context: RuleContext): boolean {
|
||||
const { file } = context.selection;
|
||||
return (
|
||||
isWriteLocked(context) &&
|
||||
(context.permissions.check(file.entry, ['delete']) ||
|
||||
isUserWriteLockOwner(context))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if user can upload a new version of the file.
|
||||
* JSON ref: `app.selection.file.canUploadVersion`
|
||||
*/
|
||||
export function canUploadVersion(context: RuleContext): boolean {
|
||||
if (navigation.isFavorites(context) || navigation.isSharedFiles(context)) {
|
||||
return hasFileSelected(context);
|
||||
}
|
||||
|
||||
return [
|
||||
hasFileSelected(context),
|
||||
navigation.isNotTrashcan(context),
|
||||
isWriteLocked(context)
|
||||
? isUserWriteLockOwner(context)
|
||||
: canUpdateSelectedNode(context)
|
||||
].every(Boolean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if user has trashcan item selected.
|
||||
* JSON ref: `isTrashcanItemSelected`
|
||||
* @param context Rule execution context
|
||||
*/
|
||||
export function isTrashcanItemSelected(context: RuleContext): boolean {
|
||||
return [navigation.isTrashcan(context), hasSelection(context)].every(Boolean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if user can view the file.
|
||||
* JSON ref: `canViewFile`
|
||||
* @param context Rule execution context
|
||||
*/
|
||||
export function canViewFile(context: RuleContext): boolean {
|
||||
return [hasFileSelected(context), navigation.isNotTrashcan(context)].every(
|
||||
Boolean
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if user can **Leave** selected library.
|
||||
* JSON ref: `canLeaveLibrary`
|
||||
* @param context Rule execution context
|
||||
*/
|
||||
export function canLeaveLibrary(context: RuleContext): boolean {
|
||||
return [hasLibrarySelected(context), hasLibraryRole(context)].every(Boolean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if user can toggle shared link mode.
|
||||
* JSON ref: `canToggleSharedLink`
|
||||
* @param context Rule execution context
|
||||
*/
|
||||
export function canToggleSharedLink(context: RuleContext): boolean {
|
||||
return [
|
||||
hasFileSelected(context),
|
||||
[canShareFile(context), isShared(context)].some(Boolean)
|
||||
].every(Boolean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if user can show **Info Drawer** for the selected node.
|
||||
* JSON ref: `canShowInfoDrawer`
|
||||
* @param context Rule execution context
|
||||
*/
|
||||
export function canShowInfoDrawer(context: RuleContext): boolean {
|
||||
return [
|
||||
hasSelection(context),
|
||||
navigation.isNotLibraries(context),
|
||||
navigation.isNotTrashcan(context)
|
||||
].every(Boolean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if user can manage file versions for the selected node.
|
||||
* JSON ref: `canManageFileVersions`
|
||||
* @param context Rule execution context
|
||||
*/
|
||||
export function canManageFileVersions(context: RuleContext): boolean {
|
||||
return [
|
||||
hasFileSelected(context),
|
||||
navigation.isNotTrashcan(context),
|
||||
!hasLockedFiles(context)
|
||||
].every(Boolean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if user can manage permissions for the selected node.
|
||||
* JSON ref: `canManagePermissions`
|
||||
* @param context Rule execution context
|
||||
*/
|
||||
export function canManagePermissions(context: RuleContext): boolean {
|
||||
return [
|
||||
canUpdateSelectedNode(context),
|
||||
navigation.isNotTrashcan(context)
|
||||
].every(Boolean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if user can toggle **Edit Offline** mode for selected node.
|
||||
* JSON ref: `canToggleEditOffline`
|
||||
* @param context Rule execution context
|
||||
*/
|
||||
export function canToggleEditOffline(context: RuleContext): boolean {
|
||||
return [
|
||||
hasFileSelected(context),
|
||||
navigation.isNotTrashcan(context),
|
||||
navigation.isNotFavorites(context) ||
|
||||
navigation.isFavoritesPreview(context),
|
||||
navigation.isNotSharedFiles(context) || navigation.isSharedPreview(context),
|
||||
canLockFile(context) || canUnlockFile(context)
|
||||
].every(Boolean);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Uses workarounds for for recent files and search api issues.
|
||||
* Checks if user can toggle **Favorite** state for a node.
|
||||
* @param context Rule execution context
|
||||
*/
|
||||
export function canToggleFavorite(context: RuleContext): boolean {
|
||||
return [
|
||||
[canAddFavorite(context), canRemoveFavorite(context)].some(Boolean),
|
||||
[
|
||||
navigation.isRecentFiles(context),
|
||||
navigation.isSharedFiles(context),
|
||||
navigation.isSearchResults(context),
|
||||
navigation.isFavorites(context)
|
||||
].some(Boolean)
|
||||
].every(Boolean);
|
||||
}
|
||||
@@ -1,338 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2019 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 * as app from './navigation.evaluators';
|
||||
|
||||
describe('navigation.evaluators', () => {
|
||||
describe('isPreview', () => {
|
||||
it('should return [true] if url contains `/preview/`', () => {
|
||||
const context: any = {
|
||||
navigation: {
|
||||
url: 'path/preview/id'
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.isPreview(context)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('isFavorites', () => {
|
||||
it('should return [true] if url contains `/favorites`', () => {
|
||||
const context: any = {
|
||||
navigation: {
|
||||
url: '/favorites/path'
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.isFavorites(context)).toBe(true);
|
||||
});
|
||||
|
||||
it('should return [false] if `/favorites` url contains `/preview/`', () => {
|
||||
const context: any = {
|
||||
navigation: {
|
||||
url: '/favorites/preview/'
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.isFavorites(context)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('isNotFavorites', () => {
|
||||
it('should return [true] if url is not `/favorites`', () => {
|
||||
const context: any = {
|
||||
navigation: {
|
||||
url: '/some/path'
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.isNotFavorites(context)).toBe(true);
|
||||
});
|
||||
|
||||
it('should return [false] if url starts with `/favorites`', () => {
|
||||
const context: any = {
|
||||
navigation: {
|
||||
url: '/favorites/path'
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.isNotFavorites(context)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('isSharedFiles', () => {
|
||||
it('should return [true] if path starts with `/shared`', () => {
|
||||
const context: any = {
|
||||
navigation: {
|
||||
url: '/shared/path'
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.isSharedFiles(context)).toBe(true);
|
||||
});
|
||||
|
||||
it('should return [false] if `/shared` url contains `/preview/`', () => {
|
||||
const context: any = {
|
||||
navigation: {
|
||||
url: '/shared/preview/'
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.isSharedFiles(context)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('isNotSharedFiles', () => {
|
||||
it('should return [true] if path does not contain `/shared`', () => {
|
||||
const context: any = {
|
||||
navigation: {
|
||||
url: '/some/path/'
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.isNotSharedFiles(context)).toBe(true);
|
||||
});
|
||||
|
||||
it('should return [false] if path contains `/shared`', () => {
|
||||
const context: any = {
|
||||
navigation: {
|
||||
url: '/shared/path/'
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.isNotSharedFiles(context)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('isTrashcan', () => {
|
||||
it('should return [true] if url starts with `/trashcan`', () => {
|
||||
const context: any = {
|
||||
navigation: {
|
||||
url: '/trashcan'
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.isTrashcan(context)).toBe(true);
|
||||
});
|
||||
|
||||
it('should return [false] if url does not start with `/trashcan`', () => {
|
||||
const context: any = {
|
||||
navigation: {
|
||||
url: '/path/trashcan'
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.isTrashcan(context)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('isNotTrashcan', () => {
|
||||
it('should return [true] if url does not start with `/trashcan`', () => {
|
||||
const context: any = {
|
||||
navigation: {
|
||||
url: '/path/trashcan'
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.isNotTrashcan(context)).toBe(true);
|
||||
});
|
||||
|
||||
it('should return [false] if url does start with `/trashcan`', () => {
|
||||
const context: any = {
|
||||
navigation: {
|
||||
url: '/trashcan'
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.isNotTrashcan(context)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('isPersonalFiles', () => {
|
||||
it('should return [true] if url starts with `/personal-files`', () => {
|
||||
const context: any = {
|
||||
navigation: {
|
||||
url: '/personal-files'
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.isPersonalFiles(context)).toBe(true);
|
||||
});
|
||||
|
||||
it('should return [false] if url does not start with `/personal-files`', () => {
|
||||
const context: any = {
|
||||
navigation: {
|
||||
url: '/path/personal-files'
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.isPersonalFiles(context)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('isLibraries', () => {
|
||||
it('should return [true] if url ends with `/libraries`', () => {
|
||||
const context: any = {
|
||||
navigation: {
|
||||
url: '/path/libraries'
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.isLibraries(context)).toBe(true);
|
||||
});
|
||||
|
||||
it('should return [true] if url starts with `/search-libraries`', () => {
|
||||
const context: any = {
|
||||
navigation: {
|
||||
url: '/search-libraries/path'
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.isLibraries(context)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('isNotLibraries', () => {
|
||||
it('should return [true] if url does not end with `/libraries`', () => {
|
||||
const context: any = {
|
||||
navigation: {
|
||||
url: '/libraries/path'
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.isNotLibraries(context)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('isRecentFiles', () => {
|
||||
it('should return [true] if url starts with `/recent-files`', () => {
|
||||
const context: any = {
|
||||
navigation: {
|
||||
url: '/recent-files'
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.isRecentFiles(context)).toBe(true);
|
||||
});
|
||||
|
||||
it('should return [false] if url does not start with `/recent-files`', () => {
|
||||
const context: any = {
|
||||
navigation: {
|
||||
url: '/path/recent-files'
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.isRecentFiles(context)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('isSearchResults', () => {
|
||||
it('should return [true] if url starts with `/search`', () => {
|
||||
const context: any = {
|
||||
navigation: {
|
||||
url: '/search'
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.isSearchResults(context)).toBe(true);
|
||||
});
|
||||
|
||||
it('should return [false] if url does not start with `/search`', () => {
|
||||
const context: any = {
|
||||
navigation: {
|
||||
url: '/path/search'
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.isSearchResults(context)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('isSharedPreview', () => {
|
||||
it('should return [true] if url starts with `/shared/preview/`', () => {
|
||||
const context: any = {
|
||||
navigation: {
|
||||
url: '/shared/preview/path'
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.isSharedPreview(context)).toBe(true);
|
||||
});
|
||||
|
||||
it('should return [false] if url does not start with `/shared/preview/`', () => {
|
||||
const context: any = {
|
||||
navigation: {
|
||||
url: '/path/shared/preview/'
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.isSharedPreview(context)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('isFavoritesPreview', () => {
|
||||
it('should return [true] if url starts with `/favorites/preview/`', () => {
|
||||
const context: any = {
|
||||
navigation: {
|
||||
url: '/favorites/preview/path'
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.isFavoritesPreview(context)).toBe(true);
|
||||
});
|
||||
|
||||
it('should return [false] if url does not start with `/favorites/preview/`', () => {
|
||||
const context: any = {
|
||||
navigation: {
|
||||
url: '/path/favorites/preview/'
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.isFavoritesPreview(context)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('isSharedFileViewer', () => {
|
||||
it('should return [true] if url starts with `/preview/s/`', () => {
|
||||
const context: any = {
|
||||
navigation: {
|
||||
url: '/preview/s/path'
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.isSharedFileViewer(context)).toBe(true);
|
||||
});
|
||||
|
||||
it('should return [false] if url does not start with `/preview/s/`', () => {
|
||||
const context: any = {
|
||||
navigation: {
|
||||
url: '/path/preview/s/'
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.isSharedFileViewer(context)).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,187 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2019 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 { RuleContext } from '@alfresco/adf-extensions';
|
||||
|
||||
/**
|
||||
* Checks if a Preview route is activated.
|
||||
* JSON ref: `app.navigation.isPreview`
|
||||
*/
|
||||
export function isPreview(context: RuleContext): boolean {
|
||||
const { url } = context.navigation;
|
||||
return url && (url.includes('/preview/') || url.includes('/view/'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a **Favorites** route is activated.
|
||||
* JSON ref: `app.navigation.isFavorites`
|
||||
*/
|
||||
export function isFavorites(context: RuleContext): boolean {
|
||||
const { url } = context.navigation;
|
||||
return url && url.startsWith('/favorites') && !isPreview(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the activated route is not **Favorites**.
|
||||
* JSON ref: `app.navigation.isNotFavorites`
|
||||
*/
|
||||
export function isNotFavorites(context: RuleContext): boolean {
|
||||
return !isFavorites(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a **Shared Files** route is activated.
|
||||
* JSON ref: `app.navigation.isSharedFiles`
|
||||
*/
|
||||
export function isSharedFiles(context: RuleContext): boolean {
|
||||
const { url } = context.navigation;
|
||||
return url && url.startsWith('/shared') && !isPreview(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the activated route is not **Shared Files**.
|
||||
* JSON ref: `app.navigation.isNotSharedFiles`
|
||||
*/
|
||||
export function isNotSharedFiles(context: RuleContext): boolean {
|
||||
return !isSharedFiles(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a **Trashcan** route is activated.
|
||||
* JSON ref: `app.navigation.isTrashcan`
|
||||
*/
|
||||
export function isTrashcan(context: RuleContext): boolean {
|
||||
const { url } = context.navigation;
|
||||
return url && url.startsWith('/trashcan');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the activated route is not **Trashcan**.
|
||||
* JSON ref: `app.navigation.isNotTrashcan`
|
||||
*/
|
||||
export function isNotTrashcan(context: RuleContext): boolean {
|
||||
return !isTrashcan(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a **Personal Files** route is activated.
|
||||
* JSON ref: `app.navigation.isPersonalFiles`
|
||||
*/
|
||||
export function isPersonalFiles(context: RuleContext): boolean {
|
||||
const { url } = context.navigation;
|
||||
return url && url.startsWith('/personal-files');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a **Library Files** route is activated.
|
||||
* JSON ref: `app.navigation.isLibraryFiles`
|
||||
*/
|
||||
export function isLibraryFiles(context: RuleContext): boolean {
|
||||
const { url } = context.navigation;
|
||||
return url && url.startsWith('/libraries');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a **Library Files** or **Library Search Result** route is activated.
|
||||
* JSON ref: `app.navigation.isLibraryFiles`
|
||||
*/
|
||||
export function isLibraries(context: RuleContext): boolean {
|
||||
const { url } = context.navigation;
|
||||
return (
|
||||
url && (url.endsWith('/libraries') || url.startsWith('/search-libraries'))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the activated route is neither **Libraries** nor **Library Search Results**.
|
||||
* JSON ref: `app.navigation.isNotLibraries`
|
||||
*/
|
||||
export function isNotLibraries(context: RuleContext): boolean {
|
||||
return !isLibraries(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a **Recent Files** route is activated.
|
||||
* JSON ref: `app.navigation.isRecentFiles`
|
||||
*/
|
||||
export function isRecentFiles(context: RuleContext): boolean {
|
||||
const { url } = context.navigation;
|
||||
return url && url.startsWith('/recent-files');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the activated route is not **Recent Files**.
|
||||
* JSON ref: `app.navigation.isNotRecentFiles`
|
||||
*/
|
||||
export function isNotRecentFiles(context: RuleContext): boolean {
|
||||
return !isRecentFiles(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a **Search Results** route is activated.
|
||||
* JSON ref: `app.navigation.isSearchResults`
|
||||
*/
|
||||
export function isSearchResults(
|
||||
context: RuleContext /*,
|
||||
...args: RuleParameter[]*/
|
||||
): boolean {
|
||||
const { url } = context.navigation;
|
||||
return url && url.startsWith('/search');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the activated route is not **Search Results**.
|
||||
* JSON ref: `app.navigation.isNotSearchResults`
|
||||
*/
|
||||
export function isNotSearchResults(context: RuleContext): boolean {
|
||||
return !isSearchResults(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a **Shared Preview** route is activated.
|
||||
* JSON ref: `app.navigation.isSharedPreview`
|
||||
*/
|
||||
export function isSharedPreview(context: RuleContext): boolean {
|
||||
const { url } = context.navigation;
|
||||
return url && url.startsWith('/shared/preview/');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a **Favorites Preview** route is activated.
|
||||
* JSON ref: `app.navigation.isFavoritesPreview`
|
||||
*/
|
||||
export function isFavoritesPreview(context: RuleContext): boolean {
|
||||
const { url } = context.navigation;
|
||||
return url && url.startsWith('/favorites/preview/');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a **Shared File Preview** route is activated.
|
||||
* JSON ref: `app.navigation.isFavoritesPreview`
|
||||
*/
|
||||
export function isSharedFileViewer(context: RuleContext): boolean {
|
||||
const { url } = context.navigation;
|
||||
return url && url.startsWith('/preview/s/');
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2019 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 { RuleContext } from '@alfresco/adf-extensions';
|
||||
|
||||
/**
|
||||
* Checks if the quick share repository option is enabled or not.
|
||||
* JSON ref: `repository.isQuickShareEnabled`
|
||||
*/
|
||||
export function hasQuickShareEnabled(context: RuleContext): boolean {
|
||||
return context.repository.status.isQuickShareEnabled;
|
||||
}
|
||||
@@ -27,7 +27,7 @@ import { TestBed } from '@angular/core/testing';
|
||||
import { AppTestingModule } from '../testing/app-testing.module';
|
||||
import { AppExtensionService } from './extension.service';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppStore } from '../store/states';
|
||||
import { AppStore } from '@alfresco/aca-shared/store';
|
||||
import {
|
||||
ContentActionType,
|
||||
mergeArrays,
|
||||
|
||||
@@ -26,11 +26,10 @@
|
||||
import { Injectable, Type } from '@angular/core';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { Route } from '@angular/router';
|
||||
import { MatIconRegistry } from '@angular/material';
|
||||
import { MatIconRegistry } from '@angular/material/icon';
|
||||
import { DomSanitizer } from '@angular/platform-browser';
|
||||
import { AppStore } from '../store/states';
|
||||
import { ruleContext } from '../store/selectors/app.selectors';
|
||||
import { NodePermissionService } from '../services/node-permission.service';
|
||||
import { AppStore, getRuleContext } from '@alfresco/aca-shared/store';
|
||||
import { NodePermissionService } from '@alfresco/aca-shared';
|
||||
import {
|
||||
SelectionState,
|
||||
NavigationState,
|
||||
@@ -117,7 +116,7 @@ export class AppExtensionService implements RuleContext {
|
||||
) {
|
||||
this.references$ = this._references.asObservable();
|
||||
|
||||
this.store.select(ruleContext).subscribe(result => {
|
||||
this.store.select(getRuleContext).subscribe(result => {
|
||||
this.selection = result.selection;
|
||||
this.navigation = result.navigation;
|
||||
this.profile = result.profile;
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2019 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 { Injectable } from '@angular/core';
|
||||
import { CanActivate } from '@angular/router';
|
||||
import { Observable } from 'rxjs';
|
||||
import { ActivatedRouteSnapshot } from '@angular/router';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppStore } from '../store/states/app.state';
|
||||
import { isQuickShareEnabled } from '../store/selectors/app.selectors';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class AppSharedRuleGuard implements CanActivate {
|
||||
isQuickShareEnabled$: Observable<boolean>;
|
||||
|
||||
constructor(store: Store<AppStore>) {
|
||||
this.isQuickShareEnabled$ = store.select(isQuickShareEnabled);
|
||||
}
|
||||
|
||||
canActivate(
|
||||
_: ActivatedRouteSnapshot
|
||||
): Observable<boolean> | Promise<boolean> | boolean {
|
||||
return this.isQuickShareEnabled$;
|
||||
}
|
||||
|
||||
canActivateChild(
|
||||
route: ActivatedRouteSnapshot
|
||||
): Observable<boolean> | Promise<boolean> | boolean {
|
||||
return this.canActivate(route);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user