Skip to content

Commit 83daf3e

Browse files
committed
refactor: merge
1 parent 930c45b commit 83daf3e

File tree

3 files changed

+53
-49
lines changed

3 files changed

+53
-49
lines changed

frontend/src/i18n/zh-CN.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"back": "返回",
1010
"confirm": "确认",
1111
"cancel": "取消",
12+
"search": "查询",
1213
"system_manage": "系统管理",
1314
"update_success": "更新",
1415
"save_success": "保存成功",
@@ -24,7 +25,10 @@
2425
"folder": "目录",
2526
"dashboard": "仪表板",
2627
"delete_warning": "确定要删除吗?",
27-
"delete_success": "删除成功"
28+
"delete_resource_warn": "确定删除该{0}吗?",
29+
"delete_success": "删除成功",
30+
"new_folder": "新建目录",
31+
"new_dashboard": "新建仪表板"
2832
},
2933
"qa": {
3034
"New Conversation": "开启新问数",

frontend/src/views/dashboard/common/ResourceTree.vue

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ const state = reactive({
7676
7777
// @ts-ignore
7878
const {handleDrop, allowDrop, handleDragStart} = treeDraggableChart(
79-
state,
80-
'resourceTree',
81-
'dashboard'
79+
state,
80+
'resourceTree',
81+
'dashboard'
8282
)
8383
8484
@@ -224,7 +224,7 @@ onMounted(() => {
224224
const addOperation = (params: any) => {
225225
if (params.opt === 'newLeaf') {
226226
const newCanvasUrl = '#/canvas?opt=create' + (params?.id ? `&pid=${params?.id}` : '')
227-
window.open(newCanvasUrl, '_blank')
227+
window.open(newCanvasUrl, '_self')
228228
} else {
229229
// @ts-ignore
230230
resourceGroupOptRef.value?.optInit(params)
@@ -234,8 +234,8 @@ const addOperation = (params: any) => {
234234
const operation = (opt: string, data: SQTreeNode) => {
235235
if (opt === 'delete') {
236236
const msg = data.node_type === 'leaf' ? '' : t('dashboard.delete_tips')
237-
const tips_label = data.node_type === 'leaf' ? 'Dashboard' : t('dashboard.folder')
238-
ElMessageBox.confirm(t('dashboard.delete_warn', [tips_label]), {
237+
const tips_label = data.node_type === 'leaf' ? t('dashboard.dashboard') : t('dashboard.folder')
238+
ElMessageBox.confirm(t('dashboard.delete_resource_warn', [tips_label]), {
239239
confirmButtonType: 'danger',
240240
type: 'warning',
241241
tip: msg,
@@ -245,6 +245,7 @@ const operation = (opt: string, data: SQTreeNode) => {
245245
dashboardApi.delete_resource({id: data.id}).then(() => {
246246
ElMessage.success(t('dashboard.delete_success'))
247247
getTree()
248+
dashboardStore.setCurComponent(null)
248249
})
249250
})
250251
} else if (opt === 'rename') {
@@ -269,24 +270,24 @@ defineExpose({
269270
<div class="resource-tree">
270271
<div class="tree-header">
271272
<div class="icon-methods">
272-
<span class="title"> Dashboard </span>
273+
<span class="title">{{ t('dashboard.dashboard') }} </span>
273274
<div class="flex-align-center">
274-
<el-tooltip :content="'New Folder'" placement="top" effect="dark">
275+
<el-tooltip :content="t('dashboard.new_folder')" placement="top" effect="dark">
275276
<el-icon
276-
class="custom-icon btn"
277-
style="margin-right: 10px"
278-
@click="addOperation({opt:'newFolder',type:'folder',pid:'root'} )"
277+
class="custom-icon btn"
278+
style="margin-right: 10px"
279+
@click="addOperation({opt:'newFolder',type:'folder',pid:'root'} )"
279280
>
280281
<Icon name="dv-new-folder">
281282
<newFolder class="svg-icon"/>
282283
</Icon>
283284
</el-icon>
284285
</el-tooltip>
285-
<el-tooltip :content="'Add Dashboard'" placement="top" effect="dark">
286+
<el-tooltip :content="t('dashboard.new_dashboard')" placement="top" effect="dark">
286287
<el-icon
287-
class="custom-icon btn"
288-
style="margin-right: 10px"
289-
@click="addOperation({opt:'newLeaf',type:'dashboard'} )"
288+
class="custom-icon btn"
289+
style="margin-right: 10px"
290+
@click="addOperation({opt:'newLeaf',type:'dashboard'} )"
290291
>
291292
<Icon name="dv-new-folder">
292293
<icon_fileAdd_outlined class="svg-icon"/>
@@ -296,10 +297,10 @@ defineExpose({
296297
</div>
297298
</div>
298299
<el-input
299-
:placeholder="'Search'"
300-
v-model="filterText"
301-
clearable
302-
class="search-bar"
300+
:placeholder="t('common.search')"
301+
v-model="filterText"
302+
clearable
303+
class="search-bar"
303304
>
304305
<template #prefix>
305306
<el-icon>
@@ -314,21 +315,21 @@ defineExpose({
314315
</div>
315316
<el-scrollbar class="custom-tree" v-loading="copyLoading">
316317
<el-tree
317-
menu
318-
ref="resourceListTree"
319-
:default-expanded-keys="expandedArray"
320-
:data="state.resourceTree"
321-
:props="defaultProps"
322-
node-key="id"
323-
highlight-current
324-
:expand-on-click-node="true"
325-
:filter-node-method="filterNode"
326-
@node-expand="nodeExpand"
327-
@node-collapse="nodeCollapse"
328-
@node-click="nodeClick"
329-
@node-drag-start="handleDragStart"
330-
@node-drop="handleDrop"
331-
draggable
318+
menu
319+
ref="resourceListTree"
320+
:default-expanded-keys="expandedArray"
321+
:data="state.resourceTree"
322+
:props="defaultProps"
323+
node-key="id"
324+
highlight-current
325+
:expand-on-click-node="true"
326+
:filter-node-method="filterNode"
327+
@node-expand="nodeExpand"
328+
@node-collapse="nodeCollapse"
329+
@node-click="nodeClick"
330+
@node-drag-start="handleDragStart"
331+
@node-drop="handleDrop"
332+
draggable
332333
>
333334
<template #default="{ node, data }">
334335
<span class="custom-tree-node">
@@ -343,27 +344,26 @@ defineExpose({
343344
</span>
344345
<div class="icon-more">
345346
<el-icon
346-
v-on:click.stop
347-
v-if="data.node_type !== 'leaf'"
348-
class="hover-icon"
349-
@click="addOperation({opt:'newLeaf',type:'dashboard',id:data.id} )"
347+
v-on:click.stop
348+
v-if="data.node_type !== 'leaf'"
349+
class="hover-icon"
350+
@click="addOperation({opt:'newLeaf',type:'dashboard',id:data.id} )"
350351
>
351352
<Icon><icon_add_outlined class="svg-icon"/></Icon>
352353
</el-icon>
353354
<el-icon
354-
v-on:click.stop
355-
v-if="data.node_type === 'leaf'"
356-
class="hover-icon"
357-
@click="resourceEdit(data.id)"
355+
v-on:click.stop
356+
v-if="data.node_type === 'leaf'"
357+
class="hover-icon"
358+
@click="resourceEdit(data.id)"
358359
>
359360
<Icon><icon_edit_outlined class="svg-icon"/></Icon>
360361
</el-icon>
361362
<HandleMore
362-
@handle-command=" (opt:string) => operation(opt,data)"
363-
:menu-list="state.folderMenuList"
364-
:icon-name="icon_more_outlined"
365-
placement="bottom-start"
366-
v-if="data.node_type !== 'leaf'"
363+
@handle-command=" (opt:string) => operation(opt,data)"
364+
:menu-list="state.folderMenuList"
365+
:icon-name="icon_more_outlined"
366+
placement="bottom-start"
367367
></HandleMore>
368368
</div>
369369
</span>

frontend/src/views/dashboard/preview/SQPreviewHead.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const preview = () => {
99
window.open(`#/dashboard-preview?resourceId=${props.dashboardInfo.id}`, '_blank')
1010
}
1111
const edit = () => {
12-
window.open(`#/canvas?resourceId=${props.dashboardInfo.id}`, '_blank')
12+
window.open(`#/canvas?resourceId=${props.dashboardInfo.id}`, '_self')
1313
}
1414
const props = defineProps({
1515
dashboardInfo: {

0 commit comments

Comments
 (0)