rename pretty-ms import to be clear about units

This commit is contained in:
emma 2023-11-13 19:37:15 -05:00
parent 5c5eba97a0
commit 060b8d85c9

View File

@ -4,7 +4,7 @@ import { when } from "lit/directives/when.js";
import { ifDefined } from "lit/directives/if-defined.js"; import { ifDefined } from "lit/directives/if-defined.js";
import { msg, localized, str } from "@lit/localize"; import { msg, localized, str } from "@lit/localize";
import type { SlSelectEvent } from "@shoelace-style/shoelace"; import type { SlSelectEvent } from "@shoelace-style/shoelace";
import humanizeDuration from "pretty-ms"; import humanizeMilliseconds from "pretty-ms";
import LiteElement, { html } from "../../utils/LiteElement"; import LiteElement, { html } from "../../utils/LiteElement";
import type { AuthState } from "../../utils/AuthService"; import type { AuthState } from "../../utils/AuthService";
@ -80,7 +80,7 @@ export class Dashboard extends LiteElement {
return html`<span title="${fullFormatter.format(minutes)}"> return html`<span title="${fullFormatter.format(minutes)}">
${compactFormatter.format(minutes)}</span ${compactFormatter.format(minutes)}</span
> >
(${humanizeDuration(seconds * 1000)})`; (${humanizeMilliseconds(seconds * 1000)})`;
}; };
render() { render() {
@ -401,7 +401,7 @@ export class Dashboard extends LiteElement {
<div class="text-center"> <div class="text-center">
<div>${label}</div> <div>${label}</div>
<div class="text-xs opacity-80"> <div class="text-xs opacity-80">
${humanizeDuration(value * 1000)} | ${humanizeMilliseconds(value * 1000)} |
${this.renderPercentage(value / quotaSeconds)} ${this.renderPercentage(value / quotaSeconds)}
</div> </div>
</div> </div>
@ -590,7 +590,7 @@ export class Dashboard extends LiteElement {
</sl-format-date> </sl-format-date>
`, `,
value ? this.humanizeExecutionSeconds(value) : "--", value ? this.humanizeExecutionSeconds(value) : "--",
humanizeDuration(crawlTime * 1000 || 0), humanizeMilliseconds(crawlTime * 1000 || 0),
]; ];
}); });
return html` return html`