1
- import { Story } from "@storybook/react" ;
2
1
import {
3
2
WorkspaceAgentMetadataDescription ,
4
3
WorkspaceAgentMetadataResult ,
5
4
} from "api/typesGenerated" ;
6
- import { AgentMetadataView , AgentMetadataViewProps } from "./AgentMetadata" ;
5
+ import { AgentMetadataView } from "./AgentMetadata" ;
6
+ import type { Meta , StoryObj } from "@storybook/react" ;
7
7
8
- export default {
9
- title : "components/AgentMetadata " ,
8
+ const meta : Meta < typeof AgentMetadataView > = {
9
+ title : "components/AgentMetadataView " ,
10
10
component : AgentMetadataView ,
11
11
} ;
12
12
13
- const Template : Story < AgentMetadataViewProps > = ( args ) => (
14
- < AgentMetadataView { ...args } />
15
- ) ;
13
+ export default meta ;
14
+ type Story = StoryObj < typeof AgentMetadataView > ;
16
15
17
16
const resultDefaults : WorkspaceAgentMetadataResult = {
18
17
collected_at : "2021-05-05T00:00:00Z" ,
@@ -29,79 +28,80 @@ const descriptionDefaults: WorkspaceAgentMetadataDescription = {
29
28
script : "some command" ,
30
29
} ;
31
30
32
- export const Example = Template . bind ( { } ) ;
33
- Example . args = {
34
- metadata : [
35
- {
36
- result : {
37
- ...resultDefaults ,
38
- value : "110%" ,
31
+ export const Example : Story = {
32
+ args : {
33
+ metadata : [
34
+ {
35
+ result : {
36
+ ...resultDefaults ,
37
+ value : "110%" ,
38
+ } ,
39
+ description : {
40
+ ...descriptionDefaults ,
41
+ display_name : "CPU" ,
42
+ key : "CPU" ,
43
+ } ,
39
44
} ,
40
- description : {
41
- ...descriptionDefaults ,
42
- display_name : "CPU" ,
43
- key : "CPU" ,
45
+ {
46
+ result : {
47
+ ...resultDefaults ,
48
+ value : "50GB" ,
49
+ } ,
50
+ description : {
51
+ ...descriptionDefaults ,
52
+ display_name : "Memory" ,
53
+ key : "Memory" ,
54
+ } ,
44
55
} ,
45
- } ,
46
- {
47
- result : {
48
- ...resultDefaults ,
49
- value : "50GB" ,
56
+ {
57
+ result : {
58
+ ...resultDefaults ,
59
+ value : "stale value" ,
60
+ age : 300 ,
61
+ } ,
62
+ description : {
63
+ ...descriptionDefaults ,
64
+ interval : 5 ,
65
+ display_name : "Stale" ,
66
+ key : "stale" ,
67
+ } ,
50
68
} ,
51
- description : {
52
- ...descriptionDefaults ,
53
- display_name : "Memory" ,
54
- key : "Memory" ,
69
+ {
70
+ result : {
71
+ ...resultDefaults ,
72
+ value : "oops" ,
73
+ error : "fatal error" ,
74
+ } ,
75
+ description : {
76
+ ...descriptionDefaults ,
77
+ display_name : "Error" ,
78
+ key : "error" ,
79
+ } ,
55
80
} ,
56
- } ,
57
- {
58
- result : {
59
- ...resultDefaults ,
60
- value : "stale value" ,
61
- age : 300 ,
81
+ {
82
+ result : {
83
+ ...resultDefaults ,
84
+ value : "" ,
85
+ collected_at : "0001-01-01T00:00:00Z" ,
86
+ age : 1000000 ,
87
+ } ,
88
+ description : {
89
+ ...descriptionDefaults ,
90
+ display_name : "Never loads" ,
91
+ key : "nloads" ,
92
+ } ,
62
93
} ,
63
- description : {
64
- ...descriptionDefaults ,
65
- interval : 5 ,
66
- display_name : "Stale" ,
67
- key : "stale" ,
94
+ {
95
+ result : {
96
+ ...resultDefaults ,
97
+ value : "r" . repeat ( 1000 ) ,
98
+ } ,
99
+ description : {
100
+ ...descriptionDefaults ,
101
+ display_name : "Really, really big" ,
102
+ key : "big" ,
103
+ } ,
68
104
} ,
69
- } ,
70
- {
71
- result : {
72
- ...resultDefaults ,
73
- value : "oops" ,
74
- error : "fatal error" ,
75
- } ,
76
- description : {
77
- ...descriptionDefaults ,
78
- display_name : "Error" ,
79
- key : "error" ,
80
- } ,
81
- } ,
82
- {
83
- result : {
84
- ...resultDefaults ,
85
- value : "" ,
86
- collected_at : "0001-01-01T00:00:00Z" ,
87
- age : 1000000 ,
88
- } ,
89
- description : {
90
- ...descriptionDefaults ,
91
- display_name : "Never loads" ,
92
- key : "nloads" ,
93
- } ,
94
- } ,
95
- {
96
- result : {
97
- ...resultDefaults ,
98
- value : "r" . repeat ( 1000 ) ,
99
- } ,
100
- description : {
101
- ...descriptionDefaults ,
102
- display_name : "Really, really big" ,
103
- key : "big" ,
104
- } ,
105
- } ,
106
- ] ,
105
+ ] ,
106
+ } ,
107
107
} ;
0 commit comments