Skip to content

Commit 0b42c67

Browse files
committed
feat: expand Overview stories with empty, loading, and error states
1 parent 2ae32f8 commit 0b42c67

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

frontend/src/components/cluster/Overview.stories.tsx

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,3 +192,52 @@ const Template: StoryFn = () => {
192192
};
193193

194194
export const Events = Template.bind({});
195+
196+
export const EmptyState = Template.bind({});
197+
EmptyState.parameters = {
198+
msw: {
199+
handlers: {
200+
story: [
201+
http.get('http://localhost:4466/api/v1/events', () =>
202+
HttpResponse.json({
203+
kind: 'EventsList',
204+
items: [],
205+
metadata: {},
206+
})
207+
),
208+
http.get('http://localhost:4466/api/v1/pods', () =>
209+
HttpResponse.json({
210+
kind: 'PodList',
211+
apiVersion: 'v1',
212+
metadata: {},
213+
items: [],
214+
})
215+
),
216+
],
217+
},
218+
},
219+
};
220+
221+
export const LoadingState = Template.bind({});
222+
LoadingState.parameters = {
223+
msw: {
224+
handlers: {
225+
story: [
226+
http.get('http://localhost:4466/api/v1/events', () => new Promise(() => {})), // simulate loading
227+
http.get('http://localhost:4466/api/v1/pods', () => new Promise(() => {})),
228+
],
229+
},
230+
},
231+
};
232+
233+
export const ErrorState = Template.bind({});
234+
ErrorState.parameters = {
235+
msw: {
236+
handlers: {
237+
story: [
238+
http.get('http://localhost:4466/api/v1/events', () => HttpResponse.error()),
239+
http.get('http://localhost:4466/api/v1/pods', () => HttpResponse.error()),
240+
],
241+
},
242+
},
243+
};

0 commit comments

Comments
 (0)