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 b1f0a66 commit 1375916
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 13 deletions.
3 changes: 3 additions & 0 deletions dbm-ui/frontend/src/locales/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -3655,5 +3655,8 @@
"全站搜索,支持多对象,Shift + Enter 换行,Enter键开启搜索": "全站搜索,支持多对象,Shift + Enter 换行,Enter键开启搜索",
"全站搜索,支持多对象,Enter开启搜索": "全站搜索,支持多对象,Enter开启搜索",
"同主机关联的其他集群,勾选后一并添加": "同主机关联的其他集群,勾选后一并添加",
"点击上传": "点击上传",
"请选择本地 SQL 文件": "请选择本地 SQL 文件",
"这行勿动!新增翻译请在上一行添加!": ""

}
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 1375916

Please sign in to comment.