From 4c4a51bd13d3cb5e6cb23b5b7634ea692c81af02 Mon Sep 17 00:00:00 2001 From: Zhaoxinxin <107842350+Liam-Zhao@users.noreply.github.com> Date: Fri, 15 Sep 2023 16:33:18 +0800 Subject: [PATCH] fix: change form ui (#292) --- src/components/clusters/edit.module.css | 4 - src/components/clusters/edit.tsx | 254 ++++++++++++++--------- src/components/clusters/new.module.css | 4 - src/components/clusters/new.tsx | 249 ++++++++++++++-------- src/components/developer/tokens/edit.tsx | 3 +- src/components/developer/tokens/new.tsx | 3 +- 6 files changed, 320 insertions(+), 197 deletions(-) diff --git a/src/components/clusters/edit.module.css b/src/components/clusters/edit.module.css index 500a590b..9c4086e8 100644 --- a/src/components/clusters/edit.module.css +++ b/src/components/clusters/edit.module.css @@ -32,10 +32,6 @@ flex-wrap: wrap; } -.footerButton { - margin-top: 2rem; -} - .textField { width: 18rem; max-width: 25rem; diff --git a/src/components/clusters/edit.tsx b/src/components/clusters/edit.tsx index 666e8143..845bfcd9 100644 --- a/src/components/clusters/edit.tsx +++ b/src/components/clusters/edit.tsx @@ -556,7 +556,7 @@ export default function EditCluster() { Update Cluster - + @@ -568,107 +568,171 @@ export default function EditCluster() { - - - - Information - - - - - - - { - setCluster({ ...cluster, is_default: event.target.checked }); - }} - sx={{ '&.MuiCheckbox-root': { color: 'var(--button-color)' } }} - /> - } - label="Set cluster as your default cluster" - name="IsDefault" - sx={{ '&.MuiFormControlLabel-root': { mr: '0.6rem' } }} - /> - - - - - {informationForm.map((item) => ( - - ))} - - - scopes - - - - - - - {scopesForm.map((item) => { - return ( - - {item.label === 'CIDRs' ? ( - } - /> - ) : item.label === 'IDC' ? ( - } - /> - ) : ( - - )} - - ); - })} - - - - Config - - - - - - - {configForm.map((item) => ( + + + + + Information + + + + + + + { + setCluster({ ...cluster, is_default: event.target.checked }); + }} + sx={{ '&.MuiCheckbox-root': { color: 'var(--button-color)' } }} + /> + } + label="Set cluster as your default cluster" + name="IsDefault" + sx={{ '&.MuiFormControlLabel-root': { mr: '0.6rem' } }} + /> + + + + + {informationForm.map((item) => ( ))} - - + + + scopes + + + + + + + {scopesForm.map((item) => { + return ( + + {item.label === 'CIDRs' ? ( + ( + + {params.InputProps.endAdornment} + + + + + ), + }} + color="success" + {...item.formProps} + /> + )} + /> + ) : item.label === 'IDC' ? ( + ( + + {params.InputProps.endAdornment} + + + + + ), + }} + color="success" + {...item.formProps} + /> + )} + /> + ) : ( + + )} + + ); + })} + + + + Config + + + + + + + {configForm.map((item) => ( + + ))} + + + + } diff --git a/src/components/clusters/new.module.css b/src/components/clusters/new.module.css index 784c81d0..a1066b4a 100644 --- a/src/components/clusters/new.module.css +++ b/src/components/clusters/new.module.css @@ -32,10 +32,6 @@ flex-wrap: wrap; } -.footerButton { - margin-top: 2rem; -} - .textField { width: 18rem; max-width: 25rem; diff --git a/src/components/clusters/new.tsx b/src/components/clusters/new.tsx index 55fcc25b..bc3cc53a 100644 --- a/src/components/clusters/new.tsx +++ b/src/components/clusters/new.tsx @@ -47,6 +47,7 @@ export default function NewCluster() { id: 'name', label: 'Name', name: 'name', + required: true, autoComplete: 'family-name', placeholder: 'Enter your name', helperText: nameError ? 'Fill in the characters, the length is 1-40.' : '', @@ -520,101 +521,165 @@ export default function NewCluster() { Create Cluster - - - - Information - - - - - - - } - label="Set cluster as your default cluster" - name="isDefault" - sx={{ '&.MuiFormControlLabel-root': { mr: '0.6rem' } }} - /> - - - - - - {informationForm.map((item) => ( - + + + + Information + + + + + + + } + label="Set cluster as your default cluster" + name="isDefault" + sx={{ '&.MuiFormControlLabel-root': { mr: '0.6rem' } }} /> - ))} - - - - Scopes - - + + + + + {informationForm.map((item) => ( + + ))} + + + + Scopes + + - - - - - {scopesForm.map((item) => { - return ( - - {item.label === 'CIDRs' ? ( - } - /> - ) : item.label === 'IDC' ? ( - } - /> - ) : ( - - )} - - ); - })} - - - - Config - - - - + placement="top" + > + + + + + {scopesForm.map((item) => { + return ( + + {item.label === 'CIDRs' ? ( + ( + + {params.InputProps.endAdornment} + + + + + ), + }} + color="success" + {...item.formProps} + /> + )} + /> + ) : item.label === 'IDC' ? ( + ( + + {params.InputProps.endAdornment} + + + + + ), + }} + color="success" + {...item.formProps} + /> + )} + /> + ) : ( + + )} + + ); + })} + + + + Config + + + + + + + {configForm.map((item) => ( + + ))} + - - {configForm.map((item) => ( - - ))} - - + + } diff --git a/src/components/developer/tokens/edit.tsx b/src/components/developer/tokens/edit.tsx index e4b78695..b5f5326a 100644 --- a/src/components/developer/tokens/edit.tsx +++ b/src/components/developer/tokens/edit.tsx @@ -356,7 +356,8 @@ export default function UpdateTokens() { - + + } diff --git a/src/components/developer/tokens/new.tsx b/src/components/developer/tokens/new.tsx index 270db585..d837fcc0 100644 --- a/src/components/developer/tokens/new.tsx +++ b/src/components/developer/tokens/new.tsx @@ -352,7 +352,8 @@ export default function CreateTokens() { - + + }