Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add Start time and Duration columnn in Admin perspectivr builds list …
…page and show duration on details page whie build is running
- Loading branch information
1 parent
338ce5b
commit 652ec23
Showing
7 changed files
with
106 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import i18next from 'i18next'; | ||
|
||
export const displayDurationInWords = (start: string, stop: string): string => { | ||
if (!start) { | ||
return '-'; | ||
} | ||
const startTime = new Date(start).getTime(); | ||
const stopTime = stop ? new Date(stop).getTime() : new Date().getTime(); | ||
let duration = Math.round((stopTime - startTime) / 1000); | ||
const time = []; | ||
let durationInWords = ''; | ||
while (duration >= 60) { | ||
time.push(duration % 60); | ||
duration = Math.floor(duration / 60); | ||
} | ||
time.push(duration); | ||
if (time[2]) { | ||
durationInWords += `${time[2]} ${ | ||
time[2] > 1 ? i18next.t('public~hours') : i18next.t('public~hour') | ||
} `; | ||
} | ||
if (time[1]) { | ||
durationInWords += `${time[1]} ${ | ||
time[1] > 1 ? i18next.t('public~minutes') : i18next.t('public~minute') | ||
} `; | ||
} | ||
if (time[0]) { | ||
durationInWords += `${time[0]} ${ | ||
time[0] > 1 ? i18next.t('public~seconds') : i18next.t('public~second') | ||
} `; | ||
} | ||
return durationInWords.trim(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters