Rebase with the develop branch

This commit is contained in:
Shubham Bansal
2022-08-14 11:36:30 +00:00
340 changed files with 20955 additions and 37892 deletions

3
.gitignore vendored
View File

@@ -1,3 +1,4 @@
/.angular/cache
*.log
node_modules
bundles
@@ -30,3 +31,5 @@ out-tsc
e2e-result-*
licenses.txt
.DS_Store
.angular

View File

@@ -1,10 +1,10 @@
{
"extends": "../tsconfig.json",
"exclude": [
"../**/*.spec.js",
"../**/*.spec.ts",
"../**/*.spec.tsx",
"../**/*.spec.jsx"
],
"include": ["../**/*"]
"extends": "../tsconfig.json",
"exclude": [
"../**/*.spec.js",
"../**/*.spec.ts",
"../**/*.spec.tsx",
"../**/*.spec.jsx"
],
"include": ["../**/*"]
}

View File

@@ -1,12 +0,0 @@
/**
* Export a function. Accept the base config as the only param.
* @param {Object} options
* @param {Required<import('webpack').Configuration>} options.config
* @param {'DEVELOPMENT' | 'PRODUCTION'} options.mode - change the build configuration. 'PRODUCTION' is used when building the static version of storybook.
*/
module.exports = async ({ config, mode }) => {
// Make whatever fine-grained changes you need
// Return the altered config
return config;
};

View File

@@ -1,2 +1,3 @@
_theming.scss
lib/core/viewer/components/pdf-viewer-host.component.scss
lib/dist

View File

@@ -47,6 +47,13 @@ branches:
only:
- /^master(-patch.*)?$/
- /^develop(-patch.*)?$/
- master
- develop
#remove after upgrade
- angular-upgrade-v13
- angular-upgrade-v14
- /.*old-env.*/
- /.*next-release.*/
- /.*beta.*/
stages:
@@ -61,9 +68,9 @@ stages:
- name: "Build Demo shell"
if: tag IS blank
- name: "Unit test Lib"
if: type = pull_request || (type = cron || type = api)
if: type = pull_request || (type = cron || type = api) || branch = "angular-upgrade-v13"
- name: "e2e Test"
if: type = pull_request || (type = cron || type = api)
if: type = pull_request || (type = cron || type = api) || branch = "angular-upgrade-v13"
- name: "Release tag"
if: branch =~ /^master(-patch.*)?$/
- name: "Deprecate develop builds"
@@ -120,10 +127,13 @@ jobs:
- stage: "Build Demo shell"
name: "Demo Shell & Storybook :Build && dockerize"
before_script:
- NODE_OPTIONS="--max-old-space-size=8192" $(npm bin)/nx run cli:build --prod
- ./scripts/build/build-cli.sh
script:
# Build Demo shell & Storybook for production docker"
- NODE_OPTIONS=--max_old_space_size=8192 nx build demoshell --configuration production
- NODE_OPTIONS=--max_old_space_size=8192 nx run stories:build-storybook --configuration ci
- NODE_OPTIONS=--max_old_space_size=8192 nx run stories:build-storybook --configuration ci --projectBuildConfig=stories:build-storybook
- ./scripts/travis/release/release-docker.sh
workspaces:
create:
@@ -187,11 +197,15 @@ jobs:
- ./scripts/ci/check-env/check-cs-env.sh || travis_terminate 1
- ./scripts/ci/check-env/check-ps-env.sh || travis_terminate 1
script: ./scripts/travis/e2e/e2e.sh
after_script: ./scripts/ci/job_hooks/after_e2e.sh
workspaces:
use:
- built_libs_cache
- built_demo_shell_cache
create:
name: e2e_cache
paths:
- "$SMART_RUNNER_DIRECTORY"
use:
- built_libs_cache
- built_demo_shell_cache
- e2e_cache
env:
- FOLDER="core"
- PROVIDER='ALL'
@@ -203,11 +217,15 @@ jobs:
- ./scripts/ci/job_hooks/before_e2e.sh
- ./scripts/ci/check-env/check-cs-env.sh || travis_terminate 1
script: ./scripts/travis/e2e/e2e.sh
after_script: ./scripts/ci/job_hooks/after_e2e.sh
workspaces:
use:
- built_libs_cache
- built_demo_shell_cache
create:
name: e2e_cache
paths:
- "$SMART_RUNNER_DIRECTORY"
use:
- built_libs_cache
- built_demo_shell_cache
- e2e_cache
env:
- FOLDER="content-services/components"
- PROVIDER="ECM"
@@ -219,11 +237,15 @@ jobs:
- ./scripts/ci/job_hooks/before_e2e.sh
- ./scripts/ci/check-env/check-cs-env.sh || travis_terminate 1
script: ./scripts/travis/e2e/e2e.sh
after_script: ./scripts/ci/job_hooks/after_e2e.sh
workspaces:
use:
- built_libs_cache
- built_demo_shell_cache
create:
name: e2e_cache
paths:
- "$SMART_RUNNER_DIRECTORY"
use:
- built_libs_cache
- built_demo_shell_cache
- e2e_cache
env:
- FOLDER="content-services/directives"
- PROVIDER="ECM"
@@ -235,11 +257,15 @@ jobs:
- ./scripts/ci/job_hooks/before_e2e.sh
- ./scripts/ci/check-env/check-cs-env.sh || travis_terminate 1
script: ./scripts/travis/e2e/e2e.sh
after_script: ./scripts/ci/job_hooks/after_e2e.sh
workspaces:
use:
- built_libs_cache
- built_demo_shell_cache
create:
name: e2e_cache
paths:
- "$SMART_RUNNER_DIRECTORY"
use:
- built_libs_cache
- built_demo_shell_cache
- e2e_cache
env:
- FOLDER="content-services/document-list"
- PROVIDER="ECM"
@@ -251,11 +277,15 @@ jobs:
- ./scripts/ci/job_hooks/before_e2e.sh
- ./scripts/ci/check-env/check-cs-env.sh || travis_terminate 1
script: ./scripts/travis/e2e/e2e.sh
after_script: ./scripts/ci/job_hooks/after_e2e.sh
workspaces:
use:
- built_libs_cache
- built_demo_shell_cache
create:
name: e2e_cache
paths:
- "$SMART_RUNNER_DIRECTORY"
use:
- built_libs_cache
- built_demo_shell_cache
- e2e_cache
env:
- FOLDER="content-services/metadata"
- PROVIDER="ECM"
@@ -267,11 +297,15 @@ jobs:
- ./scripts/ci/job_hooks/before_e2e.sh
- ./scripts/ci/check-env/check-cs-env.sh || travis_terminate 1
script: ./scripts/travis/e2e/e2e.sh
after_script: ./scripts/ci/job_hooks/after_e2e.sh
workspaces:
use:
- built_libs_cache
- built_demo_shell_cache
create:
name: e2e_cache
paths:
- "$SMART_RUNNER_DIRECTORY"
use:
- built_libs_cache
- built_demo_shell_cache
- e2e_cache
env:
- FOLDER="content-services/upload"
- PROVIDER="ECM"
@@ -283,11 +317,15 @@ jobs:
- ./scripts/ci/job_hooks/before_e2e.sh
- ./scripts/ci/check-env/check-cs-env.sh || travis_terminate 1
script: ./scripts/travis/e2e/e2e.sh
after_script: ./scripts/ci/job_hooks/after_e2e.sh
workspaces:
use:
- built_libs_cache
- built_demo_shell_cache
create:
name: e2e_cache
paths:
- "$SMART_RUNNER_DIRECTORY"
use:
- built_libs_cache
- built_demo_shell_cache
- e2e_cache
env:
- FOLDER="search"
- PROVIDER="ECM"
@@ -296,15 +334,19 @@ jobs:
- stage: "e2e Test"
name: "Process: Form"
before_script:
- ./scripts/ci/job_hooks/before_e2e.sh || travis_terminate 1
- ./scripts/ci/job_hooks/before_e2e.sh
- ./scripts/ci/check-env/check-ps-env.sh || travis_terminate 1
- ./scripts/ci/check-env/check-external-cs-env.sh || travis_terminate 1
script: ./scripts/travis/e2e/e2e.sh
after_script: ./scripts/ci/job_hooks/after_e2e.sh
workspaces:
use:
- built_libs_cache
- built_demo_shell_cache
create:
name: e2e_cache
paths:
- "$SMART_RUNNER_DIRECTORY"
use:
- built_libs_cache
- built_demo_shell_cache
- e2e_cache
env:
- FOLDER="process-services/form"
- PROVIDER="BPM"
@@ -313,15 +355,19 @@ jobs:
- stage: "e2e Test"
name: "Process: Process"
before_script:
- ./scripts/ci/job_hooks/before_e2e.sh || travis_terminate 1
- ./scripts/ci/job_hooks/before_e2e.sh
- ./scripts/ci/check-env/check-ps-env.sh || travis_terminate 1
- ./scripts/ci/check-env/check-external-cs-env.sh || travis_terminate 1
script: ./scripts/travis/e2e/e2e.sh
after_script: ./scripts/ci/job_hooks/after_e2e.sh
workspaces:
use:
- built_libs_cache
- built_demo_shell_cache
create:
name: e2e_cache
paths:
- "$SMART_RUNNER_DIRECTORY"
use:
- built_libs_cache
- built_demo_shell_cache
- e2e_cache
env:
- FOLDER="process-services/process"
- PROVIDER="BPM"
@@ -330,15 +376,19 @@ jobs:
- stage: "e2e Test"
name: "Process: Tasks"
before_script:
- ./scripts/ci/job_hooks/before_e2e.sh || travis_terminate 1
- ./scripts/ci/job_hooks/before_e2e.sh
- ./scripts/ci/check-env/check-ps-env.sh || travis_terminate 1
- ./scripts/ci/check-env/check-external-cs-env.sh || travis_terminate 1
script: ./scripts/travis/e2e/e2e.sh
after_script: ./scripts/ci/job_hooks/after_e2e.sh
workspaces:
use:
- built_libs_cache
- built_demo_shell_cache
create:
name: e2e_cache
paths:
- "$SMART_RUNNER_DIRECTORY"
use:
- built_libs_cache
- built_demo_shell_cache
- e2e_cache
env:
- FOLDER="process-services/tasks"
- PROVIDER="BPM"
@@ -347,20 +397,36 @@ jobs:
- stage: "e2e Test"
name: "Process: Widgets"
before_script:
- ./scripts/ci/job_hooks/before_e2e.sh || travis_terminate 1
- ./scripts/ci/job_hooks/before_e2e.sh
- ./scripts/ci/check-env/check-ps-env.sh || travis_terminate 1
- ./scripts/ci/check-env/check-external-cs-env.sh || travis_terminate 1
script: ./scripts/travis/e2e/e2e.sh
after_script: ./scripts/ci/job_hooks/after_e2e.sh
workspaces:
use:
- built_libs_cache
- built_demo_shell_cache
create:
name: e2e_cache
paths:
- "$SMART_RUNNER_DIRECTORY"
use:
- built_libs_cache
- built_demo_shell_cache
- e2e_cache
env:
- FOLDER="process-services/widgets"
- PROVIDER="BPM"
- AUTH_TYPE="OAUTH"
- stage: "e2e Test"
name: "Process Cloud:playwright"
before_script:
- ./scripts/ci/job_hooks/before_e2e.sh
- ./scripts/ci/jobs/dbpci-before-playwright || travis_terminate 1
- ./scripts/ci/check-env/check-ps-cloud-env.sh || travis_terminate 1
script: ./scripts/travis/storybook-testing/storybook-test.sh
workspaces:
use:
- built_libs_cache
- built_demo_shell_cache
- stage: "e2e Test"
name: "Process Cloud : Form"
before_script:
@@ -368,11 +434,15 @@ jobs:
- ./scripts/ci/check-env/check-cs-env.sh || travis_terminate 1
- ./scripts/ci/check-env/check-ps-cloud-env.sh || travis_terminate 1
script: ./scripts/travis/e2e/e2e.sh
after_script: ./scripts/ci/job_hooks/after_e2e.sh
workspaces:
use:
- built_libs_cache
- built_demo_shell_cache
create:
name: e2e_cache
paths:
- "$SMART_RUNNER_DIRECTORY"
use:
- built_libs_cache
- built_demo_shell_cache
- e2e_cache
env:
- FOLDER="process-services-cloud/form-field"
- PROVIDER="ALL"
@@ -386,11 +456,15 @@ jobs:
- ./scripts/ci/check-env/check-cs-env.sh || travis_terminate 1
- ./scripts/ci/check-env/check-ps-cloud-env.sh || travis_terminate 1
script: ./scripts/travis/e2e/e2e.sh
after_script: ./scripts/ci/job_hooks/after_e2e.sh
workspaces:
use:
- built_libs_cache
- built_demo_shell_cache
create:
name: e2e_cache
paths:
- "$SMART_RUNNER_DIRECTORY"
use:
- built_libs_cache
- built_demo_shell_cache
- e2e_cache
env:
- FOLDER="process-services-cloud/people"
- PROVIDER="ALL"
@@ -404,11 +478,15 @@ jobs:
- ./scripts/ci/check-env/check-cs-env.sh || travis_terminate 1
- ./scripts/ci/check-env/check-ps-cloud-env.sh || travis_terminate 1
script: ./scripts/travis/e2e/e2e.sh
after_script: ./scripts/ci/job_hooks/after_e2e.sh
workspaces:
use:
- built_libs_cache
- built_demo_shell_cache
create:
name: e2e_cache
paths:
- "$SMART_RUNNER_DIRECTORY"
use:
- built_libs_cache
- built_demo_shell_cache
- e2e_cache
env:
- FOLDER="process-services-cloud/process"
- PROVIDER="ALL"
@@ -422,11 +500,15 @@ jobs:
- ./scripts/ci/check-env/check-cs-env.sh || travis_terminate 1
- ./scripts/ci/check-env/check-ps-cloud-env.sh || travis_terminate 1
script: ./scripts/travis/e2e/e2e.sh
after_script: ./scripts/ci/job_hooks/after_e2e.sh
workspaces:
use:
- built_libs_cache
- built_demo_shell_cache
create:
name: e2e_cache
paths:
- "$SMART_RUNNER_DIRECTORY"
use:
- built_libs_cache
- built_demo_shell_cache
- e2e_cache
env:
- FOLDER="process-services-cloud/start-task"
- PROVIDER="ALL"
@@ -440,11 +522,15 @@ jobs:
- ./scripts/ci/check-env/check-cs-env.sh || travis_terminate 1
- ./scripts/ci/check-env/check-ps-cloud-env.sh || travis_terminate 1
script: ./scripts/travis/e2e/e2e.sh
after_script: ./scripts/ci/job_hooks/after_e2e.sh
workspaces:
use:
- built_libs_cache
- built_demo_shell_cache
create:
name: e2e_cache
paths:
- "$SMART_RUNNER_DIRECTORY"
use:
- built_libs_cache
- built_demo_shell_cache
- e2e_cache
env:
- FOLDER="process-services-cloud/task-list"
- PROVIDER="ALL"

View File

@@ -1,6 +1,4 @@
{
"recommendations": [
"stylelint.vscode-stylelint",
"editorconfig.editorconfig",
]
}

0
NX Normal file
View File

View File

@@ -72,4 +72,3 @@ All components are supported in the following browsers:
* Due to a [known issue](https://bugzilla.mozilla.org/show_bug.cgi?id=1188880) in Firefox, the Alfresco Upload Component does not currently support folder upload functionality on Firefox.
See the [Browser Support](BROWSER-SUPPORT.md) article for more details.

View File

@@ -11,12 +11,10 @@
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"extractCss": true,
"aot": true,
"allowedCommonJsDependencies": [
"minimatch",
"minimatch-browser",
"moment-es6",
"superagent",
"event-emitter",
"brace-expansion",
@@ -177,24 +175,27 @@
"node_modules/pdfjs-dist/web/pdf_viewer.js",
"node_modules/raphael/raphael.min.js",
"node_modules/moment/min/moment.min.js"
]
],
"vendorChunk": true,
"extractLicenses": false,
"buildOptimizer": false,
"sourceMap": true,
"optimization": false,
"namedChunks": true
},
"configurations": {
"production": {
"budgets": [
{
"type": "anyComponentStyle",
"maximumWarning": "6kb"
"maximumWarning": "12kb"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": true,
"buildOptimizer": true,
"verbose": false,
"fileReplacements": [
@@ -214,11 +215,8 @@
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": true,
"buildOptimizer": true,
"verbose": false,
"fileReplacements": [
@@ -228,7 +226,8 @@
}
]
}
}
},
"defaultConfiguration": ""
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
@@ -389,29 +388,17 @@
"protractorConfig": "./e2e/protractor.conf.js",
"devServerTarget": "lib-e2e-test:serve"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"./e2e/tsconfig.e2e.json"
],
"exclude": [
"**/lib/**/*",
"**/node_modules/**/*"
]
}
}
}
},
"core": {
"projectType": "library",
"root": "lib/core",
"sourceRoot": "lib/core",
"projectType": "library",
"prefix": "adf",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"tsConfig": "lib/core/tsconfig.lib.json",
"project": "lib/core/ng-package.json"
@@ -420,8 +407,12 @@
"production": {
"project": "lib/core/ng-package.json",
"tsConfig": "lib/core/tsconfig.lib.prod.json"
},
"development": {
"tsConfig": "lib/core/tsconfig.lib.json"
}
}
},
"defaultConfiguration": "production"
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
@@ -486,7 +477,7 @@
"prefix": "adf",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"tsConfig": "lib/content-services/tsconfig.lib.json",
"project": "lib/content-services/ng-package.json"
@@ -558,7 +549,7 @@
"prefix": "adf",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"tsConfig": "lib/process-services/tsconfig.lib.json",
"project": "lib/process-services/ng-package.json"
@@ -597,7 +588,7 @@
"prefix": "adf-cloud",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"tsConfig": "lib/process-services-cloud/tsconfig.lib.json",
"project": "lib/process-services-cloud/ng-package.json"
@@ -669,7 +660,7 @@
"prefix": "adf",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"tsConfig": "lib/insights/tsconfig.lib.json",
"project": "lib/insights/ng-package.json"
@@ -708,7 +699,7 @@
"prefix": "adf",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"tsConfig": "lib/extensions/tsconfig.lib.json",
"project": "lib/extensions/ng-package.json"
@@ -746,13 +737,26 @@
"prefix": "adf",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"builder": "@nrwl/node:webpack",
"options": {
"tsConfig": "lib/testing/tsconfig.lib.json",
"project": "lib/testing/ng-package.json"
"projectRoot": "lib/testing",
"outputPath": "lib/dist/testing",
"main": "lib/testing/index.ts",
"generatePackageJson" : true,
"tsConfig": "lib/testing/tsconfig.lib.prod.json",
"additionalEntryPoints": [
{
"entryName": "shared",
"entryPath": "/lib/testing/src/lib/shared/index.ts"
}
]
},
"configurations": {
"production": {
"projectRoot": "lib/testing",
"outputPath": "lib/dist/testing",
"main": "lib/testing/index.ts",
"generatePackageJson" : true,
"tsConfig": "lib/testing/tsconfig.lib.prod.json"
}
}
@@ -775,13 +779,15 @@
"prefix": "adf",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"builder": "@nrwl/workspace:run-commands",
"options": {
"tsConfig": "lib/cli/tsconfig.json"
"commands": [
"cd lib/cli && npm i && npm run dist"
]
},
"configurations": {
"production": {
"tsConfig": "lib/cli/tsconfig.lib.prod.json"
"tsConfig": "lib/cli/tsconfig.json"
}
}
},

View File

@@ -4,10 +4,6 @@
"outDir": "../out-tsc/e2e",
"module": "commonjs",
"target": "es5",
"types":[
"jasmine",
"jasminewd2",
"node"
]
"types": ["jasmine", "jasminewd2", "node"]
}
}

View File

