add bilingual text

This commit is contained in:
ann 2024-05-13 16:57:55 +08:00
parent d7447c4039
commit b6d78f8ddd
21 changed files with 127 additions and 105 deletions

View File

@ -33,7 +33,8 @@
"submitSuccess": "提交成功",
"verificationFailed": "验证失败",
"isDeleteLog": "是否要删除该条日志",
"isDeleteResource": "是否要删除该资源"
"isDeleteResource": "是否要删除该资源",
"deleteConfirmText": "您确定要删除吗?"
},
"menu": {
"taskManagement": "Task",
@ -69,6 +70,7 @@
"volume": "Volumes",
"image": "Images",
"network": "Networking",
"cpu": "CPU",
"namespace": "Namespaces",
"virtualMachineMana": "VM Management",
"systemManagement": "System Management",
@ -365,7 +367,7 @@
"memoryUsageTop": "节点内存用量",
"resourceUsage": "集群资源使用情况",
"resource": "资源",
"used": "已使用",
"used": "Used",
"allNum": "总数",
"adapterNum": "适配器总数",
"stackNum": "软件栈总数",
@ -398,6 +400,9 @@
"apiInfo": "新增接口,需要在角色管理内配置权限才可使用",
"apiPath": "API路径",
"apiGroup": "API分组",
"apiDesc": "API描述"
"apiDesc": "API描述",
"nodeList": "节点列表",
"flavor": "规格",
"IPAddress": "IP地址"
}
}

View File

@ -33,7 +33,8 @@
"submitSuccess": "提交成功",
"verificationFailed": "验证失败",
"isDeleteLog": "是否要删除该条日志",
"isDeleteResource": "是否要删除该资源"
"isDeleteResource": "是否要删除该资源",
"deleteConfirmText": "您确定要删除吗?"
},
"menu": {
"taskManagement": "任务管理",
@ -69,6 +70,7 @@
"volume": "卷",
"image": "镜像",
"network": "网络",
"cpu": "CPU",
"namespace": "命名空间",
"virtualMachineMana": "虚拟机管理",
"systemManagement": "系统管理",
@ -398,6 +400,9 @@
"apiInfo": "新增接口,需要在角色管理内配置权限才可使用",
"apiPath": "API路径",
"apiGroup": "API分组",
"apiDesc": "API描述"
"apiDesc": "API描述",
"nodeList": "节点列表",
"flavor": "规格",
"IPAddress": "IP地址"
}
}

View File

