Skip to content

Commit

Permalink
NAS-131666 / 24.10.0 / Add support for Stopping state (by undsoft) (#…
Browse files Browse the repository at this point in the history
…10836)

* NAS-131666: Add support for Stopping state

---------

Co-authored-by: Evgeny Stepanovych <[email protected]>
  • Loading branch information
bugclerk and undsoft authored Oct 9, 2024
1 parent b566fdf commit d752456
Show file tree
Hide file tree
Showing 92 changed files with 95 additions and 107 deletions.
2 changes: 2 additions & 0 deletions src/app/enums/catalog-app-state.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ export enum CatalogAppState {
Deploying = 'DEPLOYING',
Stopped = 'STOPPED',
Crashed = 'CRASHED',
Stopping = 'STOPPING',
}

export const appStateIcons = new Map<CatalogAppState, string>([
[CatalogAppState.Running, 'mdi-check-circle'],
[CatalogAppState.Deploying, 'mdi-progress-wrench'],
[CatalogAppState.Stopping, 'mdi-progress-wrench'],
[CatalogAppState.Stopped, 'mdi-stop-circle'],
[CatalogAppState.Crashed, 'mdi-alert-circle'],
]);
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { Store } from '@ngrx/store';
import { TranslateService } from '@ngx-translate/core';
import {
combineLatest, filter, finalize,
combineLatest, filter,
Observable,
} from 'rxjs';
import { CatalogAppState } from 'app/enums/catalog-app-state.enum';
Expand Down Expand Up @@ -324,10 +324,8 @@ export class InstalledAppsComponent implements OnInit, AfterViewInit {
}

