mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-22 11:39:29 +00:00
Merge branch 'master' of github.com:jumpserver/lina
This commit is contained in:
@@ -10,6 +10,8 @@
|
||||
},
|
||||
"assets": {
|
||||
"Action": "动作",
|
||||
"UpdateAssetUserToken": "更新资产用户认证信息",
|
||||
"Password": "密码",
|
||||
"RefreshHardware": "更新硬件信息",
|
||||
"AdminUser": "管理用户",
|
||||
"AdminUserDetail": "管理用户详情",
|
||||
|
@@ -10,6 +10,8 @@
|
||||
},
|
||||
"assets": {
|
||||
"Action": "Action",
|
||||
"UpdateAssetUserToken": "Update asset user auth",
|
||||
"Password": "Password",
|
||||
"RefreshHardware": "Refresh hardware",
|
||||
"AdminUser": "Admin user",
|
||||
"AdminUserDetail": "Admin user detail",
|
||||
|
@@ -89,21 +89,21 @@ export default [
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: 'platform/update/:id',
|
||||
path: 'platforms/update/:id',
|
||||
component: () => import('@/views/assets/Platform/PlatformCreateUpdate.vue'), // Parent router-view
|
||||
name: 'PlatformUpdate',
|
||||
meta: { title: i18n.t('route.PlatformUpdate'), activeMenu: '/assets/platform' },
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: 'platform/detail/:id',
|
||||
path: 'platforms/detail/:id',
|
||||
component: () => import('@/views/assets/Platform/PlatformDetail.vue'), // Parent router-view
|
||||
name: 'PlatformDetail',
|
||||
meta: { title: i18n.t('route.PlatformDetail'), activeMenu: '/assets/platform' },
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: 'platform/create',
|
||||
path: 'platforms/create',
|
||||
component: () => import('@/views/assets/Platform/PlatformCreateUpdate.vue'), // Parent router-view
|
||||
name: 'PlatformCreate',
|
||||
meta: { title: i18n.t('route.PlatformCreate'), activeMenu: '/assets/platform' },
|
||||
|
@@ -1,4 +1,4 @@
|
||||
<template>
|
||||
<template><div>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="14">
|
||||
<ListTable ref="ListTable" :table-config="tableConfig" :header-actions="headerActions" />
|
||||
@@ -7,10 +7,28 @@
|
||||
<QuickActions type="primary" :actions="quickActions" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
<Dialog width="50" :title="this.$t('assets.UpdateAssetUserToken')" :visible.sync="showDialog" @confirm="handleConfirm()" @cancel="handleCancel()">
|
||||
<el-form label-position="right" label-width="80px" :model="dialogInfo">
|
||||
<el-form-item :label="this.$t('assets.Hostname')">
|
||||
<el-input v-model="dialogInfo.hostname" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item :label="this.$t('assets.Username')">
|
||||
<el-input v-model="dialogInfo.username" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item :label="this.$t('assets.Password')">
|
||||
<el-input v-model="dialogInfo.password" type="password" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="this.$t('assets.sshkey')">
|
||||
<input type="file" @change="Onchange">
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</Dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ListTable from '@/components/ListTable/index'
|
||||
import Dialog from '@/components/Dialog'
|
||||
import { CustomActionsFormatter, DateFormatter } from '@/components/ListTable/formatters'
|
||||
import QuickActions from '@/components/QuickActions/index'
|
||||
|
||||
@@ -18,7 +36,8 @@ export default {
|
||||
name: 'Detail',
|
||||
components: {
|
||||
QuickActions,
|
||||
ListTable
|
||||
ListTable,
|
||||
Dialog
|
||||
},
|
||||
props: {
|
||||
object: {
|
||||
@@ -28,6 +47,14 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showDialog: false,
|
||||
dialogInfo: {
|
||||
asset: '',
|
||||
username: '',
|
||||
hostname: '',
|
||||
password: '',
|
||||
key: ''
|
||||
},
|
||||
quickActions: [
|
||||
{
|
||||
title: this.$t('assets.TestAssetsConnective'),
|
||||
@@ -91,8 +118,25 @@ export default {
|
||||
name: this.$t('common.Test'),
|
||||
title: this.$t('common.Test'),
|
||||
callback: (val) => {
|
||||
console.log('Test')
|
||||
console.log(val.cellValue)
|
||||
this.$axios.post(
|
||||
`api/v1/assets/asset-users/tasks/?id=${val.cellValue}`,
|
||||
{ action: 'test' }
|
||||
).then(res => {
|
||||
window.open(`/ops/celery/task/${res.task}/log/`, '', 'width=900,height=600')
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
name: this.$t('common.Update'),
|
||||
title: this.$t('common.Update'),
|
||||
callback: function(val) {
|
||||
console.log(val)
|
||||
this.showDialog = true
|
||||
this.dialogInfo.asset = val.row.asset
|
||||
this.dialogInfo.hostname = val.row.hostname
|
||||
this.dialogInfo.username = val.row.username
|
||||
}.bind(this)
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -112,6 +156,55 @@ export default {
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
handleCancel() {
|
||||
this.dialogInfo = {
|
||||
asset: '',
|
||||
username: '',
|
||||
hostname: '',
|
||||
password: '',
|
||||
key: ''
|
||||
}
|
||||
this.showDialog = false
|
||||
},
|
||||
Onchange(e) {
|
||||
const vm = this
|
||||
// TODO 校验文件类型
|
||||
const reader = new FileReader()
|
||||
reader.onload = function() {
|
||||
vm.dialogInfo.key = this.result
|
||||
}
|
||||
reader.readAsText(
|
||||
e.target.files[0]
|
||||
)
|
||||
},
|
||||
handleConfirm() {
|
||||
const data = {
|
||||
asset: this.dialogInfo.asset,
|
||||
username: this.dialogInfo.username
|
||||
}
|
||||
if (this.dialogInfo.password !== '') {
|
||||
data.password = this.dialogInfo.password
|
||||
}
|
||||
if (this.dialogInfo.key !== '') {
|
||||
data.key = this.dialogInfo.key
|
||||
}
|
||||
this.$axios.post(
|
||||
`/api/v1/assets/asset-users/`,
|
||||
data
|
||||
).then(res => {
|
||||
this.$message.success(this.$t('common.updateSuccessMsg'))
|
||||
}).catch(err => {
|
||||
this.$message.error(this.$t('common.updateErrorMsg' + ' ' + err))
|
||||
})
|
||||
this.dialogInfo = {
|
||||
asset: '',
|
||||
username: '',
|
||||
hostname: '',
|
||||
password: '',
|
||||
key: ''
|
||||
}
|
||||
this.showDialog = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@@ -36,7 +36,7 @@ export default {
|
||||
processResults: (data) => {
|
||||
let results = data.results
|
||||
results = results.map((item) => {
|
||||
return { label: `${item.name}`, value: item.name }
|
||||
return { label: item.name, value: item.name }
|
||||
})
|
||||
const more = !!data.next
|
||||
return { results: results, pagination: more, total: data.count }
|
||||
|
@@ -41,7 +41,7 @@ export default {
|
||||
},
|
||||
{
|
||||
key: this.$t('assets.Meta'),
|
||||
value: this.object.meta
|
||||
value: JSON.stringify(this.object.meta)
|
||||
},
|
||||
{
|
||||
key: this.$t('assets.Comment'),
|
||||
|
@@ -22,7 +22,7 @@ export default {
|
||||
detailApiUrl: `/api/v1/assets/platforms/${this.$route.params.id}/`
|
||||
},
|
||||
config: {
|
||||
title: this.$t('assets.commandFilterDetail'),
|
||||
title: this.$t('assets.PlatformDetail'),
|
||||
activeMenu: 'Detail',
|
||||
submenu: [
|
||||
{
|
||||
@@ -30,12 +30,14 @@ export default {
|
||||
name: 'Detail'
|
||||
}
|
||||
],
|
||||
hasRightSide: false
|
||||
hasRightSide: this.hasRightSide
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
hasRightSide() {
|
||||
return this.$route.params.id > 7
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user