various code quality fixes (#5792)

* various code quality fixes

* reduce duplicated code

* add safety check
This commit is contained in:
Denys Vuika
2020-06-18 17:57:46 +01:00
committed by GitHub
parent dc2060fe49
commit e9350bd297
54 changed files with 96 additions and 154 deletions

View File

@@ -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);
}
/**

View File

@@ -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 });
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
});
}

View File

@@ -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 {

View File

@@ -71,7 +71,7 @@ export class ClaimTaskDirective {
@HostListener('click')
async onClick() {
try {
this.claimTask();
await this.claimTask();
} catch (error) {
this.error.emit(error);
}

View File

@@ -70,7 +70,7 @@ export class UnclaimTaskDirective {
@HostListener('click')
async onClick() {
try {
this.unclaimTask();
await this.unclaimTask();
} catch (error) {
this.error.emit(error);
}

View File

@@ -78,8 +78,8 @@ export class FilterRepresentationModel implements UserTaskFilterRepresentation {
}
}
hasFilter() {
return this.filter ? true : false;
hasFilter(): boolean {
return !!this.filter;
}
}