Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
emma-sg committed Mar 11, 2024
1 parent 197d741 commit 226ee82
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
15 changes: 9 additions & 6 deletions frontend/src/components/ui/grouped-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ type GroupConfig<
label?: string;
collapsible?: boolean;
startCollapsed?: boolean;
displayIfEmpty?: boolean;
renderLabel?: (group: {
group: GroupConfig<T, G, GR> | null;
data: T[];
Expand Down Expand Up @@ -223,12 +224,14 @@ export function GroupedList<
return renderWrapper(
html`${groups
? groups.map((group) =>
renderGroup(
html`${group.group?.renderLabel?.(group) ??
group.group?.label ??
group.group?.value}`,
renderData(group.data),
),
group.data.length > 0 || group.group?.displayIfEmpty
? renderGroup(
html`${group.group?.renderLabel?.(group) ??
group.group?.label ??
group.group?.value}`,
renderData(group.data),
)
: null,
)
: renderData(data)}`,
);
Expand Down
1 change: 1 addition & 0 deletions frontend/src/features/qa/page-list/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type { ArchivedItemPage } from "@/types/crawler";
import { cached } from "@/utils/weakCache";

export type Severity = "severe" | "moderate" | "good" | null;
export type SortBy = "screenshotMatch" | "textMatch"; // TODO add resource counts

export const composeWithRunId = <T>(
fn: (page: ArchivedItemPage, runId: string) => T,
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/features/qa/page-list/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,11 @@ export class PageList extends TailwindElement {
>${pageDetails(datum, this.qaRunId)}</sl-tree-item
>
</sl-tree-item>`,
sortBy: (a, b) =>
issueCounts(b, this.qaRunId).severe -
issueCounts(a, this.qaRunId).severe ||
issueCounts(b, this.qaRunId).moderate -
issueCounts(a, this.qaRunId).moderate,
// sortBy: (a, b) =>
// issueCounts(b, this.qaRunId).severe -
// issueCounts(a, this.qaRunId).severe ||
// issueCounts(b, this.qaRunId).moderate -
// issueCounts(a, this.qaRunId).moderate,
groupBy: {
value: composeWithRunId(maxSeverity, this.qaRunId),
groups: [
Expand Down

0 comments on commit 226ee82

Please sign in to comment.