Skip to content

Commit

Permalink
fix(): 上传支持自定义配置 (#684)
Browse files Browse the repository at this point in the history
refs: CMDB_INSTANCE-1754
  • Loading branch information
jeft224 authored Jul 8, 2024
1 parent 9c40061 commit c209719
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe("CmdbUpload", () => {
const wrapper = mount(
<CmdbUpload
autoUpload
uploadConfig={{ method: "put", url: url }}
uploadConfig={{ method: "put", url: url, uploadButtonName: "Upload" }}
value={fileList}
onChange={onChange}
/>
Expand Down Expand Up @@ -101,7 +101,6 @@ describe("CmdbUpload", () => {
],
});
expect(wrapper.find(Upload).prop("disabled")).toBe(true);

expect(wrapper.find("Button").text()).toBe("Upload");
expect(wrapper.find("GeneralIcon").at(0).prop("icon")).toEqual({
lib: "antd",
Expand Down
3 changes: 2 additions & 1 deletion libs/cmdb-instances/src/components/cmdb-upload/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ export function CmdbUpload(props: CmdbUploadProps): React.ReactElement {
method: "put",
limitSize: 100,
};
const { uploadButtonProps, uploadConfig = defaultUploadConfig } = props;
const { uploadButtonProps, uploadConfig: otherUploadConfig } = props;
const uploadConfig = { ...defaultUploadConfig, ...(otherUploadConfig ?? {}) };
const [value, setValue] = React.useState([]);
const [fileList, setFileList] = useState([]);
const [disabled, setDisabled] = useState(false);
Expand Down

0 comments on commit c209719

Please sign in to comment.