Skip to content

Commit

Permalink
[ci:force] - fixing lint
Browse files Browse the repository at this point in the history
  • Loading branch information
VitoAlbano committed Oct 12, 2024
1 parent 0b54aeb commit bfc1b0f
Show file tree
Hide file tree
Showing 138 changed files with 159 additions and 766 deletions.
24 changes: 8 additions & 16 deletions lib/extensions/src/lib/services/app-extension.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,31 +43,23 @@ export class AppExtensionService {
return;
}

const references = (config.$references || [])
.filter((entry) => typeof entry === 'object')
.map((entry) => entry as ExtensionRef);
const references = (config.$references || []).filter((entry) => typeof entry === 'object').map((entry) => entry as ExtensionRef);
this._references.next(references);
}

/**
* Provides a collection of document list columns for the particular preset.
* The result is filtered by the **disabled** state.
*
* @param key Preset key.
* @returns list of document list presets
*/
getDocumentListPreset(key: string): DocumentListPresetRef[] {
return this.extensionService
.getElements<DocumentListPresetRef>(
`features.documentList.${key}`
)
.filter((entry) => !entry.disabled);
return this.extensionService.getElements<DocumentListPresetRef>(`features.documentList.${key}`).filter((entry) => !entry.disabled);
}

/**
* Provides a list of the Viewer content extensions,
* filtered by **disabled** state and **rules**.
*
* @returns list of viewer extension references
*/
getViewerExtensions(): ViewerExtensionRef[] {
Expand All @@ -78,13 +70,13 @@ export class AppExtensionService {

protected isViewerExtensionDisabled(extension: ViewerExtensionRef): boolean {
if (extension) {
if (extension.disabled) {
return true;
}
if (extension.disabled) {
return true;
}

if (extension.rules?.disabled) {
return this.extensionService.evaluateRule(extension.rules.disabled);
}
if (extension.rules?.disabled) {
return this.extensionService.evaluateRule(extension.rules.disabled);
}
}

return false;
Expand Down
42 changes: 9 additions & 33 deletions lib/extensions/src/lib/services/extension-loader.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,9 @@ import { RuleRef } from '../config/rule.extensions';
providedIn: 'root'
})
export class ExtensionLoaderService {
constructor(private http: HttpClient) {
}
constructor(private http: HttpClient) {}

load(
configPath: string,
pluginsPath: string,
extensions?: string[],
extensionValues?: ExtensionConfig[]
): Promise<ExtensionConfig> {
load(configPath: string, pluginsPath: string, extensions?: string[], extensionValues?: ExtensionConfig[]): Promise<ExtensionConfig> {
return new Promise<any>((resolve) => {
this.loadConfig(configPath, 0).then((result) => {
if (result) {
Expand All @@ -54,9 +48,7 @@ export class ExtensionLoaderService {
}

if (config.$references?.length > 0 || extensionValues) {
const plugins = (config.$references ?? []).map((name, idx) =>
this.loadConfig(`${pluginsPath}/${name}`, idx)
);
const plugins = (config.$references ?? []).map((name, idx) => this.loadConfig(`${pluginsPath}/${name}`, idx));

Promise.all(plugins).then((results) => {
let configs = results
Expand All @@ -65,13 +57,9 @@ export class ExtensionLoaderService {
.map((entry) => entry.config);

if (extensionValues) {
configs = [
...configs,
...extensionValues
];
configs = [...configs, ...extensionValues];
}


if (configs.length > 0) {
config = mergeObjects(config, ...configs);
}
Expand All @@ -96,26 +84,18 @@ export class ExtensionLoaderService {
* Retrieves configuration elements.
* Filters element by **enabled** and **order** attributes.
* Example:
* `getElements<ViewerExtensionRef>(config, 'features.viewer.extensions')`
*
* `getElements<ViewerExtensionRef>(config, 'features.viewer.extensions')`
* @param config configuration settings
* @param key element key
* @param fallback fallback array of values
* @returns list of elements
*/
getElements<T extends ExtensionElement>(
config: ExtensionConfig,
key: string,
fallback: Array<T> = []
): Array<T> {
getElements<T extends ExtensionElement>(config: ExtensionConfig, key: string, fallback: Array<T> = []): Array<T> {
const values = getValue(config, key) || fallback || [];
return values.filter(filterEnabled).sort(sortByOrder);
}

getContentActions(
config: ExtensionConfig,
key: string
): Array<ContentActionRef> {
getContentActions(config: ExtensionConfig, key: string): Array<ContentActionRef> {
return this.getElements(config, key).map(this.setActionDefaults);
}

Expand Down Expand Up @@ -150,8 +130,7 @@ export class ExtensionLoaderService {
protected getMetadata(config: ExtensionConfig): ExtensionRef {
const result: any = {};

Object
.keys(config)
Object.keys(config)
.filter((key) => key.startsWith('$'))
.forEach((key) => {
result[key] = config[key];
Expand All @@ -160,10 +139,7 @@ export class ExtensionLoaderService {
return result;
}

protected loadConfig(
url: string,
order: number
): Promise<{ order: number; config: ExtensionConfig }> {
protected loadConfig(url: string, order: number): Promise<{ order: number; config: ExtensionConfig }> {
return new Promise((resolve) => {
this.http.get<ExtensionConfig>(url).subscribe(
(config) => {
Expand Down
17 changes: 0 additions & 17 deletions lib/extensions/src/lib/services/extension.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import { BehaviorSubject, Observable } from 'rxjs';

/**
* The default extensions factory
*
* @returns the list of extension json files
*/
export function extensionJsonsFactory() {
Expand All @@ -48,7 +47,6 @@ export const EXTENSION_JSON_VALUES = new InjectionToken<string[][]>('extension-j

/**
* Provides the extension json values for the angular modules
*
* @param jsons files to provide
* @returns a provider section
*/
Expand All @@ -62,7 +60,6 @@ export function provideExtensionConfig(jsons: string[]) {

/**
* Provides the extension json raw values for the angular modules
*
* @param extensionConfigValue config value
* @returns a provider section
*/
Expand Down Expand Up @@ -103,7 +100,6 @@ 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> {
Expand All @@ -115,7 +111,6 @@ export class ExtensionService {

/**
* Registers extensions from a config object.
*
* @param config Object with config data
*/
setup(config: ExtensionConfig) {
Expand All @@ -142,7 +137,6 @@ export class ExtensionService {

/**
* Gets features by key.
*
* @param key Key string using dot notation or array of strings
* @param defaultValue Default value returned if feature is not found, default is empty array
* @returns Feature found by key
Expand All @@ -158,7 +152,6 @@ 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 }) {
Expand All @@ -167,7 +160,6 @@ export class ExtensionService {

/**
* Adds one or more new auth guards to the existing set.
*
* @param values The new auth guards to add
*/
setAuthGuards(values: Record<string, unknown>) {
Expand All @@ -178,7 +170,6 @@ 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<any> }) {
Expand All @@ -187,7 +178,6 @@ export class ExtensionService {

/**
* Retrieves a route using its ID value.
*
* @param id The ID value to look for
* @returns The route or null if not found
*/
Expand All @@ -197,7 +187,6 @@ 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
*/
Expand All @@ -207,7 +196,6 @@ 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
*/
Expand All @@ -217,7 +205,6 @@ 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
*/
Expand All @@ -227,7 +214,6 @@ 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
Expand All @@ -238,7 +224,6 @@ 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
*/
Expand All @@ -248,7 +233,6 @@ 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
*/
Expand All @@ -258,7 +242,6 @@ 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
Expand Down
4 changes: 0 additions & 4 deletions lib/extensions/src/lib/services/rule.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export class RuleService {

/**
* Adds one or more new rule evaluators to the existing set.
*
* @param values The new evaluators to add
*/
setEvaluators(values: { [key: string]: RuleEvaluator }) {
Expand All @@ -47,7 +46,6 @@ export class RuleService {

/**
* Retrieves a rule using its ID value.
*
* @param id The ID value to look for
* @returns The rule or null if not found
*/
Expand All @@ -57,7 +55,6 @@ export class RuleService {

/**
* Retrieves a RuleEvaluator function using its key name.
*
* @param key Key name to look for
* @returns RuleEvaluator or null if not found
*/
Expand All @@ -71,7 +68,6 @@ export class RuleService {

/**
* 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
Expand Down
3 changes: 2 additions & 1 deletion lib/extensions/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"@alfresco/js-api": ["../../../dist/libs/js-api"],
"@alfresco/js-api/*": ["../../../dist/libs/js-api/*"]
}
}
},
"include": ["src/**/*.ts", "index.ts"]
}
2 changes: 1 addition & 1 deletion lib/extensions/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"useDefineForClassFields": false
},
"files": ["src/test.ts"],
"include": ["**/*.spec.ts", "**/*.test.ts", "**/*.d.ts"]
"include": ["**/*.spec.ts", "**/*.test.ts", "**/*.d.ts", "index.ts"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ export class AnalyticsReportListComponent implements OnInit {

/**
* Reload the component
*
* @param reportId report id
*/
reload(reportId?: number) {
Expand All @@ -95,7 +94,6 @@ export class AnalyticsReportListComponent implements OnInit {

/**
* Get the report list
*
* @param appId application id
* @param reportId report id
*/
Expand Down Expand Up @@ -139,7 +137,6 @@ export class AnalyticsReportListComponent implements OnInit {

/**
* Check if the report list is empty
*
* @returns `true` if report list is empty, otherwise `false`
*/
isReportsEmpty(): boolean {
Expand All @@ -148,7 +145,6 @@ export class AnalyticsReportListComponent implements OnInit {

/**
* Select the current report
*
* @param report report model
*/
selectReport(report: ReportParametersModel) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export class AnalyticsService {

/**
* Retrieve all the Deployed app
*
* @param appId application id
* @returns list or report parameter models
*/
Expand All @@ -71,7 +70,6 @@ export class AnalyticsService {

/**
* Retrieve Report by name
*
* @param reportName - The name of report
* @returns report model
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ export class DiagramTooltipComponent implements AfterViewInit, OnDestroy {

/**
* Calculates the tooltip position and displays it
*
* @param event mouseenter/touchend event
*/
private handleMouseEnter(event): void {
Expand Down
3 changes: 2 additions & 1 deletion lib/insights/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
},
"target": "ES2022",
"useDefineForClassFields": false
}
},
"include": ["src/**/*.ts", "index.ts"]
}
Loading

0 comments on commit bfc1b0f

Please sign in to comment.