Merge pull request #808 from jumpserver/dev

v2.10.0 rc3
This commit is contained in:
Jiangjie.Bai
2021-05-18 19:18:19 +08:00
committed by GitHub
27 changed files with 356 additions and 54 deletions

View File

@@ -228,7 +228,8 @@ export default {
const _tableConfig = localStorage.getItem('tableConfig')
? JSON.parse(localStorage.getItem('tableConfig'))
: {}
const configShowColumnsNames = _.get(_tableConfig[this.$route.name], 'showColumns', null)
const tableName = this.config.name || this.$route.name
const configShowColumnsNames = _.get(_tableConfig[tableName], 'showColumns', null)
let showColumnsNames = configShowColumnsNames || defaultColumnsNames
if (showColumnsNames.length === 0) {
showColumnsNames = totalColumnsNames
@@ -270,7 +271,8 @@ export default {
const _tableConfig = localStorage.getItem('tableConfig')
? JSON.parse(localStorage.getItem('tableConfig'))
: {}
_tableConfig[this.$route.name] = {
const tableName = this.config.name || this.$route.name
_tableConfig[tableName] = {
'showColumns': columns
}
localStorage.setItem('tableConfig', JSON.stringify(_tableConfig))

View File

@@ -269,7 +269,7 @@
"MFAConfirm": "MFA 认证",
"MFARequireForSecurity": "为了安全请输入MFA",
"PasswordConfirm": "密码认证",
"PasswordRequireForSecurity": "为了安全请输入MFA",
"PasswordRequireForSecurity": "为了安全请输入密码",
"Members": "成员",
"More": "更多",
"Message": "消息",
@@ -856,9 +856,12 @@
"Expire": " 过期",
"WeCom": "企业微信",
"DingTalk": "钉钉",
"dingTalkTest": "测试",
"weComTest": "测试",
"setting": "设置"
},
"tickets": {
"PermissionName": "授权规则名称",
"Accept": "同意",
"AssignedMe": "待我审批",
"Assignee": "处理人",
@@ -1136,7 +1139,9 @@
"GatherUserList": "收集用户",
"GatherUserTaskCreate": "创建任务",
"GatherUserTaskList": "任务列表",
"GatherUserTaskUpdate": "更新任务"
"GatherUserTaskUpdate": "更新任务",
"GatherUserTaskDetail": "任务详情",
"GatherUserTaskExecutionList": "任务执行列表"
},
"Import": "导入",
"ImportLicense": "导入许可证",

View File

@@ -265,8 +265,8 @@
"Info": "Info",
"MFAConfirm": "MFA Confirm",
"MFARequireForSecurity": "MFA required for security",
"PasswordConfirm": "MFA Confirm",
"PasswordRequireForSecurity": "MFA required for security",
"PasswordConfirm": "Password Confirm",
"PasswordRequireForSecurity": "Password required for security",
"Members": "Members",
"More": "More",
"Message": "Message",
@@ -851,10 +851,13 @@
"Expire": "",
"WeCom": "WeCom",
"DingTalk": "DingTalk",
"dingTalkTest": "Test",
"weComTest": "Test",
"setting": "Setting"
},
"tickets": {
"PermissionName": "Permission name",
"Accept": "Accept",
"AssignedMe": "Assigned me",
"Assignee": "Assignee",
@@ -1130,7 +1133,9 @@
"GatherUserList": "Gather user",
"GatherUserTaskCreate": "Create gather user task",
"GatherUserTaskList": "Gather user task list",
"GatherUserTaskUpdate": "Update gather user task"
"GatherUserTaskUpdate": "Update gather user task",
"GatherUserTaskDetail": "Gather user detail",
"GatherUserTaskExecutionList": "Gather user task execution list"
},
"Import": "Import",
"ImportLicense": "Import license",

View File

@@ -89,7 +89,7 @@ export default {
for (const preTab of preActiveTabs) {
for (const tabName in this.tabIndices) {
if (preTab.toLowerCase() === tabName.toLowerCase()) {
if (preTab && tabName && preTab.toLowerCase() === tabName.toLowerCase()) {
return tabName
}
}

View File

@@ -38,7 +38,7 @@ export default {
],
fieldsMeta: {
public_key_comment: {
label: this.$t('users.Name'),
label: this.$t('common.Name'),
disabled: true
},
public_key_hash_md5: {

View File

@@ -64,6 +64,8 @@ export default {
hasCreate: false,
hasMoreActions: false,
hasBulkDelete: false,
hasExport: false,
hasImport: false,
// createRoute: 'RemoteAppCreate',
moreCreates: {
dropdown: this.getCreateAppType(),

View File

@@ -28,15 +28,15 @@ function getFields() {
hidden: (form) => {
if (['mysql', 'postgresql', 'mariadb', 'oracle'].includes(form.protocol)) {
this.fieldsMeta.username.rules[0].required = true
return
}
if (['vnc'].includes(form.protocol)) {
} else if (['vnc'].includes(form.protocol)) {
this.fieldsMeta.username.rules[0].required = false
return
} else {
this.fieldsMeta.username.rules[0].required = !(form.login_mode === 'manual' || form.username_same_with_user)
}
if (form.username_same_with_user) {
this.fieldsMeta.username.el.disabled = true
form.username = ''
}
this.fieldsMeta.username.rules[0].required = !(form.login_mode === 'manual' || form.username_same_with_user)
this.fieldsMeta.username.el.disabled = !!form.username_same_with_user
}
}

View File

@@ -91,15 +91,9 @@ export default {
]
},
headerActions: {
hasLeftActions: true,
hasBulkDelete: false,
hasImport: false,
hasExport: true,
hasCreate: false,
hasSearch: true,
hasMoreActions: false,
moreActionsTitle: this.$t('common.More'),
moreActionsType: 'primary',
extraMoreActions: [
{
title: this.$t('common.PushSelected'),

View File

@@ -1,7 +1,7 @@
<template>
<GenericDetailPage :object.sync="TaskDetail" :active-menu.sync="config.activeMenu" v-bind="config" v-on="$listeners">
<GenericDetailPage :object.sync="systemUser" :active-menu.sync="config.activeMenu" v-bind="config" v-on="$listeners">
<keep-alive>
<component :is="config.activeMenu" :object="TaskDetail" />
<component :is="config.activeMenu" :object="systemUser" />
</keep-alive>
</GenericDetailPage>
</template>
@@ -20,8 +20,9 @@ export default {
AccountList
},
data() {
const vm = this
return {
TaskDetail: {},
systemUser: {},
config: {
activeMenu: 'Detail',
submenu: [
@@ -37,9 +38,19 @@ export default {
title: this.$t('assets.AccountList'),
name: 'AccountList'
}
],
hasRightSide: true
hasRightSide: true,
actions: {
updateCallback: () => {
const id = this.$route.params.id
const routeName = 'SystemUserUpdate'
this.$router.push({
name: routeName,
params: { id: id },
query: { protocol: vm.systemUser.protocol }
})
}
}
}
}
}

View File

@@ -5,6 +5,7 @@
:url="url"
:get-method="getMethod"
:fields-meta="fieldsMeta"
:more-buttons="moreButtons"
:has-detail-in-msg="false"
/>
</IBox>
@@ -21,8 +22,24 @@ export default {
GenericCreateUpdateForm
},
data() {
const vm = this
return {
url: '/api/v1/settings/setting/?category=dingtalk',
moreButtons: [
{
title: this.$t('setting.dingTalkTest'),
callback: function(value, form) {
vm.$axios.post(
'/api/v1/settings/dingtalk/testing/',
value
).then(res => {
vm.$message.success(res['msg'])
}).catch(err => {
vm.$message.error(err['response']['data']['error'])
})
}
}
],
fields: [
[
this.$t('common.BasicInfo'),

View File

@@ -5,6 +5,7 @@
:url="url"
:get-method="getMethod"
:fields-meta="fieldsMeta"
:more-buttons="moreButtons"
:has-detail-in-msg="false"
/>
</IBox>
@@ -21,8 +22,24 @@ export default {
GenericCreateUpdateForm
},
data() {
const vm = this
return {
url: '/api/v1/settings/setting/?category=wecom',
moreButtons: [
{
title: this.$t('setting.weComTest'),
callback: function(value, form) {
vm.$axios.post(
'/api/v1/settings/wecom/testing/',
value
).then(res => {
vm.$message.success(res['msg'])
}).catch(err => {
vm.$message.error(err['response']['data']['error'])
})
}
}
],
fields: [
[
this.$t('common.BasicInfo'),

View File

@@ -154,6 +154,10 @@ export default {
key: this.$t('tickets.SystemUser'),
value: this.object.meta.apply_system_user_group.toString()
},
{
key: this.$t('assets.Action'),
value: this.object.meta.apply_actions_display.toString()
},
{
key: this.$t('common.dateStart'),
value: toSafeLocalDateStr(this.object.meta.apply_date_start)
@@ -165,14 +169,27 @@ export default {
]
},
assignedCardItems() {
const vm = this
return [
{
key: this.$t('tickets.PermissionName'),
value: this.object.meta.approve_permission_name,
formatter: function(item, value) {
const to = { name: 'AssetPermissionDetail', params: { id: vm.object.id }}
return <router-link to={to}>{ value }</router-link>
}
},
{
key: this.$t('assets.Asset'),
value: this.object.meta.approve_assets_display
value: this.object.meta.approve_assets_display.toString()
},
{
key: this.$t('tickets.SystemUser'),
value: this.object.meta.approve_system_users_display
value: this.object.meta.approve_system_users_display.toString()
},
{
key: this.$t('assets.Action'),
value: this.object.meta.approve_actions_display.toString()
},
{
key: this.$t('common.dateStart'),

View File

@@ -45,6 +45,7 @@
</el-button>
</template>
<el-button
v-if="isSelfTicket"
:disabled="object.status === 'closed'"
type="danger"
size="small"
@@ -103,6 +104,9 @@ export default {
computed: {
hasActionPerm() {
return this.object.assignees.indexOf(this.$store.state.users.profile.id) !== -1
},
isSelfTicket() {
return this.object.applicant === this.$store.state.users.profile.id
}
},
mounted() {

View File

@@ -150,6 +150,9 @@ export default {
const method = this.getMethod()
if (method === 'post' && !value.password_strategy) {
delete value['password']
if (this.currentOrgIsRoot) {
delete value['groups']
}
}
if (value.update_password !== undefined) {
delete value.update_password
@@ -166,6 +169,9 @@ export default {
},
afterGetUser(user) {
this.user = user
if (this.$route.query.clone_from) {
this.user.groups = []
}
}
}
}

View File

@@ -87,7 +87,7 @@ export default {
onAddSuccess: (items, that) => {
this.$log.debug('AssetSelect value', that.assets)
this.$message.success(this.$t('common.updateSuccessMsg'))
this.$refs.listTable.reloadTable()
this.$refs.listTable.$refs.ListTable.reloadTable()
that.$refs.assetSelect.$refs.select2.clearSelected()
}
},
@@ -115,7 +115,7 @@ export default {
that.iHasObjects = [...that.iHasObjects, ...objects]
that.$refs.select2.clearSelected()
this.$message.success(this.$t('common.updateSuccessMsg'))
this.$refs.listTable.reloadTable()
this.$refs.listTable.$refs.ListTable.reloadTable()
},
performDelete: (item) => {
const nodes = this.object.nodes

View File

@@ -40,8 +40,8 @@ export default {
}
}
},
updateSuccessNextRoute: { name: 'CloudCenter' },
createSuccessNextRoute: { name: 'CloudCenter' },
updateSuccessNextRoute: { name: 'AccountList' },
createSuccessNextRoute: { name: 'AccountList' },
getUrl() {
const params = this.$route.params
let url = `/api/v1/xpack/cloud/accounts/`

View File

@@ -17,9 +17,11 @@ export default {
TabPage
},
data() {
const vm = this
return {
Account: {
name: '', provider_display: '', validity_display: '', comment: '', date_created: '', created_by: '' },
name: '', provider: '', provider_display: '', validity_display: '', comment: '', date_created: '', created_by: ''
},
config: {
activeMenu: 'AccountDetail',
submenu: [
@@ -29,7 +31,16 @@ export default {
}
],
actions: {
deleteSuccessRoute: 'CloudCenter'
deleteSuccessRoute: 'CloudCenter',
updateCallback: () => {
const id = this.$route.params.id
const routeName = 'AccountUpdate'
this.$router.push({
name: routeName,
params: { id: id },
query: { provider: vm.Account.provider }
})
}
}
}
}

View File

@@ -24,7 +24,8 @@ export default {
url: '/api/v1/assets/gathered-users/',
hasTree: true,
columns: [
'hostname', 'ip', 'username', 'date_last_login', 'present', 'ip_last_login', 'date_updated'
'hostname', 'ip', 'username', 'date_last_login', 'present',
'ip_last_login', 'date_updated'
],
columnsMeta: {
hostname: {

View File

@@ -17,10 +17,6 @@ export default {
[this.$t('common.Other'), ['comment']]
],
url: '/api/v1/xpack/gathered-user/tasks/',
initial: {
is_periodic: true,
interval: 24
},
hasDetailInMsg: false,
fieldsMeta: {
crontab: {
@@ -48,12 +44,16 @@ export default {
}
}
},
'is_periodic': {
is_periodic: {
type: 'switch'
}
},
createSuccessNextRoute: { name: 'GatherUserListIndex' },
updateSuccessNextRoute: { name: 'GatherUserListIndex' }
updateSuccessNextRoute: { name: 'GatherUserListIndex' },
cleanFormValue(values) {
values.interval = values.interval || null
return values
}
}
}
}

View File

@@ -0,0 +1,70 @@
<template>
<el-row :gutter="20">
<el-col :span="14">
<DetailCard :items="detailCardItems" />
</el-col>
</el-row>
</template>
<script>
import DetailCard from '@/components/DetailCard'
import { toSafeLocalDateStr } from '@/utils/common'
export default {
name: 'Detail',
components: {
DetailCard
},
props: {
object: {
type: Object,
default: () => {}
}
},
data() {
return {
}
},
computed: {
detailCardItems() {
return [
{
key: this.$t('common.Name'),
value: this.object.name
},
{
key: this.$t('xpack.Cloud.PeriodicPerform'),
value: this.object.is_periodic ? (this.$t('xpack.GatherUser.True')) : (this.$t('xpack.GatherUser.False'))
},
{
key: this.$t('xpack.Cloud.Periodic'),
value: this.object.periodic_display
},
{
key: this.$t('xpack.Cloud.DateLastSync'),
value: this.object.date_last_sync ? toSafeLocalDateStr(this.object.date_created) : ''
},
{
key: this.$t('xpack.Cloud.DateCreated'),
value: this.object.date_created ? toSafeLocalDateStr(this.object.date_created) : ''
},
{
key: this.$t('common.Comment'),
value: this.object.comment
}
]
}
},
mounted() {
},
methods: {
}
}
</script>
<style lang='less' scoped>
</style>

View File

@@ -0,0 +1,64 @@
<template>
<GenericListTable ref="GenericListTable" :table-config="tableConfig" :header-actions="headerActions" />
</template>
<script>
import GenericListTable from '@/layout/components/GenericListTable/index'
import { BooleanFormatter, DateFormatter } from '@/components/TableFormatters'
export default {
name: 'TaskExecutionList',
components: { GenericListTable },
props: {
object: {
type: Object,
default: () => {}
}
},
data() {
return {
headerActions: {
hasLeftActions: false,
hasBulkDelete: false,
hasImport: false,
hasExport: false,
hasSearch: true
},
tableConfig: {
url: `/api/v1/xpack/gathered-user/task-executions/?task=${this.object.id}`,
columns: [
{
prop: 'timedelta',
label: this.$t('ops.timeDelta'),
formatter: function(row) {
return row.timedelta.toFixed(2) + 's'
}
},
{
prop: 'date_start',
label: this.$t('common.DateStart'),
formatter: DateFormatter
},
{
prop: 'success',
label: this.$t('common.Success'),
width: '90px',
align: 'center',
formatter: BooleanFormatter,
formatterArgs: {
iconChoices: {
false: 'fa-times text-danger',
true: 'fa-check text-primary'
}
}
}
]
}
}
}
}
</script>
<style lang='less' scoped>
</style>

View File

@@ -0,0 +1,45 @@
<template>
<GenericDetailPage :object.sync="TaskDetail" :active-menu.sync="config.activeMenu" v-bind="config" v-on="$listeners">
<keep-alive>
<component :is="config.activeMenu" :object="TaskDetail" />
</keep-alive>
</GenericDetailPage>
</template>
<script>
import { GenericDetailPage, TabPage } from '@/layout/components'
import Detail from './Detail'
import TaskExecutionList from './TaskExecutionList'
export default {
name: 'SyncInstanceTaskDetail',
components: {
GenericDetailPage,
TabPage,
Detail,
TaskExecutionList
},
data() {
return {
TaskDetail: {},
config: {
activeMenu: 'Detail',
submenu: [
{
title: this.$t('xpack.GatherUser.GatherUserTaskDetail'),
name: 'Detail'
},
{
title: this.$t('xpack.GatherUser.GatherUserTaskExecutionList'),
name: 'TaskExecutionList'
}
],
hasRightSide: true
}
}
}
}
</script>
<style scoped>
</style>

View File

@@ -4,6 +4,7 @@
<script>
import GenericListTable from '@/layout/components/GenericListTable'
import { DetailFormatter } from '@/components/TableFormatters'
export default {
components: {
@@ -14,13 +15,23 @@ export default {
return {
tableConfig: {
name: 'TaskListTable',
url: '/api/v1/xpack/gathered-user/tasks/',
columns: [
'name', 'nodes', 'periodic_display', 'executed_times', 'actions'
],
columnsShow: {
min: ['name', 'nodes', 'periodic_display', 'executed_times', 'actions']
},
columnsMeta: {
name: {
formatter: null
formatter: DetailFormatter,
formatterArgs: {
route: 'GatherUserTaskDetail',
routeQuery: {
activeTab: 'Detail'
}
}
},
nodes: {
formatter: function(row, column, cellValue, index) {
@@ -31,6 +42,15 @@ export default {
showOverflowTooltip: true,
width: 150
},
executed_times: {
formatter: DetailFormatter,
formatterArgs: {
route: 'GatherUserTaskDetail',
routeQuery: {
activeTab: 'TaskExecutionList'
}
}
},
actions: {
formatterArgs: {
updateRoute: 'GatherUserTaskUpdate',
@@ -61,7 +81,8 @@ export default {
hasRefresh: false,
hasExport: false,
hasMoreActions: false,
createRoute: 'GatherUserTaskCreate'
createRoute: 'GatherUserTaskCreate',
hasColumnSetting: false
}
}
}

View File

@@ -108,7 +108,7 @@ export default {
that.iHasObjects = [...that.iHasObjects, ...objects]
that.$refs.select2.clearSelected()
this.$message.success(this.$t('common.updateSuccessMsg'))
this.$refs.GenericListTable.reloadTable()
this.$refs.GenericListTable.$refs.ListTable.reloadTable()
window.location.reload()
}
}

View File

@@ -51,10 +51,12 @@ export default {
try {
await performDelete.bind(this)()
this.$message.success(this.$t('common.deleteSuccessMsg'))
this.$router.push('/xpack/orgs/') // 返回列表
return done()
} catch (error) {
this.$log.error(error)
} finally {
instance.confirmButtonLoading = false
this.$router.push('/xpack/orgs/') // 返回列表
}
}
}).catch(() => {

View File

@@ -70,7 +70,7 @@ export default {
components: {
},
props: {
// koko/guacamole/omnidb/core
// koko/guacamole/omnidb/lion/core
type: {
type: String,
default: 'koko',
@@ -86,7 +86,8 @@ export default {
const nameMapper = {
koko: 'KoKo',
guacamole: 'Guacamole',
omnidb: 'OmniDB'
omnidb: 'OmniDB',
lion: 'Lion'
}
return nameMapper[this.componentMetric.type]
}

View File

@@ -128,7 +128,7 @@ export default {
meta: { title: i18n.t('xpack.InterfaceSettings'), permissions: [rolec.PERM_SUPER] }
},
{
path: 'gathered-users',
path: 'gathered-user',
component: empty,
redirect: '',
meta: { title: i18n.t('xpack.GatherUser.GatherUserList') },
@@ -137,34 +137,41 @@ export default {
path: '',
component: () => import('@/views/xpack/GatheredUser/index'),
name: 'GatherUserListIndex',
meta: { title: i18n.t('xpack.GatherUser.GatherUser'), activeMenu: '/xpack/gathered-users' }
meta: { title: i18n.t('xpack.GatherUser.GatherUser'), activeMenu: '/xpack/gathered-user' }
},
{
path: '',
component: () => import('@/views/xpack/GatheredUser/GatheredUserList'),
name: 'GatherUserList',
hidden: true,
meta: { title: i18n.t('xpack.GatherUser.GatherUserList'), activeMenu: '/xpack/gathered-users' }
meta: { title: i18n.t('xpack.GatherUser.GatherUserList'), activeMenu: '/xpack/gathered-user' }
},
{
path: 'tasks',
component: () => import('@/views/xpack/GatheredUser/TaskList'),
name: 'GatherUserTaskList',
meta: { title: i18n.t('xpack.GatherUser.GatherUserTaskList'), activeMenu: '/xpack/gathered-users' },
meta: { title: i18n.t('xpack.GatherUser.GatherUserTaskList'), activeMenu: '/xpack/gathered-user' },
hidden: true
},
{
path: 'tasks/:id',
component: () => import('@/views/xpack/GatheredUser/TaskDetail/index'),
name: 'GatherUserTaskDetail',
meta: { title: i18n.t('xpack.GatherUser.GatherUserTaskDetail'), activeMenu: '/xpack/gathered-user' },
hidden: true
},
{
path: 'tasks/create',
component: () => import('@/views/xpack/GatheredUser/TaskCreateUpdate'),
name: 'GatherUserTaskCreate',
meta: { title: i18n.t('xpack.GatherUser.GatherUserTaskCreate'), activeMenu: '/xpack/gathered-users' },
meta: { title: i18n.t('xpack.GatherUser.GatherUserTaskCreate'), activeMenu: '/xpack/gathered-user' },
hidden: true
},
{
path: 'tasks/:id/update',
component: () => import('@/views/xpack/GatheredUser/TaskCreateUpdate'),
name: 'GatherUserTaskUpdate',
meta: { title: i18n.t('xpack.GatherUser.GatherUserTaskUpdate'), action: 'update', activeMenu: '/xpack/gathered-users' },
meta: { title: i18n.t('xpack.GatherUser.GatherUserTaskUpdate'), action: 'update', activeMenu: '/xpack/gathered-user' },
hidden: true
}
]