Skip to content

Commit 3452266

Browse files
committed
fix in tables
1 parent 11b43d7 commit 3452266

2 files changed

Lines changed: 49 additions & 38 deletions

File tree

frontend/src/features/crawls/crawl-list/crawl-list-item.ts

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,11 @@ export class CrawlListItem extends BtrixElement {
7171

7272
return html`
7373
<btrix-table-row
74-
class=${this.href
75-
? "cursor-pointer select-none transition-colors hover:bg-neutral-50 focus-within:bg-neutral-50 duration-fast"
76-
: ""}
74+
class=${
75+
this.href
76+
? "cursor-pointer select-none transition-colors hover:bg-neutral-50 focus-within:bg-neutral-50 duration-fast"
77+
: ""
78+
}
7779
@click=${async (e: MouseEvent) => {
7880
if (e.target === this.dropdownMenu) {
7981
return;
@@ -95,30 +97,34 @@ export class CrawlListItem extends BtrixElement {
9597
)}
9698
</btrix-table-cell>
9799
<btrix-table-cell rowClickTarget=${this.href ? "a" : nothing}>
98-
${this.href
99-
? html`<a href=${this.href} @click=${this.navigate.link}>
100-
${label}
101-
</a>`
102-
: label}
100+
${
101+
this.href
102+
? html`<a href=${this.href} @click=${this.navigate.link}>
103+
${label}
104+
</a>`
105+
: label
106+
}
103107
</btrix-table-cell>
104-
${this.workflowId
105-
? nothing
106-
: html`
107-
<btrix-table-cell>
108-
${this.safeRender(
109-
(crawl) => html`
110-
<btrix-format-date
111-
date=${crawl.started}
112-
month="2-digit"
113-
day="2-digit"
114-
year="numeric"
115-
hour="2-digit"
116-
minute="2-digit"
117-
></btrix-format-date>
118-
`,
119-
)}
120-
</btrix-table-cell>
121-
`}
108+
${
109+
this.workflowId
110+
? nothing
111+
: html`
112+
<btrix-table-cell>
113+
${this.safeRender(
114+
(crawl) => html`
115+
<btrix-format-date
116+
date=${crawl.started}
117+
month="2-digit"
118+
day="2-digit"
119+
year="numeric"
120+
hour="2-digit"
121+
minute="2-digit"
122+
></btrix-format-date>
123+
`,
124+
)}
125+
</btrix-table-cell>
126+
`
127+
}
122128
<btrix-table-cell>
123129
${this.safeRender((crawl) =>
124130
crawl.finished
@@ -138,11 +144,9 @@ export class CrawlListItem extends BtrixElement {
138144
<btrix-table-cell>
139145
${this.safeRender((crawl) =>
140146
!skipped
141-
? html`<span
142-
>${humanizeExecutionSeconds(crawl.crawlExecSeconds, {
143-
style: "short",
144-
})}</span
145-
>`
147+
? humanizeExecutionSeconds(crawl.crawlExecSeconds, {
148+
style: "short",
149+
})
146150
: notApplicable,
147151
)}
148152
</btrix-table-cell>

frontend/src/utils/executionTimeFormatter.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
import clsx from "clsx";
12
import { html, nothing } from "lit";
23
import { ifDefined } from "lit/directives/if-defined.js";
34

45
import localize from "./localize";
6+
import { tw } from "./tailwind";
57

68
/**
79
* Returns either `nothing`, or hours-minutes-seconds wrapped in parens.
@@ -161,19 +163,24 @@ export const humanizeExecutionSeconds = (
161163
: "";
162164

163165
switch (style) {
164-
case "long":
166+
case "long": {
167+
const tooltip = fullMinutes !== compactMinutes ? fullMinutes : undefined;
165168
return html`<span
166-
title="${ifDefined(
167-
fullMinutes !== compactMinutes ? fullMinutes : undefined,
168-
)}"
169+
class=${clsx(
170+
// Place above 'rowClickTarget' in tables if tooltip is available
171+
tooltip && tw`z-[1]`,
172+
)}
173+
title=${ifDefined(tooltip)}
169174
>${prefix}${detailsRelevant ? formattedDetails : compactMinutes}</span
170175
>`;
176+
}
171177
case "short":
172178
return html`<span
179+
class="z-[1]"
173180
title="${displaySeconds && seconds < 60 ? fullSeconds : fullMinutes}"
174-
>${prefix}${displaySeconds && seconds < 60
175-
? compactSeconds
176-
: compactMinutes}</span
181+
>${prefix}${
182+
displaySeconds && seconds < 60 ? compactSeconds : compactMinutes
183+
}</span
177184
>`;
178185
}
179186
};

0 commit comments

Comments
 (0)