[update]完善平台列表

This commit is contained in:
OrangeM21
2020-04-20 20:09:48 +08:00
parent fdb3195fd7
commit bf849dd8b7
11 changed files with 318 additions and 12 deletions

View File

@@ -134,6 +134,12 @@ export const constantRoutes = [
component: () => import('@/views/assets/DomainList.vue'),
meta: { title: 'DomainList' }
},
{
path: 'domains/create',
name: 'DomainCreate',
component: () => import('@/views/assets/DomainCreateUpdate.vue'),
meta: { title: 'DomainList' }
},
{
path: 'domains/:id/gateway',
name: 'GatewayList',
@@ -147,6 +153,48 @@ export const constantRoutes = [
component: () => import('@/views/assets/AdminUserList'),
meta: { title: 'AdminUserList' }
},
{
path: 'admin-users/create',
component: () => import('@/views/assets/AdminUserCreateUpdate.vue'), // Parent router-view
name: 'AdminUserCreateUpdate',
meta: { title: 'AdminUserCreate' },
hidden: true
},
{
path: 'platform/update/:id',
component: () => import('@/views/assets/PlatformCreateUpdate.vue'), // Parent router-view
name: 'PlatformUpdate',
meta: { title: 'PlatformUpdate' },
hidden: true
},
{
path: 'platform/create',
component: () => import('@/views/assets/PlatformCreateUpdate.vue'), // Parent router-view
name: 'PlatformCreate',
meta: { title: 'PlatformCreate' },
hidden: true
},
{
path: 'cmd-filters/update/:id',
component: () => import('@/views/assets/CommandFilterCreateUpdate.vue'), // Parent router-view
name: 'PlatformUpdate',
meta: { title: 'PlatformUpdate' },
hidden: true
},
{
path: 'cmd-filters/create',
component: () => import('@/views/assets/CommandFilterCreateUpdate.vue'), // Parent router-view
name: 'PlatformCreate',
meta: { title: 'PlatformCreate' },
hidden: true
},
{
path: 'platform/:id',
component: () => import('@/views/assets/PlatformDetail.vue'), // Parent router-view
name: 'PlatformDetail',
meta: { title: 'PlatformDetail' },
hidden: true
},
{
path: 'admin-users/:id',
component: () => import('@/views/assets/AdminUserDetail.vue'), // Parent router-view
@@ -154,6 +202,7 @@ export const constantRoutes = [
meta: { title: 'AdminUserDetail' },
hidden: true
},
{
path: 'system-users',
name: 'SystemUserList',

View File

@@ -0,0 +1,33 @@
<template>
<GenericCreateUpdatePage :fields="fields" :initial="initial" :fields-meta="fieldsMeta" :url="url" />
</template>
<script>
import GenericCreateUpdatePage from '@/layout/components/GenericCreateUpdatePage'
export default {
name: 'AdminUserCreateUpdate',
components: {
GenericCreateUpdatePage
},
data() {
return {
initial: {
},
fields: [
[this.$t('perms.' + 'Basic'), ['name', 'username', 'password', 'private_key', 'comment']]
],
fieldsMeta: {
private_key: {
}
},
url: '/api/v1/assets/admin-users/'
}
}
}
</script>
<style>
</style>

View File

@@ -54,7 +54,7 @@ export default {
},
headerActions: {
hasBulkDelete: false,
createRoute: 'AdminUserCreate'
createRoute: 'AdminUserCreateUpdate'
}
}
}

View File

@@ -0,0 +1,52 @@
<template>
<GenericCreateUpdatePage :fields="fields" :initial="initial" :fields-meta="fieldsMeta" :url="url" />
</template>
<script>
import GenericCreateUpdatePage from '@/layout/components/GenericCreateUpdatePage'
export default {
name: 'CommandFilterCreateUpdate',
components: { GenericCreateUpdatePage },
data() {
return {
initial: {
},
fields: [
// [this.$t('perms.' + 'Basic'), ['name', 'base', 'security', 'console', 'comment']]
],
fieldsMeta: {
},
performSubmit: function(formdata) {
console.log(formdata)
var postData = {}
if (formdata.base === 'Windows') {
postData.meta = {}
postData.meta.security = formdata.security
postData.meta.console = (formdata.console === 'true')
}
postData.name = formdata.name
postData.base = formdata.base
postData.comment = formdata.comment || ''
const params = this.$route.params
if (params.id) {
return this.$axios.put(
`${this.url}${params.id}/`, postData
)
} else {
return this.$axios.post(
this.url, postData
)
}
},
url: '/api/v1/assets/cmd-filters/'
}
}
}
</script>
<style lang='less' scoped>
</style>

View File

@@ -1,5 +1,5 @@
<template>
<GenericListPage :table-config="tableConfig" :header-actions="headerActions" />
<GenericListPage :table-config="tableConfig" :header-actions="headerActions" :help-message="title" />
</template>
<script>
@@ -52,10 +52,20 @@ export default {
]
},
headerActions: {
hasRightActions: false,
hasExport: false,
hasImport: false,
hasRefresh: true,
hasBulkDelete: false,
hasSearch: true,
createRoute: 'CommandFilterCreate'
}
}
},
computed: {
title() {
return this.$t('系统用户可以绑定一些命令过滤器,一个过滤器可以定义一些规则 当用户使用这个系统用户登录资产,然后执行一个命令 这个命令需要被绑定过滤器的所有规则匹配,高优先级先被匹配, 当一个规则匹配到了,如果规则的动作是允许,这个命令会被放行, 如果规则的动作是禁止,命令将会被禁止执行, 否则就匹配下一个规则,如果最后没有匹配到规则,则允许执行\n')
}
}
}
</script>

