From 6c1f8ec8f7d212445c3d43af2c64f3120a2e2e81 Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Tue, 3 Nov 2020 14:28:36 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=95=B4=E7=90=86=E9=87=8D=E6=9E=84?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E6=A8=A1=E5=9D=97=E5=8F=8A=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E6=8E=88=E6=9D=83=E6=A8=A1=E5=9D=97=20(#465)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: 整理重构应用模块及应用授权模块 Co-authored-by: Orange --- src/components/ActionsGroup/index.vue | 5 + src/components/AutoDataForm/index.vue | 17 +- src/i18n/langs/cn.json | 27 +++- src/i18n/langs/en.json | 22 ++- .../GenericCreateUpdateForm/index.vue | 4 + .../components/Page/LicenseExpireTip.vue | 18 +-- src/router/perms.js | 102 +++--------- src/userviews/apps/DatabaseApp.vue | 4 +- src/userviews/apps/KubernetesApp.vue | 2 +- src/userviews/apps/RemoteApp.vue | 6 +- .../DatabaseApp/DatabaseAppCreateUpdate.vue | 50 +++++- .../DatabaseAppDetail/DatabaseAppDetail.vue | 8 +- .../DatabaseApp/DatabaseAppDetail/index.vue | 8 +- .../DatabaseApp/DatabaseAppList.vue | 76 +++++++-- .../KubernetesAppCreateUpdate.vue | 44 ++++- .../KubernetesAppDetail.vue | 2 +- .../KubernetesAppDetail/index.vue | 6 +- .../KubernetesApp/KubernetesAppList.vue | 24 ++- .../RemoteApp/RemoteAppCreateUpdate.vue | 98 ++++++++++- .../RemoteAppDetail/RemoteAppDetail.vue | 12 +- .../RemoteApp/RemoteAppDetail/index.vue | 8 +- .../applications/RemoteApp/RemoteAppList.vue | 22 ++- src/views/applications/RemoteApp/const.js | 8 +- .../assets/Domain/DomainDetail/Detail.vue | 4 + src/views/assets/Domain/DomainList.vue | 5 +- .../ApplicationPermissionCreateUpdate.vue | 124 ++++++++++++++ .../AppliactionPermissionDetail.vue} | 10 +- .../ApplicationPermissionUser.vue} | 17 +- .../ApplicationsPermission.vue} | 40 +++-- .../ApplicationPermissionDetail}/index.vue | 30 ++-- .../ApplicationPermissionList.vue} | 25 ++- .../DatabaseAppPermissionCreateUpdate.vue | 79 --------- .../DatabaseAppPermissionDatabaseApp.vue | 152 ------------------ .../DatabaseAppPermissionDetail.vue | 105 ------------ .../DatabaseAppPermissionUser.vue | 148 ----------------- .../DatabaseAppPermissionDetail/index.vue | 59 ------- .../DatabaseAppPermissionList.vue | 80 --------- .../KubernetesAppPermissionCreateUpdate.vue | 80 --------- .../KubernetesAppPermissionDetail.vue | 105 ------------ .../KubernetesAppPermissionKubernetesApp.vue | 152 ------------------ .../KubernetesAppPermissionUser.vue | 148 ----------------- .../KubernetesAppPermissionDetail/index.vue | 63 -------- .../KubernetesAppPermissionList.vue | 80 --------- .../RemoteAppPermissionCreateUpdate.vue | 79 --------- src/views/perms/const.js | 102 ++++++++++++ 45 files changed, 730 insertions(+), 1530 deletions(-) create mode 100644 src/views/perms/ApplicationPermission/ApplicationPermissionCreateUpdate.vue rename src/views/perms/{RemoteAppPermission/RemoteAppPermissionDetail/RemoteAppPermissionDetail.vue => ApplicationPermission/ApplicationPermissionDetail/AppliactionPermissionDetail.vue} (89%) rename src/views/perms/{RemoteAppPermission/RemoteAppPermissionDetail/RemoteAppPermissionUser.vue => ApplicationPermission/ApplicationPermissionDetail/ApplicationPermissionUser.vue} (87%) rename src/views/perms/{RemoteAppPermission/RemoteAppPermissionDetail/RemoteAppPermissionRemoteApp.vue => ApplicationPermission/ApplicationPermissionDetail/ApplicationsPermission.vue} (76%) rename src/views/perms/{RemoteAppPermission/RemoteAppPermissionDetail => ApplicationPermission/ApplicationPermissionDetail}/index.vue (53%) rename src/views/perms/{RemoteAppPermission/RemoteAppPermissionList.vue => ApplicationPermission/ApplicationPermissionList.vue} (74%) delete mode 100644 src/views/perms/DatabaseAppPermission/DatabaseAppPermissionCreateUpdate.vue delete mode 100644 src/views/perms/DatabaseAppPermission/DatabaseAppPermissionDetail/DatabaseAppPermissionDatabaseApp.vue delete mode 100644 src/views/perms/DatabaseAppPermission/DatabaseAppPermissionDetail/DatabaseAppPermissionDetail.vue delete mode 100644 src/views/perms/DatabaseAppPermission/DatabaseAppPermissionDetail/DatabaseAppPermissionUser.vue delete mode 100644 src/views/perms/DatabaseAppPermission/DatabaseAppPermissionDetail/index.vue delete mode 100644 src/views/perms/DatabaseAppPermission/DatabaseAppPermissionList.vue delete mode 100644 src/views/perms/KubernetesAppPermission/KubernetesAppPermissionCreateUpdate.vue delete mode 100644 src/views/perms/KubernetesAppPermission/KubernetesAppPermissionDetail/KubernetesAppPermissionDetail.vue delete mode 100644 src/views/perms/KubernetesAppPermission/KubernetesAppPermissionDetail/KubernetesAppPermissionKubernetesApp.vue delete mode 100644 src/views/perms/KubernetesAppPermission/KubernetesAppPermissionDetail/KubernetesAppPermissionUser.vue delete mode 100644 src/views/perms/KubernetesAppPermission/KubernetesAppPermissionDetail/index.vue delete mode 100644 src/views/perms/KubernetesAppPermission/KubernetesAppPermissionList.vue delete mode 100644 src/views/perms/RemoteAppPermission/RemoteAppPermissionCreateUpdate.vue create mode 100644 src/views/perms/const.js diff --git a/src/components/ActionsGroup/index.vue b/src/components/ActionsGroup/index.vue index fa3f50c05..d9f11442d 100644 --- a/src/components/ActionsGroup/index.vue +++ b/src/components/ActionsGroup/index.vue @@ -119,6 +119,11 @@ export default { if (!has) { continue } + // 是否有分割线 + const divided = this.checkItem(action, 'divided', false) + delete action['divided'] + action.divided = divided + // 是否是disabled const can = this.checkItem(action, 'can') delete action['can'] diff --git a/src/components/AutoDataForm/index.vue b/src/components/AutoDataForm/index.vue index 2c9211331..8d443ed63 100644 --- a/src/components/AutoDataForm/index.vue +++ b/src/components/AutoDataForm/index.vue @@ -131,7 +131,8 @@ export default { }, generateField(name) { let field = { id: name, prop: name, el: {}, attrs: {}} - const fieldMeta = this.meta[name] || {} + // const fieldMeta = this.meta[name] || this.meta['attrs']['children'][name] || {} + const fieldMeta = this.meta[name] || ((this.meta['attrs']) ? (this.meta['attrs']['children'][name]) : {}) field.label = fieldMeta.label field = this.generateFieldByType(fieldMeta.type, field, fieldMeta) field = this.generateFieldByName(name, field) @@ -149,12 +150,26 @@ export default { }) return this.generateFields(fields) }, + genreateFieldAttrs(name) { + const fields = [] + Object.keys(this.meta[name]['children']).forEach((key, i) => { + const filed = this.generateField(key) + fields.push(filed) + }) + + return fields + }, generateFields(data) { let fields = [] for (let field of data) { if (field instanceof Array) { const items = this.generateFieldGroup(field) fields = [...fields, ...items] + } else if (field === 'attrs') { + const items = this.genreateFieldAttrs(field) + fields = [...fields, ...items] + // 修改title插入ID + this.groups[this.groups.length - 1].name = items[0].id } else if (typeof field === 'string') { field = this.generateField(field) fields.push(field) diff --git a/src/i18n/langs/cn.json b/src/i18n/langs/cn.json index d46d0347e..cfb77958d 100644 --- a/src/i18n/langs/cn.json +++ b/src/i18n/langs/cn.json @@ -2,6 +2,22 @@ "": "", "applications": { "": "", + "applicationsType": { + "chrome": "Chrome", + "mysql_workbench": "MySQL Workbench", + "vmware_client":"Vmware Client", + "custom":"Custom", + "mysql": "MySQL", + "oracle": "Oracle", + "postgresql": "PostgreSQL", + "mariadb": "MariaDB", + "k8s": "Kubernetes" + }, + "applicationsCategory": { + "remote_app": "远程应用", + "db": "数据库应用", + "cloud": "云应用" + }, "appPath": "应用路径", "appType": "应用类型", "asset": "资产", @@ -32,7 +48,8 @@ "Custom": "自定义", "cluster": "集群", "kubernetes":"Kubernetes", - "clusterHelpTextMessage": "例如:https://172.16.8.8:8443" + "clusterHelpTextMessage": "例如:https://172.16.8.8:8443", + "DBInfo": "数据库信息" }, "assets": { "Action": "动作", @@ -113,6 +130,7 @@ "RefreshHardware": "更新硬件信息", "RemoteAppListHelpMessage": "使用此功能前,请确保已将应用加载器上传到应用服务器并成功发布为一个 RemoteApp 应用 下载应用加载器", "RemoteApps": "远程应用", + "Applications": "应用", "RemoteType": "应用类型", "RemoveFromCurrentNode": "从节点移除", "ReplaceNodeAssetsAdminUserWithThis": "替换资产的管理员", @@ -415,6 +433,8 @@ "refreshSuccess": "刷新成功", "remoteApp": "远程应用", "remoteAppCount": "远程应用数量", + "appsCount": "应用数量", + "appsList":"应用列表", "DatabaseAppCount": "数据库应用数量", "KubernetesAppCount": "Kubernetes应用数量", "systemUserCount": "系统用户数量", @@ -506,6 +526,11 @@ "RemoteAppPermissionCreate": "创建远程应用授权规则", "RemoteAppPermissionDetail": "远程应用授权详情", "RemoteAppPermissionUpdate": "更新远程应用授权规则", + "ApplicationDetail": "应用详情", + "ApplicationPermission": "应用授权", + "ApplicationPermissionCreate": "创建应用授权规则", + "ApplicationPermissionDetail": "应用授权详情", + "ApplicationPermissionUpdate": "更新应用授权规则", "RemoteAppUpdate": "更新远程应用", "ReplayStorageUpdate": "更新录像存储", "SessionDetail": "会话详情", diff --git a/src/i18n/langs/en.json b/src/i18n/langs/en.json index 030217c19..6ecfb4330 100644 --- a/src/i18n/langs/en.json +++ b/src/i18n/langs/en.json @@ -2,6 +2,22 @@ "": "", "applications": { "": "", + "applicationsType": { + "chrome": "Chrome", + "mysql_workbench": "MySQL Workbench", + "vmware_client":"Vmware Client", + "custom":"Custom", + "mysql": "MySQL", + "oracle": "Oracle", + "postgresql": "PostgreSQL", + "mariadb": "MariaDB", + "k8s": "kubernetes" + }, + "applicationsCategory": { + "remote_app": "Remote app", + "db": "Database app", + "cloud": "Cloud app" + }, "appPath": "App path", "appType": "App type", "asset": "Asset", @@ -32,7 +48,8 @@ "Custom": "Custom", "cluster": "Cluster", "kubernetes":"Kubernetes", - "clusterHelpTextMessage": "Tips: https://172.16.8.8:8443" + "clusterHelpTextMessage": "Tips: https://172.16.8.8:8443", + "DBInfo": "Database Info" }, "assets": { "Action": "Action", @@ -113,6 +130,7 @@ "RefreshHardware": "Refresh hardware", "RemoteAppListHelpMessage": "Before using this feature, make sure that the application loader has been uploaded to the application server and successfully published as a RemoteApp application Download application loader", "RemoteApps": "Remote apps", + "Applications": "Applications", "RemoteType": "Remote type", "RemoveFromCurrentNode": "Remove from node", "ReplaceNodeAssetsAdminUserWithThis": "Replace node assets admin user with this", @@ -414,6 +432,8 @@ "refreshSuccess": "Refresh success", "remoteApp": "RemoteApp", "remoteAppCount": "RemoteApp count", + "appsCount": "App count", + "appsList":"App list", "DatabaseAppCount": "DatabaseApp count", "KubernetesAppCount": "KubernetesApp count", "systemUserCount": "System user count", diff --git a/src/layout/components/GenericCreateUpdateForm/index.vue b/src/layout/components/GenericCreateUpdateForm/index.vue index 491ecda72..198e0947d 100644 --- a/src/layout/components/GenericCreateUpdateForm/index.vue +++ b/src/layout/components/GenericCreateUpdateForm/index.vue @@ -13,6 +13,7 @@ diff --git a/src/views/applications/KubernetesApp/KubernetesAppDetail/KubernetesAppDetail.vue b/src/views/applications/KubernetesApp/KubernetesAppDetail/KubernetesAppDetail.vue index b5a603ebd..4eaaf8376 100644 --- a/src/views/applications/KubernetesApp/KubernetesAppDetail/KubernetesAppDetail.vue +++ b/src/views/applications/KubernetesApp/KubernetesAppDetail/KubernetesAppDetail.vue @@ -37,7 +37,7 @@ export default { }, { key: this.$t('applications.cluster'), - value: this.object.cluster + value: this.object.attrs.cluster }, { key: this.$t('common.dateCreated'), diff --git a/src/views/applications/KubernetesApp/KubernetesAppDetail/index.vue b/src/views/applications/KubernetesApp/KubernetesAppDetail/index.vue index f3b893608..39cbc7c3c 100644 --- a/src/views/applications/KubernetesApp/KubernetesAppDetail/index.vue +++ b/src/views/applications/KubernetesApp/KubernetesAppDetail/index.vue @@ -19,7 +19,7 @@ export default { data() { return { KubernetesApp: { - name: '', type_display: '', cluster: '', date_created: '', created_by: '', comment: '' + name: '', type_display: '', cluster: '', date_created: '', created_by: '', comment: '', attrs: '' }, config: { activeMenu: 'KubernetesAppDetail', @@ -30,8 +30,8 @@ export default { } ], actions: { - detailApiUrl: `/api/v1/applications/k8s-apps/${this.$route.params.id}/`, - deleteApiUrl: `/api/v1/applications/k8s-apps/${this.$route.params.id}/` + detailApiUrl: `/api/v1/applications/applications/${this.$route.params.id}/`, + deleteApiUrl: `/api/v1/applications/applications/${this.$route.params.id}/` } } } diff --git a/src/views/applications/KubernetesApp/KubernetesAppList.vue b/src/views/applications/KubernetesApp/KubernetesAppList.vue index f32674925..bd123b552 100644 --- a/src/views/applications/KubernetesApp/KubernetesAppList.vue +++ b/src/views/applications/KubernetesApp/KubernetesAppList.vue @@ -1,5 +1,5 @@ + + diff --git a/src/views/perms/RemoteAppPermission/RemoteAppPermissionDetail/RemoteAppPermissionDetail.vue b/src/views/perms/ApplicationPermission/ApplicationPermissionDetail/AppliactionPermissionDetail.vue similarity index 89% rename from src/views/perms/RemoteAppPermission/RemoteAppPermissionDetail/RemoteAppPermissionDetail.vue rename to src/views/perms/ApplicationPermission/ApplicationPermissionDetail/AppliactionPermissionDetail.vue index 33a4a6fcb..00766a837 100644 --- a/src/views/perms/RemoteAppPermission/RemoteAppPermissionDetail/RemoteAppPermissionDetail.vue +++ b/src/views/perms/ApplicationPermission/ApplicationPermissionDetail/AppliactionPermissionDetail.vue @@ -38,7 +38,7 @@ export default { callbacks: { change: function(val) { this.$axios.patch( - `/api/v1/perms/remote-app-permissions/${this.object.id}/`, + `/api/v1/perms/application-permissions/${this.object.id}/`, { is_active: val } ).then(res => { this.$message.success(this.$t('common.updateSuccessMsg')) @@ -58,6 +58,10 @@ export default { key: this.$t('common.Name'), value: this.object.name }, + { + key: this.$t('assets.Applications'), + value: this.object.category_display + }, { key: this.$t('perms.userCount'), value: this.object.users_amount @@ -67,8 +71,8 @@ export default { value: this.object.user_groups_amount }, { - key: this.$t('perms.remoteAppCount'), - value: this.object.remote_apps_amount + key: this.$t('perms.appsCount'), + value: this.object.applications_amount }, { key: this.$t('perms.systemUserCount'), diff --git a/src/views/perms/RemoteAppPermission/RemoteAppPermissionDetail/RemoteAppPermissionUser.vue b/src/views/perms/ApplicationPermission/ApplicationPermissionDetail/ApplicationPermissionUser.vue similarity index 87% rename from src/views/perms/RemoteAppPermission/RemoteAppPermissionDetail/RemoteAppPermissionUser.vue rename to src/views/perms/ApplicationPermission/ApplicationPermissionDetail/ApplicationPermissionUser.vue index 770ad0a15..a405a51ec 100644 --- a/src/views/perms/RemoteAppPermission/RemoteAppPermissionDetail/RemoteAppPermissionUser.vue +++ b/src/views/perms/ApplicationPermission/ApplicationPermissionDetail/ApplicationPermissionUser.vue @@ -30,7 +30,7 @@ export default { data() { return { tableConfig: { - url: `/api/v1/perms/remote-app-permissions/${this.object.id}/users/all/`, + url: `/api/v1/perms/application-permissions/${this.object.id}/users/all/`, columns: [ 'user_display', 'delete_action' ], @@ -46,7 +46,7 @@ export default { width: 150, objects: this.object.users, formatter: DeleteActionFormatter, - deleteUrl: `/api/v1/perms/remote-app-permissions-users-relations/?remoteapppermission=${this.object.id}&user=` + deleteUrl: `/api/v1/perms/application-permissions-users-relations/?applicationpermission=${this.object.id}&user=` } }, tableAttrs: { @@ -77,10 +77,13 @@ export default { showHasObjects: false, performAdd: (items) => { const objectId = this.object.id - const relationUrl = `/api/v1/perms/remote-app-permissions/${objectId}/users/add/` + const relationUrl = `/api/v1/perms/application-permissions-users-relations/` const usersId = items.map(v => v.value) - const data = { users: usersId } - return this.$axios.patch(relationUrl, data) + const data = [] + for (const user of usersId) { + data.push({ applicationpermission: objectId, user: user }) + } + return this.$axios.post(relationUrl, data) }, onAddSuccess: (objects, that) => { this.$log.debug('Select value', that.select2.value) @@ -99,7 +102,7 @@ export default { hasObjectsId: this.object.user_groups, performAdd: (items) => { const objectId = this.object.id - const relationUrl = `/api/v1/perms/remote-app-permissions/${objectId}/` + const relationUrl = `/api/v1/perms/application-permissions/${objectId}/` const objectRelationUserGroups = this.object.user_groups items.map(v => objectRelationUserGroups.push(v.value)) const data = { user_groups: objectRelationUserGroups } @@ -114,7 +117,7 @@ export default { }, performDelete: (item) => { const objectId = this.object.id - const relationUrl = `/api/v1/perms/remote-app-permissions/${objectId}/` + const relationUrl = `/api/v1/perms/application-permissions/${objectId}/` const objectOldRelationUserGroups = this.object.user_groups const objectNewRelationUserGroups = objectOldRelationUserGroups.filter(v => v !== item.value) const data = { user_groups: objectNewRelationUserGroups } diff --git a/src/views/perms/RemoteAppPermission/RemoteAppPermissionDetail/RemoteAppPermissionRemoteApp.vue b/src/views/perms/ApplicationPermission/ApplicationPermissionDetail/ApplicationsPermission.vue similarity index 76% rename from src/views/perms/RemoteAppPermission/RemoteAppPermissionDetail/RemoteAppPermissionRemoteApp.vue rename to src/views/perms/ApplicationPermission/ApplicationPermissionDetail/ApplicationsPermission.vue index 2a6e1412f..22d331040 100644 --- a/src/views/perms/RemoteAppPermission/RemoteAppPermissionDetail/RemoteAppPermissionRemoteApp.vue +++ b/src/views/perms/ApplicationPermission/ApplicationPermissionDetail/ApplicationsPermission.vue @@ -27,26 +27,28 @@ export default { default: () => ({}) } }, + data() { + const vm = this return { tableConfig: { - url: `/api/v1/perms/remote-app-permissions/${this.object.id}/remote-apps/all/`, + url: `/api/v1/perms/application-permissions/${this.object.id}/applications/all/`, columns: [ - 'remoteapp_display', 'delete_action' + 'application_display', 'delete_action' ], columnsMeta: { - remoteapp_display: { - label: this.$t('perms.remoteApp'), + application_display: { + label: this.$t('assets.Applications'), align: 'center' }, delete_action: { - prop: 'remoteapp', + prop: 'application', label: this.$t('common.Actions'), align: 'center', width: 150, - objects: this.object.remote_apps, + objects: this.object.applications, formatter: DeleteActionFormatter, - deleteUrl: `/api/v1/perms/remote-app-permissions-remote-apps-relations/?remoteapppermission=${this.$route.params.id}&remoteapp=` + deleteUrl: `/api/v1/perms/application-permissions-applications-relations/?remoteapppermission=${this.$route.params.id}&application=` } }, tableAttrs: { @@ -68,16 +70,22 @@ export default { icon: 'fa-edit', title: this.$t('perms.addRemoteAppToThisPermission'), objectsAjax: { - url: '/api/v1/applications/remote-apps/' + url: `/api/v1/applications/applications/?category=${this.object.category}&type=${this.object.type}`, + transformOption: (item) => { + return { label: item.name + ' (' + item.type_display + ')', value: item.id } + } }, - hasObjectsId: this.object.remote_apps, + hasObjectsId: this.object.application, showHasObjects: false, performAdd: (items) => { const objectId = this.object.id - const relationUrl = `/api/v1/perms/remote-app-permissions/${objectId}/remote-apps/add/` + const relationUrl = `/api/v1/perms/application-permissions-applications-relations/` const remoteAppId = items.map(v => v.value) - const data = { remote_apps: remoteAppId } - return this.$axios.patch(relationUrl, data) + const data = [] + for (const app of remoteAppId) { + data.push({ applicationpermission: objectId, application: app }) + } + return this.$axios.post(relationUrl, data) }, onAddSuccess: (objects, that) => { this.$log.debug('Select value', that.select2.value) @@ -94,7 +102,8 @@ export default { url: '/api/v1/assets/system-users/', processResults(data) { let results = data.results - results = results.filter((item) => item.protocol === 'rdp').map((item) => { + const protocol = vm.object.category === 'remote_app' ? `rdp` : vm.object.type + results = results.filter((item) => item.protocol === protocol).map((item) => { return { label: item.name + '(' + item.username + ')', value: item.id } }) const more = !!data.next @@ -104,7 +113,7 @@ export default { hasObjectsId: this.object.system_users, performAdd: (items) => { const objectId = this.object.id - const relationUrl = `/api/v1/perms/remote-app-permissions/${objectId}/` + const relationUrl = `/api/v1/perms/application-permissions/${objectId}/` const objectRelationSystemUsers = this.object.system_users items.map(v => objectRelationSystemUsers.push(v.value)) const data = { system_users: objectRelationSystemUsers } @@ -119,9 +128,8 @@ export default { }, performDelete: (item) => { const objectId = this.object.id - const relationUrl = `/api/v1/perms/remote-app-permissions/${objectId}/` + const relationUrl = `/api/v1/perms/application-permissions/${objectId}/` const objectOldRelationSystemUsers = this.object.system_users - // console.log(1, objectOldRelationSystemUsers, item) const objectNewRelationSystemUsers = objectOldRelationSystemUsers.filter(v => v !== item.value) const data = { system_users: objectNewRelationSystemUsers } return this.$axios.patch(relationUrl, data) diff --git a/src/views/perms/RemoteAppPermission/RemoteAppPermissionDetail/index.vue b/src/views/perms/ApplicationPermission/ApplicationPermissionDetail/index.vue similarity index 53% rename from src/views/perms/RemoteAppPermission/RemoteAppPermissionDetail/index.vue rename to src/views/perms/ApplicationPermission/ApplicationPermissionDetail/index.vue index b91a7d8e7..6b74069be 100644 --- a/src/views/perms/RemoteAppPermission/RemoteAppPermissionDetail/index.vue +++ b/src/views/perms/ApplicationPermission/ApplicationPermissionDetail/index.vue @@ -8,15 +8,15 @@ diff --git a/src/views/perms/DatabaseAppPermission/DatabaseAppPermissionCreateUpdate.vue b/src/views/perms/DatabaseAppPermission/DatabaseAppPermissionCreateUpdate.vue deleted file mode 100644 index 59873503d..000000000 --- a/src/views/perms/DatabaseAppPermission/DatabaseAppPermissionCreateUpdate.vue +++ /dev/null @@ -1,79 +0,0 @@ - - - - - diff --git a/src/views/perms/DatabaseAppPermission/DatabaseAppPermissionDetail/DatabaseAppPermissionDatabaseApp.vue b/src/views/perms/DatabaseAppPermission/DatabaseAppPermissionDetail/DatabaseAppPermissionDatabaseApp.vue deleted file mode 100644 index 7302dfef1..000000000 --- a/src/views/perms/DatabaseAppPermission/DatabaseAppPermissionDetail/DatabaseAppPermissionDatabaseApp.vue +++ /dev/null @@ -1,152 +0,0 @@ - - - - - diff --git a/src/views/perms/DatabaseAppPermission/DatabaseAppPermissionDetail/DatabaseAppPermissionDetail.vue b/src/views/perms/DatabaseAppPermission/DatabaseAppPermissionDetail/DatabaseAppPermissionDetail.vue deleted file mode 100644 index c4f0a4204..000000000 --- a/src/views/perms/DatabaseAppPermission/DatabaseAppPermissionDetail/DatabaseAppPermissionDetail.vue +++ /dev/null @@ -1,105 +0,0 @@ - - - - - diff --git a/src/views/perms/DatabaseAppPermission/DatabaseAppPermissionDetail/DatabaseAppPermissionUser.vue b/src/views/perms/DatabaseAppPermission/DatabaseAppPermissionDetail/DatabaseAppPermissionUser.vue deleted file mode 100644 index 08769327d..000000000 --- a/src/views/perms/DatabaseAppPermission/DatabaseAppPermissionDetail/DatabaseAppPermissionUser.vue +++ /dev/null @@ -1,148 +0,0 @@ - - - - - diff --git a/src/views/perms/DatabaseAppPermission/DatabaseAppPermissionDetail/index.vue b/src/views/perms/DatabaseAppPermission/DatabaseAppPermissionDetail/index.vue deleted file mode 100644 index 2ea9ab014..000000000 --- a/src/views/perms/DatabaseAppPermission/DatabaseAppPermissionDetail/index.vue +++ /dev/null @@ -1,59 +0,0 @@ - - - - - diff --git a/src/views/perms/DatabaseAppPermission/DatabaseAppPermissionList.vue b/src/views/perms/DatabaseAppPermission/DatabaseAppPermissionList.vue deleted file mode 100644 index 35d307335..000000000 --- a/src/views/perms/DatabaseAppPermission/DatabaseAppPermissionList.vue +++ /dev/null @@ -1,80 +0,0 @@ - - - - - diff --git a/src/views/perms/KubernetesAppPermission/KubernetesAppPermissionCreateUpdate.vue b/src/views/perms/KubernetesAppPermission/KubernetesAppPermissionCreateUpdate.vue deleted file mode 100644 index a3d4a225c..000000000 --- a/src/views/perms/KubernetesAppPermission/KubernetesAppPermissionCreateUpdate.vue +++ /dev/null @@ -1,80 +0,0 @@ - - - - - diff --git a/src/views/perms/KubernetesAppPermission/KubernetesAppPermissionDetail/KubernetesAppPermissionDetail.vue b/src/views/perms/KubernetesAppPermission/KubernetesAppPermissionDetail/KubernetesAppPermissionDetail.vue deleted file mode 100644 index 60a2fb74d..000000000 --- a/src/views/perms/KubernetesAppPermission/KubernetesAppPermissionDetail/KubernetesAppPermissionDetail.vue +++ /dev/null @@ -1,105 +0,0 @@ - - - - - diff --git a/src/views/perms/KubernetesAppPermission/KubernetesAppPermissionDetail/KubernetesAppPermissionKubernetesApp.vue b/src/views/perms/KubernetesAppPermission/KubernetesAppPermissionDetail/KubernetesAppPermissionKubernetesApp.vue deleted file mode 100644 index f06770033..000000000 --- a/src/views/perms/KubernetesAppPermission/KubernetesAppPermissionDetail/KubernetesAppPermissionKubernetesApp.vue +++ /dev/null @@ -1,152 +0,0 @@ - - - - - diff --git a/src/views/perms/KubernetesAppPermission/KubernetesAppPermissionDetail/KubernetesAppPermissionUser.vue b/src/views/perms/KubernetesAppPermission/KubernetesAppPermissionDetail/KubernetesAppPermissionUser.vue deleted file mode 100644 index 9c8362ad4..000000000 --- a/src/views/perms/KubernetesAppPermission/KubernetesAppPermissionDetail/KubernetesAppPermissionUser.vue +++ /dev/null @@ -1,148 +0,0 @@ - - - - - diff --git a/src/views/perms/KubernetesAppPermission/KubernetesAppPermissionDetail/index.vue b/src/views/perms/KubernetesAppPermission/KubernetesAppPermissionDetail/index.vue deleted file mode 100644 index a6acf4847..000000000 --- a/src/views/perms/KubernetesAppPermission/KubernetesAppPermissionDetail/index.vue +++ /dev/null @@ -1,63 +0,0 @@ - - - - - diff --git a/src/views/perms/KubernetesAppPermission/KubernetesAppPermissionList.vue b/src/views/perms/KubernetesAppPermission/KubernetesAppPermissionList.vue deleted file mode 100644 index c10b66e71..000000000 --- a/src/views/perms/KubernetesAppPermission/KubernetesAppPermissionList.vue +++ /dev/null @@ -1,80 +0,0 @@ - - - - - diff --git a/src/views/perms/RemoteAppPermission/RemoteAppPermissionCreateUpdate.vue b/src/views/perms/RemoteAppPermission/RemoteAppPermissionCreateUpdate.vue deleted file mode 100644 index 334371230..000000000 --- a/src/views/perms/RemoteAppPermission/RemoteAppPermissionCreateUpdate.vue +++ /dev/null @@ -1,79 +0,0 @@ - - - - - diff --git a/src/views/perms/const.js b/src/views/perms/const.js new file mode 100644 index 000000000..bd7f81747 --- /dev/null +++ b/src/views/perms/const.js @@ -0,0 +1,102 @@ +import i18n from '@/i18n/i18n' +import router from '@/router' +import store from '@/store' +export const CHROME = 'chrome' +export const MYSQL_WORKBENCH = 'mysql_workbench' +export const VMWARE_CLIENT = 'vmware_client' +export const CUSTOM = 'custom' +export const REMOTEAPP_CATEGORY = 'remote_app' + +function isValidateLicense() { + if (store.getters.publicSettings.XPACK_ENABLED) { + return store.getters.publicSettings.XPACK_LICENSE_IS_VALID + } + return true +} + +export const REMOTE_APP = [ + { + name: CHROME, + title: i18n.t(`applications.applicationsType.${CHROME}`), + type: 'primary', + can: isValidateLicense, + callback: function() { router.push({ name: 'ApplicationPermissionCreate', query: { type: CHROME, category: REMOTEAPP_CATEGORY }}) } + }, + { + name: MYSQL_WORKBENCH, + title: i18n.t(`applications.applicationsType.${MYSQL_WORKBENCH}`), + type: 'primary', + can: isValidateLicense, + callback: function() { router.push({ name: 'ApplicationPermissionCreate', query: { type: MYSQL_WORKBENCH, category: REMOTEAPP_CATEGORY }}) } + }, + { + name: VMWARE_CLIENT, + title: i18n.t(`applications.applicationsType.${VMWARE_CLIENT}`), + type: 'primary', + can: isValidateLicense, + callback: function() { router.push({ name: 'ApplicationPermissionCreate', query: { type: VMWARE_CLIENT, category: REMOTEAPP_CATEGORY }}) } + }, + { + name: CUSTOM, + title: i18n.t(`applications.applicationsType.${CUSTOM}`), + type: 'primary', + can: isValidateLicense, + callback: function() { router.push({ name: 'ApplicationPermissionCreate', query: { type: CUSTOM, category: REMOTEAPP_CATEGORY }}) } + } +] + +export const MYSQL = 'mysql' +export const ORACLE = 'oracle' +export const POSTGRESQL = 'postgresql' +export const MARIADB = 'mariadb' +export const DATABASE_CATEGORY = 'db' + +export const DATABASE = [ + { + name: MYSQL, + title: i18n.t(`applications.applicationsType.${MYSQL}`), + type: 'primary', + can: true, + divided: true, + callback: function() { router.push({ name: 'ApplicationPermissionCreate', query: { type: MYSQL, category: DATABASE_CATEGORY }}) } + }, + { + name: ORACLE, + title: i18n.t(`applications.applicationsType.${ORACLE}`), + type: 'primary', + can: isValidateLicense, + callback: function() { router.push({ name: 'ApplicationPermissionCreate', query: { type: ORACLE, category: DATABASE_CATEGORY }}) } + }, + { + name: POSTGRESQL, + title: i18n.t(`applications.applicationsType.${POSTGRESQL}`), + type: 'primary', + can: isValidateLicense, + callback: function() { router.push({ name: 'ApplicationPermissionCreate', query: { type: POSTGRESQL, category: DATABASE_CATEGORY }}) } + }, + { + name: MARIADB, + title: i18n.t(`applications.applicationsType.${MARIADB}`), + type: 'primary', + can: isValidateLicense, + callback: function() { router.push({ name: 'ApplicationPermissionCreate', query: { type: MARIADB, category: DATABASE_CATEGORY }}) } + } +] + +export const KUBERNETES = 'k8s' +export const CLOUD_CATEGORY = 'cloud' + +export const CLOUD = [ + { + name: KUBERNETES, + title: i18n.t(`applications.applicationsType.${KUBERNETES}`), + divided: true, + type: 'primary', + can: true, + callback: function() { router.push({ name: 'ApplicationPermissionCreate', query: { type: KUBERNETES, category: CLOUD_CATEGORY }}) } + } +] + +export const ApplicationTypes = [ + ...REMOTE_APP, ...DATABASE, ...CLOUD +]