Skip to content

Commit 87da880

Browse files
committed
icon_title
1 parent bd28d89 commit 87da880

File tree

13 files changed

+42
-75
lines changed

13 files changed

+42
-75
lines changed

services/console/src/components/console/deck/header/DeckHeader.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,20 @@ import {
33
type Accessor,
44
For,
55
type Resource,
6+
Show,
67
createEffect,
78
createMemo,
89
} from "solid-js";
9-
import type { JsonAuthUser } from "../../../../types/bencher";
10+
import { AlertStatus, type JsonAuthUser } from "../../../../types/bencher";
1011
import { fmtValues, setPageTitle } from "../../../../util/resource";
1112
import { decodePath, pathname } from "../../../../util/url";
1213
import DeckHeaderButton, {
1314
type DeckHeaderButtonConfig,
1415
} from "./DeckHeaderButton";
1516
import { Display } from "../../../../config/types";
1617
import { fmtDateTime } from "../../../../config/util";
18+
import IconTitle from "../../../site/IconTitle";
19+
import { fmtAlertStatus } from "../../table/rows/AlertRow";
1720

1821
export interface Props {
1922
apiUrl: string;
@@ -28,6 +31,7 @@ export interface Props {
2831
export interface DeckHeaderConfig {
2932
key: string;
3033
keys?: string[][];
34+
icon?: string | ((data: object) => string);
3135
display?: Display;
3236
path: (pathname: string) => string;
3337
path_to: string;
@@ -68,9 +72,7 @@ const DeckHeader = (props: Props) => {
6872
</div>
6973
<div class="column">
7074
<div class="content has-text-centered">
71-
<h3 class="title is-3" style="word-break: break-word;">
72-
{title()}
73-
</h3>
75+
<h3 class="title is-3">{title()}</h3>
7476
</div>
7577
</div>
7678

services/console/src/components/console/table/rows/AlertRow.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import DimensionLabel from "./DimensionLabel";
66
import { MODEL_TEST_ICON } from "../../../field/kinds/Model";
77
import { Match, Switch } from "solid-js";
88

9-
export const ThresholdRow = (props: { alert: JsonAlert }) => {
9+
export const AlertRow = (props: { alert: JsonAlert }) => {
1010
return (
1111
<div>
1212
<Switch>
@@ -15,7 +15,7 @@ export const ThresholdRow = (props: { alert: JsonAlert }) => {
1515
<span class="icon has-text-primary">
1616
<i class="far fa-bell" />
1717
</span>
18-
<span>{fmtStatus(props.alert?.status)}</span>
18+
<span>{fmtAlertStatus(props.alert?.status)}</span>
1919
</span>
2020
</Match>
2121
<Match
@@ -28,7 +28,7 @@ export const ThresholdRow = (props: { alert: JsonAlert }) => {
2828
<span class="icon">
2929
<i class="far fa-bell-slash" />
3030
</span>
31-
<span>{fmtStatus(props.alert?.status)}</span>
31+
<span>{fmtAlertStatus(props.alert?.status)}</span>
3232
</span>
3333
</Match>
3434
</Switch>
@@ -52,7 +52,7 @@ export const ThresholdRow = (props: { alert: JsonAlert }) => {
5252
);
5353
};
5454

55-
const fmtStatus = (status: AlertStatus) => {
55+
export const fmtAlertStatus = (status: AlertStatus) => {
5656
switch (status) {
5757
case AlertStatus.Active:
5858
return "Active";
@@ -65,4 +65,4 @@ const fmtStatus = (status: AlertStatus) => {
6565
}
6666
};
6767

68-
export default ThresholdRow;
68+
export default AlertRow;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const IconTitle = (props: {
2+
icon: string;
3+
title: string | number | undefined;
4+
}) => (
5+
<span class="icon-text">
6+
<span class="icon">
7+
<i class={props.icon} />
8+
</span>
9+
<span>&nbsp;{props.title}</span>
10+
</span>
11+
);
12+
13+
export default IconTitle;

services/console/src/config/organization/members.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
isAllowedOrganizationDeleteRole,
99
} from "../../util/auth";
1010
import FieldKind from "../../components/field/kind";
11+
import IconTitle from "../../components/site/IconTitle";
1112

1213
const MEMBER_ICON = "fas fa-user";
1314

@@ -57,14 +58,7 @@ const MembersConfig = {
5758
[Operation.LIST]: {
5859
operation: Operation.LIST,
5960
header: {
60-
title: (
61-
<span class="icon-text">
62-
<span class="icon">
63-
<i class={MEMBER_ICON} />
64-
</span>
65-
<div>&nbsp;Members</div>
66-
</span>
67-
),
61+
title: <IconTitle icon={MEMBER_ICON} title="Members" />,
6862
buttons: [
6963
{ kind: Button.SEARCH },
7064
{
@@ -170,7 +164,6 @@ const MembersConfig = {
170164
operation: Operation.VIEW,
171165
header: {
172166
key: "name",
173-
icon: MEMBER_ICON,
174167
path: parentPath,
175168
path_to: "Organization Members",
176169
buttons: [{ kind: Button.REFRESH }],

services/console/src/config/organization/organizations.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ const organizationsConfig = {
107107
operation: Operation.VIEW,
108108
header: {
109109
key: "name",
110-
icon: ORGANIZATION_ICON,
111110
path: (pathname: string) => `${parentPath(pathname)}/projects`,
112111
path_to: "Organizations",
113112
buttons: [{ kind: Button.REFRESH }],

services/console/src/config/project/alerts.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,17 @@ import { PubResourceKind } from "../../components/perf/util";
33
import { isAllowedProjectEdit } from "../../util/auth";
44
import { ActionButton, Button, Card, Display, Operation, Row } from "../types";
55
import { parentPath, viewUuidPath } from "../util";
6+
import IconTitle from "../../components/site/IconTitle";
67

78
export const ALERT_ICON = "fas fa-bell";
89
export const ALERT_OFF_ICON = "far fa-bell-slash";
10+
export const ALERT_FALLBACK_ICON = "far fa-bell";
911

1012
const alertsConfig = {
1113
[Operation.LIST]: {
1214
operation: Operation.LIST,
1315
header: {
14-
title: (
15-
<span class="icon-text">
16-
<span class="icon">
17-
<i class={ALERT_ICON} />
18-
</span>
19-
<div>&nbsp;Alerts</div>
20-
</span>
21-
),
16+
title: <IconTitle icon={ALERT_ICON} title="Alerts" />,
2217
buttons: [
2318
{ kind: Button.DISMISS_ALL },
2419
{ kind: Button.ARCHIVED },

services/console/src/config/project/benchmarks.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
isAllowedProjectDelete,
1010
isAllowedProjectEdit,
1111
} from "../../util/auth";
12+
import IconTitle from "../../components/site/IconTitle";
1213

1314
export const BENCHMARK_ICON = "fas fa-tachometer-alt";
1415

@@ -33,14 +34,7 @@ const benchmarksConfig = {
3334
[Operation.LIST]: {
3435
operation: Operation.LIST,
3536
header: {
36-
title: (
37-
<span class="icon-text">
38-
<span class="icon">
39-
<i class={BENCHMARK_ICON} />
40-
</span>
41-
<div>&nbsp;Benchmarks</div>
42-
</span>
43-
),
37+
title: <IconTitle icon={BENCHMARK_ICON} title="Benchmarks" />,
4438
name: "Benchmarks",
4539
buttons: [
4640
{ kind: Button.SEARCH },

services/console/src/config/project/branches.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
ThresholdDimension,
1919
} from "../types";
2020
import { addPath, createdSlugPath, parentPath, viewSlugPath } from "../util";
21+
import IconTitle from "../../components/site/IconTitle";
2122

2223
export const BRANCH_ICON = "fas fa-code-branch";
2324

@@ -42,14 +43,7 @@ const branchesConfig = {
4243
[Operation.LIST]: {
4344
operation: Operation.LIST,
4445
header: {
45-
title: (
46-
<span class="icon-text">
47-
<span class="icon">
48-
<i class={BRANCH_ICON} />
49-
</span>
50-
<div>&nbsp;Branches</div>
51-
</span>
52-
),
46+
title: <IconTitle icon={BRANCH_ICON} title="Branches" />,
5347
name: "Branches",
5448
buttons: [
5549
{ kind: Button.SEARCH },

services/console/src/config/project/measures.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
ThresholdDimension,
1818
} from "../types";
1919
import { addPath, createdSlugPath, parentPath, viewSlugPath } from "../util";
20+
import IconTitle from "../../components/site/IconTitle";
2021

2122
export const MEASURE_ICON = "fas fa-shapes";
2223

@@ -48,14 +49,7 @@ const measuresConfig = {
4849
[Operation.LIST]: {
4950
operation: Operation.LIST,
5051
header: {
51-
title: (
52-
<span class="icon-text">
53-
<span class="icon">
54-
<i class={MEASURE_ICON} />
55-
</span>
56-
<div>&nbsp;Measures</div>
57-
</span>
58-
),
52+
title: <IconTitle icon={MEASURE_ICON} title="Measures" />,
5953
name: "Measures",
6054
buttons: [
6155
{ kind: Button.SEARCH },

services/console/src/config/project/projects.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
import { validResourceName, validOptionUrl, validSlug } from "../../util/valid";
1010
import { ActionButton, Button, Card, Display, Operation, Row } from "../types";
1111
import { addPath, parentPath } from "../util";
12+
import IconTitle from "../../components/site/IconTitle";
1213

1314
const PROJECT_ICON = "fas fa-project-diagram";
1415

@@ -57,14 +58,7 @@ const projectsConfig = {
5758
[Operation.LIST]: {
5859
operation: Operation.LIST,
5960
header: {
60-
title: (
61-
<span class="icon-text">
62-
<span class="icon">
63-
<i class={PROJECT_ICON} />
64-
</span>
65-
<div>&nbsp;Projects</div>
66-
</span>
67-
),
61+
title: <IconTitle icon={PROJECT_ICON} title="Projects" />,
6862
buttons: [
6963
{ kind: Button.SEARCH },
7064
{

0 commit comments

Comments
 (0)