feat: 添加Endpoint (#1651)

* feat: 添加Endpoint页面

* feat: 添加Endpoint Rule页面

* feat: 获取connect-url连接地址

* feat: 删除配置KOKO、XRDP、MAGNUS

* feat: 修改翻译

* feat: 修改默认endpoint不能删除

Co-authored-by: Jiangjie.Bai <bugatti_it@163.com>
This commit is contained in:
fit2bot
2022-04-12 19:28:42 +08:00
committed by GitHub
parent 364f2aaf12
commit a8a7538655
10 changed files with 292 additions and 10 deletions

View File

@@ -652,6 +652,10 @@
},
"route": {
"": "",
"CreateEndpoint": "Create endpoint",
"UpdateEndpoint": "Update endpoint",
"CreateEndpointRule": "Create endpoint rule",
"UpdateEndpointRule": "Update endpoint rule",
"SystemSetting": "System setting",
"Index": "Index",
"Role": "Role",
@@ -1436,6 +1440,8 @@
"License": "License",
"LicenseDetail": "License detail",
"ComponentMonitor": "System Monitor",
"Endpoint": "Endpoint",
"EndpointRule": "Endpoint rule",
"ServiceRatio": "Service ratio",
"LoadStatus":"Status",
"NormalLoad":"Normal",

View File

@@ -662,6 +662,10 @@
},
"route": {
"": "",
"CreateEndpoint": "エンドポイントを作成する",
"UpdateEndpoint": "エンドポイントを更新",
"CreateEndpointRule": "エンドポイントルールを作成する",
"UpdateEndpointRule": "エンドポイントルールを更新する",
"Index": "トップページ",
"SystemSetting": "システム設定",
"WorkBench": "作業台",
@@ -1481,6 +1485,8 @@
"InterfaceSettings": "インターフェース設定",
"License": "ライセンス",
"ComponentMonitor": "コンポーネントモニタリング",
"Endpoint": "ターミナルエンドポイント",
"EndpointRule": "エンドポイントエンドポイントルール",
"ServiceRatio": "コンポーネント負荷統計",
"LoadStatus": "コンポーネントステータス",
"NormalLoad": "正常",

View File

@@ -663,6 +663,10 @@
},
"route": {
"": "",
"CreateEndpoint": "创建端点",
"UpdateEndpoint": "更新端点",
"CreateEndpointRule": "创建端点规则",
"UpdateEndpointRule": "更新端点规则",
"Index": "首页",
"SystemSetting": "系统设置",
"WorkBench": "工作台",
@@ -1482,6 +1486,8 @@
"InterfaceSettings": "界面设置",
"License": "许可证",
"ComponentMonitor": "组件监控",
"Endpoint": "终端节点",
"EndpointRule": "终端节点规则",
"ServiceRatio": "组件负载统计",
"LoadStatus":"组件状态",
"NormalLoad":"正常",

View File

@@ -152,6 +152,50 @@ export default {
permissions: ['terminal.change_commandstorage']
},
hidden: true
},
{
path: 'endpoint/create',
name: 'EndpointCreate',
component: () => import('@/views/settings/Terminal/Endpoint/EndpointCreateUpdate'),
meta: {
title: i18n.t('route.CreateEndpoint'),
activeMenu: '/settings/terminal',
permissions: ['terminal.add_endpoint']
},
hidden: true
},
{
path: 'endpoint/:id/update',
name: 'EndpointUpdate',
component: () => import('@/views/settings/Terminal/Endpoint/EndpointCreateUpdate'),
meta: {
title: i18n.t('route.UpdateEndpoint'),
activeMenu: '/settings/terminal',
permissions: ['terminal.change_endpoint']
},
hidden: true
},
{
path: 'endpoint-rule/create',
name: 'EndpointRuleCreate',
component: () => import('@/views/settings/Terminal/EndpointRule/EndpointRuleCreateUpdate'),
meta: {
title: i18n.t('route.CreateEndpointRule'),
activeMenu: '/settings/terminal',
permissions: ['terminal.add_endpointrule']
},
hidden: true
},
{
path: 'endpoint-rule/:id/update',
name: 'EndpointRuleUpdate',
component: () => import('@/views/settings/Terminal/EndpointRule/EndpointRuleCreateUpdate'),
meta: {
title: i18n.t('route.UpdateEndpointRule'),
activeMenu: '/settings/terminal',
permissions: ['terminal.change_endpointrule']
},
hidden: true
}
]
},

