From ef086fe60d4375c92847f6d37242a58c5fb87fd6 Mon Sep 17 00:00:00 2001 From: Juan Diaz Date: Thu, 22 Aug 2024 14:51:32 -0400 Subject: [PATCH] [ui] Add ability to edit schema description (unitycatalog/unitycatalog-ui#69) closes unitycatalog/unitycatalog-ui#39 --- .../modals/EditSchemaDescriptionModal.tsx | 60 +++++++++++ ui/src/hooks/schemas.tsx | 41 +++++++ ui/src/pages/SchemaDetails.tsx | 101 ++++++++++++------ 3 files changed, 169 insertions(+), 33 deletions(-) create mode 100644 ui/src/components/modals/EditSchemaDescriptionModal.tsx diff --git a/ui/src/components/modals/EditSchemaDescriptionModal.tsx b/ui/src/components/modals/EditSchemaDescriptionModal.tsx new file mode 100644 index 000000000..d219cecfe --- /dev/null +++ b/ui/src/components/modals/EditSchemaDescriptionModal.tsx @@ -0,0 +1,60 @@ +import { Button, Form, Modal, Typography } from 'antd'; +import React, { useCallback, useRef } from 'react'; +import TextArea from 'antd/es/input/TextArea'; +import { UpdateSchemaMutationParams } from '../../hooks/schemas'; + +interface EditSchemaDescriptionModalProps { + open: boolean; + schema: UpdateSchemaMutationParams; + closeModal: () => void; + onSubmit: (comment: UpdateSchemaMutationParams) => void; + loading: boolean; +} + +export function EditSchemaDescriptionModal({ + open, + schema, + closeModal, + onSubmit, + loading, +}: EditSchemaDescriptionModalProps) { + const submitRef = useRef(null); + + const handleSubmit = useCallback(() => { + submitRef.current?.click(); + }, []); + + return ( + Edit description} + okText="Save" + cancelText="Cancel" + open={open} + destroyOnClose + onCancel={closeModal} + onOk={handleSubmit} + okButtonProps={{ loading: loading }} + > + + Schema description + + + layout="vertical" + onFinish={(values) => { + onSubmit(values); + }} + name="Edit description form" + initialValues={{ comment: schema.comment }} + > + +