Skip to content

Commit 106c383

Browse files
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>
1 parent a1bb34d commit 106c383

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.stories.tsx

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,3 +382,43 @@ export const ExternalAuthAllConnected: Story = {
382382
],
383383
},
384384
};
385+
386+
export const WithViewSourceButton: 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+
export const WithoutViewSourceButton: 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.",
421+
},
422+
},
423+
},
424+
};

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy