IO-3017 Lifecycle Average Time
Signed-off-by: Allan Carr <allan.carr@thinkimex.com>
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
import { Card, Table, Tag } from "antd";
|
import { Card, Table, Tag } from "antd";
|
||||||
import LoadingSkeleton from "../../loading-skeleton/loading-skeleton.component";
|
|
||||||
import { useTranslation } from "react-i18next";
|
|
||||||
import React, { useEffect, useState } from "react";
|
|
||||||
import dayjs from "../../../utils/day";
|
|
||||||
import DashboardRefreshRequired from "../refresh-required.component";
|
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
import React, { useEffect, useState } from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import dayjs from "../../../utils/day";
|
||||||
|
import LoadingSkeleton from "../../loading-skeleton/loading-skeleton.component";
|
||||||
|
import DashboardRefreshRequired from "../refresh-required.component";
|
||||||
|
|
||||||
const fortyFiveDaysAgo = () => dayjs().subtract(45, "day").toLocaleString();
|
const fortyFiveDaysAgo = () => dayjs().subtract(45, "day").toLocaleString();
|
||||||
|
|
||||||
@@ -46,6 +46,11 @@ export default function JobLifecycleDashboardComponent({ data, bodyshop, ...card
|
|||||||
dataIndex: "humanReadable",
|
dataIndex: "humanReadable",
|
||||||
key: "humanReadable"
|
key: "humanReadable"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: t("job_lifecycle.columns.average_human_readable"),
|
||||||
|
dataIndex: "averageHumanReadable",
|
||||||
|
key: "averageHumanReadable"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: t("job_lifecycle.columns.status_count"),
|
title: t("job_lifecycle.columns.status_count"),
|
||||||
key: "statusCount",
|
key: "statusCount",
|
||||||
|
|||||||
@@ -1338,6 +1338,8 @@
|
|||||||
},
|
},
|
||||||
"job_lifecycle": {
|
"job_lifecycle": {
|
||||||
"columns": {
|
"columns": {
|
||||||
|
"average_human_readable": "Average Human Readable",
|
||||||
|
"average_value": "Average Value",
|
||||||
"duration": "Duration",
|
"duration": "Duration",
|
||||||
"end": "End",
|
"end": "End",
|
||||||
"human_readable": "Human Readable",
|
"human_readable": "Human Readable",
|
||||||
|
|||||||
@@ -1338,6 +1338,8 @@
|
|||||||
},
|
},
|
||||||
"job_lifecycle": {
|
"job_lifecycle": {
|
||||||
"columns": {
|
"columns": {
|
||||||
|
"average_human_readable": "",
|
||||||
|
"average_value": "",
|
||||||
"duration": "",
|
"duration": "",
|
||||||
"end": "",
|
"end": "",
|
||||||
"human_readable": "",
|
"human_readable": "",
|
||||||
|
|||||||
@@ -1338,6 +1338,8 @@
|
|||||||
},
|
},
|
||||||
"job_lifecycle": {
|
"job_lifecycle": {
|
||||||
"columns": {
|
"columns": {
|
||||||
|
"average_human_readable": "",
|
||||||
|
"average_value": "",
|
||||||
"duration": "",
|
"duration": "",
|
||||||
"end": "",
|
"end": "",
|
||||||
"human_readable": "",
|
"human_readable": "",
|
||||||
|
|||||||
@@ -81,13 +81,17 @@ const jobLifecycle = async (req, res) => {
|
|||||||
const percentage = (value / finalTotal) * 100;
|
const percentage = (value / finalTotal) * 100;
|
||||||
const color = getLifecycleStatusColor(status);
|
const color = getLifecycleStatusColor(status);
|
||||||
const roundedPercentage = `${Math.round(percentage)}%`;
|
const roundedPercentage = `${Math.round(percentage)}%`;
|
||||||
|
const averageValue = value / jobIDs.length;
|
||||||
|
const averageHumanReadable = durationToHumanReadable(moment.duration(averageValue));
|
||||||
finalSummations.push({
|
finalSummations.push({
|
||||||
status,
|
status,
|
||||||
value,
|
value,
|
||||||
humanReadable,
|
humanReadable,
|
||||||
percentage,
|
percentage,
|
||||||
color,
|
color,
|
||||||
roundedPercentage
|
roundedPercentage,
|
||||||
|
averageValue,
|
||||||
|
averageHumanReadable
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -100,7 +104,9 @@ const jobLifecycle = async (req, res) => {
|
|||||||
totalStatuses: finalSummations.length,
|
totalStatuses: finalSummations.length,
|
||||||
total: finalTotal,
|
total: finalTotal,
|
||||||
statusCounts: finalStatusCounts,
|
statusCounts: finalStatusCounts,
|
||||||
humanReadable: durationToHumanReadable(moment.duration(finalTotal))
|
humanReadable: durationToHumanReadable(moment.duration(finalTotal)),
|
||||||
|
averageValue: finalTotal / jobIDs.length,
|
||||||
|
averageHumanReadable: durationToHumanReadable(moment.duration(finalTotal / jobIDs.length))
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user