Skip to content

Commit

Permalink
fix: enable deletion of images queued for download
Browse files Browse the repository at this point in the history
  • Loading branch information
Jay-Topher committed Mar 26, 2024
1 parent bb3080b commit abbf93b
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/app/images/components/ImagesTable/ImagesTable.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ it("disables delete action for images being downloaded", async () => {
title: "18.04 LTS",
complete: false,
status: "Downloading 50%",
downloading: true,
}),
];
const image = {
Expand Down
42 changes: 41 additions & 1 deletion src/app/images/components/ImagesTable/ImagesTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@ const generateResourceRow = ({
const { os, release } = splitResourceName(resource.name);
const isCommissioningImage =
os === "ubuntu" && release === commissioningRelease;
const canBeDeleted = !isCommissioningImage && resource.complete;
const canBeDeleted =
(!isCommissioningImage && resource.complete) ||
(!isCommissioningImage && !resource.downloading);
let statusIcon = <Spinner />;
let statusText = resource.status;

Expand Down Expand Up @@ -322,3 +324,41 @@ const ImagesTable = ({
};

export default ImagesTable;

// queued
// {
// "id": 25,
// "rtype": 0,
// "name": "ubuntu/impish",
// "title": "21.10",
// "arch": "amd64",
// "size": "593.8 MB",
// "complete": false,
// "status": "Queued for download",
// "icon": "queued",
// "downloading": false,
// "canDeployToMemory": true,
// "numberOfNodes": 0,
// "machineCount": 0,
// "lastUpdate": "Tue, 26 Mar. 2024 08:54:41",
// "lastDeployed": null
// }

// downloading
// {
// "id": 25,
// "rtype": 0,
// "name": "ubuntu/impish",
// "title": "21.10",
// "arch": "amd64",
// "size": "593.8 MB",
// "complete": false,
// "status": "Downloading 29%",
// "icon": "in-progress",
// "downloading": true,
// "canDeployToMemory": true,
// "numberOfNodes": 0,
// "machineCount": 0,
// "lastUpdate": "Tue, 26 Mar. 2024 08:54:41",
// "lastDeployed": null
// }

0 comments on commit abbf93b

Please sign in to comment.