diff --git a/ui/src/ensembler/components/modal/DeleteEnsemblerModal.js b/ui/src/ensembler/components/modal/DeleteEnsemblerModal.js index 5050529d2..f3cd7d068 100644 --- a/ui/src/ensembler/components/modal/DeleteEnsemblerModal.js +++ b/ui/src/ensembler/components/modal/DeleteEnsemblerModal.js @@ -54,6 +54,8 @@ export const DeleteEnsemblerModal = ({ const modalClosed = () => { setCanDeleteEnsembler(true) setEnsemblerUsedByCurrentRouterVersion(false) + setEnsemblerUsedByActiveRouterVersion(false) + setEnsemblerUsedByActiveEnsemblingJob(false) setDeleteConfirmation("") } @@ -61,16 +63,16 @@ export const DeleteEnsemblerModal = ({ modalClosed()} - onConfirm={submitForm} + onConfirm={(arg) => {submitForm(arg); modalClosed()}} isLoading={isLoading} content={
{canDeleteEnsembler ? (

- You are about to delete Ensembler {ensembler.name}. This action cannot be undone. + You are about to delete the Ensembler {ensembler.name}. This action cannot be undone.

- To confirm, please type "{ensembler.name}" in the box below + To confirm, please type "{ensembler.name}" in the box below: setDeleteConfirmation(e.target.value)} isInvalid={deleteConfirmation !== ensembler.name} />
- ) : ensemblerUsedByCurrentRouterVersion ? ( -
- You cannot delete this ensembler because it is associated with a router version that is currently being used by a router -

If you still wish to delete this ensembler, please Deploy another version on this router. -
) : (
- You cannot delete this ensembler because there are Active Router Versions or Ensembling Jobs that use this ensembler. -

If you still wish to delete this ensembler, please Undeploy router versions and Terminate ensembling jobs that use this ensembler. -
+ You cannot delete this ensembler because it is: + +
)} {/* Only show The Ensembling Table if ensembler is not used by current router version */} {!ensemblerUsedByCurrentRouterVersion && ( diff --git a/ui/src/ensembler/components/table/ListEnsemblingJobsForEnsemblerTable.js b/ui/src/ensembler/components/table/ListEnsemblingJobsForEnsemblerTable.js index 1c29bedf6..29719bcee 100644 --- a/ui/src/ensembler/components/table/ListEnsemblingJobsForEnsemblerTable.js +++ b/ui/src/ensembler/components/table/ListEnsemblingJobsForEnsemblerTable.js @@ -93,7 +93,8 @@ export const ListEnsemblingJobsForEnsemblerTable = ({ {canDeleteEnsembler ? ( results.totalInactiveCount > 0 && (

-

Deleting this Ensembler will also delete {results.totalInactiveCount} Failed or Completed Ensembling Jobs that use this Ensembler

+ Deleting this Ensembler will also delete {results.totalInactiveCount} Failed or Completed +  Ensembling Job{results.totalInactiveCount > 1 && "s"} that use{results.totalInactiveCount === 1 && "s"} this Ensembler: 0 && (

-

This Ensembler is being used by {results.totalActiveCount} Active Ensembling Jobs. - If the ensembling jobs are in terminating state, please wait until the process complete to delete this ensembler

+ This Ensembler is used by {results.totalActiveCount} Active Ensembling Job{results.totalActiveCount > 1 && "s"}. + If any ensembling jobs are in the terminating state, please wait until they are terminated to delete this ensembler. + If you wish to delete this ensembler, please terminate {results.totalActiveCount > 1 ? "these ensembling jobs" : "this ensembling job"}.
))} diff --git a/ui/src/ensembler/components/table/ListRouterVersionsForEnsemblerTable.js b/ui/src/ensembler/components/table/ListRouterVersionsForEnsemblerTable.js index c40d4dd2d..fa8d8e850 100644 --- a/ui/src/ensembler/components/table/ListRouterVersionsForEnsemblerTable.js +++ b/ui/src/ensembler/components/table/ListRouterVersionsForEnsemblerTable.js @@ -18,6 +18,7 @@ export const ListRouterVersionsForEnsemblerTable = ({ ensemblerUsedByCurrentRouterVersion }) => { const [results, setResults] = useState({ inactiveItems: [], activeItems:[], totalInactiveCount: 0, totalActiveCount:0 }); + const [filteredActiveRouterVersions, setFilteredActiveRouterVersions] = useState([]) const { appConfig: { @@ -50,16 +51,15 @@ export const ListRouterVersionsForEnsemblerTable = ({ useEffect(() => { if (results.activeItems.length > 0){ - setEnsemblerUsedByActiveRouterVersion(true) - } else { - if (currentRouterVersion.isLoaded && !currentRouterVersion.error) { - if (currentRouterVersion.data.length > 0){ - setEnsemblerUsedByCurrentRouterVersion(true) - setEnsemblerUsedByActiveRouterVersion(false) - } else { - setEnsemblerUsedByCurrentRouterVersion(false) - setEnsemblerUsedByActiveRouterVersion(false) - } + setEnsemblerUsedByActiveRouterVersion(true); + } + + if (currentRouterVersion.isLoaded && !currentRouterVersion.error) { + if (currentRouterVersion.data.length > 0){ + setEnsemblerUsedByCurrentRouterVersion(true); + setFilteredActiveRouterVersions(results.activeItems.filter(item => currentRouterVersion.data.every((e => e.id !== item.id)))); + } else { + setEnsemblerUsedByCurrentRouterVersion(false) } } }, [results, currentRouterVersion, setEnsemblerUsedByActiveRouterVersion, setEnsemblerUsedByCurrentRouterVersion]) @@ -115,44 +115,54 @@ export const ListRouterVersionsForEnsemblerTable = ({ ) : ( - {ensemblerUsedByCurrentRouterVersion ? ( - currentRouterVersion.data.length > 0 && ( + {canDeleteEnsembler && results.totalInactiveCount > 0 && (

-

The router version with the related ensembler is being used by {currentRouterVersion.data.length} Routers

+ Deleting this Ensembler will also delete {results.totalInactiveCount} Failed or Undeployed +  Router Version{results.totalInactiveCount > 1 && "s"} that + use{results.totalInactiveCount === 1 && "s"} this Ensembler:
- )) : canDeleteEnsembler ? ( results.totalInactiveCount > 0 && ( + )} + {ensemblerUsedByCurrentRouterVersion && currentRouterVersion.data.length > 0 && (
-
-

Deleting this Ensembler will also delete {results.totalInactiveCount} Failed or Undeployed Router Versions that use this Ensembler

+ This Ensembler is used by {currentRouterVersion.data.length} +  Router{currentRouterVersion.data.length > 1 && "s"} +  in {currentRouterVersion.data.length > 1 ? "their" : "its"} current configuration: + If you wish to delete this ensembler, please deploy another router version + for {currentRouterVersion.data.length > 1 ? "these routers" : "this router"}.
- )) : ( results.totalActiveCount > 0 && ( + )} + {filteredActiveRouterVersions.length > 0 && (

-

This Ensembler is being used by {results.totalActiveCount} Active Router Versions

+ This Ensembler is {ensemblerUsedByCurrentRouterVersion && currentRouterVersion.data.length > 0 && "also"} +  used by {filteredActiveRouterVersions.length} +  Active Router Version{filteredActiveRouterVersions.length > 1 && "s"}: + If you wish to delete this ensembler, please undeploy +  {filteredActiveRouterVersions.length > 1 ? "these router versions" : "this router version"}.
- ))} + )}
); }; diff --git a/ui/src/jobs/components/modal/DeleteJobModal.js b/ui/src/jobs/components/modal/DeleteJobModal.js index 362bc167a..49ebcda34 100644 --- a/ui/src/jobs/components/modal/DeleteJobModal.js +++ b/ui/src/jobs/components/modal/DeleteJobModal.js @@ -45,7 +45,8 @@ export const DeleteJobModal = ({ return ( setDeleteConfirmation("")} + onConfirm={(arg) => {submitForm(arg); setDeleteConfirmation("")}} isLoading={isLoading} disabled={deleteConfirmation !== job.name} content={ diff --git a/ui/src/jobs/list/ListEnsemblingJobsTable.js b/ui/src/jobs/list/ListEnsemblingJobsTable.js index eea904acb..93a5b1228 100644 --- a/ui/src/jobs/list/ListEnsemblingJobsTable.js +++ b/ui/src/jobs/list/ListEnsemblingJobsTable.js @@ -158,18 +158,17 @@ export const ListEnsemblingJobsTable = ({ Monitoring - {item.status !== "terminating" && ( - - onDeleteJob(item)} - color={"danger"} - iconType={isActiveJobStatus(item.status) ? "trash" : "minusInCircle" } - iconSide="left" - size="xs"> - {isActiveJobStatus(item.status) ? "Delete" : "Terminate" } - - - )} + + onDeleteJob(item)} + color={"danger"} + iconType={isActiveJobStatus(item.status) ? "trash" : "minusInCircle" } + iconSide="left" + size="xs" + isDisabled={item.status === "terminating"}> + {isActiveJobStatus(item.status) ? "Delete" : "Terminate" } + + ),