mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-08-16 04:39:15 +00:00
fix(vm-migration): show elapsed duration for in-progress plans (#1037)
formatDuration returned an empty value when a migration was in progress (started set but completed missing), causing the duration column to show an em-dash for all running plans. It now computes elapsed time up to Date.now() when completed is absent, only returning the placeholder when started is unset or timestamps are invalid. Related issue: harvester/harvester#10417 Signed-off-by: Andy Lee <andy.lee@suse.com>
This commit is contained in:
parent
3d39626b93
commit
7a84e08f99
@ -99,12 +99,12 @@ const formatPipelineTooltip = (pipeline = []) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const formatDuration = (started, completed) => {
|
const formatDuration = (started, completed) => {
|
||||||
if (!started || !completed) {
|
if (!started) {
|
||||||
return { display: null, seconds: -1 };
|
return { display: null, seconds: -1 };
|
||||||
}
|
}
|
||||||
|
|
||||||
const startMs = new Date(started).getTime();
|
const startMs = new Date(started).getTime();
|
||||||
const endMs = new Date(completed).getTime();
|
const endMs = completed ? new Date(completed).getTime() : Date.now();
|
||||||
|
|
||||||
if (isNaN(startMs) || isNaN(endMs) || endMs < startMs) {
|
if (isNaN(startMs) || isNaN(endMs) || endMs < startMs) {
|
||||||
return { display: null, seconds: -1 };
|
return { display: null, seconds: -1 };
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user