mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-19 09:43:32 +00:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -538,7 +538,10 @@
|
||||
"terminate": "终断",
|
||||
"test": "测试",
|
||||
"type": "类型",
|
||||
"user": "用户"
|
||||
"user": "用户",
|
||||
"riskLevels": {
|
||||
"common": "普通"
|
||||
}
|
||||
},
|
||||
"setting": {
|
||||
"Secret": "密钥",
|
||||
|
@@ -533,7 +533,10 @@
|
||||
"terminate": "Terminate",
|
||||
"test": "Test",
|
||||
"type": "Type",
|
||||
"user": "Use"
|
||||
"user": "Use",
|
||||
"riskLevels": {
|
||||
"common": "common"
|
||||
}
|
||||
},
|
||||
"setting": {
|
||||
"Basic": "Basic setting",
|
||||
|
@@ -4,8 +4,7 @@
|
||||
ref="form"
|
||||
:method="method"
|
||||
:form="form"
|
||||
:fields="fields"
|
||||
:url="totalUrl"
|
||||
:url="iUrl"
|
||||
:is-submitting="isSubmitting"
|
||||
v-bind="$attrs"
|
||||
v-on="$listeners"
|
||||
@@ -24,12 +23,6 @@ export default {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
fields: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return []
|
||||
}
|
||||
},
|
||||
object: {
|
||||
type: Object,
|
||||
default: null
|
||||
@@ -48,7 +41,9 @@ export default {
|
||||
},
|
||||
performSubmit: {
|
||||
type: Function,
|
||||
default: null
|
||||
default(validValues) {
|
||||
return this.$axios[this.method](this.iUrl, validValues)
|
||||
}
|
||||
},
|
||||
createSuccessMsg: {
|
||||
type: String,
|
||||
@@ -76,6 +71,12 @@ export default {
|
||||
return { name: routeName }
|
||||
}
|
||||
},
|
||||
getNextRoute: {
|
||||
type: Function,
|
||||
default(res, method) {
|
||||
return method === 'post' ? this.createSuccessNextRoute : this.updateSuccessNextRoute
|
||||
}
|
||||
},
|
||||
getMethod: {
|
||||
type: Function,
|
||||
default: function() {
|
||||
@@ -87,12 +88,6 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
getNextRoute: {
|
||||
type: Function,
|
||||
default(res, method) {
|
||||
return method === 'post' ? this.createSuccessNextRoute : this.updateSuccessNextRoute
|
||||
}
|
||||
},
|
||||
getUrl: {
|
||||
type: Function,
|
||||
default: function() {
|
||||
@@ -103,6 +98,33 @@ export default {
|
||||
}
|
||||
return url
|
||||
}
|
||||
},
|
||||
onPerformSuccess: {
|
||||
type: Function,
|
||||
default(res, method, vm) {
|
||||
const msg = method === 'post' ? this.createSuccessMsg : this.updateSuccessMsg
|
||||
const route = this.getNextRoute(res, method)
|
||||
this.$emit('submitSuccess', res)
|
||||
this.$message.success(msg)
|
||||
setTimeout(() => this.$router.push(route), 100)
|
||||
}
|
||||
},
|
||||
onPerformError: {
|
||||
type: Function,
|
||||
default(error, method, vm) {
|
||||
this.$emit('submitError', error)
|
||||
const response = error.response
|
||||
const data = response.data
|
||||
if (response.status === 400) {
|
||||
for (const key of Object.keys(data)) {
|
||||
let value = data[key]
|
||||
if (value instanceof Array) {
|
||||
value = value.join(';')
|
||||
}
|
||||
this.$refs.form.setFieldError(key, value)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@@ -116,11 +138,11 @@ export default {
|
||||
method() {
|
||||
return this.getMethod(this)
|
||||
},
|
||||
totalUrl() {
|
||||
iUrl() {
|
||||
return this.getUrl()
|
||||
}
|
||||
},
|
||||
async mounted() {
|
||||
async created() {
|
||||
this.loading = true
|
||||
try {
|
||||
const values = await this.getFormValue()
|
||||
@@ -136,36 +158,12 @@ export default {
|
||||
values = this.cleanFormValue(values)
|
||||
return handler(values)
|
||||
},
|
||||
defaultPerformSubmit(validValues) {
|
||||
return this.$axios[this.method](this.totalUrl, validValues)
|
||||
},
|
||||
defaultOnSubmit(validValues) {
|
||||
const performSubmit = this.performSubmit || this.defaultPerformSubmit
|
||||
const msg = this.method === 'post' ? this.createSuccessMsg : this.updateSuccessMsg
|
||||
const event = this.method === 'post' ? 'createSuccess' : 'updateSuccess'
|
||||
this.isSubmitting = true
|
||||
performSubmit(validValues).then((res) => {
|
||||
const route = this.getNextRoute(res, this.method)
|
||||
this.$emit(event, res)
|
||||
this.$emit('submitSuccess', res)
|
||||
this.$message.success(msg)
|
||||
setTimeout(() => this.$router.push(route), 100)
|
||||
}).catch(error => {
|
||||
this.$emit('submitError', error)
|
||||
const response = error.response
|
||||
const data = response.data
|
||||
if (response.status === 400) {
|
||||
for (const key of Object.keys(data)) {
|
||||
let value = data[key]
|
||||
if (value instanceof Array) {
|
||||
value = value.join(';')
|
||||
}
|
||||
this.$refs.form.setFieldError(key, value)
|
||||
}
|
||||
}
|
||||
}).finally(() => {
|
||||
this.isSubmitting = false
|
||||
})
|
||||
this.performSubmit(validValues)
|
||||
.then((res) => this.onPerformSuccess.bind(this)(res, this.method, this))
|
||||
.catch((error) => this.onPerformError(error, this.method, this))
|
||||
.finally(() => { this.isSubmitting = false })
|
||||
},
|
||||
async getFormValue() {
|
||||
if (this.method !== 'put') {
|
||||
@@ -174,11 +172,12 @@ export default {
|
||||
let object = this.object
|
||||
if (object === null) {
|
||||
object = await this.getObjectDetail()
|
||||
this.$emit('update:object', object)
|
||||
}
|
||||
return object
|
||||
},
|
||||
async getObjectDetail() {
|
||||
return this.$axios.get(this.totalUrl)
|
||||
return this.$axios.get(this.iUrl)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -37,6 +37,9 @@ const mutations = {
|
||||
SET_ORGS: (state, orgs) => {
|
||||
state.orgs = orgs
|
||||
},
|
||||
ADD_ORG: (state, org) => {
|
||||
state.orgs.push(org)
|
||||
},
|
||||
SET_ROLES(state, roles) {
|
||||
state.roles = roles
|
||||
},
|
||||
@@ -119,6 +122,9 @@ const actions = {
|
||||
}).catch((e) => reject(e))
|
||||
})
|
||||
},
|
||||
addAdminOrg({ commit, state }, org) {
|
||||
commit('ADD_ORG', org)
|
||||
},
|
||||
// user logout
|
||||
logout({ commit, state }) {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
@@ -9,7 +9,7 @@
|
||||
</el-row>
|
||||
</template>a
|
||||
|
||||
<script>
|
||||
<script type="text/jsx">
|
||||
import DetailCard from '@/components/DetailCard'
|
||||
import QuickActions from '@/components/QuickActions'
|
||||
import { toSafeLocalDateStr } from '@/utils/common'
|
||||
@@ -99,8 +99,13 @@ export default {
|
||||
key: this.$t('users.IsActive')
|
||||
},
|
||||
{
|
||||
value: `${this.object.public_key_comment} ${this.object.public_key_hash_md5}`,
|
||||
key: 'SSHKey'
|
||||
value: this.object,
|
||||
key: 'SSHKey',
|
||||
formatter: (item, val) => {
|
||||
const comment = val.public_key_comment
|
||||
const md5 = val.public_key_hash_md5
|
||||
return <span>{ comment } <br /> { md5 }</span>
|
||||
}
|
||||
},
|
||||
{
|
||||
value: this.object.mfa_level_display,
|
||||
|
@@ -11,7 +11,7 @@ export default {
|
||||
GenericCreateUpdatePage
|
||||
},
|
||||
data() {
|
||||
const appType = this.$route.query.type
|
||||
const appType = this.$route.query.type || 'chrome'
|
||||
const fieldsMap = REMOTE_APP_TYPE_FIELDS_MAP[appType]
|
||||
const appTypeMeta = REMOTE_APP_TYPE_META_MAP[appType]
|
||||
const pathInitial = REMOTE_APP_PATH_DEFAULT_MAP[appType]
|
||||
|
@@ -15,7 +15,7 @@ export default {
|
||||
name: 'RulesCreateUpdate',
|
||||
components: { GenericCreateUpdatePage },
|
||||
data() {
|
||||
const filterId = this.$route.query.filter
|
||||
const filterId = this.$route.query.filter || '00000000-0000-0000-0000-000000000000'
|
||||
const regexPlaceholder = 'rm.*|reboot|shutdown'
|
||||
const commandPlaceholder = 'rm\rreboot'
|
||||
const commandHelpText = this.$t('assets.CommandFilterRuleContentHelpText')
|
||||
@@ -41,7 +41,7 @@ export default {
|
||||
multiple: false
|
||||
}
|
||||
},
|
||||
'action.value': {
|
||||
type: {
|
||||
on: {
|
||||
change: ([val]) => {
|
||||
if (val === 'command') {
|
||||
@@ -81,11 +81,6 @@ export default {
|
||||
},
|
||||
url: `/api/v1/assets/cmd-filters/${filterId}/rules/`
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
},
|
||||
mounted() {
|
||||
console.log(this.url)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@@ -6,7 +6,7 @@
|
||||
import { GenericListPage } from '@/layout/components'
|
||||
import { getDaysAgo, toSafeLocalDateStr } from '@/utils/common'
|
||||
import { OutputExpandFormatter } from './formatters'
|
||||
import { DetailFormatter } from '@/components/ListTable/formatters'
|
||||
import { DetailFormatter, BooleanFormatter } from '@/components/ListTable/formatters'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -38,7 +38,19 @@ export default {
|
||||
label: this.$t('sessions.command')
|
||||
},
|
||||
risk_level: {
|
||||
label: this.$t('sessions.riskLevel')
|
||||
label: this.$t('sessions.riskLevel'),
|
||||
formatter: BooleanFormatter,
|
||||
formatterArgs: {
|
||||
hasTips: true,
|
||||
tips(val) {
|
||||
switch (val) {
|
||||
case 0:
|
||||
return vm.$t('sessions.riskLevels.common')
|
||||
default:
|
||||
return vm.$t('sessions.riskLevels.common')
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
user: {
|
||||
label: this.$t('sessions.user')
|
||||
@@ -75,6 +87,7 @@ export default {
|
||||
headerActions: {
|
||||
hasLeftActions: false,
|
||||
hasExport: false,
|
||||
hasImport: false,
|
||||
hasDatePicker: true,
|
||||
datePicker: {
|
||||
dateStart: dateFrom,
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<TabPage :submenu="submenu" :active-menu="activeMenu">
|
||||
<Page>
|
||||
<IBox v-if="!loading">
|
||||
<GenericCreateUpdateForm
|
||||
:fields="fields"
|
||||
@@ -11,11 +11,11 @@
|
||||
:more-buttons="moreButtons"
|
||||
/>
|
||||
</IBox>
|
||||
</TabPage>
|
||||
</Page>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { TabPage } from '@/layout/components'
|
||||
import { Page } from '@/layout/components'
|
||||
import { IBox, UploadField } from '@/components'
|
||||
import GenericCreateUpdateForm from '@/layout/components/GenericCreateUpdateForm'
|
||||
import { getInterfaceInfo, postInterface, restoreInterface } from '@/views/xpack/api'
|
||||
@@ -24,7 +24,7 @@ export default {
|
||||
name: 'InterfaceSettings',
|
||||
components: {
|
||||
IBox,
|
||||
TabPage,
|
||||
Page,
|
||||
GenericCreateUpdateForm
|
||||
},
|
||||
data() {
|
||||
@@ -32,13 +32,6 @@ export default {
|
||||
loading: true,
|
||||
files: {},
|
||||
interfaceInfo: {},
|
||||
activeMenu: 'interface',
|
||||
submenu: [
|
||||
{
|
||||
title: this.$t('xpack.InterfaceSettings'),
|
||||
name: 'interface'
|
||||
}
|
||||
],
|
||||
successUrl: { name: 'Settings' },
|
||||
fields: [
|
||||
['', ['login_title']],
|
||||
|
@@ -15,7 +15,10 @@ export default {
|
||||
initial: {
|
||||
},
|
||||
url: '/api/v1/orgs/orgs/',
|
||||
fields: ['name', 'admins', 'auditors', 'users', 'comment'],
|
||||
fields: [
|
||||
[this.$t('common.Basic'), ['name', 'comment']],
|
||||
[this.$t('common.Members'), ['admins', 'auditors', 'users']]
|
||||
],
|
||||
fieldsMeta: {
|
||||
admins: {
|
||||
label: this.$t('xpack.Admin'),
|
||||
@@ -53,6 +56,11 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
onPerformSuccess(res, method) {
|
||||
const org = { id: res.id, name: res.name }
|
||||
this.$store.dispatch('users/addAdminOrg', org)
|
||||
return this.$router.push({ name: 'OrganizationList' })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -165,24 +165,24 @@ export default {
|
||||
path: '',
|
||||
component: () => import('@/views/xpack/Org/OrganizationList'),
|
||||
name: 'OrganizationList',
|
||||
meta: { title: i18n.t('xpack.Organization.OrganizationList') }
|
||||
meta: { title: i18n.t('xpack.Organization.OrganizationList'), activeMenu: '/xpack/orgs' }
|
||||
},
|
||||
{
|
||||
path: 'orgs/create',
|
||||
path: 'create',
|
||||
component: () => import('@/views/xpack/Org/OrganizationCreateUpdate'),
|
||||
name: 'OrganizationCreate',
|
||||
hidden: true,
|
||||
meta: { title: i18n.t('xpack.Organization.OrganizationCreate'), activeMenu: '/xpack/orgs', action: 'create' }
|
||||
},
|
||||
{
|
||||
path: 'orgs/:id/update',
|
||||
path: ':id/update',
|
||||
component: () => import('@/views/xpack/Org/OrganizationCreateUpdate'),
|
||||
name: 'OrganizationUpdate',
|
||||
hidden: true,
|
||||
meta: { title: i18n.t('xpack.Organization.OrganizationUpdate'), activeMenu: '/xpack/orgs', action: 'update' }
|
||||
},
|
||||
{
|
||||
path: 'orgs/:id',
|
||||
path: ':id',
|
||||
component: () => import('@/views/xpack/Org/OrganizationDetail/index'),
|
||||
name: 'OrganizationDetail',
|
||||
hidden: true,
|
||||
@@ -193,16 +193,17 @@ export default {
|
||||
{
|
||||
path: 'vault',
|
||||
component: empty,
|
||||
meta: { title: i18n.t('xpack.Vault.Vault'), activeMenu: '/xpack/vault/vault' },
|
||||
redirect: '',
|
||||
meta: { },
|
||||
children: [
|
||||
{
|
||||
path: 'vault',
|
||||
path: '',
|
||||
component: () => import('@/views/xpack/Vault/VaultList.vue'),
|
||||
name: 'VaultList',
|
||||
meta: { title: i18n.t('xpack.Vault.Vault'), activeMenu: '/xpack/vault/vault' }
|
||||
},
|
||||
{
|
||||
path: 'vault/create',
|
||||
path: 'create',
|
||||
component: () => import('@/views/xpack/Vault/VaultCreate'),
|
||||
name: 'VaultCreate',
|
||||
meta: { title: i18n.t('xpack.Vault.Create'), activeMenu: '/xpack/vault/vault' },
|
||||
|
Reference in New Issue
Block a user