mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-16 09:35:36 -05:00
Sql DB project dashboard (#14899)
* First set of changes for workspace dashboard implementing the toolbar * Workspace dashboard container implementation (#14813) * First set of changes for workspace dashboard implementing the toolbar (#14160) * First set of changes for workspace dashboard implementing the toolbar * Addressed comments * Addressed one remaining comment * Removed an extra comma in interfaces file * Addressed comments * Addressed comments * Refactored a bit of code * Remove unnecessary await * Addressed comments * First set of changes for workspace dashboard container * Update targetPlatform icon+add Time column to deploy table * Addressed comments * Removed redundant class definition * Addressed comments * Addressed comments * Change enum to union type in dataworkspace typings * Fix tests * Addressed comments
This commit is contained in:
@@ -284,3 +284,37 @@ export function getPackageInfo(packageJson?: any): IPackageInfo | undefined {
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts time in milliseconds to hr, min, sec
|
||||
* @param duration time in milliseconds
|
||||
* @returns string in "hr, min, sec" or "msec" format
|
||||
*/
|
||||
export function timeConversion(duration: number): string {
|
||||
const portions: string[] = [];
|
||||
|
||||
const msInHour = 1000 * 60 * 60;
|
||||
const hours = Math.trunc(duration / msInHour);
|
||||
if (hours > 0) {
|
||||
portions.push(`${hours} ${constants.hr}`);
|
||||
duration = duration - (hours * msInHour);
|
||||
}
|
||||
|
||||
const msInMinute = 1000 * 60;
|
||||
const minutes = Math.trunc(duration / msInMinute);
|
||||
if (minutes > 0) {
|
||||
portions.push(`${minutes} ${constants.min}`);
|
||||
duration = duration - (minutes * msInMinute);
|
||||
}
|
||||
|
||||
const seconds = Math.trunc(duration / 1000);
|
||||
if (seconds > 0) {
|
||||
portions.push(`${seconds} ${constants.sec}`);
|
||||
}
|
||||
|
||||
if (hours === 0 && minutes === 0 && seconds === 0) {
|
||||
portions.push(`${duration} ${constants.msec}`);
|
||||
}
|
||||
|
||||
return portions.join(', ');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user