@ -240,10 +240,10 @@ export default {
},
// or
deleteItem(row) {
this.$confirm(`您确定要删除吗?`, { type: 'warning' }).then(() => {
this.$confirm(this.$t('message.deleteConfirmText'), { type: 'warning' }).then(() => {
deleteService({ address: this.$route.query.ip, path: `/core-metadata/api/v2/${this.activeName === '2' ? 'device' : 'deviceprofile'}/name/` + row.name }).then(e => {
if (e.code === 200) {
this.$message.success('删除成功')
this.$message.success(this.$t('page.deleteSuccess'))
this.tabSwitch()
}
})

View File

@ -10,14 +10,14 @@ export default {
deleteCurrent(text, name, namespace, classification, from) {
const pattern = newEval('/' + name + '/')
this.$prompt(`请输入${text}名称${name}确保您已了解操作所带来的风险。`, `${text}删除确认?`, {
confirmButtonText: '确定',
cancelButtonText: '取消',
confirmButtonText: this.$t('message.confirm'),
cancelButtonText: this.$t('message.cancel'),
inputPattern: pattern,
inputErrorMessage: '不匹配'
}).then(({ value }) => {
// 删除接口 成功后
this.$Api.deleteCurrent(this.clusterName, namespace, name, classification).then(res => {
this.$message.success('删除成功')
this.$message.success(this.$t('page.deleteSuccess'))
if (from === 'list') {
if (text === '项目' || text === '容器节点') {
this.getList()

View File

@ -51,7 +51,7 @@ service.interceptors.response.use(
if (res?.code === 401) {
MessageBox.confirm('您的登录已过期或者当前账号没有权限,是否重新登录?', '无权限', {
confirmButtonText: '重新登录',
cancelButtonText: '取消',
cancelButtonText: this.$t('message.cancel'),
type: 'warning'
}).then(() => {
store.dispatch('user/resetToken').then(() => {
@ -82,7 +82,7 @@ service.interceptors.response.use(
if (error?.response?.status === 401) {
MessageBox.confirm('您的登录已过期或者当前账号没有权限,是否重新登录?', '无权限', {
confirmButtonText: '重新登录',
cancelButtonText: '取消',
cancelButtonText: this.$t('message.cancel'),
type: 'warning'
}).then(() => {
store.dispatch('user/resetToken').then(() => {

View File

@ -333,7 +333,7 @@ export default {
break
case 'redeploy' :
this.$alert(`您确定重新创建${this.tabMapOptions[this.activeTab]} ${this.$route.params.name} 吗?, 容器组副本将会根据更新策略更新,同时相关业务将会中断。`, '重新创建', {
confirmButtonText: '确定',
confirmButtonText: this.$t('message.confirm'),
callback: (res) => {
if (res === 'confirm') {
const params = this.baseInfo

View File

@ -215,7 +215,7 @@ export default {
//
reDeploy(row) {
this.$alert(`您确定重新创建${this.tabMapOptions[this.activeName].label} ${row.metadata.name} 吗?, 容器组副本将会根据更新策略更新,同时相关业务将会中断。`, '重新创建', {
confirmButtonText: '确定',
confirmButtonText: this.$t('message.confirm'),
callback: () => {
const params = row
params.spec.template.spec.containers = params.spec.template.spec.containers.map(n => ({

View File

@ -73,9 +73,9 @@ export default {
this.$refs.multipleTable.getList()
},
deleteCluster(row) {
this.$confirm(`您确定要删除吗?`, { type: 'warning' }).then(() => {
this.$confirm(this.$t('message.deleteConfirmText'), { type: 'warning' }).then(() => {
deleteCluster({ cluster_name: row.cluster_name, domain_id: row.domain_id }).then(e => {
this.$message.success('删除成功')
this.$message.success(this.$t('page.deleteSuccess'))
setTimeout(this.getList, 3000)
})
})

View File

@ -86,9 +86,9 @@ export default {
this.$router.push({ name: `${localStorage.getItem('monitorPage') === 'false' ? 'NodeManagement' : 'clusterOverview'}`, params: { 'clusterName': row.cluster_name }})
},
deleteCluster(row) {
this.$confirm(`您确定要删除吗?`, { type: 'warning' }).then(() => {
this.$confirm(this.$t('message.deleteConfirmText'), { type: 'warning' }).then(() => {
deleteCluster({ cluster_name: row.cluster_name, domain_id: row.domain_id }).then(e => {
this.$message.success('删除成功')
this.$message.success(this.$t('page.deleteSuccess'))
setTimeout(this.getList, 3000)
})
})

View File

@ -175,11 +175,11 @@ export default {
}
},
deleteLabelFun(data) {
this.$confirm(`您确定要删除吗?`, { type: 'warning' }).then(() => {
this.$confirm(this.$t('message.deleteConfirmText'), { type: 'warning' }).then(() => {
if (this.activeName === '0') {
deleteLabelType(data).then(res => {
if (res.code === 200) {
this.$message.success('删除成功')
this.$message.success(this.$t('page.deleteSuccess'))
this.$emit('getList')
this.getList()
}
@ -187,7 +187,7 @@ export default {
} else if (this.activeName === '1') {
deleteLabel(data).then(res => {
if (res.code === 200) {
this.$message.success('删除成功')
this.$message.success(this.$t('page.deleteSuccess'))
this.$emit('getList')
this.getList()
}
@ -198,7 +198,7 @@ export default {
labels: data.labels
}).then(res => {
if (res.code === 200) {
this.$message.success('删除成功')
this.$message.success(this.$t('page.deleteSuccess'))
this.$emit('getList')
this.getList()
}

View File

@ -87,10 +87,10 @@ export default {
},
methods: {
deleteLabelFun(data) {
this.$confirm(`您确定要删除吗?`, { type: 'warning' }).then(() => {
this.$confirm(this.$t('message.deleteConfirmText'), { type: 'warning' }).then(() => {
deletePropagationTemplate(data).then(res => {
if (res.code === 200) {
this.$message.success('删除成功')
this.$message.success(this.$t('page.deleteSuccess'))
this.$emit('getList')
this.getList()
}

View File

@ -167,9 +167,9 @@ export default {
this.role = Object.assign({}, defaultRole)
},
handleRoleDelete(index, row) {
this.$confirm('是否要删除该角色?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
this.$confirm('是否要删除该角色?', this.$t('page.info'), {
confirmButtonText: this.$t('message.confirm'),
cancelButtonText: this.$t('message.cancel'),
type: 'warning'
}).then(() => {
deleteRole({ id: row.id + '' }).then(response => {

View File

@ -220,9 +220,9 @@ export default {
this.admin = Object.assign({}, defaultAdmin)
},
handleStatusChange(row) {
this.$confirm('是否要修改该状态?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
this.$confirm('是否要修改该状态?', this.$t('page.info'), {
confirmButtonText: this.$t('message.confirm'),
cancelButtonText: this.$t('message.cancel'),
type: 'warning'
}).then(() => {
switchStatus({ id: row.id, status: !row.status }).then(response => {
@ -235,9 +235,9 @@ export default {
})
},
handleDelete(id) {
this.$confirm('是否要删除该用户?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
this.$confirm('是否要删除该用户?', this.$t('page.info'), {
confirmButtonText: this.$t('message.confirm'),
cancelButtonText: this.$t('message.cancel'),
type: 'warning'
}).then(() => {
deleteUser({ id }).then(response => {

View File

@ -283,7 +283,7 @@ export default {
deleteDict(item) {
deleteDictById(item.id).then(res => {
if (res.code === 200) {
this.$message.success('删除成功')
this.$message.success(this.$t('page.deleteSuccess'))
this.getList()
}
})
@ -301,10 +301,10 @@ export default {
this.dialogItemFormVisible = true
},
deleteItem(item) {
this.$confirm(`您确定要删除吗?`, { type: 'warning' }).then(() => {
this.$confirm(this.$t('message.deleteConfirmText'), { type: 'warning' }).then(() => {
deleteItemById(item.id).then(res => {
if (res.code === 200) {
this.$message.success('删除成功')
this.$message.success(this.$t('page.deleteSuccess'))
this.$refs.multipleTable.getList()
}
})

View File

@ -3,6 +3,7 @@
<el-card>
<List
ref="multipleTable"
:key="$i18n.locale"
class="multipleTable"
:columns="columns"
:get-list-action="getDataVolumeList"
@ -13,21 +14,21 @@
list-key="volumes"
>
<template v-slot:filterBtns>
<el-button size="medium" type="primary" @click="creation">创建</el-button>
<el-button size="medium" type="primary" @click="creation">{{ $t('message.create') }}</el-button>
</template>
</List>
</el-card>
<Yaml v-if="dialogYamlFormVisible" v-model="dialogYamlFormVisible" :name="yamlName" :namespace="yamlNamespace" :is-edit="editYaml" :get-yaml="getDataVolumeYaml" :put-yaml="putDataVolumeYaml" />
<el-dialog
:close-on-click-modal="false"
title="您确定要删除吗?"
:title="$t('message.deleteConfirmText')"
:visible.sync="deleteDialogVisible"
width="30%"
>
<span>您试图删除卷<a @click="viewVolumeDetail(clickrow)"><u>{{ clickrow.name }}</u></a></span>
<span slot="footer" class="dialog-footer">
<el-button @click="deleteDialogVisible = false"> </el-button>
<el-button type="primary" @click="deleteDataVolumes(clickrow.name, clickrow.namespace)"> </el-button>
<el-button @click="deleteDialogVisible = false">{{ $t('message.cancel') }}</el-button>
<el-button type="primary" @click="deleteDataVolumes(clickrow.name, clickrow.namespace)">{{ $t('message.confirm') }}</el-button>
</span>
</el-dialog>
</div>
@ -52,8 +53,22 @@ export default {
dialogFormVisible: false,
yamlName: '',
yamlNamespace: '',
editYaml: false,
columns: [
editYaml: false
}
},
computed: {
clusterName() {
return localStorage.getItem('clusterName')
},
columns() {
return this.setColumn()
}
},
created() {
},
methods: {
setColumn() {
return [
{ prop: 'status', label: '状态', formatter: (row) => { return <el-tag type='info'>{row.status}</el-tag> } },
{ prop: 'name', label: '名称', sortable: true, formatter: (row) => { return <a onClick={() => this.viewVolumeDetail(row)}>{row.name || row.id}</a> } },
{ prop: 'size', label: '大小', formatter: (row) => {
@ -87,16 +102,7 @@ export default {
}
}
]
}
},
computed: {
clusterName() {
return localStorage.getItem('clusterName')
}
},
created() {
},
methods: {
},
viewVolumeDetail(row) {
this.$router.push({ path: `dataVolume/detail`, query: { name: row.name }})
},
@ -136,18 +142,18 @@ export default {
// async deleteDataVolumes(name, namespace) {
// await deleteDataVolume(name, namespace).then(res => {
// this.deleteDialogVisible = false
// this.$message.success('')
// this.$message.success(this.$t('page.deleteSuccess'))
// })
// this.$refs.multipleTable.getList()
// }
deleteItem(row) {
this.$confirm('确认删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
this.$confirm(this.$t('message.deleteConfirmText'), this.$t('page.info'), {
confirmButtonText: this.$t('message.confirm'),
cancelButtonText: this.$t('message.cancel'),
type: 'warning'
}).then(() => {
deleteDataVolume(row.id, this.clusterName).then(() => {
this.$message.success('删除成功')
this.$message.success(this.$t('page.deleteSuccess'))
this.$refs.multipleTable.getList()
})
})

View File

@ -20,14 +20,14 @@
<el-dialog
:close-on-click-modal="false"
title="您确定要删除吗?"
:title="$t('message.deleteConfirmText')"
:visible.sync="deleteDialogVisible"
width="30%"
>
<span>您试图删除 镜像 {{ clickrow.name }} </span>
<span slot="footer" class="dialog-footer">
<el-button @click="deleteDialogVisible = false"> </el-button>
<el-button type="primary" @click="deleteDataImage(clickrow.name, clickrow.namespace)"> </el-button>
<el-button @click="deleteDialogVisible = false">{{ $t('message.cancel') }}</el-button>
<el-button type="primary" @click="deleteDataImage(clickrow.name, clickrow.namespace)">{{ $t('message.confirm') }}</el-button>
</span>
</el-dialog>
<Yaml v-if="dialogYamlFormVisible" v-model="dialogYamlFormVisible" :name="yamlName" :namespace="yamlNamespace" :is-edit="editYaml" :get-yaml="getImagesYaml" :put-yaml="putImagesYaml" />
@ -127,7 +127,7 @@ export default {
async deleteDataImage(name, namespace) {
await deleteImage(name, this.clusterName).then(() => {
this.deleteDialogVisible = false
this.$message.success('删除成功')
this.$message.success(this.$t('page.deleteSuccess'))
})
this.$refs.multipleTable.getList()
}

View File

@ -13,7 +13,7 @@
list-key="servers"
>
<template v-slot:filterBtns>
<el-button size="medium" type="primary" @click="creation">创建</el-button>
<el-button size="medium" type="primary" @click="creation">{{ $t('message.create') }}</el-button>
</template>
</List>
</el-card>
@ -25,8 +25,8 @@
>
<p>注意!此操作会迁移当前节点上的所有虚拟机!</p>
<span slot="footer" class="dialog-footer">
<el-button @click="maintainDialogVisible = false"> </el-button>
<el-button type="primary" @click="maintainEnable()"> </el-button>
<el-button @click="maintainDialogVisible = false">{{ $t('message.cancel') }}</el-button>
<el-button type="primary" @click="maintainEnable()">{{ $t('message.confirm') }}</el-button>
</span>
</el-dialog>
</div>
@ -112,13 +112,13 @@ export default {
this.$router.push({ path: `instance/detail`, query: { name: row.name }})
},
deleteItem(row) {
this.$confirm('确认删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
this.$confirm(this.$t('message.deleteConfirmText'), this.$t('page.info'), {
confirmButtonText: this.$t('message.confirm'),
cancelButtonText: this.$t('message.cancel'),
type: 'warning'
}).then(() => {
deleteInstance(row.id, this.clusterName).then(() => {
this.$message.success('删除成功')
this.$message.success(this.$t('page.deleteSuccess'))
this.$refs.multipleTable.getList()
})
})

View File

@ -13,7 +13,7 @@
list-key="networks"
>
<template v-slot:filterBtns>
<el-button size="medium" type="primary" @click="createItem">创建</el-button>
<el-button size="medium" type="primary" @click="createItem">{{ $t('message.create') }}</el-button>
</template>
</List>
</el-card>
@ -43,8 +43,8 @@
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="dialogNetworkVisible = false"> </el-button>
<el-button type="primary" size="small" @click="handleDialogConfirm()"> </el-button>
<el-button size="small" @click="dialogNetworkVisible = false">{{ $t('message.cancel') }}</el-button>
<el-button type="primary" size="small" @click="handleDialogConfirm()">{{ $t('message.confirm') }}</el-button>
</span>
</el-dialog>
<el-dialog
@ -103,8 +103,8 @@
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="dialogSubnetVisible = false"> </el-button>
<el-button type="primary" size="small" @click="handleSubnetDialogConfirm()"> </el-button>
<el-button size="small" @click="dialogSubnetVisible = false">{{ $t('message.cancel') }}</el-button>
<el-button type="primary" size="small" @click="handleSubnetDialogConfirm()">{{ $t('message.confirm') }}</el-button>
</span>
</el-dialog>
<el-dialog
@ -115,8 +115,8 @@
>
<p>注意!此操作会迁移当前节点上的所有虚拟机!</p>
<span slot="footer" class="dialog-footer">
<el-button @click="maintainDialogVisible = false"> </el-button>
<el-button type="primary" @click="maintainEnable()"> </el-button>
<el-button @click="maintainDialogVisible = false">{{ $t('message.cancel') }}</el-button>
<el-button type="primary" @click="maintainEnable()">{{ $t('message.confirm') }}</el-button>
</span>
</el-dialog>
</div>
@ -229,13 +229,13 @@ export default {
this.$router.push({ path: `host/detail`, query: { name: row.name }})
},
deleteItem(row) {
this.$confirm('确认删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
this.$confirm(this.$t('message.deleteConfirmText'), this.$t('page.info'), {
confirmButtonText: this.$t('message.confirm'),
cancelButtonText: this.$t('message.cancel'),
type: 'warning'
}).then(() => {
deleteNetwork(row.id, this.clusterName).then(() => {
this.$message.success('删除成功')
this.$message.success(this.$t('page.deleteSuccess'))
this.$refs.multipleTable.getList()
})
})

View File

@ -4,16 +4,16 @@
<!-- <el-card>主机
<div><span>{{ counts.host }}</span><img src="../../../src/assets/images/virtual-1.png"></div>
</el-card> -->
<el-card>虚拟机
<el-card>{{ $t('menu.virtualMachine') }}
<div><span>{{ counts.virtualMachine }}</span><img src="../../../assets/images/virtual-2.png"></div>
</el-card>
<el-card>网络
<el-card>{{ $t('menu.network') }}
<div><span>{{ counts.networking }}</span><img src="../../../assets/images/virtual-3.png"></div>
</el-card>
<el-card>镜像
<el-card>{{ $t('menu.image') }}
<div><span>{{ counts.mirror }}</span><img src="../../../assets/images/virtual-4.png"></div>
</el-card>
<el-card>存储卷
<el-card>{{ $t('menu.volume') }}
<div><span>{{ counts.volume }}</span><img src="../../../assets/images/virtual-5.png"></div>
</el-card>
</div>
@ -21,32 +21,33 @@
<el-row :gutter="5">
<el-col :span="8">
<el-card class="virtualMachineChart">
<div>cpu</div>
<div>{{ $t('menu.cpu') }}</div>
<div id="cpuGauge" ref="cpuGauge" />
<p>已使用 {{ cpuUsage }}/{{ cpuTotal }}</p>
<p>{{ $t('page.used') }} {{ cpuUsage }}/{{ cpuTotal }}</p>
</el-card>
</el-col>
<el-col :span="8">
<el-card class="virtualMachineChart">
<div>内存</div>
<div>{{ $t('page.memory') }}</div>
<div id="memoryGauge" ref="memoryGauge" />
<p>已使用 {{ memoryUsage }}/{{ memoryTotal }}</p>
<p>{{ $t('page.used') }} {{ memoryUsage }}/{{ memoryTotal }}</p>
</el-card>
</el-col>
<el-col :span="8">
<el-card class="virtualMachineChart">
<div>存储</div>
<div>{{ $t('page.storage') }}</div>
<div id="storageGauge" ref="storageGauge" />
<p>已使用 {{ storageUsage }} / {{ storageTotal }} TiB</p>
<p>{{ $t('page.used') }} {{ storageUsage }} / {{ storageTotal }} TiB</p>
</el-card>
</el-col>
</el-row>
<el-card class="virtualMachineChart">
<div>节点列表</div>
<div>{{ $t('page.nodeList') }}</div>
<List
ref="multipleTable"
:key="$i18n.locale"
:table-list-data="listData"
:pagination="true"
:pagination-auto="true"
@ -80,16 +81,6 @@ export default {
mirror: '',
volume: ''
},
columns: [
{ prop: 'name', label: '集群名称' },
{ prop: 'flavor', label: '规格', formatter: (row) => { return row.flavor !== '' ? this.getText('flavor', row.flavor) : '' } },
{ prop: 'image', label: '镜像', formatter: (row) => { return row.image !== '' ? this.getText('image', row.image) : '' } },
{ prop: 'status', label: '状态' },
{ prop: 'ip', label: 'IP地址' },
{ prop: 'created', label: '创建时间', formatter: (row) => {
return <span>{new Date(row.created).toLocaleString()}</span>
} }
],
listData: [
],
cpuTotal: 0,
@ -108,6 +99,9 @@ export default {
},
jcceTheme() {
return localStorage.getItem('jcceTheme')
},
columns() {
return this.setColumn()
}
},
mounted() {
@ -147,6 +141,18 @@ export default {
})
},
methods: {
setColumn() {
return [
{ prop: 'name', label: this.$t('page.clusterName') },
{ prop: 'flavor', label: this.$t('page.flavor'), formatter: (row) => { return row.flavor !== '' ? this.getText('flavor', row.flavor) : '' } },
{ prop: 'image', label: this.$t('menu.image'), formatter: (row) => { return row.image !== '' ? this.getText('image', row.image) : '' } },
{ prop: 'status', label: this.$t('page.status') },
{ prop: 'ip', label: this.$t('page.IPAddress') },
{ prop: 'created', label: this.$t('page.creationTime'), formatter: (row) => {
return <span>{new Date(row.created).toLocaleString()}</span>
} }
]
},
getText(type, id) {
const list = (type === 'flavor' ? this.flavorLists : this.imageLists)
let text = ''

View File

@ -136,7 +136,7 @@
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false"> </el-button>
<el-button @click="dialogFormVisible = false">{{ $t('message.cancel') }}</el-button>
<el-button type="primary" @click="postSSHKey"> </el-button>
</div>
</el-dialog>

View File

@ -113,14 +113,14 @@ export default {
},
methods: {
deleteRow(row) {
this.$confirm('是否要删除该告警', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
this.$confirm(this.$t('message.deleteConfirmText'), this.$t('page.info'), {
confirmButtonText: this.$t('message.confirm'),
cancelButtonText: this.$t('message.cancel'),
type: 'warning'
}).then(() => {
deleteWarning(row.id).then(response => {
this.$message({
message: '删除成功',
message: this.$t('page.deleteSuccess'),
type: 'success',
duration: 1000
})