From b4311b8a59255025f5701959acd4e57642de2bab Mon Sep 17 00:00:00 2001
From: fit2bot <68588906+fit2bot@users.noreply.github.com>
Date: Fri, 9 Oct 2020 11:05:42 +0800
Subject: [PATCH 01/11] =?UTF-8?q?perf(permSelectAssetCard):=20=E4=BC=98?=
=?UTF-8?q?=E5=8C=96=E6=8E=88=E6=9D=83=E8=AF=A6=E6=83=85=E9=A1=B5=E4=B8=AD?=
=?UTF-8?q?=E7=9A=84=E6=B7=BB=E5=8A=A0=E8=B5=84=E4=BA=A7=EF=BC=8C=E5=B0=86?=
=?UTF-8?q?=E5=B7=B2=E6=B7=BB=E5=8A=A0=E7=9A=84=E8=B5=84=E4=BA=A7disable?=
=?UTF-8?q?=E6=8E=89=20(#405)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* perf(permSelectAssetCard): 优化授权详情页中的添加资产,将已添加的资产disable掉
* perf(permSelectAssetCard): 修改全选时,禁用也被选择的bug
* perf(assetSelect): 修改名称
Co-authored-by: jym503558564 <503558564@qq.com>
---
src/components/AssetRelationCard/index.vue | 8 +++++++-
src/components/AssetSelect/index.vue | 7 +++++++
.../compenents/el-data-table/el-data-table.vue | 10 ++++++++--
.../AssetPermissionDetail/AssetPermissionAsset.vue | 5 +++++
4 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/src/components/AssetRelationCard/index.vue b/src/components/AssetRelationCard/index.vue
index 1f02958af..a0caf498d 100644
--- a/src/components/AssetRelationCard/index.vue
+++ b/src/components/AssetRelationCard/index.vue
@@ -3,7 +3,7 @@
-
+
|
@@ -49,6 +49,12 @@ export default {
onAddSuccess: {
type: Function,
default: (objects, that) => {}
+ },
+ canSelect: {
+ type: Function,
+ default(row, index) {
+ return true
+ }
}
},
data() {
diff --git a/src/components/AssetSelect/index.vue b/src/components/AssetSelect/index.vue
index c5a372b6e..115474229 100644
--- a/src/components/AssetSelect/index.vue
+++ b/src/components/AssetSelect/index.vue
@@ -34,6 +34,12 @@ export default {
value: {
type: Array,
default: () => []
+ },
+ canSelect: {
+ type: Function,
+ default(row, index) {
+ return true
+ }
}
},
data() {
@@ -68,6 +74,7 @@ export default {
tableConfig: {
url: '/api/v1/assets/assets/',
hasTree: true,
+ canSelect: this.canSelect,
columns: [
{
prop: 'hostname',
diff --git a/src/components/DataTable/compenents/el-data-table/el-data-table.vue b/src/components/DataTable/compenents/el-data-table/el-data-table.vue
index b406765e2..2a0417095 100644
--- a/src/components/DataTable/compenents/el-data-table/el-data-table.vue
+++ b/src/components/DataTable/compenents/el-data-table/el-data-table.vue
@@ -13,7 +13,7 @@
:row-class-name="rowClassName"
@selection-change="selectStrategy.onSelectionChange"
@select="selectStrategy.onSelect"
- @select-all="selectStrategy.onSelectAll($event, selectable)"
+ @select-all="selectStrategy.onSelectAll($event, canSelect)"
@sort-change="onSortChange"
>
@@ -90,7 +90,7 @@
-
+
{
+ return this.object.assets.indexOf(row.id) === -1
+ },
performAdd: (items, that) => {
const relationUrl = `/api/v1/perms/asset-permissions-assets-relations/`
const objectId = this.object.id
@@ -86,6 +90,7 @@ export default {
this.$message.success(this.$t('common.updateSuccessMsg'))
this.$refs.ListTable.reloadTable()
that.$refs.assetSelect.$refs.select2.clearSelected()
+ window.location.reload()
}
},
nodeRelationConfig: {
From 2f9d7ab826452ba20b6935311d2c4da9b79e444d Mon Sep 17 00:00:00 2001
From: jym503558564 <503558564@qq.com>
Date: Sat, 10 Oct 2020 15:32:29 +0800
Subject: [PATCH 02/11] =?UTF-8?q?perf(protocol):=20=E6=89=B9=E9=87=8F?=
=?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=8D=8F=E8=AE=AE=E7=BB=84=E7=BB=99=E9=BB=98?=
=?UTF-8?q?=E8=AE=A4=E5=80=BC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/assets/Asset/AssetList.vue | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/views/assets/Asset/AssetList.vue b/src/views/assets/Asset/AssetList.vue
index 36c937595..db3431f6c 100644
--- a/src/views/assets/Asset/AssetList.vue
+++ b/src/views/assets/Asset/AssetList.vue
@@ -282,7 +282,8 @@ export default {
formSetting: {
url: '/api/v1/assets/assets/',
initial: {
- platform: 'Linux'
+ platform: 'Linux',
+ protocols: ['ssh/22']
},
fields: [
'platform', 'protocols', 'domain', 'admin_user', 'labels', 'comment'
From c86aef999ca19e3c83d416f8c8cc3c4104b3bdc9 Mon Sep 17 00:00:00 2001
From: Orange
Date: Fri, 9 Oct 2020 19:29:03 +0800
Subject: [PATCH 03/11] =?UTF-8?q?fix:=20=E8=B0=83=E6=95=B4badge=E4=BD=8D?=
=?UTF-8?q?=E7=BD=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/layout/components/NavHeader/Tickets.vue | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/layout/components/NavHeader/Tickets.vue b/src/layout/components/NavHeader/Tickets.vue
index 4c9d23888..aa9373fb1 100644
--- a/src/layout/components/NavHeader/Tickets.vue
+++ b/src/layout/components/NavHeader/Tickets.vue
@@ -1,7 +1,9 @@
- {{ $t('route.Ticket') }}
-
+
+
+ {{ $t('route.Ticket') }}
+
@@ -40,4 +42,7 @@ export default {
font-size: 13px;
font-weight: 400
}
+.el-badge ::v-deep .el-badge__content.is-fixed{
+ top:10px;
+}
From 47e88e7bb427162f2bdf04975dc93d9f81e68365 Mon Sep 17 00:00:00 2001
From: fit2bot <68588906+fit2bot@users.noreply.github.com>
Date: Mon, 12 Oct 2020 10:55:56 +0800
Subject: [PATCH 04/11] =?UTF-8?q?perf(org):=20=E6=B7=BB=E5=8A=A0=E7=BB=84?=
=?UTF-8?q?=E7=BB=87=E6=88=90=E5=91=98=E5=90=88=E5=B9=B6=E6=88=90=E4=B8=80?=
=?UTF-8?q?=E4=B8=AAcard=20(#422)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* perf(org): 添加组织成员合并成一个card
* perf(org): 添加成员后,object需重新刷新才能重新获取新值
Co-authored-by: jym503558564 <503558564@qq.com>
---
.../OrganizationMembershipList.vue | 121 ++++++------------
1 file changed, 40 insertions(+), 81 deletions(-)
diff --git a/src/views/xpack/Org/OrganizationDetail/OrganizationMembershipList.vue b/src/views/xpack/Org/OrganizationDetail/OrganizationMembershipList.vue
index 6c6cfc6fb..5f1d0429c 100644
--- a/src/views/xpack/Org/OrganizationDetail/OrganizationMembershipList.vue
+++ b/src/views/xpack/Org/OrganizationDetail/OrganizationMembershipList.vue
@@ -4,9 +4,11 @@
-
-
-
+
+
+ {{ item.label }}
+
+
@@ -30,6 +32,19 @@ export default {
},
data() {
return {
+ defaultOrgRole: 'User',
+ group: [
+ {
+ label: this.$t('users.OrgAdmin'),
+ value: 'Admin'
+ }, {
+ label: this.$t('users.OrgAuditor'),
+ value: 'Auditor'
+ }, {
+ label: this.$t('users.OrgUser'),
+ value: 'User'
+ }
+ ],
tableConfig: {
url: `/api/v1/orgs/org-memeber-relation/?org_id=${this.object.id}`,
columns: [
@@ -68,79 +83,9 @@ export default {
hasBulkDelete: false,
hasBulkUpdate: false
},
- adminRelationConfig: {
+ memberRelationConfig: {
icon: 'fa-user',
- title: this.$t('xpack.Admin'),
- objectsAjax: {
- url: '/api/v1/users/users/?fields_size=mini&order=name&all=1',
- transformOption: (item) => {
- return { label: item.name + '(' + item.username + ')', value: item.id }
- }
- },
- hasObjectsId: this.object.admins,
- showHasObjects: false,
- performAdd: (items) => {
- const objectId = this.object.id
- const relationUrl = `/api/v1/orgs/orgs/${objectId}/`
- const objectRelationAdmin = this.object.admins
- items.map(v => objectRelationAdmin.push(v.value))
- const data = { admins: objectRelationAdmin }
- return this.$axios.patch(relationUrl, data)
- },
- performDelete: (item) => {
- const objectId = this.object.id
- const relationUrl = `/api/v1/orgs/orgs/${objectId}/`
- const objectOldRelationAdmin = this.object.admins
- const objectNewRelationAdmin = objectOldRelationAdmin.filter(v => v !== item.value)
- const data = { admins: objectNewRelationAdmin }
- return this.$axios.patch(relationUrl, data)
- },
- onAddSuccess: (objects, that) => {
- this.$log.debug('Select value', that.select2.value)
- that.iHasObjects = [...that.iHasObjects, ...objects]
- that.$refs.select2.clearSelected()
- this.$message.success(this.$t('common.updateSuccessMsg'))
- this.$refs.ListTable.reloadTable()
- }
- },
- auditorRelationConfig: {
- icon: 'fa-user',
- title: this.$t('xpack.Auditor'),
- objectsAjax: {
- url: '/api/v1/users/users/?fields_size=mini&order=name&all=1',
- transformOption: (item) => {
- return { label: item.name + '(' + item.username + ')', value: item.id }
- }
- },
- hasObjectsId: this.object.auditors,
- showHasObjects: false,
- performAdd: (items) => {
- const objectId = this.object.id
- const relationUrl = `/api/v1/orgs/orgs/${objectId}/`
- const objectRelationAuditors = this.object.auditors
- items.map(v => objectRelationAuditors.push(v.value))
- const data = { auditors: objectRelationAuditors }
- return this.$axios.patch(relationUrl, data)
- },
- performDelete: (item) => {
- const objectId = this.object.id
- const relationUrl = `/api/v1/orgs/orgs/${objectId}/`
- const objectOldRelationAuditors = this.object.auditors
- const objectNewRelationAuditors = objectOldRelationAuditors.filter(v => v !== item.value)
- const data = { auditors: objectNewRelationAuditors }
- return this.$axios.patch(relationUrl, data)
- },
- onAddSuccess: (objects, that) => {
- this.$log.debug('Select value', that.select2.value)
- that.iHasObjects = [...that.iHasObjects, ...objects]
- that.$refs.select2.clearSelected()
- this.$message.success(this.$t('common.updateSuccessMsg'))
- this.$refs.ListTable.reloadTable()
- }
- },
- userRelationConfig: {
- icon: 'fa-user',
- title: this.$t('xpack.User'),
+ title: this.$t('xpack.Organization.AddOrgMembers'),
objectsAjax: {
url: '/api/v1/users/users/?fields_size=mini&order=name&all=1',
transformOption: (item) => {
@@ -150,12 +95,12 @@ export default {
hasObjectsId: this.object.users,
showHasObjects: false,
performAdd: (items) => {
- const objectId = this.object.id
- const relationUrl = `/api/v1/orgs/orgs/${objectId}/`
- const objectRelationUsers = this.object.users
- items.map(v => objectRelationUsers.push(v.value))
- const data = { users: objectRelationUsers }
- return this.$axios.patch(relationUrl, data)
+ const relationUrl = `/api/v1/orgs/org-memeber-relation/`
+ const data = []
+ for (const user of items) {
+ data.push({ org: this.object.id, user: user.value, role: this.defaultOrgRole })
+ }
+ return this.$axios.post(relationUrl, data)
},
onAddSuccess: (objects, that) => {
this.$log.debug('Select value', that.select2.value)
@@ -163,9 +108,23 @@ export default {
that.$refs.select2.clearSelected()
this.$message.success(this.$t('common.updateSuccessMsg'))
this.$refs.ListTable.reloadTable()
+ window.location.reload()
}
}
}
+ },
+ watch: {
+ defaultOrgRole(value) {
+ if (value === 'Admin') {
+ this.$set(this.memberRelationConfig, 'hasObjectsId', this.object.admins)
+ }
+ if (value === 'Auditor') {
+ this.$set(this.memberRelationConfig, 'hasObjectsId', this.object.auditors)
+ }
+ if (value === 'User') {
+ this.$set(this.memberRelationConfig, 'hasObjectsId', this.object.users)
+ }
+ }
}
}
From 1519ccb8e2f7dc9d247f9f105d90a2cc75452e12 Mon Sep 17 00:00:00 2001
From: Orange
Date: Mon, 12 Oct 2020 12:08:43 +0800
Subject: [PATCH 05/11] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E6=B7=BB?=
=?UTF-8?q?=E5=8A=A0=E7=94=A8=E6=88=B7API?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/users/User/components/InviteUsersDialog.vue | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/views/users/User/components/InviteUsersDialog.vue b/src/views/users/User/components/InviteUsersDialog.vue
index bb623fd90..40f34f689 100644
--- a/src/views/users/User/components/InviteUsersDialog.vue
+++ b/src/views/users/User/components/InviteUsersDialog.vue
@@ -97,7 +97,7 @@ export default {
this.InviteOptions = []
this.selectLoading = true
this.$axios
- .get(` /api/v1/users/users/?search=${query}&all=1`)
+ .get(` /api/v1/users/users/suggestion/?search=${query}`)
.then(result => {
console.log(result)
for (let i = 0; i < result.length; i++) {
From b849df1dc1f32e73e5af517f3b013d60d90e8e2d Mon Sep 17 00:00:00 2001
From: Orange
Date: Tue, 13 Oct 2020 14:48:06 +0800
Subject: [PATCH 06/11] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=A1=A8?=
=?UTF-8?q?=E6=A0=BC=E7=9A=84=E6=97=B6=E9=97=B4=E8=BF=87=E6=BB=A4=E9=97=AE?=
=?UTF-8?q?=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/utils/common.js | 7 +++++++
src/views/audits/CommandExecutionList.vue | 4 ++--
src/views/audits/FTPLogList.vue | 4 ++--
src/views/audits/LoginLogList.vue | 4 ++--
src/views/audits/OperateLogList.vue | 4 ++--
src/views/audits/PasswordChangeLogList.vue | 4 ++--
src/views/sessions/CommandList.vue | 4 ++--
src/views/sessions/SessionList/BaseList.vue | 4 ++--
8 files changed, 21 insertions(+), 14 deletions(-)
diff --git a/src/utils/common.js b/src/utils/common.js
index c1845d247..b8f5a7bb1 100644
--- a/src/utils/common.js
+++ b/src/utils/common.js
@@ -145,6 +145,13 @@ export function getDaysFuture(days, now) {
return new Date(now.getTime() + 3600 * 1000 * 24 * days)
}
+export function getDayEnd(now) {
+ if (!now) {
+ now = new Date()
+ }
+ return new Date(new Date(now.toLocaleDateString()).getTime() + 24 * 60 * 60 * 1000 - 1)
+}
+
export function setUrlParam(url, name, value) {
const urlArray = url.split('?')
if (urlArray.length === 1) {
diff --git a/src/views/audits/CommandExecutionList.vue b/src/views/audits/CommandExecutionList.vue
index 221195114..8e474dc0c 100644
--- a/src/views/audits/CommandExecutionList.vue
+++ b/src/views/audits/CommandExecutionList.vue
@@ -9,7 +9,7 @@
+
+
diff --git a/src/layout/components/Page/PageHeading.vue b/src/layout/components/Page/PageHeading.vue
index 9f1e8256f..ed8642387 100644
--- a/src/layout/components/Page/PageHeading.vue
+++ b/src/layout/components/Page/PageHeading.vue
@@ -1,22 +1,31 @@
-
-
-
- {{ title }}
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ {{ title }}
+
+
+
+
+
+
+
+