diff --git a/package.json b/package.json index 3d7f5ae..519b952 100644 --- a/package.json +++ b/package.json @@ -60,6 +60,7 @@ "eslint-plugin-prettier": "^4.0.0", "jasmine-core": "^4.0.1", "jasmine-spec-reporter": "^7.0.0", + "jsonc-parser": "^3.3.1", "karma": "^6.3.17", "karma-chrome-launcher": "^3.1.0", "karma-coverage-istanbul-reporter": "^3.0.3", diff --git a/src/app/gui/components/service/service.component.ts b/src/app/gui/components/service/service.component.ts index 8967d81..9a79809 100644 --- a/src/app/gui/components/service/service.component.ts +++ b/src/app/gui/components/service/service.component.ts @@ -93,7 +93,7 @@ export class ServiceComponent implements OnInit { this.api.gui.alert('
' + django.gettext('Launcher') + '
', message); } - async launch(transport: JSONTransport|null) { + async launch(transport: JSONTransport | null) { if (this.service.maintenance) { this.notifyNotLaunching(django.gettext('Service is in maintenance and cannot be launched')); } else if (this.service.not_accesible) { @@ -112,28 +112,29 @@ export class ServiceComponent implements OnInit { transport = this.service.transports[0]; } if (this.service.custom_message_text !== null && this.service.custom_message_text !== undefined) { + const tr = transport; if ((await this.api.gui.yesno(django.gettext('Service message'), this.service.custom_message_text)) === false) { return; } + console.debug('Launching service with transport', tr); } this.api.executeCustomJSForServiceLaunch(); this.api.launchURL(transport.link); } } - action(type: string) { + async action(type: string) { const title = (type === 'release' ? django.gettext('Release service: ') : django.gettext('Reset service: ')) + ' ' + this.serviceName; const action = type === 'release' ? django.gettext('Service released') : django.gettext('Service reseted'); - this.api.gui.yesno(title, django.gettext('Are you sure?')).then((val) => { - if (val) { - this.api.action(type, this.service.id).then((service) => { - if (service) { - this.api.gui.alert(title, action); - } - }); + if ((await this.api.gui.yesno(title, django.gettext('Are you sure?'))) === false) { + return; + } + this.api.action(type, this.service.id).then((service) => { + if (service) { + this.api.gui.alert(title, action); } }); } diff --git a/src/app/gui/modal/modal.component.ts b/src/app/gui/modal/modal.component.ts index aa63e17..ceb2eb6 100644 --- a/src/app/gui/modal/modal.component.ts +++ b/src/app/gui/modal/modal.component.ts @@ -1,7 +1,8 @@ /* eslint-disable no-shadow */ import { Component, OnInit, Inject } from '@angular/core'; import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; -import { interval, Subscription, Observable } from 'rxjs'; +import { interval } from 'rxjs'; +import { Future } from '../../helpers/tools'; export enum DialogType { alert = 0, @@ -25,19 +26,17 @@ export interface ModalData { }) export class ModalComponent implements OnInit { extra = ''; - subscription: Subscription | null = null; - yesno: Promise