Skip to content

Commit 7974bf6

Browse files
author
之瑛
committed
PullRequest: 458 更新角色名称拼接提示、状态栏调整、总耗时添加、hover提示更新等
Merge branch 'feat/ease-of-use of [email protected]:oceanbase/oceanbase-developer-center.git into dev-4.3.1 https://code.alipay.com/oceanbase/oceanbase-developer-center/pull_requests/458 Signed-off-by: 晓康 <[email protected]> * feat: hover tooltip 增加 * feat: 增加快捷键冲突判定 * feat: 增加快捷键冲突检测 * feat: 总耗时添加 * feat: change statusBar layout * feat: 角色名称拼接提示 * fix: 耗时数据读取方式问题
1 parent 1c8484f commit 7974bf6

File tree

8 files changed

+57
-28
lines changed

8 files changed

+57
-28
lines changed

src/component/Manage/RoleList/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,14 @@ const RoleList: React.FC<{
3939
isShowIcon?: boolean;
4040
isWrap?: boolean;
4141
}> = ({ roles, isShowIcon = false, isWrap = false }) => {
42+
const title = roles?.map((item) => item.name)?.join(' | ');
4243
return (
43-
<div title={roles?.map((item) => item.name)?.join(' | ')}>
44+
<div title={title}>
4445
<Space split="|" size={10} wrap={isWrap}>
4546
{roles?.length ? (
4647
roles?.map(({ name, enabled }, index) => (
4748
<Space key={index} size={5}>
48-
<span title={name}>{name}</span>
49+
<span title={title}>{name}</span>
4950
{!enabled && isShowIcon && (
5051
<span
5152
title={formatMessage({

src/component/ODCSetting/index.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ const ODCSetting: React.FC<IProps> = ({ modalStore }) => {
101101

102102
// 遍历所有子节点
103103
const children = dom.querySelectorAll<HTMLHeadingElement>('[data-name]'); // 假定子节点有共同的类名'child'
104+
// console.log(children);
104105
let min = Number.MAX_SAFE_INTEGER;
105106
let key;
106107
children.forEach((child) => {
@@ -164,6 +165,13 @@ const ODCSetting: React.FC<IProps> = ({ modalStore }) => {
164165

165166
async function save() {
166167
const values = await formRef.validateFields();
168+
if (
169+
(values['odc.editor.shortcut.executeStatement'] =
170+
values['odc.editor.shortcut.executeCurrentStatement'])
171+
) {
172+
message.warning('快捷键冲突, 请重新输入。');
173+
return;
174+
}
167175
const serverData: Record<string, string> = {},
168176
localData = {};
169177
Object.keys(values).forEach((key) => {

src/d.ts/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,6 +1045,7 @@ export interface IResultSet extends Partial<ISqlExecuteResult> {
10451045
table?: ITable;
10461046
editable: boolean;
10471047
};
1048+
timer?: ISqlExecuteResultTimer;
10481049

10491050
isQueriedEditable?: boolean;
10501051
logTypeData?: {
@@ -1632,6 +1633,12 @@ export interface ISqlExecuteResult {
16321633
withFullLinkTrace: boolean;
16331634
traceEmptyReason?: string;
16341635
}
1636+
export interface ISqlExecuteResultTimer {
1637+
name: string;
1638+
stages: IResultTimerStage[];
1639+
startTimeMillis: number; // 开始时间
1640+
totalDurationMicroseconds: number; // 总耗时
1641+
}
16351642

16361643
export enum ISqlExecuteResultStatus {
16371644
SUCCESS = 'SUCCESS',

src/page/Project/Database/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ const Database: React.FC<IProps> = ({ id, modalStore }) => {
343343
dataIndex: 'collationName',
344344
width: 120,
345345
ellipsis: true,
346+
render: (collationName) => collationName || '-',
346347
},
347348
{
348349
title: formatMessage({

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

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { ITableColumn, ResultSetColumn } from '@/d.ts';
17+
import { ISqlExecuteResultTimer, ITableColumn, ResultSetColumn } from '@/d.ts';
18+
import { SQLStore } from '@/store/sql';
1819
import { formatMessage } from '@/util/intl';
1920
import { formatTimeTemplate } from '@/util/utils';
2021
import { Divider, Space, Typography } from 'antd';
2122
import BigNumber from 'bignumber.js';
23+
import { inject, observer } from 'mobx-react';
2224
import React, { useMemo } from 'react';
2325

2426
interface IProps {
@@ -27,15 +29,25 @@ interface IProps {
2729
columns: Partial<ITableColumn>[];
2830
fields: ResultSetColumn[];
2931
selectedColumnKeys: React.Key[];
32+
sqlStore?: SQLStore;
33+
timer?: ISqlExecuteResultTimer;
3034
}
3135

3236
const StatusBar: React.FC<IProps> = function ({
3337
recordCount,
3438
dbTotalDurationMicroseconds,
3539
columns,
40+
timer,
3641
fields,
3742
selectedColumnKeys,
3843
}) {
44+
const executeStage = timer?.stages?.find((stage) => stage.stageName === 'Execute');
45+
const executeSQLStage = executeStage?.subStages?.find(
46+
(stage) => stage.stageName === 'DB Server Execute SQL',
47+
);
48+
const DBCostTime = formatTimeTemplate(
49+
BigNumber(executeSQLStage?.totalDurationMicroseconds).div(1000000).toNumber(),
50+
);
3951
const selectColumns = useMemo(() => {
4052
if (!columns?.length || !selectedColumnKeys?.length || !fields?.length) {
4153
return [];
@@ -117,22 +129,26 @@ const StatusBar: React.FC<IProps> = function ({
117129
{formatTimeTemplate(BigNumber(dbTotalDurationMicroseconds).div(1000000).toNumber())}
118130
</span>
119131
) : null}
120-
<span>
121-
{
122-
formatMessage(
123-
{
124-
id: 'odc.components.DDLResultSet.StatusBar.TotalNumberOfEntriesRecordcount',
125-
},
132+
<Space size={'small'}>
133+
<span>{`总耗时:${DBCostTime}`}</span>
134+
<span>
135+
{
136+
formatMessage(
137+
{
138+
id: 'odc.components.DDLResultSet.StatusBar.TotalNumberOfEntriesRecordcount',
139+
},
140+
141+
{ recordCount: recordCount },
142+
)
143+
/*总条数:{recordCount} 条*/
144+
}
145+
</span>
146+
</Space>
126147

127-
{ recordCount: recordCount },
128-
)
129-
/*总条数:{recordCount} 条*/
130-
}
131-
</span>
132148
{columnInfo}
133149
</Space>
134150
</div>
135151
);
136152
};
137153

138-
export default StatusBar;
154+
export default inject('sqlStore')(observer(StatusBar));

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import Toolbar from '@/component/Toolbar';
1919
import icon, { IConStatus } from '@/component/Toolbar/statefulIcon/index';
2020
import {
2121
GeneralSQLType,
22+
ISqlExecuteResultTimer,
2223
ITable,
2324
ITableColumn,
2425
LobExt,
@@ -125,6 +126,7 @@ interface IProps {
125126
resultHeight: number | string;
126127
pageKey?: string;
127128
generalSqlType?: GeneralSQLType;
129+
timer?: ISqlExecuteResultTimer;
128130
traceId?: string;
129131
enableRowId?: boolean;
130132
autoCommit: boolean;
@@ -155,6 +157,7 @@ const DDLResultSet: React.FC<IProps> = function (props) {
155157
columns,
156158
showPagination,
157159
sqlStore,
160+
timer,
158161
settingStore,
159162
showExplain,
160163
showTrace = false,
@@ -1178,6 +1181,7 @@ const DDLResultSet: React.FC<IProps> = function (props) {
11781181
selectedColumnKeys={selectedCellColumnsKey}
11791182
columns={table?.columns}
11801183
dbTotalDurationMicroseconds={dbTotalDurationMicroseconds}
1184+
timer={timer}
11811185
/>
11821186
</div>
11831187
);

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ const ExecuteHistory: React.FC<IProps> = function (props) {
185185
const executeSQLStage = executeStage?.subStages?.find(
186186
(stage) => stage.stageName === 'DB Server Execute SQL',
187187
);
188-
189188
const DBCostTime = formatTimeTemplate(
190189
BigNumber(executeSQLStage?.totalDurationMicroseconds).div(1000000).toNumber(),
191190
);
@@ -239,8 +238,7 @@ const ExecuteHistory: React.FC<IProps> = function (props) {
239238
message={
240239
formatMessage(
241240
{
242-
id:
243-
'odc.components.SQLResultSet.ExecuteHistory.SelectedrowkeyslengthRecordsSelected',
241+
id: 'odc.components.SQLResultSet.ExecuteHistory.SelectedrowkeyslengthRecordsSelected',
244242
},
245243

246244
{ selectedRowKeysLength: selectedRowKeys.length },

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

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,8 @@ const SQLResultSet: React.FC<IProps> = function (props) {
228228
);
229229
}
230230
let resultTabCount = 0;
231-
if(unauthorizedDatabases?.length){
232-
return (
233-
<DBPermissionTable sql={unauthorizedSql} dataSource={unauthorizedDatabases} />
234-
)
231+
if (unauthorizedDatabases?.length) {
232+
return <DBPermissionTable sql={unauthorizedSql} dataSource={unauthorizedDatabases} />;
235233
}
236234

237235
return (
@@ -325,6 +323,7 @@ const SQLResultSet: React.FC<IProps> = function (props) {
325323
showPagination={true}
326324
showTrace={true}
327325
columns={set.columns}
326+
timer={set.timer}
328327
session={session}
329328
sqlId={set.sqlId}
330329
autoCommit={session?.params?.autoCommit}
@@ -444,12 +443,7 @@ const SQLResultSet: React.FC<IProps> = function (props) {
444443
</Tooltip>
445444
),
446445
key: set.uniqKey,
447-
children: (
448-
<SQLResultLog
449-
resultHeight={resultHeight}
450-
resultSet={set}
451-
/>
452-
),
446+
children: <SQLResultLog resultHeight={resultHeight} resultSet={set} />,
453447
};
454448
}
455449
}),

0 commit comments

Comments
 (0)