Merge pull request #509 from jumpserver/dev

Merge Dev
This commit is contained in:
Jiangjie.Bai 2020-11-17 19:45:03 +08:00 committed by GitHub
commit affb0ec2bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 96 additions and 75 deletions

View File

@ -84,7 +84,7 @@ export default {
canUpdate: true, // can set function(row, value) canUpdate: true, // can set function(row, value)
hasDelete: true, // can set function(row, value) hasDelete: true, // can set function(row, value)
canDelete: true, canDelete: true,
hasClone: true, hasClone: false,
canClone: true, canClone: true,
updateRoute: this.$route.name.replace('List', 'Update'), updateRoute: this.$route.name.replace('List', 'Update'),
cloneRoute: this.$route.name.replace('List', 'Create'), cloneRoute: this.$route.name.replace('List', 'Create'),

View File

@ -46,10 +46,11 @@ export default {
}, },
iTableConfig() { iTableConfig() {
const config = deepmerge(this.tableConfig, { extraQuery: this.extraQuery }) const config = deepmerge(this.tableConfig, { extraQuery: this.extraQuery })
const hasClone = _.get(config, 'columnsMeta.actions.formatterArgs.hasClone') let hasClone = _.get(config, 'columnsMeta.actions.formatterArgs.hasClone')
if (!this.headerActions.hasCreate && hasClone == null) { if (this.headerActions.hasCreate && hasClone == null) {
_.set(config, 'columnsMeta.actions.formatterArgs.hasClone', false) hasClone = true
} }
_.set(config, 'columnsMeta.actions.formatterArgs.hasClone', hasClone)
this.$log.debug('ListTable: iTableConfig change', config) this.$log.debug('ListTable: iTableConfig change', config)
return config return config
} }

View File

@ -903,6 +903,8 @@
"grantedK8Ss": "授权的Kubernetes", "grantedK8Ss": "授权的Kubernetes",
"grantedDatabases": "授权的数据库", "grantedDatabases": "授权的数据库",
"grantedRemoteApps": "授权的远程应用", "grantedRemoteApps": "授权的远程应用",
"grantedApplications": "授权的应用",
"ApplicationPermissionRules": "应用授权规则",
"remoteAppPermissionRules": "远程应用授权规则" "remoteAppPermissionRules": "远程应用授权规则"
}, },
"dateLastLogin": "最后登录日期", "dateLastLogin": "最后登录日期",

View File

@ -787,6 +787,7 @@
"Asset": "Asset", "Asset": "Asset",
"SystemUser": "System user", "SystemUser": "System user",
"Applicant": "Applicant", "Applicant": "Applicant",
"RequestAssetPerm": "Request asset perm",
"Pending": "Open", "Pending": "Open",
"Approved": "Approved", "Approved": "Approved",
"Rejected": "Rejected", "Rejected": "Rejected",
@ -891,6 +892,8 @@
"grantedK8Ss":"Granted K8Ss", "grantedK8Ss":"Granted K8Ss",
"grantedDatabases": "Granted databases", "grantedDatabases": "Granted databases",
"grantedRemoteApps": "Granted remote apps", "grantedRemoteApps": "Granted remote apps",
"grantedApplications": "Granted applications",
"ApplicationPermissionRules": "Application permission rules",
"remoteAppPermissionRules": "Remote app permission rules" "remoteAppPermissionRules": "Remote app permission rules"
}, },
"UpdatePassword": "", "UpdatePassword": "",

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="footer" :style="style"> <div class="footer" :style="style">
<div class="pull-right"> <div class="pull-right">
Version <strong>2.0.2</strong> <span v-if="!publicSettings.XPACK_LICENSE_IS_VALID"> GPLv2. </span> Version <strong> dev </strong> <span v-if="!publicSettings.XPACK_LICENSE_IS_VALID"> GPLv2. </span>
</div> </div>
<div v-if="!publicSettings.XPACK_LICENSE_IS_VALID" style="padding-left:20px;"> <div v-if="!publicSettings.XPACK_LICENSE_IS_VALID" style="padding-left:20px;">
<strong>Copyright</strong> FIT2CLOUD 飞致云 © 2014-2020 <strong>Copyright</strong> FIT2CLOUD 飞致云 © 2014-2020

View File

