mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
various code quality fixes (#5792)
* various code quality fixes * reduce duplicated code * add safety check
This commit is contained in:
@@ -176,10 +176,7 @@ export class AppsListComponent implements OnInit, AfterContentInit, OnDestroy {
|
||||
* Check if the value of the layoutType property is an allowed value
|
||||
*/
|
||||
isValidType(): boolean {
|
||||
if (this.layoutType && (this.layoutType === AppsListComponent.LAYOUT_LIST || this.layoutType === AppsListComponent.LAYOUT_GRID)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return this.layoutType && (this.layoutType === AppsListComponent.LAYOUT_LIST || this.layoutType === AppsListComponent.LAYOUT_GRID);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -54,7 +54,7 @@ export class AttachFileWidgetDialogService {
|
||||
selected,
|
||||
ecmHost,
|
||||
context,
|
||||
isSelectionValid: this.isNodeFile.bind(this),
|
||||
isSelectionValid: (entry: Node) => entry.isFile,
|
||||
showFilesInResult: true
|
||||
};
|
||||
|
||||
@@ -71,10 +71,6 @@ export class AttachFileWidgetDialogService {
|
||||
this.dialog.closeAll();
|
||||
}
|
||||
|
||||
private isNodeFile(entry: Node): boolean {
|
||||
return entry.isFile;
|
||||
}
|
||||
|
||||
private getLoginTitleTranslation(ecmHost: string): string {
|
||||
return this.translation.instant(`ATTACH-FILE.DIALOG.LOGIN`, { ecmHost });
|
||||
}
|
||||
|
@@ -392,11 +392,6 @@ export class FormComponent extends FormBaseComponent implements OnInit, OnDestro
|
||||
}
|
||||
|
||||
this.executeOutcome.emit(args);
|
||||
if (args.defaultPrevented) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return !args.defaultPrevented;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -37,6 +37,6 @@ export class ProcessDefinitionRepresentation {
|
||||
this.deploymentId = obj && obj.deploymentId || null;
|
||||
this.tenantId = obj && obj.tenantId || null;
|
||||
this.metaDataValues = obj && obj.metaDataValues || [];
|
||||
this.hasStartForm = obj && obj.hasStartForm === true ? true : false;
|
||||
this.hasStartForm = obj && obj.hasStartForm === true;
|
||||
}
|
||||
}
|
||||
|
@@ -64,11 +64,7 @@ export class AttachFormComponent implements OnInit, OnChanges {
|
||||
this.attachFormControl = new FormControl('', Validators.required);
|
||||
this.attachFormControl.valueChanges.subscribe( (currentValue) => {
|
||||
if (this.attachFormControl.valid) {
|
||||
if ( this.formId !== currentValue) {
|
||||
this.disableSubmit = false;
|
||||
} else {
|
||||
this.disableSubmit = true;
|
||||
}
|
||||
this.disableSubmit = this.formId === currentValue;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@@ -59,11 +59,6 @@ export class TaskAuditDirective implements OnChanges {
|
||||
|
||||
public audit: any;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param translateService
|
||||
* @param taskListService
|
||||
*/
|
||||
constructor(private contentService: ContentService,
|
||||
private taskListService: TaskListService) {
|
||||
}
|
||||
@@ -74,11 +69,8 @@ export class TaskAuditDirective implements OnChanges {
|
||||
}
|
||||
}
|
||||
|
||||
isValidType() {
|
||||
if (this.format && (this.isJsonFormat() || this.isPdfFormat())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
isValidType(): boolean {
|
||||
return this.format && (this.isJsonFormat() || this.isPdfFormat());
|
||||
}
|
||||
|
||||
setDefaultFormatType(): void {
|
||||
|
@@ -71,7 +71,7 @@ export class ClaimTaskDirective {
|
||||
@HostListener('click')
|
||||
async onClick() {
|
||||
try {
|
||||
this.claimTask();
|
||||
await this.claimTask();
|
||||
} catch (error) {
|
||||
this.error.emit(error);
|
||||
}
|
||||
|
@@ -70,7 +70,7 @@ export class UnclaimTaskDirective {
|
||||
@HostListener('click')
|
||||
async onClick() {
|
||||
try {
|
||||
this.unclaimTask();
|
||||
await this.unclaimTask();
|
||||
} catch (error) {
|
||||
this.error.emit(error);
|
||||
}
|
||||
|
@@ -78,8 +78,8 @@ export class FilterRepresentationModel implements UserTaskFilterRepresentation {
|
||||
}
|
||||
}
|
||||
|
||||
hasFilter() {
|
||||
return this.filter ? true : false;
|
||||
hasFilter(): boolean {
|
||||
return !!this.filter;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user