Skip to content

Commit

Permalink
fix(frontend): sql文件展示问题修复 TencentBlueKing#8261
Browse files Browse the repository at this point in the history
  • Loading branch information
jinquantianxia committed Nov 28, 2024
1 parent a172a46 commit f633f94
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 14 deletions.
2 changes: 2 additions & 0 deletions dbm-ui/frontend/src/locales/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -3677,5 +3677,7 @@
"冷_热节点规格": "冷_热节点规格",
"同主机关联的其他集群,勾选后一并添加": "同主机关联的其他集群,勾选后一并添加",
"密码不符合规则": "密码不符合规则",
"点击上传": "点击上传",
"请选择本地 SQL 文件": "请选择本地 SQL 文件",
"这行勿动!新增翻译请在上一行添加!": ""
}
2 changes: 1 addition & 1 deletion dbm-ui/frontend/src/types/auto-imports.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ declare global {
// for type re-export
declare global {
// @ts-ignore
export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue'
export type { Component, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue'
import('vue')
}
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,12 @@
watch(
filenameList,
() => {
localList.value = filenameList.value.map((fileName) => ({
id: fileName,
name: fileName,
}));
if (filenameList.value.length) {
localList.value = filenameList.value.map((fileName) => ({
id: fileName,
name: fileName,
}));
}
},
{
immediate: true,
Expand All @@ -182,6 +184,7 @@
};
const handleRemove = (filename: string) => {
modelValue.value = filename;
const lastesfilenameList = [...filenameList.value];
_.remove(lastesfilenameList, (item) => item === filename);
filenameList.value = lastesfilenameList;
Expand All @@ -208,18 +211,18 @@
.sql-execute-render-file-list {
height: 100%;
border-right: 1px solid #3d3d40;
background: #2e2e2e;
border-right: 1px solid #3d3d40;
.file-list-header {
display: flex;
height: 40px;
padding: 0 16px;
margin-bottom: 16px;
font-weight: bold;
line-height: 16px;
color: #fff;
display: flex;
align-items: center;
margin-bottom: 16px;
}
.file-list-wrapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,11 @@
}
isInnerChange = true;
modelValue.value = uploadFileNameList.value.map(
(localFileName) => uploadFileDataMap.value[localFileName].realFilePath,
);
if (uploadFileNameList.value.length) {
modelValue.value = uploadFileNameList.value.map(
(localFileName) => uploadFileDataMap.value[localFileName].realFilePath,
);
}
emits('grammar-check', true, true);
};
Expand Down Expand Up @@ -279,7 +281,7 @@
delete lastUploadFileDataMap[fileName];
uploadFileDataMap.value = lastUploadFileDataMap;
// 如果删除的是当前选中的文件,则重新选择第一个文件
// // 如果删除的是当前选中的文件,则重新选择第一个文件
if (fileName === selectFileName.value && uploadFileNameList.value.length > 0) {
[selectFileName.value] = uploadFileNameList.value;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@
active: fileItemData.name === modelValue,
}"
@click="handleClick(fileItemData.name)">
<span v-overflow-tips>{{ getSQLFilename(fileItemData.name) }}</span>
<span
v-overflow-tips
class="file-name">
{{ getSQLFilename(fileItemData.name) }}
</span>
</div>
</div>
</div>
Expand Down Expand Up @@ -84,10 +88,13 @@
}
.sql-execute-sql-file-list {
display: flex;
width: 238px;
height: 500px;
height: calc(100vh - 120px);
padding-top: 18px;
overflow-y: auto;
border-right: 1px solid #3d3d40;
flex-direction: column;
.file-list-title {
padding: 0 16px;
Expand Down Expand Up @@ -131,6 +138,13 @@
& ~ .file-item {
margin-top: 8px;
}
.file-name {
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
}
}
Expand Down

0 comments on commit f633f94

Please sign in to comment.