@@ -4,97 +4,109 @@ import TableCell from "@mui/material/TableCell";
4
4
import TableContainer from "@mui/material/TableContainer" ;
5
5
import TableHead from "@mui/material/TableHead" ;
6
6
import TableRow from "@mui/material/TableRow" ;
7
- import { ComponentMeta , Story } from "@storybook/react" ;
8
7
import {
9
8
MockAuditLog ,
10
9
MockAuditLog2 ,
11
10
MockAuditLogWithWorkspaceBuild ,
12
11
MockAuditLogWithDeletedResource ,
13
12
MockAuditLogGitSSH ,
14
13
} from "testHelpers/entities" ;
15
- import { AuditLogRow , AuditLogRowProps } from "./AuditLogRow" ;
14
+ import { AuditLogRow } from "./AuditLogRow" ;
15
+ import type { Meta , StoryObj } from "@storybook/react" ;
16
16
17
- export default {
17
+ const meta : Meta < typeof AuditLogRow > = {
18
18
title : "components/AuditLogRow" ,
19
19
component : AuditLogRow ,
20
- } as ComponentMeta < typeof AuditLogRow > ;
20
+ decorators : [
21
+ ( Story ) => (
22
+ < TableContainer >
23
+ < Table >
24
+ < TableHead >
25
+ < TableRow >
26
+ < TableCell style = { { paddingLeft : 32 } } > Logs</ TableCell >
27
+ </ TableRow >
28
+ </ TableHead >
29
+ < TableBody >
30
+ < Story />
31
+ </ TableBody >
32
+ </ Table >
33
+ </ TableContainer >
34
+ ) ,
35
+ ] ,
36
+ } ;
21
37
22
- const Template : Story < AuditLogRowProps > = ( args ) => (
23
- < TableContainer >
24
- < Table >
25
- < TableHead >
26
- < TableRow >
27
- < TableCell style = { { paddingLeft : 32 } } > Logs</ TableCell >
28
- </ TableRow >
29
- </ TableHead >
30
- < TableBody >
31
- < AuditLogRow { ...args } />
32
- </ TableBody >
33
- </ Table >
34
- </ TableContainer >
35
- ) ;
38
+ export default meta ;
39
+ type Story = StoryObj < typeof AuditLogRow > ;
36
40
37
- export const NoDiff = Template . bind ( { } ) ;
38
- NoDiff . args = {
39
- auditLog : {
40
- ...MockAuditLog ,
41
- diff : { } ,
41
+ export const NoDiff : Story = {
42
+ args : {
43
+ auditLog : {
44
+ ...MockAuditLog ,
45
+ diff : { } ,
46
+ } ,
42
47
} ,
43
48
} ;
44
49
45
- export const WithDiff = Template . bind ( { } ) ;
46
- WithDiff . args = {
47
- auditLog : MockAuditLog2 ,
48
- defaultIsDiffOpen : true ,
50
+ export const WithDiff : Story = {
51
+ args : {
52
+ auditLog : MockAuditLog2 ,
53
+ defaultIsDiffOpen : true ,
54
+ } ,
49
55
} ;
50
56
51
- export const WithLongDiffRow = Template . bind ( { } ) ;
52
- WithLongDiffRow . args = {
53
- auditLog : {
54
- ...MockAuditLog2 ,
55
- diff : {
56
- ...MockAuditLog2 . diff ,
57
- icon : {
58
- old : "https://www.google.com/url?sa=i&url=https%3A%2F%2Fwww.docker.com%2Fcompany%2Fnewsroom%2Fmedia-resources%2F&psig=AOvVaw3hLg_lm0tzXPBt74XZD2GC&ust=1666892413988000&source=images&cd=vfe&ved=0CAwQjRxqFwoTCPDsiKa4_voCFQAAAAAdAAAAABAD" ,
59
- new : "https://www.google.com/url?sa=i&url=https%3A%2F%2Fwww.kindpng.com%2Fimgv%2FhRowRxi_docker-icon-png-transparent-png%2F&psig=AOvVaw3hLg_lm0tzXPBt74XZD2GC&ust=1666892413988000&source=images&cd=vfe&ved=0CAwQjRxqFwoTCPDsiKa4_voCFQAAAAAdAAAAABAI" ,
60
- secret : false ,
57
+ export const WithLongDiffRow : Story = {
58
+ args : {
59
+ auditLog : {
60
+ ...MockAuditLog2 ,
61
+ diff : {
62
+ ...MockAuditLog2 . diff ,
63
+ icon : {
64
+ old : "https://www.google.com/url?sa=i&url=https%3A%2F%2Fwww.docker.com%2Fcompany%2Fnewsroom%2Fmedia-resources%2F&psig=AOvVaw3hLg_lm0tzXPBt74XZD2GC&ust=1666892413988000&source=images&cd=vfe&ved=0CAwQjRxqFwoTCPDsiKa4_voCFQAAAAAdAAAAABAD" ,
65
+ new : "https://www.google.com/url?sa=i&url=https%3A%2F%2Fwww.kindpng.com%2Fimgv%2FhRowRxi_docker-icon-png-transparent-png%2F&psig=AOvVaw3hLg_lm0tzXPBt74XZD2GC&ust=1666892413988000&source=images&cd=vfe&ved=0CAwQjRxqFwoTCPDsiKa4_voCFQAAAAAdAAAAABAI" ,
66
+ secret : false ,
67
+ } ,
61
68
} ,
62
69
} ,
70
+ defaultIsDiffOpen : true ,
63
71
} ,
64
- defaultIsDiffOpen : true ,
65
72
} ;
66
73
67
- export const WithStoppedWorkspaceBuild = Template . bind ( { } ) ;
68
- WithStoppedWorkspaceBuild . args = {
69
- auditLog : {
70
- ...MockAuditLogWithWorkspaceBuild ,
71
- action : "stop" ,
74
+ export const WithStoppedWorkspaceBuild : Story = {
75
+ args : {
76
+ auditLog : {
77
+ ...MockAuditLogWithWorkspaceBuild ,
78
+ action : "stop" ,
79
+ } ,
72
80
} ,
73
81
} ;
74
82
75
- export const WithStartedWorkspaceBuild = Template . bind ( { } ) ;
76
- WithStartedWorkspaceBuild . args = {
77
- auditLog : {
78
- ...MockAuditLogWithWorkspaceBuild ,
79
- action : "start" ,
83
+ export const WithStartedWorkspaceBuild : Story = {
84
+ args : {
85
+ auditLog : {
86
+ ...MockAuditLogWithWorkspaceBuild ,
87
+ action : "start" ,
88
+ } ,
80
89
} ,
81
90
} ;
82
91
83
- export const WithDeletedWorkspaceBuild = Template . bind ( { } ) ;
84
- WithDeletedWorkspaceBuild . args = {
85
- auditLog : {
86
- ...MockAuditLogWithWorkspaceBuild ,
87
- action : "delete" ,
88
- is_deleted : true ,
92
+ export const WithDeletedWorkspaceBuild : Story = {
93
+ args : {
94
+ auditLog : {
95
+ ...MockAuditLogWithWorkspaceBuild ,
96
+ action : "delete" ,
97
+ is_deleted : true ,
98
+ } ,
89
99
} ,
90
100
} ;
91
101
92
- export const DeletedResource = Template . bind ( { } ) ;
93
- DeletedResource . args = {
94
- auditLog : MockAuditLogWithDeletedResource ,
102
+ export const DeletedResource : Story = {
103
+ args : {
104
+ auditLog : MockAuditLogWithDeletedResource ,
105
+ } ,
95
106
} ;
96
107
97
- export const SecretDiffValue = Template . bind ( { } ) ;
98
- SecretDiffValue . args = {
99
- auditLog : MockAuditLogGitSSH ,
108
+ export const SecretDiffValue : Story = {
109
+ args : {
110
+ auditLog : MockAuditLogGitSSH ,
111
+ } ,
100
112
} ;
0 commit comments