Skip to content

Commit

Permalink
Set deployment history status to not deployed to match endpoint status
Browse files Browse the repository at this point in the history
  • Loading branch information
Arief Rahmansyah committed Oct 17, 2023
1 parent ebeed07 commit 412bfb4
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions ui/src/pages/version/HistoryDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,21 @@ import { useMerlinApi } from "../../hooks/useMerlinApi";

const defaultTextSize = "s";

const DeploymentStatus = ({ status, deployment, deployedRevision }) => {
const DeploymentStatus = ({
status,
deployment,
deployedRevision,
endpointStatus,
}) => {
if (deployment.error !== "") {
return <EuiHealth color="danger">Failed</EuiHealth>;
}

if (status === "running" || status === "serving") {
if (deployment.id === deployedRevision.id) {
if (
deployment.id === deployedRevision.id &&
(endpointStatus === "running" || endpointStatus === "serving")
) {
return <EuiHealth color="success">Deployed</EuiHealth>;
}
return <EuiHealth color="default">Not Deployed</EuiHealth>;
Expand All @@ -31,7 +39,7 @@ const DeploymentStatus = ({ status, deployment, deployedRevision }) => {
}
};

const RevisionPanel = ({ deployments, deploymentsLoaded }) => {
const RevisionPanel = ({ deployments, deploymentsLoaded, endpoint }) => {
const orderedDeployments = deployments.sort((a, b) => b.id - a.id);

const deployedRevision = orderedDeployments.find(
Expand Down Expand Up @@ -96,6 +104,7 @@ const RevisionPanel = ({ deployments, deploymentsLoaded }) => {
status={status}
deployment={deployment}
deployedRevision={deployedRevision}
endpointStatus={endpoint.status}
/>
),
},
Expand Down Expand Up @@ -164,6 +173,7 @@ export const HistoryDetails = ({ model, version, endpoint }) => {
<RevisionPanel
deployments={deployments}
deploymentsLoaded={deploymentsLoaded}
endpoint={endpoint}
/>
</EuiFlexItem>
<EuiFlexItem grow={1}></EuiFlexItem>
Expand Down

0 comments on commit 412bfb4

Please sign in to comment.