- Notifications
You must be signed in to change notification settings - Fork928
feat: show deleted workspace after delete action#2208
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
8 commits Select commitHold shift + click to select a range
b78f0b5
added deleted workspace banner
Kira-Pilot2e26ef4
merged in main
Kira-Pilot2931b60
x state pass
Kira-Pilot62b17d7
Merge remote-tracking branch 'origin/main' into show-deleted-workspac…
Kira-Pilote48cc71
added include_deleted param
Kira-Pilotaa0101e
clean up x state
Kira-Pilotda40d49
added teests
Kira-Pilotb4391e3
cleaning up unneeded xstate service
Kira-PilotFile 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
12 changes: 9 additions & 3 deletionssite/src/api/api.ts
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
9 changes: 8 additions & 1 deletionsite/src/components/Workspace/Workspace.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
28 changes: 28 additions & 0 deletionssite/src/components/WorkspaceDeletedBanner/WorkspaceDeletedBanner.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,28 @@ | ||
import { action } from "@storybook/addon-actions" | ||
import { Story } from "@storybook/react" | ||
import * as Mocks from "../../testHelpers/entities" | ||
import { WorkspaceDeletedBanner, WorkspaceDeletedBannerProps } from "./WorkspaceDeletedBanner" | ||
export default { | ||
title: "components/WorkspaceDeletedBanner", | ||
component: WorkspaceDeletedBanner, | ||
} | ||
const Template: Story<WorkspaceDeletedBannerProps> = (args) => <WorkspaceDeletedBanner {...args} /> | ||
export const Example = Template.bind({}) | ||
Example.args = { | ||
handleClick: action("extend"), | ||
workspace: { | ||
...Mocks.MockWorkspace, | ||
latest_build: { | ||
...Mocks.MockWorkspaceBuild, | ||
job: { | ||
...Mocks.MockProvisionerJob, | ||
status: "succeeded", | ||
}, | ||
transition: "delete", | ||
}, | ||
}, | ||
} |
50 changes: 50 additions & 0 deletionssite/src/components/WorkspaceDeletedBanner/WorkspaceDeletedBanner.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,50 @@ | ||
import Button from "@material-ui/core/Button" | ||
import { makeStyles } from "@material-ui/core/styles" | ||
import Alert from "@material-ui/lab/Alert" | ||
import AlertTitle from "@material-ui/lab/AlertTitle" | ||
import { FC } from "react" | ||
import * as TypesGen from "../../api/typesGenerated" | ||
import { isWorkspaceDeleted } from "../../util/workspace" | ||
const Language = { | ||
bannerTitle: "This workspace has been deleted and cannot be edited.", | ||
createWorkspaceCta: "Create new workspace", | ||
} | ||
export interface WorkspaceDeletedBannerProps { | ||
workspace: TypesGen.Workspace | ||
handleClick: () => void | ||
} | ||
export const WorkspaceDeletedBanner: FC<WorkspaceDeletedBannerProps> = ({ workspace, handleClick }) => { | ||
const styles = useStyles() | ||
if (!isWorkspaceDeleted(workspace)) { | ||
return null | ||
} | ||
return ( | ||
<Alert | ||
className={styles.root} | ||
action={ | ||
<Button color="inherit" onClick={handleClick} size="small"> | ||
{Language.createWorkspaceCta} | ||
</Button> | ||
} | ||
severity="warning" | ||
> | ||
<AlertTitle>{Language.bannerTitle}</AlertTitle> | ||
</Alert> | ||
) | ||
} | ||
export const useStyles = makeStyles(() => { | ||
return { | ||
root: { | ||
alignItems: "center", | ||
"& .MuiAlertTitle-root": { | ||
marginBottom: "0px", | ||
}, | ||
}, | ||
} | ||
}) |
2 changes: 1 addition & 1 deletionsite/src/components/WorkspaceScheduleBanner/WorkspaceScheduleBanner.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/WorkspacePage/WorkspacePage.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
40 changes: 39 additions & 1 deletionsite/src/util/workspace.test.ts
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: 4 additions & 0 deletionssite/src/util/workspace.ts
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
6 changes: 4 additions & 2 deletionssite/src/xServices/workspace/workspaceXService.ts
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
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.