@ -38,15 +38,15 @@ export default {
} }
}, },
mounted() { mounted() {
// if (this.publicSettings.XPACK_ENABLED && this.currentUser.role === 'Admin') { if (this.publicSettings.XPACK_ENABLED && this.currentUser.role === 'Admin') {
// this.$axios.get('/api/v1/xpack/license/detail').then(res => { this.$axios.get('/api/v1/xpack/license/detail').then(res => {
// this.licenseData = res this.licenseData = res
// }).finally(() => { }).finally(() => {
// this.loading = false this.loading = false
// }) })
// } else { } else {
// this.loading = false this.loading = false
// } }
}, },
methods: { methods: {
getIntervalDays(date) { getIntervalDays(date) {

View File

@ -65,7 +65,8 @@ export default {
title: this.$t('users.UpdatePassword'), title: this.$t('users.UpdatePassword'),
attrs: { attrs: {
type: 'primary', type: 'primary',
label: this.$t('common.Update') label: this.$t('common.Update'),
disabled: this.$store.state.users.profile.source !== 'local'
}, },
callbacks: { callbacks: {
click: function() { click: function() {
@ -77,7 +78,8 @@ export default {
title: this.$t('users.UpdateSSHKey'), title: this.$t('users.UpdateSSHKey'),
attrs: { attrs: {
type: 'primary', type: 'primary',
label: this.$t('common.Update') label: this.$t('common.Update'),
disabled: this.$store.state.users.profile.source !== 'local'
}, },
callbacks: { callbacks: {
click: function() { click: function() {

View File

@ -37,12 +37,12 @@ export default {
actions: { actions: {
prop: '', prop: '',
formatterArgs: { formatterArgs: {
onDelete: function({ row, col, cellValue, reload }) { performDelete: function({ row, col, cellValue, reload }) {
this.$axios.delete( this.$axios.delete(
`/api/v1/applications/applications/${row.id}/` `/api/v1/applications/applications/${row.id}/`
).then(res => { ).then(res => {
this.$refs.GenericListTable.$refs.ListTable.reloadTable() this.$refs.GenericListTable.$refs.ListTable.reloadTable()
this.$message.success(this.$t('common.deleteSuccessMsg')) // this.$message.success(this.$t('common.deleteSuccessMsg'))
}).catch(error => { }).catch(error => {
this.$message.error(this.$t('common.deleteErrorMsg' + ' ' + error)) this.$message.error(this.$t('common.deleteErrorMsg' + ' ' + error))
}) })

View File

@ -29,12 +29,12 @@ export default {
actions: { actions: {
prop: '', prop: '',
formatterArgs: { formatterArgs: {
onDelete: function({ row, col, cellValue, reload }) { performDelete: function({ row, col, cellValue, reload }) {
this.$axios.delete( this.$axios.delete(
`/api/v1/applications/applications/${row.id}/` `/api/v1/applications/applications/${row.id}/`
).then(res => { ).then(res => {
this.$refs.GenericListTable.$refs.ListTable.reloadTable() this.$refs.GenericListTable.$refs.ListTable.reloadTable()
this.$message.success(this.$t('common.deleteSuccessMsg')) // this.$message.success(this.$t('common.deleteSuccessMsg'))
}).catch(error => { }).catch(error => {
this.$message.error(this.$t('common.deleteErrorMsg' + ' ' + error)) this.$message.error(this.$t('common.deleteErrorMsg' + ' ' + error))
}) })

View File

@ -17,6 +17,7 @@ export default {
TabPage TabPage
}, },
data() { data() {
const vm = this
return { return {
RemoteApp: { RemoteApp: {
name: '', asset: '', get_type_display: '', path: '', date_created: '', created_by: '', comment: '', attrs: '' name: '', asset: '', get_type_display: '', path: '', date_created: '', created_by: '', comment: '', attrs: ''
@ -31,7 +32,10 @@ export default {
], ],
actions: { actions: {
detailApiUrl: `/api/v1/applications/applications/${this.$route.params.id}/`, detailApiUrl: `/api/v1/applications/applications/${this.$route.params.id}/`,
deleteApiUrl: `/api/v1/applications/applications/${this.$route.params.id}/` deleteApiUrl: `/api/v1/applications/applications/${this.$route.params.id}/`,
updateCallback: function(item) {
vm.$router.push({ name: 'RemoteAppUpdate', params: { id: vm.RemoteApp.id }, query: { type: vm.RemoteApp.type }})
}
} }
} }
} }

View File

@ -28,7 +28,6 @@ export default {
label: this.$t('assets.Assets'), label: this.$t('assets.Assets'),
showOverflowTooltip: true, showOverflowTooltip: true,
formatter: function(row, column, cellValue, index) { formatter: function(row, column, cellValue, index) {
console.log(row, column, cellValue)
const route = { to: { name: 'AssetDetail', params: { id: cellValue }}} const route = { to: { name: 'AssetDetail', params: { id: cellValue }}}
return <router-link{...{ attrs: route }} >{ row.attrs.asset_info.hostname }</router-link> return <router-link{...{ attrs: route }} >{ row.attrs.asset_info.hostname }</router-link>
} }
@ -38,12 +37,12 @@ export default {
onUpdate: ({ row }) => { onUpdate: ({ row }) => {
vm.$router.push({ name: 'RemoteAppUpdate', params: { id: row.id }, query: { type: row.type }}) vm.$router.push({ name: 'RemoteAppUpdate', params: { id: row.id }, query: { type: row.type }})
}, },
onDelete: function({ row, col, cellValue, reload }) { performDelete: function({ row, col, cellValue, reload }) {
this.$axios.delete( this.$axios.delete(
`/api/v1/applications/applications/${row.id}/` `/api/v1/applications/applications/${row.id}/`
).then(res => { ).then(res => {
this.$refs.GenericListTable.$refs.ListTable.reloadTable() this.$refs.GenericListTable.$refs.ListTable.reloadTable()
this.$message.success(this.$t('common.deleteSuccessMsg')) // this.$message.success(this.$t('common.deleteSuccessMsg'))
}).catch(error => { }).catch(error => {
this.$message.error(this.$t('common.deleteErrorMsg' + ' ' + error)) this.$message.error(this.$t('common.deleteErrorMsg' + ' ' + error))
}) })

View File

@ -281,6 +281,7 @@ export default {
}, },
formSetting: { formSetting: {
url: '/api/v1/assets/assets/', url: '/api/v1/assets/assets/',
hasSaveContinue: false,
initial: { initial: {
platform: 'Linux', platform: 'Linux',
protocols: ['ssh/22'] protocols: ['ssh/22']

View File

@ -191,6 +191,9 @@ export default {
if (formValue.update_password || formValue.protocol === 'k8s') { if (formValue.update_password || formValue.protocol === 'k8s') {
return true return true
} }
if (formValue.login_mode === 'login_mode') {
return true
}
return !this.$route.params.id return !this.$route.params.id
} }
}, },

View File

@ -34,7 +34,7 @@ export default {
label: this.$t('ops.hosts'), label: this.$t('ops.hosts'),
width: '65px', width: '65px',
formatter: function(row) { formatter: function(row) {
return row.latest_execution.hosts_amount return _.get(row, 'latest_execution.hosts_amount', 0)
} }
}, },
is_success: { is_success: {
@ -42,7 +42,7 @@ export default {
align: 'center', align: 'center',
width: '80px', width: '80px',
formatter: row => { formatter: row => {
if (row.latest_execution.is_success) { if (_.get(row, 'latest_execution.is_success', false)) {
return <i Class='fa fa-check text-primary'/> return <i Class='fa fa-check text-primary'/>
} }
return <i Class='fa fa-times text-danger'/> return <i Class='fa fa-times text-danger'/>
@ -52,14 +52,20 @@ export default {
label: this.$t('ops.date'), label: this.$t('ops.date'),
width: '150px', width: '150px',
formatter: function(row) { formatter: function(row) {
return toSafeLocalDateStr(row.latest_execution.date_start) if (_.get(row, 'latest_execution.date_start', false)) {
return toSafeLocalDateStr(row.latest_execution.date_start)
}
return ''
} }
}, },
time: { time: {
label: this.$t('ops.time'), label: this.$t('ops.time'),
width: '100px', width: '100px',
formatter: function(row) { formatter: function(row) {
return timeOffset(row.latest_execution.date_start, row.latest_execution.date_finished) if (_.get(row, 'latest_execution.date_start', false)) {
return timeOffset(row.latest_execution.date_start, row.latest_execution.date_finished)
}
return ''
} }
}, },
actions: { actions: {

View File

@ -99,15 +99,9 @@ export default {
icon: 'fa-edit', icon: 'fa-edit',
title: this.$t('perms.addSystemUserToThisPermission'), title: this.$t('perms.addSystemUserToThisPermission'),
objectsAjax: { objectsAjax: {
url: '/api/v1/assets/system-users/', url: `/api/v1/assets/system-users/?category=${vm.object.category}&type=${vm.object.type}`,
processResults(data) { transformOption: (item) => {
let results = data.results return { label: item.name + ' (' + item.username + ')', value: item.id }
const protocol = vm.object.category === 'remote_app' ? `rdp` : vm.object.type
results = results.filter((item) => item.protocol === protocol).map((item) => {
return { label: item.name + '(' + item.username + ')', value: item.id }
})
const more = !!data.next
return { results: results, pagination: more, total: data.count }
} }
}, },
hasObjectsId: this.object.system_users, hasObjectsId: this.object.system_users,

View File

@ -156,7 +156,7 @@ export default {
window.location.reload() window.location.reload()
}, },
handleApprove() { handleApprove() {
if (this.requestForm.asset.length === 0 || this.requestForm.systemuser === '') { if (this.requestForm.asset.length === 0 || this.requestForm.systemuser.length === 0) {
return this.$message.error(this.$t('common.NeedAssetsAndSystemUserErrMsg')) return this.$message.error(this.$t('common.NeedAssetsAndSystemUserErrMsg'))
} else { } else {
this.$axios.patch(`/api/v1/tickets/tickets/request-asset-perm/${this.object.id}/`, { this.$axios.patch(`/api/v1/tickets/tickets/request-asset-perm/${this.object.id}/`, {

View File

@ -13,8 +13,8 @@
<strong>{{ item.user_display }}</strong> <small class="text-muted">{{ formatTime(item.date_created) }}</small> <strong>{{ item.user_display }}</strong> <small class="text-muted">{{ formatTime(item.date_created) }}</small>
<br> <br>
<small class="text-muted">{{ toSafeLocalDateStr(item.date_created) }}</small> <small class="text-muted">{{ toSafeLocalDateStr(item.date_created) }}</small>
<pre style="padding-top: 10px"> <pre style="padding-top: 10px; overflow: auto">
{{ item.body }} {{ item.body }}
</pre> </pre>
</div> </div>
</div> </div>

View File

@ -18,12 +18,16 @@ export default {
data() { data() {
return { return {
tableConfig: { tableConfig: {
url: `/api/v1/perms/remote-app-permissions/?user_id=${this.object.id}&draw=1`, url: `/api/v1/perms/application-permissions/?user_id=${this.object.id}&draw=1`,
columns: ['name', 'users_amount', 'user_groups_amount', 'remote_apps_amount', 'system_users_amount', 'is_valid', 'actions'], columns: [
'name', 'category_display', 'users_amount', 'user_groups_amount',
'applications_amount', 'system_users_amount',
'is_valid', 'actions'
],
columnsMeta: { columnsMeta: {
name: { name: {
formatterArgs: { formatterArgs: {
route: 'RemoteAppPermissionDetail' route: 'ApplicationPermissionDetail'
}, },
showOverflowTooltip: true showOverflowTooltip: true
}, },
@ -35,8 +39,8 @@ export default {
label: this.$t('users.UserGroups'), label: this.$t('users.UserGroups'),
width: '110px' width: '110px'
}, },
remote_apps_amount: { applications_amount: {
label: this.$t('assets.RemoteApps'), label: this.$t('assets.Applications'),
width: '110px' width: '110px'
}, },
system_users_amount: { system_users_amount: {
@ -48,7 +52,7 @@ export default {
updateRoute: 'RemoteAppPermissionUpdate', updateRoute: 'RemoteAppPermissionUpdate',
performDelete: ({ row, col }) => { performDelete: ({ row, col }) => {
const id = row.id const id = row.id
const url = `/api/v1/perms/remote-app-permissions/${id}/?user_id=${this.object.id}&draw=1` const url = `/api/v1/perms/application-permissions/${id}/?user_id=${this.object.id}&draw=1`
return this.$axios.delete(url) return this.$axios.delete(url)
} }
} }

View File

@ -5,7 +5,7 @@
<script> <script>
import ListTable from '@/components/ListTable' import ListTable from '@/components/ListTable'
export default { export default {
name: 'UserGrantedRemoteApps', name: 'UserGrantedApplications',
components: { components: {
ListTable ListTable
}, },
@ -18,8 +18,8 @@ export default {
data() { data() {
return { return {
tableConfig: { tableConfig: {
url: `/api/v1/perms/users/${this.object.id}/remote-apps/?draw=1`, url: `/api/v1/perms/users/${this.object.id}/applications/`,
columns: ['name', 'type', 'asset', 'comment'], columns: ['name', 'category_display', 'type', 'asset', 'comment'],
columnsMeta: { columnsMeta: {
name: { name: {
formatterArgs: { formatterArgs: {
@ -27,12 +27,13 @@ export default {
} }
}, },
type: { type: {
displayKey: 'get_type_display', displayKey: 'type_display',
width: '140px' width: '140px'
}, },
asset: { asset: {
label: '资产',
formatter(row) { formatter(row) {
return row.asset_info.hostname return row.attrs.host || row.attrs.hostname
} }
} }
} }

View File

@ -10,8 +10,8 @@
import { GenericDetailPage } from '@/layout/components' import { GenericDetailPage } from '@/layout/components'
import UserAssetPermissionRules from './UserAssetPermissionRules' import UserAssetPermissionRules from './UserAssetPermissionRules'
import UserGrantedAssets from './UserGrantedAssets' import UserGrantedAssets from './UserGrantedAssets'
import UserGrantedRemoteApps from './UserGrantedRemoteApps' import UserGrantedApplications from './UserGrantedApplications'
import UserRemoteAppPermissionRules from './UserRemoteAppPermissionRules' import UserApplicationPermissionRules from './UserApplicationsPermissionRules'
import UserGrantedDatabases from './UserGrantedDatabases' import UserGrantedDatabases from './UserGrantedDatabases'
import UserGrantedK8Ss from './UserGrantedK8Ss' import UserGrantedK8Ss from './UserGrantedK8Ss'
import UserK8SPermissionRules from './UserK8SPermissionRules' import UserK8SPermissionRules from './UserK8SPermissionRules'
@ -24,8 +24,8 @@ export default {
UserInfo, UserInfo,
UserGrantedAssets, UserGrantedAssets,
UserAssetPermissionRules, UserAssetPermissionRules,
UserGrantedRemoteApps, UserGrantedApplications,
UserRemoteAppPermissionRules, UserApplicationPermissionRules,
UserGrantedDatabases, UserGrantedDatabases,
UserDatabasePermissionRules, UserDatabasePermissionRules,
UserK8SPermissionRules, UserK8SPermissionRules,
@ -55,29 +55,29 @@ export default {
name: 'UserAssetPermissionRules' name: 'UserAssetPermissionRules'
}, },
{ {
title: this.$t('users.tabs.grantedRemoteApps'), title: this.$t('users.tabs.grantedApplications'),
name: 'UserGrantedRemoteApps' name: 'UserGrantedApplications'
}, },
{ {
title: this.$t('users.tabs.remoteAppPermissionRules'), title: this.$t('users.tabs.ApplicationPermissionRules'),
name: 'UserRemoteAppPermissionRules' name: 'UserApplicationPermissionRules'
},
{
title: this.$t('users.tabs.grantedDatabases'),
name: 'UserGrantedDatabases'
},
{
title: this.$t('users.tabs.databasePermissionRules'),
name: 'UserDatabasePermissionRules'
},
{
title: this.$t('users.tabs.grantedK8Ss'),
name: 'UserGrantedK8Ss'
},
{
title: this.$t('users.tabs.k8sPermissionRules'),
name: 'UserK8SPermissionRules'
} }
// {
// title: this.$t('users.tabs.grantedDatabases'),
// name: 'UserGrantedDatabases'
// },
// {
// title: this.$t('users.tabs.databasePermissionRules'),
// name: 'UserDatabasePermissionRules'
// },
// {
// title: this.$t('users.tabs.grantedK8Ss'),
// name: 'UserGrantedK8Ss'
// },
// {
// title: this.$t('users.tabs.k8sPermissionRules'),
// name: 'UserK8SPermissionRules'
// }
] ]
} }
} }

View File

@ -161,6 +161,7 @@ export default {
date_expired: getDayFuture(36500, new Date()).toISOString() date_expired: getDayFuture(36500, new Date()).toISOString()
}, },
fields: ['groups', 'date_expired', 'comment'], fields: ['groups', 'date_expired', 'comment'],
hasSaveContinue: false,
url: '/api/v1/users/users/', url: '/api/v1/users/users/',
fieldsMeta: { fieldsMeta: {
groups: { groups: {