diff --git a/.github/plint.yml b/.github/plint.yml
index 63c57da92..84ed3336b 100644
--- a/.github/plint.yml
+++ b/.github/plint.yml
@@ -5,3 +5,6 @@ modules:
spellcheck:
words:
- plint
+ - ngrx
+ - qshare
+ - snackbar
diff --git a/angular.json b/angular.json
index a2dafd68d..6cf5af0d3 100644
--- a/angular.json
+++ b/angular.json
@@ -273,6 +273,41 @@
}
}
}
+ },
+ "aca-shared": {
+ "root": "projects/aca-shared",
+ "sourceRoot": "projects/aca-shared/src",
+ "projectType": "library",
+ "prefix": "lib",
+ "architect": {
+ "build": {
+ "builder": "@angular-devkit/build-ng-packagr:build",
+ "options": {
+ "tsConfig": "projects/aca-shared/tsconfig.lib.json",
+ "project": "projects/aca-shared/ng-package.json"
+ }
+ },
+ "test": {
+ "builder": "@angular-devkit/build-angular:karma",
+ "options": {
+ "main": "projects/aca-shared/test.ts",
+ "tsConfig": "projects/aca-shared/tsconfig.spec.json",
+ "karmaConfig": "projects/aca-shared/karma.conf.js"
+ }
+ },
+ "lint": {
+ "builder": "@angular-devkit/build-angular:tslint",
+ "options": {
+ "tsConfig": [
+ "projects/aca-shared/tsconfig.lib.json",
+ "projects/aca-shared/tsconfig.spec.json"
+ ],
+ "exclude": [
+ "**/node_modules/**"
+ ]
+ }
+ }
+ }
}
},
"defaultProject": "app",
diff --git a/docs/extending/tutorials.md b/docs/extending/tutorials.md
index 49c0d6bbc..74fa1270b 100644
--- a/docs/extending/tutorials.md
+++ b/docs/extending/tutorials.md
@@ -161,7 +161,7 @@ Update `my-extension-dialog.component.ts`:
```ts
import { Component } from '@angular/core';
-import { MatDialogRef } from '@angular/material';
+import { MatDialogRef } from '@angular/material/dialog';
@Component({
selector: 'aca-my-extension-dialog',
@@ -229,7 +229,7 @@ See also:
Update to raise a dialog
```ts
-import { MatDialog } from '@angular/material';
+import { MatDialog } from '@angular/material/dialog';
import { MyExtensionDialogComponent } from '../../dialogs/my-extension-dialog/my-extension-dialog.component';
@Injectable()
diff --git a/docs/tutorials/dialog-actions.md b/docs/tutorials/dialog-actions.md
index 6d8228587..f762733b6 100644
--- a/docs/tutorials/dialog-actions.md
+++ b/docs/tutorials/dialog-actions.md
@@ -36,7 +36,7 @@ Update `my-extension-dialog.component.ts`:
```ts
import { Component } from '@angular/core';
-import { MatDialogRef } from '@angular/material';
+import { MatDialogRef } from '@angular/material/dialog';
@Component({
selector: 'aca-my-extension-dialog',
@@ -104,7 +104,7 @@ See also:
Update to raise a dialog
```ts
-import { MatDialog } from '@angular/material';
+import { MatDialog } from '@angular/material/dialog';
import { MyExtensionDialogComponent } from '../../dialogs/my-extension-dialog/my-extension-dialog.component';
@Injectable()
diff --git a/package-lock.json b/package-lock.json
index 4a8738dd2..88eb95028 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -4959,7 +4959,8 @@
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"aproba": {
"version": "1.2.0",
@@ -4980,12 +4981,14 @@
"balanced-match": {
"version": "1.0.0",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@@ -5000,17 +5003,20 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"core-util-is": {
"version": "1.0.2",
@@ -5127,7 +5133,8 @@
"inherits": {
"version": "2.0.3",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"ini": {
"version": "1.3.5",
@@ -5139,6 +5146,7 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@@ -5153,6 +5161,7 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
@@ -5160,12 +5169,14 @@
"minimist": {
"version": "0.0.8",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"minipass": {
"version": "2.3.5",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
@@ -5184,6 +5195,7 @@
"version": "0.5.1",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"minimist": "0.0.8"
}
@@ -5264,7 +5276,8 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"object-assign": {
"version": "4.1.1",
@@ -5276,6 +5289,7 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"wrappy": "1"
}
@@ -5361,7 +5375,8 @@
"safe-buffer": {
"version": "5.1.2",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"safer-buffer": {
"version": "2.1.2",
@@ -5397,6 +5412,7 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@@ -5416,6 +5432,7 @@
"version": "3.0.1",
"bundled": true,
"dev": true,
+ "optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@@ -5459,12 +5476,14 @@
"wrappy": {
"version": "1.0.2",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
},
"yallist": {
"version": "3.0.3",
"bundled": true,
- "dev": true
+ "dev": true,
+ "optional": true
}
}
},
diff --git a/package.json b/package.json
index cac2ba938..d1af1f332 100644
--- a/package.json
+++ b/package.json
@@ -4,15 +4,16 @@
"license": "LGPL-3.0",
"scripts": {
"ng": "ng",
- "start": "npm run build.extensions && ng serve --open",
+ "start": "npm run build.shared && npm run build.extensions && ng serve --open",
"start:prod": "node --max-old-space-size=8192 node_modules/@angular/cli/bin/ng serve --prod --open",
"build:aos-extension": "npx rimraf dist/@alfresco/adf-office-services-ext && ng build adf-office-services-ext && cpr projects/adf-office-services-ext/ngi.json dist/@alfresco/adf-office-services-ext/ngi.json && cpr projects/adf-office-services-ext/assets dist/@alfresco/adf-office-services-ext/assets",
+ "build.shared": "ng build aca-shared",
"build.extensions": "npm run build:aos-extension",
"build.app": "node --max-old-space-size=8192 node_modules/@angular/cli/bin/ng build app",
- "build": "npm run build.extensions && npm run build.app -- --prod",
- "build.e2e": "npm run build.extensions && npm run build.app -- --prod --configuration=e2e",
+ "build": "npm run build.shared && npm run build.extensions && npm run build.app -- --prod",
+ "build.e2e": "npm run build.shared && npm run build.extensions && npm run build.app -- --prod --configuration=e2e",
"test": "ng test app --code-coverage",
- "test:ci": "npm run build.extensions && ng test adf-office-services-ext --watch=false && ng test app --code-coverage --watch=false",
+ "test:ci": "npm run build.shared && npm run build.extensions && ng test adf-office-services-ext --watch=false && ng test app --code-coverage --watch=false",
"lint": "ng lint && npm run spellcheck && npm run format:check && npm run e2e.typecheck",
"wd:update": "webdriver-manager update --gecko=false",
"e2e.typecheck": "tsc -p ./e2e/tsconfig.e2e.typecheck.json",
@@ -26,7 +27,7 @@
"inspect.bundle": "ng build app --prod --stats-json && npx webpack-bundle-analyzer dist/app/stats.json",
"format:check": "prettier --check \"src/{app,environments}/**/*.{ts,js,css,scss,html}\"",
"format:fix": "prettier --write \"src/{app,environments}/**/*.{ts,js,css,scss,html}\"",
- "build.tomcat": "npm run build.extensions && npm run build.app -- --prod --base-href ./ && jar -cvf docker/tomcat/artifacts/content-app.war -C dist/app/ .",
+ "build.tomcat": "npm run build.shared && npm run build.extensions && npm run build.app -- --prod --base-href ./ && jar -cvf docker/tomcat/artifacts/content-app.war -C dist/app/ .",
"build.tomcat.e2e": "./build-tomcat-e2e.sh",
"e2e.tomcat": "npm run wd:update && protractor --baseUrl=http://localhost:4000/content-app/ $SUITE",
"docker.tomcat.start": "cd docker/tomcat && docker-compose up -d --build && npm run wait:app",
diff --git a/projects/aca-shared/README.md b/projects/aca-shared/README.md
new file mode 100644
index 000000000..336cad5cd
--- /dev/null
+++ b/projects/aca-shared/README.md
@@ -0,0 +1,24 @@
+# AcaShared
+
+This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.2.0.
+
+## Code scaffolding
+
+Run `ng generate component component-name --project aca-shared` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project aca-shared`.
+> Note: Don't forget to add `--project aca-shared` or else it will be added to the default project in your `angular.json` file.
+
+## Build
+
+Run `ng build aca-shared` to build the project. The build artifacts will be stored in the `dist/` directory.
+
+## Publishing
+
+After building your library with `ng build aca-shared`, go to the dist folder `cd dist/aca-shared` and run `npm publish`.
+
+## Running unit tests
+
+Run `ng test aca-shared` to execute the unit tests via [Karma](https://karma-runner.github.io).
+
+## Further help
+
+To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
diff --git a/projects/aca-shared/karma.conf.js b/projects/aca-shared/karma.conf.js
new file mode 100644
index 000000000..391854077
--- /dev/null
+++ b/projects/aca-shared/karma.conf.js
@@ -0,0 +1,32 @@
+// Karma configuration file, see link for more information
+// https://karma-runner.github.io/1.0/config/configuration-file.html
+
+module.exports = function(config) {
+ config.set({
+ basePath: '',
+ frameworks: ['jasmine', '@angular-devkit/build-angular'],
+ plugins: [
+ require('karma-jasmine'),
+ require('karma-chrome-launcher'),
+ require('karma-jasmine-html-reporter'),
+ require('karma-coverage-istanbul-reporter'),
+ require('@angular-devkit/build-angular/plugins/karma')
+ ],
+ client: {
+ clearContext: false // leave Jasmine Spec Runner output visible in browser
+ },
+ coverageIstanbulReporter: {
+ dir: require('path').join(__dirname, '../../coverage/aca-shared'),
+ reports: ['html', 'lcovonly'],
+ fixWebpackSourcePaths: true
+ },
+ reporters: ['progress', 'kjhtml'],
+ port: 9876,
+ colors: true,
+ logLevel: config.LOG_INFO,
+ autoWatch: true,
+ browsers: ['Chrome'],
+ singleRun: false,
+ restartOnFileChange: true
+ });
+};
diff --git a/projects/aca-shared/ng-package.json b/projects/aca-shared/ng-package.json
new file mode 100644
index 000000000..240cc4a74
--- /dev/null
+++ b/projects/aca-shared/ng-package.json
@@ -0,0 +1,17 @@
+{
+ "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
+ "dest": "../../dist/@alfresco/aca-shared",
+ "lib": {
+ "entryFile": "src/public-api.ts",
+ "umdModuleIds": {
+ "rxjs": "rxjs",
+ "@alfresco/js-api": "@alfresco/js-api",
+ "@alfresco/adf-core": "@alfresco/adf-core",
+ "@alfresco/adf-extensions": "@alfresco/adf-extensions",
+ "@ngrx/store": "@ngrx/store",
+ "@ngrx/effects": "@ngrx/effects",
+ "@angular/material": "@angular/material",
+ "@ngx-translate/core": "@ngx-translate/core"
+ }
+ }
+}
diff --git a/projects/aca-shared/package.json b/projects/aca-shared/package.json
new file mode 100644
index 000000000..942ab6857
--- /dev/null
+++ b/projects/aca-shared/package.json
@@ -0,0 +1,15 @@
+{
+ "name": "@alfresco/aca-shared",
+ "version": "1.8.0",
+ "peerDependencies": {
+ "@angular/common": "^7.2.0",
+ "@angular/core": "^7.2.0",
+ "@angular/material": "^7.3.7",
+ "@ngrx/effects": "^7.4.0",
+ "@ngrx/store": "^7.4.0",
+ "@alfresco/adf-extensions": "^3.1.0",
+ "@alfresco/js-api": "^3.1.0",
+ "rxjs": "^6.4.0",
+ "@ngx-translate/core": "^11.0.1"
+ }
+}
diff --git a/projects/aca-shared/rules/package.json b/projects/aca-shared/rules/package.json
new file mode 100644
index 000000000..4bbd7d0f7
--- /dev/null
+++ b/projects/aca-shared/rules/package.json
@@ -0,0 +1,3 @@
+{
+ "ngPackage": {}
+}
diff --git a/src/app/extensions/evaluators/app.evaluators.spec.ts b/projects/aca-shared/rules/src/app.rules.spec.ts
similarity index 99%
rename from src/app/extensions/evaluators/app.evaluators.spec.ts
rename to projects/aca-shared/rules/src/app.rules.spec.ts
index 781ed2ef5..1f37fd342 100644
--- a/src/app/extensions/evaluators/app.evaluators.spec.ts
+++ b/projects/aca-shared/rules/src/app.rules.spec.ts
@@ -23,7 +23,7 @@
* along with Alfresco. If not, see .
*/
-import * as app from './app.evaluators';
+import * as app from './app.rules';
describe('app.evaluators', () => {
describe('isWriteLocked', () => {
diff --git a/src/app/extensions/evaluators/app.evaluators.ts b/projects/aca-shared/rules/src/app.rules.ts
similarity index 99%
rename from src/app/extensions/evaluators/app.evaluators.ts
rename to projects/aca-shared/rules/src/app.rules.ts
index 74ad48383..129c4d585 100644
--- a/src/app/extensions/evaluators/app.evaluators.ts
+++ b/projects/aca-shared/rules/src/app.rules.ts
@@ -24,8 +24,8 @@
*/
import { RuleContext } from '@alfresco/adf-extensions';
-import * as navigation from './navigation.evaluators';
-import * as repository from './repository.evaluators';
+import * as navigation from './navigation.rules';
+import * as repository from './repository.rules';
/**
* Checks if user can copy selected node.
diff --git a/src/app/extensions/evaluators/navigation.evaluators.spec.ts b/projects/aca-shared/rules/src/navigation.rules.spec.ts
similarity index 99%
rename from src/app/extensions/evaluators/navigation.evaluators.spec.ts
rename to projects/aca-shared/rules/src/navigation.rules.spec.ts
index 23b5e6df0..c89e6026e 100644
--- a/src/app/extensions/evaluators/navigation.evaluators.spec.ts
+++ b/projects/aca-shared/rules/src/navigation.rules.spec.ts
@@ -23,7 +23,7 @@
* along with Alfresco. If not, see .
*/
-import * as app from './navigation.evaluators';
+import * as app from './navigation.rules';
describe('navigation.evaluators', () => {
describe('isPreview', () => {
diff --git a/src/app/extensions/evaluators/navigation.evaluators.ts b/projects/aca-shared/rules/src/navigation.rules.ts
similarity index 100%
rename from src/app/extensions/evaluators/navigation.evaluators.ts
rename to projects/aca-shared/rules/src/navigation.rules.ts
diff --git a/src/app/store/states.ts b/projects/aca-shared/rules/src/public_api.ts
similarity index 91%
rename from src/app/store/states.ts
rename to projects/aca-shared/rules/src/public_api.ts
index b39538649..542beb99a 100644
--- a/src/app/store/states.ts
+++ b/projects/aca-shared/rules/src/public_api.ts
@@ -23,4 +23,6 @@
* along with Alfresco. If not, see .
*/
-export * from './states/app.state';
+export * from './app.rules';
+export * from './navigation.rules';
+export * from './repository.rules';
diff --git a/src/app/extensions/evaluators/repository.evaluators.ts b/projects/aca-shared/rules/src/repository.rules.ts
similarity index 100%
rename from src/app/extensions/evaluators/repository.evaluators.ts
rename to projects/aca-shared/rules/src/repository.rules.ts
diff --git a/src/app/components/common/generic-error/generic-error.component.html b/projects/aca-shared/src/lib/components/generic-error/generic-error.component.html
similarity index 53%
rename from src/app/components/common/generic-error/generic-error.component.html
rename to projects/aca-shared/src/lib/components/generic-error/generic-error.component.html
index 8b0419bc1..4ab4542a1 100644
--- a/src/app/components/common/generic-error/generic-error.component.html
+++ b/projects/aca-shared/src/lib/components/generic-error/generic-error.component.html
@@ -1,4 +1,4 @@
ic_error
- {{ 'APP.MESSAGES.ERRORS.MISSING_CONTENT' | translate }}
+ {{ text | translate }}
diff --git a/projects/aca-shared/src/lib/components/generic-error/generic-error.component.scss b/projects/aca-shared/src/lib/components/generic-error/generic-error.component.scss
new file mode 100644
index 000000000..efba7b28d
--- /dev/null
+++ b/projects/aca-shared/src/lib/components/generic-error/generic-error.component.scss
@@ -0,0 +1,22 @@
+.aca-generic-error {
+ color: var(--theme-text-color, rgba(0, 0, 0, 0.54));
+
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ flex-direction: column;
+ width: 100%;
+ height: 100%;
+
+ &__title {
+ font-size: 16px;
+ }
+
+ mat-icon {
+ color: var(--theme-warn-color, #f44336);
+ direction: rtl;
+ font-size: 52px;
+ height: 52px;
+ width: 52px;
+ }
+}
diff --git a/src/app/components/common/generic-error/generic-error.component.spec.ts b/projects/aca-shared/src/lib/components/generic-error/generic-error.component.spec.ts
similarity index 100%
rename from src/app/components/common/generic-error/generic-error.component.spec.ts
rename to projects/aca-shared/src/lib/components/generic-error/generic-error.component.spec.ts
diff --git a/src/app/components/common/generic-error/generic-error.component.ts b/projects/aca-shared/src/lib/components/generic-error/generic-error.component.ts
similarity index 88%
rename from src/app/components/common/generic-error/generic-error.component.ts
rename to projects/aca-shared/src/lib/components/generic-error/generic-error.component.ts
index 755cc3df9..bdcfdd912 100644
--- a/src/app/components/common/generic-error/generic-error.component.ts
+++ b/projects/aca-shared/src/lib/components/generic-error/generic-error.component.ts
@@ -26,14 +26,19 @@
import {
Component,
ViewEncapsulation,
- ChangeDetectionStrategy
+ ChangeDetectionStrategy,
+ Input
} from '@angular/core';
@Component({
selector: 'aca-generic-error',
templateUrl: './generic-error.component.html',
+ styleUrls: ['./generic-error.component.scss'],
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
host: { class: 'aca-generic-error' }
})
-export class GenericErrorComponent {}
+export class GenericErrorComponent {
+ @Input()
+ text = 'APP.MESSAGES.ERRORS.MISSING_CONTENT';
+}
diff --git a/src/app/store/actions/modals.actions.ts b/projects/aca-shared/src/lib/components/generic-error/generic-error.module.ts
similarity index 70%
rename from src/app/store/actions/modals.actions.ts
rename to projects/aca-shared/src/lib/components/generic-error/generic-error.module.ts
index b2c9afc25..819ade5ba 100644
--- a/src/app/store/actions/modals.actions.ts
+++ b/projects/aca-shared/src/lib/components/generic-error/generic-error.module.ts
@@ -23,11 +23,15 @@
* along with Alfresco. If not, see .
*/
-import { Action } from '@ngrx/store';
+import { NgModule } from '@angular/core';
+import { GenericErrorComponent } from './generic-error.component';
+import { MatIconModule } from '@angular/material/icon';
+import { CommonModule } from '@angular/common';
+import { TranslateModule } from '@ngx-translate/core';
-export const CLOSE_MODAL_DIALOGS = 'CLOSE_MODAL_DIALOGS';
-
-export class CloseModalDialogsAction implements Action {
- readonly type = CLOSE_MODAL_DIALOGS;
- constructor() {}
-}
+@NgModule({
+ imports: [CommonModule, MatIconModule, TranslateModule.forChild()],
+ declarations: [GenericErrorComponent],
+ exports: [GenericErrorComponent]
+})
+export class GenericErrorModule {}
diff --git a/src/app/components/layout/page-layout/page-layout-content.component.ts b/projects/aca-shared/src/lib/components/page-layout/page-layout-content.component.ts
similarity index 94%
rename from src/app/components/layout/page-layout/page-layout-content.component.ts
rename to projects/aca-shared/src/lib/components/page-layout/page-layout-content.component.ts
index 48015a48c..375f2c746 100644
--- a/src/app/components/layout/page-layout/page-layout-content.component.ts
+++ b/projects/aca-shared/src/lib/components/page-layout/page-layout-content.component.ts
@@ -32,13 +32,13 @@ import {
} from '@angular/core';
@Component({
- selector: 'app-page-layout-content',
+ selector: 'aca-page-layout-content',
template: `
`,
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
- host: { class: 'app-page-layout-content' }
+ host: { class: 'aca-page-layout-content' }
})
export class PageLayoutContentComponent {
@Input()
diff --git a/src/app/components/layout/page-layout/page-layout-error.component.ts b/projects/aca-shared/src/lib/components/page-layout/page-layout-error.component.ts
similarity index 94%
rename from src/app/components/layout/page-layout/page-layout-error.component.ts
rename to projects/aca-shared/src/lib/components/page-layout/page-layout-error.component.ts
index 7c5f1d008..a171d5219 100644
--- a/src/app/components/layout/page-layout/page-layout-error.component.ts
+++ b/projects/aca-shared/src/lib/components/page-layout/page-layout-error.component.ts
@@ -30,12 +30,12 @@ import {
} from '@angular/core';
@Component({
- selector: 'app-page-layout-error',
+ selector: 'aca-page-layout-error',
template: `
`,
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
- host: { class: 'app-page-layout-error' }
+ host: { class: 'aca-page-layout-error' }
})
export class PageLayoutErrorComponent {}
diff --git a/src/app/components/layout/page-layout/page-layout-header.component.ts b/projects/aca-shared/src/lib/components/page-layout/page-layout-header.component.ts
similarity index 94%
rename from src/app/components/layout/page-layout/page-layout-header.component.ts
rename to projects/aca-shared/src/lib/components/page-layout/page-layout-header.component.ts
index 788a094c4..2890c4048 100644
--- a/src/app/components/layout/page-layout/page-layout-header.component.ts
+++ b/projects/aca-shared/src/lib/components/page-layout/page-layout-header.component.ts
@@ -30,10 +30,10 @@ import {
} from '@angular/core';
@Component({
- selector: 'app-page-layout-header',
+ selector: 'aca-page-layout-header',
template: '',
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
- host: { class: 'app-page-layout-header' }
+ host: { class: 'aca-page-layout-header' }
})
export class PageLayoutHeaderComponent {}
diff --git a/projects/aca-shared/src/lib/components/page-layout/page-layout.component.html b/projects/aca-shared/src/lib/components/page-layout/page-layout.component.html
new file mode 100644
index 000000000..966402c25
--- /dev/null
+++ b/projects/aca-shared/src/lib/components/page-layout/page-layout.component.html
@@ -0,0 +1,3 @@
+
+
+
diff --git a/projects/aca-shared/src/lib/components/page-layout/page-layout.component.scss b/projects/aca-shared/src/lib/components/page-layout/page-layout.component.scss
new file mode 100644
index 000000000..79670dfcc
--- /dev/null
+++ b/projects/aca-shared/src/lib/components/page-layout/page-layout.component.scss
@@ -0,0 +1,44 @@
+@import '../../styles/mixins.scss';
+
+.aca-page-layout {
+ @include flex-column;
+
+ .aca-page-layout-header {
+ display: flex;
+ align-items: center;
+ flex: 0 0 65px;
+ flex-basis: 48px;
+ background: #fafafa;
+ border-bottom: 1px solid var(--theme-border-color, rgba(0, 0, 0, 0.07));
+ padding: 0 24px;
+ }
+
+ .aca-page-layout-content {
+ @include flex-row;
+ }
+
+ .aca-page-layout-error {
+ @include flex-row;
+ }
+
+ .main-content {
+ @include flex-column;
+ border-right: 1px solid var(--theme-border-color, rgba(0, 0, 0, 0.07));
+ }
+
+ .scrollable {
+ overflow: auto !important;
+
+ .main-content {
+ overflow: auto !important;
+ }
+ }
+
+ .sidebar {
+ display: block;
+ height: 100%;
+ overflow-y: scroll;
+ max-width: 350px;
+ width: 350px;
+ }
+}
diff --git a/src/app/components/layout/page-layout/page-layout.component.ts b/projects/aca-shared/src/lib/components/page-layout/page-layout.component.ts
similarity index 92%
rename from src/app/components/layout/page-layout/page-layout.component.ts
rename to projects/aca-shared/src/lib/components/page-layout/page-layout.component.ts
index 791984812..cc378408d 100644
--- a/src/app/components/layout/page-layout/page-layout.component.ts
+++ b/projects/aca-shared/src/lib/components/page-layout/page-layout.component.ts
@@ -31,10 +31,11 @@ import {
} from '@angular/core';
@Component({
- selector: 'app-page-layout',
+ selector: 'aca-page-layout',
templateUrl: 'page-layout.component.html',
+ styleUrls: ['./page-layout.component.scss'],
encapsulation: ViewEncapsulation.None,
- host: { class: 'app-page-layout' },
+ host: { class: 'aca-page-layout' },
changeDetection: ChangeDetectionStrategy.OnPush
})
export class PageLayoutComponent {
diff --git a/projects/aca-shared/src/lib/components/page-layout/page-layout.module.ts b/projects/aca-shared/src/lib/components/page-layout/page-layout.module.ts
new file mode 100644
index 000000000..defead023
--- /dev/null
+++ b/projects/aca-shared/src/lib/components/page-layout/page-layout.module.ts
@@ -0,0 +1,48 @@
+/*!
+ * @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 .
+ */
+
+import { NgModule } from '@angular/core';
+import { PageLayoutContentComponent } from './page-layout-content.component';
+import { PageLayoutErrorComponent } from './page-layout-error.component';
+import { PageLayoutHeaderComponent } from './page-layout-header.component';
+import { PageLayoutComponent } from './page-layout.component';
+import { CommonModule } from '@angular/common';
+
+@NgModule({
+ imports: [CommonModule],
+ declarations: [
+ PageLayoutContentComponent,
+ PageLayoutErrorComponent,
+ PageLayoutHeaderComponent,
+ PageLayoutComponent
+ ],
+ exports: [
+ PageLayoutContentComponent,
+ PageLayoutErrorComponent,
+ PageLayoutHeaderComponent,
+ PageLayoutComponent
+ ]
+})
+export class PageLayoutModule {}
diff --git a/src/app/app.routes.strategy.spec.ts b/projects/aca-shared/src/lib/routing/app.routes.strategy.spec.ts
similarity index 96%
rename from src/app/app.routes.strategy.spec.ts
rename to projects/aca-shared/src/lib/routing/app.routes.strategy.spec.ts
index 674e430a5..cd6fd61ef 100644
--- a/src/app/app.routes.strategy.spec.ts
+++ b/projects/aca-shared/src/lib/routing/app.routes.strategy.spec.ts
@@ -25,14 +25,12 @@
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]
});
diff --git a/src/app/app.routes.strategy.ts b/projects/aca-shared/src/lib/routing/app.routes.strategy.ts
similarity index 100%
rename from src/app/app.routes.strategy.ts
rename to projects/aca-shared/src/lib/routing/app.routes.strategy.ts
diff --git a/src/app/guards/shared.guard.ts b/projects/aca-shared/src/lib/routing/shared.guard.ts
similarity index 93%
rename from src/app/guards/shared.guard.ts
rename to projects/aca-shared/src/lib/routing/shared.guard.ts
index 3da19f4ec..bb491f7c4 100644
--- a/src/app/guards/shared.guard.ts
+++ b/projects/aca-shared/src/lib/routing/shared.guard.ts
@@ -28,8 +28,7 @@ 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';
+import { AppStore, isQuickShareEnabled } from '@alfresco/aca-shared/store';
@Injectable({
providedIn: 'root'
diff --git a/src/app/services/app.service.spec.ts b/projects/aca-shared/src/lib/services/app.service.spec.ts
similarity index 94%
rename from src/app/services/app.service.spec.ts
rename to projects/aca-shared/src/lib/services/app.service.spec.ts
index a41aa215d..440289ee4 100644
--- a/src/app/services/app.service.spec.ts
+++ b/projects/aca-shared/src/lib/services/app.service.spec.ts
@@ -25,10 +25,10 @@
import { AppService } from './app.service';
import { TestBed } from '@angular/core/testing';
-import { AppTestingModule } from '../testing/app-testing.module';
import { AuthenticationService, AppConfigService } from '@alfresco/adf-core';
-import { AppRouteReuseStrategy } from '../app.routes.strategy';
import { Subject } from 'rxjs';
+import { HttpClientModule } from '@angular/common/http';
+import { AppRouteReuseStrategy } from '../routing/app.routes.strategy';
describe('AppService', () => {
let service: AppService;
@@ -38,7 +38,7 @@ describe('AppService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
- imports: [AppTestingModule],
+ imports: [HttpClientModule],
providers: [
AppRouteReuseStrategy,
{
diff --git a/src/app/services/app.service.ts b/projects/aca-shared/src/lib/services/app.service.ts
similarity index 96%
rename from src/app/services/app.service.ts
rename to projects/aca-shared/src/lib/services/app.service.ts
index 0b02eb10b..5c097d937 100644
--- a/src/app/services/app.service.ts
+++ b/projects/aca-shared/src/lib/services/app.service.ts
@@ -26,8 +26,8 @@
import { Injectable, Inject } from '@angular/core';
import { AuthenticationService, AppConfigService } from '@alfresco/adf-core';
import { Observable, BehaviorSubject } from 'rxjs';
-import { AppRouteReuseStrategy } from '../app.routes.strategy';
import { RouteReuseStrategy } from '@angular/router';
+import { AppRouteReuseStrategy } from '../routing/app.routes.strategy';
@Injectable({
providedIn: 'root'
diff --git a/src/app/services/content-api.service.spec.ts b/projects/aca-shared/src/lib/services/content-api.service.spec.ts
similarity index 100%
rename from src/app/services/content-api.service.spec.ts
rename to projects/aca-shared/src/lib/services/content-api.service.spec.ts
diff --git a/src/app/services/content-api.service.ts b/projects/aca-shared/src/lib/services/content-api.service.ts
similarity index 100%
rename from src/app/services/content-api.service.ts
rename to projects/aca-shared/src/lib/services/content-api.service.ts
diff --git a/src/app/services/node-permission.service.spec.ts b/projects/aca-shared/src/lib/services/node-permission.service.spec.ts
similarity index 100%
rename from src/app/services/node-permission.service.spec.ts
rename to projects/aca-shared/src/lib/services/node-permission.service.spec.ts
diff --git a/src/app/services/node-permission.service.ts b/projects/aca-shared/src/lib/services/node-permission.service.ts
similarity index 100%
rename from src/app/services/node-permission.service.ts
rename to projects/aca-shared/src/lib/services/node-permission.service.ts
diff --git a/src/app/store/actions/info-drawer.actions.ts b/projects/aca-shared/src/lib/shared.module.ts
similarity index 70%
rename from src/app/store/actions/info-drawer.actions.ts
rename to projects/aca-shared/src/lib/shared.module.ts
index 9db0e7e13..327fe0b8b 100644
--- a/src/app/store/actions/info-drawer.actions.ts
+++ b/projects/aca-shared/src/lib/shared.module.ts
@@ -23,11 +23,17 @@
* along with Alfresco. If not, see .
*/
-import { Action } from '@ngrx/store';
+import { NgModule, ModuleWithProviders } from '@angular/core';
+import { ContentApiService } from './services/content-api.service';
+import { NodePermissionService } from './services/node-permission.service';
+import { AppService } from './services/app.service';
-export const SET_INFO_DRAWER_STATE = 'SET_INFO_DRAWER_STATE';
-
-export class SetInfoDrawerStateAction implements Action {
- readonly type = SET_INFO_DRAWER_STATE;
- constructor(public payload: boolean) {}
+@NgModule({})
+export class SharedModule {
+ static forRoot(): ModuleWithProviders {
+ return {
+ ngModule: SharedModule,
+ providers: [ContentApiService, NodePermissionService, AppService]
+ };
+ }
}
diff --git a/projects/aca-shared/src/lib/styles/mixins.scss b/projects/aca-shared/src/lib/styles/mixins.scss
new file mode 100644
index 000000000..946c3b568
--- /dev/null
+++ b/projects/aca-shared/src/lib/styles/mixins.scss
@@ -0,0 +1,16 @@
+@mixin flex-column {
+ display: flex;
+ flex-direction: column;
+ flex: 1;
+ height: 100%;
+ overflow: hidden;
+ min-height: 0;
+}
+
+@mixin flex-row {
+ display: flex;
+ flex-direction: row;
+ flex: 1;
+ height: 100%;
+ overflow: hidden;
+}
diff --git a/projects/aca-shared/src/public-api.ts b/projects/aca-shared/src/public-api.ts
new file mode 100644
index 000000000..0d87b4502
--- /dev/null
+++ b/projects/aca-shared/src/public-api.ts
@@ -0,0 +1,42 @@
+/*!
+ * @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 .
+ */
+
+export * from './lib/components/page-layout/page-layout-content.component';
+export * from './lib/components/page-layout/page-layout-error.component';
+export * from './lib/components/page-layout/page-layout-header.component';
+export * from './lib/components/page-layout/page-layout.component';
+export * from './lib/components/page-layout/page-layout.module';
+
+export * from './lib/routing/app.routes.strategy';
+export * from './lib/routing/shared.guard';
+
+export * from './lib/services/app.service';
+export * from './lib/services/content-api.service';
+export * from './lib/services/node-permission.service';
+
+export * from './lib/components/generic-error/generic-error.component';
+export * from './lib/components/generic-error/generic-error.module';
+
+export * from './lib/shared.module';
diff --git a/projects/aca-shared/store/package.json b/projects/aca-shared/store/package.json
new file mode 100644
index 000000000..4bbd7d0f7
--- /dev/null
+++ b/projects/aca-shared/store/package.json
@@ -0,0 +1,3 @@
+{
+ "ngPackage": {}
+}
diff --git a/src/app/store/actions/app.actions.ts b/projects/aca-shared/store/src/actions/app.actions.ts
similarity index 55%
rename from src/app/store/actions/app.actions.ts
rename to projects/aca-shared/store/src/actions/app.actions.ts
index a45dafa25..864fae83c 100644
--- a/src/app/store/actions/app.actions.ts
+++ b/projects/aca-shared/store/src/actions/app.actions.ts
@@ -24,57 +24,84 @@
*/
import { Action } from '@ngrx/store';
-import { Node, Person, Group } from '@alfresco/js-api';
-import { AppState } from '../states';
+import { Node, Person, Group, RepositoryInfo } from '@alfresco/js-api';
+import { AppState } from '../states/app.state';
-export const SET_INITIAL_STATE = 'SET_INITIAL_STATE';
-export const SET_LANGUAGE_PICKER = 'SET_LANGUAGE_PICKER';
-export const SET_CURRENT_FOLDER = 'SET_CURRENT_FOLDER';
-export const SET_CURRENT_URL = 'SET_CURRENT_URL';
-export const SET_USER_PROFILE = 'SET_USER_PROFILE';
-export const TOGGLE_INFO_DRAWER = 'TOGGLE_INFO_DRAWER';
-export const TOGGLE_DOCUMENT_DISPLAY_MODE = 'TOGGLE_DOCUMENT_DISPLAY_MODE';
-export const LOGOUT = 'LOGOUT';
-export const RELOAD_DOCUMENT_LIST = 'RELOAD_DOCUMENT_LIST';
+export enum AppActionTypes {
+ SetInitialState = 'SET_INITIAL_STATE',
+ SetLanguagePicker = 'SET_LANGUAGE_PICKER',
+ SetCurrentFolder = 'SET_CURRENT_FOLDER',
+ SetCurrentUrl = 'SET_CURRENT_URL',
+ SetUserProfile = 'SET_USER_PROFILE',
+ SetRepositoryInfo = 'SET_REPOSITORY_INFO',
+ ToggleInfoDrawer = 'TOGGLE_INFO_DRAWER',
+ ToggleDocumentDisplayMode = 'TOGGLE_DOCUMENT_DISPLAY_MODE',
+ Logout = 'LOGOUT',
+ ReloadDocumentList = 'RELOAD_DOCUMENT_LIST',
+ SetInfoDrawerState = 'SET_INFO_DRAWER_STATE',
+ CloseModalDialogs = 'CLOSE_MODAL_DIALOGS'
+}
export class SetInitialStateAction implements Action {
- readonly type = SET_INITIAL_STATE;
+ readonly type = AppActionTypes.SetInitialState;
+
constructor(public payload: AppState) {}
}
export class SetLanguagePickerAction implements Action {
- readonly type = SET_LANGUAGE_PICKER;
+ readonly type = AppActionTypes.SetLanguagePicker;
+
constructor(public payload: boolean) {}
}
export class SetCurrentFolderAction implements Action {
- readonly type = SET_CURRENT_FOLDER;
+ readonly type = AppActionTypes.SetCurrentFolder;
+
constructor(public payload: Node) {}
}
export class SetCurrentUrlAction implements Action {
- readonly type = SET_CURRENT_URL;
+ readonly type = AppActionTypes.SetCurrentUrl;
+
constructor(public payload: string) {}
}
export class SetUserProfileAction implements Action {
- readonly type = SET_USER_PROFILE;
+ readonly type = AppActionTypes.SetUserProfile;
+
constructor(public payload: { person: Person; groups: Group[] }) {}
}
export class ToggleInfoDrawerAction implements Action {
- readonly type = TOGGLE_INFO_DRAWER;
+ readonly type = AppActionTypes.ToggleInfoDrawer;
}
export class ToggleDocumentDisplayMode implements Action {
- readonly type = TOGGLE_DOCUMENT_DISPLAY_MODE;
+ readonly type = AppActionTypes.ToggleDocumentDisplayMode;
}
export class LogoutAction implements Action {
- readonly type = LOGOUT;
+ readonly type = AppActionTypes.Logout;
}
export class ReloadDocumentListAction implements Action {
- readonly type = RELOAD_DOCUMENT_LIST;
+ readonly type = AppActionTypes.ReloadDocumentList;
+
constructor(public payload?: any) {}
}
+
+export class SetInfoDrawerStateAction implements Action {
+ readonly type = AppActionTypes.SetInfoDrawerState;
+
+ constructor(public payload: boolean) {}
+}
+
+export class CloseModalDialogsAction implements Action {
+ readonly type = AppActionTypes.CloseModalDialogs;
+}
+
+export class SetRepositoryInfoAction implements Action {
+ readonly type = AppActionTypes.SetRepositoryInfo;
+
+ constructor(public payload: RepositoryInfo) {}
+}
diff --git a/src/app/store/actions/library.actions.ts b/projects/aca-shared/store/src/actions/library.actions.ts
similarity index 79%
rename from src/app/store/actions/library.actions.ts
rename to projects/aca-shared/store/src/actions/library.actions.ts
index 9801f13a1..fc3e34c9b 100644
--- a/src/app/store/actions/library.actions.ts
+++ b/projects/aca-shared/store/src/actions/library.actions.ts
@@ -26,33 +26,38 @@
import { Action } from '@ngrx/store';
import { SiteBody } from '@alfresco/js-api';
-export const DELETE_LIBRARY = 'DELETE_LIBRARY';
-export const CREATE_LIBRARY = 'CREATE_LIBRARY';
-export const NAVIGATE_LIBRARY = 'NAVIGATE_LIBRARY';
-export const UPDATE_LIBRARY = 'UPDATE_LIBRARY';
-export const LEAVE_LIBRARY = 'LEAVE_LIBRARY';
+export enum LibraryActionTypes {
+ Delete = 'DELETE_LIBRARY',
+ Create = 'CREATE_LIBRARY',
+ Navigate = 'NAVIGATE_LIBRARY',
+ Update = 'UPDATE_LIBRARY',
+ Leave = 'LEAVE_LIBRARY'
+}
export class DeleteLibraryAction implements Action {
- readonly type = DELETE_LIBRARY;
+ readonly type = LibraryActionTypes.Delete;
+
constructor(public payload?: string) {}
}
export class CreateLibraryAction implements Action {
- readonly type = CREATE_LIBRARY;
- constructor() {}
+ readonly type = LibraryActionTypes.Create;
}
export class NavigateLibraryAction implements Action {
- readonly type = NAVIGATE_LIBRARY;
+ readonly type = LibraryActionTypes.Navigate;
+
constructor(public payload?: string) {}
}
export class UpdateLibraryAction implements Action {
- readonly type = UPDATE_LIBRARY;
+ readonly type = LibraryActionTypes.Update;
+
constructor(public payload?: SiteBody) {}
}
export class LeaveLibraryAction implements Action {
- readonly type = LEAVE_LIBRARY;
+ readonly type = LibraryActionTypes.Leave;
+
constructor(public payload?: string) {}
}
diff --git a/src/app/store/actions/node.actions.ts b/projects/aca-shared/store/src/actions/node.actions.ts
similarity index 63%
rename from src/app/store/actions/node.actions.ts
rename to projects/aca-shared/store/src/actions/node.actions.ts
index bd03557ae..7fdf132c3 100644
--- a/src/app/store/actions/node.actions.ts
+++ b/projects/aca-shared/store/src/actions/node.actions.ts
@@ -26,111 +26,138 @@
import { Action } from '@ngrx/store';
import { MinimalNodeEntity } from '@alfresco/js-api';
-export const SET_SELECTED_NODES = 'SET_SELECTED_NODES';
-export const DELETE_NODES = 'DELETE_NODES';
-export const UNDO_DELETE_NODES = 'UNDO_DELETE_NODES';
-export const RESTORE_DELETED_NODES = 'RESTORE_DELETED_NODES';
-export const PURGE_DELETED_NODES = 'PURGE_DELETED_NODES';
-export const DOWNLOAD_NODES = 'DOWNLOAD_NODES';
-export const CREATE_FOLDER = 'CREATE_FOLDER';
-export const EDIT_FOLDER = 'EDIT_FOLDER';
-export const SHARE_NODE = 'SHARE_NODE';
-export const UNSHARE_NODES = 'UNSHARE_NODES';
-export const COPY_NODES = 'COPY_NODES';
-export const MOVE_NODES = 'MOVE_NODES';
-export const MANAGE_PERMISSIONS = 'MANAGE_PERMISSIONS';
-export const PRINT_FILE = 'PRINT_FILE';
-export const FULLSCREEN_VIEWER = 'FULLSCREEN_VIEWER';
-export const MANAGE_VERSIONS = 'MANAGE_VERSIONS';
-export const EDIT_OFFLINE = 'EDIT_OFFLINE';
-export const UNLOCK_WRITE = 'UNLOCK_WRITE_LOCK';
+export enum NodeActionTypes {
+ SetSelection = 'SET_SELECTED_NODES',
+ Delete = 'DELETE_NODES',
+ UndoDelete = 'UNDO_DELETE_NODES',
+ RestoreDeleted = 'RESTORE_DELETED_NODES',
+ PurgeDeleted = 'PURGE_DELETED_NODES',
+ Download = 'DOWNLOAD_NODES',
+ CreateFolder = 'CREATE_FOLDER',
+ EditFolder = 'EDIT_FOLDER',
+ Share = 'SHARE_NODE',
+ Unshare = 'UNSHARE_NODES',
+ Copy = 'COPY_NODES',
+ Move = 'MOVE_NODES',
+ ManagePermissions = 'MANAGE_PERMISSIONS',
+ PrintFile = 'PRINT_FILE',
+ ManageVersions = 'MANAGE_VERSIONS',
+ EditOffline = 'EDIT_OFFLINE',
+ UnlockForWriting = 'UNLOCK_WRITE_LOCK',
+ AddFavorite = 'ADD_FAVORITE',
+ RemoveFavorite = 'REMOVE_FAVORITE'
+}
export class SetSelectedNodesAction implements Action {
- readonly type = SET_SELECTED_NODES;
+ readonly type = NodeActionTypes.SetSelection;
+
constructor(public payload: MinimalNodeEntity[] = []) {}
}
export class DeleteNodesAction implements Action {
- readonly type = DELETE_NODES;
+ readonly type = NodeActionTypes.Delete;
+
constructor(public payload: MinimalNodeEntity[] = []) {}
}
export class UndoDeleteNodesAction implements Action {
- readonly type = UNDO_DELETE_NODES;
+ readonly type = NodeActionTypes.UndoDelete;
+
constructor(public payload: any[] = []) {}
}
export class RestoreDeletedNodesAction implements Action {
- readonly type = RESTORE_DELETED_NODES;
+ readonly type = NodeActionTypes.RestoreDeleted;
+
constructor(public payload: Array) {}
}
export class PurgeDeletedNodesAction implements Action {
- readonly type = PURGE_DELETED_NODES;
+ readonly type = NodeActionTypes.PurgeDeleted;
+
constructor(public payload: Array) {}
}
export class DownloadNodesAction implements Action {
- readonly type = DOWNLOAD_NODES;
+ readonly type = NodeActionTypes.Download;
+
constructor(public payload: MinimalNodeEntity[] = []) {}
}
export class CreateFolderAction implements Action {
- readonly type = CREATE_FOLDER;
+ readonly type = NodeActionTypes.CreateFolder;
+
constructor(public payload: string) {}
}
export class EditFolderAction implements Action {
- readonly type = EDIT_FOLDER;
+ readonly type = NodeActionTypes.EditFolder;
+
constructor(public payload: MinimalNodeEntity) {}
}
export class ShareNodeAction implements Action {
- readonly type = SHARE_NODE;
+ readonly type = NodeActionTypes.Share;
+
constructor(public payload: MinimalNodeEntity) {}
}
export class UnshareNodesAction implements Action {
- readonly type = UNSHARE_NODES;
+ readonly type = NodeActionTypes.Unshare;
+
constructor(public payload: Array) {}
}
export class CopyNodesAction implements Action {
- readonly type = COPY_NODES;
+ readonly type = NodeActionTypes.Copy;
+
constructor(public payload: Array) {}
}
export class MoveNodesAction implements Action {
- readonly type = MOVE_NODES;
+ readonly type = NodeActionTypes.Move;
+
constructor(public payload: Array) {}
}
export class ManagePermissionsAction implements Action {
- readonly type = MANAGE_PERMISSIONS;
+ readonly type = NodeActionTypes.ManagePermissions;
+
constructor(public payload: MinimalNodeEntity) {}
}
export class PrintFileAction implements Action {
- readonly type = PRINT_FILE;
- constructor(public payload: MinimalNodeEntity) {}
-}
+ readonly type = NodeActionTypes.PrintFile;
-export class FullscreenViewerAction implements Action {
- readonly type = FULLSCREEN_VIEWER;
constructor(public payload: MinimalNodeEntity) {}
}
export class ManageVersionsAction implements Action {
- readonly type = MANAGE_VERSIONS;
+ readonly type = NodeActionTypes.ManageVersions;
+
constructor(public payload: MinimalNodeEntity) {}
}
export class EditOfflineAction implements Action {
- readonly type = EDIT_OFFLINE;
+ readonly type = NodeActionTypes.EditOffline;
+
constructor(public payload: any) {}
}
export class UnlockWriteAction implements Action {
- readonly type = UNLOCK_WRITE;
+ readonly type = NodeActionTypes.UnlockForWriting;
+
constructor(public payload: any) {}
}
+
+export class AddFavoriteAction implements Action {
+ readonly type = NodeActionTypes.AddFavorite;
+
+ constructor(public payload: Array) {}
+}
+
+export class RemoveFavoriteAction implements Action {
+ readonly type = NodeActionTypes.RemoveFavorite;
+
+ constructor(public payload: Array) {}
+}
diff --git a/src/app/store/actions/router.actions.ts b/projects/aca-shared/store/src/actions/router.actions.ts
similarity index 80%
rename from src/app/store/actions/router.actions.ts
rename to projects/aca-shared/store/src/actions/router.actions.ts
index a29575c76..0bf984ddd 100644
--- a/src/app/store/actions/router.actions.ts
+++ b/projects/aca-shared/store/src/actions/router.actions.ts
@@ -26,27 +26,33 @@
import { Action } from '@ngrx/store';
import { MinimalNodeEntity } from '@alfresco/js-api';
-export const NAVIGATE_URL = 'NAVIGATE_URL';
-export const NAVIGATE_ROUTE = 'NAVIGATE_ROUTE';
-export const NAVIGATE_FOLDER = 'NAVIGATE_FOLDER';
-export const NAVIGATE_PARENT_FOLDER = 'NAVIGATE_PARENT_FOLDER';
+export enum RouterActionTypes {
+ NavigateUrl = 'NAVIGATE_URL',
+ NavigateRoute = 'NAVIGATE_ROUTE',
+ NavigateFolder = 'NAVIGATE_FOLDER',
+ NavigateParentFolder = 'NAVIGATE_PARENT_FOLDER'
+}
export class NavigateUrlAction implements Action {
- readonly type = NAVIGATE_URL;
+ readonly type = RouterActionTypes.NavigateUrl;
+
constructor(public payload: string) {}
}
export class NavigateRouteAction implements Action {
- readonly type = NAVIGATE_ROUTE;
+ readonly type = RouterActionTypes.NavigateRoute;
+
constructor(public payload: any[]) {}
}
export class NavigateToFolder implements Action {
- readonly type = NAVIGATE_FOLDER;
+ readonly type = RouterActionTypes.NavigateFolder;
+
constructor(public payload: MinimalNodeEntity) {}
}
export class NavigateToParentFolder implements Action {
- readonly type = NAVIGATE_PARENT_FOLDER;
+ readonly type = RouterActionTypes.NavigateParentFolder;
+
constructor(public payload: MinimalNodeEntity) {}
}
diff --git a/src/app/store/actions/search.actions.ts b/projects/aca-shared/store/src/actions/search.actions.ts
similarity index 76%
rename from src/app/store/actions/search.actions.ts
rename to projects/aca-shared/store/src/actions/search.actions.ts
index 2dc82c123..0f9fbf5f6 100644
--- a/src/app/store/actions/search.actions.ts
+++ b/projects/aca-shared/store/src/actions/search.actions.ts
@@ -24,15 +24,17 @@
*/
import { Action } from '@ngrx/store';
-import { SearchOptionModel } from '../models/searchOption.model';
+import { SearchOptionModel } from '../models/search-option.model';
-export const SEARCH_BY_TERM = 'SEARCH_BY_TERM';
-export const TOGGLE_SEARCH_FILTER = 'TOGGLE_SEARCH_FILTER';
-export const SHOW_SEARCH_FILTER = 'SHOW_SEARCH_FILTER';
-export const HIDE_SEARCH_FILTER = 'HIDE_SEARCH_FILTER';
+export enum SearchActionTypes {
+ SearchByTerm = 'SEARCH_BY_TERM',
+ ToggleFilter = 'TOGGLE_SEARCH_FILTER',
+ ShowFilter = 'SHOW_SEARCH_FILTER',
+ HideFilter = 'HIDE_SEARCH_FILTER'
+}
export class SearchByTermAction implements Action {
- readonly type = SEARCH_BY_TERM;
+ readonly type = SearchActionTypes.SearchByTerm;
constructor(
public payload: string,
public searchOptions?: SearchOptionModel[]
@@ -40,13 +42,13 @@ export class SearchByTermAction implements Action {
}
export class ToggleSearchFilterAction implements Action {
- readonly type = TOGGLE_SEARCH_FILTER;
+ readonly type = SearchActionTypes.ToggleFilter;
}
export class ShowSearchFilterAction implements Action {
- readonly type = SHOW_SEARCH_FILTER;
+ readonly type = SearchActionTypes.ShowFilter;
}
export class HideSearchFilterAction implements Action {
- readonly type = HIDE_SEARCH_FILTER;
+ readonly type = SearchActionTypes.HideFilter;
}
diff --git a/src/app/store/actions/snackbar.actions.ts b/projects/aca-shared/store/src/actions/snackbar.actions.ts
similarity index 88%
rename from src/app/store/actions/snackbar.actions.ts
rename to projects/aca-shared/store/src/actions/snackbar.actions.ts
index 8e95c7f99..4a65997af 100644
--- a/src/app/store/actions/snackbar.actions.ts
+++ b/projects/aca-shared/store/src/actions/snackbar.actions.ts
@@ -25,9 +25,11 @@
import { Action } from '@ngrx/store';
-export const SNACKBAR_INFO = 'SNACKBAR_INFO';
-export const SNACKBAR_WARNING = 'SNACKBAR_WARNING';
-export const SNACKBAR_ERROR = 'SNACKBAR_ERROR';
+export enum SnackbarActionTypes {
+ Info = 'SNACKBAR_INFO',
+ Warning = 'SNACKBAR_WARNING',
+ Error = 'SNACKBAR_ERROR'
+}
export interface SnackbarAction extends Action {
payload: string;
@@ -41,7 +43,7 @@ export class SnackbarUserAction {
}
export class SnackbarInfoAction implements SnackbarAction {
- readonly type = SNACKBAR_INFO;
+ readonly type = SnackbarActionTypes.Info;
userAction?: SnackbarUserAction;
duration = 4000;
@@ -50,7 +52,7 @@ export class SnackbarInfoAction implements SnackbarAction {
}
export class SnackbarWarningAction implements SnackbarAction {
- readonly type = SNACKBAR_WARNING;
+ readonly type = SnackbarActionTypes.Warning;
userAction?: SnackbarUserAction;
duration = 4000;
@@ -59,7 +61,7 @@ export class SnackbarWarningAction implements SnackbarAction {
}
export class SnackbarErrorAction implements SnackbarAction {
- readonly type = SNACKBAR_ERROR;
+ readonly type = SnackbarActionTypes.Error;
userAction?: SnackbarUserAction;
duration = 4000;
diff --git a/src/app/store/actions/upload.actions.ts b/projects/aca-shared/store/src/actions/upload.actions.ts
similarity index 82%
rename from src/app/store/actions/upload.actions.ts
rename to projects/aca-shared/store/src/actions/upload.actions.ts
index 061c824c2..6d8780b83 100644
--- a/src/app/store/actions/upload.actions.ts
+++ b/projects/aca-shared/store/src/actions/upload.actions.ts
@@ -25,20 +25,24 @@
import { Action } from '@ngrx/store';
-export const UPLOAD_FILES = 'UPLOAD_FILES';
-export const UPLOAD_FOLDER = 'UPLOAD_FOLDER';
-export const UPLOAD_FILE_VERSION = 'UPLOAD_FILE_VERSION';
+export enum UploadActionTypes {
+ UploadFiles = 'UPLOAD_FILES',
+ UploadFolder = 'UPLOAD_FOLDER',
+ UploadFileVersion = 'UPLOAD_FILE_VERSION'
+}
export class UploadFilesAction implements Action {
- readonly type = UPLOAD_FILES;
+ readonly type = UploadActionTypes.UploadFiles;
+
constructor(public payload: any) {}
}
export class UploadFolderAction implements Action {
- readonly type = UPLOAD_FOLDER;
+ readonly type = UploadActionTypes.UploadFolder;
+
constructor(public payload: any) {}
}
export class UploadFileVersionAction implements Action {
- readonly type = UPLOAD_FILE_VERSION;
+ readonly type = UploadActionTypes.UploadFileVersion;
}
diff --git a/src/app/store/actions/viewer.actions.ts b/projects/aca-shared/store/src/actions/viewer.actions.ts
similarity index 79%
rename from src/app/store/actions/viewer.actions.ts
rename to projects/aca-shared/store/src/actions/viewer.actions.ts
index dea6c81e3..1e878b13a 100644
--- a/src/app/store/actions/viewer.actions.ts
+++ b/projects/aca-shared/store/src/actions/viewer.actions.ts
@@ -26,15 +26,26 @@
import { Action } from '@ngrx/store';
import { MinimalNodeEntity } from '@alfresco/js-api';
-export const VIEW_FILE = 'VIEW_FILE';
-export const VIEW_NODE = 'VIEW_NODE';
+export enum ViewerActionTypes {
+ ViewFile = 'VIEW_FILE',
+ ViewNode = 'VIEW_NODE',
+ FullScreen = 'FULLSCREEN_VIEWER'
+}
export class ViewFileAction implements Action {
- readonly type = VIEW_FILE;
+ readonly type = ViewerActionTypes.ViewFile;
+
constructor(public payload: MinimalNodeEntity, public parentId?: string) {}
}
export class ViewNodeAction implements Action {
- readonly type = VIEW_NODE;
+ readonly type = ViewerActionTypes.ViewNode;
+
constructor(public nodeId: string, public location?: string) {}
}
+
+export class FullscreenViewerAction implements Action {
+ readonly type = ViewerActionTypes.FullScreen;
+
+ constructor(public payload: MinimalNodeEntity) {}
+}
diff --git a/src/app/store/effects/modals.effects.ts b/projects/aca-shared/store/src/effects/dialog.effects.ts
similarity index 85%
rename from src/app/store/effects/modals.effects.ts
rename to projects/aca-shared/store/src/effects/dialog.effects.ts
index 9eb338181..64ef99ef7 100644
--- a/src/app/store/effects/modals.effects.ts
+++ b/projects/aca-shared/store/src/effects/dialog.effects.ts
@@ -26,16 +26,19 @@
import { Effect, Actions, ofType } from '@ngrx/effects';
import { Injectable } from '@angular/core';
import { map } from 'rxjs/operators';
-import { CloseModalDialogsAction, CLOSE_MODAL_DIALOGS } from '../actions';
-import { MatDialog } from '@angular/material';
+import { MatDialog } from '@angular/material/dialog';
+import {
+ CloseModalDialogsAction,
+ AppActionTypes
+} from '../actions/app.actions';
@Injectable()
-export class ModalsEffects {
+export class DialogEffects {
constructor(private actions$: Actions, private matDialog: MatDialog) {}
@Effect({ dispatch: false })
closeAll$ = this.actions$.pipe(
- ofType(CLOSE_MODAL_DIALOGS),
+ ofType(AppActionTypes.CloseModalDialogs),
map(() => this.matDialog.closeAll())
);
}
diff --git a/src/app/store/effects/router.effects.ts b/projects/aca-shared/store/src/effects/router.effects.ts
similarity index 91%
rename from src/app/store/effects/router.effects.ts
rename to projects/aca-shared/store/src/effects/router.effects.ts
index 482cc190b..f39f36985 100644
--- a/src/app/store/effects/router.effects.ts
+++ b/projects/aca-shared/store/src/effects/router.effects.ts
@@ -28,19 +28,16 @@ import { Router } from '@angular/router';
import { Actions, Effect, ofType } from '@ngrx/effects';
import { MinimalNodeEntryEntity, PathInfoEntity } from '@alfresco/js-api';
import { map } from 'rxjs/operators';
-import {
- NavigateRouteAction,
- NavigateToParentFolder,
- NAVIGATE_PARENT_FOLDER,
- NAVIGATE_ROUTE,
- NavigateToFolder,
- NAVIGATE_FOLDER,
- NavigateUrlAction,
- NAVIGATE_URL,
- SnackbarErrorAction
-} from '../actions';
-import { AppStore } from '../states/app.state';
import { Store } from '@ngrx/store';
+import { AppStore } from '../states/app.state';
+import {
+ NavigateUrlAction,
+ RouterActionTypes,
+ NavigateRouteAction,
+ NavigateToFolder,
+ NavigateToParentFolder
+} from '../actions/router.actions';
+import { SnackbarErrorAction } from '../actions/snackbar.actions';
@Injectable()
export class RouterEffects {
@@ -52,7 +49,7 @@ export class RouterEffects {
@Effect({ dispatch: false })
navigateUrl$ = this.actions$.pipe(
- ofType(NAVIGATE_URL),
+ ofType(RouterActionTypes.NavigateUrl),
map(action => {
if (action.payload) {
this.router.navigateByUrl(action.payload);
@@ -62,7 +59,7 @@ export class RouterEffects {
@Effect({ dispatch: false })
navigateRoute$ = this.actions$.pipe(
- ofType(NAVIGATE_ROUTE),
+ ofType(RouterActionTypes.NavigateRoute),
map(action => {
this.router.navigate(action.payload);
})
@@ -70,7 +67,7 @@ export class RouterEffects {
@Effect({ dispatch: false })
navigateToFolder$ = this.actions$.pipe(
- ofType(NAVIGATE_FOLDER),
+ ofType(RouterActionTypes.NavigateFolder),
map(action => {
if (action.payload && action.payload.entry) {
this.navigateToFolder(action.payload.entry);
@@ -80,7 +77,7 @@ export class RouterEffects {
@Effect({ dispatch: false })
navigateToParentFolder$ = this.actions$.pipe(
- ofType(NAVIGATE_PARENT_FOLDER),
+ ofType(RouterActionTypes.NavigateParentFolder),
map(action => {
if (action.payload && action.payload.entry) {
this.navigateToParentFolder(action.payload.entry);
diff --git a/src/app/store/effects/snackbar.effects.ts b/projects/aca-shared/store/src/effects/snackbar.effects.ts
similarity index 90%
rename from src/app/store/effects/snackbar.effects.ts
rename to projects/aca-shared/store/src/effects/snackbar.effects.ts
index 4f9e476f6..e81fd42cf 100644
--- a/src/app/store/effects/snackbar.effects.ts
+++ b/projects/aca-shared/store/src/effects/snackbar.effects.ts
@@ -25,20 +25,18 @@
import { TranslationService } from '@alfresco/adf-core';
import { Injectable } from '@angular/core';
-import { MatSnackBar } from '@angular/material';
+import { MatSnackBar } from '@angular/material/snack-bar';
import { Actions, Effect, ofType } from '@ngrx/effects';
import { Store } from '@ngrx/store';
import { map } from 'rxjs/operators';
-import {
- SnackbarAction,
- SnackbarErrorAction,
- SnackbarInfoAction,
- SnackbarWarningAction,
- SNACKBAR_ERROR,
- SNACKBAR_INFO,
- SNACKBAR_WARNING
-} from '../actions';
import { AppStore } from '../states/app.state';
+import {
+ SnackbarInfoAction,
+ SnackbarActionTypes,
+ SnackbarWarningAction,
+ SnackbarErrorAction,
+ SnackbarAction
+} from '../actions/snackbar.actions';
@Injectable()
export class SnackbarEffects {
@@ -51,7 +49,7 @@ export class SnackbarEffects {
@Effect({ dispatch: false })
infoEffect = this.actions$.pipe(
- ofType(SNACKBAR_INFO),
+ ofType(SnackbarActionTypes.Info),
map((action: SnackbarInfoAction) => {
this.showSnackBar(action, 'info-snackbar');
})
@@ -59,7 +57,7 @@ export class SnackbarEffects {
@Effect({ dispatch: false })
warningEffect = this.actions$.pipe(
- ofType(SNACKBAR_WARNING),
+ ofType(SnackbarActionTypes.Warning),
map((action: SnackbarWarningAction) => {
this.showSnackBar(action, 'warning-snackbar');
})
@@ -67,7 +65,7 @@ export class SnackbarEffects {
@Effect({ dispatch: false })
errorEffect = this.actions$.pipe(
- ofType(SNACKBAR_ERROR),
+ ofType(SnackbarActionTypes.Error),
map((action: SnackbarErrorAction) => {
this.showSnackBar(action, 'error-snackbar');
})
diff --git a/src/app/store/models/delete-status.model.ts b/projects/aca-shared/store/src/models/delete-status.model.ts
similarity index 100%
rename from src/app/store/models/delete-status.model.ts
rename to projects/aca-shared/store/src/models/delete-status.model.ts
diff --git a/src/app/store/models/deleted-node-info.model.ts b/projects/aca-shared/store/src/models/deleted-node-info.model.ts
similarity index 100%
rename from src/app/store/models/deleted-node-info.model.ts
rename to projects/aca-shared/store/src/models/deleted-node-info.model.ts
diff --git a/src/app/store/models/node-info.model.ts b/projects/aca-shared/store/src/models/node-info.model.ts
similarity index 100%
rename from src/app/store/models/node-info.model.ts
rename to projects/aca-shared/store/src/models/node-info.model.ts
diff --git a/src/app/store/models/searchOption.model.ts b/projects/aca-shared/store/src/models/search-option.model.ts
similarity index 100%
rename from src/app/store/models/searchOption.model.ts
rename to projects/aca-shared/store/src/models/search-option.model.ts
diff --git a/src/app/store/actions.ts b/projects/aca-shared/store/src/public_api.ts
similarity index 77%
rename from src/app/store/actions.ts
rename to projects/aca-shared/store/src/public_api.ts
index 07a23b8da..0a8d24832 100644
--- a/src/app/store/actions.ts
+++ b/projects/aca-shared/store/src/public_api.ts
@@ -24,15 +24,25 @@
*/
export * from './actions/app.actions';
-export * from './actions/favorite.actions';
-export * from './actions/node.actions';
-export * from './actions/snackbar.actions';
-export * from './actions/router.actions';
-export * from './actions/viewer.actions';
-export * from './actions/search.actions';
export * from './actions/library.actions';
+export * from './actions/node.actions';
+export * from './actions/router.actions';
+export * from './actions/search.actions';
+export * from './actions/snackbar.actions';
export * from './actions/upload.actions';
-export * from './actions/modals.actions';
-export * from './actions/repository.actions';
-export * from './actions/info-drawer.actions';
-export * from './actions/upload.actions';
+export * from './actions/viewer.actions';
+
+export * from './effects/dialog.effects';
+export * from './effects/router.effects';
+export * from './effects/snackbar.effects';
+
+export * from './models/delete-status.model';
+export * from './models/deleted-node-info.model';
+export * from './models/node-info.model';
+export * from './models/search-option.model';
+
+export * from './selectors/app.selectors';
+
+export * from './states/app.state';
+
+export * from './store.module';
diff --git a/src/app/store/selectors/app.selectors.ts b/projects/aca-shared/store/src/selectors/app.selectors.ts
similarity index 74%
rename from src/app/store/selectors/app.selectors.ts
rename to projects/aca-shared/store/src/selectors/app.selectors.ts
index baaa7aad4..fb027a4d5 100644
--- a/src/app/store/selectors/app.selectors.ts
+++ b/projects/aca-shared/store/src/selectors/app.selectors.ts
@@ -23,57 +23,57 @@
* along with Alfresco. If not, see .
*/
-import { createSelector } from '@ngrx/store';
import { AppStore } from '../states/app.state';
+import { createSelector } from '@ngrx/store';
export const selectApp = (state: AppStore) => state.app;
-export const selectHeaderColor = createSelector(
+export const getHeaderColor = createSelector(
selectApp,
state => state.headerColor
);
-export const selectAppName = createSelector(
+export const getAppName = createSelector(
selectApp,
state => state.appName
);
-export const selectLogoPath = createSelector(
+export const getLogoPath = createSelector(
selectApp,
state => state.logoPath
);
-export const appSelection = createSelector(
- selectApp,
- state => state.selection
-);
-
-export const appLanguagePicker = createSelector(
+export const getLanguagePickerState = createSelector(
selectApp,
state => state.languagePicker
);
-export const selectUser = createSelector(
+export const getUserProfile = createSelector(
selectApp,
state => state.user
);
-export const sharedUrl = createSelector(
- selectApp,
- state => state.sharedUrl
-);
-
-export const appNavigation = createSelector(
- selectApp,
- state => state.navigation
-);
-
-export const currentFolder = createSelector(
+export const getCurrentFolder = createSelector(
selectApp,
state => state.navigation.currentFolder
);
-export const infoDrawerOpened = createSelector(
+export const getAppSelection = createSelector(
+ selectApp,
+ state => state.selection
+);
+
+export const getSharedUrl = createSelector(
+ selectApp,
+ state => state.sharedUrl
+);
+
+export const getNavigationState = createSelector(
+ selectApp,
+ state => state.navigation
+);
+
+export const isInfoDrawerOpened = createSelector(
selectApp,
state => state.infoDrawerOpened
);
@@ -83,18 +83,18 @@ export const showFacetFilter = createSelector(
state => state.showFacetFilter
);
-export const documentDisplayMode = createSelector(
+export const getDocumentDisplayMode = createSelector(
selectApp,
state => state.documentDisplayMode
);
-export const repositoryStatus = createSelector(
+export const getRepositoryStatus = createSelector(
selectApp,
state => state.repository
);
export const isQuickShareEnabled = createSelector(
- repositoryStatus,
+ getRepositoryStatus,
info => info.status.isQuickShareEnabled
);
@@ -103,9 +103,9 @@ export const isAdmin = createSelector(
state => state.user.isAdmin
);
-export const sidenavState = createSelector(
- appSelection,
- appNavigation,
+export const getSideNavState = createSelector(
+ getAppSelection,
+ getNavigationState,
(selection, navigation) => {
return {
selection,
@@ -114,11 +114,11 @@ export const sidenavState = createSelector(
}
);
-export const ruleContext = createSelector(
- appSelection,
- appNavigation,
- selectUser,
- repositoryStatus,
+export const getRuleContext = createSelector(
+ getAppSelection,
+ getNavigationState,
+ getUserProfile,
+ getRepositoryStatus,
(selection, navigation, profile, repository) => {
return {
selection,
diff --git a/src/app/store/actions/favorite.actions.ts b/projects/aca-shared/store/src/states/app.state.ts
similarity index 67%
rename from src/app/store/actions/favorite.actions.ts
rename to projects/aca-shared/store/src/states/app.state.ts
index 1c4a23e1d..763920c43 100644
--- a/src/app/store/actions/favorite.actions.ts
+++ b/projects/aca-shared/store/src/states/app.state.ts
@@ -23,18 +23,28 @@
* along with Alfresco. If not, see .
*/
-import { Action } from '@ngrx/store';
-import { MinimalNodeEntity } from '@alfresco/js-api';
+import {
+ SelectionState,
+ ProfileState,
+ NavigationState
+} from '@alfresco/adf-extensions';
+import { RepositoryInfo } from '@alfresco/js-api';
-export const ADD_FAVORITE = 'ADD_FAVORITE';
-export const REMOVE_FAVORITE = 'REMOVE_FAVORITE';
-
-export class AddFavoriteAction implements Action {
- readonly type = ADD_FAVORITE;
- constructor(public payload: Array) {}
+export interface AppState {
+ appName: string;
+ headerColor: string;
+ logoPath: string;
+ languagePicker: boolean;
+ sharedUrl: string;
+ selection: SelectionState;
+ user: ProfileState;
+ navigation: NavigationState;
+ infoDrawerOpened: boolean;
+ showFacetFilter: boolean;
+ documentDisplayMode: string;
+ repository: RepositoryInfo;
}
-export class RemoveFavoriteAction implements Action {
- readonly type = REMOVE_FAVORITE;
- constructor(public payload: Array) {}
+export interface AppStore {
+ app: AppState;
}
diff --git a/src/app/store/actions/repository.actions.ts b/projects/aca-shared/store/src/store.module.ts
similarity index 73%
rename from src/app/store/actions/repository.actions.ts
rename to projects/aca-shared/store/src/store.module.ts
index cc3208341..9e4925069 100644
--- a/src/app/store/actions/repository.actions.ts
+++ b/projects/aca-shared/store/src/store.module.ts
@@ -23,12 +23,15 @@
* along with Alfresco. If not, see .
*/
-import { Action } from '@ngrx/store';
-import { RepositoryInfo } from '@alfresco/js-api';
+import { NgModule } from '@angular/core';
+import { EffectsModule } from '@ngrx/effects';
+import { SnackbarEffects } from './effects/snackbar.effects';
+import { DialogEffects } from './effects/dialog.effects';
+import { RouterEffects } from './effects/router.effects';
-export const SET_REPOSITORY_INFO = 'SET_REPOSITORY_INFO';
-
-export class SetRepositoryInfoAction implements Action {
- readonly type = SET_REPOSITORY_INFO;
- constructor(public payload: RepositoryInfo) {}
-}
+@NgModule({
+ imports: [
+ EffectsModule.forFeature([SnackbarEffects, DialogEffects, RouterEffects])
+ ]
+})
+export class SharedStoreModule {}
diff --git a/projects/aca-shared/test.ts b/projects/aca-shared/test.ts
new file mode 100644
index 000000000..e11ff1c97
--- /dev/null
+++ b/projects/aca-shared/test.ts
@@ -0,0 +1,22 @@
+// This file is required by karma.conf.js and loads recursively all the .spec and framework files
+
+import 'core-js/es7/reflect';
+import 'zone.js/dist/zone';
+import 'zone.js/dist/zone-testing';
+import { getTestBed } from '@angular/core/testing';
+import {
+ BrowserDynamicTestingModule,
+ platformBrowserDynamicTesting
+} from '@angular/platform-browser-dynamic/testing';
+
+declare const require: any;
+
+// First, initialize the Angular testing environment.
+getTestBed().initTestEnvironment(
+ BrowserDynamicTestingModule,
+ platformBrowserDynamicTesting()
+);
+// Then we find all the tests.
+const context = require.context('./', true, /\.spec\.ts$/);
+// And load the modules.
+context.keys().map(context);
diff --git a/projects/aca-shared/tsconfig.lib.json b/projects/aca-shared/tsconfig.lib.json
new file mode 100644
index 000000000..f407ef6a4
--- /dev/null
+++ b/projects/aca-shared/tsconfig.lib.json
@@ -0,0 +1,29 @@
+{
+ "extends": "../../tsconfig.json",
+ "compilerOptions": {
+ "outDir": "../../out-tsc/lib",
+ "target": "es2015",
+ "module": "es2015",
+ "moduleResolution": "node",
+ "declaration": true,
+ "sourceMap": true,
+ "inlineSources": true,
+ "emitDecoratorMetadata": true,
+ "experimentalDecorators": true,
+ "importHelpers": true,
+ "types": [],
+ "lib": ["dom", "es2018"],
+ "paths": {
+ "@alfresco/aca-shared/*": ["./*"]
+ }
+ },
+ "angularCompilerOptions": {
+ "annotateForClosureCompiler": true,
+ "skipTemplateCodegen": true,
+ "strictMetadataEmit": true,
+ "fullTemplateTypeCheck": true,
+ "strictInjectionParameters": true,
+ "enableResourceInlining": true
+ },
+ "exclude": ["test.ts", "**/*.spec.ts"]
+}
diff --git a/projects/aca-shared/tsconfig.spec.json b/projects/aca-shared/tsconfig.spec.json
new file mode 100644
index 000000000..c1d29e83b
--- /dev/null
+++ b/projects/aca-shared/tsconfig.spec.json
@@ -0,0 +1,9 @@
+{
+ "extends": "../../tsconfig.json",
+ "compilerOptions": {
+ "outDir": "../../out-tsc/spec",
+ "types": ["jasmine", "node"]
+ },
+ "files": ["test.ts"],
+ "include": ["**/*.spec.ts", "**/*.d.ts"]
+}
diff --git a/projects/aca-shared/tslint.json b/projects/aca-shared/tslint.json
new file mode 100644
index 000000000..fdc7ace61
--- /dev/null
+++ b/projects/aca-shared/tslint.json
@@ -0,0 +1,7 @@
+{
+ "extends": "../../tslint.json",
+ "rules": {
+ "directive-selector": [true, "attribute", "aca", "camelCase"],
+ "component-selector": [true, "element", "aca", "kebab-case"]
+ }
+}
diff --git a/projects/adf-office-services-ext/package.json b/projects/adf-office-services-ext/package.json
index 849fd06b6..2d4e11c5f 100644
--- a/projects/adf-office-services-ext/package.json
+++ b/projects/adf-office-services-ext/package.json
@@ -2,17 +2,6 @@
"name": "@alfresco/adf-office-services-ext",
"version": "0.0.6",
"license": "Apache-2.0",
- "author": {
- "name": "Keensoft",
- "url": "http://www.keensoft.es/en/"
- },
- "contributors": [
- {
- "name": "Denys Vuika",
- "email": "denys.vuka@gmail.com",
- "url": "https://medium.com/@denysvuika"
- }
- ],
"homepage": "https://github.com/Alfresco/alfresco-content-app",
"keywords": ["Alfresco", "ADF", "ACA", "Content Application"],
"peerDependencies": {
diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts
index 368016e76..b5c55f0bc 100644
--- a/src/app/app.component.spec.ts
+++ b/src/app/app.component.spec.ts
@@ -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;
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index f78f01bd7..0295f2702 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -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',
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index c8068b034..d74c50003 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -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,
diff --git a/src/app/app.routes.ts b/src/app/app.routes.ts
index 0fa7814d4..92da4e42f 100644
--- a/src/app/app.routes.ts
+++ b/src/app/app.routes.ts
@@ -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 = [
diff --git a/src/app/components/about/about.component.html b/src/app/components/about/about.component.html
index 80891c6d2..643e33c9c 100644
--- a/src/app/components/about/about.component.html
+++ b/src/app/components/about/about.component.html
@@ -1,5 +1,5 @@
-
-
+
+
{{ 'application.name' | adfAppConfig }}
@@ -43,5 +43,5 @@
-
-
+
+
diff --git a/src/app/components/about/about.component.ts b/src/app/components/about/about.component.ts
index c6e172099..eb28b814e 100644
--- a/src/app/components/about/about.component.ts
+++ b/src/app/components/about/about.component.ts
@@ -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',
diff --git a/src/app/components/about/about.module.ts b/src/app/components/about/about.module.ts
index aa2fd1bea..2af7d5087 100644
--- a/src/app/components/about/about.module.ts
+++ b/src/app/components/about/about.module.ts
@@ -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';
diff --git a/src/app/components/common/common.module.ts b/src/app/components/common/common.module.ts
index c1a0973e7..fbda679d4 100644
--- a/src/app/components/common/common.module.ts
+++ b/src/app/components/common/common.module.ts
@@ -23,23 +23,22 @@
* along with Alfresco. If not, see .
*/
-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 {}
diff --git a/src/app/components/common/generic-error/generic-error.component.theme.scss b/src/app/components/common/generic-error/generic-error.component.theme.scss
deleted file mode 100644
index d921cc072..000000000
--- a/src/app/components/common/generic-error/generic-error.component.theme.scss
+++ /dev/null
@@ -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;
- }
- }
-}
diff --git a/src/app/components/common/location-link/location-link.component.ts b/src/app/components/common/location-link/location-link.component.ts
index 5e9839d95..147dca68e 100644
--- a/src/app/components/common/location-link/location-link.component.ts
+++ b/src/app/components/common/location-link/location-link.component.ts
@@ -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({
diff --git a/src/app/components/context-menu/context-menu.component.ts b/src/app/components/context-menu/context-menu.component.ts
index c657770e0..4fae5f538 100644
--- a/src/app/components/context-menu/context-menu.component.ts
+++ b/src/app/components/context-menu/context-menu.component.ts
@@ -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) {
diff --git a/src/app/components/context-menu/context-menu.module.ts b/src/app/components/context-menu/context-menu.module.ts
index 90b203d42..a6f298bd9 100644
--- a/src/app/components/context-menu/context-menu.module.ts
+++ b/src/app/components/context-menu/context-menu.module.ts
@@ -23,22 +23,19 @@
* along with Alfresco. If not, see .
*/
-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: [
diff --git a/src/app/components/create-menu/create-menu.component.ts b/src/app/components/create-menu/create-menu.component.ts
index a57b6dfd8..158c95331 100644
--- a/src/app/components/create-menu/create-menu.component.ts
+++ b/src/app/components/create-menu/create-menu.component.ts
@@ -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();
diff --git a/src/app/components/current-user/current-user.component.ts b/src/app/components/current-user/current-user.component.ts
index 64750e9ab..8016bc6a6 100644
--- a/src/app/components/current-user/current-user.component.ts
+++ b/src/app/components/current-user/current-user.component.ts
@@ -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, 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() {
diff --git a/src/app/components/dl-custom-components/name-column/name-column.component.ts b/src/app/components/dl-custom-components/name-column/name-column.component.ts
index 6c24c8e9d..574ff07ed 100644
--- a/src/app/components/dl-custom-components/name-column/name-column.component.ts
+++ b/src/app/components/dl-custom-components/name-column/name-column.component.ts
@@ -28,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(EDIT_OFFLINE),
+ ofType(NodeActionTypes.EditOffline),
filter(val => {
return this.node.entry.id === val.payload.entry.id;
}),
diff --git a/src/app/components/favorite-libraries/favorite-libraries.component.html b/src/app/components/favorite-libraries/favorite-libraries.component.html
index dc5a8606e..bfd55f129 100644
--- a/src/app/components/favorite-libraries/favorite-libraries.component.html
+++ b/src/app/components/favorite-libraries/favorite-libraries.component.html
@@ -1,5 +1,5 @@
-
-
+
+
@@ -8,9 +8,9 @@
-
+
-
+
-
-
+
+
diff --git a/src/app/components/favorite-libraries/favorite-libraries.component.spec.ts b/src/app/components/favorite-libraries/favorite-libraries.component.spec.ts
index 25c9d64e4..3671bb482 100644
--- a/src/app/components/favorite-libraries/favorite-libraries.component.spec.ts
+++ b/src/app/components/favorite-libraries/favorite-libraries.component.spec.ts
@@ -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;
diff --git a/src/app/components/favorite-libraries/favorite-libraries.component.ts b/src/app/components/favorite-libraries/favorite-libraries.component.ts
index dbeb30975..aad1a83fd 100644
--- a/src/app/components/favorite-libraries/favorite-libraries.component.ts
+++ b/src/app/components/favorite-libraries/favorite-libraries.component.ts
@@ -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,
+ store: Store,
extensions: AppExtensionService,
private contentApiService: ContentApiService,
private breakpointObserver: BreakpointObserver,
diff --git a/src/app/components/favorites/favorites.component.html b/src/app/components/favorites/favorites.component.html
index 264653ba6..bcad87fe7 100644
--- a/src/app/components/favorites/favorites.component.html
+++ b/src/app/components/favorites/favorites.component.html
@@ -1,5 +1,5 @@
-
-
+
+
@@ -7,9 +7,9 @@
-
+
-
+
-
-
+
+
diff --git a/src/app/components/favorites/favorites.component.spec.ts b/src/app/components/favorites/favorites.component.spec.ts
index c2e3efe17..36c4bcfe0 100644
--- a/src/app/components/favorites/favorites.component.spec.ts
+++ b/src/app/components/favorites/favorites.component.spec.ts
@@ -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;
diff --git a/src/app/components/favorites/favorites.component.ts b/src/app/components/favorites/favorites.component.ts
index 6cedd515d..b95691714 100644
--- a/src/app/components/favorites/favorites.component.ts
+++ b/src/app/components/favorites/favorites.component.ts
@@ -23,23 +23,23 @@
* along with Alfresco. If not, see .
*/
-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'
diff --git a/src/app/components/files/files.component.html b/src/app/components/files/files.component.html
index d830a3bc7..6fb5b6a3b 100644
--- a/src/app/components/files/files.component.html
+++ b/src/app/components/files/files.component.html
@@ -1,5 +1,5 @@
-
-
+
+
-
+
-
+
-
+
-
+
-
-
+
+
diff --git a/src/app/components/files/files.component.spec.ts b/src/app/components/files/files.component.spec.ts
index 114e642e9..4f3486372 100644
--- a/src/app/components/files/files.component.spec.ts
+++ b/src/app/components/files/files.component.spec.ts
@@ -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', () => {
diff --git a/src/app/components/files/files.component.ts b/src/app/components/files/files.component.ts
index 4aaa12f79..7aedc31dd 100644
--- a/src/app/components/files/files.component.ts
+++ b/src/app/components/files/files.component.ts
@@ -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({
diff --git a/src/app/components/header/header.component.ts b/src/app/components/header/header.component.ts
index b22cfd55b..c592a9ecc 100644
--- a/src/app/components/header/header.component.ts
+++ b/src/app/components/header/header.component.ts
@@ -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,
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() {
diff --git a/src/app/components/info-drawer/comments-tab/comments-tab.component.spec.ts b/src/app/components/info-drawer/comments-tab/comments-tab.component.spec.ts
index 64a45ccbf..35a502ff1 100644
--- a/src/app/components/info-drawer/comments-tab/comments-tab.component.spec.ts
+++ b/src/app/components/info-drawer/comments-tab/comments-tab.component.spec.ts
@@ -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;
diff --git a/src/app/components/info-drawer/comments-tab/comments-tab.component.ts b/src/app/components/info-drawer/comments-tab/comments-tab.component.ts
index ec43ea1cd..aef6adb6e 100644
--- a/src/app/components/info-drawer/comments-tab/comments-tab.component.ts
+++ b/src/app/components/info-drawer/comments-tab/comments-tab.component.ts
@@ -25,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({
diff --git a/src/app/components/info-drawer/info-drawer.component.spec.ts b/src/app/components/info-drawer/info-drawer.component.spec.ts
index 35ab269b5..57a442605 100644
--- a/src/app/components/info-drawer/info-drawer.component.spec.ts
+++ b/src/app/components/info-drawer/info-drawer.component.spec.ts
@@ -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', () => {
diff --git a/src/app/components/info-drawer/info-drawer.component.ts b/src/app/components/info-drawer/info-drawer.component.ts
index d182ebfa3..55c3b80d2 100644
--- a/src/app/components/info-drawer/info-drawer.component.ts
+++ b/src/app/components/info-drawer/info-drawer.component.ts
@@ -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',
diff --git a/src/app/components/info-drawer/library-metadata-tab/library-metadata-form.component.spec.ts b/src/app/components/info-drawer/library-metadata-tab/library-metadata-form.component.spec.ts
index 3449c7a62..a35a7c1c5 100644
--- a/src/app/components/info-drawer/library-metadata-tab/library-metadata-form.component.spec.ts
+++ b/src/app/components/info-drawer/library-metadata-tab/library-metadata-form.component.spec.ts
@@ -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';
diff --git a/src/app/components/info-drawer/library-metadata-tab/library-metadata-form.component.ts b/src/app/components/info-drawer/library-metadata-tab/library-metadata-form.component.ts
index 9b0f99502..f9eb73ea1 100644
--- a/src/app/components/info-drawer/library-metadata-tab/library-metadata-form.component.ts
+++ b/src/app/components/info-drawer/library-metadata-tab/library-metadata-form.component.ts
@@ -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';
diff --git a/src/app/components/info-drawer/metadata-tab/metadata-tab.component.spec.ts b/src/app/components/info-drawer/metadata-tab/metadata-tab.component.spec.ts
index 4a1131438..614658e4a 100644
--- a/src/app/components/info-drawer/metadata-tab/metadata-tab.component.spec.ts
+++ b/src/app/components/info-drawer/metadata-tab/metadata-tab.component.spec.ts
@@ -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', () => {
diff --git a/src/app/components/info-drawer/metadata-tab/metadata-tab.component.ts b/src/app/components/info-drawer/metadata-tab/metadata-tab.component.ts
index 1183249f0..040ed7fa3 100644
--- a/src/app/components/info-drawer/metadata-tab/metadata-tab.component.ts
+++ b/src/app/components/info-drawer/metadata-tab/metadata-tab.component.ts
@@ -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';
diff --git a/src/app/components/layout/app-layout/app-layout.component.spec.ts b/src/app/components/layout/app-layout/app-layout.component.spec.ts
index a5386f56e..7e52c3ad3 100644
--- a/src/app/components/layout/app-layout/app-layout.component.spec.ts
+++ b/src/app/components/layout/app-layout/app-layout.component.spec.ts
@@ -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();
});
diff --git a/src/app/components/layout/app-layout/app-layout.component.ts b/src/app/components/layout/app-layout/app-layout.component.ts
index 1dbe0aa32..9fb1ea3b6 100644
--- a/src/app/components/layout/app-layout/app-layout.component.ts
+++ b/src/app/components/layout/app-layout/app-layout.component.ts
@@ -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;
diff --git a/src/app/components/layout/layout.module.ts b/src/app/components/layout/layout.module.ts
index cace44c97..5464a73b1 100644
--- a/src/app/components/layout/layout.module.ts
+++ b/src/app/components/layout/layout.module.ts
@@ -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 {}
diff --git a/src/app/components/layout/layout.theme.scss b/src/app/components/layout/layout.theme.scss
index e9914e610..bc73d98ef 100644
--- a/src/app/components/layout/layout.theme.scss
+++ b/src/app/components/layout/layout.theme.scss
@@ -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);
}
diff --git a/src/app/components/layout/page-layout/page-layout.component.html b/src/app/components/layout/page-layout/page-layout.component.html
deleted file mode 100644
index cee7682ac..000000000
--- a/src/app/components/layout/page-layout/page-layout.component.html
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/src/app/components/layout/page-layout/page-layout.theme.scss b/src/app/components/layout/page-layout/page-layout.theme.scss
deleted file mode 100644
index 4571bd774..000000000
--- a/src/app/components/layout/page-layout/page-layout.theme.scss
+++ /dev/null
@@ -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;
- }
- }
-}
diff --git a/src/app/components/libraries/libraries.component.html b/src/app/components/libraries/libraries.component.html
index 03833f5f6..d76c9054a 100644
--- a/src/app/components/libraries/libraries.component.html
+++ b/src/app/components/libraries/libraries.component.html
@@ -1,5 +1,5 @@
-
-
+
+
@@ -8,9 +8,9 @@
-
+
-
+
-
-
+
+
diff --git a/src/app/components/libraries/libraries.component.ts b/src/app/components/libraries/libraries.component.ts
index f22b2ad9b..a5747ddb1 100644
--- a/src/app/components/libraries/libraries.component.ts
+++ b/src/app/components/libraries/libraries.component.ts
@@ -23,14 +23,13 @@
* along with Alfresco. If not, see .
*/
+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({
diff --git a/src/app/components/page.component.ts b/src/app/components/page.component.ts
index 42b979be7..62879bc51 100644
--- a/src/app/components/page.component.ts
+++ b/src/app/components/page.component.ts
@@ -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);
diff --git a/src/app/components/permissions/permission-dialog/node-permissions.dialog.ts b/src/app/components/permissions/permission-dialog/node-permissions.dialog.ts
index 7692e0471..21964cf2e 100644
--- a/src/app/components/permissions/permission-dialog/node-permissions.dialog.ts
+++ b/src/app/components/permissions/permission-dialog/node-permissions.dialog.ts
@@ -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',
diff --git a/src/app/components/permissions/permission-manager/permission-manager.component.ts b/src/app/components/permissions/permission-manager/permission-manager.component.ts
index 3dd7d02fe..90586a6cf 100644
--- a/src/app/components/permissions/permission-manager/permission-manager.component.ts
+++ b/src/app/components/permissions/permission-manager/permission-manager.component.ts
@@ -23,17 +23,16 @@
* along with Alfresco. If not, see .
*/
+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({
diff --git a/src/app/components/preview/preview.component.spec.ts b/src/app/components/preview/preview.component.spec.ts
index 3812d1205..fcac4d2f4 100644
--- a/src/app/components/preview/preview.component.spec.ts
+++ b/src/app/components/preview/preview.component.spec.ts
@@ -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', () => {
diff --git a/src/app/components/preview/preview.component.ts b/src/app/components/preview/preview.component.ts
index 376ebbd13..97fdf7f93 100644
--- a/src/app/components/preview/preview.component.ts
+++ b/src/app/components/preview/preview.component.ts
@@ -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';
diff --git a/src/app/components/recent-files/recent-files.component.html b/src/app/components/recent-files/recent-files.component.html
index 02e53c2cf..cfe0a2036 100644
--- a/src/app/components/recent-files/recent-files.component.html
+++ b/src/app/components/recent-files/recent-files.component.html
@@ -1,5 +1,5 @@
-
-
+
+
@@ -7,9 +7,9 @@
-
+
-
+
-
-
+
+
diff --git a/src/app/components/recent-files/recent-files.component.ts b/src/app/components/recent-files/recent-files.component.ts
index d51203eca..9731088df 100644
--- a/src/app/components/recent-files/recent-files.component.ts
+++ b/src/app/components/recent-files/recent-files.component.ts
@@ -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';
diff --git a/src/app/components/search/search-input/search-input.component.spec.ts b/src/app/components/search/search-input/search-input.component.spec.ts
index 785e254b2..184ce28f5 100644
--- a/src/app/components/search/search-input/search-input.component.spec.ts
+++ b/src/app/components/search/search-input/search-input.component.spec.ts
@@ -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(SEARCH_BY_TERM),
+ ofType(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(SEARCH_BY_TERM),
+ ofType(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(SEARCH_BY_TERM),
+ ofType(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(SEARCH_BY_TERM),
+ ofType(SearchActionTypes.SearchByTerm),
map(action => {
expect(action.payload).toBe(searchedTerm);
done();
diff --git a/src/app/components/search/search-input/search-input.component.ts b/src/app/components/search/search-input/search-input.component.ts
index 83e563af9..bb9b0c71e 100644
--- a/src/app/components/search/search-input/search-input.component.ts
+++ b/src/app/components/search/search-input/search-input.component.ts
@@ -23,6 +23,14 @@
* along with Alfresco. If not, see .
*/
+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',
diff --git a/src/app/components/search/search-libraries-results/search-libraries-results.component.html b/src/app/components/search/search-libraries-results/search-libraries-results.component.html
index f00954e45..bbeb1ca05 100644
--- a/src/app/components/search/search-libraries-results/search-libraries-results.component.html
+++ b/src/app/components/search/search-libraries-results/search-libraries-results.component.html
@@ -1,14 +1,14 @@
-
-
+
+
-
+
-
+
@@ -123,5 +123,5 @@
-
-
+
+
diff --git a/src/app/components/search/search-libraries-results/search-libraries-results.component.ts b/src/app/components/search/search-libraries-results/search-libraries-results.component.ts
index 4b7ecdb6a..87afb8513 100644
--- a/src/app/components/search/search-libraries-results/search-libraries-results.component.ts
+++ b/src/app/components/search/search-libraries-results/search-libraries-results.component.ts
@@ -23,17 +23,17 @@
* along with Alfresco. If not, see
.
*/
-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',
diff --git a/src/app/components/search/search-results-row/search-results-row.component.ts b/src/app/components/search/search-results-row/search-results-row.component.ts
index bdc72dffc..7cdb41f69 100644
--- a/src/app/components/search/search-results-row/search-results-row.component.ts
+++ b/src/app/components/search/search-results-row/search-results-row.component.ts
@@ -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';
diff --git a/src/app/components/search/search-results/search-results.component.html b/src/app/components/search/search-results/search-results.component.html
index 824ec2513..7e5cee9c2 100644
--- a/src/app/components/search/search-results/search-results.component.html
+++ b/src/app/components/search/search-results/search-results.component.html
@@ -1,14 +1,14 @@
-
-
+
+
-
+
-
+
-
-
+
+
diff --git a/src/app/components/search/search-results/search-results.component.spec.ts b/src/app/components/search/search-results/search-results.component.spec.ts
index e7e5c71b9..cca5ed600 100644
--- a/src/app/components/search/search-results/search-results.component.spec.ts
+++ b/src/app/components/search/search-results/search-results.component.spec.ts
@@ -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';
diff --git a/src/app/components/search/search-results/search-results.component.ts b/src/app/components/search/search-results/search-results.component.ts
index 2b419dd44..bef44362f 100644
--- a/src/app/components/search/search-results/search-results.component.ts
+++ b/src/app/components/search/search-results/search-results.component.ts
@@ -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',
diff --git a/src/app/components/settings/settings.component.ts b/src/app/components/settings/settings.component.ts
index c0e6f1733..157b03ca9 100644
--- a/src/app/components/settings/settings.component.ts
+++ b/src/app/components/settings/settings.component.ts
@@ -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() {
diff --git a/src/app/components/shared-files/shared-files.component.html b/src/app/components/shared-files/shared-files.component.html
index 2d748e83a..98a111432 100644
--- a/src/app/components/shared-files/shared-files.component.html
+++ b/src/app/components/shared-files/shared-files.component.html
@@ -1,5 +1,5 @@
-
-
+
+
@@ -7,9 +7,9 @@
-
+
-
+
-
-
+
+
diff --git a/src/app/components/shared-files/shared-files.component.ts b/src/app/components/shared-files/shared-files.component.ts
index 3229cb401..ba5d3c7a5 100644
--- a/src/app/components/shared-files/shared-files.component.ts
+++ b/src/app/components/shared-files/shared-files.component.ts
@@ -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
,
+ store: Store,
extensions: AppExtensionService,
content: ContentManagementService,
private uploadService: UploadService,
diff --git a/src/app/components/shared-link-view/shared-link-view.component.spec.ts b/src/app/components/shared-link-view/shared-link-view.component.spec.ts
index 0cb20d044..6b622c51c 100644
--- a/src/app/components/shared-link-view/shared-link-view.component.spec.ts
+++ b/src/app/components/shared-link-view/shared-link-view.component.spec.ts
@@ -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', () => {
diff --git a/src/app/components/shared-link-view/shared-link-view.component.ts b/src/app/components/shared-link-view/shared-link-view.component.ts
index b77aacd9c..f7c4edec1 100644
--- a/src/app/components/shared-link-view/shared-link-view.component.ts
+++ b/src/app/components/shared-link-view/shared-link-view.component.ts
@@ -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 .
+ */
+
+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();
});
diff --git a/src/app/components/shared/content-node-share/content-node-share.dialog.spec.ts b/src/app/components/shared/content-node-share/content-node-share.dialog.spec.ts
index 873aad179..3f3a3af58 100644
--- a/src/app/components/shared/content-node-share/content-node-share.dialog.spec.ts
+++ b/src/app/components/shared/content-node-share/content-node-share.dialog.spec.ts
@@ -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,
diff --git a/src/app/components/shared/content-node-share/content-node-share.dialog.ts b/src/app/components/shared/content-node-share/content-node-share.dialog.ts
index ecdf01365..43455dfa2 100644
--- a/src/app/components/shared/content-node-share/content-node-share.dialog.ts
+++ b/src/app/components/shared/content-node-share/content-node-share.dialog.ts
@@ -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,
diff --git a/src/app/components/shared/toggle-shared/toggle-shared.component.ts b/src/app/components/shared/toggle-shared/toggle-shared.component.ts
index e61821454..ca3968859 100644
--- a/src/app/components/shared/toggle-shared/toggle-shared.component.ts
+++ b/src/app/components/shared/toggle-shared/toggle-shared.component.ts
@@ -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) {}
ngOnInit() {
- this.selection$ = this.store.select(appSelection);
+ this.selection$ = this.store.select(getAppSelection);
}
isShared(selection: SelectionState) {
diff --git a/src/app/components/sidenav/directives/action.directive.ts b/src/app/components/sidenav/directives/action.directive.ts
index bc201ea8e..7ca148891 100644
--- a/src/app/components/sidenav/directives/action.directive.ts
+++ b/src/app/components/sidenav/directives/action.directive.ts
@@ -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) {}
-
- private dispatchAction(action) {
- this.store.dispatch({
- type: action.action,
- payload: this.getNavigationCommands(action.payload)
- });
- }
+ constructor(private router: Router, private store: Store) {}
private getNavigationCommands(url: string): any[] {
const urlTree = this.router.parseUrl(url);
diff --git a/src/app/components/sidenav/directives/expansion-panel.directive.ts b/src/app/components/sidenav/directives/expansion-panel.directive.ts
index 86640f308..693d13113 100644
--- a/src/app/components/sidenav/directives/expansion-panel.directive.ts
+++ b/src/app/components/sidenav/directives/expansion-panel.directive.ts
@@ -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,
+ private store: Store,
private router: Router,
private expansionPanel: MatExpansionPanel
) {}
diff --git a/src/app/components/sidenav/directives/menu-panel.directive.ts b/src/app/components/sidenav/directives/menu-panel.directive.ts
index 154bfbd76..956297cac 100644
--- a/src/app/components/sidenav/directives/menu-panel.directive.ts
+++ b/src/app/components/sidenav/directives/menu-panel.directive.ts
@@ -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, private router: Router) {}
+ constructor(private store: Store, private router: Router) {}
hasActiveLinks() {
if (this.acaMenuPanel && this.acaMenuPanel.children) {
diff --git a/src/app/components/sidenav/sidenav.component.ts b/src/app/components/sidenav/sidenav.component.ts
index 9c2a8c3a1..83179b534 100755
--- a/src/app/components/sidenav/sidenav.component.ts
+++ b/src/app/components/sidenav/sidenav.component.ts
@@ -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(),
diff --git a/src/app/components/toolbar/document-display-mode/document-display-mode.component.ts b/src/app/components/toolbar/document-display-mode/document-display-mode.component.ts
index 5a241c655..124a9a7dc 100644
--- a/src/app/components/toolbar/document-display-mode/document-display-mode.component.ts
+++ b/src/app/components/toolbar/document-display-mode/document-display-mode.component.ts
@@ -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;
constructor(private store: Store) {
- this.displayMode$ = store.select(documentDisplayMode);
+ this.displayMode$ = store.select(getDocumentDisplayMode);
}
onClick() {
diff --git a/src/app/components/toolbar/toggle-edit-offline/toggle-edit-offline.component.spec.ts b/src/app/components/toolbar/toggle-edit-offline/toggle-edit-offline.component.spec.ts
index 119e80a62..0f089ca92 100644
--- a/src/app/components/toolbar/toggle-edit-offline/toggle-edit-offline.component.spec.ts
+++ b/src/app/components/toolbar/toggle-edit-offline/toggle-edit-offline.component.spec.ts
@@ -33,7 +33,7 @@ import {
DownloadNodesAction,
EditOfflineAction,
SnackbarErrorAction
-} from '../../../store/actions';
+} from '@alfresco/aca-shared/store';
describe('ToggleEditOfflineComponent', () => {
let fixture;
diff --git a/src/app/components/toolbar/toggle-edit-offline/toggle-edit-offline.component.ts b/src/app/components/toolbar/toggle-edit-offline/toggle-edit-offline.component.ts
index 26f4c8157..bead7cbde 100644
--- a/src/app/components/toolbar/toggle-edit-offline/toggle-edit-offline.component.ts
+++ b/src/app/components/toolbar/toggle-edit-offline/toggle-edit-offline.component.ts
@@ -23,16 +23,16 @@
* along with Alfresco. If not, see .
*/
-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) {}
ngOnInit() {
- this.store.select(appSelection).subscribe(({ file }) => {
+ this.store.select(getAppSelection).subscribe(({ file }) => {
this.selection = file;
});
}
diff --git a/src/app/components/toolbar/toggle-favorite-library/toggle-favorite-library.component.ts b/src/app/components/toolbar/toggle-favorite-library/toggle-favorite-library.component.ts
index df7759828..d2c0d734f 100644
--- a/src/app/components/toolbar/toggle-favorite-library/toggle-favorite-library.component.ts
+++ b/src/app/components/toolbar/toggle-favorite-library/toggle-favorite-library.component.ts
@@ -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
diff --git a/src/app/components/toolbar/toggle-favorite/toggle-favorite.component.ts b/src/app/components/toolbar/toggle-favorite/toggle-favorite.component.ts
index 37ae414fe..32498c979 100644
--- a/src/app/components/toolbar/toggle-favorite/toggle-favorite.component.ts
+++ b/src/app/components/toolbar/toggle-favorite/toggle-favorite.component.ts
@@ -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;
constructor(private store: Store) {
- this.selection$ = this.store.select(appSelection);
+ this.selection$ = this.store.select(getAppSelection);
}
onToggleEvent() {
diff --git a/src/app/components/toolbar/toggle-info-drawer/toggle-info-drawer.component.ts b/src/app/components/toolbar/toggle-info-drawer/toggle-info-drawer.component.ts
index 174df9090..2c268e305 100644
--- a/src/app/components/toolbar/toggle-info-drawer/toggle-info-drawer.component.ts
+++ b/src/app/components/toolbar/toggle-info-drawer/toggle-info-drawer.component.ts
@@ -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;
- constructor(private store: Store) {
- this.infoDrawerOpened$ = this.store.select(infoDrawerOpened);
+ constructor(private store: Store) {
+ this.infoDrawerOpened$ = this.store.select(isInfoDrawerOpened);
}
onClick() {
diff --git a/src/app/components/toolbar/toggle-join-library/toggle-join-library-button.component.ts b/src/app/components/toolbar/toggle-join-library/toggle-join-library-button.component.ts
index 44d015269..a5313da09 100644
--- a/src/app/components/toolbar/toggle-join-library/toggle-join-library-button.component.ts
+++ b/src/app/components/toolbar/toggle-join-library/toggle-join-library-button.component.ts
@@ -23,22 +23,22 @@
* along with Alfresco. If not, see .
*/
+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,
private content: ContentManagementService
) {
- this.selection$ = this.store.select(appSelection);
+ this.selection$ = this.store.select(getAppSelection);
}
onToggleEvent(event: LibraryMembershipToggleEvent) {
diff --git a/src/app/components/toolbar/toggle-join-library/toggle-join-library-menu.component.ts b/src/app/components/toolbar/toggle-join-library/toggle-join-library-menu.component.ts
index 2c90969c0..57281e195 100644
--- a/src/app/components/toolbar/toggle-join-library/toggle-join-library-menu.component.ts
+++ b/src/app/components/toolbar/toggle-join-library/toggle-join-library-menu.component.ts
@@ -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';
diff --git a/src/app/components/toolbar/toggle-join-library/toggle-join-library.component.spec.ts b/src/app/components/toolbar/toggle-join-library/toggle-join-library.component.spec.ts
index 753495afb..a0c9c9c10 100644
--- a/src/app/components/toolbar/toggle-join-library/toggle-join-library.component.spec.ts
+++ b/src/app/components/toolbar/toggle-join-library/toggle-join-library.component.spec.ts
@@ -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';
diff --git a/src/app/components/trashcan/trashcan.component.html b/src/app/components/trashcan/trashcan.component.html
index 032009ebf..37f87576b 100644
--- a/src/app/components/trashcan/trashcan.component.html
+++ b/src/app/components/trashcan/trashcan.component.html
@@ -1,5 +1,5 @@
-
-
+
+
@@ -7,9 +7,9 @@
-
+
-
+
-
-
+
+
diff --git a/src/app/components/trashcan/trashcan.component.ts b/src/app/components/trashcan/trashcan.component.ts
index 0e0e6aa4d..b830c5555 100644
--- a/src/app/components/trashcan/trashcan.component.ts
+++ b/src/app/components/trashcan/trashcan.component.ts
@@ -23,16 +23,15 @@
* along with Alfresco. If not, see .
*/
-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() {
diff --git a/src/app/components/viewer/viewer.component.ts b/src/app/components/viewer/viewer.component.ts
index c50d28cee..3a08068e2 100644
--- a/src/app/components/viewer/viewer.component.ts
+++ b/src/app/components/viewer/viewer.component.ts
@@ -23,21 +23,21 @@
* along with Alfresco. If not, see .
*/
-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;
diff --git a/src/app/dialogs/node-versions/node-versions.dialog.ts b/src/app/dialogs/node-versions/node-versions.dialog.ts
index 1a7935794..d88292520 100644
--- a/src/app/dialogs/node-versions/node-versions.dialog.ts
+++ b/src/app/dialogs/node-versions/node-versions.dialog.ts
@@ -23,12 +23,11 @@
* along with Alfresco. If not, see .
*/
-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
- ) {
+ constructor(@Inject(MAT_DIALOG_DATA) data: any, private store: Store) {
this.node = data.node;
}
diff --git a/src/app/directives/document-list.directive.ts b/src/app/directives/document-list.directive.ts
index ae0d64137..4468561ce 100644
--- a/src/app/directives/document-list.directive.ts
+++ b/src/app/directives/document-list.directive.ts
@@ -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';
diff --git a/src/app/extensions/core.extensions.module.ts b/src/app/extensions/core.extensions.module.ts
index 6baca9af5..f7332d8ec 100644
--- a/src/app/extensions/core.extensions.module.ts
+++ b/src/app/extensions/core.extensions.module.ts
@@ -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
});
}
}
diff --git a/src/app/extensions/extension.service.spec.ts b/src/app/extensions/extension.service.spec.ts
index 085ab7df4..cd23575f2 100644
--- a/src/app/extensions/extension.service.spec.ts
+++ b/src/app/extensions/extension.service.spec.ts
@@ -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,
diff --git a/src/app/extensions/extension.service.ts b/src/app/extensions/extension.service.ts
index 380f9eff9..d8cba2084 100644
--- a/src/app/extensions/extension.service.ts
+++ b/src/app/extensions/extension.service.ts
@@ -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;
diff --git a/src/app/material.module.ts b/src/app/material.module.ts
index 397e6d222..2caa53326 100644
--- a/src/app/material.module.ts
+++ b/src/app/material.module.ts
@@ -24,16 +24,16 @@
*/
import { NgModule } from '@angular/core';
+import { MatMenuModule } from '@angular/material/menu';
+import { MatIconModule } from '@angular/material/icon';
+import { MatButtonModule } from '@angular/material/button';
import {
- MatMenuModule,
- MatIconModule,
- MatButtonModule,
MatDialogModule,
- MatInputModule,
- MatSnackBarModule,
- MatProgressBarModule,
MAT_DIALOG_DEFAULT_OPTIONS
-} from '@angular/material';
+} from '@angular/material/dialog';
+import { MatInputModule } from '@angular/material/input';
+import { MatSnackBarModule } from '@angular/material/snack-bar';
+import { MatProgressBarModule } from '@angular/material/progress-bar';
@NgModule({
imports: [
diff --git a/src/app/services/content-management.service.spec.ts b/src/app/services/content-management.service.spec.ts
index c190b6d18..2c33097f3 100644
--- a/src/app/services/content-management.service.spec.ts
+++ b/src/app/services/content-management.service.spec.ts
@@ -25,36 +25,37 @@
import { TestBed, fakeAsync, tick, flush } from '@angular/core/testing';
import { of, throwError } from 'rxjs';
-import { MatDialog, MatSnackBar } from '@angular/material';
import { Actions, ofType, EffectsModule } from '@ngrx/effects';
import {
- SNACKBAR_INFO,
+ AppStore,
SnackbarWarningAction,
SnackbarInfoAction,
SnackbarErrorAction,
- SNACKBAR_ERROR,
- SNACKBAR_WARNING,
PurgeDeletedNodesAction,
RestoreDeletedNodesAction,
NavigateToParentFolder,
NavigateRouteAction,
- NAVIGATE_ROUTE,
DeleteNodesAction,
MoveNodesAction,
CopyNodesAction,
ShareNodeAction,
SetSelectedNodesAction,
UnlockWriteAction
-} from '../store/actions';
+} from '@alfresco/aca-shared/store';
import { map } from 'rxjs/operators';
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 { Store } from '@ngrx/store';
-import { AppStore } from '../store/states';
import { ContentManagementService } from './content-management.service';
import { NodeActionsService } from './node-actions.service';
import { TranslationService } from '@alfresco/adf-core';
+import { MatDialog } from '@angular/material/dialog';
+import { MatSnackBar } from '@angular/material/snack-bar';
+import {
+ SnackbarActionTypes,
+ RouterActionTypes
+} from '../../../projects/aca-shared/store/src/public_api';
describe('ContentManagementService', () => {
let dialog: MatDialog;
@@ -773,7 +774,7 @@ describe('ContentManagementService', () => {
spyOn(contentApi, 'restoreNode').and.returnValue(throwError(null));
actions$.pipe(
- ofType(SNACKBAR_ERROR),
+ ofType(SnackbarActionTypes.Error),
map(action => done())
);
@@ -815,7 +816,7 @@ describe('ContentManagementService', () => {
);
actions$.pipe(
- ofType(SNACKBAR_ERROR),
+ ofType(SnackbarActionTypes.Error),
map(action => done())
);
@@ -848,7 +849,7 @@ describe('ContentManagementService', () => {
);
actions$.pipe(
- ofType(SNACKBAR_ERROR),
+ ofType(SnackbarActionTypes.Error),
map(action => done())
);
@@ -882,7 +883,7 @@ describe('ContentManagementService', () => {
spyOn(contentApi, 'deleteNode').and.returnValue(of(null));
actions$.pipe(
- ofType(SNACKBAR_INFO),
+ ofType(SnackbarActionTypes.Info),
map(action => {
done();
})
@@ -897,7 +898,7 @@ describe('ContentManagementService', () => {
spyOn(contentApi, 'deleteNode').and.returnValue(throwError(null));
actions$.pipe(
- ofType(SNACKBAR_ERROR),
+ ofType(SnackbarActionTypes.Error),
map(action => {
done();
})
@@ -912,7 +913,7 @@ describe('ContentManagementService', () => {
spyOn(contentApi, 'deleteNode').and.returnValue(of(null));
actions$.pipe(
- ofType(SNACKBAR_INFO),
+ ofType(SnackbarActionTypes.Info),
map(action => {
done();
})
@@ -930,7 +931,7 @@ describe('ContentManagementService', () => {
spyOn(contentApi, 'deleteNode').and.returnValue(throwError(null));
actions$.pipe(
- ofType(SNACKBAR_ERROR),
+ ofType(SnackbarActionTypes.Error),
map(action => {
done();
})
@@ -954,7 +955,7 @@ describe('ContentManagementService', () => {
});
actions$.pipe(
- ofType(SNACKBAR_WARNING),
+ ofType(SnackbarActionTypes.Warning),
map(action => {
done();
})
@@ -984,7 +985,7 @@ describe('ContentManagementService', () => {
});
actions$.pipe(
- ofType(SNACKBAR_WARNING),
+ ofType(SnackbarActionTypes.Warning),
map(action => {
done();
})
@@ -1028,7 +1029,7 @@ describe('ContentManagementService', () => {
describe('notification', () => {
it('raises warning on multiple fail and one success', fakeAsync(done => {
actions$.pipe(
- ofType(SNACKBAR_WARNING),
+ ofType(SnackbarActionTypes.Warning),
map((action: SnackbarWarningAction) => {
done();
})
@@ -1059,7 +1060,7 @@ describe('ContentManagementService', () => {
it('raises warning on multiple success and multiple fail', fakeAsync(done => {
actions$.pipe(
- ofType(SNACKBAR_WARNING),
+ ofType(SnackbarActionTypes.Warning),
map((action: SnackbarWarningAction) => {
done();
})
@@ -1095,7 +1096,7 @@ describe('ContentManagementService', () => {
it('raises info on one selected node success', fakeAsync(done => {
actions$.pipe(
- ofType(SNACKBAR_INFO),
+ ofType(SnackbarActionTypes.Info),
map((action: SnackbarInfoAction) => {
done();
})
@@ -1110,7 +1111,7 @@ describe('ContentManagementService', () => {
it('raises error on one selected node fail', fakeAsync(done => {
actions$.pipe(
- ofType(SNACKBAR_ERROR),
+ ofType(SnackbarActionTypes.Error),
map((action: SnackbarErrorAction) => {
done();
})
@@ -1125,7 +1126,7 @@ describe('ContentManagementService', () => {
it('raises info on all nodes success', fakeAsync(done => {
actions$.pipe(
- ofType(SNACKBAR_INFO),
+ ofType(SnackbarActionTypes.Info),
map((action: SnackbarInfoAction) => {
done();
})
@@ -1150,7 +1151,7 @@ describe('ContentManagementService', () => {
it('raises error on all nodes fail', fakeAsync(done => {
actions$.pipe(
- ofType(SNACKBAR_ERROR),
+ ofType(SnackbarActionTypes.Error),
map((action: SnackbarErrorAction) => {
done();
})
@@ -1278,7 +1279,7 @@ describe('ContentManagementService', () => {
const error = { message: '{ "error": {} }' };
actions$.pipe(
- ofType(SNACKBAR_ERROR),
+ ofType(SnackbarActionTypes.Error),
map(action => done())
);
@@ -1319,7 +1320,7 @@ describe('ContentManagementService', () => {
spyOn(contentApi, 'restoreNode').and.returnValue(throwError(error));
actions$.pipe(
- ofType(SNACKBAR_ERROR),
+ ofType(SnackbarActionTypes.Error),
map(action => done())
);
@@ -1343,7 +1344,7 @@ describe('ContentManagementService', () => {
spyOn(contentApi, 'restoreNode').and.returnValue(throwError(error));
actions$.pipe(
- ofType(SNACKBAR_ERROR),
+ ofType(SnackbarActionTypes.Error),
map(action => done())
);
@@ -1367,7 +1368,7 @@ describe('ContentManagementService', () => {
spyOn(contentApi, 'restoreNode').and.returnValue(throwError(error));
actions$.pipe(
- ofType(SNACKBAR_ERROR),
+ ofType(SnackbarActionTypes.Error),
map(action => done())
);
@@ -1397,7 +1398,7 @@ describe('ContentManagementService', () => {
});
actions$.pipe(
- ofType(SNACKBAR_INFO),
+ ofType(SnackbarActionTypes.Info),
map(action => done())
);
@@ -1422,7 +1423,7 @@ describe('ContentManagementService', () => {
spyOn(contentApi, 'restoreNode').and.returnValue(of({}));
actions$.pipe(
- ofType(SNACKBAR_INFO),
+ ofType(SnackbarActionTypes.Info),
map(action => done())
);
@@ -1444,7 +1445,7 @@ describe('ContentManagementService', () => {
spyOn(contentApi, 'restoreNode').and.returnValue(of({}));
actions$.pipe(
- ofType(NAVIGATE_ROUTE),
+ ofType(RouterActionTypes.NavigateRoute),
map(action => done())
);
diff --git a/src/app/services/content-management.service.ts b/src/app/services/content-management.service.ts
index 1e80db29a..91ec3c779 100644
--- a/src/app/services/content-management.service.ts
+++ b/src/app/services/content-management.service.ts
@@ -23,49 +23,53 @@
* along with Alfresco. If not, see .
*/
-import { Subject, Observable, forkJoin, of, zip } from 'rxjs';
-import { Injectable } from '@angular/core';
-import { MatDialog, MatSnackBar } from '@angular/material';
+import { ContentApiService } from '@alfresco/aca-shared';
import {
- FolderDialogComponent,
- ConfirmDialogComponent,
- LibraryDialogComponent
-} from '@alfresco/adf-content-services';
-import {
- SnackbarErrorAction,
- SnackbarInfoAction,
- SnackbarAction,
- SnackbarWarningAction,
+ AppStore,
+ DeletedNodeInfo,
+ DeleteStatus,
+ getAppSelection,
+ getSharedUrl,
NavigateRouteAction,
NavigateToParentFolder,
- SnackbarUserAction,
- UndoDeleteNodesAction,
+ NodeInfo,
+ ReloadDocumentListAction,
SetSelectedNodesAction,
- ReloadDocumentListAction
-} from '../store/actions';
-import { Store } from '@ngrx/store';
-import { AppStore } from '../store/states';
+ SnackbarAction,
+ SnackbarErrorAction,
+ SnackbarInfoAction,
+ SnackbarUserAction,
+ SnackbarWarningAction,
+ UndoDeleteNodesAction
+} from '@alfresco/aca-shared/store';
import {
+ ConfirmDialogComponent,
+ FolderDialogComponent,
+ LibraryDialogComponent
+} from '@alfresco/adf-content-services';
+import { TranslationService } from '@alfresco/adf-core';
+import {
+ DeletedNodesPaging,
MinimalNodeEntity,
MinimalNodeEntryEntity,
Node,
- SiteEntry,
- DeletedNodesPaging,
+ NodeEntry,
PathInfoEntity,
SiteBody,
- NodeEntry
+ SiteEntry
} from '@alfresco/js-api';
-import { NodePermissionService } from './node-permission.service';
-import { NodeInfo, DeletedNodeInfo, DeleteStatus } from '../store/models';
-import { ContentApiService } from './content-api.service';
-import { sharedUrl, appSelection } from '../store/selectors/app.selectors';
-import { NodeActionsService } from './node-actions.service';
-import { TranslationService, ViewUtilService } from '@alfresco/adf-core';
+import { Injectable } from '@angular/core';
+import { MatDialog } from '@angular/material/dialog';
+import { MatSnackBar } from '@angular/material/snack-bar';
+import { Store } from '@ngrx/store';
+import { forkJoin, Observable, of, Subject, zip } from 'rxjs';
+import { catchError, flatMap, map, mergeMap, take, tap } from 'rxjs/operators';
+import { NodePermissionsDialogComponent } from '../components/permissions/permission-dialog/node-permissions.dialog';
+import { ShareDialogComponent } from '../components/shared/content-node-share/content-node-share.dialog';
import { NodeVersionUploadDialogComponent } from '../dialogs/node-version-upload/node-version-upload.dialog';
import { NodeVersionsDialogComponent } from '../dialogs/node-versions/node-versions.dialog';
-import { ShareDialogComponent } from '../components/shared/content-node-share/content-node-share.dialog';
-import { take, map, tap, mergeMap, catchError, flatMap } from 'rxjs/operators';
-import { NodePermissionsDialogComponent } from '../components/permissions/permission-dialog/node-permissions.dialog';
+import { NodeActionsService } from './node-actions.service';
+import { NodePermissionService } from '@alfresco/aca-shared';
interface RestoredNode {
status: number;
@@ -96,8 +100,7 @@ export class ContentManagementService {
private dialogRef: MatDialog,
private nodeActionsService: NodeActionsService,
private translation: TranslationService,
- private snackBar: MatSnackBar,
- private viewUtils: ViewUtilService
+ private snackBar: MatSnackBar
) {}
addFavorite(nodes: Array) {
@@ -197,7 +200,7 @@ export class ContentManagementService {
openShareLinkDialog(node) {
this.store
- .select(sharedUrl)
+ .select(getSharedUrl)
.pipe(take(1))
.subscribe(baseShareUrl => {
this.dialogRef
@@ -1164,42 +1167,8 @@ export class ContentManagementService {
return i18nMessageString;
}
- printFile(node: any) {
- if (node && node.entry) {
- // shared and favorite
- const id = node.entry.nodeId || node.entry.guid || node.entry.id;
- const mimeType = node.entry.content.mimeType;
-
- if (id) {
- this.viewUtils.printFileGeneric(id, mimeType);
- }
- }
- }
-
- /**
- * Triggers full screen mode with a main content area displayed.
- */
- fullscreenViewer() {
- const container = (
- document.documentElement.querySelector(
- '.adf-viewer__fullscreen-container'
- )
- );
- if (container) {
- if (container.requestFullscreen) {
- container.requestFullscreen();
- } else if (container.webkitRequestFullscreen) {
- container.webkitRequestFullscreen();
- } else if (container.mozRequestFullScreen) {
- container.mozRequestFullScreen();
- } else if (container.msRequestFullscreen) {
- container.msRequestFullscreen();
- }
- }
- }
-
getNodeInfo() {
- return this.store.select(appSelection).pipe(
+ return this.store.select(getAppSelection).pipe(
take(1),
flatMap(({ file }) => {
const id = (file).entry.nodeId || (file).entry.guid;
diff --git a/src/app/services/node-actions.service.spec.ts b/src/app/services/node-actions.service.spec.ts
index a2326c0f0..17518dc61 100644
--- a/src/app/services/node-actions.service.spec.ts
+++ b/src/app/services/node-actions.service.spec.ts
@@ -24,14 +24,14 @@
*/
import { TestBed, async } from '@angular/core/testing';
-import { MatDialog } from '@angular/material';
+import { MatDialog } from '@angular/material/dialog';
import { of, throwError } from 'rxjs';
import { AlfrescoApiService, TranslationService } from '@alfresco/adf-core';
import { DocumentListService } from '@alfresco/adf-content-services';
import { NodeActionsService } from './node-actions.service';
import { MinimalNodeEntryEntity } from '@alfresco/js-api';
import { AppTestingModule } from '../testing/app-testing.module';
-import { ContentApiService } from '../services/content-api.service';
+import { ContentApiService } from '@alfresco/aca-shared';
class TestNode {
entry?: MinimalNodeEntryEntity;
diff --git a/src/app/services/node-actions.service.ts b/src/app/services/node-actions.service.ts
index f5a1a08a6..ada1b3937 100644
--- a/src/app/services/node-actions.service.ts
+++ b/src/app/services/node-actions.service.ts
@@ -24,7 +24,7 @@
*/
import { Injectable } from '@angular/core';
-import { MatDialog } from '@angular/material';
+import { MatDialog } from '@angular/material/dialog';
import { Observable, Subject, of, zip, from } from 'rxjs';
import {
@@ -48,7 +48,7 @@ import {
Site,
NodeChildAssociationPaging
} from '@alfresco/js-api';
-import { ContentApiService } from '../services/content-api.service';
+import { ContentApiService } from '@alfresco/aca-shared';
import { catchError, map, mergeMap } from 'rxjs/operators';
export enum BatchOperationType {
diff --git a/src/app/store/app-store.module.ts b/src/app/store/app-store.module.ts
index 1d39ce07e..4ea9aae32 100644
--- a/src/app/store/app-store.module.ts
+++ b/src/app/store/app-store.module.ts
@@ -26,41 +26,37 @@
import { NgModule } from '@angular/core';
import { StoreModule } from '@ngrx/store';
import { appReducer } from './reducers/app.reducer';
-import { INITIAL_STATE } from './states';
import { StoreRouterConnectingModule } from '@ngrx/router-store';
import { EffectsModule } from '@ngrx/effects';
import { environment } from '../../environments/environment';
import { StoreDevtoolsModule } from '@ngrx/store-devtools';
+import { SharedStoreModule } from '@alfresco/aca-shared/store';
import {
AppEffects,
- SnackbarEffects,
NodeEffects,
- RouterEffects,
DownloadEffects,
ViewerEffects,
SearchEffects,
LibraryEffects,
UploadEffects,
- FavoriteEffects,
- ModalsEffects
+ FavoriteEffects
} from './effects';
+import { INITIAL_STATE } from './initial-state';
@NgModule({
imports: [
StoreModule.forRoot({ app: appReducer }, { initialState: INITIAL_STATE }),
StoreRouterConnectingModule.forRoot({ stateKey: 'router' }),
+ SharedStoreModule,
EffectsModule.forRoot([
AppEffects,
- SnackbarEffects,
NodeEffects,
- RouterEffects,
DownloadEffects,
ViewerEffects,
SearchEffects,
LibraryEffects,
UploadEffects,
- FavoriteEffects,
- ModalsEffects
+ FavoriteEffects
]),
!environment.production
? StoreDevtoolsModule.instrument({ maxAge: 25 })
diff --git a/src/app/store/effects.ts b/src/app/store/effects.ts
index 421da1919..29bee5773 100644
--- a/src/app/store/effects.ts
+++ b/src/app/store/effects.ts
@@ -27,11 +27,8 @@ export * from './effects/app.effects';
export * from './effects/download.effects';
export * from './effects/favorite.effects';
export * from './effects/node.effects';
-export * from './effects/router.effects';
-export * from './effects/snackbar.effects';
export * from './effects/viewer.effects';
export * from './effects/search.effects';
export * from './effects/library.effects';
export * from './effects/upload.effects';
-export * from './effects/modals.effects';
export * from './effects/upload.effects';
diff --git a/src/app/store/effects/app.effects.ts b/src/app/store/effects/app.effects.ts
index 528602d74..682798aac 100644
--- a/src/app/store/effects/app.effects.ts
+++ b/src/app/store/effects/app.effects.ts
@@ -27,11 +27,10 @@ import { Effect, Actions, ofType } from '@ngrx/effects';
import { Injectable } from '@angular/core';
import { map } from 'rxjs/operators';
import {
+ AppActionTypes,
LogoutAction,
- LOGOUT,
- ReloadDocumentListAction,
- RELOAD_DOCUMENT_LIST
-} from '../actions/app.actions';
+ ReloadDocumentListAction
+} from '@alfresco/aca-shared/store';
import { AuthenticationService } from '@alfresco/adf-core';
import { Router } from '@angular/router';
import { ContentManagementService } from '../../services/content-management.service';
@@ -47,7 +46,7 @@ export class AppEffects {
@Effect({ dispatch: false })
reload = this.actions$.pipe(
- ofType(RELOAD_DOCUMENT_LIST),
+ ofType(AppActionTypes.ReloadDocumentList),
map(action => {
this.content.reload.next(action);
})
@@ -55,7 +54,7 @@ export class AppEffects {
@Effect({ dispatch: false })
logout$ = this.actions$.pipe(
- ofType(LOGOUT),
+ ofType(AppActionTypes.Logout),
map(() => {
this.auth
.logout()
diff --git a/src/app/store/effects/download.effects.ts b/src/app/store/effects/download.effects.ts
index d94651dc4..3a53e5448 100644
--- a/src/app/store/effects/download.effects.ts
+++ b/src/app/store/effects/download.effects.ts
@@ -23,18 +23,21 @@
* along with Alfresco. If not, see .
*/
+import {
+ AppStore,
+ DownloadNodesAction,
+ NodeActionTypes,
+ NodeInfo,
+ getAppSelection
+} from '@alfresco/aca-shared/store';
import { DownloadZipDialogComponent } from '@alfresco/adf-core';
-import { Injectable } from '@angular/core';
-import { MatDialog } from '@angular/material';
-import { Actions, Effect, ofType } from '@ngrx/effects';
-import { map, take } from 'rxjs/operators';
-import { DownloadNodesAction, DOWNLOAD_NODES } from '../actions';
-import { NodeInfo } from '../models';
-import { ContentApiService } from '../../services/content-api.service';
import { MinimalNodeEntity } from '@alfresco/js-api';
+import { Injectable } from '@angular/core';
+import { MatDialog } from '@angular/material/dialog';
+import { Actions, Effect, ofType } from '@ngrx/effects';
import { Store } from '@ngrx/store';
-import { AppStore } from '../states';
-import { appSelection } from '../selectors/app.selectors';
+import { map, take } from 'rxjs/operators';
+import { ContentApiService } from '@alfresco/aca-shared';
@Injectable()
export class DownloadEffects {
@@ -47,13 +50,13 @@ export class DownloadEffects {
@Effect({ dispatch: false })
downloadNode$ = this.actions$.pipe(
- ofType(DOWNLOAD_NODES),
+ ofType(NodeActionTypes.Download),
map(action => {
if (action.payload && action.payload.length > 0) {
this.downloadNodes(action.payload);
} else {
this.store
- .select(appSelection)
+ .select(getAppSelection)
.pipe(take(1))
.subscribe(selection => {
if (selection && !selection.isEmpty) {
diff --git a/src/app/store/effects/favorite.effects.ts b/src/app/store/effects/favorite.effects.ts
index 1c7388881..2b57eed91 100644
--- a/src/app/store/effects/favorite.effects.ts
+++ b/src/app/store/effects/favorite.effects.ts
@@ -27,14 +27,13 @@ import { Effect, Actions, ofType } from '@ngrx/effects';
import { Injectable } from '@angular/core';
import { map, take } from 'rxjs/operators';
import {
- ADD_FAVORITE,
+ AppStore,
+ NodeActionTypes,
AddFavoriteAction,
RemoveFavoriteAction,
- REMOVE_FAVORITE
-} from '../actions/favorite.actions';
+ getAppSelection
+} from '@alfresco/aca-shared/store';
import { Store } from '@ngrx/store';
-import { AppStore } from '../states';
-import { appSelection } from '../selectors/app.selectors';
import { ContentManagementService } from '../../services/content-management.service';
@Injectable()
@@ -47,13 +46,13 @@ export class FavoriteEffects {
@Effect({ dispatch: false })
addFavorite$ = this.actions$.pipe(
- ofType(ADD_FAVORITE),
+ ofType(NodeActionTypes.AddFavorite),
map(action => {
if (action.payload && action.payload.length > 0) {
this.content.addFavorite(action.payload);
} else {
this.store
- .select(appSelection)
+ .select(getAppSelection)
.pipe(take(1))
.subscribe(selection => {
if (selection && !selection.isEmpty) {
@@ -66,13 +65,13 @@ export class FavoriteEffects {
@Effect({ dispatch: false })
removeFavorite$ = this.actions$.pipe(
- ofType(REMOVE_FAVORITE),
+ ofType(NodeActionTypes.RemoveFavorite),
map(action => {
if (action.payload && action.payload.length > 0) {
this.content.removeFavorite(action.payload);
} else {
this.store
- .select(appSelection)
+ .select(getAppSelection)
.pipe(take(1))
.subscribe(selection => {
if (selection && !selection.isEmpty) {
diff --git a/src/app/store/effects/library.effects.ts b/src/app/store/effects/library.effects.ts
index 2350d759a..c496cd3bf 100644
--- a/src/app/store/effects/library.effects.ts
+++ b/src/app/store/effects/library.effects.ts
@@ -23,28 +23,24 @@
* along with Alfresco. If not, see .
*/
-import { Effect, Actions, ofType } from '@ngrx/effects';
-import { Injectable } from '@angular/core';
-import { map, take, mergeMap } from 'rxjs/operators';
import {
- DeleteLibraryAction,
- DELETE_LIBRARY,
+ AppStore,
CreateLibraryAction,
- CREATE_LIBRARY,
- NavigateLibraryAction,
- NAVIGATE_LIBRARY,
- UpdateLibraryAction,
- UPDATE_LIBRARY,
+ DeleteLibraryAction,
LeaveLibraryAction,
- LEAVE_LIBRARY,
- NavigateRouteAction
-} from '../actions';
-import { ContentManagementService } from '../../services/content-management.service';
+ LibraryActionTypes,
+ NavigateLibraryAction,
+ NavigateRouteAction,
+ SnackbarErrorAction,
+ UpdateLibraryAction,
+ getAppSelection
+} from '@alfresco/aca-shared/store';
+import { Injectable } from '@angular/core';
+import { Actions, Effect, ofType } from '@ngrx/effects';
import { Store } from '@ngrx/store';
-import { AppStore } from '../states';
-import { appSelection } from '../selectors/app.selectors';
-import { ContentApiService } from '../../services/content-api.service';
-import { SnackbarErrorAction } from '../actions/snackbar.actions';
+import { map, mergeMap, take } from 'rxjs/operators';
+import { ContentApiService } from '@alfresco/aca-shared';
+import { ContentManagementService } from '../../services/content-management.service';
@Injectable()
export class LibraryEffects {
@@ -57,13 +53,13 @@ export class LibraryEffects {
@Effect({ dispatch: false })
deleteLibrary$ = this.actions$.pipe(
- ofType(DELETE_LIBRARY),
+ ofType(LibraryActionTypes.Delete),
map(action => {
if (action.payload) {
this.content.deleteLibrary(action.payload);
} else {
this.store
- .select(appSelection)
+ .select(getAppSelection)
.pipe(take(1))
.subscribe(selection => {
if (selection && selection.library) {
@@ -76,13 +72,13 @@ export class LibraryEffects {
@Effect({ dispatch: false })
leaveLibrary$ = this.actions$.pipe(
- ofType(LEAVE_LIBRARY),
+ ofType(LibraryActionTypes.Leave),
map(action => {
if (action.payload) {
this.content.leaveLibrary(action.payload);
} else {
this.store
- .select(appSelection)
+ .select(getAppSelection)
.pipe(take(1))
.subscribe(selection => {
if (selection && selection.library) {
@@ -95,14 +91,14 @@ export class LibraryEffects {
@Effect()
createLibrary$ = this.actions$.pipe(
- ofType(CREATE_LIBRARY),
+ ofType(LibraryActionTypes.Create),
mergeMap(() => this.content.createLibrary()),
map(libraryId => new NavigateLibraryAction(libraryId))
);
@Effect({ dispatch: false })
navigateLibrary$ = this.actions$.pipe(
- ofType(NAVIGATE_LIBRARY),
+ ofType(LibraryActionTypes.Navigate),
map(action => {
const libraryId = action.payload;
if (libraryId) {
@@ -125,10 +121,10 @@ export class LibraryEffects {
@Effect({ dispatch: false })
updateLibrary$ = this.actions$.pipe(
- ofType(UPDATE_LIBRARY),
+ ofType(LibraryActionTypes.Update),
map(action => {
this.store
- .select(appSelection)
+ .select(getAppSelection)
.pipe(take(1))
.subscribe(selection => {
if (selection && selection.library) {
diff --git a/src/app/store/effects/node.effects.spec.ts b/src/app/store/effects/node.effects.spec.ts
index f5e232523..cab0701c6 100644
--- a/src/app/store/effects/node.effects.spec.ts
+++ b/src/app/store/effects/node.effects.spec.ts
@@ -30,6 +30,7 @@ import { EffectsModule } from '@ngrx/effects';
import { Store } from '@ngrx/store';
import { ContentManagementService } from '../../services/content-management.service';
import {
+ SharedStoreModule,
ShareNodeAction,
SetSelectedNodesAction,
UnshareNodesAction,
@@ -44,25 +45,34 @@ import {
ManagePermissionsAction,
UnlockWriteAction,
FullscreenViewerAction,
- PrintFileAction
-} from '../actions/node.actions';
-import { SetCurrentFolderAction } from '../actions/app.actions';
+ PrintFileAction,
+ SetCurrentFolderAction
+} from '@alfresco/aca-shared/store';
+import { ViewUtilService } from '@alfresco/adf-core';
+import { ViewerEffects } from './viewer.effects';
describe('NodeEffects', () => {
let store: Store;
- // let actions$: Actions;
let contentService: ContentManagementService;
+ let viewUtilService: ViewUtilService;
+ let viewerEffects: ViewerEffects;
beforeEach(() => {
TestBed.configureTestingModule({
- imports: [AppTestingModule, EffectsModule.forRoot([NodeEffects])],
+ imports: [
+ AppTestingModule,
+ SharedStoreModule,
+ EffectsModule.forRoot([NodeEffects, ViewerEffects])
+ ],
declarations: [],
- providers: []
+ providers: [ViewUtilService]
});
// actions$ = TestBed.get(Actions);
store = TestBed.get(Store);
contentService = TestBed.get(ContentManagementService);
+ viewUtilService = TestBed.get(ViewUtilService);
+ viewerEffects = TestBed.get(ViewerEffects);
});
describe('shareNode$', () => {
@@ -403,17 +413,28 @@ describe('NodeEffects', () => {
describe('printFile$', () => {
it('it should print node content from payload', () => {
- spyOn(contentService, 'printFile').and.stub();
- const node: any = { entry: { id: 'node-id' } };
+ spyOn(viewUtilService, 'printFileGeneric').and.stub();
+ const node: any = {
+ entry: { id: 'node-id', content: { mimeType: 'text/json' } }
+ };
store.dispatch(new PrintFileAction(node));
- expect(contentService.printFile).toHaveBeenCalledWith(node);
+ expect(viewUtilService.printFileGeneric).toHaveBeenCalledWith(
+ 'node-id',
+ 'text/json'
+ );
});
it('it should print node content from store', fakeAsync(() => {
- spyOn(contentService, 'printFile').and.stub();
- const node: any = { entry: { isFile: true, id: 'node-id' } };
+ spyOn(viewUtilService, 'printFileGeneric').and.stub();
+ const node: any = {
+ entry: {
+ isFile: true,
+ id: 'node-id',
+ content: { mimeType: 'text/json' }
+ }
+ };
store.dispatch(new SetSelectedNodesAction([node]));
@@ -421,17 +442,20 @@ describe('NodeEffects', () => {
store.dispatch(new PrintFileAction(null));
- expect(contentService.printFile).toHaveBeenCalledWith(node);
+ expect(viewUtilService.printFileGeneric).toHaveBeenCalledWith(
+ 'node-id',
+ 'text/json'
+ );
}));
});
describe('fullscreenViewer$', () => {
it('should call fullscreen viewer', () => {
- spyOn(contentService, 'fullscreenViewer').and.stub();
+ spyOn(viewerEffects, 'enterFullScreen').and.stub();
store.dispatch(new FullscreenViewerAction(null));
- expect(contentService.fullscreenViewer).toHaveBeenCalled();
+ expect(viewerEffects.enterFullScreen).toHaveBeenCalled();
});
});
diff --git a/src/app/store/effects/node.effects.ts b/src/app/store/effects/node.effects.ts
index 3128edfea..dd90baf39 100644
--- a/src/app/store/effects/node.effects.ts
+++ b/src/app/store/effects/node.effects.ts
@@ -27,61 +27,47 @@ import { Effect, Actions, ofType } from '@ngrx/effects';
import { Injectable } from '@angular/core';
import { map, take } from 'rxjs/operators';
import { Store } from '@ngrx/store';
-import { AppStore } from '../states/app.state';
import {
+ AppStore,
+ NodeActionTypes,
PurgeDeletedNodesAction,
- PURGE_DELETED_NODES,
DeleteNodesAction,
- DELETE_NODES,
UndoDeleteNodesAction,
- UNDO_DELETE_NODES,
CreateFolderAction,
- CREATE_FOLDER,
EditFolderAction,
- EDIT_FOLDER,
RestoreDeletedNodesAction,
- RESTORE_DELETED_NODES,
ShareNodeAction,
- SHARE_NODE,
ManageVersionsAction,
- MANAGE_VERSIONS,
UnlockWriteAction,
- UNLOCK_WRITE
-} from '../actions';
-import { ContentManagementService } from '../../services/content-management.service';
-import { currentFolder, appSelection } from '../selectors/app.selectors';
-import {
UnshareNodesAction,
- UNSHARE_NODES,
CopyNodesAction,
- COPY_NODES,
MoveNodesAction,
- MOVE_NODES,
ManagePermissionsAction,
- MANAGE_PERMISSIONS,
- PRINT_FILE,
PrintFileAction,
- FULLSCREEN_VIEWER,
- FullscreenViewerAction
-} from '../actions/node.actions';
+ getCurrentFolder,
+ getAppSelection
+} from '@alfresco/aca-shared/store';
+import { ContentManagementService } from '../../services/content-management.service';
+import { ViewUtilService } from '@alfresco/adf-core';
@Injectable()
export class NodeEffects {
constructor(
private store: Store,
private actions$: Actions,
- private contentService: ContentManagementService
+ private contentService: ContentManagementService,
+ private viewUtils: ViewUtilService
) {}
@Effect({ dispatch: false })
shareNode$ = this.actions$.pipe(
- ofType(SHARE_NODE),
+ ofType(NodeActionTypes.Share),
map(action => {
if (action.payload) {
this.contentService.shareNode(action.payload);
} else {
this.store
- .select(appSelection)
+ .select(getAppSelection)
.pipe(take(1))
.subscribe(selection => {
if (selection && selection.file) {
@@ -94,13 +80,13 @@ export class NodeEffects {
@Effect({ dispatch: false })
unshareNodes$ = this.actions$.pipe(
- ofType(UNSHARE_NODES),
+ ofType(NodeActionTypes.Unshare),
map(action => {
if (action && action.payload && action.payload.length > 0) {
this.contentService.unshareNodes(action.payload);
} else {
this.store
- .select(appSelection)
+ .select(getAppSelection)
.pipe(take(1))
.subscribe(selection => {
if (selection && !selection.isEmpty) {
@@ -113,13 +99,13 @@ export class NodeEffects {
@Effect({ dispatch: false })
purgeDeletedNodes$ = this.actions$.pipe(
- ofType(PURGE_DELETED_NODES),
+ ofType(NodeActionTypes.PurgeDeleted),
map(action => {
if (action && action.payload && action.payload.length > 0) {
this.contentService.purgeDeletedNodes(action.payload);
} else {
this.store
- .select(appSelection)
+ .select(getAppSelection)
.pipe(take(1))
.subscribe(selection => {
if (selection && selection.count > 0) {
@@ -132,13 +118,13 @@ export class NodeEffects {
@Effect({ dispatch: false })
restoreDeletedNodes$ = this.actions$.pipe(
- ofType(RESTORE_DELETED_NODES),
+ ofType(NodeActionTypes.RestoreDeleted),
map(action => {
if (action && action.payload && action.payload.length > 0) {
this.contentService.restoreDeletedNodes(action.payload);
} else {
this.store
- .select(appSelection)
+ .select(getAppSelection)
.pipe(take(1))
.subscribe(selection => {
if (selection && selection.count > 0) {
@@ -151,13 +137,13 @@ export class NodeEffects {
@Effect({ dispatch: false })
deleteNodes$ = this.actions$.pipe(
- ofType(DELETE_NODES),
+ ofType(NodeActionTypes.Delete),
map(action => {
if (action && action.payload && action.payload.length > 0) {
this.contentService.deleteNodes(action.payload);
} else {
this.store
- .select(appSelection)
+ .select(getAppSelection)
.pipe(take(1))
.subscribe(selection => {
if (selection && selection.count > 0) {
@@ -170,7 +156,7 @@ export class NodeEffects {
@Effect({ dispatch: false })
undoDeleteNodes$ = this.actions$.pipe(
- ofType(UNDO_DELETE_NODES),
+ ofType(NodeActionTypes.UndoDelete),
map(action => {
if (action.payload.length > 0) {
this.contentService.undoDeleteNodes(action.payload);
@@ -180,13 +166,13 @@ export class NodeEffects {
@Effect({ dispatch: false })
createFolder$ = this.actions$.pipe(
- ofType(CREATE_FOLDER),
+ ofType(NodeActionTypes.CreateFolder),
map(action => {
if (action.payload) {
this.contentService.createFolder(action.payload);
} else {
this.store
- .select(currentFolder)
+ .select(getCurrentFolder)
.pipe(take(1))
.subscribe(node => {
if (node && node.id) {
@@ -199,13 +185,13 @@ export class NodeEffects {
@Effect({ dispatch: false })
editFolder$ = this.actions$.pipe(
- ofType(EDIT_FOLDER),
+ ofType(NodeActionTypes.EditFolder),
map(action => {
if (action.payload) {
this.contentService.editFolder(action.payload);
} else {
this.store
- .select(appSelection)
+ .select(getAppSelection)
.pipe(take(1))
.subscribe(selection => {
if (selection && selection.folder) {
@@ -218,13 +204,13 @@ export class NodeEffects {
@Effect({ dispatch: false })
copyNodes$ = this.actions$.pipe(
- ofType(COPY_NODES),
+ ofType(NodeActionTypes.Copy),
map(action => {
if (action.payload && action.payload.length > 0) {
this.contentService.copyNodes(action.payload);
} else {
this.store
- .select(appSelection)
+ .select(getAppSelection)
.pipe(take(1))
.subscribe(selection => {
if (selection && !selection.isEmpty) {
@@ -237,13 +223,13 @@ export class NodeEffects {
@Effect({ dispatch: false })
moveNodes$ = this.actions$.pipe(
- ofType(MOVE_NODES),
+ ofType(NodeActionTypes.Move),
map(action => {
if (action.payload && action.payload.length > 0) {
this.contentService.moveNodes(action.payload);
} else {
this.store
- .select(appSelection)
+ .select(getAppSelection)
.pipe(take(1))
.subscribe(selection => {
if (selection && !selection.isEmpty) {
@@ -256,13 +242,13 @@ export class NodeEffects {
@Effect({ dispatch: false })
managePermissions$ = this.actions$.pipe(
- ofType(MANAGE_PERMISSIONS),
+ ofType(NodeActionTypes.ManagePermissions),
map(action => {
if (action && action.payload) {
this.contentService.managePermissions(action.payload);
} else {
this.store
- .select(appSelection)
+ .select(getAppSelection)
.pipe(take(1))
.subscribe(selection => {
if (selection && !selection.isEmpty) {
@@ -275,13 +261,13 @@ export class NodeEffects {
@Effect({ dispatch: false })
manageVersions$ = this.actions$.pipe(
- ofType(MANAGE_VERSIONS),
+ ofType(NodeActionTypes.ManageVersions),
map(action => {
if (action && action.payload) {
this.contentService.manageVersions(action.payload);
} else {
this.store
- .select(appSelection)
+ .select(getAppSelection)
.pipe(take(1))
.subscribe(selection => {
if (selection && selection.file) {
@@ -294,40 +280,32 @@ export class NodeEffects {
@Effect({ dispatch: false })
printFile$ = this.actions$.pipe(
- ofType(PRINT_FILE),
+ ofType(NodeActionTypes.PrintFile),
map(action => {
if (action && action.payload) {
- this.contentService.printFile(action.payload);
+ this.printFile(action.payload);
} else {
this.store
- .select(appSelection)
+ .select(getAppSelection)
.pipe(take(1))
.subscribe(selection => {
if (selection && selection.file) {
- this.contentService.printFile(selection.file);
+ this.printFile(selection.file);
}
});
}
})
);
- @Effect({ dispatch: false })
- fullscreenViewer$ = this.actions$.pipe(
- ofType(FULLSCREEN_VIEWER),
- map(() => {
- this.contentService.fullscreenViewer();
- })
- );
-
@Effect({ dispatch: false })
unlockWrite$ = this.actions$.pipe(
- ofType(UNLOCK_WRITE),
+ ofType(NodeActionTypes.UnlockForWriting),
map(action => {
if (action && action.payload) {
this.contentService.unlockNode(action.payload);
} else {
this.store
- .select(appSelection)
+ .select(getAppSelection)
.pipe(take(1))
.subscribe(selection => {
if (selection && selection.file) {
@@ -337,4 +315,16 @@ export class NodeEffects {
}
})
);
+
+ printFile(node: any) {
+ if (node && node.entry) {
+ // shared and favorite
+ const id = node.entry.nodeId || node.entry.guid || node.entry.id;
+ const mimeType = node.entry.content.mimeType;
+
+ if (id) {
+ this.viewUtils.printFileGeneric(id, mimeType);
+ }
+ }
+ }
}
diff --git a/src/app/store/effects/search.effects.spec.ts b/src/app/store/effects/search.effects.spec.ts
index 08eacc76b..4667cf0bd 100644
--- a/src/app/store/effects/search.effects.spec.ts
+++ b/src/app/store/effects/search.effects.spec.ts
@@ -28,9 +28,11 @@ import { AppTestingModule } from '../../testing/app-testing.module';
import { SearchEffects } from './search.effects';
import { EffectsModule } from '@ngrx/effects';
import { Store } from '@ngrx/store';
-import { SearchByTermAction } from '../actions/search.actions';
import { Router } from '@angular/router';
-import { SearchOptionIds } from '../models/searchOption.model';
+import {
+ SearchOptionIds,
+ SearchByTermAction
+} from '@alfresco/aca-shared/store';
describe('SearchEffects', () => {
let store: Store;
diff --git a/src/app/store/effects/search.effects.ts b/src/app/store/effects/search.effects.ts
index a6037ae11..477f73eeb 100644
--- a/src/app/store/effects/search.effects.ts
+++ b/src/app/store/effects/search.effects.ts
@@ -26,9 +26,12 @@
import { Effect, Actions, ofType } from '@ngrx/effects';
import { Injectable } from '@angular/core';
import { map } from 'rxjs/operators';
-import { SEARCH_BY_TERM, SearchByTermAction } from '../actions/search.actions';
+import {
+ SearchActionTypes,
+ SearchByTermAction,
+ SearchOptionIds
+} from '@alfresco/aca-shared/store';
import { Router } from '@angular/router';
-import { SearchOptionIds } from '../models/searchOption.model';
@Injectable()
export class SearchEffects {
@@ -36,7 +39,7 @@ export class SearchEffects {
@Effect({ dispatch: false })
searchByTerm$ = this.actions$.pipe(
- ofType(SEARCH_BY_TERM),
+ ofType(SearchActionTypes.SearchByTerm),
map(action => {
const query = action.payload
.replace(/[(]/g, '%28')
diff --git a/src/app/store/effects/upload.effects.spec.ts b/src/app/store/effects/upload.effects.spec.ts
index a5d094b73..8a4992f9e 100644
--- a/src/app/store/effects/upload.effects.spec.ts
+++ b/src/app/store/effects/upload.effects.spec.ts
@@ -34,7 +34,7 @@ import {
FileUploadCompleteEvent,
FileModel
} from '@alfresco/adf-core';
-import { UnlockWriteAction } from '../actions';
+import { UnlockWriteAction } from '@alfresco/aca-shared/store';
describe('UploadEffects', () => {
let store: Store;
diff --git a/src/app/store/effects/upload.effects.ts b/src/app/store/effects/upload.effects.ts
index 4b8d5b600..e53e8a471 100644
--- a/src/app/store/effects/upload.effects.ts
+++ b/src/app/store/effects/upload.effects.ts
@@ -23,33 +23,31 @@
* along with Alfresco. If not, see .
*/
-import { Injectable, RendererFactory2, NgZone } from '@angular/core';
+import {
+ AppStore,
+ SnackbarErrorAction,
+ UnlockWriteAction,
+ UploadActionTypes,
+ UploadFilesAction,
+ UploadFileVersionAction,
+ UploadFolderAction,
+ getCurrentFolder
+} from '@alfresco/aca-shared/store';
+import { FileModel, FileUtils, UploadService } from '@alfresco/adf-core';
+import { Injectable, NgZone, RendererFactory2 } from '@angular/core';
import { Actions, Effect, ofType } from '@ngrx/effects';
import { Store } from '@ngrx/store';
-import { AppStore } from '../states';
+import { forkJoin, fromEvent, of } from 'rxjs';
import {
- UploadFilesAction,
- UPLOAD_FILES,
- UploadFolderAction,
- UPLOAD_FOLDER,
- UPLOAD_FILE_VERSION,
- UploadFileVersionAction,
- SnackbarErrorAction,
- UnlockWriteAction
-} from '../actions';
-import {
- map,
- take,
- flatMap,
- distinctUntilChanged,
catchError,
+ distinctUntilChanged,
+ filter,
+ flatMap,
+ map,
switchMap,
- tap,
- filter
+ take,
+ tap
} from 'rxjs/operators';
-import { FileUtils, FileModel, UploadService } from '@alfresco/adf-core';
-import { currentFolder } from '../selectors/app.selectors';
-import { fromEvent, of, forkJoin } from 'rxjs';
import { ContentManagementService } from '../../services/content-management.service';
@Injectable()
@@ -95,7 +93,7 @@ export class UploadEffects {
@Effect({ dispatch: false })
uploadFiles$ = this.actions$.pipe(
- ofType(UPLOAD_FILES),
+ ofType(UploadActionTypes.UploadFiles),
map(() => {
this.fileInput.click();
})
@@ -103,7 +101,7 @@ export class UploadEffects {
@Effect({ dispatch: false })
uploadFolder$ = this.actions$.pipe(
- ofType(UPLOAD_FOLDER),
+ ofType(UploadActionTypes.UploadFolder),
map(() => {
this.folderInput.click();
})
@@ -111,7 +109,7 @@ export class UploadEffects {
@Effect({ dispatch: false })
uploadVersion$ = this.actions$.pipe(
- ofType(UPLOAD_FILE_VERSION),
+ ofType(UploadActionTypes.UploadFileVersion),
switchMap(() => {
this.fileVersionInput.click();
return fromEvent(this.fileVersionInput, 'change').pipe(
@@ -155,7 +153,7 @@ export class UploadEffects {
private upload(event: any): void {
this.store
- .select(currentFolder)
+ .select(getCurrentFolder)
.pipe(take(1))
.subscribe(node => {
if (node && node.id) {
diff --git a/src/app/store/effects/viewer.effects.ts b/src/app/store/effects/viewer.effects.ts
index fc7be8f10..31ccc90cc 100644
--- a/src/app/store/effects/viewer.effects.ts
+++ b/src/app/store/effects/viewer.effects.ts
@@ -26,16 +26,21 @@
import { Effect, Actions, ofType } from '@ngrx/effects';
import { Injectable } from '@angular/core';
import { map, take } from 'rxjs/operators';
-import { VIEW_FILE, ViewFileAction } from '../actions';
+import {
+ AppStore,
+ ViewerActionTypes,
+ ViewFileAction,
+ ViewNodeAction,
+ getCurrentFolder,
+ getAppSelection,
+ FullscreenViewerAction
+} from '@alfresco/aca-shared/store';
import { Router } from '@angular/router';
import { Store, createSelector } from '@ngrx/store';
-import { AppStore } from '../states';
-import { appSelection, currentFolder } from '../selectors/app.selectors';
-import { ViewNodeAction, VIEW_NODE } from '../actions/viewer.actions';
export const fileToPreview = createSelector(
- appSelection,
- currentFolder,
+ getAppSelection,
+ getCurrentFolder,
(selection, folder) => {
return {
selection,
@@ -52,9 +57,17 @@ export class ViewerEffects {
private router: Router
) {}
+ @Effect({ dispatch: false })
+ fullscreenViewer$ = this.actions$.pipe(
+ ofType(ViewerActionTypes.FullScreen),
+ map(() => {
+ this.enterFullScreen();
+ })
+ );
+
@Effect({ dispatch: false })
viewNode$ = this.actions$.pipe(
- ofType(VIEW_NODE),
+ ofType(ViewerActionTypes.ViewNode),
map(action => {
if (action.location) {
this.router.navigate(
@@ -76,7 +89,7 @@ export class ViewerEffects {
@Effect({ dispatch: false })
viewFile$ = this.actions$.pipe(
- ofType(VIEW_FILE),
+ ofType(ViewerActionTypes.ViewFile),
map(action => {
if (action.payload && action.payload.entry) {
const { id, nodeId, isFile } = action.payload.entry;
@@ -123,4 +136,23 @@ export class ViewerEffects {
path.push('preview', nodeId);
this.router.navigateByUrl(path.join('/'));
}
+
+ enterFullScreen() {
+ const container = (
+ document.documentElement.querySelector(
+ '.adf-viewer__fullscreen-container'
+ )
+ );
+ if (container) {
+ if (container.requestFullscreen) {
+ container.requestFullscreen();
+ } else if (container.webkitRequestFullscreen) {
+ container.webkitRequestFullscreen();
+ } else if (container.mozRequestFullScreen) {
+ container.mozRequestFullScreen();
+ } else if (container.msRequestFullscreen) {
+ container.msRequestFullscreen();
+ }
+ }
+ }
}
diff --git a/src/app/store/states/app.state.ts b/src/app/store/initial-state.ts
similarity index 74%
rename from src/app/store/states/app.state.ts
rename to src/app/store/initial-state.ts
index f1356549d..7af49305d 100644
--- a/src/app/store/states/app.state.ts
+++ b/src/app/store/initial-state.ts
@@ -23,30 +23,10 @@
* along with Alfresco. If not, see .
*/
-import {
- SelectionState,
- ProfileState,
- NavigationState
-} from '@alfresco/adf-extensions';
-import { RepositoryInfo } from '@alfresco/js-api';
-
-export interface AppState {
- appName: string;
- headerColor: string;
- logoPath: string;
- languagePicker: boolean;
- sharedUrl: string;
- selection: SelectionState;
- user: ProfileState;
- navigation: NavigationState;
- infoDrawerOpened: boolean;
- showFacetFilter: boolean;
- documentDisplayMode: string;
- repository: RepositoryInfo;
-}
+import { AppState, AppStore } from '@alfresco/aca-shared/store';
export const INITIAL_APP_STATE: AppState = {
- appName: 'Alfresco Example Content Application',
+ appName: 'Alfresco Content Application',
headerColor: '#2196F3',
logoPath: 'assets/images/alfresco-logo-white.svg',
languagePicker: false,
@@ -76,10 +56,6 @@ export const INITIAL_APP_STATE: AppState = {
}
};
-export interface AppStore {
- app: AppState;
-}
-
export const INITIAL_STATE: AppStore = {
app: INITIAL_APP_STATE
};
diff --git a/src/app/store/models.ts b/src/app/store/models.ts
deleted file mode 100644
index 9aea5f541..000000000
--- a/src/app/store/models.ts
+++ /dev/null
@@ -1,28 +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 .
- */
-
-export * from './models/delete-status.model';
-export * from './models/deleted-node-info.model';
-export * from './models/node-info.model';
diff --git a/src/app/store/reducers/app.reducer.ts b/src/app/store/reducers/app.reducer.ts
index 4f376f50c..04dd55465 100644
--- a/src/app/store/reducers/app.reducer.ts
+++ b/src/app/store/reducers/app.reducer.ts
@@ -24,30 +24,21 @@
*/
import { Action } from '@ngrx/store';
-import { AppState, INITIAL_APP_STATE } from '../states/app.state';
import {
- SET_SELECTED_NODES,
- SetSelectedNodesAction,
- SET_USER_PROFILE,
+ AppState,
+ AppActionTypes,
+ NodeActionTypes,
+ SearchActionTypes,
SetUserProfileAction,
- SET_REPOSITORY_INFO,
- SetRepositoryInfoAction,
- SET_LANGUAGE_PICKER,
SetLanguagePickerAction,
- SET_CURRENT_FOLDER,
SetCurrentFolderAction,
- SET_CURRENT_URL,
SetCurrentUrlAction,
- SET_INFO_DRAWER_STATE,
- SetInfoDrawerStateAction,
- TOGGLE_INFO_DRAWER,
- TOGGLE_DOCUMENT_DISPLAY_MODE,
- SET_INITIAL_STATE,
SetInitialStateAction,
- TOGGLE_SEARCH_FILTER,
- SHOW_SEARCH_FILTER,
- HIDE_SEARCH_FILTER
-} from '../actions';
+ SetSelectedNodesAction,
+ SetRepositoryInfoAction,
+ SetInfoDrawerStateAction
+} from '@alfresco/aca-shared/store';
+import { INITIAL_APP_STATE } from '../initial-state';
export function appReducer(
state: AppState = INITIAL_APP_STATE,
@@ -56,43 +47,43 @@ export function appReducer(
let newState: AppState;
switch (action.type) {
- case SET_INITIAL_STATE:
+ case AppActionTypes.SetInitialState:
newState = Object.assign({}, (action).payload);
break;
- case SET_SELECTED_NODES:
+ case NodeActionTypes.SetSelection:
newState = updateSelectedNodes(state, action);
break;
- case SET_USER_PROFILE:
+ case AppActionTypes.SetUserProfile:
newState = updateUser(state, action);
break;
- case SET_LANGUAGE_PICKER:
+ case AppActionTypes.SetLanguagePicker:
newState = updateLanguagePicker(state, action);
break;
- case SET_CURRENT_FOLDER:
+ case AppActionTypes.SetCurrentFolder:
newState = updateCurrentFolder(state, action);
break;
- case SET_CURRENT_URL:
+ case AppActionTypes.SetCurrentUrl:
newState = updateCurrentUrl(state, action);
break;
- case TOGGLE_INFO_DRAWER:
+ case AppActionTypes.ToggleInfoDrawer:
newState = toggleInfoDrawer(state);
break;
- case SET_INFO_DRAWER_STATE:
+ case AppActionTypes.SetInfoDrawerState:
newState = setInfoDrawer(state, action);
break;
- case TOGGLE_DOCUMENT_DISPLAY_MODE:
+ case AppActionTypes.ToggleDocumentDisplayMode:
newState = toggleDocumentDisplayMode(state);
break;
- case SET_REPOSITORY_INFO:
+ case AppActionTypes.SetRepositoryInfo:
newState = updateRepositoryStatus(state, action);
break;
- case TOGGLE_SEARCH_FILTER:
+ case SearchActionTypes.ToggleFilter:
newState = toggleSearchFilter(state);
break;
- case SHOW_SEARCH_FILTER:
+ case SearchActionTypes.ShowFilter:
newState = showSearchFilter(state);
break;
- case HIDE_SEARCH_FILTER:
+ case SearchActionTypes.HideFilter:
newState = hideSearchFilter(state);
break;
default:
diff --git a/src/app/testing/app-testing.module.ts b/src/app/testing/app-testing.module.ts
index d13f2767f..3e8bf6b0f 100644
--- a/src/app/testing/app-testing.module.ts
+++ b/src/app/testing/app-testing.module.ts
@@ -48,7 +48,6 @@ import { HttpClientModule } from '@angular/common/http';
import { TranslateServiceMock } from './translation.service';
import { StoreModule } from '@ngrx/store';
import { appReducer } from '../store/reducers/app.reducer';
-import { INITIAL_STATE } from '../store/states/app.state';
import { RouterTestingModule } from '@angular/router/testing';
import { EffectsModule } from '@ngrx/effects';
import {
@@ -56,6 +55,7 @@ import {
DocumentListService
} from '@alfresco/adf-content-services';
import { MaterialModule } from '../material.module';
+import { INITIAL_STATE } from '../store/initial-state';
@NgModule({
imports: [
diff --git a/src/app/ui/custom-theme.scss b/src/app/ui/custom-theme.scss
index 097475f51..e970dd835 100644
--- a/src/app/ui/custom-theme.scss
+++ b/src/app/ui/custom-theme.scss
@@ -3,7 +3,6 @@
@import '../components/sidenav/sidenav.component.theme';
@import '../components/about/about.component.theme';
-@import '../components/common/generic-error/generic-error.component.theme';
@import '../components/search/search-input/search-input.component.theme';
@import '../components/settings/settings.component.theme';
@import '../components/current-user/current-user.component.theme';
@@ -60,6 +59,7 @@ $custom-theme-accent: mat-palette($alfresco-accent-orange);
$custom-theme-warn: mat-palette($alfresco-warn);
$custom-theme: mat-light-theme($custom-theme-primary, $custom-theme-accent);
$foreground: map-get($custom-theme, foreground);
+$warn: map-get($custom-theme, warn);
@mixin custom-theme($theme) {
@include custom-adf-toolbar-theme($theme);
@@ -67,7 +67,6 @@ $foreground: map-get($custom-theme, foreground);
@include layout-theme($theme);
@include aca-search-input-theme($theme);
- @include aca-generic-error-theme($theme);
@include app-permission-manager-theme($theme);
@include aca-node-versions-dialog-theme($theme);
@include aca-settings-theme($theme);
@@ -96,3 +95,18 @@ $adf-upload-dragging-border: 1px solid #00bcd4;
$adf-upload-dragging-background: #e0f7fa;
$adf-upload-dragging-level1-color: unset;
$adf-upload-dragging-level1-border: none;
+
+$defaults: (
+ --theme-warn-color: mat-color($warn),
+ --theme-text-color: mat-color($foreground, text, 0.54),
+ --theme-title-color: mat-color($foreground, text, 0.87),
+ --theme-text-disabled-color: mat-color($foreground, text, 0.38),
+ --theme-border-color: mat-color($foreground, text, 0.07)
+);
+
+// defaults
+:root {
+ @each $name, $value in $defaults {
+ #{$name}: #{$value};
+ }
+}
diff --git a/tsconfig.json b/tsconfig.json
index b6dad6889..a0b9424f8 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -20,7 +20,9 @@
],
"@alfresco/adf-office-services-ext/*": [
"dist/@alfresco/adf-office-services-ext/*"
- ]
+ ],
+ "@alfresco/aca-shared": ["dist/@alfresco/aca-shared"],
+ "@alfresco/aca-shared/*": ["dist/@alfresco/aca-shared/*"]
},
"resolveJsonModule": true
},