Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions modules/ui/src/app/model/testrun-status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export enum StatusOfTestrun {
WaitingForDevice = 'Waiting for Device',
Cancelled = 'Cancelled',
Cancelling = 'Cancelling',
Stopping = 'Stopping',
Failed = 'Failed',
CompliantLimited = 'Compliant (Limited)',
CompliantHigh = 'Compliant (High)',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@
*ngSwitchCase="StatusOfTestrun.Cancelling"
[ngTemplateOutlet]="Cancelling">
</ng-container>
<ng-container
*ngSwitchCase="StatusOfTestrun.Stopping"
[ngTemplateOutlet]="Cancelling">
</ng-container>
</div>

<ng-container
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ describe('ProgressStatusCardComponent', () => {
StatusOfTestrun.WaitingForDevice,
StatusOfTestrun.Monitoring,
StatusOfTestrun.Cancelling,
StatusOfTestrun.Stopping,
];

const statusesForCompletedSuccessClass = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ export class TestrunStatusCardComponent {
} {
return {
progress:
this.isProgressStatus(status) || status === StatusOfTestrun.Cancelling,
this.isProgressStatus(status) ||
status === StatusOfTestrun.Cancelling ||
status === StatusOfTestrun.Stopping,
'completed-success':
(result === ResultOfTestrun.Compliant &&
status === StatusOfTestrun.Complete) ||
Expand All @@ -92,6 +94,7 @@ export class TestrunStatusCardComponent {
data.status === StatusOfTestrun.InProgress ||
data.status === StatusOfTestrun.Cancelled ||
data.status === StatusOfTestrun.Cancelling ||
data.status === StatusOfTestrun.Stopping ||
data.finished
) {
if (
Expand Down Expand Up @@ -126,6 +129,9 @@ export class TestrunStatusCardComponent {
) {
return data.result!;
}
if (data.status === StatusOfTestrun.Stopping) {
return StatusOfTestrun.Cancelling;
}
return data.status;
}

Expand Down
4 changes: 3 additions & 1 deletion modules/ui/src/app/pages/testrun/testrun.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
isTestrunInProgress(data.status) ||
data.status === StatusOfTestrun.Cancelled ||
data.status === StatusOfTestrun.Cancelling ||
data.status === StatusOfTestrun.Stopping ||
data.finished
">
<mat-toolbar class="progress-toolbar">
Expand Down Expand Up @@ -115,7 +116,8 @@
hasDevices === false ||
isAllDevicesOutdated === true ||
isTestrunInProgress(systemStatus?.status) ||
systemStatus?.status === StatusOfTestrun.Cancelling
systemStatus?.status === StatusOfTestrun.Cancelling ||
systemStatus?.status === StatusOfTestrun.Stopping
"
(click)="openTestRunModal(vm.testModules)"
mat-flat-button>
Expand Down
2 changes: 0 additions & 2 deletions modules/ui/src/app/store/effects.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import {
MOCK_PROGRESS_DATA_WAITING_FOR_DEVICE,
} from '../mocks/testrun.mock';
import {
fetchSystemStatus,
fetchSystemStatusSuccess,
setReports,
setStatus,
Expand Down Expand Up @@ -339,7 +338,6 @@ describe('Effects', () => {

effects.onStopTestrun$.subscribe(() => {
expect(testRunServiceMock.stopTestrun).toHaveBeenCalled();
expect(dispatchSpy).toHaveBeenCalledWith(fetchSystemStatus());
done();
});
});
Expand Down
18 changes: 7 additions & 11 deletions modules/ui/src/app/store/effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import {
TestrunStatus,
} from '../model/testrun-status';
import {
fetchSystemStatus,
fetchSystemStatusSuccess,
setIsTestingComplete,
setReports,
Expand Down Expand Up @@ -137,7 +136,8 @@ export class AppEffects {
map(({ systemStatus }) => {
const isInProgressDevice =
this.testrunService.testrunInProgress(systemStatus?.status) ||
systemStatus.status === StatusOfTestrun.Cancelling;
systemStatus.status === StatusOfTestrun.Cancelling ||
systemStatus.status === StatusOfTestrun.Stopping;
return AppActions.setDeviceInProgress({
device: isInProgressDevice ? systemStatus.device : null,
});
Expand All @@ -163,14 +163,7 @@ export class AppEffects {
return this.actions$.pipe(
ofType(AppActions.setIsStopTestrun),
switchMap(() => {
this.store.dispatch(stopInterval());
return this.testrunService.stopTestrun().pipe(
map(stopped => {
if (stopped) {
this.store.dispatch(fetchSystemStatus());
}
})
);
return this.testrunService.stopTestrun();
})
);
},
Expand Down Expand Up @@ -200,7 +193,10 @@ export class AppEffects {
isTestingComplete: this.isTestrunFinished(systemStatus.status),
})
);
if (this.testrunService.testrunInProgress(systemStatus.status)) {
if (
this.testrunService.testrunInProgress(systemStatus.status) ||
systemStatus.status === StatusOfTestrun.Stopping
) {
this.pullingSystemStatusData();
this.fetchInternetConnection();
} else if (
Expand Down