stop(name: string): void {
this.loader.open(this.translate.instant('Stopping "{app}"', { app: name }));
this.appService.stopApplication(name)
.pipe(
finalize(() => this.loader.close()),
this.errorHandler.catchError(),
untilDestroyed(this),
)
Expand Down
3 changes: 3 additions & 0 deletions src/app/pages/apps/enum/app-status.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export enum AppStatus {
Deploying = 'DEPLOYING',
Stopped = 'STOPPED',
Stopping = 'STOPPING',
Crashed = 'CRASHED',
}

export const appStatusIcons = new Map<AppStatus, string>([
Expand All @@ -14,6 +15,7 @@ export const appStatusIcons = new Map<AppStatus, string>([
[AppStatus.Deploying, 'mdi-progress-wrench'],
[AppStatus.Stopping, 'mdi-progress-wrench'],
[AppStatus.Stopped, 'mdi-stop-circle'],
[AppStatus.Crashed, 'mdi-stop-circle'],
]);

export const appStatusLabels = new Map<AppStatus, string>([
Expand All @@ -22,4 +24,5 @@ export const appStatusLabels = new Map<AppStatus, string>([
[AppStatus.Deploying, T('Deploying')],
[AppStatus.Stopped, T('Stopped')],
[AppStatus.Stopping, T('Stopping')],
[AppStatus.Crashed, T('Crashed')],
]);
17 changes: 1 addition & 16 deletions src/app/pages/apps/utils/get-app-status.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,9 @@
import { CatalogAppState } from 'app/enums/catalog-app-state.enum';
import { App, AppStartQueryParams } from 'app/interfaces/app.interface';
import { Job } from 'app/interfaces/job.interface';
import { AppStatus } from 'app/pages/apps/enum/app-status.enum';

export function getAppStatus(app: App, _?: Job<void, AppStartQueryParams>): AppStatus {
if (!app) return null;

let status: AppStatus;

switch (app.state) {
case CatalogAppState.Running:
status = AppStatus.Running;
break;
case CatalogAppState.Deploying:
status = AppStatus.Deploying;
break;
case CatalogAppState.Stopped:
status = AppStatus.Stopped;
break;
}

return status;
return app.state as unknown as AppStatus;
}
2 changes: 1 addition & 1 deletion src/assets/i18n/af.json
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,7 @@
"Copy to Clipboard": "",
"Cores": "",
"Country": "",
"Crashed": "",
"Create": "",
"Create ACME Certificate": "",
"Create ACME DNS-Authenticator": "",
Expand Down Expand Up @@ -4085,7 +4086,6 @@
"Stop {vmName}?": "",
"Stopped": "",
"Stopping": "",
"Stopping \"{app}\"": "",
"Stopping Apps Service": "",
"Stopping {rowName}": "",
"Stops the rollback when the safety check finds any related clone snapshots that are newer than the rollback snapshot.": "",
Expand Down
2 changes: 1 addition & 1 deletion src/assets/i18n/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,7 @@
"Copy to Clipboard": "",
"Cores": "",
"Country": "",
"Crashed": "",
"Create": "",
"Create ACME Certificate": "",
"Create ACME DNS-Authenticator": "",
Expand Down Expand Up @@ -4085,7 +4086,6 @@
"Stop {vmName}?": "",
"Stopped": "",
"Stopping": "",
"Stopping \"{app}\"": "",
"Stopping Apps Service": "",
"Stopping {rowName}": "",
"Stops the rollback when the safety check finds any related clone snapshots that are newer than the rollback snapshot.": "",
Expand Down
2 changes: 1 addition & 1 deletion src/assets/i18n/ast.json
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,7 @@
"Copy to Clipboard": "",
"Cores": "",
"Country": "",
"Crashed": "",
"Create": "",
"Create ACME Certificate": "",
"Create ACME DNS-Authenticator": "",
Expand Down Expand Up @@ -4085,7 +4086,6 @@
"Stop {vmName}?": "",
"Stopped": "",
"Stopping": "",
"Stopping \"{app}\"": "",
"Stopping Apps Service": "",
"Stopping {rowName}": "",
"Stops the rollback when the safety check finds any related clone snapshots that are newer than the rollback snapshot.": "",
Expand Down
2 changes: 1 addition & 1 deletion src/assets/i18n/az.json
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,7 @@
"Copy to Clipboard": "",
"Cores": "",
"Country": "",
"Crashed": "",
"Create": "",
"Create ACME Certificate": "",
"Create ACME DNS-Authenticator": "",
Expand Down Expand Up @@ -4085,7 +4086,6 @@
"Stop {vmName}?": "",
"Stopped": "",
"Stopping": "",
"Stopping \"{app}\"": "",
"Stopping Apps Service": "",
"Stopping {rowName}": "",
"Stops the rollback when the safety check finds any related clone snapshots that are newer than the rollback snapshot.": "",
Expand Down
2 changes: 1 addition & 1 deletion src/assets/i18n/be.json
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,7 @@
"Copy to Clipboard": "",
"Cores": "",
"Country": "",
"Crashed": "",
"Create": "",
"Create ACME Certificate": "",
"Create ACME DNS-Authenticator": "",
Expand Down Expand Up @@ -4085,7 +4086,6 @@
"Stop {vmName}?": "",
"Stopped": "",
"Stopping": "",
"Stopping \"{app}\"": "",
"Stopping Apps Service": "",
"Stopping {rowName}": "",
"Stops the rollback when the safety check finds any related clone snapshots that are newer than the rollback snapshot.": "",
Expand Down
2 changes: 1 addition & 1 deletion src/assets/i18n/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,7 @@
"Copy to Clipboard": "",
"Cores": "",
"Country": "",
"Crashed": "",
"Create": "",
"Create ACME Certificate": "",
"Create ACME DNS-Authenticator": "",
Expand Down Expand Up @@ -4085,7 +4086,6 @@
"Stop {vmName}?": "",
"Stopped": "",
"Stopping": "",
"Stopping \"{app}\"": "",
"Stopping Apps Service": "",
"Stopping {rowName}": "",
"Stops the rollback when the safety check finds any related clone snapshots that are newer than the rollback snapshot.": "",
Expand Down
2 changes: 1 addition & 1 deletion src/assets/i18n/bn.json
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,7 @@
"Copy to Clipboard": "",
"Cores": "",
"Country": "",
"Crashed": "",
"Create": "",
"Create ACME Certificate": "",
"Create ACME DNS-Authenticator": "",
Expand Down Expand Up @@ -4085,7 +4086,6 @@
"Stop {vmName}?": "",
"Stopped": "",
"Stopping": "",
"Stopping \"{app}\"": "",
"Stopping Apps Service": "",
"Stopping {rowName}": "",
"Stops the rollback when the safety check finds any related clone snapshots that are newer than the rollback snapshot.": "",
Expand Down
2 changes: 1 addition & 1 deletion src/assets/i18n/br.json
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,7 @@
"Copy to Clipboard": "",
"Cores": "",
"Country": "",
"Crashed": "",
"Create": "",
"Create ACME Certificate": "",
"Create ACME DNS-Authenticator": "",
Expand Down Expand Up @@ -4085,7 +4086,6 @@
"Stop {vmName}?": "",
"Stopped": "",
"Stopping": "",
"Stopping \"{app}\"": "",
"Stopping Apps Service": "",
"Stopping {rowName}": "",
"Stops the rollback when the safety check finds any related clone snapshots that are newer than the rollback snapshot.": "",
Expand Down
2 changes: 1 addition & 1 deletion src/assets/i18n/bs.json
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,7 @@
"Copy to Clipboard": "",
"Cores": "",
"Country": "",
"Crashed": "",
"Create": "",
"Create ACME Certificate": "",
"Create ACME DNS-Authenticator": "",
Expand Down Expand Up @@ -4085,7 +4086,6 @@
"Stop {vmName}?": "",
"Stopped": "",
"Stopping": "",
"Stopping \"{app}\"": "",
"Stopping Apps Service": "",
"Stopping {rowName}": "",
"Stops the rollback when the safety check finds any related clone snapshots that are newer than the rollback snapshot.": "",
Expand Down
2 changes: 1 addition & 1 deletion src/assets/i18n/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,7 @@
"Copy to Clipboard": "",
"Cores": "",
"Country": "",
"Crashed": "",
"Create": "",
"Create ACME Certificate": "",
"Create ACME DNS-Authenticator": "",
Expand Down Expand Up @@ -4085,7 +4086,6 @@
"Stop {vmName}?": "",
"Stopped": "",
"Stopping": "",
"Stopping \"{app}\"": "",
"Stopping Apps Service": "",
"Stopping {rowName}": "",
"Stops the rollback when the safety check finds any related clone snapshots that are newer than the rollback snapshot.": "",
Expand Down
2 changes: 1 addition & 1 deletion src/assets/i18n/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -918,6 +918,7 @@
"Copy and Paste": "",
"Copy to Clipboard": "",
"Cores": "",
"Crashed": "",
"Create": "",
"Create ACME Certificate": "",
"Create ACME DNS-Authenticator": "",
Expand Down Expand Up @@ -3706,7 +3707,6 @@
"Stop {vmName}?": "",
"Stopped": "",
"Stopping": "",
"Stopping \"{app}\"": "",
"Stopping Apps Service": "",
"Stopping {rowName}": "",
"Stops the rollback when the safety check finds any related clone snapshots that are newer than the rollback snapshot.": "",
Expand Down
2 changes: 1 addition & 1 deletion src/assets/i18n/cy.json
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,7 @@
"Copy to Clipboard": "",
"Cores": "",
"Country": "",
"Crashed": "",
"Create": "",
"Create ACME Certificate": "",
"Create ACME DNS-Authenticator": "",
Expand Down Expand Up @@ -4085,7 +4086,6 @@
"Stop {vmName}?": "",
"Stopped": "",
"Stopping": "",
"Stopping \"{app}\"": "",
"Stopping Apps Service": "",
"Stopping {rowName}": "",
"Stops the rollback when the safety check finds any related clone snapshots that are newer than the rollback snapshot.": "",
Expand Down
2 changes: 1 addition & 1 deletion src/assets/i18n/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,7 @@
"Copy to Clipboard": "",
"Cores": "",
"Country": "",
"Crashed": "",
"Create": "",
"Create ACME Certificate": "",
"Create ACME DNS-Authenticator": "",
Expand Down Expand Up @@ -4085,7 +4086,6 @@
"Stop {vmName}?": "",
"Stopped": "",
"Stopping": "",
"Stopping \"{app}\"": "",
"Stopping Apps Service": "",
"Stopping {rowName}": "",
"Stops the rollback when the safety check finds any related clone snapshots that are newer than the rollback snapshot.": "",
Expand Down
2 changes: 1 addition & 1 deletion src/assets/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,7 @@
"Copies": "",
"Copy Json": "",
"Copy to Clipboard": "",
"Crashed": "",
"Create ACME DNS-Authenticator": "",
"Create Alert": "",
"Create Backup Credential": "",
Expand Down Expand Up @@ -2900,7 +2901,6 @@
"Stop {vmName}?": "",
"Stopped": "",
"Stopping": "",
"Stopping \"{app}\"": "",
"Stopping Apps Service": "",
"Stopping {rowName}": "",
"Stops the rollback when the safety check finds any related clone snapshots that are newer than the rollback snapshot.": "",
Expand Down
2 changes: 1 addition & 1 deletion src/assets/i18n/dsb.json
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,7 @@
"Copy to Clipboard": "",
"Cores": "",
"Country": "",
"Crashed": "",
"Create": "",
"Create ACME Certificate": "",
"Create ACME DNS-Authenticator": "",
Expand Down Expand Up @@ -4085,7 +4086,6 @@
"Stop {vmName}?": "",
"Stopped": "",
"Stopping": "",
"Stopping \"{app}\"": "",
"Stopping Apps Service": "",
"Stopping {rowName}": "",
"Stops the rollback when the safety check finds any related clone snapshots that are newer than the rollback snapshot.": "",
Expand Down
2 changes: 1 addition & 1 deletion src/assets/i18n/el.json
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,7 @@
"Copy to Clipboard": "",
"Cores": "",
"Country": "",
"Crashed": "",
"Create": "",
"Create ACME Certificate": "",
"Create ACME DNS-Authenticator": "",
Expand Down Expand Up @@ -4085,7 +4086,6 @@
"Stop {vmName}?": "",
"Stopped": "",
"Stopping": "",
"Stopping \"{app}\"": "",
"Stopping Apps Service": "",
"Stopping {rowName}": "",
"Stops the rollback when the safety check finds any related clone snapshots that are newer than the rollback snapshot.": "",
Expand Down
2 changes: 1 addition & 1 deletion src/assets/i18n/en-au.json
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,7 @@
"Copy to Clipboard": "",
"Cores": "",
"Country": "",
"Crashed": "",
"Create": "",
"Create ACME Certificate": "",
"Create ACME DNS-Authenticator": "",
Expand Down Expand Up @@ -4085,7 +4086,6 @@
"Stop {vmName}?": "",
"Stopped": "",
"Stopping": "",
"Stopping \"{app}\"": "",
"Stopping Apps Service": "",
"Stopping {rowName}": "",
"Stops the rollback when the safety check finds any related clone snapshots that are newer than the rollback snapshot.": "",
Expand Down
2 changes: 1 addition & 1 deletion src/assets/i18n/en-gb.json
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,7 @@
"Copy to Clipboard": "",
"Cores": "",
"Country": "",
"Crashed": "",
"Create": "",
"Create ACME Certificate": "",
"Create ACME DNS-Authenticator": "",
Expand Down Expand Up @@ -4085,7 +4086,6 @@
"Stop {vmName}?": "",
"Stopped": "",
"Stopping": "",
"Stopping \"{app}\"": "",
"Stopping Apps Service": "",
"Stopping {rowName}": "",
"Stops the rollback when the safety check finds any related clone snapshots that are newer than the rollback snapshot.": "",
Expand Down
2 changes: 1 addition & 1 deletion src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,7 @@
"Copy to Clipboard": "",
"Cores": "",
"Country": "",
"Crashed": "",
"Create": "",
"Create ACME Certificate": "",
"Create ACME DNS-Authenticator": "",
Expand Down Expand Up @@ -4085,7 +4086,6 @@
"Stop {vmName}?": "",
"Stopped": "",
"Stopping": "",
"Stopping \"{app}\"": "",
"Stopping Apps Service": "",
"Stopping {rowName}": "",
"Stops the rollback when the safety check finds any related clone snapshots that are newer than the rollback snapshot.": "",
Expand Down
Loading

0 comments on commit d752456

Please sign in to comment.