-
Notifications
You must be signed in to change notification settings - Fork 987
fix(site): exclude workspace schedule settings for prebuilt workspaces #18826
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ssncferreira
merged 11 commits into
main
from
ssncferreira/exclude-schedule-settings-for-prebuilds
Jul 15, 2025
Merged
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
95ca5f7
fix(site): exclude workspace schedule settings for prebuilt workspaces
ssncferreira 207c80f
feat: add is_prebuild flag to workspace API response
ssncferreira 450b3e1
fix: fmt
ssncferreira 0bde254
chore: add comment to IsPrebuild parameter on codersdk.Workspaces
ssncferreira 73f5476
chore: add story to WorkspaceSchedulePage
ssncferreira f306854
Merge remote-tracking branch 'origin/main' into ssncferreira/exclude-…
ssncferreira d5e45bb
fix: run make gen
ssncferreira 0120c5b
chore: use workspace.IsPrebuild() on convertWorkspace
ssncferreira ad475cf
simplify story
BrunoQuaresma 02c0ff5
fix: run make fmt
ssncferreira 1260e49
Merge remote-tracking branch 'origin/main' into ssncferreira/exclude-…
ssncferreira File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
chore: add story to WorkspaceSchedulePage
- Loading branch information
commit 73f54764b7c31567d56aee71a2fdaf815176de85
There are no files selected for viewing
120 changes: 120 additions & 0 deletions
120
site/src/pages/WorkspaceSettingsPage/WorkspaceSchedulePage/WorkspaceSchedulePage.stories.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
import { getAuthorizationKey } from "api/queries/authCheck"; | ||
import { templateByNameKey } from "api/queries/templates"; | ||
import { workspaceByOwnerAndNameKey } from "api/queries/workspaces"; | ||
import { AuthProvider } from "contexts/auth/AuthProvider"; | ||
import { RequireAuth } from "contexts/auth/RequireAuth"; | ||
import { permissionChecks } from "modules/permissions"; | ||
import { | ||
reactRouterOutlet, | ||
reactRouterParameters, | ||
} from "storybook-addon-remix-react-router"; | ||
import { | ||
MockAppearanceConfig, | ||
MockAuthMethodsAll, | ||
MockBuildInfo, | ||
MockDefaultOrganization, | ||
MockEntitlements, | ||
MockExperiments, | ||
MockPrebuiltWorkspace, | ||
MockTemplate, | ||
MockUserAppearanceSettings, | ||
MockUserOwner, | ||
MockWorkspace, | ||
} from "testHelpers/entities"; | ||
import WorkspaceSchedulePage from "./WorkspaceSchedulePage"; | ||
|
||
import { WorkspaceSettingsContext } from "../WorkspaceSettingsLayout"; | ||
|
||
const meta = { | ||
title: "pages/WorkspaceSchedulePage", | ||
component: RequireAuth, | ||
parameters: { | ||
layout: "fullscreen", | ||
reactRouter: reactRouterParameters({ | ||
location: { | ||
pathParams: { | ||
username: `@${MockWorkspace.owner_name}`, | ||
workspace: MockWorkspace.name, | ||
}, | ||
}, | ||
routing: reactRouterOutlet( | ||
{ | ||
path: "/:username/:workspace/settings/schedule", | ||
}, | ||
<WorkspaceSchedulePage />, | ||
), | ||
}), | ||
queries: [ | ||
{ key: ["me"], data: MockUserOwner }, | ||
{ key: ["authMethods"], data: MockAuthMethodsAll }, | ||
{ key: ["hasFirstUser"], data: true }, | ||
{ key: ["buildInfo"], data: MockBuildInfo }, | ||
{ key: ["entitlements"], data: MockEntitlements }, | ||
{ key: ["experiments"], data: MockExperiments }, | ||
{ key: ["appearance"], data: MockAppearanceConfig }, | ||
{ key: ["organizations"], data: [MockDefaultOrganization] }, | ||
{ | ||
key: getAuthorizationKey({ checks: permissionChecks }), | ||
data: { editWorkspaceProxies: true }, | ||
}, | ||
{ key: ["me", "appearance"], data: MockUserAppearanceSettings }, | ||
{ | ||
key: workspaceByOwnerAndNameKey( | ||
MockWorkspace.owner_name, | ||
MockWorkspace.name, | ||
), | ||
data: MockWorkspace, | ||
}, | ||
{ | ||
key: getAuthorizationKey({ | ||
checks: { | ||
updateWorkspace: { | ||
object: { | ||
resource_type: "workspace", | ||
resource_id: MockWorkspace.id, | ||
owner_id: MockWorkspace.owner_id, | ||
}, | ||
action: "update", | ||
}, | ||
}, | ||
}), | ||
data: { updateWorkspace: true }, | ||
}, | ||
{ | ||
key: templateByNameKey( | ||
MockWorkspace.organization_id, | ||
MockWorkspace.template_name, | ||
), | ||
data: MockTemplate, | ||
}, | ||
], | ||
}, | ||
decorators: [ | ||
(Story, { parameters }) => { | ||
const workspace = parameters.workspace || MockWorkspace; | ||
return ( | ||
<AuthProvider> | ||
<WorkspaceSettingsContext.Provider value={workspace}> | ||
<Story /> | ||
</WorkspaceSettingsContext.Provider> | ||
</AuthProvider> | ||
); | ||
}, | ||
], | ||
} satisfies Meta<typeof WorkspaceSchedulePage>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof WorkspaceSchedulePage>; | ||
|
||
export const RegularWorkspace: Story = { | ||
parameters: { | ||
workspace: MockWorkspace, | ||
}, | ||
}; | ||
|
||
export const PrebuiltWorkspace: Story = { | ||
parameters: { | ||
workspace: MockPrebuiltWorkspace, | ||
}, | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest adding a story here to showcase the new behaviour.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in 73f5476