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 = '.';