@@ -21,11 +21,14 @@ const createWorkspaceItemRef = (
21
21
transition : WorkspaceTransition = "start" ,
22
22
outdated = false ,
23
23
lastUsedAt = "0001-01-01" ,
24
+ id ?: string ,
24
25
) : WorkspaceItemMachineRef => {
26
+ const wsId = id ?? MockWorkspace . id
25
27
return spawn (
26
28
workspaceItemMachine . withContext ( {
27
29
data : {
28
30
...MockWorkspace ,
31
+ id : wsId ,
29
32
outdated,
30
33
latest_build : {
31
34
...MockWorkspace . latest_build ,
@@ -83,6 +86,18 @@ const additionalWorkspaces: Record<string, WorkspaceItemMachineRef> = {
83
86
) ,
84
87
}
85
88
89
+ const fillerWorkspaces = Array ( 14 )
90
+ . fill ( undefined )
91
+ . map ( ( _ , i ) =>
92
+ createWorkspaceItemRef (
93
+ "running" ,
94
+ undefined ,
95
+ true ,
96
+ dayjs ( ) . toString ( ) ,
97
+ `test-workspace-${ i } ` ,
98
+ ) ,
99
+ )
100
+
86
101
export default {
87
102
title : "pages/WorkspacesPageView" ,
88
103
component : WorkspacesPageView ,
@@ -94,6 +109,18 @@ export default {
94
109
] ,
95
110
mapping : { ...workspaces , ...additionalWorkspaces } ,
96
111
} ,
112
+ onFilter : {
113
+ action : "filter" ,
114
+ } ,
115
+ onGoToPage : {
116
+ action : "go to page" ,
117
+ } ,
118
+ onNext : {
119
+ action : "next" ,
120
+ } ,
121
+ onPrevious : {
122
+ action : "previous" ,
123
+ } ,
97
124
} ,
98
125
} as ComponentMeta < typeof WorkspacesPageView >
99
126
@@ -107,16 +134,29 @@ AllStates.args = {
107
134
...Object . values ( workspaces ) ,
108
135
...Object . values ( additionalWorkspaces ) ,
109
136
] ,
137
+ count : 14 ,
110
138
}
111
139
112
140
export const OwnerHasNoWorkspaces = Template . bind ( { } )
113
141
OwnerHasNoWorkspaces . args = {
114
142
workspaceRefs : [ ] ,
143
+ count : 0 ,
115
144
filter : workspaceFilterQuery . me ,
116
145
}
117
146
118
147
export const NoResults = Template . bind ( { } )
119
148
NoResults . args = {
120
149
workspaceRefs : [ ] ,
150
+ count : 0 ,
121
151
filter : "searchtearmwithnoresults" ,
122
152
}
153
+
154
+ export const TwoPages = Template . bind ( { } )
155
+ TwoPages . args = {
156
+ workspaceRefs : [
157
+ ...Object . values ( workspaces ) ,
158
+ ...Object . values ( additionalWorkspaces ) ,
159
+ ...fillerWorkspaces ,
160
+ ] ,
161
+ count : 28 ,
162
+ }
0 commit comments