Skip to content

refactor(site): Refactor workspace actions #7124

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 8 commits into from
Apr 14, 2023
Merged
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
Fix keys
  • Loading branch information
BrunoQuaresma committed Apr 14, 2023
commit 27d2d240a1bd0babbd4dce190f71a62098307eba
47 changes: 37 additions & 10 deletions site/src/components/WorkspaceActions/WorkspaceActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,29 +64,56 @@ export const WorkspaceActions: FC<WorkspaceActionsProps> = ({

// A mapping of button type to the corresponding React component
const buttonMapping: ButtonMapping = {
[ButtonTypesEnum.update]: <UpdateButton handleAction={handleUpdate} />,
[ButtonTypesEnum.update]: (
<UpdateButton handleAction={handleUpdate} key={ButtonTypesEnum.update} />
),
[ButtonTypesEnum.updating]: (
<ActionLoadingButton label={t("actionButton.updating")} />
<ActionLoadingButton
label={t("actionButton.updating")}
key={ButtonTypesEnum.updating}
/>
),
[ButtonTypesEnum.start]: (
<StartButton handleAction={handleStart} key={ButtonTypesEnum.start} />
),
[ButtonTypesEnum.start]: <StartButton handleAction={handleStart} />,
[ButtonTypesEnum.starting]: (
<ActionLoadingButton label={t("actionButton.starting")} />
<ActionLoadingButton
label={t("actionButton.starting")}
key={ButtonTypesEnum.starting}
/>
),
[ButtonTypesEnum.stop]: (
<StopButton handleAction={handleStop} key={ButtonTypesEnum.stop} />
),
[ButtonTypesEnum.stop]: <StopButton handleAction={handleStop} />,
[ButtonTypesEnum.stopping]: (
<ActionLoadingButton label={t("actionButton.stopping")} />
<ActionLoadingButton
label={t("actionButton.stopping")}
key={ButtonTypesEnum.stopping}
/>
),
[ButtonTypesEnum.deleting]: (
<ActionLoadingButton label={t("actionButton.deleting")} />
<ActionLoadingButton
label={t("actionButton.deleting")}
key={ButtonTypesEnum.deleting}
/>
),
[ButtonTypesEnum.canceling]: (
<DisabledButton label={t("disabledButton.canceling")} />
<DisabledButton
label={t("disabledButton.canceling")}
key={ButtonTypesEnum.canceling}
/>
),
[ButtonTypesEnum.deleted]: (
<DisabledButton label={t("disabledButton.deleted")} />
<DisabledButton
label={t("disabledButton.deleted")}
key={ButtonTypesEnum.deleted}
/>
),
[ButtonTypesEnum.pending]: (
<ActionLoadingButton label={t("disabledButton.pending")} />
<ActionLoadingButton
label={t("disabledButton.pending")}
key={ButtonTypesEnum.pending}
/>
),
}

Expand Down