Copilot commented on code in PR #11160: URL: https://github.com/apache/gravitino/pull/11160#discussion_r3279443335
########## web-v2/web/src/app/catalogs/rightContent/entitiesContent/ViewDetailsPage.js: ########## @@ -0,0 +1,240 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + */ + +'use client' + +import { useMemo, useState } from 'react' +import { Descriptions, Divider, Flex, Input, Popover, Space, Spin, Table, Tabs, Tag, Tooltip, Typography } from 'antd' +import { useAntdColumnResize } from 'react-antd-column-resize' +import useResizeObserver from 'use-resize-observer' +import Icons from '@/components/Icons' +import { ColumnTypeColorEnum } from '@/config' +import { useAppSelector } from '@/lib/hooks/useStore' +import { useSearchParams } from 'next/navigation' +import { formatToDateTime, isValidDate } from '@/lib/utils/date' +import PropertiesContent from '@/components/PropertiesContent' + +const { Title, Paragraph } = Typography +const { Search } = Input + +export default function ViewDetailsPage() { + const searchParams = useSearchParams() + const viewName = searchParams.get('view') + const store = useAppSelector(state => state.metalakes) + const viewData = store.activatedDetails + const [search, setSearch] = useState('') + const [tabKey, setTabKey] = useState('Columns') + const { ref, width } = useResizeObserver() + + const tableData = viewData?.columns + ?.filter(c => { + if (search === '') return true + + return c.name.includes(search) + }) + .map(col => ({ + ...col, + key: col.name, + type: col.type + })) + + const columnTypeFilters = viewData?.columns + ?.map(column => (typeof column.type === 'string' ? column.type : column.type.type)) + .filter((value, index, self) => self.indexOf(value) === index) + .map(t => ({ + text: t, + value: t + })) + + const columnTypeColor = type => { + const formatType = typeof type === 'string' ? type.replace(/\(.*\)/, '') : 'objectType' + + return ColumnTypeColorEnum[formatType] + } + + const representations = viewData?.representations || [] + const properties = viewData?.properties + const createdAt = viewData?.audit?.createTime + const createdAtText = !createdAt || !isValidDate(createdAt) ? '-' : formatToDateTime(createdAt) + + const tabOptions = [ + { label: 'Columns', key: 'Columns' }, + { label: 'SQL', key: 'SQL' } + ] Review Comment: `ViewDetailsPage` only defines two tabs (Columns, SQL), but the PR description says the view details page has three tabs including Properties. Either add a Properties tab that renders the view properties (e.g., via `PropertiesContent`) or update the PR description/UX to match the intended behavior. ########## web-v2/web/src/app/catalogs/rightContent/entitiesContent/SchemaDetailsPage.js: ########## @@ -441,10 +474,51 @@ export default function SchemaDetailsPage() { [nameCol, entityType, store.tableLoading, anthEnable, catalogData?.provider] ) + const viewColumns = useMemo( + () => [ + { + title: 'View Name', + dataIndex: 'name', + key: 'name', + width: 300, + ellipsis: true, + sorter: (a, b) => a?.name.toLowerCase().localeCompare(b?.name.toLowerCase()), + render: name => ( + <Link + data-refer={`view-link-${name}`} + href={`/catalogs?metalake=${encodeURIComponent(currentMetalake)}&catalogType=${catalogType}&catalog=${encodeURIComponent(catalog)}&schema=${encodeURIComponent(schema)}&view=${encodeURIComponent(name)}`} + > + {name} + </Link> + ) + }, + { + title: 'Actions', + dataIndex: 'action', + key: 'action', + width: 100, + render: (_, record) => ( + <a data-refer={`delete-view-${record.name}`}> + <Icons.Trash2Icon className='size-4' onClick={() => showDeleteConfirm(Modal, record, 'view')} /> + </a> Review Comment: The delete action for views is rendered as an `<a>` without an `href`, with the click handler attached to the icon. This is not reliably keyboard-accessible and can confuse assistive tech. Prefer a semantic button (or at least move `onClick` onto the interactive element and add an accessible label). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
