From 2a4fe403e9e11400fb1c99aefdf0a8cb1c5ecb02 Mon Sep 17 00:00:00 2001 From: Jenny <32821331+jenny-s51@users.noreply.github.com> Date: Mon, 10 Nov 2025 15:09:41 -0500 Subject: [PATCH] fix: cancel button variant and expandable spacing Signed-off-by: Jenny <32821331+jenny-s51@users.noreply.github.com> --- workspaces/frontend/src/app/App.tsx | 1 + .../WorkspaceKinds/Form/WorkspaceKindForm.tsx | 62 +++-- .../fileUpload/WorkspaceKindFileUpload.tsx | 2 +- .../Form/image/WorkspaceKindFormImage.tsx | 114 ++++---- .../podConfig/WorkspaceKindFormPodConfig.tsx | 124 +++++---- .../WorkspaceKindFormPodTemplate.tsx | 246 +++++++++--------- .../WorkspaceKindFormProperties.tsx | 172 ++++++------ .../pages/Workspaces/Form/WorkspaceForm.tsx | 2 +- 8 files changed, 361 insertions(+), 362 deletions(-) diff --git a/workspaces/frontend/src/app/App.tsx b/workspaces/frontend/src/app/App.tsx index 101f4b69..dcedc642 100644 --- a/workspaces/frontend/src/app/App.tsx +++ b/workspaces/frontend/src/app/App.tsx @@ -27,6 +27,7 @@ const App: React.FC = () => { { )} {mode === 'edit' && ( - <> - setData('properties', properties)} - /> - { - setData('imageConfig', imageInput); - }} - /> - { - setData('podConfig', podConfig); - }} - /> - { - setData('podTemplate', podTemplate); - }} - /> - + + + setData('properties', properties)} + /> + + + { + setData('imageConfig', imageInput); + }} + /> + + + { + setData('podConfig', podConfig); + }} + /> + + + { + setData('podTemplate', podTemplate); + }} + /> + + )} @@ -226,7 +234,7 @@ export const WorkspaceKindForm: React.FC = () => { - diff --git a/workspaces/frontend/src/app/pages/WorkspaceKinds/Form/fileUpload/WorkspaceKindFileUpload.tsx b/workspaces/frontend/src/app/pages/WorkspaceKinds/Form/fileUpload/WorkspaceKindFileUpload.tsx index bd0b5d1d..b4c534b9 100644 --- a/workspaces/frontend/src/app/pages/WorkspaceKinds/Form/fileUpload/WorkspaceKindFileUpload.tsx +++ b/workspaces/frontend/src/app/pages/WorkspaceKinds/Form/fileUpload/WorkspaceKindFileUpload.tsx @@ -86,7 +86,7 @@ export const WorkspaceKindFileUpload: React.FC = ( }, []); return ( - + = ({ return ( -
- setIsExpanded((prev) => !prev)} - isExpanded={isExpanded} - isIndented + setIsExpanded((prev) => !prev)} + isExpanded={isExpanded} + isIndented + > + {imageConfig.values.length === 0 && ( + + Add an image configuration to your Workspace Kind + + {addImageBtn} + + + )} + {imageConfig.values.length > 0 && ( +
+ { + updateImageConfig({ ...imageConfig, default: id }); + setDefaultId(id); + }} + handleEdit={handleEdit} + openDeleteModal={openDeleteModal} + /> + {addImageBtn} +
+ )} + + setIsDeleteModalOpen(false)} + variant={ModalVariant.small} > - {imageConfig.values.length === 0 && ( - - Add an image configuration to your Workspace Kind - - {addImageBtn} - - - )} - {imageConfig.values.length > 0 && ( -
- { - updateImageConfig({ ...imageConfig, default: id }); - setDefaultId(id); - }} - handleEdit={handleEdit} - openDeleteModal={openDeleteModal} - /> - {addImageBtn} -
- )} - - setIsDeleteModalOpen(false)} - variant={ModalVariant.small} - > - - - - - - -
-
+ + + + + +
); }; diff --git a/workspaces/frontend/src/app/pages/WorkspaceKinds/Form/podConfig/WorkspaceKindFormPodConfig.tsx b/workspaces/frontend/src/app/pages/WorkspaceKinds/Form/podConfig/WorkspaceKindFormPodConfig.tsx index 8e70a3d9..1f880b80 100644 --- a/workspaces/frontend/src/app/pages/WorkspaceKinds/Form/podConfig/WorkspaceKindFormPodConfig.tsx +++ b/workspaces/frontend/src/app/pages/WorkspaceKinds/Form/podConfig/WorkspaceKindFormPodConfig.tsx @@ -101,71 +101,69 @@ export const WorkspaceKindFormPodConfig: React.FC -
- setIsExpanded((prev) => !prev)} - isExpanded={isExpanded} - isIndented - > - {podConfig.values.length === 0 && ( - - - Configure specifications for pods and containers in your Workspace Kind - - - {addConfigBtn} - - - )} - {podConfig.values.length > 0 && ( - <> - { - updatePodConfig({ ...podConfig, default: id }); - setDefaultId(id); - }} - handleEdit={handleEdit} - openDeleteModal={openDeleteModal} - /> - {addConfigBtn} - - )} - - setIsDeleteModalOpen(false)} - variant={ModalVariant.small} + setIsExpanded((prev) => !prev)} + isExpanded={isExpanded} + isIndented + > + {podConfig.values.length === 0 && ( + - + Configure specifications for pods and containers in your Workspace Kind + + + {addConfigBtn} + + + )} + {podConfig.values.length > 0 && ( + <> + { + updatePodConfig({ ...podConfig, default: id }); + setDefaultId(id); + }} + handleEdit={handleEdit} + openDeleteModal={openDeleteModal} /> - - - - - - -
+ {addConfigBtn} + + )} + + setIsDeleteModalOpen(false)} + variant={ModalVariant.small} + > + + + + + + +
); }; diff --git a/workspaces/frontend/src/app/pages/WorkspaceKinds/Form/podTemplate/WorkspaceKindFormPodTemplate.tsx b/workspaces/frontend/src/app/pages/WorkspaceKinds/Form/podTemplate/WorkspaceKindFormPodTemplate.tsx index 7246a881..0055b477 100644 --- a/workspaces/frontend/src/app/pages/WorkspaceKinds/Form/podTemplate/WorkspaceKindFormPodTemplate.tsx +++ b/workspaces/frontend/src/app/pages/WorkspaceKinds/Form/podTemplate/WorkspaceKindFormPodTemplate.tsx @@ -53,144 +53,142 @@ export const WorkspaceKindFormPodTemplate: React.FC - setIsExpanded((prev) => !prev)} - isExpanded={isExpanded} - isIndented - > -
+ setIsExpanded((prev) => !prev)} + isExpanded={isExpanded} + isIndented + > + + + Edit mutable metadata of all pods created with this Workspace Kind. + + } + /> + } + > + ({ + key: entry[0], + value: entry[1], + }))} + setRows={(newLabels) => { + updatePodTemplate({ + ...podTemplate, + podMetadata: { + ...podTemplate.podMetadata, + labels: newLabels.reduce((acc: { [k: string]: string }, { key, value }) => { + acc[key] = value; + return acc; + }, {}), + }, + }); + }} + /> + ({ + key: entry[0], + value: entry[1], + }))} + setRows={(newAnnotations) => { + updatePodTemplate({ + ...podTemplate, + podMetadata: { + ...podTemplate.podMetadata, + annotations: newAnnotations.reduce( + (acc: { [k: string]: string }, { key, value }) => { + acc[key] = value; + return acc; + }, + {}, + ), + }, + }); + }} + /> + + {/* podTemplate.culling is currently not developed in the backend */} + {podTemplate.culling && ( - Edit mutable metadata of all pods created with this Workspace Kind. + + Warning: Only for JupyterLab deployments + + Culling scales the number of pods in a Workspace to zero based on its last + activity by polling Jupyter's status endpoint. } /> } > - ({ - key: entry[0], - value: entry[1], - }))} - setRows={(newLabels) => { - updatePodTemplate({ - ...podTemplate, - podMetadata: { - ...podTemplate.podMetadata, - labels: newLabels.reduce((acc: { [k: string]: string }, { key, value }) => { - acc[key] = value; - return acc; - }, {}), - }, - }); - }} - /> - ({ - key: entry[0], - value: entry[1], - }))} - setRows={(newAnnotations) => { - updatePodTemplate({ - ...podTemplate, - podMetadata: { - ...podTemplate.podMetadata, - annotations: newAnnotations.reduce( - (acc: { [k: string]: string }, { key, value }) => { - acc[key] = value; - return acc; - }, - {}, - ), - }, - }); - }} - /> - - {/* podTemplate.culling is currently not developed in the backend */} - {podTemplate.culling && ( - - - Warning: Only for JupyterLab deployments - - Culling scales the number of pods in a Workspace to zero based on its last - activity by polling Jupyter's status endpoint. - - } - /> - } - > - - toggleCullingEnabled(checked)} - id="workspace-kind-pod-template-culling-enabled" - name="culling-enabled" - /> - - - - podTemplate.culling && - updatePodTemplate({ - ...podTemplate, - culling: { - ...podTemplate.culling, - maxInactiveSeconds: Number(value), - }, - }) - } - step={1} - aria-label="max inactive period input" - isDisabled={!podTemplate.culling.enabled} - /> - - - )} - Configure the paths to mount additional PVCs. + + toggleCullingEnabled(checked)} + id="workspace-kind-pod-template-culling-enabled" + name="culling-enabled" + /> + + + + podTemplate.culling && + updatePodTemplate({ + ...podTemplate, + culling: { + ...podTemplate.culling, + maxInactiveSeconds: Number(value), + }, + }) } + step={1} + aria-label="max inactive period input" + isDisabled={!podTemplate.culling.enabled} /> - } - > - + - -
- + )} + Configure the paths to mount additional PVCs. + } + /> + } + > + + + +
); }; diff --git a/workspaces/frontend/src/app/pages/WorkspaceKinds/Form/properties/WorkspaceKindFormProperties.tsx b/workspaces/frontend/src/app/pages/WorkspaceKinds/Form/properties/WorkspaceKindFormProperties.tsx index 4aafe35e..4b5b13a1 100644 --- a/workspaces/frontend/src/app/pages/WorkspaceKinds/Form/properties/WorkspaceKindFormProperties.tsx +++ b/workspaces/frontend/src/app/pages/WorkspaceKinds/Form/properties/WorkspaceKindFormProperties.tsx @@ -21,108 +21,104 @@ export const WorkspaceKindFormProperties: React.FC -
- setIsExpanded((prev) => !prev)} - isExpanded={isExpanded} - isIndented - > -
- - updateField({ ...properties, displayName: value })} - id="workspace-kind-name" - /> - - - updateField({ ...properties, description: value })} - id="workspace-kind-description" - /> - - {mode === 'edit' && ( - - -
Deprecated
- - Flag this workspace kind as deprecated and optionally set a deprecation - message - -
- } - onChange={() => - updateField({ ...properties, deprecated: !properties.deprecated }) - } - id="workspace-kind-deprecated" - name="workspace-kind-deprecated-switch" - /> - - )} - {mode === 'edit' && properties.deprecated && ( - - updateField({ ...properties, deprecationMessage: value })} - id="workspace-kind-deprecated-msg" - /> - - )} + setIsExpanded((prev) => !prev)} + isExpanded={isExpanded} + isIndented + > + + + updateField({ ...properties, displayName: value })} + id="workspace-kind-name" + /> + + + updateField({ ...properties, description: value })} + id="workspace-kind-description" + /> + + {mode === 'edit' && ( updateField({ ...properties, hidden: !properties.hidden })} - id="workspace-kind-hidden" - name="workspace-kind-hidden-switch" - aria-label="workspace-kind-hidden" + aria-label="workspace-kind-deprecated" + isChecked={properties.deprecated} label={
-
Hidden
- Hide this workspace kind from users +
Deprecated
+ + Flag this workspace kind as deprecated and optionally set a deprecation + message +
} + onChange={() => updateField({ ...properties, deprecated: !properties.deprecated })} + id="workspace-kind-deprecated" + name="workspace-kind-deprecated-switch" />
- - updateField({ ...properties, icon: { url: value } })} - id="workspace-kind-icon" - /> - - + )} + {mode === 'edit' && properties.deprecated && ( + updateField({ ...properties, logo: { url: value } })} - id="workspace-kind-logo" + label="Deprecation message" + value={properties.deprecationMessage} + placeholder="Deprecation message" + onChange={(_, value) => updateField({ ...properties, deprecationMessage: value })} + id="workspace-kind-deprecated-msg" /> - -
- + )} + + updateField({ ...properties, hidden: !properties.hidden })} + id="workspace-kind-hidden" + name="workspace-kind-hidden-switch" + aria-label="workspace-kind-hidden" + label={ +
+
Hidden
+ Hide this workspace kind from users +
+ } + /> +
+ + updateField({ ...properties, icon: { url: value } })} + id="workspace-kind-icon" + /> + + + updateField({ ...properties, logo: { url: value } })} + id="workspace-kind-logo" + /> + + +
); }; diff --git a/workspaces/frontend/src/app/pages/Workspaces/Form/WorkspaceForm.tsx b/workspaces/frontend/src/app/pages/Workspaces/Form/WorkspaceForm.tsx index 3219c3d8..7e279e5c 100644 --- a/workspaces/frontend/src/app/pages/Workspaces/Form/WorkspaceForm.tsx +++ b/workspaces/frontend/src/app/pages/Workspaces/Form/WorkspaceForm.tsx @@ -410,7 +410,7 @@ const WorkspaceForm: React.FC = () => { )} -