Merged in feature/IO-3017-Lifecycle-Average-Time (pull request #1889)
IO-3017 Lifecycle Average Time Approved-by: Dave Richer
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": "",
|
||||||
|
|||||||
@@ -78,16 +78,20 @@ const jobLifecycle = async (req, res) => {
|
|||||||
Object.keys(flatGroupedAllDurations).forEach((status) => {
|
Object.keys(flatGroupedAllDurations).forEach((status) => {
|
||||||
const value = flatGroupedAllDurations[status].reduce((acc, curr) => acc + curr.value, 0);
|
const value = flatGroupedAllDurations[status].reduce((acc, curr) => acc + curr.value, 0);
|
||||||
const humanReadable = durationToHumanReadable(moment.duration(value));
|
const humanReadable = durationToHumanReadable(moment.duration(value));
|
||||||
const percentage = (value / finalTotal) * 100;
|
const percentage = finalTotal > 0 ? (value / finalTotal) * 100 : 0;
|
||||||
const color = getLifecycleStatusColor(status);
|
const color = getLifecycleStatusColor(status);
|
||||||
const roundedPercentage = `${Math.round(percentage)}%`;
|
const roundedPercentage = `${Math.round(percentage)}%`;
|
||||||
|
const averageValue = _.size(jobIDs) > 0 ? value / jobIDs.length : 0;
|
||||||
|
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,12 @@ 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: _.size(jobIDs) > 0 ? finalTotal / jobIDs.length : 0,
|
||||||
|
averageHumanReadable:
|
||||||
|
_.size(jobIDs) > 0
|
||||||
|
? durationToHumanReadable(moment.duration(finalTotal / jobIDs.length))
|
||||||
|
: durationToHumanReadable(moment.duration(0))
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user