[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:
Denys Vuika
2022-02-03 11:01:54 +00:00
committed by GitHub
parent b8bb234410
commit 8dc736e8f0
233 changed files with 1496 additions and 725 deletions
+104
View File
@@ -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"
}
}
]
}
+1 -1
View File
@@ -38,7 +38,7 @@ function zipArtifact(output: string) {
logger.info(response);
}
export default function () {
export default function() {
main();
}
+1 -1
View File
@@ -34,7 +34,7 @@ function awsCp(output: string) {
logger.info(response);
}
export default function () {
export default function() {
main();
}
+2 -2
View File
@@ -54,7 +54,7 @@ export default function main(_args: string[], workingDir: string) {
}
return new Promise((resolve, reject) => {
// tslint:disable-next-line: no-console
// eslint-disable-next-line no-console
console.log(`Running audit on ${packagePath}`);
const packageJson = JSON.parse(fs.readFileSync(packagePath).toString());
@@ -75,7 +75,7 @@ export default function main(_args: string[], workingDir: string) {
fs.writeFileSync(outputFile, mdText);
// tslint:disable-next-line: no-console
// eslint-disable-next-line no-console
console.log(`Report saved as ${outputFile}`);
resolve(0);
}
+3 -1
View File
@@ -56,6 +56,7 @@ interface DiffOptions {
/**
* Get the remote URL for the cloned git repository
*
* @param workingDir Repository directory
* @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
*
* @param options Logging options
* @returns Collection of Commit objects
*/
@@ -78,7 +80,7 @@ function getCommits(options: DiffOptions): Array<Commit> {
.join('\|');
if (!authorFilter) {
authorFilter = "bot\|Alfresco Build User";
authorFilter = `bot\|Alfresco Build User`;
}
+2 -2
View File
@@ -1,9 +1,9 @@
/* tslint:disable */
/* eslint-disable */
const alfrescoApi = require('@alfresco/js-api');
const program = require('commander');
const path = require('path');
const fs = require('fs');
/* tslint:enable */
/* eslint-enable */
import { logger } from './logger';
const MAX_RETRY = 3;
const TIMEOUT = 20000;
+2 -2
View File
@@ -1,7 +1,7 @@
/* tslint:disable */
/* eslint-disable */
const alfrescoApi = require('@alfresco/js-api');
const program = require('commander');
/* tslint:enable */
/* eslint-enable */
import { logger } from './logger';
const MAX_RETRY = 10;
const TIMEOUT = 60000;
+1 -1
View File
@@ -19,6 +19,6 @@
import * as docker from './docker';
export default function (args: any) {
export default function(args: any) {
docker.default(args);
}
+3 -3
View File
@@ -50,9 +50,9 @@ function loginPerform(args: PublishArgs) {
function buildImagePerform(args: PublishArgs, tag: string) {
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}`);
} else {
args.buildArgs.forEach((envVar) => {
@@ -88,7 +88,7 @@ function cleanImagePerform(args: PublishArgs, tag: string) {
logger.info(response);
}
export default function (args: PublishArgs) {
export default function(args: PublishArgs) {
main(args);
}
+90 -48
View File
@@ -19,13 +19,13 @@
import * as program from 'commander';
/* tslint:disable */
/* eslint-disable */
import request = require('request');
import * as fs from 'fs';
import { logger } from './logger';
import { AlfrescoApi } from '@alfresco/js-api';
const ACTIVITI_CLOUD_APPS = require('./resources').ACTIVITI_CLOUD_APPS;
/* tslint:enable */
/* eslint-enable */
let alfrescoJsApiModeler: any;
let alfrescoJsApiDevops: any;
@@ -53,9 +53,14 @@ export const AAE_MICROSERVICES = [
async function healthCheck(nameService: string) {
const url = `${args.host}/${nameService}/actuator/health`;
const pathParams = {}, queryParams = {},
headerParams = {}, formParams = {}, bodyParam = {},
contentTypes = ['application/json'], accepts = ['application/json'];
const pathParams = {};
const queryParams = {};
const headerParams = {};
const formParams = {};
const bodyParam = {};
const contentTypes = ['application/json'];
const accepts = ['application/json'];
try {
const health = await alfrescoJsApiModeler.oauth2Auth.callCustomApi(url, 'GET', pathParams, queryParams, headerParams, formParams, bodyParam,
contentTypes, accepts);
@@ -63,7 +68,8 @@ async function healthCheck(nameService: string) {
logger.error(`${nameService} is DOWN `);
isValid = false;
} else {
const reset = '\x1b[0m', green = '\x1b[32m';
const reset = '\x1b[0m';
const green = '\x1b[32m';
logger.info(`${green}${nameService} is UP!${reset}`);
}
} catch (error) {
@@ -75,9 +81,14 @@ async function healthCheck(nameService: string) {
async function getApplicationByStatus(status: string) {
const url = `${args.host}/deployment-service/v1/applications/`;
const pathParams = {}, queryParams = { status: status },
headerParams = {}, formParams = {}, bodyParam = {},
contentTypes = ['application/json'], accepts = ['application/json'];
const pathParams = {};
const queryParams = { status };
const headerParams = {};
const formParams = {};
const bodyParam = {};
const contentTypes = ['application/json'];
const accepts = ['application/json'];
try {
await alfrescoJsApiDevops.login(args.devopsUsername, args.devopsPassword);
@@ -95,9 +106,14 @@ async function getApplicationByStatus(status: string) {
function getDescriptors() {
const url = `${args.host}/deployment-service/v1/descriptors`;
const pathParams = {}, queryParams = {},
headerParams = {}, formParams = {}, bodyParam = {},
contentTypes = ['application/json'], accepts = ['application/json'];
const pathParams = {};
const queryParams = {};
const headerParams = {};
const formParams = {};
const bodyParam = {};
const contentTypes = ['application/json'];
const accepts = ['application/json'];
try {
return alfrescoJsApiDevops.oauth2Auth.callCustomApi(url, 'GET', pathParams, queryParams, headerParams, formParams, bodyParam,
contentTypes, accepts);
@@ -111,9 +127,14 @@ function getDescriptors() {
function getProjects() {
const url = `${args.host}/modeling-service/v1/projects`;
const pathParams = {}, queryParams = { maxItems: 1000 },
headerParams = {}, formParams = {}, bodyParam = {},
contentTypes = ['application/json'], accepts = ['application/json'];
const pathParams = {};
const queryParams = { maxItems: 1000 };
const headerParams = {};
const formParams = {};
const bodyParam = {};
const contentTypes = ['application/json'];
const accepts = ['application/json'];
try {
return alfrescoJsApiModeler.oauth2Auth.callCustomApi(url, 'GET', pathParams, queryParams, headerParams, formParams, bodyParam,
contentTypes, accepts);
@@ -127,9 +148,14 @@ function getProjects() {
function getProjectRelease(projectId: string) {
const url = `${args.host}/modeling-service/v1/projects/${projectId}/releases`;
const pathParams = {}, queryParams = {},
headerParams = {}, formParams = {}, bodyParam = {},
contentTypes = ['application/json'], accepts = ['application/json'];
const pathParams = {};
const queryParams = {};
const headerParams = {};
const formParams = {};
const bodyParam = {};
const contentTypes = ['application/json'];
const accepts = ['application/json'];
try {
return alfrescoJsApiModeler.oauth2Auth.callCustomApi(url, 'GET', pathParams, queryParams, headerParams, formParams, bodyParam,
contentTypes, accepts);
@@ -143,9 +169,14 @@ function getProjectRelease(projectId: string) {
async function releaseProject(projectId: string) {
const url = `${args.host}/modeling-service/v1/projects/${projectId}/releases`;
const pathParams = {}, queryParams = {},
headerParams = {}, formParams = {}, bodyParam = {},
contentTypes = ['application/json'], accepts = ['application/json'];
const pathParams = {};
const queryParams = {};
const headerParams = {};
const formParams = {};
const bodyParam = {};
const contentTypes = ['application/json'];
const accepts = ['application/json'];
try {
return alfrescoJsApiModeler.oauth2Auth.callCustomApi(url, 'POST', pathParams, queryParams, headerParams, formParams, bodyParam,
contentTypes, accepts);
@@ -160,9 +191,14 @@ async function releaseProject(projectId: string) {
function deleteProject(projectId: string) {
const url = `${args.host}/modeling-service/v1/projects/${projectId}`;
const pathParams = {}, queryParams = {},
headerParams = {}, formParams = {}, bodyParam = {},
contentTypes = ['application/json'], accepts = ['application/json'];
const pathParams = {};
const queryParams = {};
const headerParams = {};
const formParams = {};
const bodyParam = {};
const contentTypes = ['application/json'];
const accepts = ['application/json'];
try {
return alfrescoJsApiModeler.oauth2Auth.callCustomApi(url, 'DELETE', pathParams, queryParams, headerParams, formParams, bodyParam,
contentTypes, accepts);
@@ -194,9 +230,14 @@ async function importAndReleaseProject(absoluteFilePath: string) {
function deleteDescriptor(name: string) {
const url = `${args.host}/deployment-service/v1/descriptors/${name}`;
const pathParams = {}, queryParams = {},
headerParams = {}, formParams = {}, bodyParam = {},
contentTypes = ['application/json'], accepts = ['application/json'];
const pathParams = {};
const queryParams = {};
const headerParams = {};
const formParams = {};
const bodyParam = {};
const contentTypes = ['application/json'];
const accepts = ['application/json'];
try {
return alfrescoJsApiDevops.oauth2Auth.callCustomApi(url, 'DELETE', pathParams, queryParams, headerParams, formParams, bodyParam,
contentTypes, accepts);
@@ -210,9 +251,14 @@ function deleteDescriptor(name: string) {
function deploy(model: any) {
const url = `${args.host}/deployment-service/v1/applications/`;
const pathParams = {}, queryParams = {},
headerParams = {}, formParams = {}, bodyParam = model,
contentTypes = ['application/json'], accepts = ['application/json'];
const pathParams = {};
const queryParams = {};
const headerParams = {};
const formParams = {};
const bodyParam = model;
const contentTypes = ['application/json'];
const accepts = ['application/json'];
try {
return alfrescoJsApiDevops.oauth2Auth.callCustomApi(url, 'POST', pathParams, queryParams, headerParams, formParams, bodyParam,
contentTypes, accepts);
@@ -248,7 +294,9 @@ async function deployMissingApps(tag?: string) {
if (failingApps.length > 0) {
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}`);
});
process.exit(1);
@@ -256,7 +304,8 @@ async function deployMissingApps(tag?: string) {
logger.warn(`Missing apps: ${JSON.stringify(absentApps)}`);
await checkIfAppIsReleased(absentApps, tag);
} 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}`);
}
}
@@ -269,9 +318,7 @@ async function checkIfAppIsReleased(missingApps: any [], tag?: string) {
for (let i = 0; i < missingApps.length; i++) {
noError = true;
const currentAbsentApp = missingApps[i];
const project = projectList.list.entries.find((currentApp: any) => {
return currentAbsentApp.name === currentApp.entry.name;
});
const project = projectList.list.entries.find((currentApp: any) => currentAbsentApp.name === currentApp.entry.name);
let projectRelease: any;
if (project === undefined) {
@@ -360,11 +407,8 @@ async function importProjectAndRelease(app: any, tag?: string) {
}
function findMissingApps(deployedApps: any []) {
Object.keys(ACTIVITI_CLOUD_APPS).forEach((key) => {
const isPresent = deployedApps.find((currentApp: any) => {
return ACTIVITI_CLOUD_APPS[key].name === currentApp.entry.name;
});
const isPresent = deployedApps.find((currentApp: any) => ACTIVITI_CLOUD_APPS[key].name === currentApp.entry.name);
if (!isPresent) {
absentApps.push(ACTIVITI_CLOUD_APPS[key]);
@@ -373,11 +417,8 @@ function findMissingApps(deployedApps: any []) {
}
function findFailingApps(deployedApps: any []) {
Object.keys(ACTIVITI_CLOUD_APPS).forEach((key) => {
const failingApp = deployedApps.filter((currentApp: any) => {
return ACTIVITI_CLOUD_APPS[key].name === currentApp.entry.name && 'Running' !== currentApp.entry.status;
});
const failingApp = deployedApps.filter((currentApp: any) => ACTIVITI_CLOUD_APPS[key].name === currentApp.entry.name && 'Running' !== currentApp.entry.status);
if (failingApp?.length > 0) {
failingApps.push(...failingApp);
@@ -386,7 +427,7 @@ function findFailingApps(deployedApps: any []) {
}
async function getFileFromRemote(url: string, name: string) {
return new Promise((resolve, reject) => {
return new Promise<void>((resolve, reject) => {
request(url)
.pipe(fs.createWriteStream(`${name}.zip`))
.on('finish', () => {
@@ -412,12 +453,11 @@ async function sleep(time: number) {
return;
}
export default async function (configArgs: ConfigArgs) {
export default async function(configArgs: ConfigArgs) {
await main(configArgs);
}
async function main(configArgs: ConfigArgs) {
args = configArgs;
program
@@ -445,7 +485,8 @@ async function main(configArgs: ConfigArgs) {
});
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}`);
}, (error) => {
logger.error(`login SSO error ${JSON.stringify(error)} ${args.modelerUsername}`);
@@ -453,7 +494,8 @@ async function main(configArgs: ConfigArgs) {
});
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}`);
alfrescoJsApiDevops = getAlfrescoJsApiInstance(args);
await alfrescoJsApiDevops.login(args.devopsUsername, args.devopsPassword).then(() => {
+5 -5
View File
@@ -1,4 +1,4 @@
/* tslint:disable */
/* eslint-disable */
let alfrescoApi = require('@alfresco/js-api');
let program = require('commander');
let fs = require ('fs');
@@ -9,11 +9,11 @@ let MAX_RETRY = 10;
let counter = 0;
let TIMEOUT = 6000;
const ACS_DEFAULT = require('./resources').ACS_DEFAULT;
/* tslint:enable */
/* eslint-enable */
let alfrescoJsApi;
export default async function () {
export default async function() {
await main();
}
@@ -120,7 +120,7 @@ async function lockFile(nodeId) {
async function shareFile(nodeId) {
const data = {
nodeId: nodeId
nodeId
};
try {
await new SharedlinksApi(alfrescoJsApi).createSharedLink(data);
@@ -179,7 +179,7 @@ async function checkEnv() {
}
}
/* tslint:enable */
/* eslint-enable */
function sleep(delay) {
const start = new Date().getTime();
+7 -7
View File
@@ -1,4 +1,4 @@
/* tslint:disable */
/* eslint-disable */
let alfrescoApi = require('@alfresco/js-api');
let program = require('commander');
let fs = require ('fs');
@@ -13,12 +13,12 @@ const TENANT_DEFAULT_ID = 1;
const TENANT_DEFAULT_NAME = 'default';
const CONTENT_DEFAULT_NAME = 'adw-content';
const ACTIVITI_APPS = require('./resources').ACTIVITI_APPS;
/* tslint:enable */
/* eslint-enable */
let alfrescoJsApi;
let alfrescoJsApiRepo;
export default async function () {
export default async function() {
await main();
}
@@ -336,11 +336,11 @@ async function addContentRepoWithBasic(tenantId, name) {
const body = {
alfrescoTenantId: '',
authenticationType: 'basic',
name: name,
name,
repositoryUrl: `${program.host}/alfresco`,
shareUrl: `${program.host}/share`,
// sitesFolder: '', not working on activiti 1.11.1.1
tenantId: tenantId,
tenantId,
version: '6.1.1'
};
@@ -413,7 +413,7 @@ async function authorizeUserToContentWithBasic(username, contentId) {
}
}
/* tslint:disable */
/* eslint-disable */
async function downloadLicenseFile(apsLicensePath) {
try {
@@ -428,7 +428,7 @@ async function downloadLicenseFile(apsLicensePath) {
return false;
}
}
/* tslint:enable */
/* eslint-enable */
function sleep(delay) {
const start = new Date().getTime();
+32 -15
View File
@@ -20,9 +20,9 @@
import * as program from 'commander';
import moment from 'moment-es6';
import { exec } from './exec';
/* tslint:disable */
/* eslint-disable */
import { AlfrescoApi } from '@alfresco/js-api';
/* tslint:enable */
/* eslint-enable */
import { logger } from './logger';
@@ -82,8 +82,11 @@ async function deleteDescriptor(args: ConfigArgs, apiService: any, name: string)
const pathParams = {};
const bodyParam = {};
const headerParams = {}, formParams = {}, queryParams = {},
contentTypes = ['application/json'], accepts = ['application/json'];
const headerParams = {};
const formParams = {};
const queryParams = {};
const contentTypes = ['application/json'];
const accepts = ['application/json'];
try {
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 bodyParam = {};
const headerParams = {}, formParams = {}, queryParams = {},
contentTypes = ['application/json'], accepts = ['application/json'];
const headerParams = {};
const formParams = {};
const queryParams = {};
const contentTypes = ['application/json'];
const accepts = ['application/json'];
try {
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}`);
const url = `${args.host}/modeling-service/v1/projects?name=${name}`;
const pathParams = {}, queryParams = {},
headerParams = {}, formParams = {}, bodyParam = {},
contentTypes = ['application/json'], accepts = ['application/json'];
const pathParams = {};
const queryParams = {};
const headerParams = {};
const formParams = {};
const bodyParam = {};
const contentTypes = ['application/json'];
const accepts = ['application/json'];
try {
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}`);
const url = `${args.host}/deployment-service/v1/applications?name=${name}`;
const pathParams = {}, queryParams = {},
headerParams = {}, formParams = {}, bodyParam = {},
contentTypes = ['application/json'], accepts = ['application/json'];
const pathParams = {};
const queryParams = {};
const headerParams = {};
const formParams = {};
const bodyParam = {};
const contentTypes = ['application/json'];
const accepts = ['application/json'];
try {
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 bodyParam = {};
const headerParams = {}, formParams = {}, queryParams = {},
contentTypes = ['application/json'], accepts = ['application/json'];
const headerParams = {};
const formParams = {};
const queryParams = {};
const contentTypes = ['application/json'];
const accepts = ['application/json'];
try {
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);
}
export default async function (args: ConfigArgs) {
export default async function(args: ConfigArgs) {
await main(args);
}
+1 -1
View File
@@ -59,7 +59,7 @@ function deletePod(args: KubeArgs) {
logger.info(response);
}
export default function (args: KubeArgs) {
export default function(args: KubeArgs) {
main(args);
}
+1 -1
View File
@@ -85,7 +85,7 @@ function installPerform() {
exec('curl', [`LO`, `${k8sRelease}`], {});
}
export default function (args: KubeArgs) {
export default function(args: KubeArgs) {
main(args);
}
+5 -5
View File
@@ -108,19 +108,19 @@ export default function main(_args: string[], workingDir: string) {
}
return new Promise((resolve, reject) => {
// tslint:disable-next-line: no-console
// eslint-disable-next-line no-console
console.info(`Checking ${packagePath}`);
checker.init({
start: workingDir,
production: true,
failOn: 'GPL'
}, function (err: any, packages: any[]) {
}, function(err: any, packages: any[]) {
if (err) {
console.error(err);
reject(err);
} else {
// tslint:disable-next-line: forin
// eslint-disable-next-line guard-for-in
for (const packageName in packages) {
const pack = packages[packageName];
pack['licenseExp'] = pack['licenses'].toString()
@@ -148,7 +148,7 @@ export default function main(_args: string[], workingDir: string) {
const packageJson: PackageInfo = getPackageFile(packagePath);
ejs.renderFile(templatePath, {
packages: packages,
packages,
projVersion: packageJson.version,
projName: packageJson.name
}, {}, (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`);
fs.writeFileSync(outputFile, mdText);
// tslint:disable-next-line: no-console
// eslint-disable-next-line no-console
console.log(`Report saved as ${outputFile}`);
resolve(0);
}
+2 -2
View File
@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable */
/* eslint-disable */
let log = null;
log = {
@@ -31,4 +31,4 @@ log = {
};
export let logger = log;
/* tslint:enable */
/* eslint-enable */
+1 -1
View File
@@ -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);
}
+8 -7
View File
@@ -12,13 +12,14 @@ export class PluginConfiguration {
}
async callCustomApi(url: string) {
const pathParams = {},
headerParams = {},
formParams = {},
bodyParam = {},
queryParams = {},
contentTypes = ['application/json'],
accepts = ['application/json'];
const pathParams = {};
const headerParams = {};
const formParams = {};
const bodyParam = {};
const queryParams = {};
const contentTypes = ['application/json'];
const accepts = ['application/json'];
try {
const response = await this.alfrescoJsApi.oauth2Auth.callCustomApi(
url,
+19 -13
View File
@@ -2,23 +2,28 @@ import { AlfrescoApi, PeopleApi, NodesApi, GroupsApi, SitesApi, SearchApi } from
import * as program from 'commander';
import { logger } from './logger';
interface PeopleTally { enabled: number; disabled: number; }
interface RowToPrint { label: string; value: number; }
interface PeopleTally { enabled: number; disabled: number }
interface RowToPrint { label: string; value: number }
const MAX_ATTEMPTS = 1;
const TIMEOUT = 180000;
const MAX_PEOPLE_PER_PAGE = 100;
const USERS_HOME_RELATIVE_PATH = 'User Homes';
const reset = '\x1b[0m', grey = '\x1b[90m', cyan = '\x1b[36m', yellow = '\x1b[33m',
bright = '\x1b[1m', red = '\x1b[31m', green = '\x1b[32m';
const reset = '\x1b[0m';
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 loginAttempts: number = 0;
export default async function main(_args: string[]) {
// tslint:disable-next-line: no-console
// eslint-disable-next-line no-console
console.log = () => {};
program
@@ -35,22 +40,19 @@ export default async function main(_args: string[]) {
const peopleCount = await getPeopleCount();
rowsToPrint.push({ label: 'Active Users', value: peopleCount.enabled });
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: 'Sites', value: await getSitesCount() });
rowsToPrint.push({ label: 'Files', value: await getFilesCount() });
logger.info(generateTable(rowsToPrint));
}
function generateTable(rowsToPrint: Array<RowToPrint>) {
const columnWidths = rowsToPrint.reduce((maxWidths, row: RowToPrint) => {
return {
const columnWidths = rowsToPrint.reduce((maxWidths, row: RowToPrint) => ({
labelColumn: Math.max(maxWidths.labelColumn, row.label.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 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({
fields: ['enabled'],
maxItems: MAX_PEOPLE_PER_PAGE,
skipCount: skipCount
skipCount
});
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;
}, { enabled: 0, disabled: 0 });
if (apiResult.list.pagination.hasMoreItems) {
+1 -1
View File
@@ -47,7 +47,7 @@ function replacePerform(args: CommitArgs, sha: string) {
}
}
export default function (args: CommitArgs) {
export default function(args: CommitArgs) {
main(args);
}
+110
View File
@@ -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 queryOptions = Object.assign({}, defaultOptions, opts);
return from(this.auditApi.updateAuditApp(auditApplicationId, new AuditBodyUpdate({ isEnabled: auditAppBodyUpdate }), queryOptions))
@@ -22,7 +22,7 @@ export interface PropertyGroup {
title: string;
description?: string;
properties: {
[key: string]: Property
[key: string]: Property;
};
}
@@ -27,12 +27,11 @@ export class BasicPropertiesService {
}
getProperties(node: Node) {
const sizeInBytes = node.content ? node.content.sizeInBytes : '',
mimeTypeName = node.content ? node.content.mimeTypeName : '',
author = node.properties ? node.properties['cm:author'] : '',
description = node.properties ? node.properties['cm:description'] : '',
title = node.properties ? node.properties['cm:title'] : '';
const sizeInBytes = node.content ? node.content.sizeInBytes : '';
const mimeTypeName = node.content ? node.content.mimeTypeName : '';
const author = node.properties ? node.properties['cm:author'] : '';
const description = node.properties ? node.properties['cm:description'] : '';
const title = node.properties ? node.properties['cm:title'] : '';
return [
new CardViewTextItemModel({
@@ -34,10 +34,10 @@ describe('AspectOrientedConfigService', () => {
expectations: OrganisedPropertyGroup[];
}
const property1 = <Property> { name: 'property1' },
property2 = <Property> { name: 'property2' },
property3 = <Property> { name: 'property3' },
property4 = <Property> { name: 'property4' };
const property1 = <Property> { name: 'property1' };
const property2 = <Property> { name: 'property2' };
const property3 = <Property> { name: 'property3' };
const property4 = <Property> { name: 'property4' };
const propertyGroups: PropertyGroupContainer = {
berseria: { title: 'Berseria', description: '', name: 'berseria', properties: { property1, property2 } },
@@ -177,11 +177,10 @@ describe('AspectOrientedConfigService', () => {
});
describe('appendAllPreset', () => {
const property1 = <Property> { name: 'property1' },
property2 = <Property> { name: 'property2' },
property3 = <Property> { name: 'property3' },
property4 = <Property> { name: 'property4' };
const property1 = <Property> { name: 'property1' };
const property2 = <Property> { name: 'property2' };
const property3 = <Property> { name: 'property3' };
const property4 = <Property> { name: 'property4' };
const propertyGroups: PropertyGroupContainer = {
berseria: { title: 'Berseria', description: '', name: 'berseria', properties: { property1, property2 } },
@@ -31,8 +31,8 @@ export class AspectOrientedConfigService implements ContentMetadataConfig {
}
public reorganiseByConfig(propertyGroups: PropertyGroupContainer): OrganisedPropertyGroup[] {
const aspects = this.config,
aspectNames = Object.keys(aspects);
const aspects = this.config;
const aspectNames = Object.keys(aspects);
return aspectNames
.reduce((groupAccumulator, aspectName) => {
@@ -45,8 +45,8 @@ export class AspectOrientedConfigService implements ContentMetadataConfig {
public appendAllPreset(propertyGroups: PropertyGroupContainer): OrganisedPropertyGroup[] {
const groups = Object.keys(propertyGroups)
.map((groupName) => {
const propertyGroup = propertyGroups[groupName],
properties = propertyGroup.properties;
const propertyGroup = propertyGroups[groupName];
const properties = propertyGroup.properties;
if (this.isAspectReadOnly(groupName)) {
Object.keys(properties).map((propertyName) => this.setReadOnlyProperty(properties[propertyName]));
@@ -28,8 +28,8 @@ export class IndifferentConfigService implements ContentMetadataConfig {
reorganiseByConfig(propertyGroups: PropertyGroupContainer): OrganisedPropertyGroup[] {
return Object.keys(propertyGroups)
.map((groupName) => {
const propertyGroup = propertyGroups[groupName],
properties = propertyGroup.properties;
const propertyGroup = propertyGroups[groupName];
const properties = propertyGroup.properties;
return Object.assign({}, propertyGroup, {
properties: Object.keys(properties).map((propertyName) => properties[propertyName])
@@ -102,12 +102,12 @@ describe('LayoutOrientedConfigService', () => {
expectations: OrganisedPropertyGroup[];
}
const property1 = <Property> { name: 'property1' },
property2 = <Property> { name: 'property2' },
property3 = <Property> { name: 'property3' },
property4 = <Property> { name: 'property4' },
property5 = <Property> { name: 'property5' },
property6 = <Property> { name: 'property6' };
const property1 = <Property> { name: 'property1' };
const property2 = <Property> { name: 'property2' };
const property3 = <Property> { name: 'property3' };
const property4 = <Property> { name: 'property4' };
const property5 = <Property> { name: 'property5' };
const property6 = <Property> { name: 'property6' };
const propertyGroups: PropertyGroupContainer = {
berseria: { title: 'Berseria', description: '', name: 'berseria', properties: { property1, property2 } },
@@ -39,15 +39,17 @@ export class LayoutOrientedConfigService implements ContentMetadataConfig {
const layoutBlocks = this.config.filter((itemsGroup) => itemsGroup.items);
const organisedPropertyGroup = layoutBlocks.map((layoutBlock) => {
const flattenedItems = this.flattenItems(layoutBlock.items),
properties = flattenedItems.reduce((props, explodedItem) => {
const isProperty = typeof explodedItem.property === 'object';
const propertyName = isProperty ? explodedItem.property.name : explodedItem.property;
let property = getProperty(propertyGroups, explodedItem.groupName, propertyName) || [];
if (isProperty) { property = this.setPropertyTitle(property, explodedItem.property); }
property = this.setEditableProperty(property, explodedItem);
return props.concat(property);
}, []);
const flattenedItems = this.flattenItems(layoutBlock.items);
const properties = flattenedItems.reduce((props, explodedItem) => {
const isProperty = typeof explodedItem.property === 'object';
const propertyName = isProperty ? explodedItem.property.name : explodedItem.property;
let property = getProperty(propertyGroups, explodedItem.groupName, propertyName) || [];
if (isProperty) {
property = this.setPropertyTitle(property, explodedItem.property);
}
property = this.setEditableProperty(property, explodedItem);
return props.concat(property);
}, []);
return {
title: layoutBlock.title,
@@ -61,8 +63,8 @@ export class LayoutOrientedConfigService implements ContentMetadataConfig {
public appendAllPreset(propertyGroups: PropertyGroupContainer): OrganisedPropertyGroup[] {
return Object.keys(propertyGroups)
.map((groupName) => {
const propertyGroup = propertyGroups[groupName],
properties = propertyGroup.properties;
const propertyGroup = propertyGroups[groupName];
const properties = propertyGroup.properties;
return Object.assign({}, propertyGroup, {
properties: Object.keys(properties).map((propertyName) => properties[propertyName])
@@ -31,7 +31,7 @@ import { ContentTypePropertiesService } from './content-type-property.service';
})
export class ContentMetadataService {
error = new Subject<{ statusCode: number, message: string }>();
error = new Subject<{ statusCode: number; message: string }>();
constructor(private basicPropertiesService: BasicPropertiesService,
private contentMetadataConfigFactory: ContentMetadataConfigFactory,
@@ -31,7 +31,7 @@ import { switchMap } from 'rxjs/operators';
@Injectable({
providedIn: 'root'
})
// tslint:disable-next-line: directive-class-suffix
// eslint-disable-next-line @angular-eslint/directive-class-suffix
export class ContentNodeDialogService {
static nonDocumentSiteContent = [
'blog',
@@ -197,7 +197,7 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
@Input()
set showFilesInResult(value: boolean) {
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);
}
}
@@ -34,7 +34,7 @@ export class NodeSharedDirective implements OnChanges, OnDestroy {
isShared: boolean = false;
/** Node to share. */
// tslint:disable-next-line:no-input-rename
// eslint-disable-next-line @angular-eslint/no-input-rename
@Input('adf-share')
node: NodeEntry;
@@ -130,7 +130,9 @@ describe('FolderDialogComponent', () => {
spyOn(nodesApi, 'updateNode').and.returnValue(of(folder));
component.success.subscribe((node) => { expectedNode = node; });
component.success.subscribe((node) => {
expectedNode = node;
});
component.submit();
fixture.detectChanges();
@@ -142,7 +142,9 @@ export class FolderDialogComponent implements OnInit {
submit() {
const { form, dialog, editing } = this;
if (!form.valid) { return; }
if (!form.valid) {
return;
}
(editing ? this.edit() : this.create())
.subscribe(
@@ -7,7 +7,6 @@
placeholder="{{ 'LIBRARY.DIALOG.FORM.NAME' | translate }}"
required
matInput
autofocus
formControlName="title"
autocomplete="off"
/>
@@ -15,7 +15,7 @@
* 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 { Node } from '@alfresco/js-api';
@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import { Component } from '@angular/core';
@@ -15,7 +15,7 @@
* 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';
@@ -46,7 +46,7 @@ export class ContentActionComponent implements OnInit, OnChanges, OnDestroy {
/** Visibility state (see examples). */
@Input()
visible: boolean | Function = true;
visible: boolean | ((...args) => boolean) = true;
/** System actions. Can be "delete", "download", "copy" or "move". */
@Input()
@@ -66,7 +66,7 @@ export class ContentActionComponent implements OnInit, OnChanges, OnDestroy {
/** Is the menu item disabled? */
@Input()
disabled: boolean | Function = false;
disabled: boolean | ((...args) => boolean) = false;
/** Emitted when the user selects the action from the menu. */
@Output()
@@ -241,7 +241,9 @@ describe('DocumentList', () => {
previousValue: undefined,
currentValue: mockPreselectedNodes,
firstChange: true,
isFirstChange(): boolean { return this.firstChange; }
isFirstChange(): boolean {
return this.firstChange;
}
}
};
documentList.ngOnChanges(changes);
@@ -258,7 +260,9 @@ describe('DocumentList', () => {
previousValue: undefined,
currentValue: ['mockChangeValue'],
firstChange: true,
isFirstChange(): boolean { return this.firstChange; }
isFirstChange(): boolean {
return this.firstChange;
}
}
};
documentList.ngOnChanges(changes);
@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:rxjs-no-subject-value */
/* eslint-disable rxjs/no-subject-value */
import {
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.
*/
@Input()
rowStyle: { [key: string]: any; };
rowStyle: { [key: string]: any };
/** The CSS class to apply to every row */
@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);
const domEvent = new CustomEvent('node-select', {
detail: {
@@ -829,7 +829,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
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);
const domEvent = new CustomEvent('node-unselect', {
detail: {
@@ -15,7 +15,7 @@
* 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 { DocumentListComponent } from '../document-list.component';
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',
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 . */
@Input()
@@ -19,12 +19,12 @@ export class ContentActionModel {
icon: string;
title: string;
handler: ContentActionHandler;
execute: Function;
execute: (...args) => void;
target: string;
permission: string;
disableWithNoPermission: boolean = false;
disabled: boolean | Function = false;
visible: boolean | Function = true;
disabled: boolean | ((...args) => boolean) = false;
visible: boolean | ((...args) => boolean) = true;
constructor(obj?: any) {
if (obj) {
@@ -34,7 +34,7 @@ export class DocumentActionsService {
error: Subject<Error> = new Subject<Error>();
success: Subject<string> = new Subject<string>();
private handlers: { [id: string]: ContentActionHandler; } = {};
private handlers: { [id: string]: ContentActionHandler } = {};
constructor(private nodeActionsService: NodeActionsService,
private contentNodeDialogService: ContentNodeDialogService,
@@ -33,7 +33,7 @@ export class FolderActionsService {
error: Subject<Error> = new Subject<Error>();
success: Subject<string> = new Subject<string>();
private handlers: { [id: string]: ContentActionHandler; } = {};
private handlers: { [id: string]: ContentActionHandler } = {};
constructor(private nodeActionsService: NodeActionsService,
private documentListService: DocumentListService,
@@ -28,7 +28,7 @@ import { NodeAction } from '../models/node-action.enum';
@Injectable({
providedIn: 'root'
})
// tslint:disable-next-line: directive-class-suffix
// eslint-disable-next-line @angular-eslint/directive-class-suffix
export class NodeActionsService {
@Output()
@@ -15,7 +15,7 @@
* 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 { MatDialog } from '@angular/material/dialog';
@@ -15,7 +15,7 @@
* 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 { MatDialog } from '@angular/material/dialog';
@@ -42,8 +42,8 @@ export const disabledCategories = [
'field': null,
'pageSize': 5,
'options': [
{ 'name': 'Folder', 'value': "TYPE:'cm:folder'" },
{ 'name': 'Document', 'value': "TYPE:'cm:content'" }
{ 'name': 'Folder', 'value': `TYPE:'cm:folder'` },
{ 'name': 'Document', 'value': `TYPE:'cm:content'` }
]
}
}
@@ -62,8 +62,8 @@ export const expandedCategories = [
'field': null,
'pageSize': 5,
'options': [
{ 'name': 'Folder', 'value': "TYPE:'cm:folder'" },
{ 'name': 'Document', 'value': "TYPE:'cm:content'" }
{ 'name': 'Folder', 'value': `TYPE:'cm:folder'` },
{ 'name': 'Document', 'value': `TYPE:'cm:content'` }
]
}
}
@@ -94,8 +94,8 @@ export const simpleCategories: SearchCategory[] = [
'field': 'check-list',
'pageSize': 5,
'options': [
{ 'name': 'Folder', 'value': "TYPE:'cm:folder'" },
{ 'name': 'Document', 'value': "TYPE:'cm:content'" }
{ 'name': 'Folder', 'value': `TYPE:'cm:folder'` },
{ 'name': 'Document', 'value': `TYPE:'cm:content'` }
]
}
}
@@ -132,7 +132,7 @@ export const searchFilter = {
'resetButton': true,
'filterQueries': [
{
'query': "TYPE:'cm:folder' OR TYPE:'cm:content'"
'query': `TYPE:'cm:folder' OR TYPE:'cm:content'`
},
{
'query': 'NOT cm:creator:System'
@@ -321,7 +321,7 @@ export const searchFilter = {
'component': {
'selector': 'text',
'settings': {
'pattern': "cm:name:'(.*?)'",
'pattern': `cm:name:'(.*?)'`,
'field': 'cm:name',
'placeholder': 'Enter the name'
}
@@ -44,7 +44,7 @@ export class SearchPermissionConfigurationService implements SearchConfiguration
skipCount: skipCount
},
filterQueries: [
/*tslint:disable-next-line */
/* eslint-disable-next-line */
{ query: "TYPE:'cm:authority'" }]
};
@@ -15,7 +15,7 @@
* 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 { NodesApiService, ContentService, AllowableOperationsEnum } from '@alfresco/adf-core';
import { Node } from '@alfresco/js-api';
@@ -48,7 +48,7 @@ export class PermissionContainerComponent implements OnChanges {
/** Emitted when the permission is updated. */
@Output()
update = new EventEmitter<{role: string, permission: PermissionDisplayModel}>();
update = new EventEmitter<{role: string; permission: PermissionDisplayModel}>();
@Output()
updateAll = new EventEmitter<string>();
@@ -17,7 +17,7 @@
import { ObjectDataRow } from '@alfresco/adf-core';
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 { PermissionListService } from './permission-list.service';
@@ -27,7 +27,7 @@ import { PermissionListService } from './permission-list.service';
styleUrls: ['./permission-list.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class PermissionListComponent {
export class PermissionListComponent implements OnInit {
/** ID of the node whose permissions you want to show. */
@Input()
nodeId: string;
@@ -71,8 +71,9 @@ describe('PermissionListService', () => {
describe('toggle permission', () => {
it('should show error if user doesn\'t have permission to update node', () => {
const node = JSON.parse(JSON.stringify(fakeNodeInheritedOnly)), event = { source: { checked: false } };
it('should show error if user does not have permission to update node', () => {
const node = JSON.parse(JSON.stringify(fakeNodeInheritedOnly));
const event = { source: { checked: false } };
node.allowableOperations = [];
spyOn(nodePermissionService, 'getNodeWithRoles').and.returnValue(of({node , roles: []}));
spyOn(nodesApiService, 'updateNode').and.stub();
@@ -83,7 +84,8 @@ describe('PermissionListService', () => {
});
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, 'updatePermissions').and.returnValue(of(null));
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', () => {
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));
node.permissions.locallySet = [{
'authorityId': 'GROUP_site_testsite_SiteManager',
@@ -124,7 +127,8 @@ describe('PermissionListService', () => {
});
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;
spyOn(nodesApiService, 'updateNode').and.returnValue(throwError('Failed to update'));
spyOn(nodePermissionService, 'getNodeWithRoles').and.returnValue(of({node , roles: []}));
@@ -36,7 +36,7 @@ export class PermissionListService {
loading$: BehaviorSubject<boolean> = new BehaviorSubject(true);
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(
map(({ node, roles}) => {
const nodeLocalPermissions = this.nodePermissionService.getLocalPermissions(node);
@@ -220,7 +220,8 @@ export class PermissionListService {
getManagerAuthority(node: Node): string {
const sitePath = node.path.elements.find((path) => path.nodeType === 'st:site');
let hasLocalManagerPermission = false, authorityId: string;
let hasLocalManagerPermission = false;
let authorityId: string;
if (sitePath) {
authorityId = `GROUP_site_${sitePath.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;
}
@Input('adf-pop-over') popOver!: TemplateRef<object>;
@Input('adf-pop-over') popOver!: TemplateRef<any>;
@Input() target!: HTMLElement;
@Input() panelClass = 'adf-permission-pop-over';
@@ -189,7 +189,9 @@ describe('NodePermissionService', () => {
service.updateLocallySetPermissions(fakeNodeCopy, fakeDuplicateAuthority)
.subscribe(
() => { fail('should throw exception'); },
() => {
fail('should throw exception');
},
(errorMessage) => {
expect(errorMessage).not.toBeNull();
expect(errorMessage).toBeDefined();
@@ -224,7 +224,7 @@ export class NodePermissionService {
'filterQueries': [
{
'query':
"TYPE:'st:site'"
`TYPE:'st:site'`
}
]
};
@@ -307,8 +307,9 @@ export class NodePermissionService {
);
}
transformNodeToUserPerson(node: Node): { person: EcmUserModel, group: Group } {
let person = null, group = null;
transformNodeToUserPerson(node: Node): { person: EcmUserModel; group: Group } {
let person = null;
let group = null;
if (node.nodeType === 'cm:person') {
const firstName = node.properties['cm:firstName'];
const lastName = node.properties['cm:lastName'];
@@ -42,8 +42,8 @@ describe('SearchCheckListComponent', () => {
it('should setup options from settings', () => {
const options: any = [
{ 'name': 'Folder', 'value': "TYPE:'cm:folder'" },
{ 'name': 'Document', 'value': "TYPE:'cm:content'" }
{ 'name': 'Folder', 'value': `TYPE:'cm:folder'` },
{ 'name': 'Document', 'value': `TYPE:'cm:content'` }
];
component.settings = <any> { options: options };
component.ngOnInit();
@@ -53,8 +53,8 @@ describe('SearchCheckListComponent', () => {
it('should handle enter key as click on checkboxes', () => {
component.options = new SearchFilterList<SearchListOption>([
{ name: 'Folder', value: "TYPE:'cm:folder'", checked: false },
{ name: 'Document', value: "TYPE:'cm:content'", checked: false }
{ name: 'Folder', value: `TYPE:'cm:folder'`, checked: false },
{ name: 'Document', value: `TYPE:'cm:content'`, checked: false }
]);
component.ngOnInit();
@@ -83,8 +83,8 @@ describe('SearchCheckListComponent', () => {
it('should update query builder on checkbox change', () => {
component.options = new SearchFilterList<SearchListOption>([
{ name: 'Folder', value: "TYPE:'cm:folder'", checked: false },
{ name: 'Document', value: "TYPE:'cm:content'", checked: false }
{ name: 'Folder', value: `TYPE:'cm:folder'`, checked: false },
{ name: 'Document', value: `TYPE:'cm:content'`, checked: false }
]);
component.id = 'checklist';
@@ -116,8 +116,8 @@ describe('SearchCheckListComponent', () => {
it('should reset selected boxes', () => {
component.options = new SearchFilterList<SearchListOption>([
{ name: 'Folder', value: "TYPE:'cm:folder'", checked: true },
{ name: 'Document', value: "TYPE:'cm:content'", checked: true }
{ name: 'Folder', value: `TYPE:'cm:folder'`, checked: true },
{ name: 'Document', value: `TYPE:'cm:content'`, checked: true }
]);
component.reset();
@@ -138,8 +138,8 @@ describe('SearchCheckListComponent', () => {
component.ngOnInit();
component.options = new SearchFilterList<SearchListOption>([
{ name: 'Folder', value: "TYPE:'cm:folder'", checked: true },
{ name: 'Document', value: "TYPE:'cm:content'", checked: true }
{ name: 'Folder', value: `TYPE:'cm:folder'`, checked: true },
{ name: 'Document', value: `TYPE:'cm:content'`, checked: true }
]);
component.reset();
@@ -141,7 +141,7 @@ export class SearchDateRangeComponent implements SearchWidget, OnInit, OnDestroy
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) {
this.isActive = true;
@@ -129,7 +129,7 @@ export class SearchDatetimeRangeComponent implements SearchWidget, OnInit, OnDes
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) {
this.isActive = true;
@@ -20,7 +20,6 @@ import { TranslateModule } from '@ngx-translate/core';
import { SearchService, setupTestBed } from '@alfresco/adf-core';
import { SearchHeaderQueryBuilderService } from '../../services/search-header-query-builder.service';
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 { By } from '@angular/platform-browser';
import { SearchFilterContainerComponent } from './search-filter-container.component';
@@ -36,7 +35,7 @@ const mockCategory: SearchCategory = {
'component': {
'selector': 'text',
'settings': {
'pattern': "cm:name:'(.*?)'",
'pattern': `cm:name:'(.*?)'`,
'field': 'cm:name',
'placeholder': 'Enter the name'
}
@@ -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};
}
apply(model: { from: string, to: string }, isValid: boolean) {
apply(model: { from: string; to: string }, isValid: boolean) {
if (isValid && this.id && this.context && this.field) {
this.updateDisplayValue();
this.isActive = true;
@@ -42,8 +42,8 @@ describe('SearchCheckListComponent', () => {
it('should setup options from settings', () => {
const options: any = [
{ 'name': 'Folder', 'value': "TYPE:'cm:folder'" },
{ 'name': 'Document', 'value': "TYPE:'cm:content'" }
{ 'name': 'Folder', 'value': `TYPE:'cm:folder'` },
{ 'name': 'Document', 'value': `TYPE:'cm:content'` }
];
component.settings = <any> { options: options };
component.ngOnInit();
@@ -53,8 +53,8 @@ describe('SearchCheckListComponent', () => {
it('should handle enter key as click on checkboxes', () => {
component.options = new SearchFilterList<SearchListOption>([
{ name: 'Folder', value: "TYPE:'cm:folder'", checked: false },
{ name: 'Document', value: "TYPE:'cm:content'", checked: false }
{ name: 'Folder', value: `TYPE:'cm:folder'`, checked: false },
{ name: 'Document', value: `TYPE:'cm:content'`, checked: false }
]);
component.ngOnInit();
@@ -83,8 +83,8 @@ describe('SearchCheckListComponent', () => {
it('should update query builder on checkbox change', () => {
component.options = new SearchFilterList<SearchListOption>([
{ name: 'Folder', value: "TYPE:'cm:folder'", checked: false },
{ name: 'Document', value: "TYPE:'cm:content'", checked: false }
{ name: 'Folder', value: `TYPE:'cm:folder'`, checked: false },
{ name: 'Document', value: `TYPE:'cm:content'`, checked: false }
]);
component.id = 'checklist';
@@ -116,8 +116,8 @@ describe('SearchCheckListComponent', () => {
it('should reset selected boxes', () => {
component.options = new SearchFilterList<SearchListOption>([
{ name: 'Folder', value: "TYPE:'cm:folder'", checked: true },
{ name: 'Document', value: "TYPE:'cm:content'", checked: true }
{ name: 'Folder', value: `TYPE:'cm:folder'`, checked: true },
{ name: 'Document', value: `TYPE:'cm:content'`, checked: true }
]);
component.reset();
@@ -138,8 +138,8 @@ describe('SearchCheckListComponent', () => {
component.ngOnInit();
component.options = new SearchFilterList<SearchListOption>([
{ name: 'Folder', value: "TYPE:'cm:folder'", checked: true },
{ name: 'Document', value: "TYPE:'cm:content'", checked: true }
{ name: 'Folder', value: `TYPE:'cm:folder'`, checked: true },
{ name: 'Document', value: `TYPE:'cm:content'`, checked: true }
]);
component.reset();
@@ -37,7 +37,7 @@ describe('SearchTextComponent', () => {
component = fixture.componentInstance;
component.id = 'text';
component.settings = {
'pattern': "cm:name:'(.*?)'",
'pattern': `cm:name:'(.*?)'`,
'field': 'cm:name',
'placeholder': 'Enter the name'
};
@@ -49,7 +49,7 @@ describe('SearchTextComponent', () => {
});
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();
expect(component.value).toEqual('secret.pdf');
@@ -57,7 +57,7 @@ describe('SearchTextComponent', () => {
it('should not parse value when pattern not defined', () => {
component.settings.pattern = null;
component.context.queryFragments[component.id] = "cm:name:'secret.pdf'";
component.context.queryFragments[component.id] = `cm:name:'secret.pdf'`;
fixture.detectChanges();
expect(component.value).toEqual('');
@@ -73,7 +73,7 @@ describe('SearchTextComponent', () => {
});
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();
});
@@ -85,7 +85,7 @@ describe('SearchTextComponent', () => {
});
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({
target: {
@@ -98,7 +98,7 @@ describe('SearchTextComponent', () => {
});
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();
await fixture.whenStable();
expect(component.value).toEqual('secret.pdf');
@@ -107,7 +107,7 @@ describe('SearchTextComponent', () => {
});
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();
await fixture.whenStable();
const clearElement = fixture.debugElement.nativeElement.querySelector('button');
@@ -107,7 +107,7 @@ export class SearchWidgetContainerComponent implements OnInit, OnDestroy, OnChan
this.componentRef.instance.submitValues();
}
setValue(currentValue: string | Object) {
setValue(currentValue: string | any) {
this.componentRef.instance.isActive = true;
this.componentRef.instance.setValue(currentValue);
}
@@ -24,7 +24,8 @@ import { TranslateModule } from '@ngx-translate/core';
describe('SearchComponent', () => {
let fixture: ComponentFixture<SimpleSearchTestComponent>, element: HTMLElement;
let fixture: ComponentFixture<SimpleSearchTestComponent>;
let element: HTMLElement;
let component: SimpleSearchTestComponent;
let searchService: SearchService;
@@ -72,6 +72,7 @@ export class SearchComponent implements SearchComponentInterface, AfterContentIn
searchTerm: string = '';
/** CSS class for display. */
// eslint-disable-next-line @angular-eslint/no-input-rename
@Input('class')
set classList(classList: string) {
if (classList && classList.length) {
@@ -35,7 +35,7 @@ describe('Search term validator', () => {
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', () => {
const control = new FormControl('a ._-?b', SearchTermValidator.minAlphanumericChars(3));
expect(control.valid).toBe(false);
@@ -32,7 +32,7 @@ export class SearchFilterService {
/**
* Contains string-to-type mappings for registered widgets.
*/
widgets: { [id: string]: Type<{}> } = {
widgets: { [id: string]: Type<any> } = {
'text': SearchTextComponent,
'radio': SearchRadioComponent,
'slider': SearchSliderComponent,
@@ -26,7 +26,7 @@ import { RatingServiceInterface } from '../services/rating.service.interface';
})
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') {
return of(ratingOneMock);
}
@@ -34,7 +34,7 @@ export class RatingServiceMock implements RatingServiceInterface {
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') {
ratingOneMock.entry.aggregate.numberOfRatings = 1;
ratingOneMock.entry.aggregate.average = 1.0;
@@ -15,7 +15,7 @@
* 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 { RatingEntry } from '@alfresco/js-api';
import { takeUntil } from 'rxjs/operators';
@@ -27,7 +27,7 @@ import { Subject } from 'rxjs';
templateUrl: './rating.component.html',
encapsulation: ViewEncapsulation.None
})
export class RatingComponent implements OnChanges {
export class RatingComponent implements OnChanges, OnDestroy {
/** Identifier of the node to apply the rating to. */
@Input()
@@ -20,7 +20,7 @@ import { Observable } from 'rxjs';
export interface RatingServiceInterface {
getRating(nodeId: string, ratingType: any): Observable<RatingEntry | {}>;
postRating(nodeId: string, ratingType: string, vote: any): Observable<RatingEntry | {}>;
getRating(nodeId: string, ratingType: any): Observable<RatingEntry | any>;
postRating(nodeId: string, ratingType: string, vote: any): Observable<RatingEntry | 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")
* @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))
.pipe(
catchError(this.handleError)
@@ -56,7 +56,7 @@ export class RatingService implements RatingServiceInterface {
* @param vote Rating value (boolean for "likes", numeric 0..5 for "fiveStar")
* @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({
'id': ratingType,
'myRating': vote
@@ -24,7 +24,7 @@ import { TagBody, TagPaging, TagEntry, TagsApi } from '@alfresco/js-api';
@Injectable({
providedIn: 'root'
})
// tslint:disable-next-line: directive-class-suffix
// eslint-disable-next-line @angular-eslint/directive-class-suffix
export class TagService {
_tagsApi: TagsApi;
@@ -22,7 +22,7 @@ import { UploadFilesEvent } from '../upload-files.event';
import { takeUntil } from 'rxjs/operators';
@Directive()
// tslint:disable-next-line: directive-class-suffix
// eslint-disable-next-line @angular-eslint/directive-class-suffix
export abstract class UploadBase implements OnInit, OnDestroy {
/** 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.
*/
showUndoNotificationBar(latestFilesAdded: FileModel[]) {
let messageTranslate: any, actionTranslate: any;
messageTranslate = this.translationService.get('FILE_UPLOAD.MESSAGES.PROGRESS');
actionTranslate = this.translationService.get('FILE_UPLOAD.ACTION.UNDO');
const messageTranslate = this.translationService.instant('FILE_UPLOAD.MESSAGES.PROGRESS');
const actionTranslate = this.translationService.instant('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);
});
}
@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:no-input-rename */
/* eslint-disable @angular-eslint/no-input-rename */
import { FileUtils } from '@alfresco/adf-core';
import { Directive, ElementRef, EventEmitter, Input, NgZone, OnDestroy, OnInit, Output } from '@angular/core';
+110
View File
@@ -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.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import {
Component,
@@ -102,7 +102,7 @@ export function reduceEmptyMenus(
return acc.concat(el);
}
export function mergeObjects(...objects: object[]): any {
export function mergeObjects(...objects: any[]): any {
const result = {};
objects.forEach((source) => {
@@ -23,16 +23,16 @@ export interface ExtensionComponent {
@Injectable({ providedIn: 'root' })
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) {
this.components = Object.assign({}, this.components, values);
}
}
getComponentById<T>(id: string): Type<T> {
return <Type<T>> this.components[id];
return this.components[id];
}
hasComponentById(id: string): boolean {
@@ -57,7 +57,7 @@ export class ExtensionService {
routes: Array<RouteRef> = [];
actions: Array<ActionRef> = [];
features: Array<any> = [];
authGuards: { [key: string]: Type<{}> } = {};
authGuards: { [key: string]: Type<any> } = {};
protected onSetup$ = new BehaviorSubject<ExtensionConfig>(this.config);
setup$ = this.onSetup$.asObservable();
@@ -72,6 +72,7 @@ export class ExtensionService {
/**
* Loads and registers an extension config file and plugins (specified by path properties).
*
* @returns The loaded config data
*/
async load(): Promise<ExtensionConfig> {
@@ -86,6 +87,7 @@ export class ExtensionService {
/**
* Registers extensions from a config object.
*
* @param config Object with config data
*/
setup(config: ExtensionConfig) {
@@ -112,6 +114,7 @@ export class ExtensionService {
/**
* Gets features by key.
*
* @param key Key string, using dot notation
* @returns Features array found by key
*/
@@ -126,6 +129,7 @@ export class ExtensionService {
/**
* Adds one or more new rule evaluators to the existing set.
*
* @param values The new evaluators to add
*/
setEvaluators(values: { [key: string]: RuleEvaluator }) {
@@ -134,9 +138,10 @@ export class ExtensionService {
/**
* Adds one or more new auth guards to the existing set.
*
* @param values The new auth guards to add
*/
setAuthGuards(values: { [key: string]: Type<{}> }) {
setAuthGuards(values: { [key: string]: Type<any> }) {
if (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.
*
* @param values The new components to add
*/
setComponents(values: { [key: string]: Type<{}> }) {
setComponents(values: { [key: string]: Type<any> }) {
this.componentRegister.setComponents(values);
}
/**
* Retrieves a route using its ID value.
*
* @param id The ID value to look for
* @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.
*
* @param ids Array of ID value to look for
* @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 || [])
.map((id) => this.authGuards[id])
.filter((guard) => guard);
@@ -172,6 +180,7 @@ export class ExtensionService {
/**
* Retrieves an action using its ID value.
*
* @param id The ID value to look for
* @returns Action or null if not found
*/
@@ -181,6 +190,7 @@ export class ExtensionService {
/**
* Retrieves a RuleEvaluator function using its key name.
*
* @param key Key name to look for
* @returns RuleEvaluator or null if not found
*/
@@ -190,6 +200,7 @@ export class ExtensionService {
/**
* Evaluates a rule.
*
* @param ruleId ID of the rule to evaluate
* @param context Custom rule execution context.
* @returns True if the rule passed, false otherwise
@@ -200,6 +211,7 @@ export class ExtensionService {
/**
* Retrieves a registered extension component using its ID value.
*
* @param id The ID value to look for
* @returns The component or null if not found
*/
@@ -209,6 +221,7 @@ export class ExtensionService {
/**
* Retrieves a rule using its ID value.
*
* @param id The ID value to look for
* @returns The rule or null if not found
*/
@@ -218,11 +231,12 @@ export class ExtensionService {
/**
* Runs a lightweight expression stored in a string.
*
* @param value String containing the expression or literal value
* @param context Parameter object for the expression with details of app state
* @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' ) {
return this.evaluateExpression(value, context);
} else {
@@ -17,6 +17,6 @@
import { AppExtensionService } from './app-extension.service';
export function setupExtensions(appExtensionService: AppExtensionService): Function {
export function setupExtensions(appExtensionService: AppExtensionService) {
return () => appExtensionService.load();
}
+110
View File
@@ -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"
}
}
]
}
@@ -11,7 +11,6 @@
type="text"
class="adf-edit-report-title"
id="reportName"
autofocus
data-automation-id="reportName"
[value]="reportParameters.name"
(input)="reportParameters.name=$any($event).target.value"
@@ -15,7 +15,7 @@
* 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 { FormGroup } from '@angular/forms';
@@ -15,7 +15,7 @@
* 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 { Component, EventEmitter, Input, OnInit, Output, ViewEncapsulation, OnDestroy } from '@angular/core';
@@ -15,7 +15,7 @@
* 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 { FormControl, FormGroup, Validators } from '@angular/forms';
@@ -15,7 +15,7 @@
* 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 { FormControl, FormGroup, Validators } from '@angular/forms';
@@ -15,7 +15,7 @@
* 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 { FormGroup, Validators } from '@angular/forms';
@@ -18,7 +18,7 @@
import { EventEmitter, Input, OnChanges, Output, SimpleChanges, Directive } from '@angular/core';
@Directive()
// tslint:disable-next-line: directive-class-suffix
// eslint-disable-next-line @angular-eslint/directive-class-suffix
export class WidgetComponent implements OnChanges {
/** field. */
@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import { Component, ElementRef, EventEmitter, Input, OnInit, Output } from '@angular/core';
@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import { Component, ElementRef, EventEmitter, Input, Output } from '@angular/core';
@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import { Component, ElementRef, EventEmitter, Input, OnInit, Output } from '@angular/core';
@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import { Component, ElementRef, EventEmitter, Input, OnInit, Output } from '@angular/core';
@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import { Component, ElementRef, EventEmitter, Input, OnInit, Output } from '@angular/core';
@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
import { Component, ElementRef, EventEmitter, Input, Output } from '@angular/core';
@@ -15,7 +15,7 @@
* limitations under the License.
*/
/* tslint:disable:component-selector */
/* eslint-disable @angular-eslint/component-selector */
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