mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
[AAE-7100] migrate ADF projects to eslint (#7483)
* migrate content services to eslint * migrate insights to eslint * migrate extensions to eslint * migrate testing lib to eslint * migrate CLI to eslint * migrate process-services to eslint * migrate process-services-cloud to eslint * remove cli analytics [ci:force]
This commit is contained in:
+1
-1
@@ -11,7 +11,7 @@
|
|||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
"project": [
|
"project": [
|
||||||
"tsconfig.json",
|
"tsconfig.json",
|
||||||
"e2e/tsconfig.json"
|
"e2e/tsconfig.e2e.json"
|
||||||
],
|
],
|
||||||
"createDefaultProgram": true
|
"createDefaultProgram": true
|
||||||
},
|
},
|
||||||
|
|||||||
+34
-76
@@ -507,19 +507,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lint": {
|
"lint": {
|
||||||
"builder": "@angular-devkit/build-angular:tslint",
|
"builder": "@angular-eslint/builder:lint",
|
||||||
"options": {
|
"options": {
|
||||||
"tsConfig": [
|
"lintFilePatterns": [
|
||||||
"lib/content-services/tsconfig.lib.json",
|
"lib/content-services/**/*.ts",
|
||||||
"lib/content-services/tsconfig.spec.json"
|
"lib/content-services/**/*.html"
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"**/lib/extensions/**/*",
|
|
||||||
"**/lib/core/**/*",
|
|
||||||
"**/lib/insights/**/*",
|
|
||||||
"**/lib/process-services-cloud/**/*",
|
|
||||||
"**/lib/process-services/**/*",
|
|
||||||
"**/node_modules/**"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -588,19 +580,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lint": {
|
"lint": {
|
||||||
"builder": "@angular-devkit/build-angular:tslint",
|
"builder": "@angular-eslint/builder:lint",
|
||||||
"options": {
|
"options": {
|
||||||
"tsConfig": [
|
"lintFilePatterns": [
|
||||||
"lib/process-services/tsconfig.lib.json",
|
"lib/process-services/**/*.ts",
|
||||||
"lib/process-services/tsconfig.spec.json"
|
"lib/process-services/**/*.html"
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"**/lib/extensions/**/*",
|
|
||||||
"**/lib/core/**/*",
|
|
||||||
"**/lib/insights/**/*",
|
|
||||||
"**/lib/process-services-cloud/**/*",
|
|
||||||
"**/lib/content-services/**/*",
|
|
||||||
"**/node_modules/**"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -636,19 +620,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lint": {
|
"lint": {
|
||||||
"builder": "@angular-devkit/build-angular:tslint",
|
"builder": "@angular-eslint/builder:lint",
|
||||||
"options": {
|
"options": {
|
||||||
"tsConfig": [
|
"lintFilePatterns": [
|
||||||
"lib/process-services-cloud/tsconfig.lib.json",
|
"lib/process-services-cloud/**/*.ts",
|
||||||
"lib/process-services-cloud/tsconfig.spec.json"
|
"lib/process-services-cloud/**/*.html"
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"**/lib/extensions/**/*",
|
|
||||||
"**/lib/core/**/*",
|
|
||||||
"**/lib/insights/**/*",
|
|
||||||
"**/lib/process-services/**/*",
|
|
||||||
"**/lib/content-services/**/*",
|
|
||||||
"**/node_modules/**"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -717,19 +693,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lint": {
|
"lint": {
|
||||||
"builder": "@angular-devkit/build-angular:tslint",
|
"builder": "@angular-eslint/builder:lint",
|
||||||
"options": {
|
"options": {
|
||||||
"tsConfig": [
|
"lintFilePatterns": [
|
||||||
"lib/insights/tsconfig.lib.json",
|
"lib/insights/**/*.ts",
|
||||||
"lib/insights/tsconfig.spec.json"
|
"lib/insights/**/*.html"
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"**/lib/extensions/**/*",
|
|
||||||
"**/lib/core/**/*",
|
|
||||||
"**/lib/process-services-cloud/**/*",
|
|
||||||
"**/lib/process-services/**/*",
|
|
||||||
"**/lib/content-services/**/*",
|
|
||||||
"**/node_modules/**"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -764,19 +732,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lint": {
|
"lint": {
|
||||||
"builder": "@angular-devkit/build-angular:tslint",
|
"builder": "@angular-eslint/builder:lint",
|
||||||
"options": {
|
"options": {
|
||||||
"tsConfig": [
|
"lintFilePatterns": [
|
||||||
"lib/extensions/tsconfig.lib.json",
|
"lib/extensions/**/*.ts",
|
||||||
"lib/extensions/tsconfig.spec.json"
|
"lib/extensions/**/*.html"
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"**/lib/core/**/*",
|
|
||||||
"**/lib/content-services/**/*",
|
|
||||||
"**/lib/process-services/**/*",
|
|
||||||
"**/lib/process-services-cloud/**/*",
|
|
||||||
"**/lib/insights/**/*",
|
|
||||||
"**/node_modules/**"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -801,19 +761,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lint": {
|
"lint": {
|
||||||
"builder": "@angular-devkit/build-angular:tslint",
|
"builder": "@angular-eslint/builder:lint",
|
||||||
"options": {
|
"options": {
|
||||||
"tsConfig": [
|
"lintFilePatterns": [
|
||||||
"lib/testing/tsconfig.lib.json",
|
"lib/testing/**/*.ts",
|
||||||
"lib/testing/tsconfig.spec.json"
|
"lib/testing/**/*.html"
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"**/lib/core/**/*",
|
|
||||||
"**/lib/content-services/**/*",
|
|
||||||
"**/lib/process-services/**/*",
|
|
||||||
"**/lib/process-services-cloud/**/*",
|
|
||||||
"**/lib/insight/**/*",
|
|
||||||
"**/node_modules/**"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -835,6 +787,15 @@
|
|||||||
"tsConfig": "lib/cli/tsconfig.lib.prod.json"
|
"tsConfig": "lib/cli/tsconfig.lib.prod.json"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"lint": {
|
||||||
|
"builder": "@angular-eslint/builder:lint",
|
||||||
|
"options": {
|
||||||
|
"lintFilePatterns": [
|
||||||
|
"lib/cli/**/*.ts",
|
||||||
|
"lib/cli/**/*.html"
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -879,8 +840,5 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"defaultProject": "demoshell",
|
"defaultProject": "demoshell"
|
||||||
"cli": {
|
|
||||||
"analytics": "0ce5075f-0835-439a-bebe-7c41750179a6"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,104 @@
|
|||||||
|
{
|
||||||
|
"extends": "../../.eslintrc.json",
|
||||||
|
"ignorePatterns": [
|
||||||
|
"!**/*"
|
||||||
|
],
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": [
|
||||||
|
"*.ts"
|
||||||
|
],
|
||||||
|
"parserOptions": {
|
||||||
|
"project": [
|
||||||
|
"lib/cli/tsconfig.json"
|
||||||
|
],
|
||||||
|
"createDefaultProgram": true
|
||||||
|
},
|
||||||
|
"plugins": [
|
||||||
|
"eslint-plugin-unicorn",
|
||||||
|
"eslint-plugin-rxjs"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"prefer-arrow/prefer-arrow-functions": "warn",
|
||||||
|
"@typescript-eslint/no-var-requires": "warn",
|
||||||
|
"@typescript-eslint/naming-convention": "warn",
|
||||||
|
"quote-props": "warn",
|
||||||
|
"no-shadow": "warn",
|
||||||
|
"@typescript-eslint/consistent-type-assertions": "warn",
|
||||||
|
"@typescript-eslint/prefer-for-of": "warn",
|
||||||
|
"no-underscore-dangle": "warn",
|
||||||
|
|
||||||
|
"@angular-eslint/component-selector": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"type": "element",
|
||||||
|
"prefix": [
|
||||||
|
"adf",
|
||||||
|
"app"
|
||||||
|
],
|
||||||
|
"style": "kebab-case"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@angular-eslint/directive-selector": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"type": [
|
||||||
|
"element",
|
||||||
|
"attribute"
|
||||||
|
],
|
||||||
|
"prefix": [
|
||||||
|
"adf",
|
||||||
|
"app"
|
||||||
|
],
|
||||||
|
"style": "kebab-case"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@angular-eslint/no-host-metadata-property": "off",
|
||||||
|
"@angular-eslint/no-input-prefix": "error",
|
||||||
|
"@typescript-eslint/consistent-type-definitions": "error",
|
||||||
|
"@typescript-eslint/dot-notation": "off",
|
||||||
|
"@typescript-eslint/explicit-member-accessibility": [
|
||||||
|
"off",
|
||||||
|
{
|
||||||
|
"accessibility": "explicit"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@typescript-eslint/no-floating-promises": "off",
|
||||||
|
"@typescript-eslint/no-inferrable-types": "off",
|
||||||
|
"@typescript-eslint/no-require-imports": "off",
|
||||||
|
"brace-style": [
|
||||||
|
"error",
|
||||||
|
"1tbs"
|
||||||
|
],
|
||||||
|
"comma-dangle": "error",
|
||||||
|
"default-case": "error",
|
||||||
|
"import/order": "off",
|
||||||
|
"max-len": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"code": 240
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"no-bitwise": "off",
|
||||||
|
"no-duplicate-imports": "error",
|
||||||
|
"no-multiple-empty-lines": "error",
|
||||||
|
"no-redeclare": "error",
|
||||||
|
"no-return-await": "error",
|
||||||
|
"rxjs/no-create": "error",
|
||||||
|
"rxjs/no-subject-unsubscribe": "error",
|
||||||
|
"rxjs/no-subject-value": "error",
|
||||||
|
"rxjs/no-unsafe-takeuntil": "error",
|
||||||
|
"unicorn/filename-case": "error"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"files": [
|
||||||
|
"*.html"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"@angular-eslint/template/no-autofocus": "error",
|
||||||
|
"@angular-eslint/template/no-positive-tabindex": "error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -38,7 +38,7 @@ function zipArtifact(output: string) {
|
|||||||
logger.info(response);
|
logger.info(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function () {
|
export default function() {
|
||||||
main();
|
main();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ function awsCp(output: string) {
|
|||||||
logger.info(response);
|
logger.info(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function () {
|
export default function() {
|
||||||
main();
|
main();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ export default function main(_args: string[], workingDir: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
// tslint:disable-next-line: no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log(`Running audit on ${packagePath}`);
|
console.log(`Running audit on ${packagePath}`);
|
||||||
|
|
||||||
const packageJson = JSON.parse(fs.readFileSync(packagePath).toString());
|
const packageJson = JSON.parse(fs.readFileSync(packagePath).toString());
|
||||||
@@ -75,7 +75,7 @@ export default function main(_args: string[], workingDir: string) {
|
|||||||
|
|
||||||
fs.writeFileSync(outputFile, mdText);
|
fs.writeFileSync(outputFile, mdText);
|
||||||
|
|
||||||
// tslint:disable-next-line: no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log(`Report saved as ${outputFile}`);
|
console.log(`Report saved as ${outputFile}`);
|
||||||
resolve(0);
|
resolve(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ interface DiffOptions {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the remote URL for the cloned git repository
|
* Get the remote URL for the cloned git repository
|
||||||
|
*
|
||||||
* @param workingDir Repository directory
|
* @param workingDir Repository directory
|
||||||
* @returns URL pointing to the git remote
|
* @returns URL pointing to the git remote
|
||||||
*/
|
*/
|
||||||
@@ -68,6 +69,7 @@ function getRemote(workingDir: string): string {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the list of commits based on the configuration options
|
* Get the list of commits based on the configuration options
|
||||||
|
*
|
||||||
* @param options Logging options
|
* @param options Logging options
|
||||||
* @returns Collection of Commit objects
|
* @returns Collection of Commit objects
|
||||||
*/
|
*/
|
||||||
@@ -78,7 +80,7 @@ function getCommits(options: DiffOptions): Array<Commit> {
|
|||||||
.join('\|');
|
.join('\|');
|
||||||
|
|
||||||
if (!authorFilter) {
|
if (!authorFilter) {
|
||||||
authorFilter = "bot\|Alfresco Build User";
|
authorFilter = `bot\|Alfresco Build User`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
/* tslint:disable */
|
/* eslint-disable */
|
||||||
const alfrescoApi = require('@alfresco/js-api');
|
const alfrescoApi = require('@alfresco/js-api');
|
||||||
const program = require('commander');
|
const program = require('commander');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
/* tslint:enable */
|
/* eslint-enable */
|
||||||
import { logger } from './logger';
|
import { logger } from './logger';
|
||||||
const MAX_RETRY = 3;
|
const MAX_RETRY = 3;
|
||||||
const TIMEOUT = 20000;
|
const TIMEOUT = 20000;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/* tslint:disable */
|
/* eslint-disable */
|
||||||
const alfrescoApi = require('@alfresco/js-api');
|
const alfrescoApi = require('@alfresco/js-api');
|
||||||
const program = require('commander');
|
const program = require('commander');
|
||||||
/* tslint:enable */
|
/* eslint-enable */
|
||||||
import { logger } from './logger';
|
import { logger } from './logger';
|
||||||
const MAX_RETRY = 10;
|
const MAX_RETRY = 10;
|
||||||
const TIMEOUT = 60000;
|
const TIMEOUT = 60000;
|
||||||
|
|||||||
@@ -19,6 +19,6 @@
|
|||||||
|
|
||||||
import * as docker from './docker';
|
import * as docker from './docker';
|
||||||
|
|
||||||
export default function (args: any) {
|
export default function(args: any) {
|
||||||
docker.default(args);
|
docker.default(args);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,9 +50,9 @@ function loginPerform(args: PublishArgs) {
|
|||||||
function buildImagePerform(args: PublishArgs, tag: string) {
|
function buildImagePerform(args: PublishArgs, tag: string) {
|
||||||
logger.info(`Perform docker build...${args.dockerRepo}:${tag}`);
|
logger.info(`Perform docker build...${args.dockerRepo}:${tag}`);
|
||||||
|
|
||||||
let buildArgs = [];
|
const buildArgs = [];
|
||||||
|
|
||||||
if (typeof args.buildArgs === "string") {
|
if (typeof args.buildArgs === 'string') {
|
||||||
buildArgs.push(`--build-arg=${args.buildArgs}`);
|
buildArgs.push(`--build-arg=${args.buildArgs}`);
|
||||||
} else {
|
} else {
|
||||||
args.buildArgs.forEach((envVar) => {
|
args.buildArgs.forEach((envVar) => {
|
||||||
@@ -88,7 +88,7 @@ function cleanImagePerform(args: PublishArgs, tag: string) {
|
|||||||
logger.info(response);
|
logger.info(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function (args: PublishArgs) {
|
export default function(args: PublishArgs) {
|
||||||
main(args);
|
main(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,13 +19,13 @@
|
|||||||
|
|
||||||
import * as program from 'commander';
|
import * as program from 'commander';
|
||||||
|
|
||||||
/* tslint:disable */
|
/* eslint-disable */
|
||||||
import request = require('request');
|
import request = require('request');
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import { logger } from './logger';
|
import { logger } from './logger';
|
||||||
import { AlfrescoApi } from '@alfresco/js-api';
|
import { AlfrescoApi } from '@alfresco/js-api';
|
||||||
const ACTIVITI_CLOUD_APPS = require('./resources').ACTIVITI_CLOUD_APPS;
|
const ACTIVITI_CLOUD_APPS = require('./resources').ACTIVITI_CLOUD_APPS;
|
||||||
/* tslint:enable */
|
/* eslint-enable */
|
||||||
|
|
||||||
let alfrescoJsApiModeler: any;
|
let alfrescoJsApiModeler: any;
|
||||||
let alfrescoJsApiDevops: any;
|
let alfrescoJsApiDevops: any;
|
||||||
@@ -53,9 +53,14 @@ export const AAE_MICROSERVICES = [
|
|||||||
async function healthCheck(nameService: string) {
|
async function healthCheck(nameService: string) {
|
||||||
const url = `${args.host}/${nameService}/actuator/health`;
|
const url = `${args.host}/${nameService}/actuator/health`;
|
||||||
|
|
||||||
const pathParams = {}, queryParams = {},
|
const pathParams = {};
|
||||||
headerParams = {}, formParams = {}, bodyParam = {},
|
const queryParams = {};
|
||||||
contentTypes = ['application/json'], accepts = ['application/json'];
|
const headerParams = {};
|
||||||
|
const formParams = {};
|
||||||
|
const bodyParam = {};
|
||||||
|
const contentTypes = ['application/json'];
|
||||||
|
const accepts = ['application/json'];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const health = await alfrescoJsApiModeler.oauth2Auth.callCustomApi(url, 'GET', pathParams, queryParams, headerParams, formParams, bodyParam,
|
const health = await alfrescoJsApiModeler.oauth2Auth.callCustomApi(url, 'GET', pathParams, queryParams, headerParams, formParams, bodyParam,
|
||||||
contentTypes, accepts);
|
contentTypes, accepts);
|
||||||
@@ -63,7 +68,8 @@ async function healthCheck(nameService: string) {
|
|||||||
logger.error(`${nameService} is DOWN `);
|
logger.error(`${nameService} is DOWN `);
|
||||||
isValid = false;
|
isValid = false;
|
||||||
} else {
|
} else {
|
||||||
const reset = '\x1b[0m', green = '\x1b[32m';
|
const reset = '\x1b[0m';
|
||||||
|
const green = '\x1b[32m';
|
||||||
logger.info(`${green}${nameService} is UP!${reset}`);
|
logger.info(`${green}${nameService} is UP!${reset}`);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -75,9 +81,14 @@ async function healthCheck(nameService: string) {
|
|||||||
async function getApplicationByStatus(status: string) {
|
async function getApplicationByStatus(status: string) {
|
||||||
const url = `${args.host}/deployment-service/v1/applications/`;
|
const url = `${args.host}/deployment-service/v1/applications/`;
|
||||||
|
|
||||||
const pathParams = {}, queryParams = { status: status },
|
const pathParams = {};
|
||||||
headerParams = {}, formParams = {}, bodyParam = {},
|
const queryParams = { status };
|
||||||
contentTypes = ['application/json'], accepts = ['application/json'];
|
const headerParams = {};
|
||||||
|
const formParams = {};
|
||||||
|
const bodyParam = {};
|
||||||
|
const contentTypes = ['application/json'];
|
||||||
|
const accepts = ['application/json'];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await alfrescoJsApiDevops.login(args.devopsUsername, args.devopsPassword);
|
await alfrescoJsApiDevops.login(args.devopsUsername, args.devopsPassword);
|
||||||
|
|
||||||
@@ -95,9 +106,14 @@ async function getApplicationByStatus(status: string) {
|
|||||||
function getDescriptors() {
|
function getDescriptors() {
|
||||||
const url = `${args.host}/deployment-service/v1/descriptors`;
|
const url = `${args.host}/deployment-service/v1/descriptors`;
|
||||||
|
|
||||||
const pathParams = {}, queryParams = {},
|
const pathParams = {};
|
||||||
headerParams = {}, formParams = {}, bodyParam = {},
|
const queryParams = {};
|
||||||
contentTypes = ['application/json'], accepts = ['application/json'];
|
const headerParams = {};
|
||||||
|
const formParams = {};
|
||||||
|
const bodyParam = {};
|
||||||
|
const contentTypes = ['application/json'];
|
||||||
|
const accepts = ['application/json'];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return alfrescoJsApiDevops.oauth2Auth.callCustomApi(url, 'GET', pathParams, queryParams, headerParams, formParams, bodyParam,
|
return alfrescoJsApiDevops.oauth2Auth.callCustomApi(url, 'GET', pathParams, queryParams, headerParams, formParams, bodyParam,
|
||||||
contentTypes, accepts);
|
contentTypes, accepts);
|
||||||
@@ -111,9 +127,14 @@ function getDescriptors() {
|
|||||||
function getProjects() {
|
function getProjects() {
|
||||||
const url = `${args.host}/modeling-service/v1/projects`;
|
const url = `${args.host}/modeling-service/v1/projects`;
|
||||||
|
|
||||||
const pathParams = {}, queryParams = { maxItems: 1000 },
|
const pathParams = {};
|
||||||
headerParams = {}, formParams = {}, bodyParam = {},
|
const queryParams = { maxItems: 1000 };
|
||||||
contentTypes = ['application/json'], accepts = ['application/json'];
|
const headerParams = {};
|
||||||
|
const formParams = {};
|
||||||
|
const bodyParam = {};
|
||||||
|
const contentTypes = ['application/json'];
|
||||||
|
const accepts = ['application/json'];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return alfrescoJsApiModeler.oauth2Auth.callCustomApi(url, 'GET', pathParams, queryParams, headerParams, formParams, bodyParam,
|
return alfrescoJsApiModeler.oauth2Auth.callCustomApi(url, 'GET', pathParams, queryParams, headerParams, formParams, bodyParam,
|
||||||
contentTypes, accepts);
|
contentTypes, accepts);
|
||||||
@@ -127,9 +148,14 @@ function getProjects() {
|
|||||||
function getProjectRelease(projectId: string) {
|
function getProjectRelease(projectId: string) {
|
||||||
const url = `${args.host}/modeling-service/v1/projects/${projectId}/releases`;
|
const url = `${args.host}/modeling-service/v1/projects/${projectId}/releases`;
|
||||||
|
|
||||||
const pathParams = {}, queryParams = {},
|
const pathParams = {};
|
||||||
headerParams = {}, formParams = {}, bodyParam = {},
|
const queryParams = {};
|
||||||
contentTypes = ['application/json'], accepts = ['application/json'];
|
const headerParams = {};
|
||||||
|
const formParams = {};
|
||||||
|
const bodyParam = {};
|
||||||
|
const contentTypes = ['application/json'];
|
||||||
|
const accepts = ['application/json'];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return alfrescoJsApiModeler.oauth2Auth.callCustomApi(url, 'GET', pathParams, queryParams, headerParams, formParams, bodyParam,
|
return alfrescoJsApiModeler.oauth2Auth.callCustomApi(url, 'GET', pathParams, queryParams, headerParams, formParams, bodyParam,
|
||||||
contentTypes, accepts);
|
contentTypes, accepts);
|
||||||
@@ -143,9 +169,14 @@ function getProjectRelease(projectId: string) {
|
|||||||
async function releaseProject(projectId: string) {
|
async function releaseProject(projectId: string) {
|
||||||
const url = `${args.host}/modeling-service/v1/projects/${projectId}/releases`;
|
const url = `${args.host}/modeling-service/v1/projects/${projectId}/releases`;
|
||||||
|
|
||||||
const pathParams = {}, queryParams = {},
|
const pathParams = {};
|
||||||
headerParams = {}, formParams = {}, bodyParam = {},
|
const queryParams = {};
|
||||||
contentTypes = ['application/json'], accepts = ['application/json'];
|
const headerParams = {};
|
||||||
|
const formParams = {};
|
||||||
|
const bodyParam = {};
|
||||||
|
const contentTypes = ['application/json'];
|
||||||
|
const accepts = ['application/json'];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return alfrescoJsApiModeler.oauth2Auth.callCustomApi(url, 'POST', pathParams, queryParams, headerParams, formParams, bodyParam,
|
return alfrescoJsApiModeler.oauth2Auth.callCustomApi(url, 'POST', pathParams, queryParams, headerParams, formParams, bodyParam,
|
||||||
contentTypes, accepts);
|
contentTypes, accepts);
|
||||||
@@ -160,9 +191,14 @@ async function releaseProject(projectId: string) {
|
|||||||
function deleteProject(projectId: string) {
|
function deleteProject(projectId: string) {
|
||||||
const url = `${args.host}/modeling-service/v1/projects/${projectId}`;
|
const url = `${args.host}/modeling-service/v1/projects/${projectId}`;
|
||||||
|
|
||||||
const pathParams = {}, queryParams = {},
|
const pathParams = {};
|
||||||
headerParams = {}, formParams = {}, bodyParam = {},
|
const queryParams = {};
|
||||||
contentTypes = ['application/json'], accepts = ['application/json'];
|
const headerParams = {};
|
||||||
|
const formParams = {};
|
||||||
|
const bodyParam = {};
|
||||||
|
const contentTypes = ['application/json'];
|
||||||
|
const accepts = ['application/json'];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return alfrescoJsApiModeler.oauth2Auth.callCustomApi(url, 'DELETE', pathParams, queryParams, headerParams, formParams, bodyParam,
|
return alfrescoJsApiModeler.oauth2Auth.callCustomApi(url, 'DELETE', pathParams, queryParams, headerParams, formParams, bodyParam,
|
||||||
contentTypes, accepts);
|
contentTypes, accepts);
|
||||||
@@ -194,9 +230,14 @@ async function importAndReleaseProject(absoluteFilePath: string) {
|
|||||||
function deleteDescriptor(name: string) {
|
function deleteDescriptor(name: string) {
|
||||||
const url = `${args.host}/deployment-service/v1/descriptors/${name}`;
|
const url = `${args.host}/deployment-service/v1/descriptors/${name}`;
|
||||||
|
|
||||||
const pathParams = {}, queryParams = {},
|
const pathParams = {};
|
||||||
headerParams = {}, formParams = {}, bodyParam = {},
|
const queryParams = {};
|
||||||
contentTypes = ['application/json'], accepts = ['application/json'];
|
const headerParams = {};
|
||||||
|
const formParams = {};
|
||||||
|
const bodyParam = {};
|
||||||
|
const contentTypes = ['application/json'];
|
||||||
|
const accepts = ['application/json'];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return alfrescoJsApiDevops.oauth2Auth.callCustomApi(url, 'DELETE', pathParams, queryParams, headerParams, formParams, bodyParam,
|
return alfrescoJsApiDevops.oauth2Auth.callCustomApi(url, 'DELETE', pathParams, queryParams, headerParams, formParams, bodyParam,
|
||||||
contentTypes, accepts);
|
contentTypes, accepts);
|
||||||
@@ -210,9 +251,14 @@ function deleteDescriptor(name: string) {
|
|||||||
function deploy(model: any) {
|
function deploy(model: any) {
|
||||||
const url = `${args.host}/deployment-service/v1/applications/`;
|
const url = `${args.host}/deployment-service/v1/applications/`;
|
||||||
|
|
||||||
const pathParams = {}, queryParams = {},
|
const pathParams = {};
|
||||||
headerParams = {}, formParams = {}, bodyParam = model,
|
const queryParams = {};
|
||||||
contentTypes = ['application/json'], accepts = ['application/json'];
|
const headerParams = {};
|
||||||
|
const formParams = {};
|
||||||
|
const bodyParam = model;
|
||||||
|
const contentTypes = ['application/json'];
|
||||||
|
const accepts = ['application/json'];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return alfrescoJsApiDevops.oauth2Auth.callCustomApi(url, 'POST', pathParams, queryParams, headerParams, formParams, bodyParam,
|
return alfrescoJsApiDevops.oauth2Auth.callCustomApi(url, 'POST', pathParams, queryParams, headerParams, formParams, bodyParam,
|
||||||
contentTypes, accepts);
|
contentTypes, accepts);
|
||||||
@@ -248,7 +294,9 @@ async function deployMissingApps(tag?: string) {
|
|||||||
|
|
||||||
if (failingApps.length > 0) {
|
if (failingApps.length > 0) {
|
||||||
failingApps.forEach( app => {
|
failingApps.forEach( app => {
|
||||||
const reset = '\x1b[0m', bright = '\x1b[1m', red = '\x1b[31m';
|
const reset = '\x1b[0m';
|
||||||
|
const bright = '\x1b[1m';
|
||||||
|
const red = '\x1b[31m';
|
||||||
logger.error(`${red}${bright}ERROR: App ${app.entry.name} down or inaccessible ${reset}${red} with status ${app.entry.status}${reset}`);
|
logger.error(`${red}${bright}ERROR: App ${app.entry.name} down or inaccessible ${reset}${red} with status ${app.entry.status}${reset}`);
|
||||||
});
|
});
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
@@ -256,7 +304,8 @@ async function deployMissingApps(tag?: string) {
|
|||||||
logger.warn(`Missing apps: ${JSON.stringify(absentApps)}`);
|
logger.warn(`Missing apps: ${JSON.stringify(absentApps)}`);
|
||||||
await checkIfAppIsReleased(absentApps, tag);
|
await checkIfAppIsReleased(absentApps, tag);
|
||||||
} else {
|
} else {
|
||||||
const reset = '\x1b[0m', green = '\x1b[32m';
|
const reset = '\x1b[0m';
|
||||||
|
const green = '\x1b[32m';
|
||||||
logger.info(`${green}All the apps are correctly deployed${reset}`);
|
logger.info(`${green}All the apps are correctly deployed${reset}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -269,9 +318,7 @@ async function checkIfAppIsReleased(missingApps: any [], tag?: string) {
|
|||||||
for (let i = 0; i < missingApps.length; i++) {
|
for (let i = 0; i < missingApps.length; i++) {
|
||||||
noError = true;
|
noError = true;
|
||||||
const currentAbsentApp = missingApps[i];
|
const currentAbsentApp = missingApps[i];
|
||||||
const project = projectList.list.entries.find((currentApp: any) => {
|
const project = projectList.list.entries.find((currentApp: any) => currentAbsentApp.name === currentApp.entry.name);
|
||||||
return currentAbsentApp.name === currentApp.entry.name;
|
|
||||||
});
|
|
||||||
let projectRelease: any;
|
let projectRelease: any;
|
||||||
|
|
||||||
if (project === undefined) {
|
if (project === undefined) {
|
||||||
@@ -360,11 +407,8 @@ async function importProjectAndRelease(app: any, tag?: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function findMissingApps(deployedApps: any []) {
|
function findMissingApps(deployedApps: any []) {
|
||||||
|
|
||||||
Object.keys(ACTIVITI_CLOUD_APPS).forEach((key) => {
|
Object.keys(ACTIVITI_CLOUD_APPS).forEach((key) => {
|
||||||
const isPresent = deployedApps.find((currentApp: any) => {
|
const isPresent = deployedApps.find((currentApp: any) => ACTIVITI_CLOUD_APPS[key].name === currentApp.entry.name);
|
||||||
return ACTIVITI_CLOUD_APPS[key].name === currentApp.entry.name;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!isPresent) {
|
if (!isPresent) {
|
||||||
absentApps.push(ACTIVITI_CLOUD_APPS[key]);
|
absentApps.push(ACTIVITI_CLOUD_APPS[key]);
|
||||||
@@ -373,11 +417,8 @@ function findMissingApps(deployedApps: any []) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function findFailingApps(deployedApps: any []) {
|
function findFailingApps(deployedApps: any []) {
|
||||||
|
|
||||||
Object.keys(ACTIVITI_CLOUD_APPS).forEach((key) => {
|
Object.keys(ACTIVITI_CLOUD_APPS).forEach((key) => {
|
||||||
const failingApp = deployedApps.filter((currentApp: any) => {
|
const failingApp = deployedApps.filter((currentApp: any) => ACTIVITI_CLOUD_APPS[key].name === currentApp.entry.name && 'Running' !== currentApp.entry.status);
|
||||||
return ACTIVITI_CLOUD_APPS[key].name === currentApp.entry.name && 'Running' !== currentApp.entry.status;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (failingApp?.length > 0) {
|
if (failingApp?.length > 0) {
|
||||||
failingApps.push(...failingApp);
|
failingApps.push(...failingApp);
|
||||||
@@ -386,7 +427,7 @@ function findFailingApps(deployedApps: any []) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function getFileFromRemote(url: string, name: string) {
|
async function getFileFromRemote(url: string, name: string) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise<void>((resolve, reject) => {
|
||||||
request(url)
|
request(url)
|
||||||
.pipe(fs.createWriteStream(`${name}.zip`))
|
.pipe(fs.createWriteStream(`${name}.zip`))
|
||||||
.on('finish', () => {
|
.on('finish', () => {
|
||||||
@@ -412,12 +453,11 @@ async function sleep(time: number) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async function (configArgs: ConfigArgs) {
|
export default async function(configArgs: ConfigArgs) {
|
||||||
await main(configArgs);
|
await main(configArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function main(configArgs: ConfigArgs) {
|
async function main(configArgs: ConfigArgs) {
|
||||||
|
|
||||||
args = configArgs;
|
args = configArgs;
|
||||||
|
|
||||||
program
|
program
|
||||||
@@ -445,7 +485,8 @@ async function main(configArgs: ConfigArgs) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
await alfrescoJsApiModeler.login(args.modelerUsername, args.modelerPassword).then(() => {
|
await alfrescoJsApiModeler.login(args.modelerUsername, args.modelerPassword).then(() => {
|
||||||
const reset = '\x1b[0m', green = '\x1b[32m';
|
const reset = '\x1b[0m';
|
||||||
|
const green = '\x1b[32m';
|
||||||
logger.info(`${green}login SSO ok${reset}`);
|
logger.info(`${green}login SSO ok${reset}`);
|
||||||
}, (error) => {
|
}, (error) => {
|
||||||
logger.error(`login SSO error ${JSON.stringify(error)} ${args.modelerUsername}`);
|
logger.error(`login SSO error ${JSON.stringify(error)} ${args.modelerUsername}`);
|
||||||
@@ -453,7 +494,8 @@ async function main(configArgs: ConfigArgs) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (isValid) {
|
if (isValid) {
|
||||||
const reset = '\x1b[0m', green = '\x1b[32m';
|
const reset = '\x1b[0m';
|
||||||
|
const green = '\x1b[32m';
|
||||||
logger.info(`${green}The environment is up and running ${reset}`);
|
logger.info(`${green}The environment is up and running ${reset}`);
|
||||||
alfrescoJsApiDevops = getAlfrescoJsApiInstance(args);
|
alfrescoJsApiDevops = getAlfrescoJsApiInstance(args);
|
||||||
await alfrescoJsApiDevops.login(args.devopsUsername, args.devopsPassword).then(() => {
|
await alfrescoJsApiDevops.login(args.devopsUsername, args.devopsPassword).then(() => {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* tslint:disable */
|
/* eslint-disable */
|
||||||
let alfrescoApi = require('@alfresco/js-api');
|
let alfrescoApi = require('@alfresco/js-api');
|
||||||
let program = require('commander');
|
let program = require('commander');
|
||||||
let fs = require ('fs');
|
let fs = require ('fs');
|
||||||
@@ -9,11 +9,11 @@ let MAX_RETRY = 10;
|
|||||||
let counter = 0;
|
let counter = 0;
|
||||||
let TIMEOUT = 6000;
|
let TIMEOUT = 6000;
|
||||||
const ACS_DEFAULT = require('./resources').ACS_DEFAULT;
|
const ACS_DEFAULT = require('./resources').ACS_DEFAULT;
|
||||||
/* tslint:enable */
|
/* eslint-enable */
|
||||||
|
|
||||||
let alfrescoJsApi;
|
let alfrescoJsApi;
|
||||||
|
|
||||||
export default async function () {
|
export default async function() {
|
||||||
await main();
|
await main();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,7 +120,7 @@ async function lockFile(nodeId) {
|
|||||||
|
|
||||||
async function shareFile(nodeId) {
|
async function shareFile(nodeId) {
|
||||||
const data = {
|
const data = {
|
||||||
nodeId: nodeId
|
nodeId
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
await new SharedlinksApi(alfrescoJsApi).createSharedLink(data);
|
await new SharedlinksApi(alfrescoJsApi).createSharedLink(data);
|
||||||
@@ -179,7 +179,7 @@ async function checkEnv() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* tslint:enable */
|
/* eslint-enable */
|
||||||
|
|
||||||
function sleep(delay) {
|
function sleep(delay) {
|
||||||
const start = new Date().getTime();
|
const start = new Date().getTime();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* tslint:disable */
|
/* eslint-disable */
|
||||||
let alfrescoApi = require('@alfresco/js-api');
|
let alfrescoApi = require('@alfresco/js-api');
|
||||||
let program = require('commander');
|
let program = require('commander');
|
||||||
let fs = require ('fs');
|
let fs = require ('fs');
|
||||||
@@ -13,12 +13,12 @@ const TENANT_DEFAULT_ID = 1;
|
|||||||
const TENANT_DEFAULT_NAME = 'default';
|
const TENANT_DEFAULT_NAME = 'default';
|
||||||
const CONTENT_DEFAULT_NAME = 'adw-content';
|
const CONTENT_DEFAULT_NAME = 'adw-content';
|
||||||
const ACTIVITI_APPS = require('./resources').ACTIVITI_APPS;
|
const ACTIVITI_APPS = require('./resources').ACTIVITI_APPS;
|
||||||
/* tslint:enable */
|
/* eslint-enable */
|
||||||
|
|
||||||
let alfrescoJsApi;
|
let alfrescoJsApi;
|
||||||
let alfrescoJsApiRepo;
|
let alfrescoJsApiRepo;
|
||||||
|
|
||||||
export default async function () {
|
export default async function() {
|
||||||
await main();
|
await main();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -336,11 +336,11 @@ async function addContentRepoWithBasic(tenantId, name) {
|
|||||||
const body = {
|
const body = {
|
||||||
alfrescoTenantId: '',
|
alfrescoTenantId: '',
|
||||||
authenticationType: 'basic',
|
authenticationType: 'basic',
|
||||||
name: name,
|
name,
|
||||||
repositoryUrl: `${program.host}/alfresco`,
|
repositoryUrl: `${program.host}/alfresco`,
|
||||||
shareUrl: `${program.host}/share`,
|
shareUrl: `${program.host}/share`,
|
||||||
// sitesFolder: '', not working on activiti 1.11.1.1
|
// sitesFolder: '', not working on activiti 1.11.1.1
|
||||||
tenantId: tenantId,
|
tenantId,
|
||||||
version: '6.1.1'
|
version: '6.1.1'
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -413,7 +413,7 @@ async function authorizeUserToContentWithBasic(username, contentId) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* tslint:disable */
|
/* eslint-disable */
|
||||||
async function downloadLicenseFile(apsLicensePath) {
|
async function downloadLicenseFile(apsLicensePath) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -428,7 +428,7 @@ async function downloadLicenseFile(apsLicensePath) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* tslint:enable */
|
/* eslint-enable */
|
||||||
|
|
||||||
function sleep(delay) {
|
function sleep(delay) {
|
||||||
const start = new Date().getTime();
|
const start = new Date().getTime();
|
||||||
|
|||||||
@@ -20,9 +20,9 @@
|
|||||||
import * as program from 'commander';
|
import * as program from 'commander';
|
||||||
import moment from 'moment-es6';
|
import moment from 'moment-es6';
|
||||||
import { exec } from './exec';
|
import { exec } from './exec';
|
||||||
/* tslint:disable */
|
/* eslint-disable */
|
||||||
import { AlfrescoApi } from '@alfresco/js-api';
|
import { AlfrescoApi } from '@alfresco/js-api';
|
||||||
/* tslint:enable */
|
/* eslint-enable */
|
||||||
|
|
||||||
import { logger } from './logger';
|
import { logger } from './logger';
|
||||||
|
|
||||||
@@ -82,8 +82,11 @@ async function deleteDescriptor(args: ConfigArgs, apiService: any, name: string)
|
|||||||
const pathParams = {};
|
const pathParams = {};
|
||||||
const bodyParam = {};
|
const bodyParam = {};
|
||||||
|
|
||||||
const headerParams = {}, formParams = {}, queryParams = {},
|
const headerParams = {};
|
||||||
contentTypes = ['application/json'], accepts = ['application/json'];
|
const formParams = {};
|
||||||
|
const queryParams = {};
|
||||||
|
const contentTypes = ['application/json'];
|
||||||
|
const accepts = ['application/json'];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return await apiService.oauth2Auth.callCustomApi(url, 'DELETE', pathParams, queryParams, headerParams, formParams, bodyParam, contentTypes, accepts);
|
return await apiService.oauth2Auth.callCustomApi(url, 'DELETE', pathParams, queryParams, headerParams, formParams, bodyParam, contentTypes, accepts);
|
||||||
@@ -100,8 +103,11 @@ async function deleteProject(args: ConfigArgs, apiService: any, projectId: strin
|
|||||||
const pathParams = {};
|
const pathParams = {};
|
||||||
const bodyParam = {};
|
const bodyParam = {};
|
||||||
|
|
||||||
const headerParams = {}, formParams = {}, queryParams = {},
|
const headerParams = {};
|
||||||
contentTypes = ['application/json'], accepts = ['application/json'];
|
const formParams = {};
|
||||||
|
const queryParams = {};
|
||||||
|
const contentTypes = ['application/json'];
|
||||||
|
const accepts = ['application/json'];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return await apiService.oauth2Auth.callCustomApi(url, 'DELETE', pathParams, queryParams, headerParams, formParams, bodyParam, contentTypes, accepts);
|
return await apiService.oauth2Auth.callCustomApi(url, 'DELETE', pathParams, queryParams, headerParams, formParams, bodyParam, contentTypes, accepts);
|
||||||
@@ -114,9 +120,13 @@ async function deleteProjectByName(args: ConfigArgs, apiService: any, name: stri
|
|||||||
logger.warn(`Get the project by name ${name}`);
|
logger.warn(`Get the project by name ${name}`);
|
||||||
const url = `${args.host}/modeling-service/v1/projects?name=${name}`;
|
const url = `${args.host}/modeling-service/v1/projects?name=${name}`;
|
||||||
|
|
||||||
const pathParams = {}, queryParams = {},
|
const pathParams = {};
|
||||||
headerParams = {}, formParams = {}, bodyParam = {},
|
const queryParams = {};
|
||||||
contentTypes = ['application/json'], accepts = ['application/json'];
|
const headerParams = {};
|
||||||
|
const formParams = {};
|
||||||
|
const bodyParam = {};
|
||||||
|
const contentTypes = ['application/json'];
|
||||||
|
const accepts = ['application/json'];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const data = await apiService.oauth2Auth.callCustomApi(url, 'GET', pathParams, queryParams, headerParams, formParams, bodyParam,
|
const data = await apiService.oauth2Auth.callCustomApi(url, 'GET', pathParams, queryParams, headerParams, formParams, bodyParam,
|
||||||
@@ -136,9 +146,13 @@ async function getApplicationsByName(args: ConfigArgs, apiService: any, name: st
|
|||||||
logger.warn(`Get the applications by name ${name}`);
|
logger.warn(`Get the applications by name ${name}`);
|
||||||
const url = `${args.host}/deployment-service/v1/applications?name=${name}`;
|
const url = `${args.host}/deployment-service/v1/applications?name=${name}`;
|
||||||
|
|
||||||
const pathParams = {}, queryParams = {},
|
const pathParams = {};
|
||||||
headerParams = {}, formParams = {}, bodyParam = {},
|
const queryParams = {};
|
||||||
contentTypes = ['application/json'], accepts = ['application/json'];
|
const headerParams = {};
|
||||||
|
const formParams = {};
|
||||||
|
const bodyParam = {};
|
||||||
|
const contentTypes = ['application/json'];
|
||||||
|
const accepts = ['application/json'];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const apps = await apiService.oauth2Auth.callCustomApi(url, 'GET', pathParams, queryParams, headerParams, formParams, bodyParam,
|
const apps = await apiService.oauth2Auth.callCustomApi(url, 'GET', pathParams, queryParams, headerParams, formParams, bodyParam,
|
||||||
@@ -158,8 +172,11 @@ async function undeployApplication(args: ConfigArgs, apiService: any, name: stri
|
|||||||
const pathParams = {};
|
const pathParams = {};
|
||||||
const bodyParam = {};
|
const bodyParam = {};
|
||||||
|
|
||||||
const headerParams = {}, formParams = {}, queryParams = {},
|
const headerParams = {};
|
||||||
contentTypes = ['application/json'], accepts = ['application/json'];
|
const formParams = {};
|
||||||
|
const queryParams = {};
|
||||||
|
const contentTypes = ['application/json'];
|
||||||
|
const accepts = ['application/json'];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return await apiService.oauth2Auth.callCustomApi(url, 'DELETE', pathParams, queryParams, headerParams, formParams, bodyParam, contentTypes, accepts);
|
return await apiService.oauth2Auth.callCustomApi(url, 'DELETE', pathParams, queryParams, headerParams, formParams, bodyParam, contentTypes, accepts);
|
||||||
@@ -192,7 +209,7 @@ function useContext(args: ConfigArgs) {
|
|||||||
logger.info(response);
|
logger.info(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async function (args: ConfigArgs) {
|
export default async function(args: ConfigArgs) {
|
||||||
await main(args);
|
await main(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ function deletePod(args: KubeArgs) {
|
|||||||
logger.info(response);
|
logger.info(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function (args: KubeArgs) {
|
export default function(args: KubeArgs) {
|
||||||
main(args);
|
main(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ function installPerform() {
|
|||||||
exec('curl', [`LO`, `${k8sRelease}`], {});
|
exec('curl', [`LO`, `${k8sRelease}`], {});
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function (args: KubeArgs) {
|
export default function(args: KubeArgs) {
|
||||||
main(args);
|
main(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -108,19 +108,19 @@ export default function main(_args: string[], workingDir: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
// tslint:disable-next-line: no-console
|
// eslint-disable-next-line no-console
|
||||||
console.info(`Checking ${packagePath}`);
|
console.info(`Checking ${packagePath}`);
|
||||||
|
|
||||||
checker.init({
|
checker.init({
|
||||||
start: workingDir,
|
start: workingDir,
|
||||||
production: true,
|
production: true,
|
||||||
failOn: 'GPL'
|
failOn: 'GPL'
|
||||||
}, function (err: any, packages: any[]) {
|
}, function(err: any, packages: any[]) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
reject(err);
|
reject(err);
|
||||||
} else {
|
} else {
|
||||||
// tslint:disable-next-line: forin
|
// eslint-disable-next-line guard-for-in
|
||||||
for (const packageName in packages) {
|
for (const packageName in packages) {
|
||||||
const pack = packages[packageName];
|
const pack = packages[packageName];
|
||||||
pack['licenseExp'] = pack['licenses'].toString()
|
pack['licenseExp'] = pack['licenses'].toString()
|
||||||
@@ -148,7 +148,7 @@ export default function main(_args: string[], workingDir: string) {
|
|||||||
const packageJson: PackageInfo = getPackageFile(packagePath);
|
const packageJson: PackageInfo = getPackageFile(packagePath);
|
||||||
|
|
||||||
ejs.renderFile(templatePath, {
|
ejs.renderFile(templatePath, {
|
||||||
packages: packages,
|
packages,
|
||||||
projVersion: packageJson.version,
|
projVersion: packageJson.version,
|
||||||
projName: packageJson.name
|
projName: packageJson.name
|
||||||
}, {}, (ejsError: any, mdText: string) => {
|
}, {}, (ejsError: any, mdText: string) => {
|
||||||
@@ -160,7 +160,7 @@ export default function main(_args: string[], workingDir: string) {
|
|||||||
const outputFile = path.join(outputPath, `license-info-${packageJson.version}.md`);
|
const outputFile = path.join(outputPath, `license-info-${packageJson.version}.md`);
|
||||||
|
|
||||||
fs.writeFileSync(outputFile, mdText);
|
fs.writeFileSync(outputFile, mdText);
|
||||||
// tslint:disable-next-line: no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log(`Report saved as ${outputFile}`);
|
console.log(`Report saved as ${outputFile}`);
|
||||||
resolve(0);
|
resolve(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* tslint:disable */
|
/* eslint-disable */
|
||||||
let log = null;
|
let log = null;
|
||||||
|
|
||||||
log = {
|
log = {
|
||||||
@@ -31,4 +31,4 @@ log = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export let logger = log;
|
export let logger = log;
|
||||||
/* tslint:enable */
|
/* eslint-enable */
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ function removeNpmConfig(args: PublishArgs, project: string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async function (args: PublishArgs) {
|
export default async function(args: PublishArgs) {
|
||||||
await main(args);
|
await main(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,13 +12,14 @@ export class PluginConfiguration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async callCustomApi(url: string) {
|
async callCustomApi(url: string) {
|
||||||
const pathParams = {},
|
const pathParams = {};
|
||||||
headerParams = {},
|
const headerParams = {};
|
||||||
formParams = {},
|
const formParams = {};
|
||||||
bodyParam = {},
|
const bodyParam = {};
|
||||||
queryParams = {},
|
const queryParams = {};
|
||||||
contentTypes = ['application/json'],
|
const contentTypes = ['application/json'];
|
||||||
accepts = ['application/json'];
|
const accepts = ['application/json'];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await this.alfrescoJsApi.oauth2Auth.callCustomApi(
|
const response = await this.alfrescoJsApi.oauth2Auth.callCustomApi(
|
||||||
url,
|
url,
|
||||||
|
|||||||
+19
-13
@@ -2,23 +2,28 @@ import { AlfrescoApi, PeopleApi, NodesApi, GroupsApi, SitesApi, SearchApi } from
|
|||||||
import * as program from 'commander';
|
import * as program from 'commander';
|
||||||
import { logger } from './logger';
|
import { logger } from './logger';
|
||||||
|
|
||||||
interface PeopleTally { enabled: number; disabled: number; }
|
interface PeopleTally { enabled: number; disabled: number }
|
||||||
interface RowToPrint { label: string; value: number; }
|
interface RowToPrint { label: string; value: number }
|
||||||
|
|
||||||
const MAX_ATTEMPTS = 1;
|
const MAX_ATTEMPTS = 1;
|
||||||
const TIMEOUT = 180000;
|
const TIMEOUT = 180000;
|
||||||
const MAX_PEOPLE_PER_PAGE = 100;
|
const MAX_PEOPLE_PER_PAGE = 100;
|
||||||
const USERS_HOME_RELATIVE_PATH = 'User Homes';
|
const USERS_HOME_RELATIVE_PATH = 'User Homes';
|
||||||
|
|
||||||
const reset = '\x1b[0m', grey = '\x1b[90m', cyan = '\x1b[36m', yellow = '\x1b[33m',
|
const reset = '\x1b[0m';
|
||||||
bright = '\x1b[1m', red = '\x1b[31m', green = '\x1b[32m';
|
const grey = '\x1b[90m';
|
||||||
|
const cyan = '\x1b[36m';
|
||||||
|
const yellow = '\x1b[33m';
|
||||||
|
const bright = '\x1b[1m';
|
||||||
|
const red = '\x1b[31m';
|
||||||
|
const green = '\x1b[32m';
|
||||||
|
|
||||||
let jsApiConnection: any;
|
let jsApiConnection: any;
|
||||||
let loginAttempts: number = 0;
|
let loginAttempts: number = 0;
|
||||||
|
|
||||||
export default async function main(_args: string[]) {
|
export default async function main(_args: string[]) {
|
||||||
|
|
||||||
// tslint:disable-next-line: no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log = () => {};
|
console.log = () => {};
|
||||||
|
|
||||||
program
|
program
|
||||||
@@ -35,22 +40,19 @@ export default async function main(_args: string[]) {
|
|||||||
const peopleCount = await getPeopleCount();
|
const peopleCount = await getPeopleCount();
|
||||||
rowsToPrint.push({ label: 'Active Users', value: peopleCount.enabled });
|
rowsToPrint.push({ label: 'Active Users', value: peopleCount.enabled });
|
||||||
rowsToPrint.push({ label: 'Deactivated Users', value: peopleCount.disabled });
|
rowsToPrint.push({ label: 'Deactivated Users', value: peopleCount.disabled });
|
||||||
rowsToPrint.push({ label: "User's Home Folders", value: await getHomeFoldersCount() });
|
rowsToPrint.push({ label: `User's Home Folders`, value: await getHomeFoldersCount() });
|
||||||
rowsToPrint.push({ label: 'Groups', value: await getGroupsCount() });
|
rowsToPrint.push({ label: 'Groups', value: await getGroupsCount() });
|
||||||
rowsToPrint.push({ label: 'Sites', value: await getSitesCount() });
|
rowsToPrint.push({ label: 'Sites', value: await getSitesCount() });
|
||||||
rowsToPrint.push({ label: 'Files', value: await getFilesCount() });
|
rowsToPrint.push({ label: 'Files', value: await getFilesCount() });
|
||||||
|
|
||||||
logger.info(generateTable(rowsToPrint));
|
logger.info(generateTable(rowsToPrint));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateTable(rowsToPrint: Array<RowToPrint>) {
|
function generateTable(rowsToPrint: Array<RowToPrint>) {
|
||||||
const columnWidths = rowsToPrint.reduce((maxWidths, row: RowToPrint) => {
|
const columnWidths = rowsToPrint.reduce((maxWidths, row: RowToPrint) => ({
|
||||||
return {
|
|
||||||
labelColumn: Math.max(maxWidths.labelColumn, row.label.length),
|
labelColumn: Math.max(maxWidths.labelColumn, row.label.length),
|
||||||
valueColumn: Math.max(maxWidths.valueColumn, row.value.toString().length)
|
valueColumn: Math.max(maxWidths.valueColumn, row.value.toString().length)
|
||||||
};
|
}), { labelColumn: 12, valueColumn: 1 });
|
||||||
}, { labelColumn: 12, valueColumn: 1 });
|
|
||||||
|
|
||||||
const horizontalLine = ''.padEnd(columnWidths.labelColumn + columnWidths.valueColumn + 5, '═');
|
const horizontalLine = ''.padEnd(columnWidths.labelColumn + columnWidths.valueColumn + 5, '═');
|
||||||
const headerText = 'ENVIRONM'.padStart(Math.floor((columnWidths.labelColumn + columnWidths.valueColumn + 3) / 2), ' ')
|
const headerText = 'ENVIRONM'.padStart(Math.floor((columnWidths.labelColumn + columnWidths.valueColumn + 3) / 2), ' ')
|
||||||
@@ -134,10 +136,14 @@ async function getPeopleCount(skipCount: number = 0): Promise<PeopleTally> {
|
|||||||
const apiResult = await peopleApi.listPeople({
|
const apiResult = await peopleApi.listPeople({
|
||||||
fields: ['enabled'],
|
fields: ['enabled'],
|
||||||
maxItems: MAX_PEOPLE_PER_PAGE,
|
maxItems: MAX_PEOPLE_PER_PAGE,
|
||||||
skipCount: skipCount
|
skipCount
|
||||||
});
|
});
|
||||||
const result: PeopleTally = apiResult.list.entries.reduce((peopleTally: PeopleTally, currentPerson) => {
|
const result: PeopleTally = apiResult.list.entries.reduce((peopleTally: PeopleTally, currentPerson) => {
|
||||||
if (currentPerson.entry.enabled) { peopleTally.enabled++; } else { peopleTally.disabled++; }
|
if (currentPerson.entry.enabled) {
|
||||||
|
peopleTally.enabled++;
|
||||||
|
} else {
|
||||||
|
peopleTally.disabled++;
|
||||||
|
}
|
||||||
return peopleTally;
|
return peopleTally;
|
||||||
}, { enabled: 0, disabled: 0 });
|
}, { enabled: 0, disabled: 0 });
|
||||||
if (apiResult.list.pagination.hasMoreItems) {
|
if (apiResult.list.pagination.hasMoreItems) {
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ function replacePerform(args: CommitArgs, sha: string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function (args: CommitArgs) {
|
export default function(args: CommitArgs) {
|
||||||
main(args);
|
main(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,110 @@
|
|||||||
|
{
|
||||||
|
"extends": "../../.eslintrc.json",
|
||||||
|
"ignorePatterns": [
|
||||||
|
"!**/*"
|
||||||
|
],
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": [
|
||||||
|
"*.ts"
|
||||||
|
],
|
||||||
|
"parserOptions": {
|
||||||
|
"project": [
|
||||||
|
"lib/content-services/tsconfig.lib.json",
|
||||||
|
"lib/content-services/tsconfig.spec.json"
|
||||||
|
],
|
||||||
|
"createDefaultProgram": true
|
||||||
|
},
|
||||||
|
"plugins": [
|
||||||
|
"eslint-plugin-unicorn",
|
||||||
|
"eslint-plugin-rxjs"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"jsdoc/newline-after-description": "warn",
|
||||||
|
"@typescript-eslint/naming-convention": "warn",
|
||||||
|
"@typescript-eslint/consistent-type-assertions": "warn",
|
||||||
|
"@typescript-eslint/prefer-for-of": "warn",
|
||||||
|
"no-underscore-dangle": "warn",
|
||||||
|
"no-shadow": "warn",
|
||||||
|
"quote-props": "warn",
|
||||||
|
"object-shorthand": "warn",
|
||||||
|
"prefer-const": "warn",
|
||||||
|
"arrow-body-style": "warn",
|
||||||
|
"@angular-eslint/no-output-native": "warn",
|
||||||
|
"space-before-function-paren": "warn",
|
||||||
|
|
||||||
|
"@angular-eslint/component-selector": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"type": "element",
|
||||||
|
"prefix": [
|
||||||
|
"adf",
|
||||||
|
"app"
|
||||||
|
],
|
||||||
|
"style": "kebab-case"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@angular-eslint/directive-selector": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"type": [
|
||||||
|
"element",
|
||||||
|
"attribute"
|
||||||
|
],
|
||||||
|
"prefix": [
|
||||||
|
"adf",
|
||||||
|
"app"
|
||||||
|
],
|
||||||
|
"style": "kebab-case"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@angular-eslint/no-host-metadata-property": "off",
|
||||||
|
"@angular-eslint/no-input-prefix": "error",
|
||||||
|
"@typescript-eslint/consistent-type-definitions": "error",
|
||||||
|
"@typescript-eslint/dot-notation": "off",
|
||||||
|
"@typescript-eslint/explicit-member-accessibility": [
|
||||||
|
"off",
|
||||||
|
{
|
||||||
|
"accessibility": "explicit"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@typescript-eslint/no-floating-promises": "off",
|
||||||
|
"@typescript-eslint/no-inferrable-types": "off",
|
||||||
|
"@typescript-eslint/no-require-imports": "off",
|
||||||
|
"@typescript-eslint/no-var-requires": "error",
|
||||||
|
"brace-style": [
|
||||||
|
"error",
|
||||||
|
"1tbs"
|
||||||
|
],
|
||||||
|
"comma-dangle": "error",
|
||||||
|
"default-case": "error",
|
||||||
|
"import/order": "off",
|
||||||
|
"max-len": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"code": 240
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"no-bitwise": "off",
|
||||||
|
"no-duplicate-imports": "error",
|
||||||
|
"no-multiple-empty-lines": "error",
|
||||||
|
"no-redeclare": "error",
|
||||||
|
"no-return-await": "error",
|
||||||
|
"rxjs/no-create": "error",
|
||||||
|
"rxjs/no-subject-unsubscribe": "error",
|
||||||
|
"rxjs/no-subject-value": "error",
|
||||||
|
"rxjs/no-unsafe-takeuntil": "error",
|
||||||
|
"unicorn/filename-case": "error"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"files": [
|
||||||
|
"*.html"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"@angular-eslint/template/no-autofocus": "error",
|
||||||
|
"@angular-eslint/template/no-positive-tabindex": "error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -65,7 +65,7 @@ export class AuditService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateAuditApp(auditApplicationId: string, auditAppBodyUpdate: boolean, opts?: any): Observable<AuditApp | {}> {
|
updateAuditApp(auditApplicationId: string, auditAppBodyUpdate: boolean, opts?: any): Observable<AuditApp | any> {
|
||||||
const defaultOptions = {};
|
const defaultOptions = {};
|
||||||
const queryOptions = Object.assign({}, defaultOptions, opts);
|
const queryOptions = Object.assign({}, defaultOptions, opts);
|
||||||
return from(this.auditApi.updateAuditApp(auditApplicationId, new AuditBodyUpdate({ isEnabled: auditAppBodyUpdate }), queryOptions))
|
return from(this.auditApi.updateAuditApp(auditApplicationId, new AuditBodyUpdate({ isEnabled: auditAppBodyUpdate }), queryOptions))
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@ export interface PropertyGroup {
|
|||||||
title: string;
|
title: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
properties: {
|
properties: {
|
||||||
[key: string]: Property
|
[key: string]: Property;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,12 +27,11 @@ export class BasicPropertiesService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getProperties(node: Node) {
|
getProperties(node: Node) {
|
||||||
|
const sizeInBytes = node.content ? node.content.sizeInBytes : '';
|
||||||
const sizeInBytes = node.content ? node.content.sizeInBytes : '',
|
const mimeTypeName = node.content ? node.content.mimeTypeName : '';
|
||||||
mimeTypeName = node.content ? node.content.mimeTypeName : '',
|
const author = node.properties ? node.properties['cm:author'] : '';
|
||||||
author = node.properties ? node.properties['cm:author'] : '',
|
const description = node.properties ? node.properties['cm:description'] : '';
|
||||||
description = node.properties ? node.properties['cm:description'] : '',
|
const title = node.properties ? node.properties['cm:title'] : '';
|
||||||
title = node.properties ? node.properties['cm:title'] : '';
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
new CardViewTextItemModel({
|
new CardViewTextItemModel({
|
||||||
|
|||||||
+8
-9
@@ -34,10 +34,10 @@ describe('AspectOrientedConfigService', () => {
|
|||||||
expectations: OrganisedPropertyGroup[];
|
expectations: OrganisedPropertyGroup[];
|
||||||
}
|
}
|
||||||
|
|
||||||
const property1 = <Property> { name: 'property1' },
|
const property1 = <Property> { name: 'property1' };
|
||||||
property2 = <Property> { name: 'property2' },
|
const property2 = <Property> { name: 'property2' };
|
||||||
property3 = <Property> { name: 'property3' },
|
const property3 = <Property> { name: 'property3' };
|
||||||
property4 = <Property> { name: 'property4' };
|
const property4 = <Property> { name: 'property4' };
|
||||||
|
|
||||||
const propertyGroups: PropertyGroupContainer = {
|
const propertyGroups: PropertyGroupContainer = {
|
||||||
berseria: { title: 'Berseria', description: '', name: 'berseria', properties: { property1, property2 } },
|
berseria: { title: 'Berseria', description: '', name: 'berseria', properties: { property1, property2 } },
|
||||||
@@ -177,11 +177,10 @@ describe('AspectOrientedConfigService', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('appendAllPreset', () => {
|
describe('appendAllPreset', () => {
|
||||||
|
const property1 = <Property> { name: 'property1' };
|
||||||
const property1 = <Property> { name: 'property1' },
|
const property2 = <Property> { name: 'property2' };
|
||||||
property2 = <Property> { name: 'property2' },
|
const property3 = <Property> { name: 'property3' };
|
||||||
property3 = <Property> { name: 'property3' },
|
const property4 = <Property> { name: 'property4' };
|
||||||
property4 = <Property> { name: 'property4' };
|
|
||||||
|
|
||||||
const propertyGroups: PropertyGroupContainer = {
|
const propertyGroups: PropertyGroupContainer = {
|
||||||
berseria: { title: 'Berseria', description: '', name: 'berseria', properties: { property1, property2 } },
|
berseria: { title: 'Berseria', description: '', name: 'berseria', properties: { property1, property2 } },
|
||||||
|
|||||||
+4
-4
@@ -31,8 +31,8 @@ export class AspectOrientedConfigService implements ContentMetadataConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public reorganiseByConfig(propertyGroups: PropertyGroupContainer): OrganisedPropertyGroup[] {
|
public reorganiseByConfig(propertyGroups: PropertyGroupContainer): OrganisedPropertyGroup[] {
|
||||||
const aspects = this.config,
|
const aspects = this.config;
|
||||||
aspectNames = Object.keys(aspects);
|
const aspectNames = Object.keys(aspects);
|
||||||
|
|
||||||
return aspectNames
|
return aspectNames
|
||||||
.reduce((groupAccumulator, aspectName) => {
|
.reduce((groupAccumulator, aspectName) => {
|
||||||
@@ -45,8 +45,8 @@ export class AspectOrientedConfigService implements ContentMetadataConfig {
|
|||||||
public appendAllPreset(propertyGroups: PropertyGroupContainer): OrganisedPropertyGroup[] {
|
public appendAllPreset(propertyGroups: PropertyGroupContainer): OrganisedPropertyGroup[] {
|
||||||
const groups = Object.keys(propertyGroups)
|
const groups = Object.keys(propertyGroups)
|
||||||
.map((groupName) => {
|
.map((groupName) => {
|
||||||
const propertyGroup = propertyGroups[groupName],
|
const propertyGroup = propertyGroups[groupName];
|
||||||
properties = propertyGroup.properties;
|
const properties = propertyGroup.properties;
|
||||||
|
|
||||||
if (this.isAspectReadOnly(groupName)) {
|
if (this.isAspectReadOnly(groupName)) {
|
||||||
Object.keys(properties).map((propertyName) => this.setReadOnlyProperty(properties[propertyName]));
|
Object.keys(properties).map((propertyName) => this.setReadOnlyProperty(properties[propertyName]));
|
||||||
|
|||||||
+2
-2
@@ -28,8 +28,8 @@ export class IndifferentConfigService implements ContentMetadataConfig {
|
|||||||
reorganiseByConfig(propertyGroups: PropertyGroupContainer): OrganisedPropertyGroup[] {
|
reorganiseByConfig(propertyGroups: PropertyGroupContainer): OrganisedPropertyGroup[] {
|
||||||
return Object.keys(propertyGroups)
|
return Object.keys(propertyGroups)
|
||||||
.map((groupName) => {
|
.map((groupName) => {
|
||||||
const propertyGroup = propertyGroups[groupName],
|
const propertyGroup = propertyGroups[groupName];
|
||||||
properties = propertyGroup.properties;
|
const properties = propertyGroup.properties;
|
||||||
|
|
||||||
return Object.assign({}, propertyGroup, {
|
return Object.assign({}, propertyGroup, {
|
||||||
properties: Object.keys(properties).map((propertyName) => properties[propertyName])
|
properties: Object.keys(properties).map((propertyName) => properties[propertyName])
|
||||||
|
|||||||
+6
-6
@@ -102,12 +102,12 @@ describe('LayoutOrientedConfigService', () => {
|
|||||||
expectations: OrganisedPropertyGroup[];
|
expectations: OrganisedPropertyGroup[];
|
||||||
}
|
}
|
||||||
|
|
||||||
const property1 = <Property> { name: 'property1' },
|
const property1 = <Property> { name: 'property1' };
|
||||||
property2 = <Property> { name: 'property2' },
|
const property2 = <Property> { name: 'property2' };
|
||||||
property3 = <Property> { name: 'property3' },
|
const property3 = <Property> { name: 'property3' };
|
||||||
property4 = <Property> { name: 'property4' },
|
const property4 = <Property> { name: 'property4' };
|
||||||
property5 = <Property> { name: 'property5' },
|
const property5 = <Property> { name: 'property5' };
|
||||||
property6 = <Property> { name: 'property6' };
|
const property6 = <Property> { name: 'property6' };
|
||||||
|
|
||||||
const propertyGroups: PropertyGroupContainer = {
|
const propertyGroups: PropertyGroupContainer = {
|
||||||
berseria: { title: 'Berseria', description: '', name: 'berseria', properties: { property1, property2 } },
|
berseria: { title: 'Berseria', description: '', name: 'berseria', properties: { property1, property2 } },
|
||||||
|
|||||||
+7
-5
@@ -39,12 +39,14 @@ export class LayoutOrientedConfigService implements ContentMetadataConfig {
|
|||||||
const layoutBlocks = this.config.filter((itemsGroup) => itemsGroup.items);
|
const layoutBlocks = this.config.filter((itemsGroup) => itemsGroup.items);
|
||||||
|
|
||||||
const organisedPropertyGroup = layoutBlocks.map((layoutBlock) => {
|
const organisedPropertyGroup = layoutBlocks.map((layoutBlock) => {
|
||||||
const flattenedItems = this.flattenItems(layoutBlock.items),
|
const flattenedItems = this.flattenItems(layoutBlock.items);
|
||||||
properties = flattenedItems.reduce((props, explodedItem) => {
|
const properties = flattenedItems.reduce((props, explodedItem) => {
|
||||||
const isProperty = typeof explodedItem.property === 'object';
|
const isProperty = typeof explodedItem.property === 'object';
|
||||||
const propertyName = isProperty ? explodedItem.property.name : explodedItem.property;
|
const propertyName = isProperty ? explodedItem.property.name : explodedItem.property;
|
||||||
let property = getProperty(propertyGroups, explodedItem.groupName, propertyName) || [];
|
let property = getProperty(propertyGroups, explodedItem.groupName, propertyName) || [];
|
||||||
if (isProperty) { property = this.setPropertyTitle(property, explodedItem.property); }
|
if (isProperty) {
|
||||||
|
property = this.setPropertyTitle(property, explodedItem.property);
|
||||||
|
}
|
||||||
property = this.setEditableProperty(property, explodedItem);
|
property = this.setEditableProperty(property, explodedItem);
|
||||||
return props.concat(property);
|
return props.concat(property);
|
||||||
}, []);
|
}, []);
|
||||||
@@ -61,8 +63,8 @@ export class LayoutOrientedConfigService implements ContentMetadataConfig {
|
|||||||
public appendAllPreset(propertyGroups: PropertyGroupContainer): OrganisedPropertyGroup[] {
|
public appendAllPreset(propertyGroups: PropertyGroupContainer): OrganisedPropertyGroup[] {
|
||||||
return Object.keys(propertyGroups)
|
return Object.keys(propertyGroups)
|
||||||
.map((groupName) => {
|
.map((groupName) => {
|
||||||
const propertyGroup = propertyGroups[groupName],
|
const propertyGroup = propertyGroups[groupName];
|
||||||
properties = propertyGroup.properties;
|
const properties = propertyGroup.properties;
|
||||||
|
|
||||||
return Object.assign({}, propertyGroup, {
|
return Object.assign({}, propertyGroup, {
|
||||||
properties: Object.keys(properties).map((propertyName) => properties[propertyName])
|
properties: Object.keys(properties).map((propertyName) => properties[propertyName])
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ import { ContentTypePropertiesService } from './content-type-property.service';
|
|||||||
})
|
})
|
||||||
export class ContentMetadataService {
|
export class ContentMetadataService {
|
||||||
|
|
||||||
error = new Subject<{ statusCode: number, message: string }>();
|
error = new Subject<{ statusCode: number; message: string }>();
|
||||||
|
|
||||||
constructor(private basicPropertiesService: BasicPropertiesService,
|
constructor(private basicPropertiesService: BasicPropertiesService,
|
||||||
private contentMetadataConfigFactory: ContentMetadataConfigFactory,
|
private contentMetadataConfigFactory: ContentMetadataConfigFactory,
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ import { switchMap } from 'rxjs/operators';
|
|||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
// tslint:disable-next-line: directive-class-suffix
|
// eslint-disable-next-line @angular-eslint/directive-class-suffix
|
||||||
export class ContentNodeDialogService {
|
export class ContentNodeDialogService {
|
||||||
static nonDocumentSiteContent = [
|
static nonDocumentSiteContent = [
|
||||||
'blog',
|
'blog',
|
||||||
|
|||||||
+1
-1
@@ -197,7 +197,7 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
|
|||||||
@Input()
|
@Input()
|
||||||
set showFilesInResult(value: boolean) {
|
set showFilesInResult(value: boolean) {
|
||||||
if (value !== undefined && value !== null) {
|
if (value !== undefined && value !== null) {
|
||||||
const showFilesQuery = `TYPE:'cm:folder'${value ? " OR TYPE:'cm:content'" : ''}`;
|
const showFilesQuery = `TYPE:'cm:folder'${value ? ` OR TYPE:'cm:content'` : ''}`;
|
||||||
this.queryBuilderService.addFilterQuery(showFilesQuery);
|
this.queryBuilderService.addFilterQuery(showFilesQuery);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ export class NodeSharedDirective implements OnChanges, OnDestroy {
|
|||||||
isShared: boolean = false;
|
isShared: boolean = false;
|
||||||
|
|
||||||
/** Node to share. */
|
/** Node to share. */
|
||||||
// tslint:disable-next-line:no-input-rename
|
// eslint-disable-next-line @angular-eslint/no-input-rename
|
||||||
@Input('adf-share')
|
@Input('adf-share')
|
||||||
node: NodeEntry;
|
node: NodeEntry;
|
||||||
|
|
||||||
|
|||||||
@@ -130,7 +130,9 @@ describe('FolderDialogComponent', () => {
|
|||||||
|
|
||||||
spyOn(nodesApi, 'updateNode').and.returnValue(of(folder));
|
spyOn(nodesApi, 'updateNode').and.returnValue(of(folder));
|
||||||
|
|
||||||
component.success.subscribe((node) => { expectedNode = node; });
|
component.success.subscribe((node) => {
|
||||||
|
expectedNode = node;
|
||||||
|
});
|
||||||
component.submit();
|
component.submit();
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|||||||
@@ -142,7 +142,9 @@ export class FolderDialogComponent implements OnInit {
|
|||||||
submit() {
|
submit() {
|
||||||
const { form, dialog, editing } = this;
|
const { form, dialog, editing } = this;
|
||||||
|
|
||||||
if (!form.valid) { return; }
|
if (!form.valid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
(editing ? this.edit() : this.create())
|
(editing ? this.edit() : this.create())
|
||||||
.subscribe(
|
.subscribe(
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
placeholder="{{ 'LIBRARY.DIALOG.FORM.NAME' | translate }}"
|
placeholder="{{ 'LIBRARY.DIALOG.FORM.NAME' | translate }}"
|
||||||
required
|
required
|
||||||
matInput
|
matInput
|
||||||
autofocus
|
|
||||||
formControlName="title"
|
formControlName="title"
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* tslint:disable:no-input-rename */
|
/* eslint-disable @angular-eslint/no-input-rename */
|
||||||
|
|
||||||
import { Directive, ElementRef, Renderer2, HostListener, Input, AfterViewInit } from '@angular/core';
|
import { Directive, ElementRef, Renderer2, HostListener, Input, AfterViewInit } from '@angular/core';
|
||||||
import { Node } from '@alfresco/js-api';
|
import { Node } from '@alfresco/js-api';
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* tslint:disable:component-selector */
|
/* eslint-disable @angular-eslint/component-selector */
|
||||||
|
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* tslint:disable:component-selector */
|
/* eslint-disable @angular-eslint/component-selector */
|
||||||
|
|
||||||
import { Component, EventEmitter, Input, OnInit, Output, OnChanges, SimpleChanges, OnDestroy } from '@angular/core';
|
import { Component, EventEmitter, Input, OnInit, Output, OnChanges, SimpleChanges, OnDestroy } from '@angular/core';
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ export class ContentActionComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
|
|
||||||
/** Visibility state (see examples). */
|
/** Visibility state (see examples). */
|
||||||
@Input()
|
@Input()
|
||||||
visible: boolean | Function = true;
|
visible: boolean | ((...args) => boolean) = true;
|
||||||
|
|
||||||
/** System actions. Can be "delete", "download", "copy" or "move". */
|
/** System actions. Can be "delete", "download", "copy" or "move". */
|
||||||
@Input()
|
@Input()
|
||||||
@@ -66,7 +66,7 @@ export class ContentActionComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
|
|
||||||
/** Is the menu item disabled? */
|
/** Is the menu item disabled? */
|
||||||
@Input()
|
@Input()
|
||||||
disabled: boolean | Function = false;
|
disabled: boolean | ((...args) => boolean) = false;
|
||||||
|
|
||||||
/** Emitted when the user selects the action from the menu. */
|
/** Emitted when the user selects the action from the menu. */
|
||||||
@Output()
|
@Output()
|
||||||
|
|||||||
+6
-2
@@ -241,7 +241,9 @@ describe('DocumentList', () => {
|
|||||||
previousValue: undefined,
|
previousValue: undefined,
|
||||||
currentValue: mockPreselectedNodes,
|
currentValue: mockPreselectedNodes,
|
||||||
firstChange: true,
|
firstChange: true,
|
||||||
isFirstChange(): boolean { return this.firstChange; }
|
isFirstChange(): boolean {
|
||||||
|
return this.firstChange;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
documentList.ngOnChanges(changes);
|
documentList.ngOnChanges(changes);
|
||||||
@@ -258,7 +260,9 @@ describe('DocumentList', () => {
|
|||||||
previousValue: undefined,
|
previousValue: undefined,
|
||||||
currentValue: ['mockChangeValue'],
|
currentValue: ['mockChangeValue'],
|
||||||
firstChange: true,
|
firstChange: true,
|
||||||
isFirstChange(): boolean { return this.firstChange; }
|
isFirstChange(): boolean {
|
||||||
|
return this.firstChange;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
documentList.ngOnChanges(changes);
|
documentList.ngOnChanges(changes);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* tslint:disable:rxjs-no-subject-value */
|
/* eslint-disable rxjs/no-subject-value */
|
||||||
|
|
||||||
import {
|
import {
|
||||||
AfterContentInit, Component, ContentChild, ElementRef, EventEmitter, HostListener, Input, NgZone,
|
AfterContentInit, Component, ContentChild, ElementRef, EventEmitter, HostListener, Input, NgZone,
|
||||||
@@ -208,7 +208,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
|||||||
* docs for more details and usage examples.
|
* docs for more details and usage examples.
|
||||||
*/
|
*/
|
||||||
@Input()
|
@Input()
|
||||||
rowStyle: { [key: string]: any; };
|
rowStyle: { [key: string]: any };
|
||||||
|
|
||||||
/** The CSS class to apply to every row */
|
/** The CSS class to apply to every row */
|
||||||
@Input()
|
@Input()
|
||||||
@@ -816,7 +816,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onNodeSelect(event: { row: ShareDataRow, selection: Array<ShareDataRow> }) {
|
onNodeSelect(event: { row: ShareDataRow; selection: Array<ShareDataRow> }) {
|
||||||
this.selection = event.selection.map((entry) => entry.node);
|
this.selection = event.selection.map((entry) => entry.node);
|
||||||
const domEvent = new CustomEvent('node-select', {
|
const domEvent = new CustomEvent('node-select', {
|
||||||
detail: {
|
detail: {
|
||||||
@@ -829,7 +829,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
|||||||
this.elementRef.nativeElement.dispatchEvent(domEvent);
|
this.elementRef.nativeElement.dispatchEvent(domEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
onNodeUnselect(event: { row: ShareDataRow, selection: Array<ShareDataRow> }) {
|
onNodeUnselect(event: { row: ShareDataRow; selection: Array<ShareDataRow> }) {
|
||||||
this.selection = event.selection.map((entry) => entry.node);
|
this.selection = event.selection.map((entry) => entry.node);
|
||||||
const domEvent = new CustomEvent('node-unselect', {
|
const domEvent = new CustomEvent('node-unselect', {
|
||||||
detail: {
|
detail: {
|
||||||
|
|||||||
+2
-2
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, Inject, OnInit, OnChanges, SimpleChanges, Input, Output, EventEmitter } from '@angular/core';
|
import { Component, Inject, OnInit, OnChanges, SimpleChanges, Input, Output, EventEmitter, OnDestroy } from '@angular/core';
|
||||||
import { PaginationModel, DataSorting } from '@alfresco/adf-core';
|
import { PaginationModel, DataSorting } from '@alfresco/adf-core';
|
||||||
import { DocumentListComponent } from '../document-list.component';
|
import { DocumentListComponent } from '../document-list.component';
|
||||||
import { SEARCH_QUERY_SERVICE_TOKEN } from '../../../search/search-query-service.token';
|
import { SEARCH_QUERY_SERVICE_TOKEN } from '../../../search/search-query-service.token';
|
||||||
@@ -30,7 +30,7 @@ import { NodePaging, MinimalNode } from '@alfresco/js-api';
|
|||||||
templateUrl: './filter-header.component.html',
|
templateUrl: './filter-header.component.html',
|
||||||
providers: [{ provide: SEARCH_QUERY_SERVICE_TOKEN, useClass: SearchHeaderQueryBuilderService}]
|
providers: [{ provide: SEARCH_QUERY_SERVICE_TOKEN, useClass: SearchHeaderQueryBuilderService}]
|
||||||
})
|
})
|
||||||
export class FilterHeaderComponent implements OnInit, OnChanges {
|
export class FilterHeaderComponent implements OnInit, OnChanges, OnDestroy {
|
||||||
|
|
||||||
/** (optional) Initial filter value to sort . */
|
/** (optional) Initial filter value to sort . */
|
||||||
@Input()
|
@Input()
|
||||||
|
|||||||
@@ -19,12 +19,12 @@ export class ContentActionModel {
|
|||||||
icon: string;
|
icon: string;
|
||||||
title: string;
|
title: string;
|
||||||
handler: ContentActionHandler;
|
handler: ContentActionHandler;
|
||||||
execute: Function;
|
execute: (...args) => void;
|
||||||
target: string;
|
target: string;
|
||||||
permission: string;
|
permission: string;
|
||||||
disableWithNoPermission: boolean = false;
|
disableWithNoPermission: boolean = false;
|
||||||
disabled: boolean | Function = false;
|
disabled: boolean | ((...args) => boolean) = false;
|
||||||
visible: boolean | Function = true;
|
visible: boolean | ((...args) => boolean) = true;
|
||||||
|
|
||||||
constructor(obj?: any) {
|
constructor(obj?: any) {
|
||||||
if (obj) {
|
if (obj) {
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ export class DocumentActionsService {
|
|||||||
error: Subject<Error> = new Subject<Error>();
|
error: Subject<Error> = new Subject<Error>();
|
||||||
success: Subject<string> = new Subject<string>();
|
success: Subject<string> = new Subject<string>();
|
||||||
|
|
||||||
private handlers: { [id: string]: ContentActionHandler; } = {};
|
private handlers: { [id: string]: ContentActionHandler } = {};
|
||||||
|
|
||||||
constructor(private nodeActionsService: NodeActionsService,
|
constructor(private nodeActionsService: NodeActionsService,
|
||||||
private contentNodeDialogService: ContentNodeDialogService,
|
private contentNodeDialogService: ContentNodeDialogService,
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ export class FolderActionsService {
|
|||||||
error: Subject<Error> = new Subject<Error>();
|
error: Subject<Error> = new Subject<Error>();
|
||||||
success: Subject<string> = new Subject<string>();
|
success: Subject<string> = new Subject<string>();
|
||||||
|
|
||||||
private handlers: { [id: string]: ContentActionHandler; } = {};
|
private handlers: { [id: string]: ContentActionHandler } = {};
|
||||||
|
|
||||||
constructor(private nodeActionsService: NodeActionsService,
|
constructor(private nodeActionsService: NodeActionsService,
|
||||||
private documentListService: DocumentListService,
|
private documentListService: DocumentListService,
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import { NodeAction } from '../models/node-action.enum';
|
|||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
// tslint:disable-next-line: directive-class-suffix
|
// eslint-disable-next-line @angular-eslint/directive-class-suffix
|
||||||
export class NodeActionsService {
|
export class NodeActionsService {
|
||||||
|
|
||||||
@Output()
|
@Output()
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* tslint:disable:no-input-rename */
|
/* eslint-disable @angular-eslint/no-input-rename */
|
||||||
|
|
||||||
import { Directive, HostListener, Input, Output, EventEmitter } from '@angular/core';
|
import { Directive, HostListener, Input, Output, EventEmitter } from '@angular/core';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* tslint:disable:no-input-rename */
|
/* eslint-disable @angular-eslint/no-input-rename */
|
||||||
|
|
||||||
import { Directive, ElementRef, HostListener, Input, Output, EventEmitter } from '@angular/core';
|
import { Directive, ElementRef, HostListener, Input, Output, EventEmitter } from '@angular/core';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ export const disabledCategories = [
|
|||||||
'field': null,
|
'field': null,
|
||||||
'pageSize': 5,
|
'pageSize': 5,
|
||||||
'options': [
|
'options': [
|
||||||
{ 'name': 'Folder', 'value': "TYPE:'cm:folder'" },
|
{ 'name': 'Folder', 'value': `TYPE:'cm:folder'` },
|
||||||
{ 'name': 'Document', 'value': "TYPE:'cm:content'" }
|
{ 'name': 'Document', 'value': `TYPE:'cm:content'` }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -62,8 +62,8 @@ export const expandedCategories = [
|
|||||||
'field': null,
|
'field': null,
|
||||||
'pageSize': 5,
|
'pageSize': 5,
|
||||||
'options': [
|
'options': [
|
||||||
{ 'name': 'Folder', 'value': "TYPE:'cm:folder'" },
|
{ 'name': 'Folder', 'value': `TYPE:'cm:folder'` },
|
||||||
{ 'name': 'Document', 'value': "TYPE:'cm:content'" }
|
{ 'name': 'Document', 'value': `TYPE:'cm:content'` }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -94,8 +94,8 @@ export const simpleCategories: SearchCategory[] = [
|
|||||||
'field': 'check-list',
|
'field': 'check-list',
|
||||||
'pageSize': 5,
|
'pageSize': 5,
|
||||||
'options': [
|
'options': [
|
||||||
{ 'name': 'Folder', 'value': "TYPE:'cm:folder'" },
|
{ 'name': 'Folder', 'value': `TYPE:'cm:folder'` },
|
||||||
{ 'name': 'Document', 'value': "TYPE:'cm:content'" }
|
{ 'name': 'Document', 'value': `TYPE:'cm:content'` }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -132,7 +132,7 @@ export const searchFilter = {
|
|||||||
'resetButton': true,
|
'resetButton': true,
|
||||||
'filterQueries': [
|
'filterQueries': [
|
||||||
{
|
{
|
||||||
'query': "TYPE:'cm:folder' OR TYPE:'cm:content'"
|
'query': `TYPE:'cm:folder' OR TYPE:'cm:content'`
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'query': 'NOT cm:creator:System'
|
'query': 'NOT cm:creator:System'
|
||||||
@@ -321,7 +321,7 @@ export const searchFilter = {
|
|||||||
'component': {
|
'component': {
|
||||||
'selector': 'text',
|
'selector': 'text',
|
||||||
'settings': {
|
'settings': {
|
||||||
'pattern': "cm:name:'(.*?)'",
|
'pattern': `cm:name:'(.*?)'`,
|
||||||
'field': 'cm:name',
|
'field': 'cm:name',
|
||||||
'placeholder': 'Enter the name'
|
'placeholder': 'Enter the name'
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -44,7 +44,7 @@ export class SearchPermissionConfigurationService implements SearchConfiguration
|
|||||||
skipCount: skipCount
|
skipCount: skipCount
|
||||||
},
|
},
|
||||||
filterQueries: [
|
filterQueries: [
|
||||||
/*tslint:disable-next-line */
|
/* eslint-disable-next-line */
|
||||||
{ query: "TYPE:'cm:authority'" }]
|
{ query: "TYPE:'cm:authority'" }]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* tslint:disable:no-input-rename */
|
/* eslint-disable @angular-eslint/no-input-rename */
|
||||||
import { Directive, Input, Output, EventEmitter } from '@angular/core';
|
import { Directive, Input, Output, EventEmitter } from '@angular/core';
|
||||||
import { NodesApiService, ContentService, AllowableOperationsEnum } from '@alfresco/adf-core';
|
import { NodesApiService, ContentService, AllowableOperationsEnum } from '@alfresco/adf-core';
|
||||||
import { Node } from '@alfresco/js-api';
|
import { Node } from '@alfresco/js-api';
|
||||||
|
|||||||
+1
-1
@@ -48,7 +48,7 @@ export class PermissionContainerComponent implements OnChanges {
|
|||||||
|
|
||||||
/** Emitted when the permission is updated. */
|
/** Emitted when the permission is updated. */
|
||||||
@Output()
|
@Output()
|
||||||
update = new EventEmitter<{role: string, permission: PermissionDisplayModel}>();
|
update = new EventEmitter<{role: string; permission: PermissionDisplayModel}>();
|
||||||
|
|
||||||
@Output()
|
@Output()
|
||||||
updateAll = new EventEmitter<string>();
|
updateAll = new EventEmitter<string>();
|
||||||
|
|||||||
+2
-2
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
import { ObjectDataRow } from '@alfresco/adf-core';
|
import { ObjectDataRow } from '@alfresco/adf-core';
|
||||||
import { PermissionElement } from '@alfresco/js-api';
|
import { PermissionElement } from '@alfresco/js-api';
|
||||||
import { Component, EventEmitter, Input, Output, ViewEncapsulation } from '@angular/core';
|
import { Component, EventEmitter, Input, OnInit, Output, ViewEncapsulation } from '@angular/core';
|
||||||
import { PermissionDisplayModel } from '../../models/permission.model';
|
import { PermissionDisplayModel } from '../../models/permission.model';
|
||||||
import { PermissionListService } from './permission-list.service';
|
import { PermissionListService } from './permission-list.service';
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ import { PermissionListService } from './permission-list.service';
|
|||||||
styleUrls: ['./permission-list.component.scss'],
|
styleUrls: ['./permission-list.component.scss'],
|
||||||
encapsulation: ViewEncapsulation.None
|
encapsulation: ViewEncapsulation.None
|
||||||
})
|
})
|
||||||
export class PermissionListComponent {
|
export class PermissionListComponent implements OnInit {
|
||||||
/** ID of the node whose permissions you want to show. */
|
/** ID of the node whose permissions you want to show. */
|
||||||
@Input()
|
@Input()
|
||||||
nodeId: string;
|
nodeId: string;
|
||||||
|
|||||||
+9
-5
@@ -71,8 +71,9 @@ describe('PermissionListService', () => {
|
|||||||
|
|
||||||
describe('toggle permission', () => {
|
describe('toggle permission', () => {
|
||||||
|
|
||||||
it('should show error if user doesn\'t have permission to update node', () => {
|
it('should show error if user does not have permission to update node', () => {
|
||||||
const node = JSON.parse(JSON.stringify(fakeNodeInheritedOnly)), event = { source: { checked: false } };
|
const node = JSON.parse(JSON.stringify(fakeNodeInheritedOnly));
|
||||||
|
const event = { source: { checked: false } };
|
||||||
node.allowableOperations = [];
|
node.allowableOperations = [];
|
||||||
spyOn(nodePermissionService, 'getNodeWithRoles').and.returnValue(of({node , roles: []}));
|
spyOn(nodePermissionService, 'getNodeWithRoles').and.returnValue(of({node , roles: []}));
|
||||||
spyOn(nodesApiService, 'updateNode').and.stub();
|
spyOn(nodesApiService, 'updateNode').and.stub();
|
||||||
@@ -83,7 +84,8 @@ describe('PermissionListService', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should include the local permission before toggle', (done) => {
|
it('should include the local permission before toggle', (done) => {
|
||||||
const node = JSON.parse(JSON.stringify(fakeNodeInheritedOnly)), event = { source: { checked: false } };
|
const node = JSON.parse(JSON.stringify(fakeNodeInheritedOnly));
|
||||||
|
const event = { source: { checked: false } };
|
||||||
spyOn(nodePermissionService, 'getNodeWithRoles').and.returnValue(of({node , roles: []}));
|
spyOn(nodePermissionService, 'getNodeWithRoles').and.returnValue(of({node , roles: []}));
|
||||||
spyOn(nodePermissionService, 'updatePermissions').and.returnValue(of(null));
|
spyOn(nodePermissionService, 'updatePermissions').and.returnValue(of(null));
|
||||||
spyOn(nodesApiService, 'updateNode').and.returnValue(of(JSON.parse(JSON.stringify(fakeNodeLocalSiteManager))));
|
spyOn(nodesApiService, 'updateNode').and.returnValue(of(JSON.parse(JSON.stringify(fakeNodeLocalSiteManager))));
|
||||||
@@ -104,7 +106,8 @@ describe('PermissionListService', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should not update local permission before toggle', () => {
|
it('should not update local permission before toggle', () => {
|
||||||
const node = JSON.parse(JSON.stringify(fakeNodeInheritedOnly)), event = { source: { checked: false } };
|
const node = JSON.parse(JSON.stringify(fakeNodeInheritedOnly));
|
||||||
|
const event = { source: { checked: false } };
|
||||||
const updateNode = JSON.parse(JSON.stringify(fakeNodeInheritedOnly));
|
const updateNode = JSON.parse(JSON.stringify(fakeNodeInheritedOnly));
|
||||||
node.permissions.locallySet = [{
|
node.permissions.locallySet = [{
|
||||||
'authorityId': 'GROUP_site_testsite_SiteManager',
|
'authorityId': 'GROUP_site_testsite_SiteManager',
|
||||||
@@ -124,7 +127,8 @@ describe('PermissionListService', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should show message for errored toggle', () => {
|
it('should show message for errored toggle', () => {
|
||||||
const node = JSON.parse(JSON.stringify(fakeNodeInheritedOnly)), event = { source: { checked: false } };
|
const node = JSON.parse(JSON.stringify(fakeNodeInheritedOnly));
|
||||||
|
const event = { source: { checked: false } };
|
||||||
node.permissions.isInheritanceEnabled = true;
|
node.permissions.isInheritanceEnabled = true;
|
||||||
spyOn(nodesApiService, 'updateNode').and.returnValue(throwError('Failed to update'));
|
spyOn(nodesApiService, 'updateNode').and.returnValue(throwError('Failed to update'));
|
||||||
spyOn(nodePermissionService, 'getNodeWithRoles').and.returnValue(of({node , roles: []}));
|
spyOn(nodePermissionService, 'getNodeWithRoles').and.returnValue(of({node , roles: []}));
|
||||||
|
|||||||
+3
-2
@@ -36,7 +36,7 @@ export class PermissionListService {
|
|||||||
|
|
||||||
loading$: BehaviorSubject<boolean> = new BehaviorSubject(true);
|
loading$: BehaviorSubject<boolean> = new BehaviorSubject(true);
|
||||||
error$: Subject<boolean> = new Subject();
|
error$: Subject<boolean> = new Subject();
|
||||||
nodeWithRoles$: Subject<{ node: Node, roles: RoleModel[] }> = new Subject();
|
nodeWithRoles$: Subject<{ node: Node; roles: RoleModel[] }> = new Subject();
|
||||||
data$: Observable<NodePermissionsModel> = this.nodeWithRoles$.pipe(
|
data$: Observable<NodePermissionsModel> = this.nodeWithRoles$.pipe(
|
||||||
map(({ node, roles}) => {
|
map(({ node, roles}) => {
|
||||||
const nodeLocalPermissions = this.nodePermissionService.getLocalPermissions(node);
|
const nodeLocalPermissions = this.nodePermissionService.getLocalPermissions(node);
|
||||||
@@ -220,7 +220,8 @@ export class PermissionListService {
|
|||||||
|
|
||||||
getManagerAuthority(node: Node): string {
|
getManagerAuthority(node: Node): string {
|
||||||
const sitePath = node.path.elements.find((path) => path.nodeType === 'st:site');
|
const sitePath = node.path.elements.find((path) => path.nodeType === 'st:site');
|
||||||
let hasLocalManagerPermission = false, authorityId: string;
|
let hasLocalManagerPermission = false;
|
||||||
|
let authorityId: string;
|
||||||
if (sitePath) {
|
if (sitePath) {
|
||||||
authorityId = `GROUP_site_${sitePath.name}_${this.SITE_MANAGER_ROLE}`;
|
authorityId = `GROUP_site_${sitePath.name}_${this.SITE_MANAGER_ROLE}`;
|
||||||
hasLocalManagerPermission = !!node.permissions.locallySet?.find((permission) => permission.authorityId === authorityId && permission.name === this.SITE_MANAGER_ROLE);
|
hasLocalManagerPermission = !!node.permissions.locallySet?.find((permission) => permission.authorityId === authorityId && permission.name === this.SITE_MANAGER_ROLE);
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export class PopOverDirective implements OnInit, OnDestroy, AfterViewInit {
|
|||||||
return this._open;
|
return this._open;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Input('adf-pop-over') popOver!: TemplateRef<object>;
|
@Input('adf-pop-over') popOver!: TemplateRef<any>;
|
||||||
@Input() target!: HTMLElement;
|
@Input() target!: HTMLElement;
|
||||||
@Input() panelClass = 'adf-permission-pop-over';
|
@Input() panelClass = 'adf-permission-pop-over';
|
||||||
|
|
||||||
|
|||||||
+3
-1
@@ -189,7 +189,9 @@ describe('NodePermissionService', () => {
|
|||||||
|
|
||||||
service.updateLocallySetPermissions(fakeNodeCopy, fakeDuplicateAuthority)
|
service.updateLocallySetPermissions(fakeNodeCopy, fakeDuplicateAuthority)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
() => { fail('should throw exception'); },
|
() => {
|
||||||
|
fail('should throw exception');
|
||||||
|
},
|
||||||
(errorMessage) => {
|
(errorMessage) => {
|
||||||
expect(errorMessage).not.toBeNull();
|
expect(errorMessage).not.toBeNull();
|
||||||
expect(errorMessage).toBeDefined();
|
expect(errorMessage).toBeDefined();
|
||||||
|
|||||||
@@ -224,7 +224,7 @@ export class NodePermissionService {
|
|||||||
'filterQueries': [
|
'filterQueries': [
|
||||||
{
|
{
|
||||||
'query':
|
'query':
|
||||||
"TYPE:'st:site'"
|
`TYPE:'st:site'`
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
@@ -307,8 +307,9 @@ export class NodePermissionService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
transformNodeToUserPerson(node: Node): { person: EcmUserModel, group: Group } {
|
transformNodeToUserPerson(node: Node): { person: EcmUserModel; group: Group } {
|
||||||
let person = null, group = null;
|
let person = null;
|
||||||
|
let group = null;
|
||||||
if (node.nodeType === 'cm:person') {
|
if (node.nodeType === 'cm:person') {
|
||||||
const firstName = node.properties['cm:firstName'];
|
const firstName = node.properties['cm:firstName'];
|
||||||
const lastName = node.properties['cm:lastName'];
|
const lastName = node.properties['cm:lastName'];
|
||||||
|
|||||||
+10
-10
@@ -42,8 +42,8 @@ describe('SearchCheckListComponent', () => {
|
|||||||
|
|
||||||
it('should setup options from settings', () => {
|
it('should setup options from settings', () => {
|
||||||
const options: any = [
|
const options: any = [
|
||||||
{ 'name': 'Folder', 'value': "TYPE:'cm:folder'" },
|
{ 'name': 'Folder', 'value': `TYPE:'cm:folder'` },
|
||||||
{ 'name': 'Document', 'value': "TYPE:'cm:content'" }
|
{ 'name': 'Document', 'value': `TYPE:'cm:content'` }
|
||||||
];
|
];
|
||||||
component.settings = <any> { options: options };
|
component.settings = <any> { options: options };
|
||||||
component.ngOnInit();
|
component.ngOnInit();
|
||||||
@@ -53,8 +53,8 @@ describe('SearchCheckListComponent', () => {
|
|||||||
|
|
||||||
it('should handle enter key as click on checkboxes', () => {
|
it('should handle enter key as click on checkboxes', () => {
|
||||||
component.options = new SearchFilterList<SearchListOption>([
|
component.options = new SearchFilterList<SearchListOption>([
|
||||||
{ name: 'Folder', value: "TYPE:'cm:folder'", checked: false },
|
{ name: 'Folder', value: `TYPE:'cm:folder'`, checked: false },
|
||||||
{ name: 'Document', value: "TYPE:'cm:content'", checked: false }
|
{ name: 'Document', value: `TYPE:'cm:content'`, checked: false }
|
||||||
]);
|
]);
|
||||||
|
|
||||||
component.ngOnInit();
|
component.ngOnInit();
|
||||||
@@ -83,8 +83,8 @@ describe('SearchCheckListComponent', () => {
|
|||||||
|
|
||||||
it('should update query builder on checkbox change', () => {
|
it('should update query builder on checkbox change', () => {
|
||||||
component.options = new SearchFilterList<SearchListOption>([
|
component.options = new SearchFilterList<SearchListOption>([
|
||||||
{ name: 'Folder', value: "TYPE:'cm:folder'", checked: false },
|
{ name: 'Folder', value: `TYPE:'cm:folder'`, checked: false },
|
||||||
{ name: 'Document', value: "TYPE:'cm:content'", checked: false }
|
{ name: 'Document', value: `TYPE:'cm:content'`, checked: false }
|
||||||
]);
|
]);
|
||||||
|
|
||||||
component.id = 'checklist';
|
component.id = 'checklist';
|
||||||
@@ -116,8 +116,8 @@ describe('SearchCheckListComponent', () => {
|
|||||||
|
|
||||||
it('should reset selected boxes', () => {
|
it('should reset selected boxes', () => {
|
||||||
component.options = new SearchFilterList<SearchListOption>([
|
component.options = new SearchFilterList<SearchListOption>([
|
||||||
{ name: 'Folder', value: "TYPE:'cm:folder'", checked: true },
|
{ name: 'Folder', value: `TYPE:'cm:folder'`, checked: true },
|
||||||
{ name: 'Document', value: "TYPE:'cm:content'", checked: true }
|
{ name: 'Document', value: `TYPE:'cm:content'`, checked: true }
|
||||||
]);
|
]);
|
||||||
|
|
||||||
component.reset();
|
component.reset();
|
||||||
@@ -138,8 +138,8 @@ describe('SearchCheckListComponent', () => {
|
|||||||
|
|
||||||
component.ngOnInit();
|
component.ngOnInit();
|
||||||
component.options = new SearchFilterList<SearchListOption>([
|
component.options = new SearchFilterList<SearchListOption>([
|
||||||
{ name: 'Folder', value: "TYPE:'cm:folder'", checked: true },
|
{ name: 'Folder', value: `TYPE:'cm:folder'`, checked: true },
|
||||||
{ name: 'Document', value: "TYPE:'cm:content'", checked: true }
|
{ name: 'Document', value: `TYPE:'cm:content'`, checked: true }
|
||||||
]);
|
]);
|
||||||
|
|
||||||
component.reset();
|
component.reset();
|
||||||
|
|||||||
+1
-1
@@ -141,7 +141,7 @@ export class SearchDateRangeComponent implements SearchWidget, OnInit, OnDestroy
|
|||||||
this.onDestroy$.complete();
|
this.onDestroy$.complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
apply(model: { from: string, to: string }, isValid: boolean) {
|
apply(model: { from: string; to: string }, isValid: boolean) {
|
||||||
if (isValid && this.id && this.context && this.settings && this.settings.field) {
|
if (isValid && this.id && this.context && this.settings && this.settings.field) {
|
||||||
this.isActive = true;
|
this.isActive = true;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -129,7 +129,7 @@ export class SearchDatetimeRangeComponent implements SearchWidget, OnInit, OnDes
|
|||||||
this.onDestroy$.complete();
|
this.onDestroy$.complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
apply(model: { from: string, to: string }, isValid: boolean) {
|
apply(model: { from: string; to: string }, isValid: boolean) {
|
||||||
if (isValid && this.id && this.context && this.settings && this.settings.field) {
|
if (isValid && this.id && this.context && this.settings && this.settings.field) {
|
||||||
this.isActive = true;
|
this.isActive = true;
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -20,7 +20,6 @@ import { TranslateModule } from '@ngx-translate/core';
|
|||||||
import { SearchService, setupTestBed } from '@alfresco/adf-core';
|
import { SearchService, setupTestBed } from '@alfresco/adf-core';
|
||||||
import { SearchHeaderQueryBuilderService } from '../../services/search-header-query-builder.service';
|
import { SearchHeaderQueryBuilderService } from '../../services/search-header-query-builder.service';
|
||||||
import { ContentTestingModule } from '../../../testing/content.testing.module';
|
import { ContentTestingModule } from '../../../testing/content.testing.module';
|
||||||
// import { fakeNodePaging } from './../../../mock/document-list.component.mock';
|
|
||||||
import { SEARCH_QUERY_SERVICE_TOKEN } from '../../search-query-service.token';
|
import { SEARCH_QUERY_SERVICE_TOKEN } from '../../search-query-service.token';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { SearchFilterContainerComponent } from './search-filter-container.component';
|
import { SearchFilterContainerComponent } from './search-filter-container.component';
|
||||||
@@ -36,7 +35,7 @@ const mockCategory: SearchCategory = {
|
|||||||
'component': {
|
'component': {
|
||||||
'selector': 'text',
|
'selector': 'text',
|
||||||
'settings': {
|
'settings': {
|
||||||
'pattern': "cm:name:'(.*?)'",
|
'pattern': `cm:name:'(.*?)'`,
|
||||||
'field': 'cm:name',
|
'field': 'cm:name',
|
||||||
'placeholder': 'Enter the name'
|
'placeholder': 'Enter the name'
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -86,7 +86,7 @@ export class SearchNumberRangeComponent implements SearchWidget, OnInit {
|
|||||||
return parseInt(formGroup.get('from').value, 10) < parseInt(formGroup.get('to').value, 10) ? null : {'mismatch': true};
|
return parseInt(formGroup.get('from').value, 10) < parseInt(formGroup.get('to').value, 10) ? null : {'mismatch': true};
|
||||||
}
|
}
|
||||||
|
|
||||||
apply(model: { from: string, to: string }, isValid: boolean) {
|
apply(model: { from: string; to: string }, isValid: boolean) {
|
||||||
if (isValid && this.id && this.context && this.field) {
|
if (isValid && this.id && this.context && this.field) {
|
||||||
this.updateDisplayValue();
|
this.updateDisplayValue();
|
||||||
this.isActive = true;
|
this.isActive = true;
|
||||||
|
|||||||
+10
-10
@@ -42,8 +42,8 @@ describe('SearchCheckListComponent', () => {
|
|||||||
|
|
||||||
it('should setup options from settings', () => {
|
it('should setup options from settings', () => {
|
||||||
const options: any = [
|
const options: any = [
|
||||||
{ 'name': 'Folder', 'value': "TYPE:'cm:folder'" },
|
{ 'name': 'Folder', 'value': `TYPE:'cm:folder'` },
|
||||||
{ 'name': 'Document', 'value': "TYPE:'cm:content'" }
|
{ 'name': 'Document', 'value': `TYPE:'cm:content'` }
|
||||||
];
|
];
|
||||||
component.settings = <any> { options: options };
|
component.settings = <any> { options: options };
|
||||||
component.ngOnInit();
|
component.ngOnInit();
|
||||||
@@ -53,8 +53,8 @@ describe('SearchCheckListComponent', () => {
|
|||||||
|
|
||||||
it('should handle enter key as click on checkboxes', () => {
|
it('should handle enter key as click on checkboxes', () => {
|
||||||
component.options = new SearchFilterList<SearchListOption>([
|
component.options = new SearchFilterList<SearchListOption>([
|
||||||
{ name: 'Folder', value: "TYPE:'cm:folder'", checked: false },
|
{ name: 'Folder', value: `TYPE:'cm:folder'`, checked: false },
|
||||||
{ name: 'Document', value: "TYPE:'cm:content'", checked: false }
|
{ name: 'Document', value: `TYPE:'cm:content'`, checked: false }
|
||||||
]);
|
]);
|
||||||
|
|
||||||
component.ngOnInit();
|
component.ngOnInit();
|
||||||
@@ -83,8 +83,8 @@ describe('SearchCheckListComponent', () => {
|
|||||||
|
|
||||||
it('should update query builder on checkbox change', () => {
|
it('should update query builder on checkbox change', () => {
|
||||||
component.options = new SearchFilterList<SearchListOption>([
|
component.options = new SearchFilterList<SearchListOption>([
|
||||||
{ name: 'Folder', value: "TYPE:'cm:folder'", checked: false },
|
{ name: 'Folder', value: `TYPE:'cm:folder'`, checked: false },
|
||||||
{ name: 'Document', value: "TYPE:'cm:content'", checked: false }
|
{ name: 'Document', value: `TYPE:'cm:content'`, checked: false }
|
||||||
]);
|
]);
|
||||||
|
|
||||||
component.id = 'checklist';
|
component.id = 'checklist';
|
||||||
@@ -116,8 +116,8 @@ describe('SearchCheckListComponent', () => {
|
|||||||
|
|
||||||
it('should reset selected boxes', () => {
|
it('should reset selected boxes', () => {
|
||||||
component.options = new SearchFilterList<SearchListOption>([
|
component.options = new SearchFilterList<SearchListOption>([
|
||||||
{ name: 'Folder', value: "TYPE:'cm:folder'", checked: true },
|
{ name: 'Folder', value: `TYPE:'cm:folder'`, checked: true },
|
||||||
{ name: 'Document', value: "TYPE:'cm:content'", checked: true }
|
{ name: 'Document', value: `TYPE:'cm:content'`, checked: true }
|
||||||
]);
|
]);
|
||||||
|
|
||||||
component.reset();
|
component.reset();
|
||||||
@@ -138,8 +138,8 @@ describe('SearchCheckListComponent', () => {
|
|||||||
|
|
||||||
component.ngOnInit();
|
component.ngOnInit();
|
||||||
component.options = new SearchFilterList<SearchListOption>([
|
component.options = new SearchFilterList<SearchListOption>([
|
||||||
{ name: 'Folder', value: "TYPE:'cm:folder'", checked: true },
|
{ name: 'Folder', value: `TYPE:'cm:folder'`, checked: true },
|
||||||
{ name: 'Document', value: "TYPE:'cm:content'", checked: true }
|
{ name: 'Document', value: `TYPE:'cm:content'`, checked: true }
|
||||||
]);
|
]);
|
||||||
|
|
||||||
component.reset();
|
component.reset();
|
||||||
|
|||||||
+7
-7
@@ -37,7 +37,7 @@ describe('SearchTextComponent', () => {
|
|||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
component.id = 'text';
|
component.id = 'text';
|
||||||
component.settings = {
|
component.settings = {
|
||||||
'pattern': "cm:name:'(.*?)'",
|
'pattern': `cm:name:'(.*?)'`,
|
||||||
'field': 'cm:name',
|
'field': 'cm:name',
|
||||||
'placeholder': 'Enter the name'
|
'placeholder': 'Enter the name'
|
||||||
};
|
};
|
||||||
@@ -49,7 +49,7 @@ describe('SearchTextComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should parse value from the context at startup', () => {
|
it('should parse value from the context at startup', () => {
|
||||||
component.context.queryFragments[component.id] = "cm:name:'secret.pdf'";
|
component.context.queryFragments[component.id] = `cm:name:'secret.pdf'`;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
expect(component.value).toEqual('secret.pdf');
|
expect(component.value).toEqual('secret.pdf');
|
||||||
@@ -57,7 +57,7 @@ describe('SearchTextComponent', () => {
|
|||||||
|
|
||||||
it('should not parse value when pattern not defined', () => {
|
it('should not parse value when pattern not defined', () => {
|
||||||
component.settings.pattern = null;
|
component.settings.pattern = null;
|
||||||
component.context.queryFragments[component.id] = "cm:name:'secret.pdf'";
|
component.context.queryFragments[component.id] = `cm:name:'secret.pdf'`;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
expect(component.value).toEqual('');
|
expect(component.value).toEqual('');
|
||||||
@@ -73,7 +73,7 @@ describe('SearchTextComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
expect(component.value).toBe('top-secret.doc');
|
expect(component.value).toBe('top-secret.doc');
|
||||||
expect(component.context.queryFragments[component.id]).toBe("cm:name:'top-secret.doc'");
|
expect(component.context.queryFragments[component.id]).toBe(`cm:name:'top-secret.doc'`);
|
||||||
expect(component.context.update).toHaveBeenCalled();
|
expect(component.context.update).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ describe('SearchTextComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
expect(component.value).toBe('top-secret.doc');
|
expect(component.value).toBe('top-secret.doc');
|
||||||
expect(component.context.queryFragments[component.id]).toBe("cm:name:'top-secret.doc'");
|
expect(component.context.queryFragments[component.id]).toBe(`cm:name:'top-secret.doc'`);
|
||||||
|
|
||||||
component.onChangedHandler({
|
component.onChangedHandler({
|
||||||
target: {
|
target: {
|
||||||
@@ -98,7 +98,7 @@ describe('SearchTextComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should show the custom/default name', async () => {
|
it('should show the custom/default name', async () => {
|
||||||
component.context.queryFragments[component.id] = "cm:name:'secret.pdf'";
|
component.context.queryFragments[component.id] = `cm:name:'secret.pdf'`;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
expect(component.value).toEqual('secret.pdf');
|
expect(component.value).toEqual('secret.pdf');
|
||||||
@@ -107,7 +107,7 @@ describe('SearchTextComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should be able to reset by clicking clear button', async () => {
|
it('should be able to reset by clicking clear button', async () => {
|
||||||
component.context.queryFragments[component.id] = "cm:name:'secret.pdf'";
|
component.context.queryFragments[component.id] = `cm:name:'secret.pdf'`;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
const clearElement = fixture.debugElement.nativeElement.querySelector('button');
|
const clearElement = fixture.debugElement.nativeElement.querySelector('button');
|
||||||
|
|||||||
+1
-1
@@ -107,7 +107,7 @@ export class SearchWidgetContainerComponent implements OnInit, OnDestroy, OnChan
|
|||||||
this.componentRef.instance.submitValues();
|
this.componentRef.instance.submitValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
setValue(currentValue: string | Object) {
|
setValue(currentValue: string | any) {
|
||||||
this.componentRef.instance.isActive = true;
|
this.componentRef.instance.isActive = true;
|
||||||
this.componentRef.instance.setValue(currentValue);
|
this.componentRef.instance.setValue(currentValue);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ import { TranslateModule } from '@ngx-translate/core';
|
|||||||
|
|
||||||
describe('SearchComponent', () => {
|
describe('SearchComponent', () => {
|
||||||
|
|
||||||
let fixture: ComponentFixture<SimpleSearchTestComponent>, element: HTMLElement;
|
let fixture: ComponentFixture<SimpleSearchTestComponent>;
|
||||||
|
let element: HTMLElement;
|
||||||
let component: SimpleSearchTestComponent;
|
let component: SimpleSearchTestComponent;
|
||||||
let searchService: SearchService;
|
let searchService: SearchService;
|
||||||
|
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ export class SearchComponent implements SearchComponentInterface, AfterContentIn
|
|||||||
searchTerm: string = '';
|
searchTerm: string = '';
|
||||||
|
|
||||||
/** CSS class for display. */
|
/** CSS class for display. */
|
||||||
|
// eslint-disable-next-line @angular-eslint/no-input-rename
|
||||||
@Input('class')
|
@Input('class')
|
||||||
set classList(classList: string) {
|
set classList(classList: string) {
|
||||||
if (classList && classList.length) {
|
if (classList && classList.length) {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ describe('Search term validator', () => {
|
|||||||
expect(control.valid).toBe(false);
|
expect(control.valid).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
/* tslint:disable:max-line-length */
|
/* eslint-disable max-len */
|
||||||
it('should fail validation for a value with less than the specified required number of alphanumeric characters but with other non-alphanumeric characters', () => {
|
it('should fail validation for a value with less than the specified required number of alphanumeric characters but with other non-alphanumeric characters', () => {
|
||||||
const control = new FormControl('a ._-?b', SearchTermValidator.minAlphanumericChars(3));
|
const control = new FormControl('a ._-?b', SearchTermValidator.minAlphanumericChars(3));
|
||||||
expect(control.valid).toBe(false);
|
expect(control.valid).toBe(false);
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export class SearchFilterService {
|
|||||||
/**
|
/**
|
||||||
* Contains string-to-type mappings for registered widgets.
|
* Contains string-to-type mappings for registered widgets.
|
||||||
*/
|
*/
|
||||||
widgets: { [id: string]: Type<{}> } = {
|
widgets: { [id: string]: Type<any> } = {
|
||||||
'text': SearchTextComponent,
|
'text': SearchTextComponent,
|
||||||
'radio': SearchRadioComponent,
|
'radio': SearchRadioComponent,
|
||||||
'slider': SearchSliderComponent,
|
'slider': SearchSliderComponent,
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import { RatingServiceInterface } from '../services/rating.service.interface';
|
|||||||
})
|
})
|
||||||
export class RatingServiceMock implements RatingServiceInterface {
|
export class RatingServiceMock implements RatingServiceInterface {
|
||||||
|
|
||||||
getRating(nodeId: string, _ratingType: any): Observable<RatingEntry | {}> {
|
getRating(nodeId: string, _ratingType: any): Observable<RatingEntry | any> {
|
||||||
if (nodeId === 'fake-like-node-id') {
|
if (nodeId === 'fake-like-node-id') {
|
||||||
return of(ratingOneMock);
|
return of(ratingOneMock);
|
||||||
}
|
}
|
||||||
@@ -34,7 +34,7 @@ export class RatingServiceMock implements RatingServiceInterface {
|
|||||||
return of(ratingThreeMock);
|
return of(ratingThreeMock);
|
||||||
}
|
}
|
||||||
|
|
||||||
postRating(nodeId: string, _ratingType: string, _vote: any): Observable<RatingEntry | {}> {
|
postRating(nodeId: string, _ratingType: string, _vote: any): Observable<RatingEntry | any> {
|
||||||
if (nodeId === 'ratingOneMock') {
|
if (nodeId === 'ratingOneMock') {
|
||||||
ratingOneMock.entry.aggregate.numberOfRatings = 1;
|
ratingOneMock.entry.aggregate.numberOfRatings = 1;
|
||||||
ratingOneMock.entry.aggregate.average = 1.0;
|
ratingOneMock.entry.aggregate.average = 1.0;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, EventEmitter, Input, OnChanges, Output, ViewEncapsulation } from '@angular/core';
|
import { Component, EventEmitter, Input, OnChanges, OnDestroy, Output, ViewEncapsulation } from '@angular/core';
|
||||||
import { RatingService } from './services/rating.service';
|
import { RatingService } from './services/rating.service';
|
||||||
import { RatingEntry } from '@alfresco/js-api';
|
import { RatingEntry } from '@alfresco/js-api';
|
||||||
import { takeUntil } from 'rxjs/operators';
|
import { takeUntil } from 'rxjs/operators';
|
||||||
@@ -27,7 +27,7 @@ import { Subject } from 'rxjs';
|
|||||||
templateUrl: './rating.component.html',
|
templateUrl: './rating.component.html',
|
||||||
encapsulation: ViewEncapsulation.None
|
encapsulation: ViewEncapsulation.None
|
||||||
})
|
})
|
||||||
export class RatingComponent implements OnChanges {
|
export class RatingComponent implements OnChanges, OnDestroy {
|
||||||
|
|
||||||
/** Identifier of the node to apply the rating to. */
|
/** Identifier of the node to apply the rating to. */
|
||||||
@Input()
|
@Input()
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import { Observable } from 'rxjs';
|
|||||||
|
|
||||||
export interface RatingServiceInterface {
|
export interface RatingServiceInterface {
|
||||||
|
|
||||||
getRating(nodeId: string, ratingType: any): Observable<RatingEntry | {}>;
|
getRating(nodeId: string, ratingType: any): Observable<RatingEntry | any>;
|
||||||
postRating(nodeId: string, ratingType: string, vote: any): Observable<RatingEntry | {}>;
|
postRating(nodeId: string, ratingType: string, vote: any): Observable<RatingEntry | any>;
|
||||||
deleteRating(nodeId: string, ratingType: any): Observable<any>;
|
deleteRating(nodeId: string, ratingType: any): Observable<any>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ export class RatingService implements RatingServiceInterface {
|
|||||||
* @param ratingType Type of rating (can be "likes" or "fiveStar")
|
* @param ratingType Type of rating (can be "likes" or "fiveStar")
|
||||||
* @returns The rating value
|
* @returns The rating value
|
||||||
*/
|
*/
|
||||||
getRating(nodeId: string, ratingType: any): Observable<RatingEntry | {}> {
|
getRating(nodeId: string, ratingType: any): Observable<RatingEntry | any> {
|
||||||
return from(this.ratingsApi.getRating(nodeId, ratingType))
|
return from(this.ratingsApi.getRating(nodeId, ratingType))
|
||||||
.pipe(
|
.pipe(
|
||||||
catchError(this.handleError)
|
catchError(this.handleError)
|
||||||
@@ -56,7 +56,7 @@ export class RatingService implements RatingServiceInterface {
|
|||||||
* @param vote Rating value (boolean for "likes", numeric 0..5 for "fiveStar")
|
* @param vote Rating value (boolean for "likes", numeric 0..5 for "fiveStar")
|
||||||
* @returns Details about the rating, including the new value
|
* @returns Details about the rating, including the new value
|
||||||
*/
|
*/
|
||||||
postRating(nodeId: string, ratingType: string, vote: any): Observable<RatingEntry | {}> {
|
postRating(nodeId: string, ratingType: string, vote: any): Observable<RatingEntry | any> {
|
||||||
const ratingBody: RatingBody = new RatingBody({
|
const ratingBody: RatingBody = new RatingBody({
|
||||||
'id': ratingType,
|
'id': ratingType,
|
||||||
'myRating': vote
|
'myRating': vote
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import { TagBody, TagPaging, TagEntry, TagsApi } from '@alfresco/js-api';
|
|||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
// tslint:disable-next-line: directive-class-suffix
|
// eslint-disable-next-line @angular-eslint/directive-class-suffix
|
||||||
export class TagService {
|
export class TagService {
|
||||||
|
|
||||||
_tagsApi: TagsApi;
|
_tagsApi: TagsApi;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import { UploadFilesEvent } from '../upload-files.event';
|
|||||||
import { takeUntil } from 'rxjs/operators';
|
import { takeUntil } from 'rxjs/operators';
|
||||||
|
|
||||||
@Directive()
|
@Directive()
|
||||||
// tslint:disable-next-line: directive-class-suffix
|
// eslint-disable-next-line @angular-eslint/directive-class-suffix
|
||||||
export abstract class UploadBase implements OnInit, OnDestroy {
|
export abstract class UploadBase implements OnInit, OnDestroy {
|
||||||
|
|
||||||
/** Sets a limit on the maximum size (in bytes) of a file to be uploaded.
|
/** Sets a limit on the maximum size (in bytes) of a file to be uploaded.
|
||||||
|
|||||||
@@ -72,11 +72,10 @@ export class UploadDragAreaComponent extends UploadBase implements NodeAllowable
|
|||||||
* @param latestFilesAdded - files in the upload queue enriched with status flag and xhr object.
|
* @param latestFilesAdded - files in the upload queue enriched with status flag and xhr object.
|
||||||
*/
|
*/
|
||||||
showUndoNotificationBar(latestFilesAdded: FileModel[]) {
|
showUndoNotificationBar(latestFilesAdded: FileModel[]) {
|
||||||
let messageTranslate: any, actionTranslate: any;
|
const messageTranslate = this.translationService.instant('FILE_UPLOAD.MESSAGES.PROGRESS');
|
||||||
messageTranslate = this.translationService.get('FILE_UPLOAD.MESSAGES.PROGRESS');
|
const actionTranslate = this.translationService.instant('FILE_UPLOAD.ACTION.UNDO');
|
||||||
actionTranslate = this.translationService.get('FILE_UPLOAD.ACTION.UNDO');
|
|
||||||
|
|
||||||
this.notificationService.openSnackMessageAction(messageTranslate.value, actionTranslate.value, 3000).onAction().subscribe(() => {
|
this.notificationService.openSnackMessageAction(messageTranslate, actionTranslate, 3000).onAction().subscribe(() => {
|
||||||
this.uploadService.cancelUpload(...latestFilesAdded);
|
this.uploadService.cancelUpload(...latestFilesAdded);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* tslint:disable:no-input-rename */
|
/* eslint-disable @angular-eslint/no-input-rename */
|
||||||
|
|
||||||
import { FileUtils } from '@alfresco/adf-core';
|
import { FileUtils } from '@alfresco/adf-core';
|
||||||
import { Directive, ElementRef, EventEmitter, Input, NgZone, OnDestroy, OnInit, Output } from '@angular/core';
|
import { Directive, ElementRef, EventEmitter, Input, NgZone, OnDestroy, OnInit, Output } from '@angular/core';
|
||||||
|
|||||||
@@ -0,0 +1,110 @@
|
|||||||
|
{
|
||||||
|
"extends": "../../.eslintrc.json",
|
||||||
|
"ignorePatterns": [
|
||||||
|
"!**/*"
|
||||||
|
],
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": [
|
||||||
|
"*.ts"
|
||||||
|
],
|
||||||
|
"parserOptions": {
|
||||||
|
"project": [
|
||||||
|
"lib/extensions/tsconfig.lib.json",
|
||||||
|
"lib/extensions/tsconfig.spec.json"
|
||||||
|
],
|
||||||
|
"createDefaultProgram": true
|
||||||
|
},
|
||||||
|
"plugins": [
|
||||||
|
"eslint-plugin-unicorn",
|
||||||
|
"eslint-plugin-rxjs"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"jsdoc/newline-after-description": "warn",
|
||||||
|
"@typescript-eslint/naming-convention": "warn",
|
||||||
|
"@typescript-eslint/consistent-type-assertions": "warn",
|
||||||
|
"@typescript-eslint/prefer-for-of": "warn",
|
||||||
|
"no-underscore-dangle": "warn",
|
||||||
|
"no-shadow": "warn",
|
||||||
|
"quote-props": "warn",
|
||||||
|
"object-shorthand": "warn",
|
||||||
|
"prefer-const": "warn",
|
||||||
|
"arrow-body-style": "warn",
|
||||||
|
"@angular-eslint/no-output-native": "warn",
|
||||||
|
"space-before-function-paren": "warn",
|
||||||
|
|
||||||
|
"@angular-eslint/component-selector": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"type": "element",
|
||||||
|
"prefix": [
|
||||||
|
"adf",
|
||||||
|
"app"
|
||||||
|
],
|
||||||
|
"style": "kebab-case"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@angular-eslint/directive-selector": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"type": [
|
||||||
|
"element",
|
||||||
|
"attribute"
|
||||||
|
],
|
||||||
|
"prefix": [
|
||||||
|
"adf",
|
||||||
|
"app"
|
||||||
|
],
|
||||||
|
"style": "kebab-case"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@angular-eslint/no-host-metadata-property": "off",
|
||||||
|
"@angular-eslint/no-input-prefix": "error",
|
||||||
|
"@typescript-eslint/consistent-type-definitions": "error",
|
||||||
|
"@typescript-eslint/dot-notation": "off",
|
||||||
|
"@typescript-eslint/explicit-member-accessibility": [
|
||||||
|
"off",
|
||||||
|
{
|
||||||
|
"accessibility": "explicit"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@typescript-eslint/no-floating-promises": "off",
|
||||||
|
"@typescript-eslint/no-inferrable-types": "off",
|
||||||
|
"@typescript-eslint/no-require-imports": "off",
|
||||||
|
"@typescript-eslint/no-var-requires": "error",
|
||||||
|
"brace-style": [
|
||||||
|
"error",
|
||||||
|
"1tbs"
|
||||||
|
],
|
||||||
|
"comma-dangle": "error",
|
||||||
|
"default-case": "error",
|
||||||
|
"import/order": "off",
|
||||||
|
"max-len": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"code": 240
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"no-bitwise": "off",
|
||||||
|
"no-duplicate-imports": "error",
|
||||||
|
"no-multiple-empty-lines": "error",
|
||||||
|
"no-redeclare": "error",
|
||||||
|
"no-return-await": "error",
|
||||||
|
"rxjs/no-create": "error",
|
||||||
|
"rxjs/no-subject-unsubscribe": "error",
|
||||||
|
"rxjs/no-subject-value": "error",
|
||||||
|
"rxjs/no-unsafe-takeuntil": "error",
|
||||||
|
"unicorn/filename-case": "error"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"files": [
|
||||||
|
"*.html"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"@angular-eslint/template/no-autofocus": "error",
|
||||||
|
"@angular-eslint/template/no-positive-tabindex": "error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* tslint:disable:component-selector */
|
/* eslint-disable @angular-eslint/component-selector */
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ export function reduceEmptyMenus(
|
|||||||
return acc.concat(el);
|
return acc.concat(el);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function mergeObjects(...objects: object[]): any {
|
export function mergeObjects(...objects: any[]): any {
|
||||||
const result = {};
|
const result = {};
|
||||||
|
|
||||||
objects.forEach((source) => {
|
objects.forEach((source) => {
|
||||||
|
|||||||
@@ -23,16 +23,16 @@ export interface ExtensionComponent {
|
|||||||
|
|
||||||
@Injectable({ providedIn: 'root' })
|
@Injectable({ providedIn: 'root' })
|
||||||
export class ComponentRegisterService {
|
export class ComponentRegisterService {
|
||||||
components: { [key: string]: Type<{}> } = {};
|
components: { [key: string]: Type<any> } = {};
|
||||||
|
|
||||||
setComponents(values: { [key: string]: Type<{}> }) {
|
setComponents(values: { [key: string]: Type<any> }) {
|
||||||
if (values) {
|
if (values) {
|
||||||
this.components = Object.assign({}, this.components, values);
|
this.components = Object.assign({}, this.components, values);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getComponentById<T>(id: string): Type<T> {
|
getComponentById<T>(id: string): Type<T> {
|
||||||
return <Type<T>> this.components[id];
|
return this.components[id];
|
||||||
}
|
}
|
||||||
|
|
||||||
hasComponentById(id: string): boolean {
|
hasComponentById(id: string): boolean {
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ export class ExtensionService {
|
|||||||
routes: Array<RouteRef> = [];
|
routes: Array<RouteRef> = [];
|
||||||
actions: Array<ActionRef> = [];
|
actions: Array<ActionRef> = [];
|
||||||
features: Array<any> = [];
|
features: Array<any> = [];
|
||||||
authGuards: { [key: string]: Type<{}> } = {};
|
authGuards: { [key: string]: Type<any> } = {};
|
||||||
|
|
||||||
protected onSetup$ = new BehaviorSubject<ExtensionConfig>(this.config);
|
protected onSetup$ = new BehaviorSubject<ExtensionConfig>(this.config);
|
||||||
setup$ = this.onSetup$.asObservable();
|
setup$ = this.onSetup$.asObservable();
|
||||||
@@ -72,6 +72,7 @@ export class ExtensionService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads and registers an extension config file and plugins (specified by path properties).
|
* Loads and registers an extension config file and plugins (specified by path properties).
|
||||||
|
*
|
||||||
* @returns The loaded config data
|
* @returns The loaded config data
|
||||||
*/
|
*/
|
||||||
async load(): Promise<ExtensionConfig> {
|
async load(): Promise<ExtensionConfig> {
|
||||||
@@ -86,6 +87,7 @@ export class ExtensionService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers extensions from a config object.
|
* Registers extensions from a config object.
|
||||||
|
*
|
||||||
* @param config Object with config data
|
* @param config Object with config data
|
||||||
*/
|
*/
|
||||||
setup(config: ExtensionConfig) {
|
setup(config: ExtensionConfig) {
|
||||||
@@ -112,6 +114,7 @@ export class ExtensionService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets features by key.
|
* Gets features by key.
|
||||||
|
*
|
||||||
* @param key Key string, using dot notation
|
* @param key Key string, using dot notation
|
||||||
* @returns Features array found by key
|
* @returns Features array found by key
|
||||||
*/
|
*/
|
||||||
@@ -126,6 +129,7 @@ export class ExtensionService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds one or more new rule evaluators to the existing set.
|
* Adds one or more new rule evaluators to the existing set.
|
||||||
|
*
|
||||||
* @param values The new evaluators to add
|
* @param values The new evaluators to add
|
||||||
*/
|
*/
|
||||||
setEvaluators(values: { [key: string]: RuleEvaluator }) {
|
setEvaluators(values: { [key: string]: RuleEvaluator }) {
|
||||||
@@ -134,9 +138,10 @@ export class ExtensionService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds one or more new auth guards to the existing set.
|
* Adds one or more new auth guards to the existing set.
|
||||||
|
*
|
||||||
* @param values The new auth guards to add
|
* @param values The new auth guards to add
|
||||||
*/
|
*/
|
||||||
setAuthGuards(values: { [key: string]: Type<{}> }) {
|
setAuthGuards(values: { [key: string]: Type<any> }) {
|
||||||
if (values) {
|
if (values) {
|
||||||
this.authGuards = Object.assign({}, this.authGuards, values);
|
this.authGuards = Object.assign({}, this.authGuards, values);
|
||||||
}
|
}
|
||||||
@@ -144,14 +149,16 @@ export class ExtensionService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds one or more new components to the existing set.
|
* Adds one or more new components to the existing set.
|
||||||
|
*
|
||||||
* @param values The new components to add
|
* @param values The new components to add
|
||||||
*/
|
*/
|
||||||
setComponents(values: { [key: string]: Type<{}> }) {
|
setComponents(values: { [key: string]: Type<any> }) {
|
||||||
this.componentRegister.setComponents(values);
|
this.componentRegister.setComponents(values);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves a route using its ID value.
|
* Retrieves a route using its ID value.
|
||||||
|
*
|
||||||
* @param id The ID value to look for
|
* @param id The ID value to look for
|
||||||
* @returns The route or null if not found
|
* @returns The route or null if not found
|
||||||
*/
|
*/
|
||||||
@@ -161,10 +168,11 @@ export class ExtensionService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves one or more auth guards using an array of ID values.
|
* Retrieves one or more auth guards using an array of ID values.
|
||||||
|
*
|
||||||
* @param ids Array of ID value to look for
|
* @param ids Array of ID value to look for
|
||||||
* @returns Array of auth guards or empty array if none were found
|
* @returns Array of auth guards or empty array if none were found
|
||||||
*/
|
*/
|
||||||
getAuthGuards(ids: string[]): Array<Type<{}>> {
|
getAuthGuards(ids: string[]): Array<Type<any>> {
|
||||||
return (ids || [])
|
return (ids || [])
|
||||||
.map((id) => this.authGuards[id])
|
.map((id) => this.authGuards[id])
|
||||||
.filter((guard) => guard);
|
.filter((guard) => guard);
|
||||||
@@ -172,6 +180,7 @@ export class ExtensionService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves an action using its ID value.
|
* Retrieves an action using its ID value.
|
||||||
|
*
|
||||||
* @param id The ID value to look for
|
* @param id The ID value to look for
|
||||||
* @returns Action or null if not found
|
* @returns Action or null if not found
|
||||||
*/
|
*/
|
||||||
@@ -181,6 +190,7 @@ export class ExtensionService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves a RuleEvaluator function using its key name.
|
* Retrieves a RuleEvaluator function using its key name.
|
||||||
|
*
|
||||||
* @param key Key name to look for
|
* @param key Key name to look for
|
||||||
* @returns RuleEvaluator or null if not found
|
* @returns RuleEvaluator or null if not found
|
||||||
*/
|
*/
|
||||||
@@ -190,6 +200,7 @@ export class ExtensionService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Evaluates a rule.
|
* Evaluates a rule.
|
||||||
|
*
|
||||||
* @param ruleId ID of the rule to evaluate
|
* @param ruleId ID of the rule to evaluate
|
||||||
* @param context Custom rule execution context.
|
* @param context Custom rule execution context.
|
||||||
* @returns True if the rule passed, false otherwise
|
* @returns True if the rule passed, false otherwise
|
||||||
@@ -200,6 +211,7 @@ export class ExtensionService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves a registered extension component using its ID value.
|
* Retrieves a registered extension component using its ID value.
|
||||||
|
*
|
||||||
* @param id The ID value to look for
|
* @param id The ID value to look for
|
||||||
* @returns The component or null if not found
|
* @returns The component or null if not found
|
||||||
*/
|
*/
|
||||||
@@ -209,6 +221,7 @@ export class ExtensionService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves a rule using its ID value.
|
* Retrieves a rule using its ID value.
|
||||||
|
*
|
||||||
* @param id The ID value to look for
|
* @param id The ID value to look for
|
||||||
* @returns The rule or null if not found
|
* @returns The rule or null if not found
|
||||||
*/
|
*/
|
||||||
@@ -218,11 +231,12 @@ export class ExtensionService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs a lightweight expression stored in a string.
|
* Runs a lightweight expression stored in a string.
|
||||||
|
*
|
||||||
* @param value String containing the expression or literal value
|
* @param value String containing the expression or literal value
|
||||||
* @param context Parameter object for the expression with details of app state
|
* @param context Parameter object for the expression with details of app state
|
||||||
* @returns Result of evaluated expression, if found, or the literal value otherwise
|
* @returns Result of evaluated expression, if found, or the literal value otherwise
|
||||||
*/
|
*/
|
||||||
runExpression(value: string | {} , context?: any) {
|
runExpression(value: string | any , context?: any) {
|
||||||
if (typeof value === 'string' ) {
|
if (typeof value === 'string' ) {
|
||||||
return this.evaluateExpression(value, context);
|
return this.evaluateExpression(value, context);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -17,6 +17,6 @@
|
|||||||
|
|
||||||
import { AppExtensionService } from './app-extension.service';
|
import { AppExtensionService } from './app-extension.service';
|
||||||
|
|
||||||
export function setupExtensions(appExtensionService: AppExtensionService): Function {
|
export function setupExtensions(appExtensionService: AppExtensionService) {
|
||||||
return () => appExtensionService.load();
|
return () => appExtensionService.load();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,110 @@
|
|||||||
|
{
|
||||||
|
"extends": "../../.eslintrc.json",
|
||||||
|
"ignorePatterns": [
|
||||||
|
"!**/*"
|
||||||
|
],
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": [
|
||||||
|
"*.ts"
|
||||||
|
],
|
||||||
|
"parserOptions": {
|
||||||
|
"project": [
|
||||||
|
"lib/insights/tsconfig.lib.json",
|
||||||
|
"lib/insights/tsconfig.spec.json"
|
||||||
|
],
|
||||||
|
"createDefaultProgram": true
|
||||||
|
},
|
||||||
|
"plugins": [
|
||||||
|
"eslint-plugin-unicorn",
|
||||||
|
"eslint-plugin-rxjs"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"jsdoc/newline-after-description": "warn",
|
||||||
|
"@typescript-eslint/naming-convention": "warn",
|
||||||
|
"@typescript-eslint/consistent-type-assertions": "warn",
|
||||||
|
"@typescript-eslint/prefer-for-of": "warn",
|
||||||
|
"no-underscore-dangle": "warn",
|
||||||
|
"no-shadow": "warn",
|
||||||
|
"quote-props": "warn",
|
||||||
|
"object-shorthand": "warn",
|
||||||
|
"prefer-const": "warn",
|
||||||
|
"arrow-body-style": "warn",
|
||||||
|
"@angular-eslint/no-output-native": "warn",
|
||||||
|
"space-before-function-paren": "warn",
|
||||||
|
|
||||||
|
"@angular-eslint/component-selector": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"type": "element",
|
||||||
|
"prefix": [
|
||||||
|
"adf",
|
||||||
|
"app"
|
||||||
|
],
|
||||||
|
"style": "kebab-case"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@angular-eslint/directive-selector": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"type": [
|
||||||
|
"element",
|
||||||
|
"attribute"
|
||||||
|
],
|
||||||
|
"prefix": [
|
||||||
|
"adf",
|
||||||
|
"app"
|
||||||
|
],
|
||||||
|
"style": "kebab-case"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@angular-eslint/no-host-metadata-property": "off",
|
||||||
|
"@angular-eslint/no-input-prefix": "error",
|
||||||
|
"@typescript-eslint/consistent-type-definitions": "error",
|
||||||
|
"@typescript-eslint/dot-notation": "off",
|
||||||
|
"@typescript-eslint/explicit-member-accessibility": [
|
||||||
|
"off",
|
||||||
|
{
|
||||||
|
"accessibility": "explicit"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@typescript-eslint/no-floating-promises": "off",
|
||||||
|
"@typescript-eslint/no-inferrable-types": "off",
|
||||||
|
"@typescript-eslint/no-require-imports": "off",
|
||||||
|
"@typescript-eslint/no-var-requires": "error",
|
||||||
|
"brace-style": [
|
||||||
|
"error",
|
||||||
|
"1tbs"
|
||||||
|
],
|
||||||
|
"comma-dangle": "error",
|
||||||
|
"default-case": "error",
|
||||||
|
"import/order": "off",
|
||||||
|
"max-len": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"code": 240
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"no-bitwise": "off",
|
||||||
|
"no-duplicate-imports": "error",
|
||||||
|
"no-multiple-empty-lines": "error",
|
||||||
|
"no-redeclare": "error",
|
||||||
|
"no-return-await": "error",
|
||||||
|
"rxjs/no-create": "error",
|
||||||
|
"rxjs/no-subject-unsubscribe": "error",
|
||||||
|
"rxjs/no-subject-value": "error",
|
||||||
|
"rxjs/no-unsafe-takeuntil": "error",
|
||||||
|
"unicorn/filename-case": "error"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"files": [
|
||||||
|
"*.html"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"@angular-eslint/template/no-autofocus": "error",
|
||||||
|
"@angular-eslint/template/no-positive-tabindex": "error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
-1
@@ -11,7 +11,6 @@
|
|||||||
type="text"
|
type="text"
|
||||||
class="adf-edit-report-title"
|
class="adf-edit-report-title"
|
||||||
id="reportName"
|
id="reportName"
|
||||||
autofocus
|
|
||||||
data-automation-id="reportName"
|
data-automation-id="reportName"
|
||||||
[value]="reportParameters.name"
|
[value]="reportParameters.name"
|
||||||
(input)="reportParameters.name=$any($event).target.value"
|
(input)="reportParameters.name=$any($event).target.value"
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* tslint:disable:component-selector no-access-missing-member no-input-rename */
|
/* eslint-disable @angular-eslint/component-selector, @angular-eslint/no-input-rename */
|
||||||
|
|
||||||
import { Component, ElementRef, Input, ViewEncapsulation } from '@angular/core';
|
import { Component, ElementRef, Input, ViewEncapsulation } from '@angular/core';
|
||||||
import { FormGroup } from '@angular/forms';
|
import { FormGroup } from '@angular/forms';
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* tslint:disable:no-input-rename */
|
/* eslint-disable @angular-eslint/no-input-rename */
|
||||||
|
|
||||||
import { MOMENT_DATE_FORMATS, MomentDateAdapter, UserPreferencesService, UserPreferenceValues } from '@alfresco/adf-core';
|
import { MOMENT_DATE_FORMATS, MomentDateAdapter, UserPreferencesService, UserPreferenceValues } from '@alfresco/adf-core';
|
||||||
import { Component, EventEmitter, Input, OnInit, Output, ViewEncapsulation, OnDestroy } from '@angular/core';
|
import { Component, EventEmitter, Input, OnInit, Output, ViewEncapsulation, OnDestroy } from '@angular/core';
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* tslint:disable:component-selector no-access-missing-member no-input-rename */
|
/* eslint-disable @angular-eslint/component-selector, @angular-eslint/no-input-rename */
|
||||||
|
|
||||||
import { Component, EventEmitter, Input, OnInit, Output, ViewEncapsulation } from '@angular/core';
|
import { Component, EventEmitter, Input, OnInit, Output, ViewEncapsulation } from '@angular/core';
|
||||||
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* tslint:disable:component-selector no-access-missing-member no-input-rename */
|
/* eslint-disable @angular-eslint/component-selector, @angular-eslint/no-input-rename */
|
||||||
|
|
||||||
import { Component, ElementRef, Input, OnInit, ViewEncapsulation } from '@angular/core';
|
import { Component, ElementRef, Input, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* tslint:disable:component-selector no-access-missing-member no-input-rename */
|
/* eslint-disable @angular-eslint/component-selector, @angular-eslint/no-input-rename */
|
||||||
|
|
||||||
import { Component, ElementRef, Input, OnInit, ViewEncapsulation } from '@angular/core';
|
import { Component, ElementRef, Input, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { FormGroup, Validators } from '@angular/forms';
|
import { FormGroup, Validators } from '@angular/forms';
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
import { EventEmitter, Input, OnChanges, Output, SimpleChanges, Directive } from '@angular/core';
|
import { EventEmitter, Input, OnChanges, Output, SimpleChanges, Directive } from '@angular/core';
|
||||||
|
|
||||||
@Directive()
|
@Directive()
|
||||||
// tslint:disable-next-line: directive-class-suffix
|
// eslint-disable-next-line @angular-eslint/directive-class-suffix
|
||||||
export class WidgetComponent implements OnChanges {
|
export class WidgetComponent implements OnChanges {
|
||||||
|
|
||||||
/** field. */
|
/** field. */
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* tslint:disable:component-selector */
|
/* eslint-disable @angular-eslint/component-selector */
|
||||||
|
|
||||||
import { Component, ElementRef, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
import { Component, ElementRef, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* tslint:disable:component-selector */
|
/* eslint-disable @angular-eslint/component-selector */
|
||||||
|
|
||||||
import { Component, ElementRef, EventEmitter, Input, Output } from '@angular/core';
|
import { Component, ElementRef, EventEmitter, Input, Output } from '@angular/core';
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* tslint:disable:component-selector */
|
/* eslint-disable @angular-eslint/component-selector */
|
||||||
|
|
||||||
import { Component, ElementRef, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
import { Component, ElementRef, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* tslint:disable:component-selector */
|
/* eslint-disable @angular-eslint/component-selector */
|
||||||
|
|
||||||
import { Component, ElementRef, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
import { Component, ElementRef, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* tslint:disable:component-selector */
|
/* eslint-disable @angular-eslint/component-selector */
|
||||||
|
|
||||||
import { Component, ElementRef, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
import { Component, ElementRef, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user