CEC-4157 - Add new statuses to car_update_progress (#334)
* CEC-4157 - Add new statuses to car_update_progress * small fix
This commit is contained in:
@@ -13,7 +13,7 @@ const TestWrapper = ({ status }) => {
|
||||
|
||||
const renderCarUpdateStatusProgress = async (status) => {
|
||||
const { container } = render(<TestWrapper status={status} />);
|
||||
await waitFor(() => {});
|
||||
await waitFor(() => { });
|
||||
return container;
|
||||
};
|
||||
|
||||
@@ -144,6 +144,28 @@ describe("CarUpdateStatusProgress", () => {
|
||||
err: 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "install_scheduled",
|
||||
status: {
|
||||
car_update_id: 1,
|
||||
ecu: "TEST",
|
||||
installed: 5,
|
||||
total_files: 10,
|
||||
msg: s.InstallSucceeded,
|
||||
err: 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "requirements_failed",
|
||||
status: {
|
||||
car_update_id: 1,
|
||||
ecu: "TEST",
|
||||
installed: 5,
|
||||
total_files: 10,
|
||||
msg: s.InstallFailed,
|
||||
err: 0,
|
||||
},
|
||||
},
|
||||
];
|
||||
for (let i = 0, len = tests.length; i < len; i++) {
|
||||
const test = tests[i];
|
||||
|
||||
@@ -34,6 +34,8 @@ const Statuses = {
|
||||
PackageDownloadCompleted: "package_download_complete",
|
||||
PackageInstallStarted: "package_install_start",
|
||||
PackageInstallCompleted: "package_install_complete",
|
||||
RequirementsFailed: "requirements_failed",
|
||||
InstallScheduled: "install_scheduled",
|
||||
};
|
||||
|
||||
export default Statuses;
|
||||
|
||||
@@ -994,6 +994,148 @@ exports[`CarUpdateStatusProgress Render install_error 1`] = `
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`CarUpdateStatusProgress Render install_scheduled 1`] = `
|
||||
<div>
|
||||
<div
|
||||
style="width: 100%; display: flex; justify-content: space-between; flex-wrap: wrap;"
|
||||
>
|
||||
<div
|
||||
class="makeStyles-textCenterAlign-0"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class="MuiSvgIcon-root makeStyles-progressIcon-0 makeStyles-progressSuccess-0"
|
||||
focusable="false"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"
|
||||
/>
|
||||
</svg>
|
||||
<p
|
||||
class="MuiTypography-root MuiTypography-body1"
|
||||
>
|
||||
Pending
|
||||
</p>
|
||||
</div>
|
||||
<div
|
||||
class="makeStyles-textCenterAlign-0"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class="MuiSvgIcon-root makeStyles-progressIcon-0 makeStyles-progressSuccess-0"
|
||||
focusable="false"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"
|
||||
/>
|
||||
</svg>
|
||||
<p
|
||||
class="MuiTypography-root MuiTypography-body1"
|
||||
>
|
||||
Received
|
||||
</p>
|
||||
</div>
|
||||
<div
|
||||
class="makeStyles-textCenterAlign-0"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class="MuiSvgIcon-root makeStyles-progressIcon-0 makeStyles-progressSuccess-0"
|
||||
focusable="false"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"
|
||||
/>
|
||||
</svg>
|
||||
<p
|
||||
class="MuiTypography-root MuiTypography-body1"
|
||||
>
|
||||
Precondition
|
||||
</p>
|
||||
</div>
|
||||
<div
|
||||
class="makeStyles-textCenterAlign-0"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class="MuiSvgIcon-root makeStyles-progressIcon-0 makeStyles-progressSuccess-0"
|
||||
focusable="false"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"
|
||||
/>
|
||||
</svg>
|
||||
<p
|
||||
class="MuiTypography-root MuiTypography-body1"
|
||||
>
|
||||
Download
|
||||
</p>
|
||||
</div>
|
||||
<div
|
||||
class="makeStyles-textCenterAlign-0"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class="MuiSvgIcon-root makeStyles-progressIcon-0 makeStyles-progressSuccess-0"
|
||||
focusable="false"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"
|
||||
/>
|
||||
</svg>
|
||||
<p
|
||||
class="MuiTypography-root MuiTypography-body1"
|
||||
>
|
||||
Approved
|
||||
</p>
|
||||
</div>
|
||||
<div
|
||||
class="makeStyles-textCenterAlign-0"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class="MuiSvgIcon-root makeStyles-progressIcon-0"
|
||||
focusable="false"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"
|
||||
/>
|
||||
</svg>
|
||||
<p
|
||||
class="MuiTypography-root MuiTypography-body1"
|
||||
>
|
||||
Install
|
||||
</p>
|
||||
</div>
|
||||
<div
|
||||
class="makeStyles-textCenterAlign-0"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class="MuiSvgIcon-root makeStyles-progressIcon-0"
|
||||
focusable="false"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"
|
||||
/>
|
||||
</svg>
|
||||
<p
|
||||
class="MuiTypography-root MuiTypography-body1"
|
||||
>
|
||||
Updated
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`CarUpdateStatusProgress Render installing 1`] = `
|
||||
<div>
|
||||
<div
|
||||
@@ -1561,3 +1703,145 @@ exports[`CarUpdateStatusProgress Render package_download_complete 1`] = `
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`CarUpdateStatusProgress Render requirements_failed 1`] = `
|
||||
<div>
|
||||
<div
|
||||
style="width: 100%; display: flex; justify-content: space-between; flex-wrap: wrap;"
|
||||
>
|
||||
<div
|
||||
class="makeStyles-textCenterAlign-0"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class="MuiSvgIcon-root makeStyles-progressIcon-0 makeStyles-progressSuccess-0"
|
||||
focusable="false"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"
|
||||
/>
|
||||
</svg>
|
||||
<p
|
||||
class="MuiTypography-root MuiTypography-body1"
|
||||
>
|
||||
Pending
|
||||
</p>
|
||||
</div>
|
||||
<div
|
||||
class="makeStyles-textCenterAlign-0"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class="MuiSvgIcon-root makeStyles-progressIcon-0 makeStyles-progressSuccess-0"
|
||||
focusable="false"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"
|
||||
/>
|
||||
</svg>
|
||||
<p
|
||||
class="MuiTypography-root MuiTypography-body1"
|
||||
>
|
||||
Received
|
||||
</p>
|
||||
</div>
|
||||
<div
|
||||
class="makeStyles-textCenterAlign-0"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class="MuiSvgIcon-root makeStyles-progressIcon-0 makeStyles-progressSuccess-0"
|
||||
focusable="false"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"
|
||||
/>
|
||||
</svg>
|
||||
<p
|
||||
class="MuiTypography-root MuiTypography-body1"
|
||||
>
|
||||
Precondition
|
||||
</p>
|
||||
</div>
|
||||
<div
|
||||
class="makeStyles-textCenterAlign-0"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class="MuiSvgIcon-root makeStyles-progressIcon-0 makeStyles-progressSuccess-0"
|
||||
focusable="false"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"
|
||||
/>
|
||||
</svg>
|
||||
<p
|
||||
class="MuiTypography-root MuiTypography-body1"
|
||||
>
|
||||
Download
|
||||
</p>
|
||||
</div>
|
||||
<div
|
||||
class="makeStyles-textCenterAlign-0"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class="MuiSvgIcon-root makeStyles-progressIcon-0 makeStyles-progressSuccess-0"
|
||||
focusable="false"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"
|
||||
/>
|
||||
</svg>
|
||||
<p
|
||||
class="MuiTypography-root MuiTypography-body1"
|
||||
>
|
||||
Approved
|
||||
</p>
|
||||
</div>
|
||||
<div
|
||||
class="makeStyles-textCenterAlign-0"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class="MuiSvgIcon-root makeStyles-progressIcon-0 makeStyles-progressError-0"
|
||||
focusable="false"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"
|
||||
/>
|
||||
</svg>
|
||||
<p
|
||||
class="MuiTypography-root MuiTypography-body1"
|
||||
>
|
||||
Install
|
||||
</p>
|
||||
</div>
|
||||
<div
|
||||
class="makeStyles-textCenterAlign-0"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class="MuiSvgIcon-root makeStyles-progressIcon-0"
|
||||
focusable="false"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"
|
||||
/>
|
||||
</svg>
|
||||
<p
|
||||
class="MuiTypography-root MuiTypography-body1"
|
||||
>
|
||||
Updated
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -56,9 +56,11 @@ const PHASES = [
|
||||
s.Installing,
|
||||
s.InstallSucceeded,
|
||||
s.InstallFailed,
|
||||
s.RequirementsFailed,
|
||||
s.InstallScheduled,
|
||||
],
|
||||
progress: (msg, progress) => {
|
||||
if (msg === s.InstallFailed) return ErrorStatus;
|
||||
if (msg === s.InstallFailed || msg === s.RequirementsFailed) return ErrorStatus;
|
||||
if (msg === s.PackageInstallCompleted) return CompleteStatus;
|
||||
return progress;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user