-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: incorrect interval reported on the Sources list page
== UI * Utility function to convert `interval` to string, that way we have to change only in one place if we want to change the format. == Backend * Fix interval calculation on `HelmRepository` and `GitRepository`. The issues was: `.Minutes()` and `.Seconds()` return with the value of the whole interval, not just the minutes/seconds parts.
- Loading branch information
Showing
6 changed files
with
40 additions
and
12 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,24 @@ | ||
import { Interval } from "./api/core/types.pb"; | ||
|
||
export function showInterval(interval: Interval): string { | ||
const parts = []; | ||
|
||
if (interval.hours !== "0") { | ||
parts.push(`${interval.hours}h`); | ||
} | ||
|
||
if (interval.minutes !== "0" || parts.length > 0) { | ||
// Show minutes we have Hour, but minute is zero. | ||
// For example: 1h 0m 23s | ||
// It's easier to read, without it, it's easy to misread the | ||
// value "1h 23s" as "1m 23s" | ||
parts.push(`${interval.minutes}m`); | ||
} | ||
|
||
if (interval.seconds !== "0" || parts.length > 0) { | ||
// Same as minute. | ||
parts.push(`${interval.seconds}s`); | ||
} | ||
|
||
return parts.join(" "); | ||
} |