mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
This reverts commit 9ec16d4454.
This commit is contained in:
@@ -41,7 +41,6 @@ export interface WorkspaceProps {
|
||||
}
|
||||
handleStart: () => void
|
||||
handleStop: () => void
|
||||
handleRestart: () => void
|
||||
handleDelete: () => void
|
||||
handleUpdate: () => void
|
||||
handleCancel: () => void
|
||||
@@ -73,7 +72,6 @@ export const Workspace: FC<React.PropsWithChildren<WorkspaceProps>> = ({
|
||||
scheduleProps,
|
||||
handleStart,
|
||||
handleStop,
|
||||
handleRestart,
|
||||
handleDelete,
|
||||
handleUpdate,
|
||||
handleCancel,
|
||||
@@ -134,7 +132,6 @@ export const Workspace: FC<React.PropsWithChildren<WorkspaceProps>> = ({
|
||||
isOutdated={workspace.outdated}
|
||||
handleStart={handleStart}
|
||||
handleStop={handleStop}
|
||||
handleRestart={handleRestart}
|
||||
handleDelete={handleDelete}
|
||||
handleUpdate={handleUpdate}
|
||||
handleCancel={handleCancel}
|
||||
|
||||
@@ -3,9 +3,8 @@ import BlockIcon from "@material-ui/icons/Block"
|
||||
import CloudQueueIcon from "@material-ui/icons/CloudQueue"
|
||||
import CropSquareIcon from "@material-ui/icons/CropSquare"
|
||||
import PlayCircleOutlineIcon from "@material-ui/icons/PlayCircleOutline"
|
||||
import ReplayIcon from "@material-ui/icons/Replay"
|
||||
import { LoadingButton } from "components/LoadingButton/LoadingButton"
|
||||
import { FC, PropsWithChildren } from "react"
|
||||
import { FC } from "react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { makeStyles } from "@material-ui/core/styles"
|
||||
|
||||
@@ -13,7 +12,7 @@ interface WorkspaceAction {
|
||||
handleAction: () => void
|
||||
}
|
||||
|
||||
export const UpdateButton: FC<PropsWithChildren<WorkspaceAction>> = ({
|
||||
export const UpdateButton: FC<React.PropsWithChildren<WorkspaceAction>> = ({
|
||||
handleAction,
|
||||
}) => {
|
||||
const { t } = useTranslation("workspacePage")
|
||||
@@ -31,7 +30,7 @@ export const UpdateButton: FC<PropsWithChildren<WorkspaceAction>> = ({
|
||||
)
|
||||
}
|
||||
|
||||
export const StartButton: FC<PropsWithChildren<WorkspaceAction>> = ({
|
||||
export const StartButton: FC<React.PropsWithChildren<WorkspaceAction>> = ({
|
||||
handleAction,
|
||||
}) => {
|
||||
const { t } = useTranslation("workspacePage")
|
||||
@@ -49,7 +48,7 @@ export const StartButton: FC<PropsWithChildren<WorkspaceAction>> = ({
|
||||
)
|
||||
}
|
||||
|
||||
export const StopButton: FC<PropsWithChildren<WorkspaceAction>> = ({
|
||||
export const StopButton: FC<React.PropsWithChildren<WorkspaceAction>> = ({
|
||||
handleAction,
|
||||
}) => {
|
||||
const { t } = useTranslation("workspacePage")
|
||||
@@ -67,25 +66,7 @@ export const StopButton: FC<PropsWithChildren<WorkspaceAction>> = ({
|
||||
)
|
||||
}
|
||||
|
||||
export const RestartButton: FC<PropsWithChildren<WorkspaceAction>> = ({
|
||||
handleAction,
|
||||
}) => {
|
||||
const { t } = useTranslation("workspacePage")
|
||||
const styles = useStyles()
|
||||
|
||||
return (
|
||||
<Button
|
||||
variant="outlined"
|
||||
startIcon={<ReplayIcon />}
|
||||
onClick={handleAction}
|
||||
className={styles.fixedWidth}
|
||||
>
|
||||
{t("actionButton.restart")}
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
|
||||
export const CancelButton: FC<PropsWithChildren<WorkspaceAction>> = ({
|
||||
export const CancelButton: FC<React.PropsWithChildren<WorkspaceAction>> = ({
|
||||
handleAction,
|
||||
}) => {
|
||||
return (
|
||||
@@ -99,7 +80,7 @@ interface DisabledProps {
|
||||
label: string
|
||||
}
|
||||
|
||||
export const DisabledButton: FC<PropsWithChildren<DisabledProps>> = ({
|
||||
export const DisabledButton: FC<React.PropsWithChildren<DisabledProps>> = ({
|
||||
label,
|
||||
}) => {
|
||||
return (
|
||||
@@ -113,7 +94,7 @@ interface LoadingProps {
|
||||
label: string
|
||||
}
|
||||
|
||||
export const ActionLoadingButton: FC<PropsWithChildren<LoadingProps>> = ({
|
||||
export const ActionLoadingButton: FC<React.PropsWithChildren<LoadingProps>> = ({
|
||||
label,
|
||||
}) => {
|
||||
const styles = useStyles()
|
||||
|
||||
@@ -15,7 +15,6 @@ const Template: Story<WorkspaceActionsProps> = (args) => (
|
||||
const defaultArgs = {
|
||||
handleStart: action("start"),
|
||||
handleStop: action("stop"),
|
||||
handleRestart: action("restart"),
|
||||
handleDelete: action("delete"),
|
||||
handleUpdate: action("update"),
|
||||
handleCancel: action("cancel"),
|
||||
|
||||
@@ -12,7 +12,6 @@ import {
|
||||
DisabledButton,
|
||||
StartButton,
|
||||
StopButton,
|
||||
RestartButton,
|
||||
UpdateButton,
|
||||
} from "./Buttons"
|
||||
import {
|
||||
@@ -29,7 +28,6 @@ export interface WorkspaceActionsProps {
|
||||
isOutdated: boolean
|
||||
handleStart: () => void
|
||||
handleStop: () => void
|
||||
handleRestart: () => void
|
||||
handleDelete: () => void
|
||||
handleUpdate: () => void
|
||||
handleCancel: () => void
|
||||
@@ -45,7 +43,6 @@ export const WorkspaceActions: FC<WorkspaceActionsProps> = ({
|
||||
isOutdated,
|
||||
handleStart,
|
||||
handleStop,
|
||||
handleRestart,
|
||||
handleDelete,
|
||||
handleUpdate,
|
||||
handleCancel,
|
||||
@@ -94,7 +91,6 @@ export const WorkspaceActions: FC<WorkspaceActionsProps> = ({
|
||||
key={ButtonTypesEnum.stopping}
|
||||
/>
|
||||
),
|
||||
[ButtonTypesEnum.restart]: <RestartButton handleAction={handleRestart} />,
|
||||
[ButtonTypesEnum.deleting]: (
|
||||
<ActionLoadingButton
|
||||
label={t("actionButton.deleting")}
|
||||
|
||||
@@ -7,7 +7,6 @@ export enum ButtonTypesEnum {
|
||||
starting = "starting",
|
||||
stop = "stop",
|
||||
stopping = "stopping",
|
||||
restart = "restart",
|
||||
deleting = "deleting",
|
||||
update = "update",
|
||||
updating = "updating",
|
||||
@@ -40,7 +39,7 @@ const statusToActions: Record<WorkspaceStatus, WorkspaceAbilities> = {
|
||||
canAcceptJobs: false,
|
||||
},
|
||||
running: {
|
||||
actions: [ButtonTypesEnum.stop, ButtonTypesEnum.restart],
|
||||
actions: [ButtonTypesEnum.stop],
|
||||
canCancel: false,
|
||||
canAcceptJobs: true,
|
||||
},
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
"actionButton": {
|
||||
"start": "Start",
|
||||
"stop": "Stop",
|
||||
"restart": "Restart",
|
||||
"delete": "Delete",
|
||||
"cancel": "Cancel",
|
||||
"update": "Update",
|
||||
|
||||
@@ -123,7 +123,6 @@ export const WorkspaceReadyPage = ({
|
||||
workspace={workspace}
|
||||
handleStart={() => workspaceSend({ type: "START" })}
|
||||
handleStop={() => workspaceSend({ type: "STOP" })}
|
||||
handleRestart={() => workspaceSend({ type: "START" })}
|
||||
handleDelete={() => workspaceSend({ type: "ASK_DELETE" })}
|
||||
handleUpdate={() => workspaceSend({ type: "UPDATE" })}
|
||||
handleCancel={() => workspaceSend({ type: "CANCEL" })}
|
||||
|
||||
Reference in New Issue
Block a user