You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add Storybook stories for View Source button
Adds two new stories to test the View Source button functionality:
- WithViewSourceButton: Shows the button for template administrators
- WithoutViewSourceButton: Hides the button for regular users
These stories exercise the canUpdateTemplate prop and demonstrate
the conditional rendering of the View Source button.
Co-authored-by: matifali <10648092+matifali@users.noreply.github.com>
Copy file name to clipboardExpand all lines: site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.stories.tsx
+40Lines changed: 40 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -382,3 +382,43 @@ export const ExternalAuthAllConnected: Story = {
382
382
],
383
383
},
384
384
};
385
+
386
+
exportconstWithViewSourceButton: Story={
387
+
args: {
388
+
canUpdateTemplate: true,
389
+
versionId: "template-version-123",
390
+
template: {
391
+
...MockTemplate,
392
+
organization_name: "default",
393
+
name: "docker-template",
394
+
},
395
+
},
396
+
parameters: {
397
+
docs: {
398
+
description: {
399
+
story:
400
+
"This story shows the View Source button that appears for template administrators. The button allows quick navigation to the template editor from the workspace creation page.",
401
+
},
402
+
},
403
+
},
404
+
};
405
+
406
+
exportconstWithoutViewSourceButton: Story={
407
+
args: {
408
+
canUpdateTemplate: false,
409
+
versionId: "template-version-123",
410
+
template: {
411
+
...MockTemplate,
412
+
organization_name: "default",
413
+
name: "docker-template",
414
+
},
415
+
},
416
+
parameters: {
417
+
docs: {
418
+
description: {
419
+
story:
420
+
"This story shows the workspace creation page for users without template update permissions. The View Source button is hidden for these users.",
0 commit comments