CEC-1372 manifest_rejects should be displayed as error (#149)

This commit is contained in:
John Wu
2022-04-21 09:28:36 -07:00
committed by GitHub
parent 0fd2cf6dba
commit 6326c92e2e

View File

@@ -8,22 +8,26 @@ import s from "./Statuses";
const AwaitStatus = -1; const AwaitStatus = -1;
const ErrorStatus = -100; const ErrorStatus = -100;
const CompleteStatus = 100;
const PHASES = [ const PHASES = [
{ {
label: "Pending", label: "Pending",
events: [s.Pending], events: [s.Pending],
progress: () => 100, progress: () => CompleteStatus,
}, },
{ {
label: "Received", label: "Received",
events: [s.ManifestAccepted, s.ManifestReceived, s.ManifestRejected], events: [s.ManifestAccepted, s.ManifestReceived, s.ManifestRejected],
progress: () => 100, progress: (msg) => {
if (msg === s.ManifestRejected) return ErrorStatus;
return CompleteStatus;
},
}, },
{ {
label: "Precondition", label: "Precondition",
events: [s.PreconditionAwait, s.PreconditionSuceeded], events: [s.PreconditionAwait, s.PreconditionSuceeded],
progress: () => 100, progress: () => CompleteStatus,
}, },
{ {
label: "Download", label: "Download",
@@ -55,14 +59,14 @@ const PHASES = [
], ],
progress: (msg, progress) => { progress: (msg, progress) => {
if (msg === s.InstallFailed) return ErrorStatus; if (msg === s.InstallFailed) return ErrorStatus;
if (msg === s.PackageInstallCompleted) return 100; if (msg === s.PackageInstallCompleted) return CompleteStatus;
return progress; return progress;
}, },
}, },
{ {
label: "Updated", label: "Updated",
events: [s.ManifestSucceeded], events: [s.ManifestSucceeded],
progress: (_msg, _progress) => 100, progress: (_msg, _progress) => CompleteStatus,
}, },
]; ];
@@ -84,7 +88,7 @@ const Progress = ({ value, classes }) => {
const getProgress = (index, phase, progress) => { const getProgress = (index, phase, progress) => {
if (index === phase) return progress; if (index === phase) return progress;
if (index < phase) return 100; if (index < phase) return CompleteStatus;
return -1; return -1;
}; };