Skip to content

fix: make workspace buttons less confusing when errors happen #10609

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

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: clean up types
  • Loading branch information
Parkreiner committed Nov 8, 2023
commit a4266e35d1cae5c4d87bee33690748bb3407f735
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,7 @@ export const WorkspaceActions: FC<WorkspaceActionsProps> = ({
activating: <ActivateButton loading handleAction={handleDormantActivate} />,
};

const {
canCancel,
canAcceptJobs,
actions: actionsByStatus,
} = actionsByWorkspaceStatus(
const { actions, canCancel, canAcceptJobs } = actionsByWorkspaceStatus(
workspace,
workspace.latest_build.status,
canChangeVersions,
Expand All @@ -111,7 +107,7 @@ export const WorkspaceActions: FC<WorkspaceActionsProps> = ({

{isRestarting
? buttonMapping.restarting
: actionsByStatus.map((action) => (
: actions.map((action) => (
<Fragment key={action}>{buttonMapping[action]}</Fragment>
))}

Expand Down
2 changes: 1 addition & 1 deletion site/src/pages/WorkspacePage/WorkspaceActions/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const buttonTypes = [
export type ButtonType = (typeof buttonTypes)[number];

interface WorkspaceAbilities {
actions: ButtonType[];
actions: readonly ButtonType[];
canCancel: boolean;
canAcceptJobs: boolean;
}
Expand Down