Skip to content

Commit b604ff4

Browse files
committed
add story and fix import
Signed-off-by: Jens Langhammer <[email protected]>
1 parent f6d80b2 commit b604ff4

File tree

2 files changed

+158
-0
lines changed

2 files changed

+158
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
import type { Meta, StoryObj } from "@storybook/web-components";
2+
3+
import { html } from "lit";
4+
5+
import { LogLevelEnum, SyncStatus, SystemTaskStatusEnum } from "@goauthentik/api";
6+
7+
import "./SyncStatusCard";
8+
9+
const metadata: Meta<SyncStatus> = {
10+
title: "Elements/<ak-sync-status-card>",
11+
component: "ak-sync-status-card",
12+
};
13+
14+
export default metadata;
15+
16+
export const Running: StoryObj = {
17+
args: {
18+
status: {
19+
isRunning: true,
20+
tasks: [],
21+
} as SyncStatus,
22+
},
23+
// @ts-ignore
24+
render: ({ status }: SyncStatus) => {
25+
return html` <div style="background-color: #f0f0f0; padding: 1rem;">
26+
<ak-sync-status-card
27+
.fetch=${async () => {
28+
return status;
29+
}}
30+
></ak-sync-status-card>
31+
</div>`;
32+
},
33+
};
34+
35+
export const SingleTask: StoryObj = {
36+
args: {
37+
status: {
38+
isRunning: false,
39+
tasks: [
40+
{
41+
uuid: "9ff42169-8249-4b67-ae3d-e455d822de2b",
42+
name: "Single task",
43+
fullName: "foo:bar:baz",
44+
status: SystemTaskStatusEnum.Successful,
45+
messages: [
46+
{
47+
logger: "foo",
48+
event: "bar",
49+
attributes: {
50+
foo: "bar",
51+
},
52+
timestamp: new Date(),
53+
logLevel: LogLevelEnum.Info,
54+
},
55+
],
56+
description: "foo",
57+
startTimestamp: new Date(),
58+
finishTimestamp: new Date(),
59+
duration: 0,
60+
},
61+
],
62+
} as SyncStatus,
63+
},
64+
// @ts-ignore
65+
render: ({ status }: SyncStatus) => {
66+
return html` <div style="background-color: #f0f0f0; padding: 1rem;">
67+
<ak-sync-status-card
68+
.fetch=${async () => {
69+
return status;
70+
}}
71+
></ak-sync-status-card>
72+
</div>`;
73+
},
74+
};
75+
76+
export const MultipleTasks: StoryObj = {
77+
args: {
78+
status: {
79+
isRunning: false,
80+
tasks: [
81+
{
82+
uuid: "9ff42169-8249-4b67-ae3d-e455d822de2b",
83+
name: "Single task",
84+
fullName: "foo:bar:baz",
85+
status: SystemTaskStatusEnum.Successful,
86+
messages: [
87+
{
88+
logger: "foo",
89+
event: "bar",
90+
attributes: {
91+
foo: "bar",
92+
},
93+
timestamp: new Date(),
94+
logLevel: LogLevelEnum.Info,
95+
},
96+
],
97+
description: "foo",
98+
startTimestamp: new Date(),
99+
finishTimestamp: new Date(),
100+
duration: 0,
101+
},
102+
{
103+
uuid: "9ff42169-8249-4b67-ae3d-e455d822de2b",
104+
name: "Single task",
105+
fullName: "foo:bar:baz",
106+
status: SystemTaskStatusEnum.Successful,
107+
messages: [
108+
{
109+
logger: "foo",
110+
event: "bar",
111+
attributes: {
112+
foo: "bar",
113+
},
114+
timestamp: new Date(),
115+
logLevel: LogLevelEnum.Info,
116+
},
117+
],
118+
description: "foo",
119+
startTimestamp: new Date(),
120+
finishTimestamp: new Date(),
121+
duration: 0,
122+
},
123+
{
124+
uuid: "9ff42169-8249-4b67-ae3d-e455d822de2b",
125+
name: "Single task",
126+
fullName: "foo:bar:baz",
127+
status: SystemTaskStatusEnum.Successful,
128+
messages: [
129+
{
130+
logger: "foo",
131+
event: "bar",
132+
attributes: {
133+
foo: "bar",
134+
},
135+
timestamp: new Date(),
136+
logLevel: LogLevelEnum.Info,
137+
},
138+
],
139+
description: "foo",
140+
startTimestamp: new Date(),
141+
finishTimestamp: new Date(),
142+
duration: 0,
143+
},
144+
],
145+
} as SyncStatus,
146+
},
147+
// @ts-ignore
148+
render: ({ status }: SyncStatus) => {
149+
return html` <div style="background-color: #f0f0f0; padding: 1rem;">
150+
<ak-sync-status-card
151+
.fetch=${async () => {
152+
return status;
153+
}}
154+
></ak-sync-status-card>
155+
</div>`;
156+
},
157+
};

web/src/elements/sync/SyncStatusCard.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { EVENT_REFRESH } from "@goauthentik/common/constants";
22
import { getRelativeTime } from "@goauthentik/common/utils";
33
import "@goauthentik/components/ak-status-label";
4+
import "@goauthentik/elements/buttons/ActionButton";
45
import { AKElement } from "@goauthentik/elements/Base";
56
import "@goauthentik/elements/EmptyState";
67
import "@goauthentik/elements/events/LogViewer";

0 commit comments

Comments
 (0)