fix: 修复v2.9 bugs (#739)

* fix: 修复资产列表协议组显示的问题

* fix: 全局组织批量更新用户禁止更新用户组

* fix: 修复网关无法克隆的Bug

* fix: 修复平台列表更新bug

* fix: 修复翻译问题

* fix: 修复更新管理用户账户秘钥的问题

Co-authored-by: Orange <orangemtony@gmail.com>
This commit is contained in:
fit2bot
2021-04-13 19:30:24 +08:00
committed by GitHub
parent 2d17b48b86
commit bdb63b865a
6 changed files with 104 additions and 101 deletions

View File

@@ -1,51 +1,52 @@
<template><div>
<template>
<div>
<ListTable ref="ListTable" :table-config="tableConfig" :header-actions="headerActions" />
<Dialog v-if="showMFADialog" width="50" :title="this.$t('common.MFAConfirm')" :visible.sync="showMFADialog" :show-confirm="false" :show-cancel="false" :destroy-on-close="true">
<div v-if="MFAConfirmed">
<el-form label-position="right" label-width="80px" :model="MFAInfo">
<div>
<ListTable ref="ListTable" :table-config="tableConfig" :header-actions="headerActions" />
<Dialog v-if="showMFADialog" width="50" :title="this.$t('common.MFAConfirm')" :visible.sync="showMFADialog" :show-confirm="false" :show-cancel="false" :destroy-on-close="true">
<div v-if="MFAConfirmed">
<el-form label-position="right" label-width="80px" :model="MFAInfo">
<el-form-item :label="this.$t('assets.Hostname')">
<el-input v-model="MFAInfo.hostname" disabled />
</el-form-item>
<el-form-item :label="this.$t('assets.Username')">
<el-input v-model="MFAInfo.username" disabled />
</el-form-item>
<el-form-item :label="this.$t('assets.Password')">
<el-input v-model="MFAInfo.password" type="password" show-password />
</el-form-item>
</el-form>
</div>
<el-row v-else :gutter="20">
<el-col :span="4">
<div style="line-height: 34px;text-align: center">MFA</div>
</el-col>
<el-col :span="14">
<el-input v-model="MFAInput" />
<span class="help-tips help-block">{{ $t('common.MFARequireForSecurity') }}</span>
</el-col>
<el-col :span="4">
<el-button size="mini" type="primary" style="line-height:20px " @click="MFAConfirm">{{ this.$t('common.Confirm') }}</el-button>
</el-col>
</el-row>
</Dialog>
<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="MFAInfo.hostname" disabled />
<el-input v-model="dialogInfo.hostname" disabled />
</el-form-item>
<el-form-item :label="this.$t('assets.Username')">
<el-input v-model="MFAInfo.username" disabled />
<el-input v-model="dialogInfo.username" disabled />
</el-form-item>
<el-form-item :label="this.$t('assets.Password')">
<el-input v-model="MFAInfo.password" type="password" show-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>
</div>
<el-row v-else :gutter="20">
<el-col :span="4">
<div style="line-height: 34px;text-align: center">MFA</div>
</el-col>
<el-col :span="14">
<el-input v-model="MFAInput" />
<span class="help-tips help-block">{{ $t('common.MFARequireForSecurity') }}</span>
</el-col>
<el-col :span="4">
<el-button size="mini" type="primary" style="line-height:20px " @click="MFAConfirm">{{ this.$t('common.Confirm') }}</el-button>
</el-col>
</el-row>
</Dialog>
<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>
</Dialog>
</div>
</div>
</div>
</template>
<script>
@@ -111,7 +112,7 @@ export default {
username: '',
hostname: '',
password: '',
key: ''
private_key: ''
},
tableConfig: {
url: this.url,
@@ -316,7 +317,7 @@ export default {
username: '',
hostname: '',
password: '',
key: ''
private_key: ''
}
this.showDialog = false
this.$refs.ListTable.reloadTable()
@@ -326,7 +327,7 @@ export default {
// TODO 校验文件类型
const reader = new FileReader()
reader.onload = function() {
vm.dialogInfo.key = this.result
vm.dialogInfo.private_key = this.result
}
reader.readAsText(
e.target.files[0]
@@ -340,8 +341,8 @@ export default {
if (this.dialogInfo.password !== '') {
data.password = this.dialogInfo.password
}
if (this.dialogInfo.key !== '') {
data.key = this.dialogInfo.key
if (this.dialogInfo.private_key !== '') {
data.private_key = this.dialogInfo.private_key
}
this.$axios.post(
`/api/v1/assets/asset-users/`,
@@ -356,7 +357,7 @@ export default {
username: '',
hostname: '',
password: '',
key: ''
private_key: ''
}
this.showDialog = false
this.$refs.ListTable.reloadTable()

View File

@@ -600,6 +600,10 @@
"RemoteAppPermissionCreate": "Remote apps permission create",
"RemoteAppPermissionDetail": "Remote apps permissions detail",
"RemoteAppPermissionUpdate": "Remote app permission update",
"ApplicationDetail": "Application detail",
"ApplicationPermissionCreate": "Application permission create",
"ApplicationPermissionDetail": "Application permission detail",
"ApplicationPermissionUpdate": "Application permission update",
"RemoteAppUpdate": "Remote app update",
"ReplayStorageUpdate": "Replay storage update",
"SessionDetail": "Sessions detail",

View File

@@ -122,6 +122,11 @@ export default {
},
showOverflowTooltip: true
},
protocols: {
formatter: function(row) {
return <span> {row.protocols.toString()} </span>
}
},
ip: {
sortable: 'custom',
width: '140px'

View File

@@ -85,7 +85,17 @@ export default {
}
}.bind(this)
}
]
],
onClone: function({ row, col }) {
const cloneRoute = {
name: 'GatewayCreate',
query: {
domain: this.object.id,
clone_from: row.id
}
}
this.$router.push(cloneRoute)
}.bind(this)
}
}

View File

@@ -1,5 +1,5 @@
<template>
<GenericCreateUpdatePage :fields="fields" :initial="initial" :fields-meta="fieldsMeta" :url="url" :perform-submit="performSubmit.bind(this)" />
<GenericCreateUpdatePage :fields="fields" :initial="initial" :fields-meta="fieldsMeta" :url="url" />
</template>
<script>
@@ -17,65 +17,48 @@ export default {
charset: 'utf8'
},
fields: [
[this.$t('common.Basic'), ['name', 'base', 'charset', 'security', 'console', 'comment']]
[this.$t('common.Basic'), ['name', 'base', 'charset', 'meta', 'comment']]
],
fieldsMeta: {
security: {
type: 'select',
label: 'RDP security',
options: [{
label: 'RDP',
value: 'rdp'
meta: {
fields: ['security', 'console'],
fieldsMeta: {
security: {
prop: 'meta.security',
type: 'select',
label: 'RDP security',
options: [{
label: 'RDP',
value: 'rdp'
},
{
label: 'NLA',
value: 'nla'
},
{
label: 'TLS',
value: 'tls'
},
{
label: 'Any',
value: 'any'
}]
},
console: {
type: 'select',
label: 'RDP console',
options: [{
label: this.$t('common.Yes'),
value: 'true'
}, {
label: this.$t('common.No'),
value: 'false'
}]
}
},
{
label: 'NLA',
value: 'nla'
},
{
label: 'TLS',
value: 'tls'
},
{
label: 'Any',
value: 'any'
}],
hidden: form => form.base !== 'Windows'
},
console: {
type: 'select',
label: 'RDP console',
options: [{
label: '是',
value: 'true'
}, {
label: '否',
value: 'false'
}],
hidden: form => form.base !== 'Windows'
}
},
performSubmit: function(formdata) {
var postData = {}
if (formdata.base === 'Windows') {
postData.meta = {}
postData.meta.security = formdata.security
postData.meta.console = (formdata.console === 'true')
}
postData.name = formdata.name
postData.base = formdata.base
postData.charset = formdata.charset
postData.comment = formdata.comment || ''
const params = this.$route.params
if (params.id) {
return this.$axios.put(
`${this.url}${params.id}/`, postData
)
} else {
return this.$axios.post(
this.url, postData
)
}
},
url: '/api/v1/assets/platforms/'
}

View File

@@ -187,7 +187,7 @@ export default {
fieldsMeta: {
groups: {
label: this.$t('users.UserGroups'),
hidden: () => false,
hidden: () => vm.currentOrgIsRoot,
el: {
multiple: true,
ajax: {