From 4ed588efdfda392a376b7837326db6ec9e83bb6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=95=85=E6=99=9A?= Date: Tue, 9 Jul 2024 10:02:32 +0800 Subject: [PATCH] PullRequest: 466 fix/dev-4.3.1-2840 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge branch 'fix/dev-4.3.1-2840 of git@code.alipay.com:oceanbase/oceanbase-developer-center.git into dev-4.3.1 https://code.alipay.com/oceanbase/oceanbase-developer-center/pull_requests/466 Signed-off-by: 晓康 * Fixes oceanbase/odc#2804 * Fixes oceanbase/odc#2840 --- src/component/Toolbar/index.tsx | 2 +- .../components/ObjectList.tsx | 52 ++++++++++++------ .../components/DDLResultSet/index.tsx | 55 ++++++++++--------- .../components/SQLResultSet/index.tsx | 2 +- src/store/sessionManager/session.ts | 10 +--- src/util/versionUtils.ts | 2 +- 6 files changed, 67 insertions(+), 56 deletions(-) diff --git a/src/component/Toolbar/index.tsx b/src/component/Toolbar/index.tsx index aa3f188af..0747c9abf 100644 --- a/src/component/Toolbar/index.tsx +++ b/src/component/Toolbar/index.tsx @@ -150,7 +150,7 @@ function TButton({ if (tip) { return ( - + {content} diff --git a/src/page/Workspace/SideBar/ResourceTree/DatabaseSearchModal/components/ObjectList.tsx b/src/page/Workspace/SideBar/ResourceTree/DatabaseSearchModal/components/ObjectList.tsx index dafb20d0e..e18d3734c 100644 --- a/src/page/Workspace/SideBar/ResourceTree/DatabaseSearchModal/components/ObjectList.tsx +++ b/src/page/Workspace/SideBar/ResourceTree/DatabaseSearchModal/components/ObjectList.tsx @@ -211,7 +211,7 @@ const ObjectList = ({ {i.key === DbObjectType.database ? selectDbBtn(object) - : permissionBtn(object)} + : permissionBtn(object, i.key)} ); } @@ -232,14 +232,16 @@ const ObjectList = ({ ); }; - const applyTablePermission = (e, object) => { + const applyTablePermission = (e, object, type) => { e.stopPropagation(); + const dbObj = type === DbObjectType.table ? object : object?.dbObject; const params = { - projectId: object?.database?.project?.id, - databaseId: object?.database?.id, - tableName: object?.name, - tableId: object?.id, + projectId: dbObj?.database?.project?.id, + databaseId: dbObj?.database?.id, + tableName: dbObj?.name, + tableId: dbObj?.id, }; + // debugger modalStore.changeApplyTablePermissionModal(true, { ...params, }); @@ -253,28 +255,42 @@ const ObjectList = ({ ); }; - const permissionBtn = (object) => { + const permissionBtn = (object, type: DbObjectType) => { if (activeDatabase?.id !== object.id) return; if (hasPermission(object)) return; + const isTableColumn = + object?.dbObject?.type === DbObjectType.table || object?.type === DbObjectType.table; + if ([DbObjectType.column, DbObjectType.table].includes(type) && isTableColumn) { + return ( + + ); + } return ( ); }; - const applyDbPermission = (e, db: IDatabase) => { + const applyDbPermission = (e, db) => { e.stopPropagation(); + const dbObj = db?.dbObject?.database || db?.database || db; modalStore.changeApplyDatabasePermissionModal(true, { - projectId: db?.project?.id, - databaseId: db?.id, + projectId: dbObj?.project?.id, + databaseId: dbObj?.id, }); modalStore.changeDatabaseSearchModalVisible(false); }; @@ -375,7 +391,9 @@ const ObjectList = ({ {getSubTitle(object, type)} - {isDatabasetab ? selectDbBtn(object) : permissionBtn(object)} + {isDatabasetab + ? selectDbBtn(object) + : permissionBtn(object, currentObjectList.key)} ); })} diff --git a/src/page/Workspace/components/DDLResultSet/index.tsx b/src/page/Workspace/components/DDLResultSet/index.tsx index a39c231b5..3b20a88f9 100644 --- a/src/page/Workspace/components/DDLResultSet/index.tsx +++ b/src/page/Workspace/components/DDLResultSet/index.tsx @@ -90,6 +90,7 @@ import useColumns, { isNumberType } from './hooks/useColumns'; import ResultContext from './ResultContext'; import StatusBar from './StatusBar'; import { copyToSQL, getColumnNameByColumnKey } from './util'; +import { OBCompare, ODC_TRACE_SUPPORT_VERSION } from '@/util/versionUtils'; // @ts-ignore const ToolbarButton = Toolbar.Button; @@ -676,7 +677,7 @@ const DDLResultSet: React.FC = function (props) { const executeGuideTipContent = () => { if (guideCacheStore?.[guideCacheStore.cacheEnum.executePlan]) return null; return ( -
+
{formatMessage({ id: 'src.page.Workspace.components.DDLResultSet.E32AB474', @@ -749,32 +750,32 @@ const DDLResultSet: React.FC = function (props) { /> ))} - - {showTrace ? ( - } - onClick={() => { - onShowTrace?.(); - }} - /> - ) : ( - } - onClick={() => { - onShowTrace?.(); - }} - /> - )} + {showTrace && + (isString(obVersion) && OBCompare(obVersion, ODC_TRACE_SUPPORT_VERSION, '>=') ? ( + } + onClick={() => { + onShowTrace?.(); + }} + /> + ) : ( + } + onClick={() => { + onShowTrace?.(); + }} + /> + ))} ); }; diff --git a/src/page/Workspace/components/SQLResultSet/index.tsx b/src/page/Workspace/components/SQLResultSet/index.tsx index 7d559f197..78692b85a 100644 --- a/src/page/Workspace/components/SQLResultSet/index.tsx +++ b/src/page/Workspace/components/SQLResultSet/index.tsx @@ -338,7 +338,7 @@ const SQLResultSet: React.FC = function (props) { ='); - this.supportFeature.enableSQLTrace = - this.supportFeature.enableSQLTrace && - isString(obVersion) && - OBCompare(obVersion, ODC_TRACE_SUPPORT_VERSION, '>='); }); } diff --git a/src/util/versionUtils.ts b/src/util/versionUtils.ts index 83eb5c2e4..c477eb4fd 100644 --- a/src/util/versionUtils.ts +++ b/src/util/versionUtils.ts @@ -16,7 +16,7 @@ import compareVersions, { compare } from 'compare-versions'; -export const ODC_TRACE_SUPPORT_VERSION = '4.2.0'; +export const ODC_TRACE_SUPPORT_VERSION = '4.1.0'; export const ODC_PROFILE_SUPPORT_VERSION = '4.2.4'; export const ODC_VERSION_SEP = '.';