fixes from review
This commit is contained in:
@@ -77,8 +77,9 @@ export const CarUpdatesProvider = ({ children }) => {
|
||||
try {
|
||||
setBusy(true);
|
||||
result = await api.cancelCarUpdate(id, token);
|
||||
if (result.error)
|
||||
if (result.error) {
|
||||
throw new Error(`Cancel car update error. ${result.message}`);
|
||||
}
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
@@ -92,8 +93,9 @@ export const CarUpdatesProvider = ({ children }) => {
|
||||
try {
|
||||
setBusy(true);
|
||||
result = await api.deployCarUpdate(id, token);
|
||||
if (result.error)
|
||||
if (result.error) {
|
||||
throw new Error(`Retry car update error. ${result.message}`);
|
||||
}
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
@@ -108,8 +110,9 @@ export const CarUpdatesProvider = ({ children }) => {
|
||||
setBusy(true);
|
||||
validateDeployCarUpdates(data);
|
||||
result = await api.createCarUpdates(data, token);
|
||||
if (result.error)
|
||||
if (result.error) {
|
||||
throw new Error(`Deploy car updates error. ${result.message}`);
|
||||
}
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
@@ -124,8 +127,9 @@ export const CarUpdatesProvider = ({ children }) => {
|
||||
setBusy(true);
|
||||
validateDeployFleetUpdates(data);
|
||||
result = await api.createFleetUpdates(data, token);
|
||||
if (result.error)
|
||||
if (result.error) {
|
||||
throw new Error(`Deploy fleet updates error. ${result.message}`);
|
||||
}
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
@@ -163,8 +167,9 @@ export const CarUpdatesProvider = ({ children }) => {
|
||||
try {
|
||||
setBusy(true);
|
||||
result = await api.getVINUpdates(vin, token);
|
||||
if (result.error)
|
||||
if (result.error) {
|
||||
throw new Error(`Get VIN updates error. ${result.message}`);
|
||||
}
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
@@ -230,8 +235,9 @@ export const CarUpdatesProvider = ({ children }) => {
|
||||
carupdateids.join(","),
|
||||
token
|
||||
);
|
||||
if (result.error)
|
||||
if (result.error) {
|
||||
throw new Error(`Get update progress error. ${result.message}`);
|
||||
}
|
||||
|
||||
applyProgressStatuses(result.statuses);
|
||||
} catch (e) {
|
||||
@@ -272,8 +278,9 @@ export const CarUpdatesProvider = ({ children }) => {
|
||||
try {
|
||||
setBusy(true);
|
||||
result = await api.getCarUpdateLog(query, token);
|
||||
if (result.error)
|
||||
if (result.error) {
|
||||
throw new Error(`Get car update log error. ${result.message}`);
|
||||
}
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
@@ -288,8 +295,9 @@ export const CarUpdatesProvider = ({ children }) => {
|
||||
setBusy(true);
|
||||
|
||||
result = await api.getSUMSVersions(null, token);
|
||||
if (result.error)
|
||||
if (result.error) {
|
||||
throw new Error(`Get software versions error. ${result.message}`);
|
||||
}
|
||||
|
||||
result.data.unshift(SELECT_VERSION_OBJ)
|
||||
setVersions(result.data);
|
||||
@@ -307,8 +315,9 @@ export const CarUpdatesProvider = ({ children }) => {
|
||||
setBusy(true);
|
||||
|
||||
result = await api.getSUMSVersions(options, token);
|
||||
if (result.error)
|
||||
if (result.error) {
|
||||
throw new Error(`Get software versions error. ${result.message}`);
|
||||
}
|
||||
|
||||
setVersions(result.data);
|
||||
if (options && options.offset === 0 && result.total) {
|
||||
@@ -339,8 +348,9 @@ export const CarUpdatesProvider = ({ children }) => {
|
||||
}
|
||||
|
||||
result = await api.addSUMSVersion(data, token);
|
||||
if (result.error)
|
||||
if (result.error) {
|
||||
throw new Error(`Add SUMS version error. ${result.message}`);
|
||||
}
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
@@ -355,8 +365,9 @@ export const CarUpdatesProvider = ({ children }) => {
|
||||
setBusy(true);
|
||||
|
||||
result = await api.deleteSUMSVersion(version, token);
|
||||
if (result.error)
|
||||
if (result.error) {
|
||||
throw new Error(`Delete software version error. ${result.message}`);
|
||||
}
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
@@ -373,8 +384,9 @@ export const CarUpdatesProvider = ({ children }) => {
|
||||
if (!validateSoftwareVersion(version)) throw new Error(`invalid version ${version}`);
|
||||
|
||||
result = await api.updateSUMSVersion(id, version, token);
|
||||
if (result.error)
|
||||
if (result.error) {
|
||||
throw new Error(`Update manifest version error. ${result.message}`);
|
||||
}
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
@@ -410,8 +422,9 @@ export const CarUpdatesProvider = ({ children }) => {
|
||||
setBusy(true);
|
||||
|
||||
result = await api.deleteSUMSVersionRxSwins(sums_version, rxswin, token);
|
||||
if (result.error)
|
||||
if (result.error) {
|
||||
throw new Error(`Delete software version rxswin error. ${result.message}`);
|
||||
}
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
@@ -423,8 +436,9 @@ export const CarUpdatesProvider = ({ children }) => {
|
||||
try {
|
||||
setBusy(true);
|
||||
const result = await api.addSUMSVersionRxSwins(sums_version, data, token);
|
||||
if (result.error)
|
||||
if (result.error) {
|
||||
throw new Error(`Add software version rxswin error. ${result.message}`);
|
||||
}
|
||||
return result;
|
||||
} finally {
|
||||
setBusy(false);
|
||||
|
||||
@@ -156,6 +156,8 @@ export const useCarUpdatesContext = () => ({
|
||||
stopMonitor: jest.fn(),
|
||||
approveUpdate: jest.fn(),
|
||||
getSUMSVersions: jest.fn(() => sumsVersions),
|
||||
addSUMSVersion: jest.fn(),
|
||||
deleteSUMSVersion: jest.fn(),
|
||||
getSUMSVersionRxSwins: jest.fn(() => sumsVersionRxSwins),
|
||||
deleteSUMSVersionRxSwins: jest.fn(),
|
||||
addSUMSVersionRxSwins: jest.fn(),
|
||||
|
||||
@@ -48,19 +48,25 @@ exports[`SUMSList Render 1`] = `
|
||||
class="MuiTableRow-root MuiTableRow-head"
|
||||
>
|
||||
<th
|
||||
aria-sort="descending"
|
||||
class="MuiTableCell-root MuiTableCell-head MuiTableCell-alignCenter"
|
||||
scope="col"
|
||||
>
|
||||
<span
|
||||
aria-disabled="false"
|
||||
class="MuiButtonBase-root MuiTableSortLabel-root"
|
||||
class="MuiButtonBase-root MuiTableSortLabel-root MuiTableSortLabel-active"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
SUMS Version
|
||||
<span
|
||||
class="makeStyles-hiddenSortSpan-0"
|
||||
>
|
||||
sorted descending
|
||||
</span>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class="MuiSvgIcon-root MuiTableSortLabel-icon MuiTableSortLabel-iconDirectionAsc"
|
||||
class="MuiSvgIcon-root MuiTableSortLabel-icon MuiTableSortLabel-iconDirectionDesc"
|
||||
focusable="false"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
@@ -94,25 +100,19 @@ exports[`SUMSList Render 1`] = `
|
||||
</span>
|
||||
</th>
|
||||
<th
|
||||
aria-sort="descending"
|
||||
class="MuiTableCell-root MuiTableCell-head MuiTableCell-alignCenter"
|
||||
scope="col"
|
||||
>
|
||||
<span
|
||||
aria-disabled="false"
|
||||
class="MuiButtonBase-root MuiTableSortLabel-root MuiTableSortLabel-active"
|
||||
class="MuiButtonBase-root MuiTableSortLabel-root"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
>
|
||||
Created
|
||||
<span
|
||||
class="makeStyles-hiddenSortSpan-0"
|
||||
>
|
||||
sorted descending
|
||||
</span>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class="MuiSvgIcon-root MuiTableSortLabel-icon MuiTableSortLabel-iconDirectionDesc"
|
||||
class="MuiSvgIcon-root MuiTableSortLabel-icon MuiTableSortLabel-iconDirectionAsc"
|
||||
focusable="false"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
|
||||
@@ -49,7 +49,7 @@ const PAGE_SIZE = "SUMS_VERSIONS_TABLE_PAGE_SIZE";
|
||||
const MainForm = () => {
|
||||
const classes = useStyles();
|
||||
const { setMessage, setTitle, setSitePath } = useStatusContext();
|
||||
const [orderBy, setOrderBy] = useState("created_at");
|
||||
const [orderBy, setOrderBy] = useState("version");
|
||||
const [order, setOrder] = useState("desc");
|
||||
const [showDeleteModal, setShowDeleteModal] = useState(false);
|
||||
const [rowToDelete, setRowToDelete] = useState({});
|
||||
|
||||
@@ -47,7 +47,7 @@ exports[`SUMSNew Render 1`] = `
|
||||
aria-invalid="false"
|
||||
class="MuiInputBase-input MuiOutlinedInput-input"
|
||||
id="sums_version"
|
||||
maxlength="255"
|
||||
maxlength="15"
|
||||
name="sums_version"
|
||||
required=""
|
||||
type="text"
|
||||
@@ -93,7 +93,7 @@ exports[`SUMSNew Render 1`] = `
|
||||
aria-invalid="false"
|
||||
class="MuiInputBase-input MuiOutlinedInput-input"
|
||||
id="os_version"
|
||||
maxlength="255"
|
||||
maxlength="20"
|
||||
name="os_version"
|
||||
required=""
|
||||
type="text"
|
||||
|
||||
@@ -81,7 +81,7 @@ const MainForm = () => {
|
||||
variant="outlined"
|
||||
margin="normal"
|
||||
inputProps={{
|
||||
maxLength: "255",
|
||||
maxLength: "15",
|
||||
}}
|
||||
required
|
||||
fullWidth
|
||||
@@ -96,7 +96,7 @@ const MainForm = () => {
|
||||
variant="outlined"
|
||||
margin="normal"
|
||||
inputProps={{
|
||||
maxLength: "255",
|
||||
maxLength: "20",
|
||||
}}
|
||||
required
|
||||
fullWidth
|
||||
|
||||
Reference in New Issue
Block a user