Skip to content

Commit

Permalink
NAS-130478: Fix app statuses (#10659)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexKarpov98 authored Sep 11, 2024
1 parent 716ef4c commit f54a2ad
Show file tree
Hide file tree
Showing 97 changed files with 108 additions and 22 deletions.
5 changes: 0 additions & 5 deletions src/app/enums/app-state.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,16 @@ export enum AppState {
Running = 'RUNNING',
Deploying = 'DEPLOYING',
Stopped = 'STOPPED',

// TODO: Assumed that stopping status will be implemented https://ixsystems.atlassian.net/browse/NAS-130482
Stopping = 'STOPPING',
}

export const appStateIcons = new Map<AppState, string>([
[AppState.Running, 'mdi-check-circle'],
[AppState.Deploying, 'mdi-progress-wrench'],
[AppState.Stopping, 'mdi-progress-wrench'],
[AppState.Stopped, 'mdi-stop-circle'],
]);

export const appStateLabels = new Map<AppState, string>([
[AppState.Running, T('Running')],
[AppState.Deploying, T('Deploying')],
[AppState.Stopping, T('Stopping')],
[AppState.Stopped, T('Stopped')],
]);
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ <h3 mat-card-title>
matTooltipPosition="above"
[ixTest]="[app().name, 'stop']"
[matTooltip]="'Stop' | translate"
[disabled]="isStartingOrStopping"
[disabled]="inProgress"
(click)="stopApp.emit(); $event.stopPropagation()"
>
<ix-icon name="mdi-stop"></ix-icon> {{ 'Stop' | translate }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,13 @@ export class AppInfoCardComponent {
}, { allowSignalWrites: true });

get inProgress(): boolean {
return [AppState.Deploying].includes(this.app().state) || this.isStartingOrStopping;
return [AppState.Deploying].includes(this.app().state);
}

get isAppStopped(): boolean {
return this.app().state === AppState.Stopped;
}

get isStartingOrStopping(): boolean {
return [AppState.Deploying, AppState.Stopping].includes(this.app().state);
}

get appDetailsRouterUrl(): string[] {
const app = this.app();
return ['/apps', 'available', app.metadata.train, app.id];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
matTooltipPosition="above"
[ixTest]="[app().name, 'stop']"
[matTooltip]="'Stop' | translate"
[disabled]="isStartingOrStopping()"
[disabled]="inProgress()"
(click)="stop(); $event.stopPropagation()"
>
<ix-icon name="mdi-stop"></ix-icon>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@ export class AppRowComponent {
});

readonly inProgress = computed(() => {
return [AppState.Deploying].includes(this.app().state) || this.isStartingOrStopping();
});

readonly isStartingOrStopping = computed(() => {
return [AppState.Deploying, AppState.Stopping].includes(this.app().state);
return [AppState.Deploying].includes(this.app().state);
});

readonly incomingTraffic = computed(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ <h4>
<div class="container-state">
{{ container.state | mapValue: appContainerStateLabels | translate }}
</div>
@if (app().state === CatalogAppState.Running || app().state === CatalogAppState.Deploying) {
@if (app().state === AppState.Running || app().state === AppState.Deploying) {
<div class="container-action">
@if (container.state === AppContainerState.Running) {
<button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { ShellDetailsType } from 'app/pages/apps/enum/shell-details-type.enum';
export class AppWorkloadsCardComponent {
readonly app = input.required<App>();

readonly CatalogAppState = AppState;
readonly AppState = AppState;
readonly AppContainerState = AppContainerState;

protected readonly requiredRoles = [Role.AppsWrite];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ import {
} from 'rxjs';
import { AppState } from 'app/enums/app-state.enum';
import { EmptyType } from 'app/enums/empty-type.enum';
import { JobState } from 'app/enums/job-state.enum';
import { Role } from 'app/enums/role.enum';
import { tapOnce } from 'app/helpers/operators/tap-once.operator';
import { WINDOW } from 'app/helpers/window.helper';
import { helptextApps } from 'app/helptext/apps/apps';
import { App, AppStartQueryParams, AppStats } from 'app/interfaces/app.interface';
Expand All @@ -34,6 +36,7 @@ import { Job } from 'app/interfaces/job.interface';
import { DialogService } from 'app/modules/dialog/dialog.service';
import { SortDirection } from 'app/modules/ix-table/enums/sort-direction.enum';
import { selectJob } from 'app/modules/jobs/store/job.selectors';
import { AppLoaderService } from 'app/modules/loader/app-loader.service';
import { SnackbarService } from 'app/modules/snackbar/services/snackbar.service';
import { AppBulkUpgradeComponent } from 'app/pages/apps/components/installed-apps/app-bulk-upgrade/app-bulk-upgrade.component';
import { installedAppsElements } from 'app/pages/apps/components/installed-apps/installed-apps.elements';
Expand Down Expand Up @@ -161,6 +164,7 @@ export class InstalledAppsComponent implements OnInit, AfterViewInit {
private store$: Store<AppsState>,
private location: Location,
private appsStats: AppsStatsService,
private loader: AppLoaderService,
@Inject(WINDOW) private window: Window,
) {
this.router.events
Expand Down Expand Up @@ -314,8 +318,15 @@ export class InstalledAppsComponent implements OnInit, AfterViewInit {

stop(name: string): void {
this.appService.stopApplication(name)
.pipe(this.errorHandler.catchError(), untilDestroyed(this))
.pipe(
tapOnce(() => this.loader.open(this.translate.instant('Stopping "{app}"', { app: name }))),
this.errorHandler.catchError(),
untilDestroyed(this),
)
.subscribe((job: Job<void, AppStartQueryParams>) => {
if (job.state !== JobState.Running) {
this.loader.close();
}
this.appJobs.set(name, job);
this.sortChanged(this.sortingInfo);
this.cdr.markForCheck();
Expand Down
4 changes: 2 additions & 2 deletions src/app/pages/apps/store/installed-apps-store.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ export class InstalledAppsStore extends ComponentStore<InstalledAppsState> imple
};
});

const updateApps = (appsToUpdate: AvailableApp[]): AvailableApp[] => appsToUpdate.map((appDate) => {
return app.name === app.id ? { ...appDate, installed: true } : appDate;
const updateApps = (appsToUpdate: AvailableApp[]): AvailableApp[] => appsToUpdate.map((appData) => {
return app.name === app.id ? { ...appData, installed: true } : appData;
});

this.appsStore.patchState((state) => {
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/af.json
Original file line number Diff line number Diff line change
Expand Up @@ -4076,6 +4076,7 @@
"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
1 change: 1 addition & 0 deletions src/assets/i18n/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -4076,6 +4076,7 @@
"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
1 change: 1 addition & 0 deletions src/assets/i18n/ast.json
Original file line number Diff line number Diff line change
Expand Up @@ -4076,6 +4076,7 @@
"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
1 change: 1 addition & 0 deletions src/assets/i18n/az.json
Original file line number Diff line number Diff line change
Expand Up @@ -4076,6 +4076,7 @@
"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
1 change: 1 addition & 0 deletions src/assets/i18n/be.json
Original file line number Diff line number Diff line change
Expand Up @@ -4076,6 +4076,7 @@
"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
1 change: 1 addition & 0 deletions src/assets/i18n/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -4076,6 +4076,7 @@
"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
1 change: 1 addition & 0 deletions src/assets/i18n/bn.json
Original file line number Diff line number Diff line change
Expand Up @@ -4076,6 +4076,7 @@
"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
1 change: 1 addition & 0 deletions src/assets/i18n/br.json
Original file line number Diff line number Diff line change
Expand Up @@ -4076,6 +4076,7 @@
"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
1 change: 1 addition & 0 deletions src/assets/i18n/bs.json
Original file line number Diff line number Diff line change
Expand Up @@ -4076,6 +4076,7 @@
"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
1 change: 1 addition & 0 deletions src/assets/i18n/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -4076,6 +4076,7 @@
"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
1 change: 1 addition & 0 deletions src/assets/i18n/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -3698,6 +3698,7 @@
"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
1 change: 1 addition & 0 deletions src/assets/i18n/cy.json
Original file line number Diff line number Diff line change
Expand Up @@ -4076,6 +4076,7 @@
"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
1 change: 1 addition & 0 deletions src/assets/i18n/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -4076,6 +4076,7 @@
"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
1 change: 1 addition & 0 deletions src/assets/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -2897,6 +2897,7 @@
"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
1 change: 1 addition & 0 deletions src/assets/i18n/dsb.json
Original file line number Diff line number Diff line change
Expand Up @@ -4076,6 +4076,7 @@
"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
1 change: 1 addition & 0 deletions src/assets/i18n/el.json
Original file line number Diff line number Diff line change
Expand Up @@ -4076,6 +4076,7 @@
"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
1 change: 1 addition & 0 deletions src/assets/i18n/en-au.json
Original file line number Diff line number Diff line change
Expand Up @@ -4076,6 +4076,7 @@
"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
1 change: 1 addition & 0 deletions src/assets/i18n/en-gb.json
Original file line number Diff line number Diff line change
Expand Up @@ -4076,6 +4076,7 @@
"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
1 change: 1 addition & 0 deletions src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -4076,6 +4076,7 @@
"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
1 change: 1 addition & 0 deletions src/assets/i18n/eo.json
Original file line number Diff line number Diff line change
Expand Up @@ -4076,6 +4076,7 @@
"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
1 change: 1 addition & 0 deletions src/assets/i18n/es-ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -2232,6 +2232,7 @@
"Stop {vmName}?": "",
"Stopped": "",
"Stopping": "",
"Stopping \"{app}\"": "",
"Stopping Apps Service": "",
"Stopping {rowName}": "",
"Storage Dashboard": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/es-co.json
Original file line number Diff line number Diff line change
Expand Up @@ -4076,6 +4076,7 @@
"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
1 change: 1 addition & 0 deletions src/assets/i18n/es-mx.json
Original file line number Diff line number Diff line change
Expand Up @@ -4076,6 +4076,7 @@
"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
1 change: 1 addition & 0 deletions src/assets/i18n/es-ni.json
Original file line number Diff line number Diff line change
Expand Up @@ -4076,6 +4076,7 @@
"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
1 change: 1 addition & 0 deletions src/assets/i18n/es-ve.json
Original file line number Diff line number Diff line change
Expand Up @@ -4076,6 +4076,7 @@
"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
1 change: 1 addition & 0 deletions src/assets/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -3749,6 +3749,7 @@
"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
1 change: 1 addition & 0 deletions src/assets/i18n/et.json
Original file line number Diff line number Diff line change
Expand Up @@ -4076,6 +4076,7 @@
"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
1 change: 1 addition & 0 deletions src/assets/i18n/eu.json
Original file line number Diff line number Diff line change
Expand Up @@ -4076,6 +4076,7 @@
"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
1 change: 1 addition & 0 deletions src/assets/i18n/fa.json
Original file line number Diff line number Diff line change
Expand Up @@ -4076,6 +4076,7 @@
"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
1 change: 1 addition & 0 deletions src/assets/i18n/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -4076,6 +4076,7 @@
"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
1 change: 1 addition & 0 deletions src/assets/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,7 @@
"Step Forward": "",
"Stop All Selected": "",
"Stop Flashing": "",
"Stopping \"{app}\"": "",
"Storj": "",
"Storj iX": "",
"Stream Compression": "",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/fy.json
Original file line number Diff line number Diff line change
Expand Up @@ -4076,6 +4076,7 @@
"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 f54a2ad

Please sign in to comment.