mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
reduce duplication and code improvements (#1707)
* reduce code duplication * reduce duplication, fix license headers * simplify code * typings fixes * update tests * minor fixes * markdown fixes * revert changes
This commit is contained in:
@@ -212,8 +212,7 @@ export function canDownloadSelection(context: RuleContext): boolean {
|
||||
* JSON ref: `app.selection.folder`
|
||||
*/
|
||||
export function hasFolderSelected(context: RuleContext): boolean {
|
||||
const folder = context.selection.folder;
|
||||
return folder ? true : false;
|
||||
return !!context.selection.folder;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -221,8 +220,7 @@ export function hasFolderSelected(context: RuleContext): boolean {
|
||||
* JSON ref: `app.selection.library`
|
||||
*/
|
||||
export function hasLibrarySelected(context: RuleContext): boolean {
|
||||
const library = context.selection.library;
|
||||
return library ? true : false;
|
||||
return !!context.selection.library;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -256,10 +254,7 @@ export function hasNoLibraryRole(context: RuleContext): boolean {
|
||||
* JSON ref: `app.selection.file`
|
||||
*/
|
||||
export function hasFileSelected(context: RuleContext): boolean {
|
||||
if (context && context.selection && context.selection.file) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return !!(context && context.selection && context.selection.file);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -57,9 +57,6 @@ export class ToolbarButtonComponent {
|
||||
}
|
||||
|
||||
private hasClickAction(actionRef: ContentActionRef): boolean {
|
||||
if (actionRef && actionRef.actions && actionRef.actions.click) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return !!(actionRef && actionRef.actions && actionRef.actions.click);
|
||||
}
|
||||
}
|
||||
|
@@ -53,10 +53,7 @@ export class ToolbarMenuItemComponent {
|
||||
}
|
||||
|
||||
private hasClickAction(actionRef: ContentActionRef): boolean {
|
||||
if (actionRef && actionRef.actions && actionRef.actions.click) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return !!(actionRef && actionRef.actions && actionRef.actions.click);
|
||||
}
|
||||
|
||||
trackById(_: number, obj: { id: string }) {
|
||||
|
@@ -47,10 +47,6 @@ export class ToolbarMenuComponent {
|
||||
this.matTrigger.closeMenu();
|
||||
}
|
||||
|
||||
get hasChildren(): boolean {
|
||||
return this.actionRef && this.actionRef.children && this.actionRef.children.length > 0;
|
||||
}
|
||||
|
||||
trackById(_: number, obj: { id: string }) {
|
||||
return obj.id;
|
||||
}
|
||||
|
@@ -466,7 +466,7 @@ export class AppExtensionService implements RuleContext {
|
||||
|
||||
// todo: move to ADF/RuleService
|
||||
isRuleDefined(ruleId: string): boolean {
|
||||
return ruleId && this.getEvaluator(ruleId) ? true : false;
|
||||
return !!(ruleId && this.getEvaluator(ruleId));
|
||||
}
|
||||
|
||||
// todo: move to ADF/RuleService
|
||||
|
@@ -126,10 +126,6 @@ export class RouterEffects {
|
||||
}
|
||||
|
||||
private isLibraryContent(path: PathInfoEntity): boolean {
|
||||
if (path && path.elements.length >= 2 && path.elements[1].name === 'Sites') {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return path && path.elements.length >= 2 && path.elements[1].name === 'Sites';
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user