Merge remote-tracking branch 'origin/master'

This commit is contained in:
OrangeM21
2020-05-21 18:17:35 +08:00
10 changed files with 71 additions and 161 deletions

View File

@@ -3,7 +3,7 @@ export default {
name: 'ItemValue',
props: {
value: {
type: [String, Function, Array],
type: [String, Function, Array, Object],
default: ''
},
item: {

View File

@@ -773,6 +773,16 @@
"LicenseDetail": "许可证详情",
"ImportLicense": "导入许可证",
"LicenseFile": "许可证文件",
"ImportLicenseTip": "请导入许可证"
"ImportLicenseTip": "请导入许可证",
"logoLogoutTip": "提示将会显示在企业版用户退出页面建议图片大小为82px*82px",
"logoIndexTip": "提示:将会显示在管理页面左上方(建议图片大小为: 185px*55px",
"faviconTip": "提示:网站图标(建议图片大小为: 16px*16px",
"loginImageTip": "提示:将会显示在企业版用户登录页面(建议图片大小为: 492*472px",
"loginTitleTip": "提示将会显示在企业版用户登录页面eg: 欢迎使用JumpServer开源堡垒机)",
"restoreDialogTitle": "你确认吗",
"restoreDialogMessage": "您确定要恢复默认初始化吗?",
"import": "导入",
"technologyConsult": "技术咨询",
"consult": "咨询"
}
}

View File

@@ -9,11 +9,13 @@
<script>
import { GenericDetailPage, TabPage } from '@/layout/components'
import HistoryExecutionDetail from './HistoryExecutionDetail'
import CeleryTaskLog from '../../CeleryTaskLog'
export default {
components: {
HistoryExecutionDetail,
GenericDetailPage,
CeleryTaskLog,
TabPage
},
data() {
@@ -29,7 +31,7 @@ export default {
},
{
title: this.$t('jobcenter.output'),
name: 'OutPut'
name: 'CeleryTaskLog'
}
],
hasRightSide: false,

View File

@@ -72,9 +72,10 @@ export default {
},
{
key: this.$t('jobcenter.latestVersion'),
value: this.object.latest_execution.adhoc_short_id,
value: this.object.latest_execution,
callback: function(row, data) {
return <a href=''>{ data }</a>
const url = `/ops/adhoc/${data.adhoc}`
return <a href={ url }>{ data.adhoc_short_id }</a>
}
},
{

View File

@@ -11,9 +11,11 @@ import { GenericDetailPage, TabPage } from '@/layout/components'
import TaskDetail from './TaskDetail'
import TaskHistory from './TaskHistory'
import TaskAdhoc from './TaskAdhoc'
import CeleryTaskLog from '../CeleryTaskLog'
export default {
components: {
GenericDetailPage,
CeleryTaskLog,
TaskHistory,
TaskDetail,
TaskAdhoc,
@@ -39,7 +41,7 @@ export default {
},
{
title: this.$t('jobcenter.laskExecutionOutput'),
name: 'laskExecutionOutput'
name: 'CeleryTaskLog'
}
],
hasRightSide: false

View File

@@ -50,7 +50,7 @@ export default {
fieldsMeta: {
login_title: {
label: this.$t('xpack.loginTitle'),
helpText: '提示将会显示在企业版用户登录页面eg: 欢迎使用JumpServer开源堡垒机)'
helpText: this.$t('xpack.loginTitleTip')
},
login_image: {
component: UploadField,
@@ -58,7 +58,7 @@ export default {
el: {
width: '10%',
height: '10%',
tip: '提示:将会显示在企业版用户登录页面(建议图片大小为: 492*472px'
tip: this.$t('xpack.loginImageTip')
},
on: {
fileChange: ([value], updateForm) => {
@@ -73,7 +73,7 @@ export default {
el: {
width: '5%',
height: '5%',
tip: '提示:网站图标(建议图片大小为: 16px*16px'
tip: this.$t('xpack.faviconTip')
},
on: {
fileChange: ([value], updateForm) => {
@@ -87,7 +87,7 @@ export default {
el: {
width: '10%',
height: '10%',
tip: '提示:将会显示在管理页面左上方(建议图片大小为: 185px*55px'
tip: this.$t('xpack.logoIndexTip')
},
on: {
fileChange: ([value], updateForm) => {
@@ -101,7 +101,7 @@ export default {
el: {
width: '5%',
height: '5%',
tip: '提示将会显示在企业版用户退出页面建议图片大小为82px*82px'
tip: this.$t('xpack.logoLogoutTip')
},
on: {
fileChange: ([value], updateForm) => {
@@ -115,11 +115,12 @@ export default {
{
title: this.$t('xpack.RestoreButton'),
callback: function(value, form) {
this.$confirm('您确定要恢复默认初始化吗?', '你确认吗?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$confirm(this.$t('xpack.restoreDialogMessage'),
this.$t('xpack.restoreDialogTitle'), {
confirmButtonText: this.$t('common.Confirm'),
cancelButtonText: this.$t('common.Cancel'),
type: 'warning'
}).then(() => {
restoreInterface().then(res => {
this.$message.success(res.success)
location.reload()

View File

@@ -10,26 +10,7 @@
<DetailCard :title="cardTitle" :items="detailItems" />
</el-col>
<el-col :span="10">
<el-card class="box-card primary">
<div slot="header" class="clearfix">
<i class="fa fa-info" />
<span>{{ cardActions }}</span>
</div>
<el-table class="el-table" :data="cardActionData" :show-header="false">
<el-table-column prop="name" />
<el-table-column prop="button" align="right">
<template slot-scope="scope">
<el-button
type="primary"
size="mini"
@click="handleButtonAction(scope.$index, scope.row)"
>
{{ scope.row.button }}
</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<QuickActions type="primary" :actions="quickActions" />
</el-col>
</el-row>
</div>
@@ -51,6 +32,7 @@
<script>
import { GenericDetailPage } from '@/layout/components'
import { QuickActions } from '@/components'
import DetailCard from '@/components/DetailCard/index'
import { importLicense } from '@/views/xpack/api'
import { mapGetters } from 'vuex'
@@ -59,7 +41,8 @@ export default {
name: 'License',
components: {
GenericDetailPage,
DetailCard
DetailCard,
QuickActions
},
data() {
return {
@@ -79,7 +62,30 @@ export default {
actions: {
detailApiUrl: '/api/v1/xpack/license/detail'
}
}
},
quickActions: [
{
title: this.$t('xpack.ImportLicense'),
attrs: {
type: 'primary',
label: this.$t('xpack.import')
},
callbacks: {
click: this.importAction
}
},
{
title: this.$t('xpack.technologyConsult'),
attrs: {
type: 'primary',
label: this.$t('xpack.consult')
},
callbacks: {
click: this.consultAction
}
}
]
}
},
computed: {
@@ -92,23 +98,6 @@ export default {
cardTitle() {
return ''
},
cardActions() {
return this.$t('sessions.quickModify')
},
cardActionData() {
return [
{
name: '导入许可证',
button: '导入',
value: 'import'
},
{
name: '技术咨询',
button: '咨询',
value: 'consult'
}
]
},
detailItems() {
if (!this.publicSettings.XPACK_LICENSE_IS_VALID) {
return [
@@ -143,18 +132,6 @@ export default {
}
},
methods: {
handleButtonAction: function(index, row) {
switch (row.value) {
case 'import':
this.importAction()
break
case 'consult':
this.consultAction()
break
default:
console.log('No Match button action: ' + row.value)
}
},
importAction: function() {
this.dialogLicenseImport = true
},

View File

@@ -1,38 +0,0 @@
<template>
<el-popover
placement="bottom"
trigger="click"
>
<span v-for="item in getCellValue" :key="item">{{ item }} <br></span>
<el-button slot="reference" type="text">{{ getCellValueLength }}</el-button>
</el-popover>
</template>
<script>
import BaseFormatter from '@/components/ListTable/formatters/base'
export default {
name: 'LengthFormatter',
extends: BaseFormatter,
data() {
return {
visible: false,
dataContent: this.cellValue
}
},
computed: {
getCellValueLength() {
if (this.cellValue instanceof Array) {
return this.cellValue.length
}
return this.cellValue
},
getCellValue() {
return this.cellValue
}
}
}
</script>
<style scoped>
</style>

View File

@@ -45,8 +45,9 @@ export default {
performAdd: (items) => {
const objectId = this.object.id
const relationUrl = `/api/v1/orgs/orgs/${objectId}/`
const usersId = items.map(v => v.value)
const data = { users: usersId }
const objectRelationUsers = this.object.users
items.map(v => objectRelationUsers.push(v.value))
const data = { users: objectRelationUsers }
return this.$axios.patch(relationUrl, data)
},
performDelete: (item) => {
@@ -72,20 +73,21 @@ export default {
return { results: results, pagination: more, total: data.count }
}
},
hasObjectsId: this.object.admin_users,
hasObjectsId: this.object.admins,
performAdd: (items) => {
const objectId = this.object.id
const relationUrl = `/api/v1/orgs/orgs/${objectId}/`
const adminUsersId = items.map(v => v.value)
const data = { admin_users: adminUsersId }
const objectRelationAdmin = this.object.admins
items.map(v => objectRelationAdmin.push(v.value))
const data = { admins: objectRelationAdmin }
return this.$axios.patch(relationUrl, data)
},
performDelete: (item) => {
const objectId = this.object.id
const relationUrl = `/api/v1/orgs/orgs/${objectId}/`
const objectOldRelationAdminUsers = this.object.admin_users
const objectNewRelationAdminUsers = objectOldRelationAdminUsers.filter(v => v !== item.value)
const data = { system_users: objectNewRelationAdminUsers }
const objectOldRelationAdmin = this.object.admins
const objectNewRelationAdmin = objectOldRelationAdmin.filter(v => v !== item.value)
const data = { admins: objectNewRelationAdmin }
return this.$axios.patch(relationUrl, data)
}
}

View File

@@ -4,7 +4,6 @@
<script>
import { GenericListPage } from '@/layout/components'
import OrgFieldsFormatter from './OrgFieldsFormatter'
export default {
components: {
@@ -14,53 +13,7 @@ export default {
return {
tableConfig: {
url: '/api/v1/orgs/orgs/',
columns: [
'name', 'admins', 'auditors', 'users', 'user_groups', 'assets', 'domains',
'admin_users', 'system_users', 'labels', 'perms', 'comment', 'actions'
],
columnsMeta: {
admins: {
label: this.$t('xpack.Admin'),
formatter: OrgFieldsFormatter
},
auditors: {
label: this.$t('xpack.Auditor'),
formatter: OrgFieldsFormatter
},
users: {
label: this.$t('xpack.User'),
formatter: OrgFieldsFormatter
},
user_groups: {
label: this.$t('xpack.UserGroup'),
formatter: OrgFieldsFormatter
},
assets: {
label: this.$t('xpack.Asset'),
formatter: OrgFieldsFormatter
},
domains: {
label: this.$t('xpack.Domain'),
formatter: OrgFieldsFormatter
},
admin_users: {
label: this.$t('xpack.AdminUser'),
formatter: OrgFieldsFormatter
},
system_users: {
label: this.$t('xpack.SystemUser'),
formatter: OrgFieldsFormatter
},
labels: {
label: this.$t('xpack.Admin'),
formatter: OrgFieldsFormatter
},
perms: {
label: this.$t('xpack.Label'),
formatter: OrgFieldsFormatter
}
},
detailRoute: 'OrganizationDetail'
columns: ['name', 'comment', 'actions']
},
headerActions: {
hasExport: false,