Skip to content

Commit 834eadb

Browse files
committed
PullRequest: 474 fix/.dev-4.3.1-2884
Merge branch 'fix/dev-4.3.1-2884 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/474 Signed-off-by: 晓康 <xxk268858@oceanbase.com> * fix: add traceEmptyReason in profile trace tab * fix: rename the traceComponent * fix: resultSet log with [withQueryProfile] params limits * Fixes oceanbase/odc#2884 * style: update object search Locate description
1 parent 46d523e commit 834eadb

9 files changed

Lines changed: 50 additions & 17 deletions

File tree

src/component/ExecuteSqlDetailModal/index.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { handleShowOutputFilter } from '@/page/Workspace/components/SQLExplain';
1515
import { formatMessage } from '@/util/intl';
1616
import { getFullLinkTraceDownloadUrl } from '@/common/network/sql';
1717
import { downloadFile } from '@/util/utils';
18-
import TraceComp from '@/page/Workspace/components/Trace/TraceComp';
18+
import TraceComp from '@/page/Workspace/components/Trace/TraceComponent';
1919
import { TraceTabsType } from '@/page/Workspace/components/Trace';
2020
import {
2121
ProfileType,
@@ -49,6 +49,8 @@ const ExecuteSQLDetailModal: React.FC<IProps> = ({ modalStore }: IProps) => {
4949
const [pageLoading, setPageLoading] = useState<boolean>(false);
5050
const [searchValue, setSearchValue] = useState<string>(null);
5151
const finished = !!data?.graph?.status && data?.graph?.status === IProfileStatus.FINISHED;
52+
const enableTrace =
53+
finished && modalStore?.executeSqlDetailData?.session?.params?.fullLinkTraceEnabled;
5254
const getExecuteRadioOption = () => {
5355
return [
5456
{
@@ -71,7 +73,7 @@ const ExecuteSQLDetailModal: React.FC<IProps> = ({ modalStore }: IProps) => {
7173
id: 'src.component.ExecuteSqlDetailModal.0B221F0A',
7274
defaultMessage: '全链路诊断',
7375
}),
74-
disabled: !finished,
76+
disabled: !enableTrace,
7577
},
7678
];
7779
};
@@ -87,6 +89,9 @@ const ExecuteSQLDetailModal: React.FC<IProps> = ({ modalStore }: IProps) => {
8789
];
8890

8991
const getDisabledTooltip = (val) => {
92+
if (modalStore?.executeSqlDetailData?.traceEmptyReason) {
93+
return modalStore?.executeSqlDetailData?.traceEmptyReason;
94+
}
9095
if (finished || !data?.graph?.status) {
9196
return val;
9297
}

src/component/Task/component/TableSelecter/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ const getTreeData = (validTableList: IDataBaseWithTable[], isSourceTree = false)
191191
disabled: hasGetTableList && tableList.length === 0,
192192
expandable: true,
193193
children,
194+
isLeaf: false,
194195
};
195196
});
196197
return allTreeData;

