- Notifications
You must be signed in to change notification settings - Fork921
feat: batch workspace updates#11583
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
14 commits Select commitHold shift + click to select a range
07cdbc4
feat: batch workspace updates
aslilac763f967
Merge branch 'main' into batch-update
aslilac3273e75
🧪
aslilac90c8a07
Merge branch 'main' into batch-update
aslilac4400e70
🧼
aslilac908a46c
fix icons and small things
aslilac354d3fc
🧹
aslilac8ce568d
:|
aslilaca5307cb
🌭
aslilaca400d93
🧪
aslilac73c2f9b
later
aslilac9549b12
later
aslilac4a9ebb2
🧼
aslilac53d75ba
fix new story
aslilacFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
2 changes: 1 addition & 1 deletionsite/src/components/Dialogs/ConfirmDialog/ConfirmDialog.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
4 changes: 2 additions & 2 deletionssite/src/components/Dialogs/Dialog.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
8 changes: 6 additions & 2 deletionssite/src/components/WorkspaceOutdatedTooltip/WorkspaceOutdatedTooltip.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
4 changes: 1 addition & 3 deletionssite/src/pages/UserSettingsPage/TokensPage/ConfirmDeleteDialog.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 |
---|---|---|
@@ -32,8 +32,6 @@ export const DeleteDialog: Story = { | ||
args: { | ||
queryKey: ["tokens"], | ||
token: MockToken, | ||
setToken: () => null, | ||
}, | ||
}; |
6 changes: 3 additions & 3 deletionssite/src/pages/WorkspacePage/WorkspaceReadyPage.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
8 changes: 5 additions & 3 deletions...es/WorkspacesPage/BatchDelete.stories.tsx → ...sPage/BatchDeleteConfirmation.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
74 changes: 15 additions & 59 deletions...src/pages/WorkspacesPage/BatchActions.tsx → ...orkspacesPage/BatchDeleteConfirmation.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
75 changes: 75 additions & 0 deletionssite/src/pages/WorkspacesPage/BatchUpdateConfirmation.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,75 @@ | ||
import { action } from "@storybook/addon-actions"; | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
import { useQueryClient } from "react-query"; | ||
import { chromatic } from "testHelpers/chromatic"; | ||
import { | ||
MockWorkspace, | ||
MockRunningOutdatedWorkspace, | ||
MockDormantOutdatedWorkspace, | ||
MockOutdatedWorkspace, | ||
MockTemplateVersion, | ||
MockUser2, | ||
} from "testHelpers/entities"; | ||
import { | ||
BatchUpdateConfirmation, | ||
type Update, | ||
} from "./BatchUpdateConfirmation"; | ||
const workspaces = [ | ||
{ ...MockRunningOutdatedWorkspace, id: "1" }, | ||
{ ...MockDormantOutdatedWorkspace, id: "2" }, | ||
{ ...MockOutdatedWorkspace, id: "3" }, | ||
{ ...MockOutdatedWorkspace, id: "4" }, | ||
{ ...MockWorkspace, id: "5" }, | ||
{ | ||
...MockRunningOutdatedWorkspace, | ||
id: "6", | ||
owner_id: MockUser2.id, | ||
owner_name: MockUser2.username, | ||
}, | ||
]; | ||
const updates = new Map<string, Update>(); | ||
for (const it of workspaces) { | ||
const versionId = it.template_active_version_id; | ||
const version = updates.get(versionId); | ||
if (version) { | ||
version.affected_workspaces.push(it); | ||
continue; | ||
} | ||
updates.set(versionId, { | ||
...MockTemplateVersion, | ||
template_display_name: it.template_display_name, | ||
affected_workspaces: [it], | ||
}); | ||
} | ||
const meta: Meta<typeof BatchUpdateConfirmation> = { | ||
title: "pages/WorkspacesPage/BatchUpdateConfirmation", | ||
parameters: { chromatic }, | ||
component: BatchUpdateConfirmation, | ||
decorators: [ | ||
(Story) => { | ||
const queryClient = useQueryClient(); | ||
for (const [id, it] of updates) { | ||
queryClient.setQueryData(["batchUpdate", id], it); | ||
} | ||
return <Story />; | ||
}, | ||
], | ||
args: { | ||
onClose: action("onClose"), | ||
onConfirm: action("onConfirm"), | ||
open: true, | ||
checkedWorkspaces: workspaces, | ||
}, | ||
}; | ||
export default meta; | ||
type Story = StoryObj<typeof BatchUpdateConfirmation>; | ||
const Example: Story = {}; | ||
export { Example as BatchUpdateConfirmation }; |
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
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.