preff: 修改 applets hosts 详情

This commit is contained in:
ibuler 2022-11-02 17:23:25 +08:00
parent 7f6edc2749
commit a26b42fef8
11 changed files with 48 additions and 32 deletions

View File

@ -67,7 +67,7 @@ export default {
type: field.type, type: field.type,
value: name value: name
} }
if (field.type === 'choice' && field.choices) { if (['choice', 'labeled_choice'].indexOf(field.type) > -1 && field.choices) {
option.children = field.choices.map(item => { option.children = field.choices.map(item => {
if (typeof (item.value) === 'boolean') { if (typeof (item.value) === 'boolean') {
if (item.value) { if (item.value) {

View File

@ -1,7 +1,7 @@
<template> <template>
<Dialog <Dialog
v-if="showColumnSettingPopover" v-if="showColumnSettingPopover"
:title="$t('common.CustomCol')" :title="$tc('common.CustomCol')"
:visible.sync="showColumnSettingPopover" :visible.sync="showColumnSettingPopover"
:destroy-on-close="true" :destroy-on-close="true"
:show-cancel="false" :show-cancel="false"

View File

@ -169,6 +169,10 @@ export default {
line-height: 1.5; line-height: 1.5;
padding: 6px 0; padding: 6px 0;
font-size: 13px; font-size: 13px;
* {
vertical-align: middle;
}
} }
.el-table ::v-deep .el-table__row > td> div > span { .el-table ::v-deep .el-table__row > td> div > span {
text-overflow: ellipsis; text-overflow: ellipsis;

View File

@ -107,7 +107,7 @@ export default {
return config return config
}, },
tableUrl() { tableUrl() {
return this.tableConfig.url return this.tableConfig.url || ''
}, },
permissions() { permissions() {
// permissions url // permissions url

View File

@ -120,6 +120,5 @@ export default {
.icon { .icon {
width: 28px; width: 28px;
height: 28px; height: 28px;
vertical-align: middle;
} }
</style> </style>

View File

@ -289,6 +289,7 @@
"ReLoginErr": "登录时长已超过 5 分钟,请重新登录" "ReLoginErr": "登录时长已超过 5 分钟,请重新登录"
}, },
"common": { "common": {
"Publish": "发布",
"Icon": "图标", "Icon": "图标",
"DisplayName": "名称", "DisplayName": "名称",
"Automations": "自动化", "Automations": "自动化",
@ -1000,7 +1001,8 @@
} }
}, },
"applets": { "applets": {
"NoPublished": "未发布" "NoPublished": "未发布",
"PublishStatus": "发布状态"
}, },
"setting": { "setting": {
"Applets": "远程应用", "Applets": "远程应用",

View File

@ -215,7 +215,7 @@ export default {
component: () => import('@/views/settings/Applet'), component: () => import('@/views/settings/Applet'),
meta: { meta: {
title: i18n.t('setting.Applets'), title: i18n.t('setting.Applets'),
icon: 'tasks', icon: 'windows',
permissions: ['settings.change_terminal'] permissions: ['settings.change_terminal']
} }
}, },
@ -226,7 +226,8 @@ export default {
hidden: true, hidden: true,
meta: { meta: {
title: i18n.t('route.AppletHostCreate'), title: i18n.t('route.AppletHostCreate'),
permissions: ['settings.change_terminal'] permissions: ['settings.change_terminal'],
activeMenu: '/settings/applets'
} }
}, },
{ {
@ -236,7 +237,8 @@ export default {
hidden: true, hidden: true,
meta: { meta: {
title: i18n.t('route.AppletHostDetail'), title: i18n.t('route.AppletHostDetail'),
permissions: ['settings.change_terminal'] permissions: ['settings.change_terminal'],
activeMenu: '/settings/applets'
} }
}, },
{ {
@ -246,7 +248,8 @@ export default {
hidden: true, hidden: true,
meta: { meta: {
title: i18n.t('route.AppletHostUpdate'), title: i18n.t('route.AppletHostUpdate'),
permissions: ['settings.change_terminal'] permissions: ['settings.change_terminal'],
activeMenu: '/settings/applets'
} }
} }
] ]

View File

@ -1,7 +1,7 @@
import i18n from '@/i18n/i18n' import i18n from '@/i18n/i18n'
import { CronTab } from '@/components' import { CronTab } from '@/components'
var validatorInterval = (rule, value, callback) => { const validatorInterval = (rule, value, callback) => {
if (parseInt(value) < 1) { if (parseInt(value) < 1) {
return callback(new Error(i18n.t('xpack.ChangeAuthPlan.validatorMessage.EnsureThisValueIsGreaterThanOrEqualTo1'))) return callback(new Error(i18n.t('xpack.ChangeAuthPlan.validatorMessage.EnsureThisValueIsGreaterThanOrEqualTo1')))
} }

View File

@ -1,7 +1,7 @@
<template> <template>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :md="16" :sm="24"> <el-col :md="16" :sm="24">
<ListTable :table-config="config" /> <ListTable :table-config="config" :header-actions="headerConfig" />
</el-col> </el-col>
<el-col :md="8" :sm="24"> <el-col :md="8" :sm="24">
<QuickActions type="primary" :actions="quickActions" /> <QuickActions type="primary" :actions="quickActions" />
@ -9,9 +9,10 @@
</el-row> </el-row>
</template> </template>
<script> <script type="text/jsx">
import { ListTable, QuickActions } from '@/components' import { ListTable, QuickActions } from '@/components'
import { openTaskPage } from '@/utils/jms' import { openTaskPage } from '@/utils/jms'
import { DetailFormatter } from '@/components/TableFormatters'
export default { export default {
name: 'Publications', name: 'Publications',
components: { components: {
@ -26,35 +27,40 @@ export default {
}, },
data() { data() {
return { return {
headerConfig: {
hasImport: false
},
config: { config: {
url: `/api/v1/terminal/applet-publications/?host=${this.object.id}`, url: `/api/v1/terminal/applet-publications/?host=${this.object.id}`,
columns: [ columns: [
'applet.icon', 'applet.display_name', 'date_updated', 'status', 'applet.display_name', 'date_updated', 'status',
'actions' 'actions'
], ],
columnsMeta: { columnsMeta: {
'applet.icon': {
label: this.$t('common.Icon'),
align: 'center',
width: '60px',
formatter: (row) => {
return <img src={row.applet.icon} width='30' height='30' alt='icon'></img>
}
},
'applet.display_name': { 'applet.display_name': {
label: this.$t('common.DisplayName') label: this.$t('common.DisplayName'),
formatter: DetailFormatter,
formatterArgs: {
getIcon: ({ row }) => row.applet?.icon,
getTitle: ({ row }) => row.applet.display_name
}
}, },
status: { status: {
label: this.$t('common.Status'), label: this.$t('applets.PublishStatus'),
formatter: (row) => { formatter: (row) => {
if (!row.status) { const typeMapper = {
return <el-tag size='mini' type='danger'>{ this.$t('applets.NoPublished') }</el-tag> 'ready': 'info',
'pending': 'info',
'running': 'success',
'success': 'success',
'failed': 'danger'
} }
return row.status.label const tp = typeMapper[row.status.value] || 'info'
return <el-tag size='mini' type={tp}>{ row.status.label }</el-tag>
} }
}, },
date_updated: { date_updated: {
label: '发布日期' label: '日期'
}, },
actions: { actions: {
formatterArgs: { formatterArgs: {
@ -82,10 +88,10 @@ export default {
} }
}, },
{ {
title: '同步所有应用', title: '发布所有应用',
attrs: { attrs: {
type: 'primary', type: 'primary',
label: this.$t('common.Sync') label: this.$t('common.Publish')
}, },
callbacks: { callbacks: {
click: function() { click: function() {

View File

@ -69,10 +69,10 @@ export default {
} }
}, },
{ {
title: '同步所有应用', title: '发布所有应用',
attrs: { attrs: {
type: 'primary', type: 'primary',
label: this.$t('common.Sync') label: this.$t('common.Publish')
}, },
callbacks: { callbacks: {
click: function() { click: function() {

View File

@ -38,7 +38,9 @@ export default {
protocols: { protocols: {
label: this.$t('assets.Protocols'), label: this.$t('assets.Protocols'),
formatter: (row) => { formatter: (row) => {
return row.protocols.map(p => <el-tag size='mini' class='protocol'>{p.name}/{p.port} </el-tag>) return row.protocols.map((p, i) => {
return <el-tag size='mini' class='protocol'>{p.name}/{p.port}</el-tag>
})
} }
}, },
actions: { actions: {