Skip to content

Commit

Permalink
feedback from guigui
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaume-chervet committed Jul 11, 2023
1 parent 1aad8a0 commit 230fdd7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
5 changes: 1 addition & 4 deletions api/web/src/ListState.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Table from '@axa-fr/react-toolkit-table';
import Popover from '@axa-fr/react-toolkit-popover';
import {STOPPED, STARTED} from './state';
import {endWeekModeEnum, startWeekModeEnum} from "./apiConstants.js";
import {computeIsFunction, computeState} from './state.js';
import {computeIsFunction, computeState, computeIsDailyClean} from './state.js';
import '@axa-fr/react-toolkit-table/dist/table.scss';
import '@axa-fr/react-toolkit-popover/dist/popover.scss';

Expand Down Expand Up @@ -41,9 +41,6 @@ const getTitle = (state) => {
return "In progress";
}

const computeIsDailyClean = (deployment) => {
return (deployment && deployment.labels && deployment.labels["axa.com/dailyclean"] === "false");
}

const Containers = ({deployment}) => {
if(!deployment.containers) return null;
Expand Down
14 changes: 9 additions & 5 deletions api/web/src/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@ export const IN_PROGRESS = "IN_PROGRESS";

export const computeState = (workloads) =>
{
const workloadInProgress = workloads.find(w => !computeIsFunction(w) && w.current !== w.target)
const workloadInProgress = workloads.find(w => !computeIsFunction(w) && w.current === 0 && w.target > 0 && !computeIsDailyClean(d))
if(workloadInProgress) return "IN_PROGRESS";

const workload = workloads.find(w => !computeIsFunction(w) && w.target === 0)
return workload != null ? "STOPPED" : "STARTED";
const workloadStopped = workloads.find(w => !computeIsFunction(w) && w.target === 0 && !computeIsDailyClean(d))
return workloadStopped != null ? "STOPPED" : "STARTED";
}


export const computeIsFunction = (deployment) => {
return (deployment && deployment.labels && deployment.labels["axa.com/function"] === "true");
export const computeIsFunction = (workload) => {
return (workload && workload.labels && workload.labels["axa.com/function"] === "true");
}

export const computeIsDailyClean = (workload) => {
return (workload && workload.labels && workload.labels["axa.com/dailyclean"] === "false");
}

0 comments on commit 230fdd7

Please sign in to comment.