This is an automated email from the ASF dual-hosted git repository.
jbonofre pushed a commit to branch ui
in repository https://gitbox.apache.org/repos/asf/polaris-tools.git
The following commit(s) were added to refs/heads/ui by this push:
new 4a4a123 Prepare catalog detail
4a4a123 is described below
commit 4a4a1234f99d51fdf64c0c3c2a80e95dba51a531
Author: JB Onofré <[email protected]>
AuthorDate: Mon Oct 27 08:22:12 2025 +0100
Prepare catalog detail
---
ui/src/catalog.tsx | 37 ++++++++++++++++++++++++++++++++++---
1 file changed, 34 insertions(+), 3 deletions(-)
diff --git a/ui/src/catalog.tsx b/ui/src/catalog.tsx
index 70540ff..9ec4866 100644
--- a/ui/src/catalog.tsx
+++ b/ui/src/catalog.tsx
@@ -16,7 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
-import { Link, Redirect } from 'react-router-dom';
+import { useState, useEffect } from 'react';
+import { Link } from 'react-router-dom';
import { Breadcrumb, Card, Form, Input, Select, Tabs, Collapse, Divider,
Button, Space, message } from 'antd';
import { HomeOutlined, ApartmentOutlined, AmazonOutlined, GoogleOutlined,
CloudOutlined, FileSyncOutlined, SaveOutlined, PauseCircleOutlined } from
'@ant-design/icons';
@@ -144,6 +145,9 @@ function StorageConfig() {
export default function Catalog(props) {
+ const [ catalogName, setCatalogName ] = useState();
+ const [ catalogDetail, setCatalogDetail ] = useState();
+
const bearer = 'Bearer ' + props.token;
const [ catalogForm ] = Form.useForm();
@@ -180,7 +184,7 @@ export default function Catalog(props) {
.then((data) => {
console.log(data);
message.info('Catalog ' + data.name + ' created.');
- props.fetchCatalogs();
+ setCatalogName(data.name);
})
.catch((error) => {
message.error('An error occurred: ' + error.message);
@@ -188,6 +192,33 @@ export default function Catalog(props) {
});
};
+ if (catalogName) {
+ // get catalog details
+ const fetchCatalogDetail = () => {
+ fetch('/api/management/v1/catalogs/' + catalogName, {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Polaris-Realm': 'POLARIS',
+ 'Authorization': bearer
+ }
+ })
+ .then((response) => {
+ if (!response.ok) {
+ throw new Error(response.status);
+ }
+ return response.json();
+ })
+ .then((data) => setCatalogDetail(data))
+ .catch((error) => {
+ message.error('An error occurred: ' + error.message);
+ console.error(error);
+ });
+ };
+
+ useEffect(fetchCatalogDetail, [catalogName]);
+ }
+
return(
<>
<Breadcrumb items={[ { title: <Link to="/"><HomeOutlined/></Link> }, {
title: <ApartmentOutlined/> } ]} />
@@ -195,7 +226,7 @@ export default function Catalog(props) {
<Form name="catalog" form={catalogForm} labelCol={{ span: 8 }}
wrapperCol={{ span: 16 }}
style={{ width: '100%' }}
- onFinish={onFinish}>
+ onFinish={onFinish} initialValues={catalogDetail}>
<Form.Item name="name" label="Name" rules={[{ required: true,
message: 'The catalog name is required' }]}>
<Input allowClear={true} />
</Form.Item>