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