src/page/Workspace/SideBar/ResourceTree/DatabaseSearchModal/components/DatabaseList.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,11 @@ const DatabaseList = ({
9999

100100
if (database && !searchKey) {
101101
return (
102-
<Button
103-
type="link"
104-
style={{ padding: '4px 12px', height: 28, display: 'inline-block' }}
105-
onClick={(e) => openSql(e, database)}
106-
>
107-
定位到当前数据库
108-
</Button>
102+
<div className={styles.content}>
103+
<div className={styles.databaseItem} onClick={(e) => openSql(e, database)}>
104+
{`定位到数据库 "${database?.name}"`}
105+
</div>
106+
</div>
109107
);
110108
}
111109
return (

src/page/Workspace/components/DDLResultSet/index.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,12 @@ interface IProps {
166166
onShowExecuteDetail?: () => void;
167167
onShowTrace?: () => void;
168168
onUpdateEditing?: (editing: boolean) => void;
169-
onOpenExecutingDetailModal?: (traceId: string, sql?: string) => void;
169+
onOpenExecutingDetailModal?: (
170+
traceId: string,
171+
sql?: string,
172+
sessionId?: string,
173+
traceEmptyReason?: string,
174+
) => void;
170175
}
171176
const DDLResultSet: React.FC<IProps> = function (props) {
172177
const {
@@ -708,7 +713,7 @@ const DDLResultSet: React.FC<IProps> = function (props) {
708713
icon={<Icon component={SqlProfile} />}
709714
onClick={() => {
710715
updateExecutePlanGuideCache();
711-
onOpenExecutingDetailModal?.(traceId, originSql);
716+
onOpenExecutingDetailModal?.(traceId, originSql, null, traceEmptyReason);
712717
}}
713718
tip={executeGuideTipContent()}
714719
overlayInnerStyle={{ width: 300 }}

src/page/Workspace/components/SQLResultSet/ExecuteHistory.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,12 @@ interface IProps {
4141
onShowExecuteDetail: (sql: string, tag: string) => void;
4242
resultHeight: number;
4343
sqlStore?: SQLStore;
44-
onOpenExecutingDetailModal?: (traceId: string, sql?: string, sessionId?: string) => void;
44+
onOpenExecutingDetailModal?: (
45+
traceId: string,
46+
sql?: string,
47+
sessionId?: string,
48+
traceEmptyReason?: string,
49+
) => void;
4550
}
4651

4752
function getResultText(rs: ISqlExecuteResult) {
@@ -199,7 +204,16 @@ const ExecuteHistory: React.FC<IProps> = function (props) {
199204
render: (value: string, row: any) => {
200205
if (!value) return '-';
201206
return row?.isSupportProfile ? (
202-
<Link onClick={() => onOpenExecutingDetailModal(value, row?.originSql, row?.sessionId)}>
207+
<Link
208+
onClick={() =>
209+
onOpenExecutingDetailModal(
210+
value,
211+
row?.originSql,
212+
row?.sessionId,
213+
row?.traceEmptyReason,
214+
)
215+
}
216+
>
203217
{value}
204218
</Link>
205219
) : (

src/page/Workspace/components/SQLResultSet/index.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import SQLResultLog from './SQLResultLog';
3838
import DBPermissionTable from './DBPermissionTable';
3939
import { IUnauthorizedDBResources } from '@/d.ts/table';
4040
import { ProfileType } from '@/component/ExecuteSqlDetailModal/constant';
41+
import sessionManager from '@/store/sessionManager';
4142

4243
export const recordsTabKey = 'records';
4344
export const sqlLintTabKey = 'sqlLint';
@@ -236,15 +237,21 @@ const SQLResultSet: React.FC<IProps> = function (props) {
236237
const stopRunning = () => {
237238
sqlStore.stopExec(ctx.props.pageKey, ctx?.getSession()?.sessionId);
238239
};
239-
const onOpenExecutingDetailModal = (id: string, sql?: string, sessionId?: string) => {
240-
const session = sessionId ? { sessionId: sessionId } : ctx?.getSession();
240+
const onOpenExecutingDetailModal = (
241+
id: string,
242+
sql?: string,
243+
sessionId?: string,
244+
traceEmptyReason?: string,
245+
) => {
246+
const session = sessionId ? sessionManager.sessionMap.get(sessionId) : ctx?.getSession();
241247
modalStore.changeExecuteSqlDetailModalVisible(
242248
true,
243249
id,
244250
sql,
245251
session,
246252
ctx?.editor.getSelectionContent(),
247253
ProfileType.Execute,
254+
traceEmptyReason,
248255
);
249256
};
250257

@@ -477,7 +484,7 @@ const SQLResultSet: React.FC<IProps> = function (props) {
477484
stopRunning={stopRunning}
478485
onOpenExecutingDetailModal={onOpenExecutingDetailModal}
479486
loading={sqlStore.logLoading}
480-
isSupportProfile={isSupportProfile}
487+
isSupportProfile={isSupportProfile && set?.withQueryProfile}
481488
/>
482489
),
483490
};
File renamed without changes.

src/page/Workspace/components/Trace/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { getFullLinkTrace, getFullLinkTraceDownloadUrl } from '@/common/network/
2727
import { downloadFile, formatTimeTemplatMicroSeconds } from '@/util/utils';
2828
import { TraceSpan } from '@/d.ts';
2929
import SessionStore from '@/store/sessionManager/session';
30-
import TraceComp from './TraceComp';
30+
import TraceComp from './TraceComponent';
3131
export const InfoRender = ({ infos }) => {
3232
return (
3333
<Descriptions column={1}>

src/store/modal.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,7 @@ export class ModalStore {
431431
session?: any;
432432
selectedSQL?: any;
433433
profileType?: ProfileType;
434+
traceEmptyReason?: string;
434435
} = null;
435436

436437
@action
@@ -441,6 +442,7 @@ export class ModalStore {
441442
session?: any,
442443
selectedSQL?: any,
443444
profileType?: ProfileType,
445+
traceEmptyReason?: string,
444446
) {
445447
this.executeSqlDetailModalVisible = v;
446448
this.executeSqlDetailData = {
@@ -449,6 +451,7 @@ export class ModalStore {
449451
session,
450452
selectedSQL: selectedSQL,
451453
profileType: profileType,
454+
traceEmptyReason: traceEmptyReason,
452455
};
453456
}
454457

0 commit comments

Comments
 (0)