Skip to content

Commit 2d5d226

Browse files
author
单贺喜
committed
feat:删除console
1 parent facc62e commit 2d5d226

10 files changed

Lines changed: 109 additions & 31 deletions

File tree

chat2db-client/src/blocks/Setting/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ export function SettingAI() {
203203
newChatgptConfig.apiHost = newChatgptConfig.apiHost + '/';
204204
}
205205
configService.setChatGptSystemConfig(newChatgptConfig).then((res) => {
206-
message.success(i18n('common.message.successfulConfig'));
206+
message.success(i18n('common.text.submittedSuccessfully'));
207207
});
208208
}
209209

chat2db-client/src/constants/common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ export enum ConsoleOpenedStatus {
2121
export enum ConsoleStatus {
2222
DRAFT = 'DRAFT',
2323
RELEASE = 'RELEASE',
24-
}
24+
}

chat2db-client/src/pages/main/connection/index.less

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
width: 220px;
1515
overflow: hidden;
1616
background-color: var(--color-bg-elevated);
17-
border-left: 1px solid var(--color-border);
17+
border: 1px solid var(--color-border-secondary);
18+
border-top: 0px;
19+
border-bottom: 0px;
1820
}
1921

2022
.pageTitle {

chat2db-client/src/pages/main/dashboard/index.less

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,23 @@
66
height: 100%;
77
width: 100%;
88
}
9+
.dragBox {
10+
width: 220px;
11+
height: 100%;
12+
overflow: hidden;
13+
border: 1px solid var(--color-border-secondary);
14+
border-top: 0px;
15+
border-bottom: 0px;
16+
}
917

1018
.boxLeft {
11-
min-width: 200px;
12-
max-width: 400px;
19+
display: flex;
20+
flex-direction: column;
1321
height: 100%;
14-
padding-top: 20px;
1522
background-color: var(--color-bg-elevated);
23+
padding: 10px 20px 0px;
24+
box-sizing: border-box;
25+
min-width: 200px;
1626
}
1727

