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)
hasDelete: true, // can set function(row, value)
canDelete: true,
hasClone: true,
hasClone: false,
canClone: true,
updateRoute: this.$route.name.replace('List', 'Update'),
cloneRoute: this.$route.name.replace('List', 'Create'),

View File

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
<template>
<div class="footer" :style="style">
<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 v-if="!publicSettings.XPACK_LICENSE_IS_VALID" style="padding-left:20px;">
<strong>Copyright</strong> FIT2CLOUD 飞致云 © 2014-2020

View File

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

View File

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

View File

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

View File

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

View File

@ -17,6 +17,7 @@ export default {
TabPage
},
data() {
const vm = this
return {
RemoteApp: {
name: '', asset: '', get_type_display: '', path: '', date_created: '', created_by: '', comment: '', attrs: ''
@ -31,7 +32,10 @@ export default {
],
actions: {
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'),
showOverflowTooltip: true,
formatter: function(row, column, cellValue, index) {
console.log(row, column, cellValue)
const route = { to: { name: 'AssetDetail', params: { id: cellValue }}}
return <router-link{...{ attrs: route }} >{ row.attrs.asset_info.hostname }</router-link>
}
@ -38,12 +37,12 @@ export default {
onUpdate: ({ row }) => {
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(
`/api/v1/applications/applications/${row.id}/`
).then(res => {
this.$refs.GenericListTable.$refs.ListTable.reloadTable()
this.$message.success(this.$t('common.deleteSuccessMsg'))
// this.$message.success(this.$t('common.deleteSuccessMsg'))
}).catch(error => {
this.$message.error(this.$t('common.deleteErrorMsg' + ' ' + error))
})

View File

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

View File

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

View File

@ -34,7 +34,7 @@ export default {
label: this.$t('ops.hosts'),
width: '65px',
formatter: function(row) {
return row.latest_execution.hosts_amount
return _.get(row, 'latest_execution.hosts_amount', 0)
}
},
is_success: {
@ -42,7 +42,7 @@ export default {
align: 'center',
width: '80px',
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-times text-danger'/>
@ -52,14 +52,20 @@ export default {
label: this.$t('ops.date'),
width: '150px',
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: {
label: this.$t('ops.time'),
width: '100px',
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: {

View File

@ -99,15 +99,9 @@ export default {
icon: 'fa-edit',
title: this.$t('perms.addSystemUserToThisPermission'),
objectsAjax: {
url: '/api/v1/assets/system-users/',
processResults(data) {
let results = data.results
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 }
url: `/api/v1/assets/system-users/?category=${vm.object.category}&type=${vm.object.type}`,
transformOption: (item) => {
return { label: item.name + ' (' + item.username + ')', value: item.id }
}
},
hasObjectsId: this.object.system_users,

View File

@ -156,7 +156,7 @@ export default {
window.location.reload()
},
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'))
} else {
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>
<br>
<small class="text-muted">{{ toSafeLocalDateStr(item.date_created) }}</small>
<pre style="padding-top: 10px">
{{ item.body }}
<pre style="padding-top: 10px; overflow: auto">
{{ item.body }}
</pre>
</div>
</div>

View File

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

View File

@ -5,7 +5,7 @@
<script>
import ListTable from '@/components/ListTable'
export default {
name: 'UserGrantedRemoteApps',
name: 'UserGrantedApplications',
components: {
ListTable
},
@ -18,8 +18,8 @@ export default {
data() {
return {
tableConfig: {
url: `/api/v1/perms/users/${this.object.id}/remote-apps/?draw=1`,
columns: ['name', 'type', 'asset', 'comment'],
url: `/api/v1/perms/users/${this.object.id}/applications/`,
columns: ['name', 'category_display', 'type', 'asset', 'comment'],
columnsMeta: {
name: {
formatterArgs: {
@ -27,12 +27,13 @@ export default {
}
},
type: {
displayKey: 'get_type_display',
displayKey: 'type_display',
width: '140px'
},
asset: {
label: '资产',
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 UserAssetPermissionRules from './UserAssetPermissionRules'
import UserGrantedAssets from './UserGrantedAssets'
import UserGrantedRemoteApps from './UserGrantedRemoteApps'
import UserRemoteAppPermissionRules from './UserRemoteAppPermissionRules'
import UserGrantedApplications from './UserGrantedApplications'
import UserApplicationPermissionRules from './UserApplicationsPermissionRules'
import UserGrantedDatabases from './UserGrantedDatabases'
import UserGrantedK8Ss from './UserGrantedK8Ss'
import UserK8SPermissionRules from './UserK8SPermissionRules'
@ -24,8 +24,8 @@ export default {
UserInfo,
UserGrantedAssets,
UserAssetPermissionRules,
UserGrantedRemoteApps,
UserRemoteAppPermissionRules,
UserGrantedApplications,
UserApplicationPermissionRules,
UserGrantedDatabases,
UserDatabasePermissionRules,
UserK8SPermissionRules,
@ -55,29 +55,29 @@ export default {
name: 'UserAssetPermissionRules'
},
{
title: this.$t('users.tabs.grantedRemoteApps'),
name: 'UserGrantedRemoteApps'
title: this.$t('users.tabs.grantedApplications'),
name: 'UserGrantedApplications'
},
{
title: this.$t('users.tabs.remoteAppPermissionRules'),
name: 'UserRemoteAppPermissionRules'
},
{
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.ApplicationPermissionRules'),
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'
// }
]
}
}

View File

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