diff --git a/src/pages/container/edit/List.tsx b/src/pages/container/edit/List.tsx
index 1909ab7..d83bc87 100644
--- a/src/pages/container/edit/List.tsx
+++ b/src/pages/container/edit/List.tsx
@@ -16,6 +16,7 @@ import {
MessageOutlined,
PlusOutlined,
DashboardOutlined,
+ CloudUploadOutlined,
} from '@ant-design/icons';
import clsx from 'clsx';
import { isObjectNull } from '@/utils/is-null';
@@ -97,6 +98,85 @@ const FormModal = () => {
);
};
+const PublishFormModal = () => {
+ const [form] = Form.useForm();
+ const containerStore = useContainerStore(
+ useShallow((state) => {
+ return {
+ showEdit: state.showPublish,
+ setShowEdit: state.setShowPublish,
+ formData: state.formData,
+ updateData: state.publishData,
+ };
+ }),
+ );
+ useEffect(() => {
+ const open = containerStore.showEdit;
+ if (open) {
+ if (open) {
+ const isNull = isObjectNull(containerStore.formData);
+ if (isNull) {
+ form.setFieldsValue({});
+ } else form.setFieldsValue(containerStore.formData);
+ }
+ }
+ }, [containerStore.showEdit]);
+ const onFinish = async (values: any) => {
+ containerStore.updateData(values);
+ };
+ const onClose = () => {
+ containerStore.setShowEdit(false);
+ form.resetFields();
+ };
+ const isEdit = containerStore.formData.id;
+ return (
+ containerStore.setShowEdit(false)}
+ destroyOnClose
+ footer={false}
+ width={800}
+ onCancel={onClose}>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
export const ContainerList = () => {
const navicate = useNewNavigate();
const containerStore = useContainerStore(
@@ -108,7 +188,8 @@ export const ContainerList = () => {
deleteData: state.deleteData,
getList: state.getList,
loading: state.loading,
- publishData: state.publishData,
+ // publishData: state.publishData,
+ setShowPublish: state.setShowPublish,
updateData: state.updateData,
formData: state.formData,
};
@@ -189,26 +270,40 @@ export const ContainerList = () => {
e.stopPropagation();
}}
icon={}>
-
-
+
+
+
+
+
+
+
+
+
@@ -273,6 +368,7 @@ export const ContainerList = () => {
+
);
};
diff --git a/src/pages/container/store/index.ts b/src/pages/container/store/index.ts
index e80931c..7f2e60c 100644
--- a/src/pages/container/store/index.ts
+++ b/src/pages/container/store/index.ts
@@ -4,6 +4,8 @@ import { message } from 'antd';
type ContainerStore = {
showEdit: boolean;
setShowEdit: (showEdit: boolean) => void;
+ showPublish: boolean;
+ setShowPublish: (showPublish: boolean) => void;
formData: any;
setFormData: (formData: any) => void;
loading: boolean;
@@ -18,6 +20,8 @@ export const useContainerStore = create((set, get) => {
return {
showEdit: false,
setShowEdit: (showEdit) => set({ showEdit }),
+ showPublish: false,
+ setShowPublish: (showPublish) => set({ showPublish }),
formData: {},
setFormData: (formData) => set({ formData }),
loading: false,
@@ -25,7 +29,6 @@ export const useContainerStore = create((set, get) => {
list: [],
getList: async () => {
set({ loading: true });
-
const res = await query.post({
path: 'container',
key: 'list',
@@ -67,22 +70,10 @@ export const useContainerStore = create((set, get) => {
}
},
publishData: async (data) => {
- const hasPublish = !!data.publish?.name;
- const publish = {
- name: 'test-import',
- };
- if (!hasPublish) {
- console.error('need publish.name');
- return;
- }
const res = await query.post({
path: 'container',
key: 'publish',
- data: {
- id: data.id,
- publish: publish,
- type: 'patch',
- },
+ data,
});
if (res.code === 200) {
message.success('Success');