Skip to content

Commit

Permalink
fix: the storageclass form used by select or input (#361)
Browse files Browse the repository at this point in the history
Signed-off-by: liuying <liu.ying@99cloud.net>

Signed-off-by: liuying <liu.ying@99cloud.net>
  • Loading branch information
lysign authored Dec 30, 2022
1 parent 5168ff5 commit d91db4a
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/components/FormRender/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import ArrayString from './widgets/ArrayString';
import ArrayText from './widgets/ArrayText';
import KSPlugins from './widgets/KSPlugins';
import MyCheckBox from './widgets/MyCheckBox';
import SelectInput from './widgets/SelectInput';

/**
* 自定义组件(widget)
Expand All @@ -41,6 +42,7 @@ const widgets = {
// mapping
CustomBoolean,
collapse: Collapses,
'select-input': SelectInput,
};

/**
Expand Down
32 changes: 32 additions & 0 deletions src/components/FormRender/widgets/SelectInput/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright 2021 KubeClipper Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import React from 'react';
import { Select } from 'antd';
import SelectWithInput from 'components/FormItem/SelectWithInput';

const SelectInput = (props) => {
const { schema, ...rest } = props;

const formatValue = (schema.enum || []).map((item, index) => ({
value: item,
index,
}));
return <SelectWithInput options={formatValue} {...rest} />;
};
Select;

export default SelectInput;
2 changes: 1 addition & 1 deletion src/pages/cluster/components/plugin/uiSchemas.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const uiSchemas = [
widget: 'KSPlugins',
},
storageClass: {
widget: 'select',
widget: 'select-input',
},
HostClusterName: {
hidden:
Expand Down

0 comments on commit d91db4a

Please sign in to comment.