@@ -1,7 +1,7 @@
{
"name": "Alfresco-ADF-Angular-Demo",
"description": "Demo shell for Alfresco Angular components",
"version": "4.11.0",
"version": "5.0.0-angular.13.2",
"author": "Alfresco Software, Ltd.",
"repository": {
"type": "git",

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { AspectListService } from '@alfresco/adf-content-services';
import { DialogAspectListService } from '@alfresco/adf-content-services';
import { Component } from '@angular/core';
@Component({
@@ -30,14 +30,14 @@ export class AspectListSampleComponent {
currentResult: string[] = [];
constructor(private aspectListService: AspectListService) { }
constructor(private dialogAspectListService: DialogAspectListService) { }
showAspectForNode() {
this.isShowed = !this.isShowed;
}
openAspectDialog() {
this.aspectListService.openAspectListDialog(this.currentNodeId).subscribe((result) => this.currentResult = Array.from(result));
this.dialogAspectListService.openAspectListDialog(this.currentNodeId).subscribe((result) => this.currentResult = Array.from(result));
}
onValueChanged(aspects) {

View File

@@ -38,7 +38,7 @@ import {
LibraryDialogComponent,
ContentMetadataService,
FilterSearch,
AspectListService
DialogAspectListService
} from '@alfresco/adf-content-services';
import { SelectAppsDialogComponent, ProcessFormRenderingService } from '@alfresco/adf-process-services';
@@ -233,7 +233,7 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
public alfrescoApiService: AlfrescoApiService,
private contentMetadataService: ContentMetadataService,
private sharedLinksApiService: SharedLinksApiService,
private aspectListService: AspectListService,
private dialogAspectListService: DialogAspectListService,
private nodeService: NodesApiService) {
}
@@ -474,7 +474,7 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
}
onAspectUpdate(event: any) {
this.aspectListService.openAspectListDialog(event.value.entry.id).subscribe((aspectList) => {
this.dialogAspectListService.openAspectListDialog(event.value.entry.id).subscribe((aspectList) => {
this.nodeService.updateNode(event.value.entry.id, {aspectNames : [...aspectList]}).subscribe(() => {
this.openSnackMessageInfo('Node Aspects Updated');
});

View File

@@ -19,7 +19,7 @@ import { Component, OnInit, OnDestroy } from '@angular/core';
import { FormGroup, FormBuilder, Validators, FormControl, AbstractControl } from '@angular/forms';
import { ActivatedRoute, Params } from '@angular/router';
import { debounceTime, takeUntil } from 'rxjs/operators';
import moment from 'moment-es6';
import moment from 'moment';
import { Subject } from 'rxjs';
const DEFAULT_SIZE = 20;

View File

@@ -1,11 +1,11 @@
@import '~@angular/material/theming';
@use '@angular/material' as mat;
@import '../../lib/core/styles/index';
@include mat-core($alfresco-typography);
@include mat.core($alfresco-typography);
$primary: mat-palette($alfresco-accent-orange);
$accent: mat-palette($alfresco-accent-purple);
$warn: mat-palette($alfresco-warn);
$theme: mat-light-theme(
$primary: mat.define-palette($alfresco-accent-orange);
$accent: mat.define-palette($alfresco-accent-purple);
$warn: mat.define-palette($alfresco-warn);
$theme: mat.define-light-theme(
(
color: (
primary: $primary,
@@ -14,7 +14,7 @@ $theme: mat-light-theme(
)
);
@include angular-material-theme($theme);
@include mat.all-component-themes($theme);
@include alfresco-material-theme($theme);
body,
@@ -22,9 +22,9 @@ html {
margin: 0;
height: 100%;
overflow: hidden;
font-size: mat-font-size($alfresco-typography, body-1);
font-family: mat-font-family($alfresco-typography);
line-height: mat-line-height($alfresco-typography, body-1);
font-size: mat.font-size($alfresco-typography, body-1);
font-family: mat.font-family($alfresco-typography);
line-height: mat.line-height($alfresco-typography, body-1);
}
body {

View File

@@ -1,11 +1,11 @@
@import '~@angular/material/theming';
@use '@angular/material' as mat;
@import '~@alfresco/adf-core/theming';
@include mat-core($alfresco-typography);
@include mat.core($alfresco-typography);
$primary: mat-palette($alfresco-accent-orange);
$accent: mat-palette($alfresco-accent-purple);
$warn: mat-palette($alfresco-warn);
$theme: mat-light-theme(
$primary: mat.define-palette($alfresco-accent-orange);
$accent: mat.define-palette($alfresco-accent-purple);
$warn: mat.define-palette($alfresco-warn);
$theme: mat.define-light-theme(
(
color: (
primary: $primary,
@@ -14,7 +14,7 @@ $theme: mat-light-theme(
)
);
@include angular-material-theme($theme);
@include mat.all-component-themes($theme);
@include alfresco-material-theme($theme);
body,
@@ -22,9 +22,9 @@ html {
margin: 0;
height: 100%;
overflow: hidden;
font-size: mat-font-size($alfresco-typography, body-1);
font-family: mat-font-family($alfresco-typography);
line-height: mat-line-height($alfresco-typography, body-1);
font-size: mat.font-size($alfresco-typography, body-1);
font-family: mat.font-family($alfresco-typography);
line-height: mat.line-height($alfresco-typography, body-1);
}
body {

View File

@@ -35,13 +35,10 @@
* BROWSER POLYFILLS
*/
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
// import 'classlist.js'; // Run `npm install --save classlist.js`.
/***************************************************************************************************
* Zone JS is required by Angular itself.
*/
import 'zone.js/dist/zone'; // Included with Angular CLI.
import 'zone.js'; // Included with Angular CLI.
/**
* Support custom event in IE11

View File

@@ -17,7 +17,7 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/dist/zone-testing';
import 'zone.js/testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
@@ -29,7 +29,9 @@ declare const require: any;
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
platformBrowserDynamicTesting(), {
teardown: { destroyAfterEach: false }
}
);
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);

View File

@@ -29,3 +29,4 @@ The pages linked below contain the licenses for all third party dependencies of
- [ADF 4.9.0](license-info-4.9.0.md)
- [ADF 4.10.0](license-info-4.10.0.md)
- [ADF 4.11.0](license-info-4.11.0.md)
- [ADF 5.0.0-angular.13](license-info-5.0.0-angular.13.md)

View File

@@ -0,0 +1,193 @@
---
Title: License info, alfresco-ng2-components 5.0.0-angular.13
---
# License information for alfresco-ng2-components 5.0.0-angular.13
This page lists all third party libraries the project depends on.
## Libraries
| Name | Version | License |
| --- | --- | --- |
| [@alfresco/js-api](https://github.com/Alfresco/alfresco-js-api) | 4.12.0-238 | [Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0) |
| [@angular/animations](https://github.com/angular/angular) | 13.3.11 | [MIT](http://www.opensource.org/licenses/MIT) |
| [@angular/cdk](https://github.com/angular/components) | 13.2.4 | [MIT](http://www.opensource.org/licenses/MIT) |
| [@angular/common](https://github.com/angular/angular) | 13.3.11 | [MIT](http://www.opensource.org/licenses/MIT) |
| [@angular/compiler](https://github.com/angular/angular) | 13.3.11 | [MIT](http://www.opensource.org/licenses/MIT) |
| [@angular/compiler](https://github.com/angular/angular) | 9.0.0 | [MIT](http://www.opensource.org/licenses/MIT) |
| [@angular/core](https://github.com/angular/angular) | 13.3.11 | [MIT](http://www.opensource.org/licenses/MIT) |
| [@angular/core](https://github.com/angular/angular) | 9.0.0 | [MIT](http://www.opensource.org/licenses/MIT) |
| [@angular/flex-layout](https://github.com/angular/flex-layout) | 13.0.0-beta.38 | [MIT](http://www.opensource.org/licenses/MIT) |
| [@angular/forms](https://github.com/angular/angular) | 13.3.11 | [MIT](http://www.opensource.org/licenses/MIT) |
| [@angular/material-moment-adapter](https://github.com/angular/components) | 13.3.9 | [MIT](http://www.opensource.org/licenses/MIT) |
| [@angular/material](https://github.com/angular/components) | 13.3.9 | [MIT](http://www.opensource.org/licenses/MIT) |
| [@angular/platform-browser-dynamic](https://github.com/angular/angular) | 13.3.11 | [MIT](http://www.opensource.org/licenses/MIT) |
| [@angular/platform-browser](https://github.com/angular/angular) | 13.3.11 | [MIT](http://www.opensource.org/licenses/MIT) |
| [@angular/router](https://github.com/angular/angular) | 13.3.11 | [MIT](http://www.opensource.org/licenses/MIT) |
| [@apollo/client](https://github.com/apollographql/apollo-client) | 3.6.9 | [MIT](http://www.opensource.org/licenses/MIT) |
| [@babel/code-frame](https://github.com/babel/babel) | 7.18.6 | [MIT](http://www.opensource.org/licenses/MIT) |
| [@babel/helper-validator-identifier](https://github.com/babel/babel) | 7.18.6 | [MIT](http://www.opensource.org/licenses/MIT) |
| [@babel/highlight](https://github.com/babel/babel) | 7.18.6 | [MIT](http://www.opensource.org/licenses/MIT) |
| [@editorjs/editorjs](https://github.com/codex-team/editor.js) | 2.25.0 | [Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0) |
| [@editorjs/header](https://github.com/editor-js/header) | 2.6.2 | [MIT](http://www.opensource.org/licenses/MIT) |
| [@editorjs/list](https://github.com/editor-js/list) | 1.7.0 | [MIT](http://www.opensource.org/licenses/MIT) |
| [@editorjs/underline](https://github.com/editor-js/underline) | 1.0.0 | [MIT](http://www.opensource.org/licenses/MIT) |
| [@graphql-typed-document-node/core](https://github.com/dotansimha/graphql-typed-document-node) | 3.1.1 | [MIT](http://www.opensource.org/licenses/MIT) |
| [@mat-datetimepicker/core](https://github.com/kuhnroyal/mat-datetimepicker) | 9.0.68 | [MIT](http://www.opensource.org/licenses/MIT) |
| [@mat-datetimepicker/moment](https://github.com/kuhnroyal/mat-datetimepicker) | 9.0.68 | [MIT](http://www.opensource.org/licenses/MIT) |
| [@ngx-translate/core](https://github.com/ngx-translate/core) | 13.0.0 | [MIT](http://www.opensource.org/licenses/MIT) |
| [@types/chart.js](https://github.com/DefinitelyTyped/DefinitelyTyped) | 2.9.37 | [MIT](http://www.opensource.org/licenses/MIT) |
| [@wry/context](https://github.com/benjamn/wryware) | 0.6.1 | [MIT](http://www.opensource.org/licenses/MIT) |
| [@wry/equality](https://github.com/benjamn/wryware) | 0.5.2 | [MIT](http://www.opensource.org/licenses/MIT) |
| [@wry/trie](https://github.com/benjamn/wryware) | 0.3.1 | [MIT](http://www.opensource.org/licenses/MIT) |
| [adf-tslint-rules](https://github.com/Alfresco/alfresco-ng2-components) | 0.0.7 | [Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0) |
| [alfresco-ng2-components](https://github.com/Alfresco/alfresco-ng2-components) | 5.0.0-angular.13 | [Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0) |
| [ansi-styles](https://github.com/chalk/ansi-styles) | 3.2.1 | [MIT](http://www.opensource.org/licenses/MIT) |
| [apollo-angular](https://github.com/kamilkisiela/apollo-angular) | 2.6.0 | [MIT](http://www.opensource.org/licenses/MIT) |
| [app-root-path](https://github.com/inxilpro/node-app-root-path) | 2.0.1 | [MIT](http://www.opensource.org/licenses/MIT) |
| [app-root-path](https://github.com/inxilpro/node-app-root-path) | 3.0.0 | [MIT](http://www.opensource.org/licenses/MIT) |
| [argparse](https://github.com/nodeca/argparse) | 1.0.10 | [MIT](http://www.opensource.org/licenses/MIT) |
| [aria-query](https://github.com/A11yance/aria-query) | 3.0.0 | [Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0) |
| [ast-types-flow](https://github.com/kyldvs/ast-types-flow) | 0.0.7 | [ISC](https://www.isc.org/downloads/software-support-policy/isc-license/) |
| [asynckit](https://github.com/alexindigo/asynckit) | 0.4.0 | [MIT](http://www.opensource.org/licenses/MIT) |
| [axobject-query](https://github.com/A11yance/axobject-query) | 2.0.2 | [Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0) |
| [backo2](https://github.com/mokesmokes/backo) | 1.0.2 | [MIT](http://www.opensource.org/licenses/MIT) |
| [balanced-match](https://github.com/juliangruber/balanced-match) | 1.0.2 | [MIT](http://www.opensource.org/licenses/MIT) |
| [brace-expansion](https://github.com/juliangruber/brace-expansion) | 1.1.11 | [MIT](http://www.opensource.org/licenses/MIT) |
| [brace-expansion](https://github.com/juliangruber/brace-expansion) | 2.0.1 | [MIT](http://www.opensource.org/licenses/MIT) |
| [builtin-modules](https://github.com/sindresorhus/builtin-modules) | 1.1.1 | [MIT](http://www.opensource.org/licenses/MIT) |
| [call-bind](https://github.com/ljharb/call-bind) | 1.0.2 | [MIT](http://www.opensource.org/licenses/MIT) |
| [chalk](https://github.com/chalk/chalk) | 2.4.2 | [MIT](http://www.opensource.org/licenses/MIT) |
| [chart.js](https://github.com/chartjs/Chart.js) | 2.9.4 | [MIT](http://www.opensource.org/licenses/MIT) |
| [chartjs-color-string](https://github.com/chartjs/chartjs-color-string) | 0.6.0 | [MIT](http://www.opensource.org/licenses/MIT) |
| [chartjs-color](https://github.com/chartjs/chartjs-color) | 2.4.1 | [MIT](http://www.opensource.org/licenses/MIT) |
| [codelyzer](https://github.com/mgechev/codelyzer) | 6.0.2 | [MIT](http://www.opensource.org/licenses/MIT) |
| [codex-notifier](https://github.com/codex-team/js-notifier) | 1.1.2 | [MIT](http://www.opensource.org/licenses/MIT) |
| [codex-tooltip](https://github.com/codex-team/codex.tooltips) | 1.0.5 | [MIT](http://www.opensource.org/licenses/MIT) |
| [color-convert](https://github.com/Qix-/color-convert) | 1.9.3 | [MIT](http://www.opensource.org/licenses/MIT) |
| [color-name](https://github.com/dfcreative/color-name) | 1.1.3 | [MIT](http://www.opensource.org/licenses/MIT) |
| [color-name](https://github.com/colorjs/color-name) | 1.1.4 | [MIT](http://www.opensource.org/licenses/MIT) |
| [combined-stream](https://github.com/felixge/node-combined-stream) | 1.0.8 | [MIT](http://www.opensource.org/licenses/MIT) |
| [commander](https://github.com/tj/commander.js) | 2.20.3 | [MIT](http://www.opensource.org/licenses/MIT) |
| [component-emitter](https://github.com/component/emitter) | 1.3.0 | [MIT](http://www.opensource.org/licenses/MIT) |
| [concat-map](https://github.com/substack/node-concat-map) | 0.0.1 | [MIT](http://www.opensource.org/licenses/MIT) |
| [cookiejar](https://github.com/bmeck/node-cookiejar) | 2.1.3 | [MIT](http://www.opensource.org/licenses/MIT) |
| [cropperjs](https://github.com/fengyuanchen/cropperjs) | 1.5.12 | [MIT](http://www.opensource.org/licenses/MIT) |
| [css-selector-tokenizer](https://github.com/css-modules/css-selector-tokenizer) | 0.7.0 | [MIT](http://www.opensource.org/licenses/MIT) |
| [css-selector-tokenizer](https://github.com/css-modules/css-selector-tokenizer) | 0.7.3 | [MIT](http://www.opensource.org/licenses/MIT) |
| [cssauron](https://github.com/chrisdickinson/cssauron) | 1.4.0 | [MIT](http://www.opensource.org/licenses/MIT) |
| [cssesc](https://github.com/mathiasbynens/cssesc) | 0.1.0 | [MIT](http://www.opensource.org/licenses/MIT) |
| [cssesc](https://github.com/mathiasbynens/cssesc) | 3.0.0 | [MIT](http://www.opensource.org/licenses/MIT) |
| [custom-event-polyfill](https://github.com/kumarharsh/custom-event-polyfill) | 1.0.7 | [MIT](http://www.opensource.org/licenses/MIT) |
| [d](https://github.com/medikoo/d) | 1.0.1 | [ISC](https://www.isc.org/downloads/software-support-policy/isc-license/) |
| [damerau-levenshtein](https://github.com/tad-lispy/node-damerau-levenshtein) | 1.0.8 | [BSD-2-Clause](http://www.opensource.org/licenses/BSD-2-Clause) |
| [debug](https://github.com/debug-js/debug) | 4.3.4 | [MIT](http://www.opensource.org/licenses/MIT) |
| [delayed-stream](https://github.com/felixge/node-delayed-stream) | 1.0.0 | [MIT](http://www.opensource.org/licenses/MIT) |
| [diff](https://github.com/kpdecker/jsdiff) | 4.0.2 | [BSD-3-Clause](http://www.opensource.org/licenses/BSD-3-Clause) |
| dotenv-expand | 5.1.0 | [BSD-2-Clause](http://www.opensource.org/licenses/BSD-2-Clause) |
| editorjs-html | 3.4.2 | [MIT](http://www.opensource.org/licenses/MIT) |
| [editorjs-paragraph-with-alignment](https://github.com/kaaaaaaaaaaai/paragraph-with-alignment) | 3.0.0 | [MIT](http://www.opensource.org/licenses/MIT) |
| [es5-ext](https://github.com/medikoo/es5-ext) | 0.10.61 | [ISC](https://www.isc.org/downloads/software-support-policy/isc-license/) |
| [es6-iterator](https://github.com/medikoo/es6-iterator) | 2.0.3 | [MIT](http://www.opensource.org/licenses/MIT) |
| [es6-symbol](https://github.com/medikoo/es6-symbol) | 3.1.3 | [ISC](https://www.isc.org/downloads/software-support-policy/isc-license/) |
| [escape-string-regexp](https://github.com/sindresorhus/escape-string-regexp) | 1.0.5 | [MIT](http://www.opensource.org/licenses/MIT) |
| [esprima](https://github.com/jquery/esprima) | 4.0.1 | [BSD-2-Clause](http://www.opensource.org/licenses/BSD-2-Clause) |
| [eve-raphael](https://github.com/tomasAlabes/eve) | 0.5.0 | [Apache](http://www.apache.org/licenses/LICENSE-2.0) |
| [event-emitter](https://github.com/medikoo/event-emitter) | 0.3.5 | [MIT](http://www.opensource.org/licenses/MIT) |
| [eventemitter3](https://github.com/primus/eventemitter3) | 3.1.2 | [MIT](http://www.opensource.org/licenses/MIT) |
| [ext](https://github.com/medikoo/es5-ext.git#ext) | 1.6.0 | [ISC](https://www.isc.org/downloads/software-support-policy/isc-license/) |
| [extract-files](https://github.com/jaydenseric/extract-files) | 9.0.0 | [MIT](http://www.opensource.org/licenses/MIT) |
| [fast-safe-stringify](https://github.com/davidmarkclements/fast-safe-stringify) | 2.1.1 | [MIT](http://www.opensource.org/licenses/MIT) |
| [fastparse](https://github.com/webpack/fastparse) | 1.1.2 | [MIT](http://www.opensource.org/licenses/MIT) |
| [form-data](https://github.com/form-data/form-data) | 3.0.1 | [MIT](http://www.opensource.org/licenses/MIT) |
| [formidable](https://github.com/node-formidable/formidable) | 1.2.6 | [MIT](http://www.opensource.org/licenses/MIT) |
| [fs.realpath](https://github.com/isaacs/fs.realpath) | 1.0.0 | [ISC](https://www.isc.org/downloads/software-support-policy/isc-license/) |
| [function-bind](https://github.com/Raynos/function-bind) | 1.1.1 | [MIT](http://www.opensource.org/licenses/MIT) |
| [get-intrinsic](https://github.com/ljharb/get-intrinsic) | 1.1.2 | [MIT](http://www.opensource.org/licenses/MIT) |
| [glob](https://github.com/isaacs/node-glob) | 7.2.0 | [ISC](https://www.isc.org/downloads/software-support-policy/isc-license/) |
| [graphql-tag](https://github.com/apollographql/graphql-tag) | 2.12.6 | [MIT](http://www.opensource.org/licenses/MIT) |
| [graphql](https://github.com/graphql/graphql-js) | 15.8.0 | [MIT](http://www.opensource.org/licenses/MIT) |
| [has-flag](https://github.com/sindresorhus/has-flag) | 3.0.0 | [MIT](http://www.opensource.org/licenses/MIT) |
| [has-symbols](https://github.com/inspect-js/has-symbols) | 1.0.3 | [MIT](http://www.opensource.org/licenses/MIT) |
| [has](https://github.com/tarruda/has) | 1.0.3 | [MIT](http://www.opensource.org/licenses/MIT) |
| [hoist-non-react-statics](https://github.com/mridgway/hoist-non-react-statics) | 3.3.2 | [BSD-3-Clause](http://www.opensource.org/licenses/BSD-3-Clause) |
| [inflight](https://github.com/npm/inflight) | 1.0.6 | [ISC](https://www.isc.org/downloads/software-support-policy/isc-license/) |
| [inherits](https://github.com/isaacs/inherits) | 2.0.4 | [ISC](https://www.isc.org/downloads/software-support-policy/isc-license/) |
| [is-core-module](https://github.com/inspect-js/is-core-module) | 2.9.0 | [MIT](http://www.opensource.org/licenses/MIT) |
| [iterall](https://github.com/leebyron/iterall) | 1.3.0 | [MIT](http://www.opensource.org/licenses/MIT) |
| [js-tokens](https://github.com/lydell/js-tokens) | 4.0.0 | [MIT](http://www.opensource.org/licenses/MIT) |
| [js-yaml](https://github.com/nodeca/js-yaml) | 3.14.1 | [MIT](http://www.opensource.org/licenses/MIT) |
| [jsesc](https://github.com/mathiasbynens/jsesc) | 0.5.0 | [MIT](http://www.opensource.org/licenses/MIT) |
| [lodash-es](https://github.com/lodash/lodash) | 4.17.21 | [MIT](http://www.opensource.org/licenses/MIT) |
| [loose-envify](https://github.com/zertosh/loose-envify) | 1.4.0 | [MIT](http://www.opensource.org/licenses/MIT) |
| [lru-cache](https://github.com/isaacs/node-lru-cache) | 6.0.0 | [ISC](https://www.isc.org/downloads/software-support-policy/isc-license/) |
| [methods](https://github.com/jshttp/methods) | 1.1.2 | [MIT](http://www.opensource.org/licenses/MIT) |
| [mime-db](https://github.com/jshttp/mime-db) | 1.52.0 | [MIT](http://www.opensource.org/licenses/MIT) |
| [mime-types](https://github.com/jshttp/mime-types) | 2.1.35 | [MIT](http://www.opensource.org/licenses/MIT) |
| [mime](https://github.com/broofa/mime) | 2.6.0 | [MIT](http://www.opensource.org/licenses/MIT) |
| [minimatch-browser](https://github.com/isaacs/minimatch) | 1.0.0 | [ISC](https://www.isc.org/downloads/software-support-policy/isc-license/) |
| [minimatch](https://github.com/isaacs/minimatch) | 3.1.2 | [ISC](https://www.isc.org/downloads/software-support-policy/isc-license/) |
| [minimatch](https://github.com/isaacs/minimatch) | 5.0.1 | [ISC](https://www.isc.org/downloads/software-support-policy/isc-license/) |
| [minimist](https://github.com/substack/minimist) | 1.2.6 | [MIT](http://www.opensource.org/licenses/MIT) |
| [mkdirp](https://github.com/substack/node-mkdirp) | 0.5.6 | [MIT](http://www.opensource.org/licenses/MIT) |
| [moment](https://github.com/moment/moment) | 2.29.4 | [MIT](http://www.opensource.org/licenses/MIT) |
| [ms](https://github.com/zeit/ms) | 2.1.2 | [MIT](http://www.opensource.org/licenses/MIT) |
| [nanoid](https://github.com/ai/nanoid) | 3.3.4 | [MIT](http://www.opensource.org/licenses/MIT) |
| [next-tick](https://github.com/medikoo/next-tick) | 1.1.0 | [ISC](https://www.isc.org/downloads/software-support-policy/isc-license/) |
| [ng2-charts](https://github.com/valor-software/ng2-charts) | 2.4.2 | [ISC](https://www.isc.org/downloads/software-support-policy/isc-license/) |
| [ngx-monaco-editor](https://github.com/atularen/ngx-monaco-editor) | 8.1.1 | [MIT](http://www.opensource.org/licenses/MIT) |
| [object-assign](https://github.com/sindresorhus/object-assign) | 4.1.1 | [MIT](http://www.opensource.org/licenses/MIT) |
| [object-inspect](https://github.com/inspect-js/object-inspect) | 1.12.2 | [MIT](http://www.opensource.org/licenses/MIT) |
| [once](https://github.com/isaacs/once) | 1.4.0 | [ISC](https://www.isc.org/downloads/software-support-policy/isc-license/) |
| [optimism](https://github.com/benjamn/optimism) | 0.16.1 | [MIT](http://www.opensource.org/licenses/MIT) |
| [parse5](https://github.com/inikulin/parse5) | 5.1.1 | [MIT](http://www.opensource.org/licenses/MIT) |
| [path-is-absolute](https://github.com/sindresorhus/path-is-absolute) | 1.0.1 | [MIT](http://www.opensource.org/licenses/MIT) |
| [path-parse](https://github.com/jbgutierrez/path-parse) | 1.0.7 | [MIT](http://www.opensource.org/licenses/MIT) |
| [pdfjs-dist](https://github.com/mozilla/pdfjs-dist) | 2.5.207 | [Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0) |
| [prop-types](https://github.com/facebook/prop-types) | 15.8.1 | [MIT](http://www.opensource.org/licenses/MIT) |
| [qs](https://github.com/ljharb/qs) | 6.11.0 | [BSD-3-Clause](http://www.opensource.org/licenses/BSD-3-Clause) |
| [raphael](https://github.com/DmitryBaranovskiy/raphael) | 2.3.0 | [MIT](http://www.opensource.org/licenses/MIT) |
| [react-is](https://github.com/facebook/react) | 16.13.1 | [MIT](http://www.opensource.org/licenses/MIT) |
| [react](https://github.com/facebook/react) | 16.14.0 | [MIT](http://www.opensource.org/licenses/MIT) |
| [readable-stream](https://github.com/nodejs/readable-stream) | 3.6.0 | [MIT](http://www.opensource.org/licenses/MIT) |
| [regenerate](https://github.com/mathiasbynens/regenerate) | 1.4.2 | [MIT](http://www.opensource.org/licenses/MIT) |
| [regexpu-core](https://github.com/mathiasbynens/regexpu-core) | 1.0.0 | [MIT](http://www.opensource.org/licenses/MIT) |
| [regjsgen](https://github.com/d10/regjsgen) | 0.2.0 | [MIT](http://www.opensource.org/licenses/MIT) |
| [regjsparser](https://github.com/jviereck/regjsparser) | 0.1.5 | [BSD](http://www.opensource.org/licenses/BSD-2-Clause) |
| [resolve](https://github.com/browserify/resolve) | 1.22.1 | [MIT](http://www.opensource.org/licenses/MIT) |
| [rxjs](https://github.com/reactivex/rxjs) | 6.6.7 | [Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0) |
| [safe-buffer](https://github.com/feross/safe-buffer) | 5.2.1 | [MIT](http://www.opensource.org/licenses/MIT) |
| [semver-dsl](https://github.com/mgechev/semver-dsl) | 1.0.1 | [MIT](http://www.opensource.org/licenses/MIT) |
| [semver](https://github.com/npm/node-semver) | 5.7.1 | [ISC](https://www.isc.org/downloads/software-support-policy/isc-license/) |
| [semver](https://github.com/npm/node-semver) | 7.3.7 | [ISC](https://www.isc.org/downloads/software-support-policy/isc-license/) |
| [side-channel](https://github.com/ljharb/side-channel) | 1.0.4 | [MIT](http://www.opensource.org/licenses/MIT) |
| [source-map](https://github.com/mozilla/source-map) | 0.5.6 | [BSD-3-Clause](http://www.opensource.org/licenses/BSD-3-Clause) |
| [source-map](https://github.com/mozilla/source-map) | 0.5.7 | [BSD-3-Clause](http://www.opensource.org/licenses/BSD-3-Clause) |
| [sprintf-js](https://github.com/alexei/sprintf.js) | 1.0.3 | [BSD-3-Clause](http://www.opensource.org/licenses/BSD-3-Clause) |
| [sprintf-js](https://github.com/alexei/sprintf.js) | 1.1.2 | [BSD-3-Clause](http://www.opensource.org/licenses/BSD-3-Clause) |
| [string_decoder](https://github.com/nodejs/string_decoder) | 1.3.0 | [MIT](http://www.opensource.org/licenses/MIT) |
| [subscriptions-transport-ws](https://github.com/apollostack/subscriptions-transport-ws) | 0.11.0 | [MIT](http://www.opensource.org/licenses/MIT) |
| [superagent](https://github.com/visionmedia/superagent) | 6.1.0 | [MIT](http://www.opensource.org/licenses/MIT) |
| [supports-color](https://github.com/chalk/supports-color) | 5.5.0 | [MIT](http://www.opensource.org/licenses/MIT) |
| [supports-preserve-symlinks-flag](https://github.com/inspect-js/node-supports-preserve-symlinks-flag) | 1.0.0 | [MIT](http://www.opensource.org/licenses/MIT) |
| [symbol-observable](https://github.com/blesh/symbol-observable) | 1.2.0 | [MIT](http://www.opensource.org/licenses/MIT) |
| [symbol-observable](https://github.com/blesh/symbol-observable) | 4.0.0 | [MIT](http://www.opensource.org/licenses/MIT) |
| [through](https://github.com/dominictarr/through) | 2.3.8 | [MIT](http://www.opensource.org/licenses/MIT) |
| [ts-invariant](https://github.com/apollographql/invariant-packages) | 0.10.3 | [MIT](http://www.opensource.org/licenses/MIT) |
| [tslib](https://github.com/Microsoft/tslib) | 1.14.1 | [0BSD](http://landley.net/toybox/license.html) |
| [tslib](https://github.com/Microsoft/tslib) | 2.4.0 | [0BSD](http://landley.net/toybox/license.html) |
| [tslint](https://github.com/palantir/tslint) | 6.1.3 | [Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0) |
| [tsutils](https://github.com/ajafff/tsutils) | 2.29.0 | [MIT](http://www.opensource.org/licenses/MIT) |
| [type](https://github.com/medikoo/type) | 1.2.0 | [ISC](https://www.isc.org/downloads/software-support-policy/isc-license/) |
| [type](https://github.com/medikoo/type) | 2.6.0 | [ISC](https://www.isc.org/downloads/software-support-policy/isc-license/) |
| [typescript](https://github.com/Microsoft/TypeScript) | 4.5.5 | [Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0) |
| [util-deprecate](https://github.com/TooTallNate/util-deprecate) | 1.0.2 | [MIT](http://www.opensource.org/licenses/MIT) |
| [wrappy](https://github.com/npm/wrappy) | 1.0.2 | [ISC](https://www.isc.org/downloads/software-support-policy/isc-license/) |
| [ws](https://github.com/websockets/ws) | 7.5.9 | [MIT](http://www.opensource.org/licenses/MIT) |
| [yallist](https://github.com/isaacs/yallist) | 4.0.0 | [ISC](https://www.isc.org/downloads/software-support-policy/isc-license/) |
| [zen-observable-ts](https://github.com/apollographql/zen-observable-ts) | 1.2.5 | [MIT](http://www.opensource.org/licenses/MIT) |
| [zen-observable](https://github.com/zenparsing/zen-observable) | 0.8.15 | [MIT](http://www.opensource.org/licenses/MIT) |
| [zone.js](https://github.com/angular/angular) | 0.10.3 | [MIT](http://www.opensource.org/licenses/MIT) |
| [zone.js](https://github.com/angular/angular) | 0.11.7 | [MIT](http://www.opensource.org/licenses/MIT) |

View File

@@ -26,3 +26,4 @@ The pages linked below contain the audit for all third party dependencies of ADF
- [ADF 4.9.0](audit-info-4.9.0.md)
- [ADF 4.10.0](audit-info-4.10.0.md)
- [ADF 4.11.0](audit-info-4.11.0.md)
- [ADF 5.0.0-angular.13](audit-info-5.0.0-angular.13.md)

View File

@@ -0,0 +1,22 @@
---
Title: Audit info, alfresco-ng2-components 5.0.0-angular.13
---
# Audit information for alfresco-ng2-components 5.0.0-angular.13
This page lists the security audit of the dependencies this project depends on.
## Risks
- Critical risk: 0
- High risk: 0
- Moderate risk: 0
- Low risk: 0
Dependencies analyzed: 138
## Libraries
| Severity | Module | Vulnerable versions |
| --- | --- | --- |

View File

@@ -149,7 +149,7 @@ describe('Delete Directive', () => {
await contentListPage.dataTable.checkContentIsNotDisplayed('Display name', folderInfo.name);
});
it('[C260193] Delete file when different selections are set', async () => {
it('[C260193] Delete file when different selections are set', async () => {
await contentServicesPage.chooseSelectionMode('None');
await contentListPage.selectRow(txtFileModel.name);
await contentListPage.dataTable.checkRowIsNotSelected('Display name', txtFileModel.name);

View File

@@ -19,7 +19,7 @@ import { ContentServicesPage } from '../../core/pages/content-services.page';
import { browser } from 'protractor';
import { createApiService, LoginPage, StringUtil, UploadActions, UsersActions, ViewerPage } from '@alfresco/adf-testing';
import { FileModel } from '../../models/ACS/file.model';
import moment from 'moment-es6';
import * as moment from 'moment';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
describe('Document List Component', () => {

View File

@@ -109,7 +109,7 @@ describe('content type', () => {
});
it('[C593560] Should the user be able to select a new content type and save it only after the confirmation dialog', async () => {
await BrowserActions.getUrl(browser.baseUrl + `/(overlay:files/${pdfFile.id}/view)`);
await BrowserActions.getUrl(browser.baseUrl + `/files(overlay:files/${pdfFile.id}/view)`);
await viewerPage.checkFileIsLoaded(pdfFile.name);
await viewerPage.clickInfoButton();
await viewerPage.checkInfoSideBarIsDisplayed();
@@ -134,7 +134,7 @@ describe('content type', () => {
await loginPage.login(acsUser.username, acsUser.password);
await navigationBarPage.navigateToContentServices();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
await BrowserActions.getUrl(browser.baseUrl + `/(overlay:files/${pdfFile.id}/view)`);
await BrowserActions.getUrl(browser.baseUrl + `/files(overlay:files/${pdfFile.id}/view)`);
await viewerPage.checkFileIsLoaded(pdfFile.name);
await viewerPage.clickInfoButton();
await viewerPage.checkInfoSideBarIsDisplayed();
@@ -150,7 +150,7 @@ describe('content type', () => {
});
it('[C593559] Should the user be able to select a new content type and not save it when press cancel in the confirmation dialog', async () => {
await BrowserActions.getUrl(browser.baseUrl + `/(overlay:files/${docxFileModel.id}/view)`);
await BrowserActions.getUrl(browser.baseUrl + `/files(overlay:files/${docxFileModel.id}/view)`);
await viewerPage.checkFileIsLoaded(docxFileModel.name);
await viewerPage.clickInfoButton();
await viewerPage.checkInfoSideBarIsDisplayed();
@@ -173,7 +173,7 @@ describe('content type', () => {
await loginPage.login(acsUser.username, acsUser.password);
await navigationBarPage.navigateToContentServices();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
await BrowserActions.getUrl(browser.baseUrl + `/(overlay:files/${docxFileModel.id}/view)`);
await BrowserActions.getUrl(browser.baseUrl + `/files(overlay:files/${docxFileModel.id}/view)`);
await viewerPage.checkFileIsLoaded(docxFileModel.name);
await viewerPage.clickInfoButton();
await viewerPage.checkInfoSideBarIsDisplayed();

View File

@@ -30,7 +30,7 @@ import { MetadataViewPage } from '../../core/pages/metadata-view.page';
import { FileModel } from '../../models/ACS/file.model';
import { browser } from 'protractor';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import moment = require('moment');
import * as moment from 'moment';
describe('Metadata component', () => {
@@ -269,7 +269,7 @@ describe('Metadata component', () => {
it('[C279960] Should show the last username modifier when modify a File', async () => {
await loginPage.loginWithProfile('admin');
await BrowserActions.getUrl(browser.baseUrl + `/(overlay:files/${pngFileModel.id}/view)`);
await BrowserActions.getUrl(browser.baseUrl + `/files(overlay:files/${pngFileModel.id}/view)`);
await viewerPage.clickInfoButton();
await viewerPage.checkInfoSideBarIsDisplayed();

View File

@@ -29,8 +29,6 @@ import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
describe('Datatable component', () => {
const dataTablePage = new DataTablePage('defaultTable');
const copyContentDataTablePage = new DataTablePage('copyClipboardDataTable');
const dragAndDropDataTablePage = new DataTablePage();
const loginPage = new LoginPage();
const acsUser = new UserModel();
@@ -56,48 +54,6 @@ describe('Datatable component', () => {
await navigationBarPage.clickLogoutButton();
});
describe('Datatable component - copyContent', () => {
beforeAll(async () => {
await navigationBarPage.navigateToCopyContentDatatable();
await dataTablePage.dataTable.waitForTableBody();
});
it('[C307040] A column value with copyContent set to true is copied when clicking on it', async () => {
await dataTablePage.mouseOverIdColumn('1');
await expect(await dataTablePage.getCopyContentTooltip()).toEqual('Click to copy');
await dataTablePage.clickOnIdColumn('1');
await notificationHistoryPage.checkNotifyContains('Text copied to clipboard');
await dataTablePage.clickOnIdColumn('2');
await notificationHistoryPage.checkNotifyContains('Text copied to clipboard');
await dataTablePage.pasteClipboard();
await expect(await dataTablePage.getClipboardInputText()).toEqual('2');
});
it('[C307073] A column value with copyContent set to true is copied when clicking on it', async () => {
await copyContentDataTablePage.mouseOverIdColumn('1');
await expect(await copyContentDataTablePage.getCopyContentTooltip()).toEqual('Click to copy');
await copyContentDataTablePage.clickOnIdColumn('1');
await notificationHistoryPage.checkNotifyContains('Text copied to clipboard');
await copyContentDataTablePage.clickOnIdColumn('2');
await notificationHistoryPage.checkNotifyContains('Text copied to clipboard');
await copyContentDataTablePage.pasteClipboard();
await expect(await copyContentDataTablePage.getClipboardInputText()).toEqual('2');
});
it('[C307100] A column value of type text and with copyContent set to true is copied when clicking on it', async () => {
await dataTablePage.mouseOverIdColumn('1');
await expect(await dataTablePage.getCopyContentTooltip()).toEqual('Click to copy');
await dataTablePage.clickOnIdColumn('1');
await notificationHistoryPage.checkNotifyContains('Text copied to clipboard');
await dataTablePage.pasteClipboard();
await expect(await dataTablePage.getClipboardInputText()).toEqual('1');
});
afterAll(async () => {
await navigationBarPage.clickHomeButton();
});
});
describe('Datatable component - Drag and Drop', () => {
beforeAll(async () => {
await navigationBarPage.navigateToDragAndDropDatatable();

View File

@@ -93,7 +93,7 @@ export class ContentServicesPage {
notMarkedFavorite = element(by.cssContainingText('button[data-automation-id="favorite"] mat-icon', 'star_border'));
multiSelectToggle = $('[data-automation-id="multiSelectToggle"]');
selectAllCheckbox = $$('.adf-checkbox-sr-only').first();
selectionModeDropdown = $('.mat-select[aria-label="Selection Mode"]');
selectionModeDropdown = $('.mat-select[placeholder="Selection Mode"]');
selectedNodesList = $$('.app-content-service-settings li');
siteListDropdown = new DropdownPage($(`mat-select[data-automation-id='site-my-files-option']`));
sortingDropdown = new DropdownPage($('mat-select[data-automation-id="grid-view-sorting"]'));

View File

@@ -17,7 +17,7 @@
import { $$, $ } from 'protractor';
import { BrowserVisibility, TogglePage, BrowserActions, DateTimePickerPage } from '@alfresco/adf-testing';
import moment = require('moment');
import * as moment from 'moment';
export class ShareDialogPage {

View File

@@ -32,8 +32,8 @@ export class LoginShellPage {
usernameError = $('span[data-automation-id="username-error"]');
passwordError = $('span[data-automation-id="password-required"]');
loginError = $('.adf-login-error-message');
usernameInactive = $('input[id="username"][aria-invalid="false"]');
passwordInactive = $('input[id="password"][aria-invalid="false"]');
usernameInactive = $('input[id="username"][class*="ng-invalid"]');
passwordInactive = $('input[id="password"][class*="ng-invalid"]');
adfLogo = $('.adf-img-logo');
usernameHighlighted = $('input[id="username"][aria-invalid="true"]');
@@ -115,6 +115,7 @@ export class LoginShellPage {
async checkPasswordHighlighted(): Promise<void> {
await BrowserActions.click(this.adfLogo);
await browser.sleep(900000);
await BrowserVisibility.waitUntilElementIsVisible(this.passwordHighlighted);
}

View File

@@ -33,7 +33,7 @@ export class PeopleGroupCloudComponentPage {
groupAppInput = $('input[data-automation-id="app-group-app-input"]');
peopleCloudComponentTitle = element(by.cssContainingText('mat-card-title', 'People Cloud Component'));
groupCloudComponentTitle = element(by.cssContainingText('mat-card-title', 'Groups Cloud Component'));
preselectValidation = $$('mat-checkbox.app-preselect-value').first();
preselectValidation = $$('mat-checkbox.app-preselect-value label').first();
preselectValidationStatus = $$('mat-checkbox.app-preselect-value label input').first();
async navigateTo() {

View File

@@ -35,7 +35,7 @@ import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { ProcessListPage } from '../../process-services/pages/process-list.page';
import { EditProcessFilterConfiguration } from './../config/edit-process-filter.config';
import { ProcessListCloudConfiguration } from './../config/process-list-cloud.config';
import moment = require('moment');
import * as moment from 'moment';
describe('Process filters cloud', () => {

View File

@@ -21,7 +21,7 @@ import { ProcessCloudDemoPage } from './../pages/process-cloud-demo.page';
import { TasksCloudDemoPage } from './../pages/tasks-cloud-demo.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import CONSTANTS = require('../../util/constants');
import moment = require('moment');
import * as moment from 'moment';
import { EditProcessFilterConfiguration } from './../config/edit-process-filter.config';
describe('Process Header cloud component', () => {

View File

@@ -29,7 +29,7 @@ import { createApiService,
import { browser } from 'protractor';
import { TasksCloudDemoPage } from './../pages/tasks-cloud-demo.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import moment = require('moment');
import * as moment from 'moment';
const isValueInvalid = (value: any): boolean => {
return value === null || value === undefined;

View File

@@ -25,7 +25,7 @@ import {
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { TasksCloudDemoPage } from './../pages/tasks-cloud-demo.page';
import { TaskListCloudConfiguration } from './../config/task-list-cloud.config';
import moment = require('moment');
import * as moment from 'moment';
import { taskFilterConfiguration } from './../config/task-filter.config';
describe('Edit task filters and task list properties', () => {

View File

@@ -28,7 +28,7 @@ import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { ProcessServiceTabBarPage } from './../pages/process-service-tab-bar.page';
import { ProcessListPage } from './../pages/process-list.page';
import { ProcessDetailsPage } from './../pages/process-details.page';
import moment = require('moment');
import * as moment from 'moment';
import { ProcessInstancesApi } from '@alfresco/js-api';
describe('Process Instance Details', () => {

View File

@@ -28,7 +28,7 @@ import { browser } from 'protractor';
import { TaskListDemoPage } from './../pages/task-list-demo.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { TaskActionsApi, TaskRepresentation, TasksApi } from '@alfresco/js-api';
import moment = require('moment');
import * as moment from 'moment';
describe('Start Task - Custom App', () => {

View File

@@ -33,7 +33,7 @@ import { ProcessServiceTabBarPage } from './../pages/process-service-tab-bar.pag
import { ProcessFiltersPage } from './../pages/process-filters.page';
import { infoDrawerConfiguration } from './../config/task.config';
import CONSTANTS = require('../../util/constants');
import moment = require('moment');
import * as moment from 'moment';
describe('Info Drawer', () => {

View File

@@ -31,7 +31,7 @@ import Task = require('../../models/APS/Task');
import TaskModel = require('../../models/APS/TaskModel');
import FormModel = require('../../models/APS/FormModel');
import CONSTANTS = require('../../util/constants');
import moment = require('moment');
import * as moment from 'moment';
describe('Task Details component', () => {

View File

@@ -20,7 +20,8 @@ import { SearchFiltersPage } from './pages/search-filters.page';
import { SearchResultsPage } from './pages/search-results.page';
import { FileModel } from '../models/ACS/file.model';
import { NavigationBarPage } from '../core/pages/navigation-bar.page';
import { createApiService,
import {
createApiService,
BrowserActions,
DocumentListPage,
LocalStorageUtil,
@@ -33,7 +34,7 @@ import { createApiService,
} from '@alfresco/adf-testing';
import { browser } from 'protractor';
import { SearchConfiguration } from './search.config';
import moment from 'moment-es6';
import * as moment from 'moment';
describe('Search Filters', () => {
@@ -104,6 +105,9 @@ describe('Search Filters', () => {
await browser.sleep(browser.params.testConfig.timeouts.index_search); // wait search index previous file/folder uploaded
});
beforeEach(async () => {
jsonFile = SearchConfiguration.getConfiguration();
});
@@ -118,6 +122,37 @@ describe('Search Filters', () => {
await navigationBarPage.clickLogoutButton();
});
it('[C291980] Should group search facets under specified labels', async () => {
const currentYear = moment().year();
jsonFile.facetQueries.queries[0] = {
'query': `created:${currentYear}`,
'label': 'SEARCH.FACET_QUERIES.CREATED_THIS_YEAR'
};
jsonFile.facetQueries.queries[1] = {
'query': `content.mimetype:text/html`,
'label': 'SEARCH.FACET_QUERIES.MIMETYPE',
'group': 'Type facet queries'
};
jsonFile.facetQueries.queries[2] = {
'query': `content.size:[0 TO 10240]`,
'label': 'SEARCH.FACET_QUERIES.XTRASMALL',
'group': 'Size facet queries'
};
await LocalStorageUtil.setConfigField('search', JSON.stringify(jsonFile));
await searchBarPage.clickOnSearchIcon();
await searchBarPage.enterTextAndPressEnter('*');
await searchResults.dataTable.waitTillContentLoaded();
await searchFiltersPage.checkDefaultFacetQueryGroupIsDisplayed();
await searchFiltersPage.checkTypeFacetQueryGroupIsDisplayed();
await searchFiltersPage.checkSizeFacetQueryGroupIsDisplayed();
});
it('[C286298] Should be able to cancel a filter using "x" button from the toolbar', async () => {
await searchBarPage.checkSearchIconIsVisible();
await searchBarPage.clickOnSearchIcon();
@@ -176,25 +211,6 @@ describe('Search Filters', () => {
});
});
it('[C291980] Should group search facets under specified labels', async () => {
const currentYear = moment().year();
jsonFile.facetQueries.queries[0] = {'query': `created:${currentYear}`, 'label': 'SEARCH.FACET_QUERIES.CREATED_THIS_YEAR'};
jsonFile.facetQueries.queries[1] = {'query': `content.mimetype:text/html`, 'label': 'SEARCH.FACET_QUERIES.MIMETYPE', 'group': 'Type facet queries'};
jsonFile.facetQueries.queries[2] = {'query': `content.size:[0 TO 10240]`, 'label': 'SEARCH.FACET_QUERIES.XTRASMALL', 'group': 'Size facet queries'};
await LocalStorageUtil.setConfigField('search', JSON.stringify(jsonFile));
await searchBarPage.clickOnSearchIcon();
await searchBarPage.enterTextAndPressEnter('*');
await searchResults.dataTable.waitTillContentLoaded();
await searchFiltersPage.checkDefaultFacetQueryGroupIsDisplayed();
await searchFiltersPage.checkTypeFacetQueryGroupIsDisplayed();
await searchFiltersPage.checkSizeFacetQueryGroupIsDisplayed();
});
it('[C297509] Should display search intervals under specified labels from config', async () => {
await searchBarPage.clickOnSearchIcon();
await searchBarPage.enterTextAndPressEnter('*');

View File

@@ -7,7 +7,7 @@ require('dotenv').config({path: process.env.ENV_FILE});
const HOST = process.env.URL_HOST_ADF;
const LOG = process.env.LOG;
const LOG = process.env.E2E_LOG_LEVEL;
const HOST_ECM = process.env.PROXY_HOST_ECM || HOST || 'ecm';
const HOST_BPM = process.env.PROXY_HOST_BPM || HOST || 'bpm';

View File

@@ -22,7 +22,7 @@
* @class util.Resources
*/
var path = require('path');
const ACTIVITI_CLOUD_APPS = require('../../lib/dist/testing/src');
const ACTIVITI_CLOUD_APPS = require('../../lib/dist/testing');
const RESOURCES = {
...ACTIVITI_CLOUD_APPS,

1924
lib/cli/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
{
"name": "@alfresco/adf-cli",
"description": "Alfresco ADF cli and utils",
"version": "4.11.0",
"version": "5.0.0-angular.13.2",
"author": "Alfresco Software, Ltd.",
"bin": {
"adf-cli": "./bin/adf-cli",
@@ -20,8 +20,8 @@
"dist": "rm -rf ./dist/ && npm run build && cp -R ./bin ./dist/ && cp -R ./resources ./dist && cp -R ./templates ./dist && cp ./package.json ./dist/"
},
"dependencies": {
"@alfresco/js-api": "4.12.0-197",
"commander": "^4.0.0",
"@alfresco/js-api": "4.12.0-244",
"commander": "6.2.1",
"ejs": "^2.6.1",
"license-checker": "^25.0.1",
"npm-registry-fetch": "^4.0.5",

View File

@@ -19,7 +19,7 @@
import { exec } from './exec';
import { logger } from './logger';
import * as program from 'commander';
import program from 'commander';
function test(output: string) {
const response = exec('test !', [`-d ${output} && mkdir ${output}`], {});

View File

@@ -19,7 +19,7 @@
import { exec } from './exec';
import { logger } from './logger';
import * as program from 'commander';
import program from 'commander';
function zipArtifact(artifact: string) {
logger.info(`Perform zip artifact ${artifact}`);

View File

@@ -21,7 +21,7 @@ import * as shell from 'shelljs';
import * as ejs from 'ejs';
import * as path from 'path';
import * as fs from 'fs';
import * as program from 'commander';
import program from 'commander';
export default function main(_args: string[], workingDir: string) {
program

View File

@@ -21,7 +21,7 @@
import * as shell from 'shelljs';
import * as path from 'path';
import * as program from 'commander';
import program from 'commander';
import * as fs from 'fs';
import * as ejs from 'ejs';

View File

@@ -18,7 +18,7 @@
*/
import { exec } from './exec';
import * as program from 'commander';
import program from 'commander';
import { logger } from './logger';
import { resolve } from 'path';

View File

@@ -17,7 +17,7 @@
* limitations under the License.
*/
import * as program from 'commander';
import program from 'commander';
import request = require('request');
import * as fs from 'fs';
import { logger } from './logger';

View File

@@ -17,8 +17,8 @@
* limitations under the License.
*/
import * as program from 'commander';
import moment from 'moment-es6';
import program from 'commander';
import moment from 'moment';
import { AlfrescoApi, AlfrescoApiConfig } from '@alfresco/js-api';
import { logger } from './logger';
import * as kube from './kube-utils';
@@ -192,13 +192,16 @@ const main = async (args: ConfigArgs) => {
'adf-cli kubectl-clean-app --host "gateway_env" --modelerUsername "modelerusername" --modelerPassword "modelerpassword" --oauth "identity_env" --username "username" --password "password"')
.option('-h, --host [type]', 'Host gateway')
.option('-o, --oauth [type]', 'Host sso server')
.option('--clientId[type]', 'sso client')
.option('--clusterEnv [type]', 'cluster Envirorment')
.option('--clusterUrl [type]', 'cluster URL')
.option('--clientId [type]', 'sso client')
.option('--devopsUsername [type]', 'username of user with ACTIVITI_DEVOPS role')
.option('--devopsPassword [type]', 'password of user with ACTIVITI_DEVOPS role')
.option('--modelerUsername [type]', 'username of a user with role ACTIVIT_MODELER')
.option('--modelerPassword [type]', 'modeler password')
.option('--rancherUsername [type]', 'rancher username')
.option('--rancherPassword [type]', 'rancher password')
.option('--rancherToken [type]', 'rancher token')
.option('--apps [type]', 'Application prefix')
.option('--enableLike [boolean]', 'Enable the like for app name')
.option('--intervalTime [string]', 'In case of enableLike it specify the time related to the createDate')
.parse(process.argv);

View File

@@ -17,7 +17,7 @@
* limitations under the License.
*/
import * as program from 'commander';
import program from 'commander';
import * as kube from './kube-utils';
// eslint-disable-next-line prefer-arrow/prefer-arrow-functions

View File

@@ -18,7 +18,7 @@
*/
import { exec } from './exec';
import * as program from 'commander';
import program from 'commander';
import { logger } from './logger';
import * as kube from './kube-utils';

View File

@@ -22,7 +22,7 @@ import * as fs from 'fs';
import * as checker from 'license-checker';
import * as licenseList from 'spdx-license-list';
import * as ejs from 'ejs';
import * as program from 'commander';
import program from 'commander';
interface PackageInfo {
name: string;

View File

@@ -20,7 +20,7 @@
import * as path from 'path';
import fs = require('fs');
import { exec } from './exec';
import * as program from 'commander';
import program from 'commander';
import { logger } from './logger';
export interface PublishArgs {

View File

@@ -1,5 +1,5 @@
import { AlfrescoApi, PeopleApi, NodesApi, GroupsApi, SitesApi, SearchApi, AlfrescoApiConfig } from '@alfresco/js-api';
import * as program from 'commander';
import program from 'commander';
import { logger } from './logger';
interface PeopleTally { enabled: number; disabled: number }

View File

@@ -18,7 +18,7 @@
*/
import { exec } from './exec';
import * as program from 'commander';
import program from 'commander';
import { logger } from './logger';
export interface CommitArgs {

View File

@@ -17,7 +17,7 @@
* limitations under the License.
*/
import * as program from 'commander';
import program from 'commander';
import * as path from 'path';
import * as fs from 'fs';
import * as shell from 'shelljs';

View File

@@ -10,6 +10,7 @@
"noImplicitThis": false,
"noUnusedParameters": true,
"noUnusedLocals": true,
"esModuleInterop": true,
"outDir": "./dist",
"rootDir": ".",
"skipLibCheck": true,

View File

@@ -4,6 +4,6 @@
"declarationMap": false
},
"angularCompilerOptions": {
"enableIvy": false
"compilationMode": "partial"
}
}

View File

@@ -0,0 +1,7 @@
{
"description" : "this config file is used in the unit test",
"ecmHost": "http://{hostname}:{port}/ecm",
"bpmHost": "http://{hostname}:{port}/bpm",
"baseShareUrl": null,
"logLevel" : "silent"
}

View File

@@ -0,0 +1,38 @@
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const path = require("path");
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
module.exports = {
mode: 'production',
optimization: {
minimizer: [new CssMinimizerPlugin({})],
},
entry: {
'adf-blue-orange': './lib/core/styles/prebuilt/adf-blue-orange.scss',
'adf-blue-purple': './lib/core/styles/prebuilt/adf-blue-purple.scss',
'adf-cyan-orange': './lib/core/styles/prebuilt/adf-cyan-orange.scss',
'adf-cyan-purple': './lib/core/styles/prebuilt/adf-cyan-purple.scss',
'adf-green-purple': './lib/core/styles/prebuilt/adf-green-purple.scss',
'adf-green-orange': './lib/core/styles/prebuilt/adf-green-orange.scss',
'adf-pink-bluegrey': './lib/core/styles/prebuilt/adf-pink-bluegrey.scss',
'adf-indigo-pink': './lib/core/styles/prebuilt/adf-indigo-pink.scss',
'adf-purple-green': './lib/core/styles/prebuilt/adf-purple-green.scss'
},
output: {
path: path.resolve(__dirname, '../dist/core/prebuilt-themes/'),
filename: '[name].js',
publicPath: '/dist'
},
module: {
rules: [{
test: /\.scss$/,
use: [MiniCssExtractPlugin.loader, "css-loader", "sass-loader"]
}]
},
plugins: [new MiniCssExtractPlugin()]
};

View File

@@ -15,7 +15,12 @@ module.exports = function (config) {
},
{pattern: 'node_modules/moment/min/moment.min.js', included: true, watched: false},
{pattern: 'lib/content-services/src/lib/i18n/**/en.json', included: false, served: true, watched: false},
{pattern: 'lib/content-services/src/lib/assets/images/**/*.svg', included: false, served: true, watched: false},
{
pattern: 'lib/content-services/src/lib/assets/images/**/*.svg',
included: false,
served: true,
watched: false
},
{pattern: 'lib/core/assets/images/ft_ic_folder.svg', included: false, served: true, watched: false},
{pattern: 'lib/core/i18n/**/en.json', included: false, served: true, watched: false},
{pattern: 'lib/content-services/**/*.ts', included: false, served: true, watched: false},
@@ -39,12 +44,15 @@ module.exports = function (config) {
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma'),
require('karma-mocha-reporter')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
clearContext: false,
jasmine: {
random: false
}
},
coverageIstanbulReporter: {

View File

@@ -8,22 +8,6 @@
],
"lib": {
"entryFile": "src/public-api.ts",
"flatModuleFile": "adf-content-services",
"umdModuleIds": {
"@alfresco/js-api": "@alfresco/js-api",
"@angular/platform-browser/animations": "@angular/platform-browser/animations",
"@angular/material": "@angular/material",
"@mat-datetimepicker/core": "@mat-datetimepicker/core",
"@mat-datetimepicker/moment": "@mat-datetimepicker/moment",
"@angular/flex-layout": "@angular/flex-layout",
"@alfresco/adf-core": "@alfresco/adf-core",
"@angular/animations": "@angular/animations",
"@angular/cdk/platform": "@angular/cdk/platform",
"@angular/material/core": "@angular/material/core",
"moment": "moment",
"moment-es6": "moment-es6",
"moment/src/moment": "moment/src/moment",
"@ngx-translate/core": "@ngx-translate/core"
}
"flatModuleFile": "adf-content-services"
}
}

View File

@@ -1,9 +1,8 @@
{
"name": "@alfresco/adf-content-services",
"description": "Alfresco ADF content services",
"version": "4.11.0",
"version": "5.0.0-angular.13.2",
"author": "Alfresco Software, Ltd.",
"main": "bundles/adf-content-services.js",
"repository": {
"type": "git",
"url": "https://github.com/Alfresco/alfresco-ng2-components.git"
@@ -12,18 +11,21 @@
"url": "https://github.com/Alfresco/alfresco-ng2-components/issues"
},
"peerDependencies": {
"@angular/animations": ">=10.0.2",
"@angular/cdk": ">=10.0.1",
"@angular/common": ">10.0.2",
"@angular/core": ">=10.0.2",
"@angular/flex-layout": ">=10.0.0-beta.32",
"@angular/forms": ">=10.0.2",
"@angular/material": ">=10.0.1",
"@angular/router": ">=10.0.2",
"@alfresco/js-api": "4.12.0-197",
"@alfresco/adf-core": "4.11.0",
"@angular/animations": ">=13.3.11",
"@angular/cdk": ">=13.3.9",
"@angular/common": ">=13.3.11",
"@angular/compiler": ">=13.3.11",
"@angular/core": ">=13.3.11",
"@angular/flex-layout": ">=13.0.0-beta.38",
"@angular/forms": ">=13.3.11",
"@angular/material": ">=13.3.9",
"@angular/platform-browser": ">=13.3.11",
"@angular/platform-browser-dynamic": ">=13.3.11",
"@angular/router": ">=13.3.11",
"@alfresco/js-api": "4.12.0-244",
"@ngx-translate/core": ">=13.0.0",
"moment": ">=2.22.2"
"moment": ">=2.22.2",
"@alfresco/adf-core": "5.0.0-angular.13.2"
},
"keywords": [
"content-services",

View File

@@ -22,10 +22,10 @@ import { TranslateModule } from '@ngx-translate/core';
import { of, Subject } from 'rxjs';
import { ContentTestingModule } from '../testing/content.testing.module';
import { AspectListDialogComponentData } from './aspect-list-dialog-data.interface';
import { NodesApiService } from 'core';
import { AspectListService } from './aspect-list.service';
import { AspectListService } from './services/aspect-list.service';
import { delay } from 'rxjs/operators';
import { AspectEntry, MinimalNode } from '@alfresco/js-api';
import { NodesApiService } from '@alfresco/adf-core';
const aspectListMock: AspectEntry[] = [{
entry: {

View File

@@ -18,6 +18,7 @@
import { Component, Inject, OnInit, ViewEncapsulation } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { AspectListDialogComponentData } from './aspect-list-dialog-data.interface';
@Component({
selector: 'adf-aspect-list-dialog',
templateUrl: './aspect-list-dialog.component.html',

View File

@@ -20,7 +20,7 @@ import { NodesApiService, setupTestBed } from '@alfresco/adf-core';
import { ContentTestingModule } from '../testing/content.testing.module';
import { TranslateModule } from '@ngx-translate/core';
import { AspectListComponent } from './aspect-list.component';
import { AspectListService } from './aspect-list.service';
import { AspectListService } from './services/aspect-list.service';
import { of } from 'rxjs';
import { AspectEntry } from '@alfresco/js-api';
import { delay } from 'rxjs/operators';

View File

@@ -19,7 +19,7 @@ import { Component, EventEmitter, Input, OnDestroy, OnInit, Output, ViewEncapsul
import { NodesApiService } from '@alfresco/adf-core';
import { Observable, Subject, zip } from 'rxjs';
import { concatMap, map, takeUntil, tap } from 'rxjs/operators';
import { AspectListService } from './aspect-list.service';
import { AspectListService } from './services/aspect-list.service';
import { MatCheckboxChange } from '@angular/material/checkbox';
import { AspectEntry } from '@alfresco/js-api';
@Component({

View File

@@ -17,8 +17,9 @@
export * from './aspect-list.component';
export * from './aspect-list-dialog.component';
export * from './aspect-list.service';
export * from './node-aspect.service';
export * from './services/aspect-list.service';
export * from './services/node-aspect.service';
export * from './services/dialog-aspect-list.service';
export * from './aspect-list-dialog-data.interface';

View File

@@ -16,11 +16,8 @@
*/
import { Injectable } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { AlfrescoApiService, AppConfigService, LogService } from '@alfresco/adf-core';
import { from, Observable, of, Subject, zip } from 'rxjs';
import { AspectListDialogComponentData } from './aspect-list-dialog-data.interface';
import { AspectListDialogComponent } from './aspect-list-dialog.component';
import { from, Observable, of, zip } from 'rxjs';
import { catchError, map } from 'rxjs/operators';
import { AspectEntry, AspectPaging, AspectsApi } from '@alfresco/js-api';
@@ -37,7 +34,6 @@ export class AspectListService {
constructor(private alfrescoApiService: AlfrescoApiService,
private appConfigService: AppConfigService,
private dialog: MatDialog,
private logService: LogService) {
}
@@ -101,34 +97,4 @@ export class AspectListService {
return visibleAspectList;
}
openAspectListDialog(nodeId?: string): Observable<string[]> {
const select = new Subject<string[]>();
select.subscribe({
complete: this.close.bind(this)
});
const data: AspectListDialogComponentData = {
title: 'ADF-ASPECT-LIST.DIALOG.TITLE',
description: 'ADF-ASPECT-LIST.DIALOG.DESCRIPTION',
overTableMessage: 'ADF-ASPECT-LIST.DIALOG.OVER-TABLE-MESSAGE',
select,
nodeId
};
this.openDialog(data, 'adf-aspect-list-dialog', '750px');
return select;
}
private openDialog(data: AspectListDialogComponentData, panelClass: string, width: string) {
this.dialog.open(AspectListDialogComponent, {
data,
panelClass,
width,
disableClose: true
});
}
close() {
this.dialog.closeAll();
}
}

View File

@@ -0,0 +1,62 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Injectable } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { Observable, Subject } from 'rxjs';
import { AspectListDialogComponentData } from '../aspect-list-dialog-data.interface';
import { AspectListDialogComponent } from '../aspect-list-dialog.component';
@Injectable({
providedIn: 'root'
})
export class DialogAspectListService {
constructor(private dialog: MatDialog) {
}
openAspectListDialog(nodeId?: string): Observable<string[]> {
const select = new Subject<string[]>();
select.subscribe({
complete: this.close.bind(this)
});
const data: AspectListDialogComponentData = {
title: 'ADF-ASPECT-LIST.DIALOG.TITLE',
description: 'ADF-ASPECT-LIST.DIALOG.DESCRIPTION',
overTableMessage: 'ADF-ASPECT-LIST.DIALOG.OVER-TABLE-MESSAGE',
select,
nodeId
};
this.openDialog(data, 'adf-aspect-list-dialog', '750px');
return select;
}
private openDialog(data: AspectListDialogComponentData, panelClass: string, width: string) {
this.dialog.open(AspectListDialogComponent, {
data,
panelClass,
width,
disableClose: true
});
}
close() {
this.dialog.closeAll();
}
}

View File

@@ -18,15 +18,15 @@
import { MinimalNode } from '@alfresco/js-api';
import { TestBed } from '@angular/core/testing';
import { TranslateModule } from '@ngx-translate/core';
import { AlfrescoApiService, CardViewUpdateService, NodesApiService, setupTestBed } from 'core';
import { AlfrescoApiService, CardViewUpdateService, NodesApiService, setupTestBed } from '@alfresco/adf-core';
import { of } from 'rxjs';
import { ContentTestingModule } from '../testing/content.testing.module';
import { AspectListService } from './aspect-list.service';
import { ContentTestingModule } from '../../testing/content.testing.module';
import { NodeAspectService } from './node-aspect.service';
import { DialogAspectListService } from './dialog-aspect-list.service';
describe('NodeAspectService', () => {
let aspectListService: AspectListService;
let dialogAspectListService: DialogAspectListService;
let nodeAspectService: NodeAspectService;
let nodeApiService: NodesApiService;
let alfrescoApiService: AlfrescoApiService;
@@ -40,7 +40,7 @@ describe('NodeAspectService', () => {
});
beforeEach(() => {
aspectListService = TestBed.inject(AspectListService);
dialogAspectListService = TestBed.inject(DialogAspectListService);
nodeAspectService = TestBed.inject(NodeAspectService);
nodeApiService = TestBed.inject(NodesApiService);
alfrescoApiService = TestBed.inject(AlfrescoApiService);
@@ -48,15 +48,15 @@ describe('NodeAspectService', () => {
});
it('should open the aspect list dialog', () => {
spyOn(aspectListService, 'openAspectListDialog').and.returnValue(of([]));
spyOn(dialogAspectListService, 'openAspectListDialog').and.returnValue(of([]));
spyOn(nodeApiService, 'updateNode').and.returnValue(of(null));
nodeAspectService.updateNodeAspects('fake-node-id');
expect(aspectListService.openAspectListDialog).toHaveBeenCalledWith('fake-node-id');
expect(dialogAspectListService.openAspectListDialog).toHaveBeenCalledWith('fake-node-id');
});
it('should update the node when the aspect dialog apply the changes', () => {
const expectedParameters = { aspectNames: ['a', 'b', 'c'] };
spyOn(aspectListService, 'openAspectListDialog').and.returnValue(of(['a', 'b', 'c']));
spyOn(dialogAspectListService, 'openAspectListDialog').and.returnValue(of(['a', 'b', 'c']));
spyOn(nodeApiService, 'updateNode').and.returnValue(of(null));
nodeAspectService.updateNodeAspects('fake-node-id');
expect(nodeApiService.updateNode).toHaveBeenCalledWith('fake-node-id', expectedParameters);
@@ -69,7 +69,7 @@ describe('NodeAspectService', () => {
done();
});
const fakeNode = new MinimalNode({ id: 'fake-node-id', aspectNames: ['a', 'b', 'c'] });
spyOn(aspectListService, 'openAspectListDialog').and.returnValue(of(['a', 'b', 'c']));
spyOn(dialogAspectListService, 'openAspectListDialog').and.returnValue(of(['a', 'b', 'c']));
spyOn(nodeApiService, 'updateNode').and.returnValue(of(fakeNode));
nodeAspectService.updateNodeAspects('fake-node-id');
});
@@ -81,7 +81,7 @@ describe('NodeAspectService', () => {
done();
});
const fakeNode = new MinimalNode({ id: 'fake-node-id', aspectNames: ['a', 'b', 'c'] });
spyOn(aspectListService, 'openAspectListDialog').and.returnValue(of(['a', 'b', 'c']));
spyOn(dialogAspectListService, 'openAspectListDialog').and.returnValue(of(['a', 'b', 'c']));
spyOn(nodeApiService, 'updateNode').and.returnValue(of(fakeNode));
nodeAspectService.updateNodeAspects('fake-node-id');
});

View File

@@ -17,7 +17,7 @@
import { Injectable } from '@angular/core';
import { AlfrescoApiService, CardViewUpdateService, NodesApiService } from '@alfresco/adf-core';
import { AspectListService } from './aspect-list.service';
import { DialogAspectListService } from './dialog-aspect-list.service';
@Injectable({
providedIn: 'root'
@@ -26,12 +26,12 @@ export class NodeAspectService {
constructor(private alfrescoApiService: AlfrescoApiService,
private nodesApiService: NodesApiService,
private aspectListService: AspectListService,
private dialogAspectListService: DialogAspectListService,
private cardViewUpdateService: CardViewUpdateService) {
}
updateNodeAspects(nodeId: string) {
this.aspectListService.openAspectListDialog(nodeId).subscribe((aspectList) => {
this.dialogAspectListService.openAspectListDialog(nodeId).subscribe((aspectList) => {
this.nodesApiService.updateNode(nodeId, { aspectNames: [...aspectList] }).subscribe((updatedNode) => {
this.alfrescoApiService.nodeUpdated.next(updatedNode);
this.cardViewUpdateService.updateNodeAspect(updatedNode);

View File

@@ -28,7 +28,7 @@ import {
} from '@angular/core';
import { MatSelect } from '@angular/material/select';
import { Node, PathElementEntity } from '@alfresco/js-api';
import { DocumentListComponent } from '../document-list';
import { DocumentListComponent } from '../document-list/components/document-list.component';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';

View File

@@ -24,7 +24,7 @@ import { setupTestBed, AllowableOperationsEnum } from '@alfresco/adf-core';
import { ContentTestingModule } from '../../../testing/content.testing.module';
import { SimpleChange } from '@angular/core';
import { TranslateModule } from '@ngx-translate/core';
import { NodeAspectService } from 'content-services/src/lib/aspect-list';
import { NodeAspectService } from '../../../aspect-list/services/node-aspect.service';
import { ContentMetadataService } from '../../services/content-metadata.service';
import { of } from 'rxjs';

View File

@@ -18,7 +18,7 @@
import { Component, Input, OnChanges, SimpleChanges, ViewEncapsulation } from '@angular/core';
import { Node } from '@alfresco/js-api';
import { ContentService, AllowableOperationsEnum, VersionCompatibilityService } from '@alfresco/adf-core';
import { NodeAspectService } from '../../../aspect-list/node-aspect.service';
import { NodeAspectService } from '../../../aspect-list/services/node-aspect.service';
import { PresetConfig } from '../../interfaces/content-metadata.interfaces';
@Component({
selector: 'adf-content-metadata-card',

View File

@@ -17,7 +17,7 @@
import { TestBed } from '@angular/core/testing';
import { ContentTypePropertiesService } from './content-type-property.service';
import { CardViewItem, CardViewSelectItemModel, CardViewTextItemModel, setupTestBed, VersionCompatibilityService } from 'core';
import { CardViewItem, CardViewSelectItemModel, CardViewTextItemModel, setupTestBed, VersionCompatibilityService } from '@alfresco/adf-core';
import { ContentTestingModule } from '../../testing/content.testing.module';
import { TranslateModule } from '@ngx-translate/core';
import { ContentTypeService } from '../../content-type';

View File

@@ -0,0 +1,787 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import {
MinimalNode,
Node,
NodeEntry,
NodePaging,
RequestScope,
ResultSetPaging,
SiteEntry,
SitePaging
} from '@alfresco/js-api';
import {
NodesApiService,
setupTestBed,
SitesService
} from '@alfresco/adf-core';
import { of } from 'rxjs';
import { ContentNodeSelectorPanelComponent } from './content-node-selector-panel.component';
import { ContentTestingModule } from '../testing/content.testing.module';
import { DocumentListService } from '../document-list/services/document-list.service';
import { DocumentListComponent } from '../document-list/components/document-list.component';
import { CustomResourcesService } from '../document-list/services/custom-resources.service';
import { NodeEntryEvent, ShareDataRow } from '../document-list';
import { TranslateModule } from '@ngx-translate/core';
import { SearchQueryBuilderService } from '../search';
import { mockQueryBody } from '../mock/search-query.mock';
const fakeResultSetPaging: ResultSetPaging = {
list: {
pagination: {
totalItems: 1
},
entries: [
{
entry: {
id: '123',
name: 'MyFolder',
isFile: false,
isFolder: true,
nodeType: 'mock'
}
}
]
}
};
describe('ContentNodeSelectorPanelComponent', () => {
const debounceSearch = 200;
let component: ContentNodeSelectorPanelComponent;
let fixture: ComponentFixture<ContentNodeSelectorPanelComponent>;
let nodeService: NodesApiService;
let sitesService: SitesService;
let searchSpy: jasmine.Spy;
const fakeNodeEntry = new Node({ id: 'fakeId' });
const nodeEntryEvent = new NodeEntryEvent(fakeNodeEntry);
let searchQueryBuilderService: SearchQueryBuilderService;
const typeToSearchBox = (searchTerm = 'string-to-search') => {
const searchInput = fixture.debugElement.query(By.css('[data-automation-id="content-node-selector-search-input"]'));
searchInput.nativeElement.value = searchTerm;
component.searchInput.setValue(searchTerm);
fixture.detectChanges();
};
const triggerSearchResults = (searchResults: ResultSetPaging) => {
component.queryBuilderService.executed.next(searchResults);
};
setupTestBed({
imports: [
TranslateModule.forRoot(),
ContentTestingModule
],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
});
describe('General component features', () => {
beforeEach(async () => {
fixture = TestBed.createComponent(ContentNodeSelectorPanelComponent);
component = fixture.componentInstance;
component.debounceSearch = 0;
nodeService = TestBed.inject(NodesApiService);
sitesService = TestBed.inject(SitesService);
searchQueryBuilderService = component.queryBuilderService;
component.queryBuilderService.resetToDefaults();
spyOn(nodeService, 'getNode').and.returnValue(of(new MinimalNode({
id: 'fake-node',
path: { elements: [{ nodeType: 'st:site', name: 'fake-site' }] }
})));
searchSpy = spyOn(searchQueryBuilderService, 'execute');
const fakeSite = new SiteEntry({
entry: {
id: 'fake-site',
guid: 'fake-site',
title: 'fake-site',
visibility: 'visible'
}
});
spyOn(sitesService, 'getSite').and.returnValue(of(fakeSite));
});
afterEach(async () => {
fixture.destroy();
component = null;
});
describe('Search functionality', () => {
let getCorrespondingNodeIdsSpy;
let customResourcesService: CustomResourcesService;
const entry: Node = { id: 'fakeid' } as Node;
beforeEach(() => {
const documentListService = TestBed.inject(DocumentListService);
const expectedDefaultFolderNode = new NodeEntry();
component.isSelectionValid = (node: Node) => node.isFile;
spyOn(documentListService, 'getFolderNode').and.returnValue(of(expectedDefaultFolderNode));
spyOn(documentListService, 'getFolder').and.returnValue(of(new NodePaging({
list: {
pagination: {},
entries: [],
source: {}
}
})));
spyOn(sitesService, 'getSites').and.returnValue(of(new SitePaging({ list: { entries: [] } })));
customResourcesService = TestBed.inject(CustomResourcesService);
getCorrespondingNodeIdsSpy = spyOn(customResourcesService, 'getCorrespondingNodeIds').and
.callFake((id) => {
if (id === '-sites-') {
return of(['123456testId', '09876543testId']);
}
return of([id]);
});
component.currentFolderId = 'cat-girl-nuku-nuku';
component.documentList.ngOnInit();
fixture.detectChanges();
});
it('should the user query get updated when the user types in the search input', fakeAsync(() => {
const updateSpy = spyOn(searchQueryBuilderService, 'update');
typeToSearchBox('search-term');
tick(debounceSearch);
fixture.detectChanges();
expect(updateSpy).toHaveBeenCalled();
expect(searchQueryBuilderService.userQuery).toEqual('(search-term*)');
expect(component.searchTerm).toEqual('search-term');
}));
it('should perform a search when the queryBody gets updated and it is defined', fakeAsync(() => {
typeToSearchBox('search-term');
tick(debounceSearch);
fixture.detectChanges();
expect(searchSpy).toHaveBeenCalledWith(mockQueryBody);
}));
it('should NOT perform a search and clear the results when the queryBody gets updated and it is NOT defined', async () => {
spyOn(component, 'clearSearch');
searchQueryBuilderService.userQuery = '';
searchQueryBuilderService.update();
fixture.detectChanges();
await fixture.whenStable();
expect(searchSpy).not.toHaveBeenCalled();
expect(component.clearSearch).toHaveBeenCalled();
});
it('should reset the search term when clicking the clear icon', async () => {
component.searchTerm = 'search-term';
searchQueryBuilderService.userQuery = 'search-term';
spyOn(component, 'clearSearch');
fixture.detectChanges();
const clearIcon = fixture.debugElement.query(By.css('[data-automation-id="content-node-selector-search-clear"]'));
clearIcon.nativeElement.click();
fixture.detectChanges();
expect(searchQueryBuilderService.userQuery).toEqual('');
expect(component.searchTerm).toEqual('');
expect(component.clearSearch).toHaveBeenCalled();
});
it('should load the results by calling the search api on search change', fakeAsync(() => {
typeToSearchBox('search-term');
tick(debounceSearch);
fixture.detectChanges();
expect(searchSpy).toHaveBeenCalledWith(mockQueryBody);
}));
it('should the query include the show files filterQuery', fakeAsync(() => {
component.showFilesInResult = true;
typeToSearchBox('search-term');
const expectedQueryBody = mockQueryBody;
expectedQueryBody.filterQueries.push({
query: `TYPE:'cm:folder' OR TYPE:'cm:content'`
});
tick(debounceSearch);
fixture.detectChanges();
expect(searchSpy).toHaveBeenCalledWith(expectedQueryBody);
}));
it('should reset the currently chosen node in case of starting a new search', fakeAsync(() => {
component.chosenNode = [entry];
typeToSearchBox('kakarot');
tick(debounceSearch);
fixture.detectChanges();
expect(component.chosenNode).toBeNull();
}));
it('should update the breadcrumb when changing to a custom site', async () => {
component.documentList.folderNode = { id: 'fakeNodeId', isFolder: true, path: {} } as Node;
component.siteChanged({ entry: { guid: '-mysites-', title: 'My Sites' } } as SiteEntry);
expect(component.breadcrumbFolderTitle).toBe('My Sites');
});
it('should perform a search when selecting a site with the correct query', fakeAsync(() => {
typeToSearchBox('search-term');
tick(debounceSearch);
expect(searchSpy.calls.count()).toBe(1, 'Search count should be one after only one search');
component.siteChanged({ entry: { guid: 'namek' } } as SiteEntry);
const expectedQueryBody = mockQueryBody;
expectedQueryBody.filterQueries = [{ query: `ANCESTOR:'workspace://SpacesStore/namek'` }];
expect(searchSpy.calls.count()).toBe(2, 'Search count should be two after the site change');
expect(searchSpy).toHaveBeenCalledWith(expectedQueryBody);
}));
it('should create the query with the right parameters on changing the site selectBox value from a custom dropdown menu', fakeAsync(() => {
component.dropdownSiteList = { list: { entries: [{ entry: { guid: '-sites-' } }, { entry: { guid: 'namek' } }] } } as SitePaging;
component.documentList.folderNode = { id: 'fakeNodeId', isFolder: true, path: {} } as Node;
fixture.detectChanges();
typeToSearchBox('search-term');
tick(debounceSearch);
expect(searchSpy.calls.count()).toBe(1);
component.siteChanged({ entry: { guid: '-sites-' } } as SiteEntry);
const expectedQueryBodyWithSiteChange = mockQueryBody;
expectedQueryBodyWithSiteChange.filterQueries = [
{ query: `ANCESTOR:'workspace://SpacesStore/-sites-' OR ANCESTOR:'workspace://SpacesStore/123456testId' OR ANCESTOR:'workspace://SpacesStore/09876543testId'` }
];
expect(searchSpy).toHaveBeenCalled();
expect(searchSpy.calls.count()).toBe(2);
expect(searchSpy).toHaveBeenCalledWith(mockQueryBody);
expect(searchSpy).toHaveBeenCalledWith(expectedQueryBodyWithSiteChange);
}));
it('should get the corresponding node ids on search when a known alias is selected from dropdown', fakeAsync(() => {
component.documentList.folderNode = { id: 'fakeNodeId', isFolder: true, path: {} } as Node;
typeToSearchBox('vegeta');
tick(debounceSearch);
component.siteChanged({ entry: { guid: '-sites-' } } as SiteEntry);
expect(getCorrespondingNodeIdsSpy.calls.count()).toBe(1, 'getCorrespondingNodeIdsSpy calls count should be one after the site changes to known alias \'-sites\-');
expect(getCorrespondingNodeIdsSpy.calls.mostRecent().args[0]).toEqual('-sites-');
}));
it('should get the corresponding node ids on search when a known alias is selected from CUSTOM dropdown', fakeAsync(() => {
component.dropdownSiteList = { list: { entries: [{ entry: { guid: '-sites-' } }, { entry: { guid: 'namek' } }] } } as SitePaging;
component.documentList.folderNode = { id: 'fakeNodeId', isFolder: true, path: {} } as Node;
fixture.detectChanges();
typeToSearchBox('vegeta');
tick(debounceSearch);
component.siteChanged({ entry: { guid: '-sites-' } } as SiteEntry);
expect(getCorrespondingNodeIdsSpy.calls.count()).toBe(1);
expect(getCorrespondingNodeIdsSpy.calls.mostRecent().args[0]).toEqual('-sites-');
}));
it('should NOT get the corresponding node ids on search when NOTHING is selected from dropdown', fakeAsync(() => {
component.dropdownSiteList = { list: { entries: [{ entry: { guid: '-sites-' } }, { entry: { guid: 'namek' } }] } } as SitePaging;
fixture.detectChanges();
typeToSearchBox('vegeta');
tick(debounceSearch);
expect(getCorrespondingNodeIdsSpy.calls.count()).toBe(0, 'getCorrespondingNodeIdsSpy calls count should be 0 when no site is selected');
}));
it('should NOT get the corresponding node ids on search when NO known alias is selected from dropdown', fakeAsync(() => {
typeToSearchBox('vegeta');
tick(debounceSearch);
expect(getCorrespondingNodeIdsSpy.calls.count()).toBe(0, 'getCorrespondingNodeIdsSpy should not be called');
component.siteChanged({ entry: { guid: 'namek' } } as SiteEntry);
expect(getCorrespondingNodeIdsSpy).not.toHaveBeenCalled();
}));
it('should NOT get the corresponding node ids on search when NO known alias is selected from CUSTOM dropdown', fakeAsync(() => {
component.dropdownSiteList = { list: { entries: [{ entry: { guid: '-sites-' } }, { entry: { guid: 'namek' } }] } } as SitePaging;
fixture.detectChanges();
typeToSearchBox('vegeta');
tick(debounceSearch);
expect(getCorrespondingNodeIdsSpy.calls.count()).toBe(0, 'getCorrespondingNodeIdsSpy should not be called');
component.siteChanged({ entry: { guid: 'namek' } } as SiteEntry);
expect(getCorrespondingNodeIdsSpy).not.toHaveBeenCalled();
}));
it('should show the search icon by default without the X (clear) icon', fakeAsync(() => {
fixture.detectChanges();
tick(debounceSearch);
const searchIcon = fixture.debugElement.query(By.css('[data-automation-id="content-node-selector-search-icon"]'));
const clearIcon = fixture.debugElement.query(By.css('[data-automation-id="content-node-selector-search-clear"]'));
expect(searchIcon).not.toBeNull('Search icon should be in the DOM');
expect(clearIcon).toBeNull('Clear icon should NOT be in the DOM');
}));
it('should show the X (clear) icon without the search icon when the search contains at least one character', fakeAsync(() => {
fixture.detectChanges();
typeToSearchBox('123');
tick(debounceSearch);
fixture.detectChanges();
const searchIcon = fixture.debugElement.query(By.css('[data-automation-id="content-node-selector-search-icon"]'));
const clearIcon = fixture.debugElement.query(By.css('[data-automation-id="content-node-selector-search-clear"]'));
expect(searchIcon).toBeNull('Search icon should NOT be in the DOM');
expect(clearIcon).not.toBeNull('Clear icon should be in the DOM');
}));
it('should clear the search field, nodes and chosenNode when clicking on the X (clear) icon', async () => {
component.chosenNode = [entry];
component.nodePaging = {
list: {
entries: [{ entry }]
}
};
component.searchTerm = 'piccolo';
component.showingSearchResults = true;
component.clear();
expect(component.searchTerm).toBe('');
expect(component.nodePaging).toEqual(null);
expect(component.chosenNode).toBeNull();
expect(component.showingSearchResults).toBeFalsy();
});
it('should the query restrict the search to the currentFolderId in case is defined', fakeAsync(() => {
component.currentFolderId = 'my-root-id';
component.restrictRootToCurrentFolderId = true;
component.ngOnInit();
typeToSearchBox('search-term');
tick(debounceSearch);
const expectedQueryBody = mockQueryBody;
expectedQueryBody.filterQueries = [{ query: `ANCESTOR:'workspace://SpacesStore/my-root-id'` }];
expect(searchSpy).toHaveBeenCalledWith(expectedQueryBody);
}));
it('should emit showingSearch event with true while searching', async () => {
searchQueryBuilderService.userQuery = 'mock-search-term';
searchQueryBuilderService.update();
spyOn(customResourcesService, 'hasCorrespondingNodeIds').and.returnValue(true);
const showingSearchSpy = spyOn(component.showingSearch, 'emit');
component.queryBuilderService.execute({ query: { query: 'search' } });
triggerSearchResults(fakeResultSetPaging);
fixture.detectChanges();
await fixture.whenStable();
expect(component.showingSearchResults).toBe(true);
expect(showingSearchSpy).toHaveBeenCalledWith(true);
});
it('should emit showingSearch event with false if you remove search term without clicking on X (icon) icon', fakeAsync(() => {
const showingSearchSpy = spyOn(component.showingSearch, 'emit');
typeToSearchBox('');
tick(debounceSearch);
fixture.detectChanges();
expect(component.showingSearchResults).toBe(false);
expect(showingSearchSpy).toHaveBeenCalledWith(false);
}));
it('should emit showingResults event with false when clicking on the X (clear) icon', async () => {
const showingSearchSpy = spyOn(component.showingSearch, 'emit');
component.chosenNode = [entry];
component.nodePaging = {
list: {
entries: [{ entry }]
}
};
component.searchTerm = 'piccolo';
component.showingSearchResults = true;
component.clear();
expect(component.showingSearchResults).toBe(false);
expect(showingSearchSpy).toHaveBeenCalledWith(false);
});
it('should emit showingResults event with false if search api fails', async () => {
searchQueryBuilderService.userQuery = 'mock-search-term';
searchQueryBuilderService.update();
getCorrespondingNodeIdsSpy.and.throwError('Failed');
const showingSearchSpy = spyOn(component.showingSearch, 'emit');
component.queryBuilderService.execute({ query: { query: 'search' } });
triggerSearchResults(fakeResultSetPaging);
fixture.detectChanges();
await fixture.whenStable();
expect(component.showingSearchResults).toBe(true);
expect(showingSearchSpy).toHaveBeenCalledWith(true);
});
it('should the query restrict the search to the site and not to the currentFolderId in case is changed', async () => {
component.queryBuilderService.userQuery = 'search-term*';
component.currentFolderId = 'my-root-id';
component.restrictRootToCurrentFolderId = true;
component.siteChanged({ entry: { guid: 'my-site-id' } } as SiteEntry);
const expectedQueryBodyWithSiteChange = mockQueryBody;
expectedQueryBodyWithSiteChange.filterQueries = [
{ query: `ANCESTOR:'workspace://SpacesStore/my-site-id'` }
];
expect(searchSpy).toHaveBeenCalledWith(expectedQueryBodyWithSiteChange);
});
it('should restrict the breadcrumb to the currentFolderId in case restrictedRoot is true', async () => {
component.currentFolderId = 'my-root-id';
component.restrictRootToCurrentFolderId = true;
component.ngOnInit();
expect(component.breadcrumbRootId).toEqual('my-root-id');
});
it('should NOT restrict the breadcrumb to the currentFolderId in case restrictedRoot is false', async () => {
component.currentFolderId = 'my-root-id';
component.restrictRootToCurrentFolderId = false;
component.ngOnInit();
expect(component.breadcrumbRootId).toBeUndefined();
});
it('should clear the search field, nodes and chosenNode when deleting the search input', fakeAsync(() => {
spyOn(component, 'clearSearch').and.callThrough();
typeToSearchBox('a');
tick(debounceSearch);
fixture.detectChanges();
expect(searchSpy.calls.count()).toBe(1);
typeToSearchBox('');
tick(debounceSearch);
fixture.detectChanges();
expect(searchSpy.calls.count()).toBe(1, 'no other search has been performed');
expect(component.clearSearch).toHaveBeenCalled();
expect(component.folderIdToShow).toBe('cat-girl-nuku-nuku', 'back to the folder in which the search was performed');
}));
it('should folderIdToShow equal the folder node id when navigation changes', async () => {
component.folderIdToShow = null;
const folderChangeEvent: NodeEntryEvent = new NodeEntryEvent(fakeNodeEntry);
component.onFolderChange(folderChangeEvent);
expect(component.folderIdToShow).toEqual(fakeNodeEntry.id);
});
it('should clear the search field, nodes and chosenNode on folder navigation in the results list', async () => {
spyOn(component, 'clearSearch').and.callThrough();
triggerSearchResults(fakeResultSetPaging);
fixture.detectChanges();
component.onFolderChange(nodeEntryEvent);
fixture.detectChanges();
expect(component.clearSearch).toHaveBeenCalled();
});
it('should show nodes from the same folder as selected in the dropdown on clearing the search input', fakeAsync(() => {
typeToSearchBox('piccolo');
tick(debounceSearch);
expect(searchSpy.calls.count()).toBe(1);
component.siteChanged({ entry: { guid: 'namek' } } as SiteEntry);
expect(searchSpy.calls.count()).toBe(2);
component.clear();
expect(component.searchTerm).toBe('');
expect(component.folderIdToShow).toBe('namek');
}));
it('should show the current folder\'s content instead of search results if search was not performed', async () => {
const documentList = fixture.debugElement.query(By.directive(DocumentListComponent));
expect(documentList).not.toBeNull('Document list should be shown');
expect(documentList.componentInstance.currentFolderId).toBe('cat-girl-nuku-nuku');
});
it('should pass through the rowFilter to the documentList', async () => {
const filter = (shareDataRow: ShareDataRow) =>
shareDataRow.node.entry.name === 'impossible-name';
component.rowFilter = filter;
fixture.detectChanges();
const documentList = fixture.debugElement.query(By.directive(DocumentListComponent));
expect(documentList).not.toBeNull('Document list should be shown');
expect(documentList.componentInstance.rowFilter({
node: {
entry: new Node({
name: 'impossible-name',
id: 'name'
})
}
}))
.toBe(filter({
node: {
entry: new Node({
name: 'impossible-name',
id: 'name'
})
}
} as ShareDataRow));
});
it('should pass through the excludeSiteContent to the rowFilter of the documentList', async () => {
component.excludeSiteContent = ['blog'];
fixture.detectChanges();
const documentList = fixture.debugElement.query(By.directive(DocumentListComponent));
expect(documentList).not.toBeNull('Document list should be shown');
expect(documentList.componentInstance.rowFilter).toBeTruthy('Document list should have had a rowFilter');
const testSiteContent = new Node({ id: 'blog-id', properties: { 'st:componentId': 'blog' } });
expect(documentList.componentInstance.rowFilter({ node: { entry: testSiteContent } }, null, null))
.toBe(false);
});
it('should pass through the imageResolver to the documentList', async () => {
const resolver = () => 'piccolo';
component.imageResolver = resolver;
fixture.detectChanges();
const documentList = fixture.debugElement.query(By.directive(DocumentListComponent));
expect(documentList).not.toBeNull('Document list should be shown');
expect(documentList.componentInstance.imageResolver).toBe(resolver);
});
it('should show the result list when search was performed', (done) => {
typeToSearchBox();
setTimeout(() => {
triggerSearchResults(fakeResultSetPaging);
fixture.detectChanges();
const documentList = fixture.debugElement.query(By.css('[data-automation-id="content-node-selector-document-list"]'));
expect(documentList).not.toBeNull('Document list should be shown');
expect(component.hasValidQuery).toEqual(true);
expect(documentList.componentInstance.currentFolderId).toBeNull();
done();
}, 300);
});
it('should not show the result list when results are returned but there is no search term typed', (done) => {
searchQueryBuilderService.userQuery = '';
searchQueryBuilderService.update();
setTimeout(() => {
triggerSearchResults(fakeResultSetPaging);
fixture.detectChanges();
expect(component.hasValidQuery).toEqual(false);
expect(component.showingSearchResults).toEqual(false);
done();
}, 300);
});
it('should highlight the results when search was performed in the next timeframe', (done) => {
typeToSearchBox('My');
setTimeout(() => {
triggerSearchResults(fakeResultSetPaging);
fixture.detectChanges();
fixture.whenStable().then(() => {
expect(fixture.debugElement.nativeElement.querySelector('.adf-highlight').innerHTML).toBe('My');
done();
});
}, 300);
});
it('should show the default text instead of result list if search was cleared', (done) => {
typeToSearchBox();
setTimeout(() => {
triggerSearchResults(fakeResultSetPaging);
fixture.detectChanges();
fixture.whenStable().then(() => {
const clearButton = fixture.debugElement.query(By.css('[data-automation-id="content-node-selector-search-clear"]'));
expect(clearButton).not.toBeNull('Clear button should be in DOM');
clearButton.triggerEventHandler('click', {});
fixture.detectChanges();
const documentList = fixture.debugElement.query(By.css('[data-automation-id="content-node-selector-document-list"]'));
expect(documentList).not.toBeNull('Document list should be shown');
expect(documentList.componentInstance.currentFolderId).toBe('cat-girl-nuku-nuku');
done();
});
}, 300);
});
it('should reload the original folderId when clearing the search input', fakeAsync(() => {
typeToSearchBox('search-term');
tick(debounceSearch);
fixture.detectChanges();
expect(component.folderIdToShow).toBe(null);
typeToSearchBox('');
tick(debounceSearch);
fixture.detectChanges();
expect(component.folderIdToShow).toBe('cat-girl-nuku-nuku');
}));
it('should set the folderIdToShow to the default "currentFolderId" if siteId is undefined', (done) => {
component.siteChanged({ entry: { guid: 'Kame-Sennin Muten Roshi' } } as SiteEntry);
fixture.detectChanges();
let documentList = fixture.debugElement.query(By.css('[data-automation-id="content-node-selector-document-list"]'));
expect(documentList.componentInstance.currentFolderId).toBe('Kame-Sennin Muten Roshi');
component.siteChanged({ entry: { guid: undefined } } as SiteEntry);
fixture.detectChanges();
documentList = fixture.debugElement.query(By.css('[data-automation-id="content-node-selector-document-list"]'));
expect(documentList.componentInstance.currentFolderId).toBe('cat-girl-nuku-nuku');
done();
});
describe('Pagination "Load more" button', () => {
it('should NOT be shown by default', () => {
fixture.detectChanges();
const pagination = fixture.debugElement.query(By.css('[data-automation-id="adf-infinite-pagination-button"]'));
expect(pagination).toBeNull();
});
it('button callback should load the next batch of folder results when there is no searchTerm', () => {
component.searchTerm = '';
fixture.detectChanges();
component.getNextPageOfSearch({
hasMoreItems: false,
skipCount: 10,
maxItems: 45,
totalItems: 0
});
fixture.detectChanges();
expect(component.searchTerm).toBe('');
expect(component.infiniteScroll).toBeTruthy();
expect(component.queryBuilderService.paging.maxItems).toBe(45);
expect(searchSpy).not.toHaveBeenCalled();
});
it('should set its loading state to true to perform a new search', async () => {
component.prepareDialogForNewSearch(mockQueryBody);
fixture.detectChanges();
await fixture.whenStable();
const spinnerSelector = By.css('[data-automation-id="content-node-selector-search-pagination"] [data-automation-id="adf-infinite-pagination-spinner"]');
const paginationLoading = fixture.debugElement.query(spinnerSelector);
expect(paginationLoading).not.toBeNull();
});
it('Should infinite pagination target be null when we use it for search ', fakeAsync(() => {
component.showingSearchResults = true;
typeToSearchBox('shenron');
tick(debounceSearch);
fixture.detectChanges();
expect(component.target).toBeNull();
}));
it('Should infinite pagination target be present when search finish', () => {
triggerSearchResults(fakeResultSetPaging);
fixture.detectChanges();
expect(component.target).not.toBeNull();
});
it('Should infinite pagination target on init be the document list', fakeAsync(() => {
component.showingSearchResults = true;
expect(component.target).toEqual(component.documentList);
}));
it('Should set the scope to nodes when the component inits', () => {
const expectedScope: RequestScope = { locations: 'nodes' };
const setScopeSpy = spyOn(component.queryBuilderService, 'setScope');
component.ngOnInit();
expect(setScopeSpy).toHaveBeenCalledWith(expectedScope);
});
});
});
});
});

View File

@@ -18,20 +18,39 @@
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { MinimalNode, Node, NodeEntry, NodePaging, RequestScope, ResultSetPaging, SiteEntry, SitePaging, UserInfo } from '@alfresco/js-api';
import { AppConfigService, FileModel, FileUploadStatus, NodesApiService, setupTestBed, SitesService, UploadService, FileUploadCompleteEvent, DataRow, ThumbnailService, ContentService, DataColumn } from '@alfresco/adf-core';
import {
MinimalNode,
Node,
NodeEntry,
NodePaging,
ResultSetPaging,
SiteEntry,
SitePaging,
UserInfo
} from '@alfresco/js-api';
import {
AppConfigService,
FileModel,
FileUploadStatus,
NodesApiService,
setupTestBed,
SitesService,
UploadService,
FileUploadCompleteEvent,
DataRow,
ThumbnailService,
ContentService,
DataColumn
} from '@alfresco/adf-core';
import { of, throwError } from 'rxjs';
import { DropdownBreadcrumbComponent } from '../breadcrumb';
import { ContentNodeSelectorPanelComponent } from './content-node-selector-panel.component';
import { ContentTestingModule } from '../testing/content.testing.module';
import { DocumentListService } from '../document-list/services/document-list.service';
import { DocumentListComponent } from '../document-list/components/document-list.component';
import { DropdownSitesComponent } from '../site-dropdown/sites-dropdown.component';
import { CustomResourcesService } from '../document-list/services/custom-resources.service';
import { NodeEntryEvent, ShareDataRow, ShareDataTableAdapter } from '../document-list';
import { TranslateModule } from '@ngx-translate/core';
import { SearchQueryBuilderService } from '../search';
import { mockQueryBody } from '../mock/search-query.mock';
import { ContentNodeSelectorPanelService } from './content-node-selector-panel.service';
import { mockContentModelTextProperty } from '../mock/content-model.mock';
@@ -55,12 +74,10 @@ const fakeResultSetPaging: ResultSetPaging = {
};
describe('ContentNodeSelectorPanelComponent', () => {
const debounceSearch = 200;
let component: ContentNodeSelectorPanelComponent;
let fixture: ComponentFixture<ContentNodeSelectorPanelComponent>;
let nodeService: NodesApiService;
let sitesService: SitesService;
let searchSpy: jasmine.Spy;
const fakeNodeEntry = new Node({ id: 'fakeId' });
const nodeEntryEvent = new NodeEntryEvent(fakeNodeEntry);
let searchQueryBuilderService: SearchQueryBuilderService;
@@ -69,13 +86,6 @@ describe('ContentNodeSelectorPanelComponent', () => {
let thumbnailService: ThumbnailService;
let contentService: ContentService;
const typeToSearchBox = (searchTerm = 'string-to-search') => {
const searchInput = fixture.debugElement.query(By.css('[data-automation-id="content-node-selector-search-input"]'));
searchInput.nativeElement.value = searchTerm;
component.searchInput.setValue(searchTerm);
fixture.detectChanges();
};
const triggerSearchResults = (searchResults: ResultSetPaging) => {
component.queryBuilderService.executed.next(searchResults);
};
@@ -105,9 +115,18 @@ describe('ContentNodeSelectorPanelComponent', () => {
searchQueryBuilderService = component.queryBuilderService;
component.queryBuilderService.resetToDefaults();
spyOn(nodeService, 'getNode').and.returnValue(of(new MinimalNode({ id: 'fake-node', path: { elements: [{ nodeType: 'st:site', name: 'fake-site'}] } })));
searchSpy = spyOn(searchQueryBuilderService, 'execute');
const fakeSite = new SiteEntry({ entry: { id: 'fake-site', guid: 'fake-site', title: 'fake-site', visibility: 'visible' } });
spyOn(nodeService, 'getNode').and.returnValue(of(new MinimalNode({
id: 'fake-node',
path: { elements: [{ nodeType: 'st:site', name: 'fake-site' }] }
})));
const fakeSite = new SiteEntry({
entry: {
id: 'fake-site',
guid: 'fake-site',
title: 'fake-site',
visibility: 'visible'
}
});
spyOn(sitesService, 'getSite').and.returnValue(of(fakeSite));
});
@@ -115,6 +134,40 @@ describe('ContentNodeSelectorPanelComponent', () => {
fixture.destroy();
});
describe('Site selection', () => {
beforeEach(() => {
spyOn(sitesService, 'getSites').and.returnValue(of(new SitePaging({ list: { entries: [] } })));
component.currentFolderId = 'fake-starting-folder';
});
it('should trigger siteChange event on init with parent site Title of start folder', (done) => {
component.siteChange.subscribe((siteTitle: string) => {
expect(siteTitle).toBe('fake-site');
done();
});
component.ngOnInit();
fixture.detectChanges();
expect(component.startSiteGuid).toBe('fake-site');
});
it('should trigger siteChange event when a site is selected in sites-dropdown', (done) => {
const fakeSiteEntry = new SiteEntry({ entry: { title: 'fake-new-site', guid: 'fake-new-site' } });
fixture.detectChanges();
fixture.whenStable().then(() => {
component.siteChange.subscribe((siteTitle: string) => {
expect(siteTitle).toBe('fake-new-site');
done();
});
const sitesDropdown = fixture.debugElement.query(By.directive(DropdownSitesComponent));
sitesDropdown.componentInstance.selectedSite({ value: fakeSiteEntry });
});
});
});
describe('Parameters', () => {
let documentListService: DocumentListService;
@@ -122,7 +175,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
beforeEach(() => {
documentListService = TestBed.inject(DocumentListService);
spyOn(documentListService, 'getFolderNode').and.returnValue(of({ entry: { path: { elements: [] } } }));
spyOn(documentListService, 'getFolderNode').and.returnValue(of(new NodeEntry()));
spyOn(documentListService, 'getFolder').and.returnValue(throwError('No results for test'));
spyOn(sitesService, 'getSites').and.returnValue(of(new SitePaging({
list: {
@@ -142,7 +195,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
});
it('should trigger the select event when selection has been made', (done) => {
const expectedNode = { id: 'fakeid'} as Node;
const expectedNode = { id: 'fakeid' } as Node;
component.select.subscribe((nodes) => {
expect(nodes.length).toBe(1);
expect(nodes[0]).toBe(expectedNode);
@@ -196,27 +249,27 @@ describe('ContentNodeSelectorPanelComponent', () => {
it('should render search input by default', () => {
fixture.detectChanges();
expect(fixture.debugElement.nativeElement.querySelector('.adf-content-node-selector-content-input'))
.not.toBe(null);
.not.toBe(null);
});
it('should not render search input if `showSearch` is false', () => {
component.showSearch = false;
fixture.detectChanges();
expect(fixture.debugElement.nativeElement.querySelector('.adf-content-node-selector-content-input'))
.toBe(null);
.toBe(null);
});
it('should render sites list dropdown by default', () => {
fixture.detectChanges();
expect(fixture.debugElement.nativeElement.querySelector('adf-sites-dropdown'))
.not.toBe(null);
.not.toBe(null);
});
it('should not render sites list dropdown if `showDropdownSiteList` is false', () => {
component.showDropdownSiteList = false;
fixture.detectChanges();
expect(fixture.debugElement.nativeElement.querySelector('adf-sites-dropdown'))
.toBe(null);
.toBe(null);
});
});
@@ -227,7 +280,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
beforeEach(() => {
documentListService = TestBed.inject(DocumentListService);
spyOn(documentListService, 'getFolderNode').and.returnValue(of({ entry: { path: { elements: [] } } }));
spyOn(documentListService, 'getFolderNode').and.returnValue(of(new NodeEntry()));
spyOn(documentListService, 'getFolder').and.returnValue(throwError('No results for test'));
spyOn(sitesService, 'getSites').and.returnValue(of(new SitePaging({ list: { entries: [] } })));
@@ -275,7 +328,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
triggerSearchResults(fakeResultSetPaging);
const chosenNode = new Node({ path: { elements: ['one'] } });
component.onCurrentSelection([ { entry: chosenNode } ]);
component.onCurrentSelection([{ entry: chosenNode }]);
fixture.detectChanges();
const breadcrumb = fixture.debugElement.query(By.directive(DropdownBreadcrumbComponent));
@@ -306,7 +359,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
fixture.detectChanges();
const chosenNode = { path: { elements: [] } } as Node;
component.onCurrentSelection([ { entry: chosenNode } ]);
component.onCurrentSelection([{ entry: chosenNode }]);
fixture.detectChanges();
const breadcrumb = fixture.debugElement.query(By.directive(DropdownBreadcrumbComponent));
@@ -348,692 +401,9 @@ describe('ContentNodeSelectorPanelComponent', () => {
});
});
describe('Site selection', () => {
beforeEach(() => {
spyOn(sitesService, 'getSites').and.returnValue(of(new SitePaging({ list: { entries: [] } })));
component.currentFolderId = 'fake-starting-folder';
});
it('should trigger siteChange event on init with parent site Title of start folder', (done) => {
component.siteChange.subscribe((siteTitle: string) => {
expect(siteTitle).toBe('fake-site');
done();
});
component.ngOnInit();
fixture.detectChanges();
expect(component.startSiteGuid).toBe('fake-site');
});
it('should trigger siteChange event when a site is selected in sites-dropdown', (done) => {
const fakeSiteEntry = new SiteEntry({ entry: { title: 'fake-new-site', guid: 'fake-new-site' } });
fixture.detectChanges();
fixture.whenStable().then(() => {
component.siteChange.subscribe((siteTitle: string) => {
expect(siteTitle).toBe('fake-new-site');
done();
});
const sitesDropdown = fixture.debugElement.query(By.directive(DropdownSitesComponent));
sitesDropdown.componentInstance.selectedSite({value: fakeSiteEntry});
});
});
});
describe('Search functionality', () => {
let getCorrespondingNodeIdsSpy;
let customResourcesService: CustomResourcesService;
const entry: Node = { id: 'fakeid'} as Node;
beforeEach(() => {
const documentListService = TestBed.inject(DocumentListService);
const expectedDefaultFolderNode = { entry: { path: { elements: [] } } };
component.isSelectionValid = (node: Node) => node.isFile;
spyOn(documentListService, 'getFolderNode').and.returnValue(of(expectedDefaultFolderNode));
spyOn(documentListService, 'getFolder').and.returnValue(of(new NodePaging({
list: {
pagination: {},
entries: [],
source: {}
}
})));
spyOn(sitesService, 'getSites').and.returnValue(of(new SitePaging({ list: { entries: [] } })));
customResourcesService = TestBed.inject(CustomResourcesService);
getCorrespondingNodeIdsSpy = spyOn(customResourcesService, 'getCorrespondingNodeIds').and
.callFake((id) => {
if (id === '-sites-') {
return of(['123456testId', '09876543testId']);
}
return of([id]);
});
component.currentFolderId = 'cat-girl-nuku-nuku';
component.documentList.ngOnInit();
fixture.detectChanges();
});
it('should the user query get updated when the user types in the search input', fakeAsync(() => {
const updateSpy = spyOn(searchQueryBuilderService, 'update');
typeToSearchBox('search-term');
tick(debounceSearch);
fixture.detectChanges();
expect(updateSpy).toHaveBeenCalled();
expect(searchQueryBuilderService.userQuery).toEqual('(search-term*)');
expect(component.searchTerm).toEqual('search-term');
}));
it('should perform a search when the queryBody gets updated and it is defined', async () => {
searchQueryBuilderService.userQuery = 'search-term*';
searchQueryBuilderService.update();
fixture.detectChanges();
await fixture.whenStable();
expect(searchSpy).toHaveBeenCalledWith(mockQueryBody);
});
it('should NOT perform a search and clear the results when the queryBody gets updated and it is NOT defined', async () => {
spyOn(component, 'clearSearch');
searchQueryBuilderService.userQuery = '';
searchQueryBuilderService.update();
fixture.detectChanges();
await fixture.whenStable();
expect(searchSpy).not.toHaveBeenCalled();
expect(component.clearSearch).toHaveBeenCalled();
});
it('should reset the search term when clicking the clear icon', () => {
component.searchTerm = 'search-term';
searchQueryBuilderService.userQuery = 'search-term';
spyOn(component, 'clearSearch');
fixture.detectChanges();
const clearIcon = fixture.debugElement.query(By.css('[data-automation-id="content-node-selector-search-clear"]'));
clearIcon.nativeElement.click();
fixture.detectChanges();
expect(searchQueryBuilderService.userQuery).toEqual('');
expect(component.searchTerm).toEqual('');
expect(component.clearSearch).toHaveBeenCalled();
});
it('should load the results by calling the search api on search change', fakeAsync(() => {
typeToSearchBox('search-term');
tick(debounceSearch);
fixture.detectChanges();
expect(searchSpy).toHaveBeenCalledWith(mockQueryBody);
}));
it('should the query include the show files filterQuery', fakeAsync(() => {
component.showFilesInResult = true;
typeToSearchBox('search-term');
const expectedQueryBody = mockQueryBody;
expectedQueryBody.filterQueries.push({
query: `TYPE:'cm:folder' OR TYPE:'cm:content'`
});
tick(debounceSearch);
fixture.detectChanges();
expect(searchSpy).toHaveBeenCalledWith(expectedQueryBody);
}));
it('should reset the currently chosen node in case of starting a new search', fakeAsync(() => {
component.chosenNode = [entry];
typeToSearchBox('kakarot');
tick(debounceSearch);
fixture.detectChanges();
expect(component.chosenNode).toBeNull();
}));
it('should update the breadcrumb when changing to a custom site', async () => {
component.siteChanged({ entry: { guid: '-mysites-', title: 'My Sites' } } as SiteEntry);
expect(component.breadcrumbFolderTitle).toBe('My Sites');
});
it('should perform a search when selecting a site with the correct query', fakeAsync(() => {
typeToSearchBox('search-term');
tick(debounceSearch);
expect(searchSpy.calls.count()).toBe(1, 'Search count should be one after only one search');
component.siteChanged({ entry: { guid: 'namek' } } as SiteEntry);
const expectedQueryBody = mockQueryBody;
expectedQueryBody.filterQueries = [ { query: `ANCESTOR:'workspace://SpacesStore/namek'`} ];
expect(searchSpy.calls.count()).toBe(2, 'Search count should be two after the site change');
expect(searchSpy).toHaveBeenCalledWith(expectedQueryBody);
}));
it('should create the query with the right parameters on changing the site selectBox value from a custom dropdown menu', fakeAsync(() => {
component.dropdownSiteList = { list: { entries: [{ entry: { guid: '-sites-' } }, { entry: { guid: 'namek' } }] } } as SitePaging;
fixture.detectChanges();
typeToSearchBox('search-term');
tick(debounceSearch);
expect(searchSpy.calls.count()).toBe(1);
component.siteChanged({ entry: { guid: '-sites-' } } as SiteEntry);
const expectedQueryBodyWithSiteChange = mockQueryBody;
expectedQueryBodyWithSiteChange.filterQueries = [
{ query: `ANCESTOR:'workspace://SpacesStore/-sites-' OR ANCESTOR:'workspace://SpacesStore/123456testId' OR ANCESTOR:'workspace://SpacesStore/09876543testId'` }
];
expect(searchSpy).toHaveBeenCalled();
expect(searchSpy.calls.count()).toBe(2);
expect(searchSpy).toHaveBeenCalledWith(mockQueryBody);
expect(searchSpy).toHaveBeenCalledWith(expectedQueryBodyWithSiteChange);
}));
it('should get the corresponding node ids on search when a known alias is selected from dropdown', fakeAsync(() => {
typeToSearchBox('vegeta');
tick(debounceSearch);
component.siteChanged({ entry: { guid: '-sites-' } } as SiteEntry);
expect(getCorrespondingNodeIdsSpy.calls.count()).toBe(1, 'getCorrespondingNodeIdsSpy calls count should be one after the site changes to known alias \'-sites\-');
expect(getCorrespondingNodeIdsSpy.calls.mostRecent().args[0]).toEqual('-sites-');
}));
it('should get the corresponding node ids on search when a known alias is selected from CUSTOM dropdown', fakeAsync(() => {
component.dropdownSiteList = { list: { entries: [{ entry: { guid: '-sites-' } }, { entry: { guid: 'namek' } }] } } as SitePaging;
fixture.detectChanges();
typeToSearchBox('vegeta');
tick(debounceSearch);
component.siteChanged({ entry: { guid: '-sites-' } } as SiteEntry);
expect(getCorrespondingNodeIdsSpy.calls.count()).toBe(1);
expect(getCorrespondingNodeIdsSpy.calls.mostRecent().args[0]).toEqual('-sites-');
}));
it('should NOT get the corresponding node ids on search when NOTHING is selected from dropdown', fakeAsync(() => {
component.dropdownSiteList = { list: { entries: [{ entry: { guid: '-sites-' } }, { entry: { guid: 'namek' } }] } } as SitePaging;
fixture.detectChanges();
typeToSearchBox('vegeta');
tick(debounceSearch);
expect(getCorrespondingNodeIdsSpy.calls.count()).toBe(0, 'getCorrespondingNodeIdsSpy calls count should be 0 when no site is selected');
}));
it('should NOT get the corresponding node ids on search when NO known alias is selected from dropdown', fakeAsync(() => {
typeToSearchBox('vegeta');
tick(debounceSearch);
expect(getCorrespondingNodeIdsSpy.calls.count()).toBe(0, 'getCorrespondingNodeIdsSpy should not be called');
component.siteChanged({ entry: { guid: 'namek' } } as SiteEntry);
expect(getCorrespondingNodeIdsSpy).not.toHaveBeenCalled();
}));
it('should NOT get the corresponding node ids on search when NO known alias is selected from CUSTOM dropdown', fakeAsync(() => {
component.dropdownSiteList = { list: { entries: [{ entry: { guid: '-sites-' } }, { entry: { guid: 'namek' } }] } } as SitePaging;
fixture.detectChanges();
typeToSearchBox('vegeta');
tick(debounceSearch);
expect(getCorrespondingNodeIdsSpy.calls.count()).toBe(0, 'getCorrespondingNodeIdsSpy should not be called');
component.siteChanged({ entry: { guid: 'namek' } } as SiteEntry);
expect(getCorrespondingNodeIdsSpy).not.toHaveBeenCalled();
}));
it('should show the search icon by default without the X (clear) icon', fakeAsync(() => {
fixture.detectChanges();
tick(debounceSearch);
const searchIcon = fixture.debugElement.query(By.css('[data-automation-id="content-node-selector-search-icon"]'));
const clearIcon = fixture.debugElement.query(By.css('[data-automation-id="content-node-selector-search-clear"]'));
expect(searchIcon).not.toBeNull('Search icon should be in the DOM');
expect(clearIcon).toBeNull('Clear icon should NOT be in the DOM');
}));
it('should show the X (clear) icon without the search icon when the search contains at least one character', fakeAsync(() => {
fixture.detectChanges();
typeToSearchBox('123');
tick(debounceSearch);
fixture.detectChanges();
const searchIcon = fixture.debugElement.query(By.css('[data-automation-id="content-node-selector-search-icon"]'));
const clearIcon = fixture.debugElement.query(By.css('[data-automation-id="content-node-selector-search-clear"]'));
expect(searchIcon).toBeNull('Search icon should NOT be in the DOM');
expect(clearIcon).not.toBeNull('Clear icon should be in the DOM');
}));
it('should clear the search field, nodes and chosenNode when clicking on the X (clear) icon', () => {
component.chosenNode = [entry];
component.nodePaging = {
list: {
entries: [{ entry }]
}
};
component.searchTerm = 'piccolo';
component.showingSearchResults = true;
component.clear();
expect(component.searchTerm).toBe('');
expect(component.nodePaging).toEqual(null);
expect(component.chosenNode).toBeNull();
expect(component.showingSearchResults).toBeFalsy();
});
it('should the query restrict the search to the currentFolderId in case is defined', fakeAsync(() => {
component.currentFolderId = 'my-root-id';
component.restrictRootToCurrentFolderId = true;
component.ngOnInit();
typeToSearchBox('search-term');
tick(debounceSearch);
const expectedQueryBody = mockQueryBody;
expectedQueryBody.filterQueries = [ { query: `ANCESTOR:'workspace://SpacesStore/my-root-id'`} ];
expect(searchSpy).toHaveBeenCalledWith(expectedQueryBody);
}));
it('should emit showingSearch event with true while searching', async () => {
searchQueryBuilderService.userQuery = 'mock-search-term';
searchQueryBuilderService.update();
spyOn(customResourcesService, 'hasCorrespondingNodeIds').and.returnValue(true);
const showingSearchSpy = spyOn(component.showingSearch, 'emit');
component.queryBuilderService.execute({ query: { query: 'search' } });
triggerSearchResults(fakeResultSetPaging);
fixture.detectChanges();
await fixture.whenStable();
expect(component.showingSearchResults).toBe(true);
expect(showingSearchSpy).toHaveBeenCalledWith(true);
});
it('should emit showingSearch event with false if you remove search term without clicking on X (icon) icon', fakeAsync(() => {
const showingSearchSpy = spyOn(component.showingSearch, 'emit');
typeToSearchBox('');
tick(debounceSearch);
fixture.detectChanges();
expect(component.showingSearchResults).toBe(false);
expect(showingSearchSpy).toHaveBeenCalledWith(false);
}));
it('should emit showingResults event with false when clicking on the X (clear) icon', () => {
const showingSearchSpy = spyOn(component.showingSearch, 'emit');
component.chosenNode = [entry];
component.nodePaging = {
list: {
entries: [{ entry }]
}
};
component.searchTerm = 'piccolo';
component.showingSearchResults = true;
component.clear();
expect(component.showingSearchResults).toBe(false);
expect(showingSearchSpy).toHaveBeenCalledWith(false);
});
it('should emit showingResults event with false if search api fails', async () => {
searchQueryBuilderService.userQuery = 'mock-search-term';
searchQueryBuilderService.update();
getCorrespondingNodeIdsSpy.and.throwError('Failed');
const showingSearchSpy = spyOn(component.showingSearch, 'emit');
component.queryBuilderService.execute({ query: { query: 'search' } });
triggerSearchResults(fakeResultSetPaging);
fixture.detectChanges();
await fixture.whenStable();
expect(component.showingSearchResults).toBe(true);
expect(showingSearchSpy).toHaveBeenCalledWith(true);
});
it('should the query restrict the search to the site and not to the currentFolderId in case is changed', () => {
component.queryBuilderService.userQuery = 'search-term*';
component.currentFolderId = 'my-root-id';
component.restrictRootToCurrentFolderId = true;
component.siteChanged({ entry: { guid: 'my-site-id' } } as SiteEntry);
const expectedQueryBodyWithSiteChange = mockQueryBody;
expectedQueryBodyWithSiteChange.filterQueries = [
{ query: `ANCESTOR:'workspace://SpacesStore/my-site-id'` }
];
expect(searchSpy).toHaveBeenCalledWith(expectedQueryBodyWithSiteChange);
});
it('should restrict the breadcrumb to the currentFolderId in case restrictedRoot is true', () => {
component.currentFolderId = 'my-root-id';
component.restrictRootToCurrentFolderId = true;
component.ngOnInit();
expect(component.breadcrumbRootId).toEqual('my-root-id');
});
it('should NOT restrict the breadcrumb to the currentFolderId in case restrictedRoot is false', () => {
component.currentFolderId = 'my-root-id';
component.restrictRootToCurrentFolderId = false;
component.ngOnInit();
expect(component.breadcrumbRootId).toBeUndefined();
});
it('should clear the search field, nodes and chosenNode when deleting the search input', fakeAsync (() => {
spyOn(component, 'clearSearch').and.callThrough();
typeToSearchBox('a');
tick(debounceSearch);
fixture.detectChanges();
expect(searchSpy.calls.count()).toBe(1);
typeToSearchBox('');
tick(debounceSearch);
fixture.detectChanges();
expect(searchSpy.calls.count()).toBe(1, 'no other search has been performed');
expect(component.clearSearch).toHaveBeenCalled();
expect(component.folderIdToShow).toBe('cat-girl-nuku-nuku', 'back to the folder in which the search was performed');
}));
it('should folderIdToShow equal the folder node id when navigation changes', () => {
component.folderIdToShow = null;
const folderChangeEvent: NodeEntryEvent = new NodeEntryEvent(fakeNodeEntry);
component.onFolderChange(folderChangeEvent);
expect(component.folderIdToShow).toEqual(fakeNodeEntry.id);
});
it('should clear the search field, nodes and chosenNode on folder navigation in the results list', async () => {
spyOn(component, 'clearSearch').and.callThrough();
triggerSearchResults(fakeResultSetPaging);
fixture.detectChanges();
component.onFolderChange(nodeEntryEvent);
fixture.detectChanges();
expect(component.clearSearch).toHaveBeenCalled();
});
it('should show nodes from the same folder as selected in the dropdown on clearing the search input', fakeAsync (() => {
typeToSearchBox('piccolo');
tick(debounceSearch);
expect(searchSpy.calls.count()).toBe(1);
component.siteChanged({ entry: { guid: 'namek' } } as SiteEntry);
expect(searchSpy.calls.count()).toBe(2);
component.clear();
expect(component.searchTerm).toBe('');
expect(component.folderIdToShow).toBe('namek');
}));
it('should show the current folder\'s content instead of search results if search was not performed', () => {
const documentList = fixture.debugElement.query(By.directive(DocumentListComponent));
expect(documentList).not.toBeNull('Document list should be shown');
expect(documentList.componentInstance.currentFolderId).toBe('cat-girl-nuku-nuku');
});
it('should pass through the rowFilter to the documentList', () => {
const filter = (shareDataRow: ShareDataRow) =>
shareDataRow.node.entry.name === 'impossible-name';
component.rowFilter = filter;
fixture.detectChanges();
const documentList = fixture.debugElement.query(By.directive(DocumentListComponent));
expect(documentList).not.toBeNull('Document list should be shown');
expect(documentList.componentInstance.rowFilter({
node: {
entry: new Node({
name: 'impossible-name',
id: 'name'
})
}
}))
.toBe(filter({
node: {
entry: new Node({
name: 'impossible-name',
id: 'name'
})
}
} as ShareDataRow));
});
it('should pass through the excludeSiteContent to the rowFilter of the documentList', () => {
component.excludeSiteContent = ['blog'];
fixture.detectChanges();
const documentList = fixture.debugElement.query(By.directive(DocumentListComponent));
expect(documentList).not.toBeNull('Document list should be shown');
expect(documentList.componentInstance.rowFilter).toBeTruthy('Document list should have had a rowFilter');
const testSiteContent = new Node({ id: 'blog-id', properties: { 'st:componentId': 'blog' } });
expect(documentList.componentInstance.rowFilter({ node: { entry: testSiteContent } }, null, null))
.toBe(false);
});
it('should pass through the imageResolver to the documentList', () => {
const resolver = () => 'piccolo';
component.imageResolver = resolver;
fixture.detectChanges();
const documentList = fixture.debugElement.query(By.directive(DocumentListComponent));
expect(documentList).not.toBeNull('Document list should be shown');
expect(documentList.componentInstance.imageResolver).toBe(resolver);
});
it('should show the result list when search was performed', (done) => {
typeToSearchBox();
setTimeout(() => {
triggerSearchResults(fakeResultSetPaging);
fixture.detectChanges();
const documentList = fixture.debugElement.query(By.css('[data-automation-id="content-node-selector-document-list"]'));
expect(documentList).not.toBeNull('Document list should be shown');
expect(component.hasValidQuery).toEqual(true);
expect(documentList.componentInstance.currentFolderId).toBeNull();
done();
}, 300);
});
it('should not show the result list when results are returned but there is no search term typed', (done) => {
searchQueryBuilderService.userQuery = '';
searchQueryBuilderService.update();
setTimeout(() => {
triggerSearchResults(fakeResultSetPaging);
fixture.detectChanges();
expect(component.hasValidQuery).toEqual(false);
expect(component.showingSearchResults).toEqual(false);
done();
}, 300);
});
it('should highlight the results when search was performed in the next timeframe', (done) => {
typeToSearchBox('My');
setTimeout(() => {
triggerSearchResults(fakeResultSetPaging);
fixture.detectChanges();
fixture.whenStable().then(() => {
expect(fixture.debugElement.nativeElement.querySelector('.adf-highlight').innerHTML).toBe('My');
done();
});
}, 300);
});
it('should show the default text instead of result list if search was cleared', (done) => {
typeToSearchBox();
setTimeout(() => {
triggerSearchResults(fakeResultSetPaging);
fixture.detectChanges();
fixture.whenStable().then(() => {
const clearButton = fixture.debugElement.query(By.css('[data-automation-id="content-node-selector-search-clear"]'));
expect(clearButton).not.toBeNull('Clear button should be in DOM');
clearButton.triggerEventHandler('click', {});
fixture.detectChanges();
const documentList = fixture.debugElement.query(By.css('[data-automation-id="content-node-selector-document-list"]'));
expect(documentList).not.toBeNull('Document list should be shown');
expect(documentList.componentInstance.currentFolderId).toBe('cat-girl-nuku-nuku');
done();
});
}, 300);
});
it('should reload the original folderId when clearing the search input', fakeAsync(() => {
typeToSearchBox('search-term');
tick(debounceSearch);
fixture.detectChanges();
expect(component.folderIdToShow).toBe(null);
typeToSearchBox('');
tick(debounceSearch);
fixture.detectChanges();
expect(component.folderIdToShow).toBe('cat-girl-nuku-nuku');
}));
it('should set the folderIdToShow to the default "currentFolderId" if siteId is undefined', (done) => {
component.siteChanged({ entry: { guid: 'Kame-Sennin Muten Roshi' } } as SiteEntry);
fixture.detectChanges();
let documentList = fixture.debugElement.query(By.css('[data-automation-id="content-node-selector-document-list"]'));
expect(documentList.componentInstance.currentFolderId).toBe('Kame-Sennin Muten Roshi');
component.siteChanged({ entry: { guid: undefined } } as SiteEntry);
fixture.detectChanges();
documentList = fixture.debugElement.query(By.css('[data-automation-id="content-node-selector-document-list"]'));
expect(documentList.componentInstance.currentFolderId).toBe('cat-girl-nuku-nuku');
done();
});
describe('Pagination "Load more" button', () => {
it('should NOT be shown by default', () => {
fixture.detectChanges();
const pagination = fixture.debugElement.query(By.css('[data-automation-id="adf-infinite-pagination-button"]'));
expect(pagination).toBeNull();
});
it('button callback should load the next batch of folder results when there is no searchTerm', () => {
component.searchTerm = '';
fixture.detectChanges();
component.getNextPageOfSearch({
hasMoreItems: false,
skipCount: 10,
maxItems: 45,
totalItems: 0
});
fixture.detectChanges();
expect(component.searchTerm).toBe('');
expect(component.infiniteScroll).toBeTruthy();
expect(component.queryBuilderService.paging.maxItems).toBe(45);
expect(searchSpy).not.toHaveBeenCalled();
});
it('should set its loading state to true to perform a new search', async () => {
component.prepareDialogForNewSearch(mockQueryBody);
fixture.detectChanges();
await fixture.whenStable();
const spinnerSelector = By.css('[data-automation-id="content-node-selector-search-pagination"] [data-automation-id="adf-infinite-pagination-spinner"]');
const paginationLoading = fixture.debugElement.query(spinnerSelector);
expect(paginationLoading).not.toBeNull();
});
it('Should infinite pagination target be null when we use it for search ', fakeAsync (() => {
component.showingSearchResults = true;
typeToSearchBox('shenron');
tick(debounceSearch);
fixture.detectChanges();
expect(component.target).toBeNull();
}));
it('Should infinite pagination target be present when search finish', () => {
triggerSearchResults(fakeResultSetPaging);
fixture.detectChanges();
expect(component.target).not.toBeNull();
});
it('Should infinite pagination target on init be the document list', fakeAsync(() => {
component.showingSearchResults = true;
expect(component.target).toEqual(component.documentList);
}));
it('Should set the scope to nodes when the component inits', () => {
const expectedScope: RequestScope = { locations: 'nodes' };
const setScopeSpy = spyOn(component.queryBuilderService, 'setScope');
component.ngOnInit();
expect(setScopeSpy).toHaveBeenCalledWith(expectedScope);
});
});
});
describe('Chosen node', () => {
const entry: Node = { id: 'fakeid'} as Node;
const entry: Node = { id: 'fakeid' } as Node;
const nodePage: NodePaging = { list: { pagination: {} } };
let hasAllowableOperations;
const fakeFolderNode = { id: 'fakeNodeId', isFolder: true } as Node;
@@ -1145,7 +515,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
expect(component.chosenNode[0]).toBe(entry);
});
component.onCurrentSelection([ { entry } ]);
component.onCurrentSelection([{ entry }]);
});
it('should remain empty when clicking on a node (with the WRONG permissions) in the list (onNodeSelect)', async () => {
@@ -1157,7 +527,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
expect(component.chosenNode).toEqual([]);
});
component.onCurrentSelection([ { entry } ]);
component.onCurrentSelection([{ entry }]);
});
it('should become empty when clicking on a node (with the WRONG permissions) after previously selecting a right node', async () => {
@@ -1299,8 +669,11 @@ describe('ContentNodeSelectorPanelComponent', () => {
const isUploadingSpy = spyOn(uploadService, 'isUploading').and.returnValue(true);
const documentListReloadSpy = spyOn(component.documentList, 'reloadWithoutResettingSelection');
const fakeFileModels = [new FileModel({ name: 'fake-name', size: 100 } as File), new FileModel({ name: 'fake-name-2', size: 200 } as File)];
const fileUploadCompleteEvent = new FileUploadCompleteEvent(fakeFileModels[0], 1, fakeFileModels[0], 0);
const fakeFileModels = [new FileModel({
name: 'fake-name',
size: 100
} as File), new FileModel({ name: 'fake-name-2', size: 200 } as File)];
const fileUploadCompleteEvent = new FileUploadCompleteEvent(fakeFileModels[0], 1, fakeFileModels[0], 0);
uploadService.fileUploadComplete.next(fileUploadCompleteEvent);
tick(500);
@@ -1312,7 +685,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
isUploadingSpy.and.returnValue(false);
const secondFileUploadCompleteEvent = new FileUploadCompleteEvent(fakeFileModels[1], 2, fakeFileModels[1], 0);
const secondFileUploadCompleteEvent = new FileUploadCompleteEvent(fakeFileModels[1], 2, fakeFileModels[1], 0);
uploadService.fileUploadComplete.next(secondFileUploadCompleteEvent);
tick(500);
@@ -1371,7 +744,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
contentNodeSelectorPanelService.customModels = undefined;
});
it ('should search panel be collapsed by default and expand when clicking the filter button', async () => {
it('should search panel be collapsed by default and expand when clicking the filter button', async () => {
contentNodeSelectorPanelService.customModels = [mockContentModelTextProperty];
fixture.detectChanges();
@@ -1386,7 +759,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
expect(component.searchPanelExpanded).toEqual(true);
});
it ('should search panel be present when the filter section is expanded', () => {
it('should search panel be present when the filter section is expanded', () => {
component.searchPanelExpanded = true;
fixture.detectChanges();
@@ -1395,7 +768,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
expect(searchPanelContainer).not.toBe(null);
});
it('should filter button be present only when there are custom models', () => {
it('should filter button be present only when there are custom models', () => {
contentNodeSelectorPanelService.customModels = [mockContentModelTextProperty];
fixture.detectChanges();
@@ -1404,7 +777,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
expect(toggleFiltersPanelButton).not.toEqual(null);
});
it('should filter button not be present when there are no custom models', () => {
it('should filter button not be present when there are no custom models', () => {
fixture.detectChanges();
const toggleFiltersPanelButton = fixture.debugElement.query(By.css('[data-automation-id="adf-toggle-search-panel-button"]'));

View File

@@ -47,11 +47,12 @@ import { RowFilter } from '../document-list/data/row-filter.model';
import { ImageResolver } from '../document-list/data/image-resolver.model';
import { debounceTime, takeUntil } from 'rxjs/operators';
import { CustomResourcesService } from '../document-list/services/custom-resources.service';
import { NodeEntryEvent, ShareDataRow } from '../document-list';
import { ShareDataRow } from '../document-list/data/share-data-row.model';
import { Subject } from 'rxjs';
import { SEARCH_QUERY_SERVICE_TOKEN } from '../search/search-query-service.token';
import { SearchQueryBuilderService } from '../search/services/search-query-builder.service';
import { ContentNodeSelectorPanelService } from './content-node-selector-panel.service';
import { NodeEntryEvent } from '../document-list/components/node.event';
export type ValidationFunction = (entry: Node) => boolean;

View File

@@ -27,7 +27,7 @@ import {
AppConfigService
} from '@alfresco/adf-core';
import { ShareDialogComponent } from './content-node-share.dialog';
import moment from 'moment-es6';
import moment from 'moment';
import { ContentTestingModule } from '../testing/content.testing.module';
import { TranslateModule } from '@ngx-translate/core';

View File

@@ -36,7 +36,7 @@ import {
} from '@alfresco/adf-core';
import { SharedLinkEntry, Node } from '@alfresco/js-api';
import { ConfirmDialogComponent } from '../dialogs/confirm.dialog';
import moment from 'moment-es6';
import moment from 'moment';
import { ContentNodeShareSettings } from './content-node-share.settings';
import { takeUntil, debounceTime } from 'rxjs/operators';

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import moment from 'moment-es6';
import moment from 'moment';
import { TestBed, fakeAsync, tick, ComponentFixture } from '@angular/core/testing';
import { MatDialogRef } from '@angular/material/dialog';

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import moment from 'moment-es6';
import moment from 'moment';
import { Component, Inject, OnInit, Optional, ViewEncapsulation } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';

View File

@@ -19,7 +19,7 @@
/* eslint-disable @typescript-eslint/naming-convention */
import {
AfterContentInit, Component, ContentChild, ElementRef, EventEmitter, HostListener, Input, NgZone,
AfterContentInit, Component, ContentChild, ElementRef, EventEmitter, HostListener, Input,
OnChanges, OnDestroy, OnInit, Output, SimpleChanges, ViewChild, ViewEncapsulation
} from '@angular/core';
@@ -63,11 +63,16 @@ import { RowFilter } from '../data/row-filter.model';
import { DocumentListService } from '../services/document-list.service';
import { DocumentLoaderNode } from '../models/document-folder.model';
import { takeUntil } from 'rxjs/operators';
import { ADF_DOCUMENT_PARENT_COMPONENT } from './document-list.token';
@Component({
selector: 'adf-document-list',
templateUrl: './document-list.component.html',
styleUrls: ['./document-list.component.scss'],
providers:[{
provide: ADF_DOCUMENT_PARENT_COMPONENT,
useExisting: DocumentListComponent
}],
encapsulation: ViewEncapsulation.None,
host: { class: 'adf-document-list' }
})
@@ -352,7 +357,6 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
}
constructor(private documentListService: DocumentListService,
private ngZone: NgZone,
private elementRef: ElementRef,
private appConfig: AppConfigService,
private userPreferencesService: UserPreferencesService,
@@ -507,10 +511,8 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
}
reload() {
this.ngZone.run(() => {
this.resetSelection();
this.reloadWithoutResettingSelection();
});
this.resetSelection();
this.reloadWithoutResettingSelection();
}
reloadWithoutResettingSelection() {

View File

@@ -0,0 +1,25 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* eslint-disable rxjs/no-subject-value */
/* eslint-disable @typescript-eslint/naming-convention */
import { InjectionToken } from '@angular/core';
export const ADF_DOCUMENT_PARENT_COMPONENT = new InjectionToken(
'ADF_DOCUMENT_PARENT_COMPONENT'
);

View File

@@ -26,6 +26,7 @@ import { SEARCH_QUERY_SERVICE_TOKEN } from './../../../search/search-query-servi
import { DocumentListComponent } from './../document-list.component';
import { FilterHeaderComponent } from './filter-header.component';
import { Pagination } from '@alfresco/js-api';
import { ADF_DOCUMENT_PARENT_COMPONENT } from '../document-list.token';
describe('FilterHeaderComponent', () => {
let fixture: ComponentFixture<FilterHeaderComponent>;
@@ -52,6 +53,7 @@ describe('FilterHeaderComponent', () => {
ContentTestingModule
],
providers: [
{ provide: ADF_DOCUMENT_PARENT_COMPONENT, useExisting: DocumentListComponent },
{ provide: SearchService, useValue: searchMock },
{ provide: SEARCH_QUERY_SERVICE_TOKEN, useClass: SearchHeaderQueryBuilderService },
{ provide: DocumentListComponent, useValue: documentListMock },
@@ -121,7 +123,7 @@ describe('FilterHeaderComponent', () => {
await fixture.whenStable();
expect(queryBuilder.getActiveFilters().length).toBe(0);
const initialFilterValue = { name: 'pinocchio'};
const initialFilterValue = { name: 'pinocchio' };
component.value = initialFilterValue;
const currentFolderNodeIdChange = new SimpleChange('current-node-id', 'next-node-id', true);
component.ngOnChanges({ currentFolderId: currentFolderNodeIdChange });

View File

@@ -17,13 +17,13 @@
import { Component, Inject, OnInit, OnChanges, SimpleChanges, Input, Output, EventEmitter, OnDestroy } from '@angular/core';
import { PaginationModel, DataSorting } from '@alfresco/adf-core';
import { DocumentListComponent } from '../document-list.component';
import { SEARCH_QUERY_SERVICE_TOKEN } from '../../../search/search-query-service.token';
import { SearchHeaderQueryBuilderService } from '../../../search/services/search-header-query-builder.service';
import { FilterSearch } from './../../../search/models/filter-search.interface';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { NodePaging, MinimalNode } from '@alfresco/js-api';
import { ADF_DOCUMENT_PARENT_COMPONENT } from '../document-list.token';
@Component({
selector: 'adf-filter-header',
@@ -47,7 +47,7 @@ export class FilterHeaderComponent implements OnInit, OnChanges, OnDestroy {
isFilterServiceActive: boolean;
private onDestroy$ = new Subject<boolean>();
constructor(@Inject(DocumentListComponent) private documentList: DocumentListComponent,
constructor(@Inject(ADF_DOCUMENT_PARENT_COMPONENT) private documentList: any,
@Inject(SEARCH_QUERY_SERVICE_TOKEN) private searchFilterQueryBuilder: SearchHeaderQueryBuilderService) {
this.isFilterServiceActive = this.searchFilterQueryBuilder.isFilterServiceActive();
}

View File

@@ -68,4 +68,5 @@ import { SearchModule } from './../search/search.module';
FilterHeaderComponent
]
})
export class DocumentListModule {}
export class DocumentListModule {
}

View File

@@ -101,7 +101,7 @@ describe('NewVersionUploaderService', () => {
spyOn(contentService, 'hasAllowableOperations').and.returnValue(true);
spyOn(service.versionsApi, 'listVersionHistory').and.returnValue(Promise.resolve({
list: { entries: [{ entry: '2' }] }
}));
} as any));
mockNewVersionUploaderDialogData = {
node: mockNode,
file: mockFile
@@ -115,7 +115,7 @@ describe('NewVersionUploaderService', () => {
data: { file: mockFile, node: mockNode, currentVersion: '2', showComments: true, allowDownload: true, showVersionsOnly: undefined },
panelClass: ['adf-new-version-uploader-dialog', 'adf-new-version-uploader-dialog-upload'],
width: '630px'
});
} as any);
}));
it('Should override default dialog panelClass', fakeAsync(() => {
@@ -129,7 +129,7 @@ describe('NewVersionUploaderService', () => {
data: { file: mockFile, node: mockNode, currentVersion: '2', showComments: true, allowDownload: true, showVersionsOnly: undefined },
panelClass: 'adf-custom-class',
width: '500px'
});
} as any);
}));
it('Should set dialog height', fakeAsync(() => {
@@ -143,7 +143,7 @@ describe('NewVersionUploaderService', () => {
panelClass: ['adf-new-version-uploader-dialog', 'adf-new-version-uploader-dialog-upload'],
width: '630px',
height: '600px'
});
} as any);
}));
it('Should not override dialog configuration, if dialog configuration is empty', fakeAsync(() => {
@@ -154,7 +154,7 @@ describe('NewVersionUploaderService', () => {
data: { file: mockFile, node: mockNode, currentVersion: '2', showComments: true, allowDownload: true, showVersionsOnly: undefined },
panelClass: ['adf-new-version-uploader-dialog', 'adf-new-version-uploader-dialog-upload'],
width: '630px'
});
} as any);
}));
it('Should dialog add list css class if showVersionsOnly is true', fakeAsync(() => {
@@ -169,7 +169,7 @@ describe('NewVersionUploaderService', () => {
data: { file: mockFile, node: mockNode, currentVersion: '2', showComments: true, allowDownload: true, showVersionsOnly: true },
panelClass: ['adf-new-version-uploader-dialog', 'adf-new-version-uploader-dialog-list'],
width: '630px'
});
} as any);
}));
});
@@ -181,7 +181,7 @@ describe('NewVersionUploaderService', () => {
spyOn(contentService, 'hasAllowableOperations').and.returnValue(true);
spyOn(service.versionsApi, 'listVersionHistory').and.returnValue(Promise.resolve({
list: { entries: [{ entry: '2' }] }
}));
}) as any);
mockNewVersionUploaderDialogData = {
node: mockNode,
file: mockFile

View File

@@ -1,5 +1,5 @@
<mat-card class="adf-permission-card" id="adf-permission-manager-card">
<div *ngIf="!(permissionList.data$ | async) && permissionList.loading$ | async" class="adf-permission-loader">
<div *ngIf="(permissionList.data$ | async) === null && permissionList.loading$ | async" class="adf-permission-loader">
<mat-progress-spinner [color]="'primary'"
[mode]="'indeterminate'">
</mat-progress-spinner>

View File

@@ -16,7 +16,7 @@
*/
import { NodesApiService, SearchService, setupTestBed } from '@alfresco/adf-core';
import { ComponentFixture, fakeAsync, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { TranslateModule } from '@ngx-translate/core';
import { of, throwError } from 'rxjs';
@@ -128,7 +128,7 @@ describe('PermissionListComponent', () => {
.toBe('PERMISSION_MANAGER.LABELS.INHERITED-SUBTITLE');
});
it('should toggle the inherited button', fakeAsync(() => {
it('should toggle the inherited button', async () => {
getNodeSpy.and.returnValue(of(fakeNodeInheritedOnly));
component.ngOnInit();
@@ -152,7 +152,7 @@ describe('PermissionListComponent', () => {
.toBe('PERMISSION_MANAGER.LABELS.INHERITED-PERMISSIONS PERMISSION_MANAGER.LABELS.OFF');
expect(element.querySelector('span[title="total"]').textContent.trim())
.toBe('PERMISSION_MANAGER.LABELS.INHERITED-SUBTITLE');
}));
});
it('should not toggle inherited button for read only users', async () => {
getNodeSpy.and.returnValue(of(fakeReadOnlyNodeInherited));
@@ -186,7 +186,7 @@ describe('PermissionListComponent', () => {
});
describe('locally set permission', () => {
describe('locally set permission', () => {
beforeEach(() => {
getNodeSpy.and.returnValue(of(fakeLocalPermission));
});

View File

@@ -19,33 +19,35 @@ import { Component, EventEmitter, Input, Output } from '@angular/core';
import { RoleModel } from '../../models/role.model';
@Component({
selector: 'adf-user-role-column',
template: `
<mat-form-field floatLabel="never" class="adf-role-selector-field" *ngIf="!readonly">
<mat-select
(click)="$event.stopPropagation()"
[placeholder]="placeholder | translate"
[value]="value"
(selectionChange)="onRoleChanged($event.value)">
<mat-option *ngFor="let role of roles" [value]="role.role">
{{ role.label | adfLocalizedRole }}
</mat-option>
</mat-select>
</mat-form-field>
selector: 'adf-user-role-column',
template: `
<mat-form-field floatLabel="never" class="adf-role-selector-field" *ngIf="!readonly">
<mat-select
(click)="$event.stopPropagation()"
[placeholder]="placeholder | translate"
[value]="value"
(selectionChange)="onRoleChanged($event.value)">
<mat-option *ngFor="let role of roles" [value]="role.role">
{{ role.label | adfLocalizedRole }}
</mat-option>
</mat-select>
</mat-form-field>
<span class="adf-datatable-cell-value adf-readonly-role" [title]="value | adfLocalizedRole" *ngIf="readonly">
<span class="adf-datatable-cell-value adf-readonly-role" [title]="value | adfLocalizedRole" *ngIf="readonly">
{{value | adfLocalizedRole}}
</span>
`,
`,
host: { class: 'adf-user-role-column adf-datatable-content-cell adf-expand-cell-4' },
styles: [
`.adf-role-selector-field {
width: 100%;
.mat-form-field {
width: 100%;
max-width: 200px;
}
}
.adf-role-selector-field .mat-form-field {
width: 100%;
max-width: 200px;
}
.adf-readonly-role {
padding-left: 0 !important;
}

View File

@@ -1,11 +1,11 @@
@import '~@angular/material/theming';
@use '@angular/material' as mat;
$mat-menu-overlay-min-width: 112px !default; // 56 * 2
$mat-menu-overlay-max-width: 280px !default; // 56 * 5
.adf {
&-search-result-autocomplete {
@include mat-overridable-elevation(2);
@include mat.overridable-elevation(2);
min-width: $mat-menu-overlay-min-width;
max-width: $mat-menu-overlay-max-width;

View File

@@ -1,4 +1,4 @@
@import '~@angular/material/theming';
@use '@angular/material' as mat;
.adf-search-filter-chip {
&.mat-chip {
@@ -53,6 +53,6 @@
min-width: 320px;
border-radius: 12px;
@include mat-elevation(2);
@include mat.elevation(2);
}
}

View File

@@ -1,4 +1,4 @@
@import '~@angular/material/theming';
@use '@angular/material' as mat;
.adf-search-form {
&.mat-button {
@@ -37,7 +37,7 @@
}
&-menu + * .mat-menu-panel {
@include mat-elevation(2);
@include mat.elevation(2);
border-radius: 6px;

View File

@@ -20,7 +20,7 @@
font-size: var(--theme-title-font-size);
background-repeat: no-repeat;
display: inline-block;
fill: currentColor;
fill: currentcolor;
height: 20px;
width: 20px;
color: var(--theme-primary-color-default-contrast) !important;

View File

@@ -22,7 +22,7 @@ import { VersionListComponent } from './version-list.component';
import { setupTestBed } from '@alfresco/adf-core';
import { MatDialog } from '@angular/material/dialog';
import { of } from 'rxjs';
import { Node, VersionPaging, VersionEntry } from '@alfresco/js-api';
import { Node, VersionPaging, VersionEntry, NodeEntry } from '@alfresco/js-api';
import { ContentTestingModule } from '../testing/content.testing.module';
import { TranslateModule } from '@ngx-translate/core';
import { ContentVersionService } from './content-version.service';
@@ -63,7 +63,7 @@ describe('VersionListComponent', () => {
component.node = { id: nodeId, allowableOperations: ['update'] } as Node;
spyOn(component, 'downloadContent').and.stub();
spyOn(component['nodesApi'], 'getNode').and.returnValue(Promise.resolve({ entry: { id: 'nodeInfoId' } }));
spyOn(component['nodesApi'], 'getNode').and.returnValue(Promise.resolve(new NodeEntry({ entry: { id: 'nodeInfoId' } })));
});
it('should raise confirmation dialog on delete', () => {
@@ -299,7 +299,7 @@ describe('VersionListComponent', () => {
fixture.detectChanges();
tick();
expect(component.restored.emit).toHaveBeenCalledWith({ id: 'nodeInfoId' });
expect(component.restored.emit).toHaveBeenCalledWith(new Node({ id: 'nodeInfoId' }));
}));
it('should reload the version list after a version restore', fakeAsync(() => {

View File

@@ -15,8 +15,8 @@
* limitations under the License.
*/
import 'zone.js/dist/zone';
import 'zone.js/dist/zone-testing';
import 'zone.js';
import 'zone.js/testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
@@ -28,7 +28,9 @@ declare const require: any;
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
platformBrowserDynamicTesting(), {
teardown: { destroyAfterEach: false }
}
);
declare const pdfjsLib: any;

Some files were not shown because too many files have changed in this diff Show More