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

@@ -365,11 +365,7 @@ export class FormCloudComponent extends FormBaseComponent implements OnChanges,
}
this.executeOutcome.emit(args);
if (args.defaultPrevented) {
return false;
}
return true;
return !args.defaultPrevented;
}
protected storeFormAsMetadata() {

View File

@@ -46,7 +46,7 @@ export class ContentCloudNodeSelectorService {
actionName: 'Choose',
currentFolderId: '-my-',
select,
isSelectionValid: this.isNodeFile.bind(this),
isSelectionValid: (entry: Node) => entry.isFile,
showFilesInResult: true
};
@@ -61,8 +61,4 @@ export class ContentCloudNodeSelectorService {
close() {
this.dialog.closeAll();
}
private isNodeFile(entry: Node): boolean {
return entry && entry.isFile;
}
}

View File

@@ -58,7 +58,7 @@ export class CancelProcessDirective implements OnInit, OnDestroy {
@HostListener('click')
async onClick() {
try {
this.cancelProcess();
await this.cancelProcess();
} catch (error) {
this.error.emit(error);
}

View File

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

View File

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