Skip to content

Commit 3d98753

Browse files
committed
chore(FR-402): unify the require mark style for form items in the webui (#4360)
resolves #3048 (FR-402) This PR centralizes the `requiredMark="optional"` configuration by moving it from individual Form components to the global ConfigProvider in DefaultProviders. This approach: 1. Adds the form configuration to ConfigProvider in both DefaultProvidersForWebComponent and DefaultProvidersForReactRoot 2. Removes redundant `requiredMark="optional"` props from individual Form components across multiple files 3. Maintains consistent form styling throughout the application **Checklist:** - [ ] Documentation - [ ] Minium required manager version - [ ] Specific setting for review (eg., KB link, endpoint or how to setup) - [ ] Minimum requirements to check during review - [ ] Test case(s) to demonstrate the difference of before/after
1 parent 2954b9f commit 3d98753

17 files changed

+12
-30
lines changed

react/src/components/AutoScalingRuleEditorModal.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,6 @@ const AutoScalingRuleEditorModal: React.FC<AutoScalingRuleEditorModalProps> = ({
251251
<Form
252252
ref={formRef}
253253
layout={'vertical'}
254-
requiredMark={'optional'}
255254
initialValues={
256255
autoScalingRule
257256
? {

react/src/components/Chat/CustomModelForm.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ const CustomModelForm: React.FC<CustomModelFormProps> = ({
5757
ref={formRef}
5858
layout="horizontal"
5959
size="small"
60-
requiredMark="optional"
6160
style={{ flex: 1 }}
6261
key={endpointUrl}
6362
initialValues={{

react/src/components/ContainerRegistryEditorModal.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ const ContainerRegistryEditorModal: React.FC<
202202
<Form
203203
ref={formRef}
204204
layout="vertical"
205-
requiredMark="optional"
206205
initialValues={
207206
containerRegistry
208207
? {

react/src/components/DefaultProviders.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,9 @@ const DefaultProvidersForWebComponent: React.FC<DefaultProvidersProps> = ({
256256
: theme.defaultAlgorithm,
257257
}}
258258
clientPromise={backendaiClientPromise}
259+
form={{
260+
requiredMark: 'optional',
261+
}}
259262
anonymousClientFactory={createAnonymousBackendaiClient}
260263
>
261264
<App {...commonAppProps}>
@@ -356,6 +359,9 @@ export const DefaultProvidersForReactRoot: React.FC<
356359
csp={{ nonce: globalThis.baiNonce }}
357360
clientPromise={backendaiClientPromise}
358361
anonymousClientFactory={createAnonymousBackendaiClient}
362+
form={{
363+
requiredMark: 'optional',
364+
}}
359365
>
360366
<App {...commonAppProps}>
361367
{/* <StyleProvider container={shadowRoot} cache={cache}> */}

react/src/components/FolderCreateModal.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@ const useStyles = createStyles(({ css }) => ({
4949
align-items: start;
5050
padding-left: var(--token-paddingSM);
5151
}
52-
.ant-form-item .ant-form-item-label > label {
53-
flex-direction: row-reverse !important;
54-
gap: var(--token-paddingXS);
55-
}
5652
.ant-form-item-control {
5753
padding-right: var(--token-paddingSM);
5854
}

react/src/components/ImportFromHuggingFaceModal.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -250,12 +250,7 @@ const ImportFromHuggingFaceModal: React.FC<ImportFromHuggingFaceModalProps> = ({
250250
destroyOnClose
251251
{...baiModalProps}
252252
>
253-
<Form
254-
ref={formRef}
255-
preserve={false}
256-
layout="vertical"
257-
requiredMark="optional"
258-
>
253+
<Form ref={formRef} preserve={false} layout="vertical">
259254
<Form.Item label="Hugging Face URL" required>
260255
<Space.Compact style={{ width: '100%' }}>
261256
<Form.Item

react/src/components/ImportNotebook.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const ImportNotebook: React.FC<FormProps> = (props) => {
2323
const webuiNavigate = useWebUINavigate();
2424
useSuspendedBackendaiClient();
2525
return (
26-
<Form ref={formRef} layout="inline" requiredMark="optional" {...props}>
26+
<Form ref={formRef} layout="inline" {...props}>
2727
<Form.Item
2828
name="url"
2929
label={t('import.NotebookURL')}

react/src/components/InviteFolderSettingModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ const InviteFolderSettingModal: React.FC<InviteFolderSettingModalProps> = ({
166166
<Form
167167
ref={inviteFormRef}
168168
initialValues={{ name: undefined, permission: 'ro' }}
169-
requiredMark={false}
170169
>
171170
<Descriptions title={t('data.folders.InviteUsers')}>
172171
<Descriptions.Item>
@@ -202,6 +201,7 @@ const InviteFolderSettingModal: React.FC<InviteFolderSettingModalProps> = ({
202201
name="permission"
203202
label={t('data.Permission')}
204203
style={{ marginBottom: 0 }}
204+
required
205205
>
206206
<Select
207207
options={[

react/src/components/KeypairResourcePolicySettingModal.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,6 @@ const KeypairResourcePolicySettingModal: React.FC<
304304
requiredMark={false}
305305
ref={formRef}
306306
layout="vertical"
307-
// requiredMark="optional"
308307
initialValues={initialValues}
309308
preserve={false}
310309
>

react/src/components/ManageAppsModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,6 @@ const ManageAppsModal: React.FC<ManageAppsModalProps> = ({
205205
layout="vertical"
206206
autoComplete="off"
207207
initialValues={{ apps: servicePorts }}
208-
requiredMark={false}
209208
>
210209
<BAIFlex direction="column">
211210
<Form.List name="apps">
@@ -247,6 +246,7 @@ const ManageAppsModal: React.FC<ManageAppsModalProps> = ({
247246
{...field}
248247
name={[field.name, 'port']}
249248
noStyle
249+
required
250250
rules={[
251251
{
252252
validator: (rules, rawValue) => {

0 commit comments

Comments
 (0)