fix: 优化 compose 删除提示信息 (#2437)

pull/2440/head
ssongliu 2023-10-07 15:52:47 +08:00 committed by GitHub
parent d8df9f755e
commit f004df42af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 8 deletions

View File

@ -661,7 +661,7 @@ const message = {
'The composition created through 1Panel editor or template will be saved in the {0}/docker/compose directory.',
deleteFile: 'Delete file',
deleteComposeHelper:
'Delete all files in the directory where the compose file is located, including persistent files in that directory. Please be cautious when performing this operation.',
'Delete all files in the {0} directory, including persistent files in this directory. Please proceed with caution!',
deleteCompose: '" Delete this composition.',
apps: 'Apps',
local: 'Local',

View File

@ -641,7 +641,7 @@ const message = {
composePathHelper: ': {0}',
composeHelper: ' 1Panel {0}/docker/compose ',
deleteFile: '',
deleteComposeHelper: '',
deleteComposeHelper: ' {0} ',
deleteCompose: '" ',
apps: '',
local: '',

View File

@ -641,7 +641,7 @@ const message = {
composePathHelper: ': {0}',
composeHelper: ' 1Panel {0}/docker/compose ',
deleteFile: '',
deleteComposeHelper: '',
deleteComposeHelper: ' {0} ',
deleteCompose: '" ',
apps: '',
local: '',

View File

@ -9,14 +9,14 @@
<el-form-item>
<el-checkbox v-model="deleteFile" :label="$t('container.deleteFile')" />
<span class="input-help">
{{ $t('container.deleteComposeHelper') }}
{{ $t('container.deleteComposeHelper', [loadComposeDir()]) }}
</span>
</el-form-item>
<el-form-item>
<div>
<span style="font-size: 12px">{{ $t('database.delete') }}</span>
<span style="font-size: 12px; color: red; font-weight: 500">{{ composeName }}</span>
<span style="font-size: 12px">{{ $t('container.deleteCompose') }}</span>
<div class="font">
<span>{{ $t('database.delete') }}</span>
<span class="warning">{{ composeName }}</span>
<span>{{ $t('container.deleteCompose') }}</span>
</div>
<el-input v-model="deleteInfo" :placeholder="composeName"></el-input>
</el-form-item>
@ -64,6 +64,15 @@ const acceptParams = async (prop: DialogProps) => {
dialogVisible.value = true;
};
const loadComposeDir = () => {
const parts = composePath.value.split('/');
if (parts.length <= 2) {
return '/';
}
const parentDirectory = parts.slice(0, -1).join('/');
return parentDirectory;
};
const submit = async () => {
loading.value = true;
let params = {
@ -88,3 +97,13 @@ defineExpose({
acceptParams,
});
</script>
<style lang="scss" scoped>
.font {
font-size: 12px;
.warning {
color: red;
font-weight: 500;
}
}
</style>