-
Notifications
You must be signed in to change notification settings - Fork 894
feat: add extra workspace actions in the workspaces table #17775
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
Merged
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
496473f
Refactor base menu component
BrunoQuaresma 22759e3
Refactor change workspace version
BrunoQuaresma 2f3cce0
Refactor delete workspace
BrunoQuaresma f7e9ba9
Refactor duplicate and clean up code
BrunoQuaresma a3c4908
Move components and fix build errors
BrunoQuaresma d5ae7e1
Minor visual fixes
BrunoQuaresma 0c65d4f
Fix debug check
BrunoQuaresma 3b5f20b
Add more actions to workspaces row
BrunoQuaresma 207094a
Minor fixes
BrunoQuaresma c79952b
Run FMT
BrunoQuaresma be967dd
Fix lint and tests
BrunoQuaresma 139548c
Fix stories
BrunoQuaresma 84b65a8
Apply PR reviews
BrunoQuaresma 96a6ffd
Merge branch 'main' of https://github.com/coder/coder into bq/more-ac…
BrunoQuaresma 62413e0
Fix stories
BrunoQuaresma 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
Fix debug check
- Loading branch information
commit 0c65d4f1c5df4f8272f61d1163d75caa4e9af6a7
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,8 @@ import { DebugButton } from "./DebugButton"; | |
import { RetryButton } from "./RetryButton"; | ||
import { WorkspaceMoreActions } from "modules/workspaces/WorkspaceMoreActions/WorkspaceMoreActions"; | ||
import type { WorkspacePermissions } from "modules/workspaces/permissions"; | ||
import { useQuery } from "react-query"; | ||
import { deploymentConfig } from "api/queries/deployment"; | ||
|
||
export interface WorkspaceActionsProps { | ||
workspace: Workspace; | ||
|
@@ -55,11 +57,16 @@ export const WorkspaceActions: FC<WorkspaceActionsProps> = ({ | |
handleDormantActivate, | ||
}) => { | ||
const { user } = useAuthenticated(); | ||
const isOwner = | ||
user.roles.find((role) => role.name === "owner") !== undefined; | ||
const { data: deployment } = useQuery({ | ||
...deploymentConfig(), | ||
enabled: permissions.deploymentConfig, | ||
}); | ||
const { actions, canCancel, canAcceptJobs } = abilitiesByWorkspaceStatus( | ||
workspace, | ||
{ canDebug: permissions.deploymentConfig, isOwner }, | ||
{ | ||
canDebug: !!deployment?.config.enable_terraform_debug_mode, | ||
isOwner: !!user.roles.find((role) => role.name === "owner"), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can be changed to |
||
}, | ||
); | ||
|
||
const mustUpdate = mustUpdateWorkspace( | ||
|
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.
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.
Just making sure: are we guaranteed that the config won't ever change after the initial request from the server? I know we already disable a lot of the RQ background refetch functionality, so I'm wondering if there's any harm in letting the data be marked as stale, since I'd think the data would still be refetched relatively infrequently
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.
Yeap! To change these deployment configs even coderd would need to be restarted 😄