diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Database/DatabaseSchema/DatabaseSchemaTable/DatabaseSchemaTable.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Database/DatabaseSchema/DatabaseSchemaTable/DatabaseSchemaTable.tsx index d19c12c1a899..446115795352 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Database/DatabaseSchema/DatabaseSchemaTable/DatabaseSchemaTable.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Database/DatabaseSchema/DatabaseSchemaTable/DatabaseSchemaTable.tsx @@ -192,7 +192,9 @@ export const DatabaseSchemaTable = ({ if (!schemaDetails) { return; } - const updatedData = { ...schemaDetails, displayName: data.displayName }; + const updatedData = data.displayName + ? { ...schemaDetails, displayName: data.displayName } + : { ...schemaDetails, displayName: undefined }; const jsonPatch = compare(schemaDetails, updatedData); await patchDatabaseSchemaDetails(schemaDetails.id ?? '', jsonPatch); setSchemas((prevData) => diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/DisplayName/DisplayName.interface.ts b/openmetadata-ui/src/main/resources/ui/src/components/common/DisplayName/DisplayName.interface.ts new file mode 100644 index 000000000000..b7a3f0f8218a --- /dev/null +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/DisplayName/DisplayName.interface.ts @@ -0,0 +1,22 @@ +/* + * Copyright 2024 Collate. + * Licensed 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 { EntityName } from '../../Modals/EntityNameModal/EntityNameModal.interface'; + +export interface DisplayNameProps { + id: string; + name?: string; + displayName?: string; + link: string; + onEditDisplayName?: (data: EntityName, id?: string) => Promise; + allowRename?: boolean; +} diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/DisplayName/DisplayName.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/DisplayName/DisplayName.tsx index 1ffc5abe6d5e..bb74f3be9278 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/DisplayName/DisplayName.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/DisplayName/DisplayName.tsx @@ -21,15 +21,7 @@ import { DE_ACTIVE_COLOR, ICON_DIMENSION } from '../../../constants/constants'; import { showErrorToast } from '../../../utils/ToastUtils'; import EntityNameModal from '../../Modals/EntityNameModal/EntityNameModal.component'; import { EntityName } from '../../Modals/EntityNameModal/EntityNameModal.interface'; - -export interface DisplayNameProps { - id: string; - name?: string; - displayName?: string; - link: string; - onEditDisplayName?: (data: EntityName, id?: string) => Promise; - allowRename: boolean; -} +import { DisplayNameProps } from './DisplayName.interface'; const DisplayName: React.FC = ({ id, diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/DatabaseSchemaPage/SchemaTablesTab.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/DatabaseSchemaPage/SchemaTablesTab.tsx index 282231f700e0..afdf8f172e3f 100644 --- a/openmetadata-ui/src/main/resources/ui/src/pages/DatabaseSchemaPage/SchemaTablesTab.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/pages/DatabaseSchemaPage/SchemaTablesTab.tsx @@ -93,8 +93,9 @@ function SchemaTablesTab({ if (!tableDetails) { return; } - - const updatedData = { ...tableDetails, displayName: data.displayName }; + const updatedData = data.displayName + ? { ...tableDetails, displayName: data.displayName } + : { ...tableDetails, displayName: undefined }; const jsonPatch = compare(tableDetails, updatedData); await patchTableDetails(tableDetails.id, jsonPatch); diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/ServiceDetailsPage/ServiceMainTabContent.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/ServiceDetailsPage/ServiceMainTabContent.tsx index 4ed02713332f..ee6b7f281082 100644 --- a/openmetadata-ui/src/main/resources/ui/src/pages/ServiceDetailsPage/ServiceMainTabContent.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/pages/ServiceDetailsPage/ServiceMainTabContent.tsx @@ -151,10 +151,9 @@ function ServiceMainTabContent({ if (!pageDataDetails) { return; } - const updatedData = { - ...pageDataDetails, - displayName: entityData.displayName, - }; + const updatedData = entityData.displayName + ? { ...pageDataDetails, displayName: entityData.displayName } + : { ...pageDataDetails, displayName: undefined }; const jsonPatch = compare(pageDataDetails, updatedData); await callServicePatchAPI( serviceCategory, diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/ServiceVersionPage/ServiceVersionMainTabContent.interface.ts b/openmetadata-ui/src/main/resources/ui/src/pages/ServiceVersionPage/ServiceVersionMainTabContent.interface.ts index 100aa7c306d3..cf0100aabb1b 100644 --- a/openmetadata-ui/src/main/resources/ui/src/pages/ServiceVersionPage/ServiceVersionMainTabContent.interface.ts +++ b/openmetadata-ui/src/main/resources/ui/src/pages/ServiceVersionPage/ServiceVersionMainTabContent.interface.ts @@ -28,5 +28,4 @@ export interface ServiceVersionMainTabContentProps { pagingHandler: NextPreviousProps['pagingHandler']; entityType: EntityType; changeDescription: ChangeDescription; - isVersionPage?: boolean; } diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/ServiceVersionPage/ServiceVersionMainTabContent.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/ServiceVersionPage/ServiceVersionMainTabContent.tsx index c96c53c06747..ff362630d74a 100644 --- a/openmetadata-ui/src/main/resources/ui/src/pages/ServiceVersionPage/ServiceVersionMainTabContent.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/pages/ServiceVersionPage/ServiceVersionMainTabContent.tsx @@ -25,7 +25,6 @@ import TagsContainerV2 from '../../components/Tag/TagsContainerV2/TagsContainerV import { DisplayType } from '../../components/Tag/TagsViewer/TagsViewer.interface'; import { PAGE_SIZE } from '../../constants/constants'; import { TABLE_SCROLL_VALUE } from '../../constants/Table.constants'; -import { usePermissionProvider } from '../../context/PermissionProvider/PermissionProvider'; import { TagSource } from '../../generated/type/tagLabel'; import { useFqn } from '../../hooks/useFqn'; import { getCommonDiffsFromVersionData } from '../../utils/EntityVersionUtils'; @@ -43,24 +42,15 @@ function ServiceVersionMainTabContent({ serviceDetails, entityType, changeDescription, - isVersionPage = true, }: ServiceVersionMainTabContentProps) { const { serviceCategory } = useParams<{ serviceCategory: ServiceTypes; }>(); const { fqn: serviceFQN } = useFqn(); - const { permissions } = usePermissionProvider(); - - const editDisplayNamePermission = useMemo(() => { - return !isVersionPage - ? permissions.databaseService.EditAll || - permissions.databaseService.EditDisplayName - : false; - }, [permissions]); const tableColumn: ColumnsType = useMemo( - () => getServiceMainTabColumns(serviceCategory, editDisplayNamePermission), + () => getServiceMainTabColumns(serviceCategory), [serviceCategory] ); diff --git a/openmetadata-ui/src/main/resources/ui/src/utils/ServiceMainTabContentUtils.tsx b/openmetadata-ui/src/main/resources/ui/src/utils/ServiceMainTabContentUtils.tsx index b80ae35007fd..2c58500e1216 100644 --- a/openmetadata-ui/src/main/resources/ui/src/utils/ServiceMainTabContentUtils.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/utils/ServiceMainTabContentUtils.tsx @@ -40,7 +40,7 @@ import { getUsagePercentile } from './TableUtils'; export const getServiceMainTabColumns = ( serviceCategory: ServiceTypes, - editDisplayNamePermission: boolean, + editDisplayNamePermission?: boolean, handleDisplayNameUpdate?: ( entityData: EntityName, id?: string diff --git a/openmetadata-ui/src/main/resources/ui/webpack.config.dev.js b/openmetadata-ui/src/main/resources/ui/webpack.config.dev.js index d9da5adbf69b..8a117de94324 100644 --- a/openmetadata-ui/src/main/resources/ui/webpack.config.dev.js +++ b/openmetadata-ui/src/main/resources/ui/webpack.config.dev.js @@ -19,8 +19,7 @@ const process = require('process'); const outputPath = path.join(__dirname, 'build'); const subPath = process.env.APP_SUB_PATH ?? ''; -const devServerTarget = - process.env.DEV_SERVER_TARGET ?? 'http://localhost:8585/'; +const devServerTarget = process.env.DEV_SERVER_TARGET ?? 'http://localhost:8585/'; module.exports = { // Development mode