View File

@@ -0,0 +1,31 @@
<template>
<GenericCreateUpdatePage :fields="fields" :initial="initial" :fields-meta="fieldsMeta" :url="url" />
</template>
<script>
import GenericCreateUpdatePage from '@/layout/components/GenericCreateUpdatePage'
export default {
name: 'GatewayCreate',
components: {
GenericCreateUpdatePage
},
data() {
return {
initial: {
},
fields: {
},
fieldsMeta: {
},
url: ''
}
}
}
</script>
<style>
</style>

View File

@@ -1,5 +1,5 @@
<template>
<GenericListPage :table-config="tableConfig" :header-actions="headerActions" />
<GenericListPage :table-config="tableConfig" :header-actions="headerActions" :help-message="notice" />
</template>
<script>
@@ -54,9 +54,15 @@ export default {
]
},
headerActions: {
hasRightActions: false,
hasExport: false,
hasImport: false,
hasRefresh: false,
hasBulkDelete: false,
hasSearch: false,
createRoute: 'DomainCreate'
}
},
notice: this.$t('网域功能是为了解决部分环境混合云无法直接连接而新增的功能原理是通过网关服务器进行跳转登录。JMS => 网域网关 => 目标资产')
}
}
}

View File

@@ -21,6 +21,7 @@ export default {
sortable: 'custom'
},
{
prop: 'ip',
label: this.$t('assets.ip'),
sortable: 'custom'
@@ -67,14 +68,6 @@ export default {
}
}
]
},
headerActions: {
hasRightActions: false,
hasExport: false,
hasImport: false,
hasRefresh: false,
hasBulkDelete: false,
createRoute: 'GatewayCreate'
}
}
}

View File

@@ -0,0 +1,87 @@
<template>
<GenericCreateUpdatePage :fields="fields" :initial="initial" :fields-meta="fieldsMeta" :url="url" :perform-submit="performSubmit.bind(this)" />
</template>
<script>
import GenericCreateUpdatePage from '@/layout/components/GenericCreateUpdatePage'
export default {
name: 'PlatformCreateUpdate',
components: { GenericCreateUpdatePage },
data() {
return {
initial: {
base: 'Linux',
console: 'true',
security: 'RDP',
comment: ''
},
fields: [
[this.$t('perms.' + 'Basic'), ['name', 'base', 'security', 'console', 'comment']]
],
fieldsMeta: {
security: {
type: 'select',
label: 'RDP security',
options: [{
label: 'RDP',
value: 'rdp'
},
{
label: 'NLA',
value: 'nla'
},
{
label: 'TLS',
value: 'tls'
},
{
label: 'Any',
value: 'any'
}],
hidden: form => form.base !== 'Windows'
},
console: {
type: 'select',
label: 'RDP console',
options: [{
label: '是',
value: 'true'
}, {
label: '否',
value: 'false'
}],
hidden: form => form.base !== 'Windows'
}
},
performSubmit: function(formdata) {
console.log(formdata)
var postData = {}
if (formdata.base === 'Windows') {
postData.meta = {}
postData.meta.security = formdata.security
postData.meta.console = (formdata.console === 'true')
}
postData.name = formdata.name
postData.base = formdata.base
postData.comment = formdata.comment || ''
const params = this.$route.params
if (params.id) {
return this.$axios.put(
`${this.url}${params.id}/`, postData
)
} else {
return this.$axios.post(
this.url, postData
)
}
},
url: '/api/v1/assets/platforms/'
}
}
}
</script>
<style lang='less' scoped>
</style>

View File

@@ -0,0 +1,34 @@
<template>
<GenericDetailPage :submenu="submenu" :active-menu="activeSubMenu" :title="title" />
</template>
<script>
import { GenericDetailPage } from '@/layout/components'
export default {
name: 'PlatformDetail',
components: {
GenericDetailPage
},
data() {
return {
submenu: [
{
title: this.$t('perms.AssetPermissionDetail'),
name: 'detail'
}
],
activeSubMenu: 'detail'
}
},
computed: {
title() {
return this.$t('perms.AssetPermissionDetail')
}
}
}
</script>
<style lang='less' scoped>
</style>

View File

@@ -39,6 +39,12 @@ export default {
formatter: ActionsFormatter,
width: '200px',
actions: {
canDelete: (row, vaule) => {
return !row.internal
},
canUpdate: (row, vaule) => {
return !row.internal
},
performDelete: ({ row, col }) => {
const id = row.id
const url = `/api/v1/assets/platforms/${id}/`
@@ -49,7 +55,12 @@ export default {
]
},
headerActions: {
hasRightActions: false,
hasExport: false,
hasImport: false,
hasRefresh: false,
hasBulkDelete: false,
hasSearch: false,
createRoute: 'PlatformCreate'
}
}