mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-19 09:43:32 +00:00
pref: 修改组件的状态
This commit is contained in:
@@ -89,6 +89,9 @@ export default {
|
||||
this.$log.debug('Total fields: ', this.totalFields)
|
||||
},
|
||||
_cleanFormValue(form, remoteMeta) {
|
||||
if (!form) {
|
||||
form = {}
|
||||
}
|
||||
for (const [k, v] of Object.entries(remoteMeta)) {
|
||||
let valueSet = form[k]
|
||||
if (v.type === 'nested object' && v.children) {
|
||||
|
@@ -18,10 +18,8 @@ export default {
|
||||
type: Object,
|
||||
default() {
|
||||
return {
|
||||
iconChoices: {
|
||||
},
|
||||
classChoices: {
|
||||
},
|
||||
iconChoices: {},
|
||||
classChoices: {},
|
||||
hasTips: false,
|
||||
useIcon: false,
|
||||
useText: true,
|
||||
@@ -39,7 +37,7 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
key() {
|
||||
return this.cellValue['value']
|
||||
return this.cellValue ? this.cellValue['value'] : ''
|
||||
},
|
||||
icon() {
|
||||
return this.formatterArgs.iconChoices[this.key] || ''
|
||||
|
@@ -289,6 +289,7 @@
|
||||
"ReLoginErr": "登录时长已超过 5 分钟,请重新登录"
|
||||
},
|
||||
"common": {
|
||||
"Version": "版本",
|
||||
"Publish": "发布",
|
||||
"Icon": "图标",
|
||||
"DisplayName": "名称",
|
||||
@@ -918,7 +919,8 @@
|
||||
"Applets": "远程应用",
|
||||
"AppletHosts": "应用发布机",
|
||||
"uploadZipTips": "请上传zip格式的文件",
|
||||
"HostDeployment": "发布机部署"
|
||||
"HostDeployment": "发布机部署",
|
||||
"TerminalStat": "CPU/内存/磁盘"
|
||||
},
|
||||
"sessions": {
|
||||
"SetToDefaultStorage": "设置为默认存储",
|
||||
|
@@ -92,7 +92,7 @@ export default {
|
||||
{
|
||||
path: ':id',
|
||||
name: 'TerminalDetail',
|
||||
component: () => import('@/views/settings/Terminal/TerminalDetail'),
|
||||
component: () => import('@/views/settings/Terminal/Component/TerminalDetail'),
|
||||
meta: {
|
||||
title: i18n.t('route.Terminal'),
|
||||
permissions: ['terminal.view_terminal']
|
||||
@@ -102,7 +102,7 @@ export default {
|
||||
{
|
||||
path: ':id/update',
|
||||
name: 'TerminalUpdate',
|
||||
component: () => import('@/views/settings/Terminal/TerminalUpdate'),
|
||||
component: () => import('@/views/settings/Terminal/Component/TerminalUpdate'),
|
||||
meta: {
|
||||
title: i18n.t('route.Terminal'),
|
||||
permissions: ['terminal.change_terminal']
|
||||
|
@@ -14,7 +14,7 @@ export default {
|
||||
config: {
|
||||
url: '/api/v1/terminal/applet-hosts/?oid=RemoteAppHost',
|
||||
addFields: [
|
||||
[this.$t('common.Automations'), ['account_automation', 'deploy_options'], 3]
|
||||
[this.$t('common.Automations'), ['deploy_options'], 3]
|
||||
],
|
||||
addFieldsMeta: {
|
||||
deploy_options: {
|
||||
|
@@ -33,8 +33,8 @@ export default {
|
||||
config: {
|
||||
url: `/api/v1/terminal/applet-publications/?host=${this.object.id}`,
|
||||
columns: [
|
||||
'applet.display_name', 'date_updated', 'status',
|
||||
'actions'
|
||||
'applet.display_name', 'applet.version',
|
||||
'date_updated', 'status', 'actions'
|
||||
],
|
||||
columnsMeta: {
|
||||
'applet.display_name': {
|
||||
@@ -45,15 +45,16 @@ export default {
|
||||
getTitle: ({ row }) => row.applet.display_name
|
||||
}
|
||||
},
|
||||
'applet.version': {
|
||||
label: this.$t('common.Version')
|
||||
},
|
||||
status: {
|
||||
label: this.$t('applets.PublishStatus'),
|
||||
formatter: (row) => {
|
||||
const typeMapper = {
|
||||
'ready': 'info',
|
||||
'pending': 'info',
|
||||
'running': 'success',
|
||||
'success': 'success',
|
||||
'failed': 'danger'
|
||||
'not_match': 'warning',
|
||||
'published': 'success',
|
||||
'unpublished': 'danger'
|
||||
}
|
||||
const tp = typeMapper[row.status.value] || 'info'
|
||||
return <el-tag size='mini' type={tp}>{ row.status.label }</el-tag>
|
||||
|
@@ -14,13 +14,13 @@ export default {
|
||||
tableConfig: {
|
||||
url: '/api/v1/terminal/applet-hosts/',
|
||||
columns: [
|
||||
'name', 'address', 'protocols',
|
||||
'name', 'address', 'protocols', 'status',
|
||||
'comment', 'date_created', 'date_updated', 'actions'
|
||||
],
|
||||
columnsShow: {
|
||||
min: ['name', 'actions'],
|
||||
default: [
|
||||
'name', 'address', 'protocols',
|
||||
'name', 'address', 'protocols', 'status',
|
||||
'comment', 'actions'
|
||||
]
|
||||
},
|
||||
|
@@ -5,7 +5,7 @@
|
||||
:visible.sync="dialogSettings.visible"
|
||||
:destroy-on-close="true"
|
||||
:show-cancel="false"
|
||||
:title="$t('sessions.terminalUpdateStorage')"
|
||||
:title="$tc('sessions.terminalUpdateStorage')"
|
||||
:show-confirm="false"
|
||||
>
|
||||
<GenericCreateUpdateForm v-bind="dialogSettings.iFormSetting" />
|
||||
@@ -19,13 +19,6 @@ import { GenericCreateUpdateForm } from '@/layout/components'
|
||||
import Dialog from '@/components/Dialog'
|
||||
import Select2 from '@/components/FormFields/Select2'
|
||||
|
||||
const numTotFixed = (row, type) => {
|
||||
const cur = row.stat?.[type] || ''
|
||||
if (cur instanceof Number && !Number.isInteger(cur)) {
|
||||
return cur.toFixed(1)
|
||||
}
|
||||
return cur
|
||||
}
|
||||
export default {
|
||||
components: {
|
||||
ListTable,
|
||||
@@ -67,7 +60,7 @@ export default {
|
||||
}
|
||||
},
|
||||
submitMethod: () => 'post',
|
||||
cleanFormValue: function(value) {
|
||||
cleanFormValue: (value) => {
|
||||
const formValue = []
|
||||
let object = {}
|
||||
for (const row of this.dialogSettings.selectedRows) {
|
||||
@@ -75,8 +68,8 @@ export default {
|
||||
formValue.push(object)
|
||||
}
|
||||
return formValue
|
||||
}.bind(this),
|
||||
onSubmit: function(validValues) {
|
||||
},
|
||||
onSubmit: (validValues) => {
|
||||
const url = '/api/v1/terminal/terminals/'
|
||||
const msg = this.$t('common.updateSuccessMsg')
|
||||
validValues = Object.values(validValues)
|
||||
@@ -97,7 +90,7 @@ export default {
|
||||
}
|
||||
}
|
||||
})
|
||||
}.bind(this),
|
||||
},
|
||||
hasSaveContinue: false
|
||||
}
|
||||
},
|
||||
@@ -108,15 +101,14 @@ export default {
|
||||
resource: 'terminal'
|
||||
},
|
||||
columns: [
|
||||
'name', 'remote_addr', 'session_online',
|
||||
'stat.cpu_load', 'stat.disk_used', 'stat.memory_used',
|
||||
'status', 'is_active', 'is_alive', 'actions'
|
||||
'name', 'remote_addr', 'session_online', 'stat',
|
||||
'load', 'is_active', 'actions'
|
||||
],
|
||||
columnsShow: {
|
||||
min: ['name', 'actions'],
|
||||
default: [
|
||||
'name', 'session_online', 'stat.cpu_load', 'stat.disk_used',
|
||||
'stat.memory_used', 'status', 'actions'
|
||||
'name', 'session_online', 'stat',
|
||||
'load', 'actions'
|
||||
]
|
||||
},
|
||||
columnsMeta: {
|
||||
@@ -126,25 +118,18 @@ export default {
|
||||
route: 'TerminalDetail'
|
||||
}
|
||||
},
|
||||
'stat.cpu_load': {
|
||||
label: this.$t('sessions.systemCpuLoad'),
|
||||
width: '120px',
|
||||
formatter: (row) => (numTotFixed(row, 'cpu_load'))
|
||||
stat: {
|
||||
label: this.$t('terminal.TerminalStat'),
|
||||
formatter: (row) => {
|
||||
if (!row?.stat) {
|
||||
return ''
|
||||
}
|
||||
const stat = row.stat
|
||||
return `${stat['cpu_load']} ${stat['memory_used']}% ${stat['disk_used']}%`
|
||||
}
|
||||
},
|
||||
'stat.disk_used': {
|
||||
label: this.$t('sessions.systemDiskUsedPercent'),
|
||||
width: '120px',
|
||||
formatter: (row) => (numTotFixed(row, 'disk_used'))
|
||||
},
|
||||
'stat.memory_used': {
|
||||
label: this.$t('sessions.systemMemoryUsedPercent'),
|
||||
width: '120px',
|
||||
formatter: (row) => (numTotFixed(row, 'memory_used'))
|
||||
},
|
||||
status: {
|
||||
load: {
|
||||
label: this.$t('xpack.LoadStatus'),
|
||||
width: '120px',
|
||||
// formatter: DisplayFormatter,
|
||||
filterable: 'custom',
|
||||
formatterArgs: {
|
||||
classChoices: {
|
||||
@@ -190,10 +175,10 @@ export default {
|
||||
name: 'actionUpdateSelected',
|
||||
title: this.$t('common.updateSelected'),
|
||||
can: ({ selectedRows }) => selectedRows.length > 0 && vm.$hasPerm('terminal.change_terminal'),
|
||||
callback: function({ selectedRows, reloadTable }) {
|
||||
callback: ({ selectedRows, reloadTable }) => {
|
||||
this.dialogSettings.selectedRows = selectedRows
|
||||
this.dialogSettings.visible = true
|
||||
}.bind(this)
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@@ -9,7 +9,7 @@
|
||||
<script>
|
||||
import TabPage from '@/layout/components/TabPage'
|
||||
import Basic from './Base'
|
||||
import TerminalList from './TerminalList'
|
||||
import TerminalList from './Component/TerminalList'
|
||||
import ReplayStorage from './Storage/ReplayStorage'
|
||||
import CommandStorage from './Storage/CommandStorage'
|
||||
import Monitor from './Monitor'
|
||||
|
Reference in New Issue
Block a user