laserninja commented on code in PR #12900: URL: https://github.com/apache/gravitino/pull/12900#discussion_r4266617845
########## web-v2/web/src/lib/api/semanticModels/index.js: ########## @@ -0,0 +1,94 @@ +/* + * 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. + */ + +import { defHttp } from '@/lib/utils/axios' + +const Apis = { + GET: ({ metalake, catalog, schema }) => + `/api/metalakes/${encodeURIComponent(metalake)}/catalogs/${encodeURIComponent( + catalog + )}/schemas/${encodeURIComponent(schema)}/semantic-models`, + GET_DETAIL: ({ metalake, catalog, schema, semanticModel }) => + `/api/metalakes/${encodeURIComponent(metalake)}/catalogs/${encodeURIComponent( + catalog + )}/schemas/${encodeURIComponent(schema)}/semantic-models/${encodeURIComponent(semanticModel)}` +} + +export const getSemanticModelsApi = (params, options) => { + return defHttp.get( + { + url: `${Apis.GET(params)}` + }, + + // The schema tab and tree load this list independently and must not cancel each other. + { ...options, ignoreCancelToken: true } Review Comment: Fixed in 296dd0f5a. List requests now track the latest request ID per schema and ignore superseded responses before updating the tree or list state. Older tree loads also retain the latest refreshed model nodes. Tests cover both consumers, old failures, schema switches, and store resets. In Chromium, holding the initial list through an OSSIE import and then releasing it no longer removes the imported model. ########## web-v2/web/src/app/catalogs/rightContent/entitiesContent/SemanticModelDetailsPage.js: ########## @@ -0,0 +1,576 @@ +/* + * 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 { Button, Divider, Flex, Popover, Space, Spin, Table, Tabs, Tag, Tooltip, Typography, message } from 'antd' +import { useAntdColumnResize } from 'react-antd-column-resize' +import useResizeObserver from 'use-resize-observer' +import { useRouter, useSearchParams } from 'next/navigation' +import Tags from '@/components/CustomTags' +import GetOwner from '@/components/GetOwner' +import Icons from '@/components/Icons' +import PropertiesContent from '@/components/PropertiesContent' +import { useAppDispatch, useAppSelector } from '@/lib/hooks/useStore' +import { getSemanticModelDetails } from '@/lib/store/metalakes' +import { copyToClipboard } from '@/lib/utils' +import { formatToDateTime, isValidDate } from '@/lib/utils/date' +import { formatSemanticModelDefinition } from '@/lib/utils/semanticModel' +import SemanticModelAIContext from './SemanticModelAIContext' +import SemanticModelExport from './SemanticModelExport' +import SemanticModelExtensions from './SemanticModelExtensions' +import CreateSemanticModelDialog from '../CreateSemanticModelDialog' + +const { Title, Paragraph } = Typography + +const sourceFullName = source => { + if (!source) { + return '-' + } + + return [...(source.namespace || []), source.name].filter(Boolean).join('.') +} + +const renderExpression = expression => { + const dialects = expression?.dialects || [] + + if (!dialects.length) { + return <span>-</span> + } + + return ( + <Space direction='vertical' size={2}> + {dialects.map((dialect, index) => ( + <span key={`${dialect?.dialect}-${index}`}> + <Tag>{dialect?.dialect}</Tag> + <span className='font-mono text-xs'>{dialect?.expression}</span> Review Comment: Fixed in 296dd0f5a. Both fields and metrics render each dialect in a bounded code block that preserves newlines and wraps long tokens. Cells align to the top so names and descriptions remain visible beside long SQL. Verified at 1512x861: the long literal stays within its cell, Description stays readable, and the line after a `--` comment remains on its own line. -- 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]
