diff --git a/package.json b/package.json index 4b09dfe86..053833fbb 100644 --- a/package.json +++ b/package.json @@ -40,12 +40,15 @@ "nprogress": "0.2.0", "path-to-regexp": "2.4.0", "vue": "2.6.10", + "vue-codemirror-lite": "^1.0.4", "vue-cookie": "^1.1.4", "vue-i18n": "^8.15.5", "vue-router": "3.0.6", "vue-select": "^3.9.5", "vuejs-logger": "^1.5.4", "vuex": "3.1.0", + "xterm": "^4.5.0", + "xterm-addon-fit": "^0.3.0", "ztree": "^3.5.24" }, "devDependencies": { diff --git a/src/assets/img/logo-text.png b/src/assets/img/logo-text.png index 8d741116c..0e27e3318 100644 Binary files a/src/assets/img/logo-text.png and b/src/assets/img/logo-text.png differ diff --git a/src/components/CodeMirror/index.vue b/src/components/CodeMirror/index.vue new file mode 100644 index 000000000..a24a9cd01 --- /dev/null +++ b/src/components/CodeMirror/index.vue @@ -0,0 +1,20 @@ + + + + + diff --git a/src/components/Term/index.vue b/src/components/Term/index.vue new file mode 100644 index 000000000..7370e5c58 --- /dev/null +++ b/src/components/Term/index.vue @@ -0,0 +1,52 @@ + + + diff --git a/src/components/TreeTable/components/AssetTree.vue b/src/components/TreeTable/components/AssetTree.vue new file mode 100644 index 000000000..0746029d9 --- /dev/null +++ b/src/components/TreeTable/components/AssetTree.vue @@ -0,0 +1,17 @@ + + + + + diff --git a/src/components/TreeTable/index.vue b/src/components/TreeTable/index.vue index a5fc66b5c..bce82d918 100644 --- a/src/components/TreeTable/index.vue +++ b/src/components/TreeTable/index.vue @@ -2,7 +2,13 @@
- + +
@@ -38,6 +44,11 @@ export default { showTree: { type: Boolean, default: true + }, + // 默认引用的Tree组件 + component: { + type: String, + default: () => 'AutoDataZTree' } }, data() { diff --git a/src/views/jobcenter/CommandExecution.vue b/src/views/jobcenter/CommandExecution.vue index 8e14bfe30..59770ed66 100644 --- a/src/views/jobcenter/CommandExecution.vue +++ b/src/views/jobcenter/CommandExecution.vue @@ -1,39 +1,84 @@ - - diff --git a/src/views/jobcenter/TaskDetail.vue b/src/views/jobcenter/TaskDetail.vue deleted file mode 100644 index 533f5c625..000000000 --- a/src/views/jobcenter/TaskDetail.vue +++ /dev/null @@ -1,165 +0,0 @@ - - - - - diff --git a/src/views/jobcenter/AdhocDetail.vue b/src/views/jobcenter/TaskDetail/AdhocDetail/AdhocDetail.vue similarity index 57% rename from src/views/jobcenter/AdhocDetail.vue rename to src/views/jobcenter/TaskDetail/AdhocDetail/AdhocDetail.vue index e8dadcd72..84cdfceb9 100644 --- a/src/views/jobcenter/AdhocDetail.vue +++ b/src/views/jobcenter/TaskDetail/AdhocDetail/AdhocDetail.vue @@ -1,57 +1,34 @@ + + diff --git a/src/views/jobcenter/TaskDetail/HistoryExecutionDetail/HistoryExecutionDetail.vue b/src/views/jobcenter/TaskDetail/HistoryExecutionDetail/HistoryExecutionDetail.vue new file mode 100644 index 000000000..1cdcb7e02 --- /dev/null +++ b/src/views/jobcenter/TaskDetail/HistoryExecutionDetail/HistoryExecutionDetail.vue @@ -0,0 +1,111 @@ + + + + + diff --git a/src/views/jobcenter/TaskDetail/HistoryExecutionDetail/index.vue b/src/views/jobcenter/TaskDetail/HistoryExecutionDetail/index.vue new file mode 100644 index 000000000..d118ed9f5 --- /dev/null +++ b/src/views/jobcenter/TaskDetail/HistoryExecutionDetail/index.vue @@ -0,0 +1,46 @@ + + + + + diff --git a/src/views/jobcenter/TaskAdhoc.vue b/src/views/jobcenter/TaskDetail/TaskAdhoc.vue similarity index 93% rename from src/views/jobcenter/TaskAdhoc.vue rename to src/views/jobcenter/TaskDetail/TaskAdhoc.vue index 23bf1e774..19fe1782f 100644 --- a/src/views/jobcenter/TaskAdhoc.vue +++ b/src/views/jobcenter/TaskDetail/TaskAdhoc.vue @@ -11,10 +11,16 @@ export default { components: { ListTable }, + props: { + object: { + type: Object, + default: () => ({}) + } + }, data() { return { tableConfig: { - url: `/api/v1/ops/adhoc/?task=${this.$route.params.id}`, + url: `/api/v1/ops/adhoc/?task=${this.object.id}`, columns: [ 'short_id', 'hosts', 'pattern', 'run_as', 'become_display', 'date_created', 'actions' ], @@ -52,7 +58,7 @@ export default { }, actions: { prop: 'id', - abel: this.$tc('Action'), + label: this.$tc('Action'), formatter: ActionsFormatter, actions: { hasEdit: false, diff --git a/src/views/jobcenter/TaskDetail/TaskDetail.vue b/src/views/jobcenter/TaskDetail/TaskDetail.vue new file mode 100644 index 000000000..ac7d73742 --- /dev/null +++ b/src/views/jobcenter/TaskDetail/TaskDetail.vue @@ -0,0 +1,127 @@ + + + + + diff --git a/src/views/jobcenter/TaskHistory.vue b/src/views/jobcenter/TaskDetail/TaskHistory.vue similarity index 94% rename from src/views/jobcenter/TaskHistory.vue rename to src/views/jobcenter/TaskDetail/TaskHistory.vue index cb47f798c..6b40d7f12 100644 --- a/src/views/jobcenter/TaskHistory.vue +++ b/src/views/jobcenter/TaskDetail/TaskHistory.vue @@ -12,10 +12,16 @@ export default { components: { ListTable }, + props: { + object: { + type: Object, + default: () => ({}) + } + }, data() { return { tableConfig: { - url: `/api/v1/ops/adhoc-executions/?task=${this.$route.params.id}`, + url: `/api/v1/ops/adhoc-executions/?task=${this.object.id}`, columns: [ 'date_start', 'stat', 'ratio', 'is_finished', 'is_success', 'timedelta', 'adhoc_short_id', 'actions' ], diff --git a/src/views/jobcenter/TaskDetail/index.vue b/src/views/jobcenter/TaskDetail/index.vue new file mode 100644 index 000000000..4c5a576c6 --- /dev/null +++ b/src/views/jobcenter/TaskDetail/index.vue @@ -0,0 +1,54 @@ + + + + + diff --git a/src/views/jobcenter/TaskList.vue b/src/views/jobcenter/TaskList.vue index 1c08ea5bc..8b007a692 100644 --- a/src/views/jobcenter/TaskList.vue +++ b/src/views/jobcenter/TaskList.vue @@ -83,7 +83,12 @@ export default { }, headerActions: { hasCreate: false, - hasBulkDelete: false + hasBulkDelete: false, + hasBulkUpdate: false, + hasExport: false, + hasImport: false, + hasRefresh: false + } } } diff --git a/src/views/jobcenter/index.js b/src/views/jobcenter/index.js index 6904eea56..3a203b84c 100644 --- a/src/views/jobcenter/index.js +++ b/src/views/jobcenter/index.js @@ -7,21 +7,21 @@ export default [ }, { path: 'tasks/:id', - component: () => import('@/views/jobcenter/TaskDetail'), + component: () => import('@/views/jobcenter/TaskDetail/index'), name: 'TaskDetail', hidden: true, meta: { title: 'TaskDetail', activeMenu: '/ops/task' } }, { path: 'adhoc/:id', - component: () => import('@/views/jobcenter/AdhocDetail'), + component: () => import('@/views/jobcenter/TaskDetail/AdhocDetail/index'), name: 'AdhocDetail', hidden: true, meta: { title: 'TaskDetail', activeMenu: '/ops/task' } }, { path: 'executions/:id', - component: () => import('@/views/jobcenter/HistoryExecutionDetail'), + component: () => import('@/views/jobcenter/TaskDetail/HistoryExecutionDetail/index'), name: 'HistoryExecutionDetail', hidden: true, meta: { title: 'TaskDetail', activeMenu: '/ops/task' } diff --git a/src/views/perms/AssetPermissionDetail/AssetPermissionAsset.vue b/src/views/perms/AssetPermissionDetail/AssetPermissionAsset.vue index b922eaccb..b0866a03c 100644 --- a/src/views/perms/AssetPermissionDetail/AssetPermissionAsset.vue +++ b/src/views/perms/AssetPermissionDetail/AssetPermissionAsset.vue @@ -4,9 +4,9 @@ - - - + + + diff --git a/src/views/perms/AssetPermissionDetail/AssetPermissionUser.vue b/src/views/perms/AssetPermissionDetail/AssetPermissionUser.vue index 81ac8909c..980360b12 100644 --- a/src/views/perms/AssetPermissionDetail/AssetPermissionUser.vue +++ b/src/views/perms/AssetPermissionDetail/AssetPermissionUser.vue @@ -4,8 +4,8 @@ - - + + @@ -78,10 +78,8 @@ export default { } }, performAdd: (items) => { - console.log('item=====', items) const relationUrl = `/api/v1/perms/asset-permissions-users-relations/` const objectId = this.object.id - console.log('objectId====', objectId) const data = items.map(v => { return { user: v.value, @@ -110,7 +108,6 @@ export default { return this.$axios.post(relationUrl, data) }, performDelete: (item) => { - console.log('item-group-==', item) // const itemId = item.value const objectId = this.object.id const relationUrl = `/api/v1/perms/asset-permissions-user-groups-relations/?assetpermission=${objectId}` diff --git a/src/views/perms/DatabaseAppPermissionDetail/DatabaseAppPermissionDatabaseApp.vue b/src/views/perms/DatabaseAppPermissionDetail/DatabaseAppPermissionDatabaseApp.vue index 4ba104206..62033f17f 100644 --- a/src/views/perms/DatabaseAppPermissionDetail/DatabaseAppPermissionDatabaseApp.vue +++ b/src/views/perms/DatabaseAppPermissionDetail/DatabaseAppPermissionDatabaseApp.vue @@ -4,8 +4,8 @@ - - + + @@ -63,13 +63,24 @@ export default { hasSearch: false, hasRightActions: false }, - databaseAppPermissionDatabaseApp: [], - databaseAppPermissionSystemUser: [], databaseAppReletionConfig: { icon: 'fa-info', title: this.$t('perms.Add DatabaseApp to this permission'), objectsAjax: { url: '/api/v1/applications/database-apps/' + }, + hasObjectsId: this.object.databaseapp, + performAdd: (items) => { + console.log('this.object===', this.object) + const relationUrl = `/api/v1/perms/database-app-permissions-database-apps-relations/` + const objectId = this.object.id + const data = items.map(v => { + return { + databaseapppermission: objectId, + databaseapp: v.value + } + }) + return this.$axios.post(relationUrl, data) } }, hasObjectsId: this.object.system_users, @@ -79,7 +90,6 @@ export default { objectsAjax: { url: '/api/v1/assets/system-users/', processResults(data) { - console.log('data====', data) let results = data.results results = results.filter((item) => item.protocol === 'mysql').map((item) => { return { label: item.name + '(' + item.username + ')', value: item.id } diff --git a/src/views/perms/DatabaseAppPermissionDetail/DatabaseAppPermissionDetail.vue b/src/views/perms/DatabaseAppPermissionDetail/DatabaseAppPermissionDetail.vue index eaa7999d4..c48cc6707 100644 --- a/src/views/perms/DatabaseAppPermissionDetail/DatabaseAppPermissionDetail.vue +++ b/src/views/perms/DatabaseAppPermissionDetail/DatabaseAppPermissionDetail.vue @@ -36,7 +36,7 @@ export default { is_active: this.object.is_active } ], - url: `/api/v1/perms/database-app-permissions/${this.$route.params.id}/` + url: `/api/v1/perms/database-app-permissions/${this.object.id}/` } } }, diff --git a/src/views/perms/DatabaseAppPermissionDetail/DatabaseAppPermissionUser.vue b/src/views/perms/DatabaseAppPermissionDetail/DatabaseAppPermissionUser.vue index 699118686..ce0e1805d 100644 --- a/src/views/perms/DatabaseAppPermissionDetail/DatabaseAppPermissionUser.vue +++ b/src/views/perms/DatabaseAppPermissionDetail/DatabaseAppPermissionUser.vue @@ -4,8 +4,8 @@ - - + + @@ -114,6 +114,7 @@ export default { // const itemId = item.value const objectId = this.object.id const relationUrl = `/api/v1/perms/database-app-permissions-user-groups-relations/?databaseapppermission=${objectId}` + // const relationUrl = `/api/v1/perms/database-app-permissions-user-groups-relations/?databaseapppermission=${objectId}&usergroups=${itemId}` return this.$axios.delete(relationUrl) } } diff --git a/src/views/perms/RemoteAppPermissionDetail/RemoteAppPermissionDetail.vue b/src/views/perms/RemoteAppPermissionDetail/RemoteAppPermissionDetail.vue index 4946eb179..6d2a34f22 100644 --- a/src/views/perms/RemoteAppPermissionDetail/RemoteAppPermissionDetail.vue +++ b/src/views/perms/RemoteAppPermissionDetail/RemoteAppPermissionDetail.vue @@ -27,24 +27,6 @@ export default { }, data() { return { - flag: false, - config: { - activeMenu: 'detail', - submenu: [ - { - title: this.$t('perms.RemoteAppPermissionDetail'), - name: 'detail' - }, - { - title: this.$t('perms.UsersAndUserGroups'), - name: 'userAndUserGroups' - }, - { - title: this.$t('perms.RemoteApp'), - name: 'remoteApp' - } - ] - }, activeConfig: { icon: 'fa-info', title: this.$t('perms.QuickModify'), @@ -54,7 +36,7 @@ export default { is_active: true } ], - url: `/api/v1/perms/remote-app-permissions/${this.$route.params.id}/` + url: `/api/v1/perms/remote-app-permissions/${this.object.id}/` } } }, diff --git a/src/views/perms/RemoteAppPermissionDetail/RemoteAppPermissionRemoteApp.vue b/src/views/perms/RemoteAppPermissionDetail/RemoteAppPermissionRemoteApp.vue index 929dfb2ca..6c15c4942 100644 --- a/src/views/perms/RemoteAppPermissionDetail/RemoteAppPermissionRemoteApp.vue +++ b/src/views/perms/RemoteAppPermissionDetail/RemoteAppPermissionRemoteApp.vue @@ -4,8 +4,8 @@ - - + + @@ -58,6 +58,21 @@ export default { title: this.$t('perms.Add RemoteApp to this permission'), objectsAjax: { url: '/api/v1/applications/remote-apps/' + }, + hasObjectsId: this.object.remote_apps, + performAdd: (items) => { + const objectId = this.object.id + console.log('this.object===', this.object) + const relationUrl = `/api/v1/perms/remote-app-permissions/${objectId}/remote-apps/add/` + const remoteAppId = items.map(v => v.value) + const data = { remote_apps: remoteAppId } + return this.$axios.patch(relationUrl, data) + }, + performDelete: (item) => { + const objectId = this.object.id + const relationUrl = `/api/v1/perms/remote-app-permissions/${objectId}/remote-apps/remove/` + const data = { remote_apps: [item.value] } + return this.$axios.patch(relationUrl, data) } }, systemUserReletionConfig: { @@ -76,21 +91,20 @@ export default { }, hasObjectsId: this.object.system_users, performAdd: (items) => { - const relationUrl = `/api/v1/perms/remote-app-permissions-system-users-relations/` const objectId = this.object.id - const data = items.map(v => { - return { - remoteapppermission: objectId, - systemuser: v.value - } - }) - return this.$axios.post(relationUrl, data) + const relationUrl = `/api/v1/perms/remote-app-permissions/${objectId}/` + const objectRelationSystemUsers = this.object.system_users + items.map(v => objectRelationSystemUsers.push(v.value)) + const data = { system_users: objectRelationSystemUsers } + return this.$axios.patch(relationUrl, data) }, performDelete: (item) => { - const itemId = item.value const objectId = this.object.id - const relationUrl = `/api/v1/perms/remote-app-permissions-system-users-relations/?remoteapppermission=${objectId}&systemuser=${itemId}` - return this.$axios.delete(relationUrl) + const relationUrl = `/api/v1/perms/remote-app-permissions/${objectId}/` + const objectOldRelationSystemUsers = this.object.system_users + 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/RemoteAppPermissionDetail/RemoteAppPermissionUser.vue b/src/views/perms/RemoteAppPermissionDetail/RemoteAppPermissionUser.vue index 5c1789f22..d163c2dc3 100644 --- a/src/views/perms/RemoteAppPermissionDetail/RemoteAppPermissionUser.vue +++ b/src/views/perms/RemoteAppPermissionDetail/RemoteAppPermissionUser.vue @@ -4,8 +4,8 @@ - - + + @@ -20,10 +20,16 @@ export default { ListTable, RelationCard }, + props: { + object: { + type: Object, + default: () => ({}) + } + }, data() { return { tableConfig: { - url: `/api/v1/perms/remote-app-permissions/${this.$route.params.id}/users/all/`, + url: `/api/v1/perms/remote-app-permissions/${this.object.id}/users/all/`, columns: [ // 'user_display' ], @@ -47,8 +53,6 @@ export default { hasSearch: false, hasRightActions: false }, - remoteAppPermissionUser: [], - remoteAppPermissionUserGroup: [], userReletionConfig: { icon: 'fa-user', title: this.$t('perms.Add user to this permission'), @@ -62,6 +66,20 @@ export default { const more = !!data.next return { results: results, pagination: more, total: data.count } } + }, + hasObjectsId: this.object.users, + performAdd: (items) => { + const objectId = this.object.id + const relationUrl = `/api/v1/perms/remote-app-permissions/${objectId}/users/add/` + const usersId = items.map(v => v.value) + const data = { users: usersId } + return this.$axios.patch(relationUrl, data) + }, + performDelete: (item) => { + const objectId = this.object.id + const relationUrl = `/api/v1/perms/remote-app-permissions/${objectId}/users/remove/` + const data = { users: [item.value] } + return this.$axios.patch(relationUrl, data) } }, groupReletionConfig: { @@ -69,6 +87,23 @@ export default { title: this.$t('perms.Add user group to this permission'), objectsAjax: { url: '/api/v1/users/groups/' + }, + hasObjectsId: this.object.user_groups, + performAdd: (items) => { + const objectId = this.object.id + const relationUrl = `/api/v1/perms/remote-app-permissions/${objectId}/` + const objectRelationUserGroups = this.object.user_groups + items.map(v => objectRelationUserGroups.push(v.value)) + const data = { user_groups: objectRelationUserGroups } + return this.$axios.patch(relationUrl, data) + }, + performDelete: (item) => { + const objectId = this.object.id + const relationUrl = `/api/v1/perms/remote-app-permissions/${objectId}/` + const objectOldRelationUserGroups = this.object.user_groups + const objectNewRelationUserGroups = objectOldRelationUserGroups.filter(v => v !== item.value) + const data = { user_groups: objectNewRelationUserGroups } + return this.$axios.patch(relationUrl, data) } } } diff --git a/src/views/perms/RemoteAppPermissionDetail/index.vue b/src/views/perms/RemoteAppPermissionDetail/index.vue index 152bbd268..6d31783a7 100644 --- a/src/views/perms/RemoteAppPermissionDetail/index.vue +++ b/src/views/perms/RemoteAppPermissionDetail/index.vue @@ -39,17 +39,6 @@ export default { name: 'RemoteAppPermissionRemoteApp' } ] - }, - activeConfig: { - icon: 'fa-info', - title: this.$t('perms.QuickModify'), - content: [ - { - name: this.$t('perms.Active'), - is_active: true - } - ], - url: `/api/v1/perms/remote-app-permissions/${this.$route.params.id}/` } } }, diff --git a/yarn.lock b/yarn.lock index 545a7fa9d..74329ba36 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2462,6 +2462,11 @@ code-point-at@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" +codemirror@^5.22.0: + version "5.53.2" + resolved "https://registry.yarnpkg.com/codemirror/-/codemirror-5.53.2.tgz#9799121cf8c50809cca487304e9de3a74d33f428" + integrity sha512-wvSQKS4E+P8Fxn/AQ+tQtJnF1qH5UOlxtugFLpubEZ5jcdH2iXTVinb+Xc/4QjshuOxRm4fUsU2QPF1JJKiyXA== + collection-visit@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0" @@ -9469,6 +9474,13 @@ vm-browserify@^1.0.1: version "1.1.2" resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.2.tgz#78641c488b8e6ca91a75f511e7a3b32a86e5dda0" +vue-codemirror-lite@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/vue-codemirror-lite/-/vue-codemirror-lite-1.0.4.tgz#48a5cd7d17c0914503c8cd9d9b56b438e49c3410" + integrity sha1-SKXNfRfAkUUDyM2dm1a0OOScNBA= + dependencies: + codemirror "^5.22.0" + vue-cookie@^1.1.4: version "1.1.4" resolved "https://registry.npm.taobao.org/vue-cookie/download/vue-cookie-1.1.4.tgz#b8b46d112bda9f93a2f47017c2ed5282d2064fda" @@ -9918,6 +9930,16 @@ xtend@^4.0.0, xtend@~4.0.1: version "4.0.2" resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" +xterm-addon-fit@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/xterm-addon-fit/-/xterm-addon-fit-0.3.0.tgz#341710741027de9d648a9f84415a01ddfdbbe715" + integrity sha512-kvkiqHVrnMXgyCH9Xn0BOBJ7XaWC/4BgpSWQy3SueqximgW630t/QOankgqkvk11iTOCwWdAY9DTyQBXUMN3lw== + +xterm@^4.5.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/xterm/-/xterm-4.5.0.tgz#c7fd145c6cf91c9f2ef07011a9b35026cf4bfecc" + integrity sha512-4t12tsvtYnv13FBJwewddxdI/j4kSonmbQQv50j34R/rPIFbUNGtptbprmuUlTDAKvHLMDZ/Np2XcpNimga/HQ== + y18n@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41"