View File

@@ -21,21 +21,20 @@ export default {
`SSH ${comp}(KoKo)`,
[
'TERMINAL_PASSWORD_AUTH', 'TERMINAL_PUBLIC_KEY_AUTH',
'TERMINAL_ASSET_LIST_SORT_BY', 'TERMINAL_KOKO_HOST', 'TERMINAL_KOKO_SSH_PORT',
'TERMINAL_ASSET_LIST_SORT_BY',
'TERMINAL_ASSET_LIST_PAGE_SIZE', 'TERMINAL_TELNET_REGEX'
]
],
[
`RDP ${comp}(XRDP)`,
[
'XRDP_ENABLED', 'TERMINAL_RDP_ADDR'
'XRDP_ENABLED'
]
],
[
`DB ${comp}(Magnus)`,
[
'TERMINAL_MAGNUS_ENABLED', 'TERMINAL_MAGNUS_HOST', 'TERMINAL_MAGNUS_MYSQL_PORT',
'TERMINAL_MAGNUS_POSTGRE_PORT', 'TERMINAL_MAGNUS_MARIADB_PORT'
'TERMINAL_MAGNUS_ENABLED'
]
]
],
@@ -43,11 +42,6 @@ export default {
TERMINAL_TELNET_REGEX: {
type: 'input'
},
TERMINAL_RDP_ADDR: {
hidden: () => {
return !this.$store.getters.hasValidLicense
}
},
XRDP_ENABLED: {
hidden: () => {
return !this.$store.getters.hasValidLicense

View File

@@ -0,0 +1,42 @@
<template>
<GenericCreateUpdatePage
v-bind="$data"
:create-success-next-route="successUrl"
:update-success-next-route="successUrl"
/>
</template>
<script>
import GenericCreateUpdatePage from '@/layout/components/GenericCreateUpdatePage'
export default {
name: 'EndpointCreateUpdate',
components: {
GenericCreateUpdatePage
},
data() {
return {
url: '/api/v1/terminal/endpoints/',
successUrl: { name: 'TerminalSetting', params: { activeMenu: 'EndpointList' }},
fields: [
[this.$t('common.Basic'), ['name', 'host']],
[
this.$t('applications.port'),
['http_port', 'https_port', 'ssh_port', 'rdp_port', 'mysql_port', 'mariadb_port', 'postgresql_port']
],
[this.$t('common.Other'), ['comment']]
],
fieldsMeta: {
},
hasDetailInMsg: false
}
},
computed: {
},
methods: {
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,55 @@
<template>
<ListTable :table-config="tableConfig" :header-actions="headerActions" />
</template>
<script>
import ListTable from '@/components/ListTable'
export default {
name: 'EndpointList',
components: {
ListTable
},
data() {
return {
tableConfig: {
url: '/api/v1/terminal/endpoints/',
columns: [
'name', 'host',
'http_port', 'https_port', 'ssh_port',
'rdp_port', 'mysql_port', 'mariadb_port',
'postgresql_port',
'date_created', 'comment', 'actions'
],
columnsShow: {
min: ['name', 'actions'],
default: [
'name', 'host', 'actions',
'http_port', 'https_port', 'ssh_port', 'rdp_port'
]
},
columnsMeta: {
name: {
formatter: null
},
actions: {
formatterArgs: {
updateRoute: 'EndpointUpdate',
cloneRoute: 'EndpointCreate',
canDelete: ({ row }) => row.id !== '00000000-0000-0000-0000-000000000001'
}
}
}
},
headerActions: {
hasMoreActions: false,
createRoute: 'EndpointCreate'
}
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,57 @@
<template>
<GenericCreateUpdatePage
v-bind="$data"
:create-success-next-route="successUrl"
:update-success-next-route="successUrl"
:after-get-form-value="afterGetFormValue"
/>
</template>
<script>
import { GenericCreateUpdatePage } from '@/layout/components'
export default {
name: 'EndpointRuleCreateUpdate',
components: {
GenericCreateUpdatePage
},
data() {
return {
url: '/api/v1/terminal/endpoint-rules/',
successUrl: { name: 'TerminalSetting', params: { activeMenu: 'EndpointRuleList' }},
fields: [
[this.$t('common.Basic'), ['name', 'ip_group', 'endpoint', 'priority']],
[this.$t('common.Other'), ['comment']]
],
fieldsMeta: {
endpoint: {
el: {
multiple: false,
value: [],
ajax: {
url: '/api/v1/terminal/endpoints/?fields_size=mini',
transformOption: (item) => {
return { label: item.name, value: item.id }
}
}
}
}
},
hasDetailInMsg: false,
cleanFormValue(value) {
if (!Array.isArray(value.ip_group)) {
value.ip_group = value.ip_group ? value.ip_group.split(',') : []
}
return value
},
afterGetFormValue(formValue) {
formValue.ip_group = formValue.ip_group.toString()
return formValue
}
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,54 @@
<template>
<ListTable :table-config="tableConfig" :header-actions="headerActions" />
</template>
<script>
import ListTable from '@/components/ListTable'
import { ArrayFormatter } from '@/components/TableFormatters'
export default {
name: 'EndpointRule',
components: {
ListTable
},
data() {
return {
tableConfig: {
url: '/api/v1/terminal/endpoint-rules/',
columns: [
'name', 'ip_group', 'priority', 'endpoint_display', 'date_updated', 'date_created',
'created_by', 'comment', 'actions'
],
columnsShow: {
min: ['name', 'actions'],
default: [
'name', 'ip_group', 'priority', 'endpoint_display', 'actions'
]
},
columnsMeta: {
name: {
formatter: null
},
ip_group: {
formatter: ArrayFormatter,
showOverflowTooltip: true
},
actions: {
formatterArgs: {
updateRoute: 'EndpointRuleUpdate',
cloneRoute: 'EndpointRuleCreate'
}
}
}
},
headerActions: {
hasMoreActions: false,
createRoute: 'EndpointRuleCreate'
}
}
}
}
</script>
<style scoped>
</style>

View File

@@ -13,6 +13,8 @@ import TerminalList from './TerminalList'
import ReplayStorage from './Storage/ReplayStorage'
import CommandStorage from './Storage/CommandStorage'
import Monitor from './Monitor'
import EndpointList from './Endpoint/EndpointList'
import EndpointRuleList from './EndpointRule/EndpointRuleList'
export default {
components: {
@@ -21,7 +23,9 @@ export default {
Monitor,
TerminalList,
ReplayStorage,
CommandStorage
CommandStorage,
EndpointList,
EndpointRuleList
},
data() {
return {
@@ -53,6 +57,20 @@ export default {
hidden: () => {
return !(this.$hasPerm('terminal.view_status') && this.$store.getters.hasValidLicense)
}
},
{
title: this.$t('xpack.Endpoint'),
name: 'EndpointList',
hidden: () => {
return !this.$hasPerm('terminal.view_endpoint')
}
},
{
title: this.$t('xpack.EndpointRule'),
name: 'EndpointRuleList',
hidden: () => {
return !this.$hasPerm('terminal.view_endpointrule')
}
}
]
}