1828
.createDashboardBtn {
@@ -53,10 +63,11 @@
5363
justify-content: space-between;
5464
align-items: center;
5565
border-radius: var(--border-radius-l-g);
56-
57-
.itemTitle{
66+
margin-bottom: 4px;
67+
68+
.itemTitle {
5869
font-weight: 400;
59-
&:hover{
70+
&:hover {
6071
color: var(--color-primary);
6172
}
6273
}
@@ -98,7 +109,8 @@
98109
margin-bottom: 24px;
99110
}
100111

101-
.boxRightContent {}
112+
.boxRightContent {
113+
}
102114

103115
.boxRightContentRow {
104116
display: flex;
@@ -111,4 +123,4 @@
111123
&:last-child {
112124
margin-right: 0px;
113125
}
114-
}
126+
}

chat2db-client/src/pages/main/dashboard/index.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useEffect, useState } from 'react';
1+
import React, { useEffect, useState, useRef } from 'react';
22
import { Button, Dropdown, Form, Input, Modal, message } from 'antd';
33
import { connect, Dispatch } from 'umi';
44
import cs from 'classnames';
@@ -43,6 +43,7 @@ function Chart(props: IProps) {
4343

4444
const [form] = Form.useForm(); // 创建一个表单实例
4545
const [messageApi, contextHolder] = message.useMessage();
46+
const draggableRef = useRef<any>();
4647

4748
useEffect(() => {
4849
// 获取列表数据
@@ -228,13 +229,15 @@ function Chart(props: IProps) {
228229

229230
return (
230231
<>
231-
<DraggableContainer layout="row" className={cs(styles.box, className)}>
232-
<div className={styles.boxLeft}>
233-
<div className={styles.boxLeftTitle}>
234-
<div>{i18n('dashboard.title')}</div>
235-
<Iconfont code="&#xe631;" className={styles.plusIcon} onClick={() => setOpenAddDashboard(true)} />
232+
<DraggableContainer className={cs(styles.box, className)}>
233+
<div ref={draggableRef} className={styles.dragBox}>
234+
<div className={styles.boxLeft}>
235+
<div className={styles.boxLeftTitle}>
236+
<div>{i18n('dashboard.title')}</div>
237+
<Iconfont code="&#xe631;" className={styles.plusIcon} onClick={() => setOpenAddDashboard(true)} />
238+
</div>
239+
{renderLeft()}
236240
</div>
237-
{renderLeft()}
238241
</div>
239242
<div className={styles.boxRight}>{renderContent()}</div>
240243
</DraggableContainer>

chat2db-client/src/pages/main/workspace/components/WorkspaceLeft/index.less

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
display: flex;
1515
justify-content: space-between;
1616
align-items: center;
17-
margin-bottom: 40px;
17+
margin-bottom: 34px;
1818
flex-shrink: 0;
1919
}
2020

@@ -81,7 +81,7 @@
8181

8282
.saveBoxList {
8383
margin: 0px -10px;
84-
height: calc(26px * 3);
84+
height: calc(26px * 3 + 6px);
8585
overflow-y: auto;
8686
}
8787

@@ -133,6 +133,14 @@
133133
font-weight: bold;
134134
}
135135
.iconBox {
136+
display: flex;
137+
align-items: center;
138+
}
139+
.refreshIcon {
140+
margin-right: 10px;
141+
}
142+
.refreshIcon,
143+
.searchIcon {
136144
cursor: pointer;
137145
&:hover {
138146
color: var(--color-primary);

chat2db-client/src/pages/main/workspace/components/WorkspaceLeft/index.tsx

Lines changed: 58 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,18 @@ const RenderTableBox = dvaModel(function (props: any) {
203203
setSearchedTableList(approximateTreeNode(curTableList, value))
204204
}
205205

206+
function refreshTableList() {
207+
if (curWorkspaceParams?.dataSourceId) {
208+
dispatch({
209+
type: 'workspace/fetchGetCurTableList',
210+
payload: {
211+
...curWorkspaceParams,
212+
extraParams: curWorkspaceParams,
213+
}
214+
})
215+
}
216+
}
217+
206218
return (
207219
<div className={styles.tableModule}>
208220
<div className={styles.leftModuleTitle}>
@@ -222,8 +234,13 @@ const RenderTableBox = dvaModel(function (props: any) {
222234
:
223235
<div className={styles.leftModuleTitleText}>
224236
<div className={styles.modelName}>{i18n('common.text.table')}</div>
225-
<div className={styles.iconBox} onClick={() => openSearch()}>
226-
<Iconfont code="&#xe600;" />
237+
<div className={styles.iconBox} >
238+
<div className={styles.refreshIcon} onClick={() => refreshTableList()}>
239+
<Iconfont code="&#xec08;" />
240+
</div>
241+
<div className={styles.searchIcon} onClick={() => openSearch()}>
242+
<Iconfont code="&#xe600;" />
243+
</div>
227244
</div>
228245
</div>
229246
}
@@ -308,7 +325,38 @@ const RenderSaveBox = dvaModel(function (props: any) {
308325
}
309326

310327
function deleteSaved(data: IConsole) {
311-
328+
let p: any = {
329+
id: data.id,
330+
};
331+
historyServer.deleteSavedConsole(p).then((res) => {
332+
dispatch({
333+
type: 'workspace/fetchGetSavedConsole',
334+
payload: {
335+
tabOpened: ConsoleOpenedStatus.IS_OPEN,
336+
...curWorkspaceParams
337+
},
338+
callback: (res: any) => {
339+
dispatch({
340+
type: 'workspace/setOpenConsoleList',
341+
payload: res.data,
342+
})
343+
}
344+
})
345+
dispatch({
346+
type: 'workspace/fetchGetSavedConsole',
347+
payload: {
348+
status: ConsoleStatus.RELEASE,
349+
orderByDesc: true,
350+
...curWorkspaceParams
351+
},
352+
callback: (res: any) => {
353+
dispatch({
354+
type: 'workspace/setConsoleList',
355+
payload: res.data,
356+
})
357+
}
358+
})
359+
});
312360
}
313361

314362
return (
@@ -330,8 +378,13 @@ const RenderSaveBox = dvaModel(function (props: any) {
330378
:
331379
<div className={styles.leftModuleTitleText}>
332380
<div className={styles.modelName}>{i18n('workspace.title.saved')}</div>
333-
<div className={styles.iconBox} onClick={() => openSearch()}>
334-
<Iconfont code="&#xe600;" />
381+
<div className={styles.iconBox} >
382+
{/* <div className={styles.refreshIcon} onClick={() => refreshTableList()}>
383+
<Iconfont code="&#xec08;" />
384+
</div> */}
385+
<div className={styles.searchIcon} onClick={() => openSearch()}>
386+
<Iconfont code="&#xe600;" />
387+
</div>
335388
</div>
336389
</div>
337390
}

chat2db-client/src/pages/main/workspace/components/WorkspaceRight/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ const WorkspaceRight = memo<IProps>(function (props) {
156156
return;
157157
}
158158
if (window!.status === 'DRAFT') {
159-
historyService.deleteWindowTab({ id: window!.id });
159+
historyService.deleteSavedConsole({ id: window!.id });
160160
} else {
161161
historyService.updateSavedConsole(p);
162162
}

chat2db-client/src/pages/main/workspace/components/WorkspaceRightItem/index.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,8 @@ const WorkspaceRightItem = memo<IProps>(function (props) {
6767
dispatch({
6868
type: 'workspace/fetchGetSavedConsole',
6969
payload: {
70-
pageNo: 1,
71-
pageSize: 999,
7270
status: ConsoleStatus.RELEASE,
71+
orderByDesc: true,
7372
...curWorkspaceParams,
7473
},
7574
callback: (res: any) => {

chat2db-client/src/service/history.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,14 @@ export interface IUpdateConsoleParams {
2323

2424
const saveConsole = createRequest<ICreateConsole, number>('/api/operation/saved/create', { method: 'post' });
2525

26-
const getWindowTab = createRequest<{ id: number }, number>('/api/operation/saved/:id', { method: 'get' });
26+
// orderByDesc true 降序
27+
const getWindowTab = createRequest<{ id: number, orderByDesc: boolean }, number>('/api/operation/saved/:id', { method: 'get' });
2728

2829
const updateSavedConsole = createRequest<Partial<IConsole> & {id: number}, number>('/api/operation/saved/update', { method: 'post' });
2930

3031
const getSavedConsoleList = createRequest<IGetSavedListParams, IPageResponse<IConsole>>('/api/operation/saved/list', {});
3132

32-
const deleteWindowTab = createRequest<{ id: number }, string>('/api/operation/saved/:id', { method: 'delete' });
33+
const deleteSavedConsole = createRequest<{ id: number }, string>('/api/operation/saved/:id', { method: 'delete' });
3334

3435
const createHistory = createRequest<ISaveBasicInfo, void>('/api/operation/log/create', { method: 'post' });
3536

@@ -40,7 +41,7 @@ export default {
4041
updateSavedConsole,
4142
getHistoryList,
4243
saveConsole,
43-
deleteWindowTab,
44+
deleteSavedConsole,
4445
createHistory,
4546
getWindowTab
4647
}

0 commit comments

Comments
 (0)