Commit c68c6eff authored by Alexander Philipp Nowosad's avatar Alexander Philipp Nowosad
Browse files

Add no-floating-promises, return-await

parent 272d66cf
Pipeline #138005 failed with stages
in 10 minutes and 25 seconds
......@@ -14,6 +14,9 @@
"prettier"
],
"rules": {
"@typescript-eslint/no-floating-promises": "error",
"no-return-await": "off",
"@typescript-eslint/return-await": "error",
"@angular-eslint/component-selector": [
"error",
{
......
......@@ -43,7 +43,7 @@ export class CreateCanvasConfigurationComponent
) {}
ngOnInit() {
this.loadCompanyModels().then();
void this.loadCompanyModels();
this.createForm = this.fb.group({
featureModel: this.featureModelFormService.createForm(),
});
......@@ -72,24 +72,23 @@ export class CreateCanvasConfigurationComponent
automaticCreation: true,
});
this.modalService.dismissAll();
this.router
.navigate(['companyModels', companyModel._id, 'select'], {
queryParams: {
bmProcessId: this.bmProcess._id,
},
})
.then();
await this.router.navigate(['companyModels', companyModel._id, 'select'], {
queryParams: {
bmProcessId: this.bmProcess._id,
},
});
}
navigateSelectExpertKnowledge() {
async navigateSelectExpertKnowledge() {
this.modalService.dismissAll();
this.router
.navigate(['companyModels', this.stepDecision.companyModelId, 'select'], {
await this.router.navigate(
['companyModels', this.stepDecision.companyModelId, 'select'],
{
queryParams: {
bmProcessId: this.bmProcess._id,
},
})
.then();
}
);
}
private async loadCompanyModels() {
......
......@@ -37,7 +37,7 @@ export class CreateCompetitorCanvasComponent implements OnInit, OnDestroy {
ngOnInit() {
this.routeSubscription = this.route.paramMap.subscribe((paramMap) => {
this.instanceId = +paramMap.get('instanceId');
this.loadCompanyModel(paramMap.get('companyModelId')).then();
void this.loadCompanyModel(paramMap.get('companyModelId'));
});
}
......
......@@ -31,21 +31,19 @@ export class EditCompetitorsComponent implements OnInit {
});
}
editCompetitor(id: number) {
this.router
.navigate(
[
'canvas',
this.companyModel._id,
'instance',
this.instanceId,
'competitors',
id,
'edit',
],
{ queryParams: this.processApiService.queryParams }
)
.then();
async editCompetitor(id: number) {
await this.router.navigate(
[
'canvas',
this.companyModel._id,
'instance',
this.instanceId,
'competitors',
id,
'edit',
],
{ queryParams: this.processApiService.queryParams }
);
}
async removeCompetitor(id: number) {
......
......@@ -23,7 +23,7 @@ export class InstanceLoaderService extends ElementLoaderService {
this.changesFeed = this.companyModelService
.getChangesFeed(companyModelId)
.subscribe(() => this.loadInstance(companyModelId, instanceId));
this.loadInstance(companyModelId, instanceId).then();
void this.loadInstance(companyModelId, instanceId);
}
private async loadInstance(companyModelId: string, instanceId: number) {
......
......@@ -40,7 +40,7 @@ export class ProcessApiService implements OnDestroy {
this.changesFeed = this.runningProcessService
.getChangesFeed(this.stepInfo.runningProcessId)
.subscribe(() => this.loadProcessInfo());
this.loadProcessInfo().then();
void this.loadProcessInfo();
}
});
}
......
......@@ -48,7 +48,7 @@ export class RefineCanvasComponent implements OnInit {
} else {
this.uncheckConformance();
}
this.loadExpertModels().then();
void this.loadExpertModels();
});
}
......
......@@ -19,7 +19,7 @@ export class SelectCanvasDefinitionConfigurationComponent
constructor(private canvasDefinitionService: CanvasDefinitionService) {}
ngOnInit() {
this.loadCanvasDefinitions().then();
void this.loadCanvasDefinitions();
}
async loadCanvasDefinitions() {
......
......@@ -10,113 +10,93 @@ import { InstanceArtifactData } from '../canvas-meta-model/instance-artifact-dat
export class CanvasApiService implements ModuleApiService {
createCanvas(input: MethodExecutionInput): void {
const stepInfo = this.getStepInfo(input);
input.router
.navigate(['canvas', 'instance', 'create'], { queryParams: stepInfo })
.then();
void input.router.navigate(['canvas', 'instance', 'create'], {
queryParams: stepInfo,
});
}
editCanvas(input: MethodExecutionInput): void {
const stepInfo = this.getStepInfo(input);
const reference: InstanceArtifactData =
input.inputStepArtifacts[0].data.data;
input.router
.navigate(
['canvas', reference.id, 'instance', reference.instanceId, 'edit'],
{ queryParams: stepInfo }
)
.then();
void input.router.navigate(
['canvas', reference.id, 'instance', reference.instanceId, 'edit'],
{ queryParams: stepInfo }
);
}
refineCanvas(input: MethodExecutionInput): void {
const stepInfo = this.getStepInfo(input);
const reference: InstanceArtifactData =
input.inputStepArtifacts[0].data.data;
input.router
.navigate(
['canvas', reference.id, 'instance', reference.instanceId, 'refine'],
{ queryParams: stepInfo }
)
.then();
void input.router.navigate(
['canvas', reference.id, 'instance', reference.instanceId, 'refine'],
{ queryParams: stepInfo }
);
}
compareCompetitors(input: MethodExecutionInput): void {
const stepInfo = this.getStepInfo(input);
const reference: InstanceArtifactData =
input.inputStepArtifacts[0].data.data;
input.router
.navigate(
['canvas', reference.id, 'instance', reference.instanceId, 'compare'],
{ queryParams: stepInfo }
)
.then();
void input.router.navigate(
['canvas', reference.id, 'instance', reference.instanceId, 'compare'],
{ queryParams: stepInfo }
);
}
createCompetitors(input: MethodExecutionInput): void {
const stepInfo = this.getStepInfo(input);
const reference: InstanceArtifactData =
input.inputStepArtifacts[0].data.data;
input.router
.navigate(
[
'canvas',
reference.id,
'instance',
reference.instanceId,
'competitors',
],
{ queryParams: stepInfo }
)
.then();
void input.router.navigate(
['canvas', reference.id, 'instance', reference.instanceId, 'competitors'],
{ queryParams: stepInfo }
);
}
manageCompetitors(input: MethodExecutionInput): void {
const stepInfo = this.getStepInfo(input);
const reference: InstanceArtifactData =
input.inputStepArtifacts[0].data.data;
input.router
.navigate(
[
'canvas',
reference.id,
'instance',
reference.instanceId,
'competitors',
'edit',
],
{ queryParams: stepInfo }
)
.then();
void input.router.navigate(
[
'canvas',
reference.id,
'instance',
reference.instanceId,
'competitors',
'edit',
],
{ queryParams: stepInfo }
);
}
viewCanvas(input: MethodExecutionInput): void {
const stepInfo = this.getStepInfo(input);
const reference: InstanceArtifactData =
input.inputStepArtifacts[0].data.data;
input.router
.navigate(
['canvas', reference.id, 'instance', reference.instanceId, 'view'],
{ queryParams: stepInfo }
)
.then();
void input.router.navigate(
['canvas', reference.id, 'instance', reference.instanceId, 'view'],
{ queryParams: stepInfo }
);
}
editModel(input: MethodExecutionInput): void {
const stepInfo = this.getStepInfo(input);
const reference: InstanceArtifactData =
input.inputStepArtifacts[0].data.data;
input.router
.navigate(
[
'canvas',
reference.id,
'instance',
reference.instanceId,
'model',
'edit',
],
{ queryParams: stepInfo }
)
.then();
void input.router.navigate(
[
'canvas',
reference.id,
'instance',
reference.instanceId,
'model',
'edit',
],
{ queryParams: stepInfo }
);
}
executeMethod(methodName: string, input: MethodExecutionInput): void {
......
......@@ -20,7 +20,7 @@ export class CanvasDefinitionLoaderService extends ElementLoaderService {
this.changesFeed = this.canvasDefinitionService
.getChangesFeed(canvasDefinitionId)
.subscribe(() => this.loadCanvasDefinition(canvasDefinitionId));
this.loadCanvasDefinition(canvasDefinitionId).then();
void this.loadCanvasDefinition(canvasDefinitionId);
}
private async loadCanvasDefinition(canvasDefinitionId: string) {
......
......@@ -19,9 +19,9 @@ export class CanvasResolveService {
instanceId: number
): void {
const artifactData = this.getArtifactData(companyModelId, instanceId);
this.runningProcessService
.finishExecuteStep(stepInfo, { outputArtifactData: [artifactData] })
.then();
void this.runningProcessService.finishExecuteStep(stepInfo, {
outputArtifactData: [artifactData],
});
}
resolveEditCanvas(
......@@ -30,9 +30,9 @@ export class CanvasResolveService {
instanceId: number
): void {
const artifactData = this.getArtifactData(companyModelId, instanceId);
this.runningProcessService
.finishExecuteStep(stepInfo, { outputArtifactData: [artifactData] })
.then();
void this.runningProcessService.finishExecuteStep(stepInfo, {
outputArtifactData: [artifactData],
});
}
private getArtifactData(
......
......@@ -39,7 +39,7 @@ export class CanvasService {
console.log('Registered Canvas Module as view method for canvas models');
}
viewModel(
async viewModel(
model: ArtifactDataReference,
router: Router,
reference: Reference
......@@ -65,20 +65,18 @@ export class CanvasService {
};
break;
}
router
.navigate(
[
'canvas',
modelReference.id,
'instance',
modelReference.instanceId,
'view',
],
{
queryParams,
}
)
.then();
await router.navigate(
[
'canvas',
modelReference.id,
'instance',
modelReference.instanceId,
'view',
],
{
queryParams,
}
);
}
private addMethods(module: Module) {
......
......@@ -22,7 +22,7 @@ export class CompanyModelLoaderService extends ElementLoaderService {
this.changesFeed = this.companyModelService
.getChangesFeed(companyModelId)
.subscribe(() => this.loadCompanyModel(companyModelId));
this.loadCompanyModel(companyModelId).then();
void this.loadCompanyModel(companyModelId);
}
private async loadCompanyModel(companyModelId: string) {
......
......@@ -40,10 +40,10 @@ export class CompanyModelSelectExpertKnowledgeComponent
ngOnInit() {
this.querySubscription = this.route.queryParamMap.subscribe((paramMap) => {
this.loadBmProcess(paramMap.get('bmProcessId')).then();
void this.loadBmProcess(paramMap.get('bmProcessId'));
});
this.routeSubscription = this.route.paramMap.subscribe((paramMap) => {
this.loadCompanyModel(paramMap.get('id')).then();
void this.loadCompanyModel(paramMap.get('id'));
});
}
......@@ -65,10 +65,12 @@ export class CompanyModelSelectExpertKnowledgeComponent
this.bmProcess = await this.bmProcessService.get(bmProcessId);
}
mergeExpertModel(expertModelId: string): void {
this.router
.navigate(['/merge', this.companyModel._id, expertModelId])
.then();
async mergeExpertModel(expertModelId: string): Promise<void> {
await this.router.navigate([
'/merge',
this.companyModel._id,
expertModelId,
]);
}
async selectExpertModel() {
......
......@@ -60,14 +60,16 @@ export class CompanyModelComponent implements OnInit {
);
}
mergeExpertModel(expertModelId: string): void {
this.router
.navigate(['/merge', this.companyModel._id, expertModelId])
.then();
async mergeExpertModel(expertModelId: string): Promise<void> {
await this.router.navigate([
'/merge',
this.companyModel._id,
expertModelId,
]);
}
viewExpertModel(expertModelId: string): void {
this.router.navigate(['/expertModels', expertModelId]).then();
async viewExpertModel(expertModelId: string): Promise<void> {
await this.router.navigate(['/expertModels', expertModelId]);
}
/**
......
......@@ -46,12 +46,12 @@ export class CompanyModelsComponent {
this.modelList.resetAddForm();
}
viewCompanyModel(companyModelId: string): void {
this.router.navigate(['/companyModels', companyModelId]).then();
async viewCompanyModel(companyModelId: string): Promise<void> {
await this.router.navigate(['/companyModels', companyModelId]);
}
editCompanyModel(companyModelId: string): void {
this.router.navigate(['/companyModels', companyModelId, 'edit']).then();
async editCompanyModel(companyModelId: string): Promise<void> {
await this.router.navigate(['/companyModels', companyModelId, 'edit']);
}
async openDeleteCompanyModelModal(featureModelId: string) {
......
......@@ -20,7 +20,7 @@ export class ExpertModelLoaderService extends ElementLoaderService {
this.changesFeed = this.expertModelService
.getChangesFeed(expertModelId)
.subscribe(() => this.loadExpertModel(expertModelId));
this.loadExpertModel(expertModelId).then();
void this.loadExpertModel(expertModelId);
}
private async loadExpertModel(bmProcessId: string) {
......
......@@ -55,15 +55,13 @@ export class ExpertModelComponent {
*
* @param businessModelId id of the business model
*/
viewExample(businessModelId: number): void {
this.router
.navigate([
'expertModels',
this.expertModel._id,
'examples',
businessModelId,
])
.then();
async viewExample(businessModelId: number): Promise<void> {
await this.router.navigate([
'expertModels',
this.expertModel._id,
'examples',
businessModelId,
]);
}
/**
......@@ -71,10 +69,13 @@ export class ExpertModelComponent {
*
* @param patternId the id of the pattern
*/
viewPattern(patternId: number) {
this.router
.navigate(['expertModels', this.expertModel._id, 'patterns', patternId])
.then();
async viewPattern(patternId: number): Promise<void> {
await this.router.navigate([
'expertModels',
this.expertModel._id,
'patterns',
patternId,
]);
}
/**
......
......@@ -45,12 +45,12 @@ export class ExpertModelsComponent {
this.modelList.resetAddForm();
}
viewExpertModel(expertModelId: string): void {
this.router.navigate(['/expertModels', expertModelId]).then();
async viewExpertModel(expertModelId: string): Promise<void> {
await this.router.navigate(['/expertModels', expertModelId]);
}
editExpertModel(expertModelId: string): void {
this.router.navigate(['/expertModels', expertModelId, 'edit']).then();
async editExpertModel(expertModelId: string): Promise<void> {
await this.router.navigate(['/expertModels', expertModelId, 'edit']);
}
async openDeleteExpertModelModal(featureModelId: string) {
......
......@@ -39,7 +39,7 @@ export class ModelListComponent implements OnInit, ModelList {
) {}
ngOnInit() {
this.loadCanvasDefinitions().then();
void this.loadCanvasDefinitions();
}
resetAddForm() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment