!32 [sync] PR-31: 优化登陆界面跳转逻辑、修复资产管理模块及漏洞管理模块代码遗留问题
From: @openeuler-sync-bot Reviewed-by: @zhu-yuncheng Signed-off-by: @zhu-yuncheng
This commit is contained in:
commit
1bbba66b91
226
0001-optimize-page-loading-and-routing.patch
Normal file
226
0001-optimize-page-loading-and-routing.patch
Normal file
@ -0,0 +1,226 @@
|
||||
From 1a318efbb8d9b27cf01f3dd8544baa549863575a Mon Sep 17 00:00:00 2001
|
||||
From: wkl505997900 <505997900@qq.com>
|
||||
Date: Sun, 23 Apr 2023 10:03:06 +0800
|
||||
Subject: [PATCH 1/2] Optimize page loading and routing
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
---
|
||||
src/config/router.config.js | 20 +++++++++++++++++++-
|
||||
src/views/leaks/components/HostTable.vue | 9 +++++++--
|
||||
2 files changed, 26 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/config/router.config.js b/src/config/router.config.js
|
||||
index 1a9bad3..8a15f2a 100644
|
||||
--- a/src/config/router.config.js
|
||||
+++ b/src/config/router.config.js
|
||||
@@ -37,6 +37,10 @@ const routeMap = {
|
||||
path: '/assests/hosts-management/host-edit'
|
||||
}
|
||||
}
|
||||
+ },
|
||||
+ hostgroupView: {
|
||||
+ title: 'menu.assests.host-group-management',
|
||||
+ path: '/assests/host-group-management'
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -303,7 +307,21 @@ export const asyncRouterMap = [
|
||||
component: () => import('@/views/assests/HostGroupManagement'),
|
||||
meta: {
|
||||
title: 'menu.assests.host-group-management',
|
||||
- permission: ['assests']
|
||||
+ permission: ['assests'],
|
||||
+ diyBreadcrumb: [
|
||||
+ {
|
||||
+ breadcrumbName: routeMap.index.title,
|
||||
+ path: routeMap.index.path
|
||||
+ },
|
||||
+ {
|
||||
+ breadcrumbName: routeMap.assests.title,
|
||||
+ path: routeMap.assests.path
|
||||
+ },
|
||||
+ {
|
||||
+ breadcrumbName: routeMap.assests.children.hostgroupView.title,
|
||||
+ path: routeMap.assests.children.hostgroupView.path
|
||||
+ }
|
||||
+ ]
|
||||
}
|
||||
}
|
||||
]
|
||||
diff --git a/src/views/leaks/components/HostTable.vue b/src/views/leaks/components/HostTable.vue
|
||||
index e95e974..38618de 100644
|
||||
--- a/src/views/leaks/components/HostTable.vue
|
||||
+++ b/src/views/leaks/components/HostTable.vue
|
||||
@@ -104,6 +104,9 @@
|
||||
{{ last_scan }}
|
||||
<!-- {{ record.last_scan === null ? '未扫描' : record.last_scan }} -->
|
||||
</div>
|
||||
+ <div slot="repo" slot-scope="repo">
|
||||
+ {{ repo || '——' }}
|
||||
+ </div>
|
||||
<div slot="hotpatch" slot-scope="hotpatch">
|
||||
{{ hotpatch ? '是' : '否' }}
|
||||
<!-- {{ record.last_scan === null ? '未扫描' : record.last_scan }} -->
|
||||
@@ -199,7 +202,8 @@ export default {
|
||||
key: 'repo',
|
||||
title: 'CVE REPO',
|
||||
filteredValue: filters.repo || [],
|
||||
- filters: this.repoList
|
||||
+ filters: this.repoList,
|
||||
+ scopedSlots: {customRender: 'repo'}
|
||||
},
|
||||
{
|
||||
dataIndex: 'cve_num',
|
||||
@@ -243,7 +247,8 @@ export default {
|
||||
key: 'repo',
|
||||
title: 'CVE REPO',
|
||||
filteredValue: filters.repo || null,
|
||||
- filters: this.standalone ? this.repoList : this.repoFilterList
|
||||
+ filters: this.standalone ? this.repoList : this.repoFilterList,
|
||||
+ scopedSlots: {customRender: 'repo'}
|
||||
},
|
||||
{
|
||||
dataIndex: 'hotpatch',
|
||||
--
|
||||
Gitee
|
||||
|
||||
|
||||
From 0faf5b381a1d84f3a152ffa887207af138255f5b Mon Sep 17 00:00:00 2001
|
||||
From: wkl505997900 <505997900@qq.com>
|
||||
Date: Sun, 23 Apr 2023 18:46:51 +0800
|
||||
Subject: [PATCH 2/2] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=B7=AF=E7=94=B1?=
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
---
|
||||
.../components/GlobalHeader/AvatarDropdown.vue | 1 +
|
||||
src/vendor/ant-design-pro/permission.js | 13 ++++++++++++-
|
||||
src/vendor/ant-design-pro/store/modules/user.js | 15 +++------------
|
||||
src/vendor/ant-design-pro/utils/request.js | 2 +-
|
||||
src/views/user/Login.vue | 1 +
|
||||
vue.config.js | 3 +++
|
||||
6 files changed, 21 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/src/vendor/ant-design-pro/components/GlobalHeader/AvatarDropdown.vue b/src/vendor/ant-design-pro/components/GlobalHeader/AvatarDropdown.vue
|
||||
index a30ed66..ae97aed 100644
|
||||
--- a/src/vendor/ant-design-pro/components/GlobalHeader/AvatarDropdown.vue
|
||||
+++ b/src/vendor/ant-design-pro/components/GlobalHeader/AvatarDropdown.vue
|
||||
@@ -67,6 +67,7 @@ export default {
|
||||
content: this.$t('layouts.usermenu.dialog.content'),
|
||||
onOk: () => {
|
||||
return this.$store.dispatch('Logout').then(() => {
|
||||
+ this.$message.info('退出登陆!')
|
||||
this.$router.push({name: 'login'});
|
||||
});
|
||||
},
|
||||
diff --git a/src/vendor/ant-design-pro/permission.js b/src/vendor/ant-design-pro/permission.js
|
||||
index 41ffbfb..7d85dbd 100644
|
||||
--- a/src/vendor/ant-design-pro/permission.js
|
||||
+++ b/src/vendor/ant-design-pro/permission.js
|
||||
@@ -64,7 +64,18 @@ router.beforeEach((to, from, next) => {
|
||||
});
|
||||
});
|
||||
} else {
|
||||
- next();
|
||||
+ // 路由跳转前判断token是否过期
|
||||
+ if (localStorage.getItem('is_tokenvalid')) {
|
||||
+ var interval = setInterval(function() {
|
||||
+ if (!localStorage.getItem('is_tokenvalid')) {
|
||||
+ clearInterval(interval);
|
||||
+ // 执行某些操作
|
||||
+ next()
|
||||
+ }
|
||||
+ }, 1000); // 每隔1秒钟执行一次判断操作
|
||||
+ } else {
|
||||
+ next();
|
||||
+ }
|
||||
}
|
||||
}
|
||||
} else {
|
||||
diff --git a/src/vendor/ant-design-pro/store/modules/user.js b/src/vendor/ant-design-pro/store/modules/user.js
|
||||
index 4f185e3..505ce1c 100644
|
||||
--- a/src/vendor/ant-design-pro/store/modules/user.js
|
||||
+++ b/src/vendor/ant-design-pro/store/modules/user.js
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import storage from 'store';
|
||||
import cookie from 'js-cookie';
|
||||
-import { login, logout, refreshTokenFn } from '@/api/login';
|
||||
+import { login, refreshTokenFn } from '@/api/login';
|
||||
import { ACCESS_TOKEN, REFRESH_TOKIN } from '@/vendor/ant-design-pro/store/mutation-types';
|
||||
|
||||
const user = {
|
||||
@@ -130,26 +130,17 @@ const user = {
|
||||
cookie.remove('aops_token');
|
||||
cookie.remove('user_name');
|
||||
cookie.remove('refreshtoken');
|
||||
-
|
||||
- return new Promise(resolve => {
|
||||
- logout(state.token)
|
||||
- .then(() => {
|
||||
- resolve();
|
||||
- })
|
||||
- .catch(() => {
|
||||
- resolve();
|
||||
- })
|
||||
- .finally(() => { });
|
||||
- });
|
||||
},
|
||||
|
||||
// 刷新token
|
||||
RefreshToken({ commit, state }) {
|
||||
+ storage.set('is_tokenvalid', true, 7 * 24 * 60 * 60 * 1000);
|
||||
return new Promise((resolve, reject) => {
|
||||
const refreshToken = localStorage.getItem('Refresh-Token').substring(1, localStorage.getItem('Refresh-Token').length - 1)
|
||||
refreshTokenFn(refreshToken).then((res) => {
|
||||
if (res.code === '200') {
|
||||
const in20Minutes = 1 / 72;
|
||||
+ storage.remove('is_tokenvalid');
|
||||
storage.set(ACCESS_TOKEN, res.data.token, 7 * 24 * 60 * 60 * 1000);
|
||||
storage.set(REFRESH_TOKIN, res.data.refresh_token, 7 * 24 * 60 * 60 * 1000)
|
||||
cookie.set('aops_token', res.data.token, {
|
||||
diff --git a/src/vendor/ant-design-pro/utils/request.js b/src/vendor/ant-design-pro/utils/request.js
|
||||
index e6f49ce..4a2383f 100644
|
||||
--- a/src/vendor/ant-design-pro/utils/request.js
|
||||
+++ b/src/vendor/ant-design-pro/utils/request.js
|
||||
@@ -96,7 +96,7 @@ request.interceptors.response.use(response => {
|
||||
// token过期后,调接口,刷新token
|
||||
store.dispatch('RefreshToken').then(() => {
|
||||
// 再发请求
|
||||
- return request(response.config)
|
||||
+ return request(response.config);
|
||||
}).catch((err) => {
|
||||
this.$message.error(err.response.message)
|
||||
})
|
||||
diff --git a/src/views/user/Login.vue b/src/views/user/Login.vue
|
||||
index 0026155..fae311a 100644
|
||||
--- a/src/views/user/Login.vue
|
||||
+++ b/src/views/user/Login.vue
|
||||
@@ -30,6 +30,7 @@
|
||||
validateTrigger: 'blur'
|
||||
}
|
||||
]"
|
||||
+ autocomplete
|
||||
>
|
||||
<a-icon slot="prefix" type="lock" :style="{color: 'rgba(0,0,0,.25)'}" />
|
||||
</a-input-password>
|
||||
diff --git a/vue.config.js b/vue.config.js
|
||||
index 4c6dec4..e38f377 100644
|
||||
--- a/vue.config.js
|
||||
+++ b/vue.config.js
|
||||
@@ -53,6 +53,9 @@ const vueConfig = {
|
||||
},
|
||||
|
||||
chainWebpack: config => {
|
||||
+ config.plugins.delete('prefetch')
|
||||
+ config.plugins.delete('preload')
|
||||
+
|
||||
config.resolve.alias.set('@$', resolve('src'));
|
||||
|
||||
const svgRule = config.module.rule('svg');
|
||||
--
|
||||
Gitee
|
||||
|
||||
567
0002-fix-verify-the-host-name-field-issue.patch
Normal file
567
0002-fix-verify-the-host-name-field-issue.patch
Normal file
@ -0,0 +1,567 @@
|
||||
From 4ab8ff449fd0ae87de58a64509f1218eaf0a1efd Mon Sep 17 00:00:00 2001
|
||||
From: wkl505997900 <505997900@qq.com>
|
||||
Date: Mon, 24 Apr 2023 16:11:22 +0800
|
||||
Subject: [PATCH] Verify the host name field before and after adding a host
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
---
|
||||
.../ant-design-pro/layouts/UserLayout.vue | 3 +-
|
||||
src/views/assests/HostEdition.vue | 80 ++++++++++---------
|
||||
src/views/assests/HostManagement.vue | 24 +++---
|
||||
src/views/assests/components/EditableCell.vue | 48 ++++++++---
|
||||
src/views/assests/components/addMoreHost.vue | 54 ++++++++++---
|
||||
src/views/leaks/components/UploadFile.vue | 4 +-
|
||||
src/views/user/Login.vue | 2 +-
|
||||
src/views/user/Register.vue | 6 +-
|
||||
8 files changed, 145 insertions(+), 76 deletions(-)
|
||||
|
||||
diff --git a/src/vendor/ant-design-pro/layouts/UserLayout.vue b/src/vendor/ant-design-pro/layouts/UserLayout.vue
|
||||
index 72dc176..b054097 100644
|
||||
--- a/src/vendor/ant-design-pro/layouts/UserLayout.vue
|
||||
+++ b/src/vendor/ant-design-pro/layouts/UserLayout.vue
|
||||
@@ -158,7 +158,8 @@ export default {
|
||||
}
|
||||
|
||||
.footer {
|
||||
- width: 100%;
|
||||
+ position: absolute;
|
||||
+ width: 98%;
|
||||
bottom: 0;
|
||||
padding: 0 16px;
|
||||
margin: 155px 0 24px;
|
||||
diff --git a/src/views/assests/HostEdition.vue b/src/views/assests/HostEdition.vue
|
||||
index fac76fc..a945a68 100644
|
||||
--- a/src/views/assests/HostEdition.vue
|
||||
+++ b/src/views/assests/HostEdition.vue
|
||||
@@ -12,10 +12,10 @@
|
||||
:maxLength="50"
|
||||
v-decorator="[
|
||||
'host_name',
|
||||
- {rules: [{ required: true, message: '请输入主机名称'}, {validator: checkNameInput}]}
|
||||
+ {rules: [{ required: true, message: '请输入主机名称'}, {validator: checkNameInput, validateTrigger: 'blur'}]},
|
||||
]"
|
||||
placeholder="请输入主机名称,50个字符以内">
|
||||
- <a-tooltip slot="suffix" title="最大长度50个字符,由数字、小写字母、英文下划线_组成。以小写字母开头,且结尾不能是英文下划线_">
|
||||
+ <a-tooltip slot="suffix" title="最大长度50个字符,首尾不能为空格,不允许全空格">
|
||||
<a-icon type="info-circle" style="color: rgba(0,0,0,.45)" />
|
||||
</a-tooltip>
|
||||
</a-input>
|
||||
@@ -64,6 +64,7 @@
|
||||
<a-input-number
|
||||
:min="0"
|
||||
:max="65535"
|
||||
+ @change="handlePortChange"
|
||||
v-decorator="[
|
||||
'ssh_port',
|
||||
{initialValue: 22, rules: [{required: true, message: '请输入 0~65535 内正整数'}]}
|
||||
@@ -80,6 +81,7 @@
|
||||
</a-form-item>
|
||||
<a-form-item label="主机用户名">
|
||||
<a-input
|
||||
+ @change="handleUserChange"
|
||||
v-decorator="[
|
||||
'ssh_user',
|
||||
{rules: [{required: true, message: '请输入主机用户名'}]}
|
||||
@@ -94,25 +96,10 @@
|
||||
<a-input-password
|
||||
v-decorator="[
|
||||
'password',
|
||||
- {rules: [{required: pageType === 'create' ? true : false, message: '请输入主机登录密码'}]}
|
||||
+ {rules: [{required: pageType === 'create' ? true : requiredRules, message: '请输入主机登录密码'}]}
|
||||
]"
|
||||
- placeholder="请设置登录密码, 若为空则不修改"></a-input-password>
|
||||
+ :placeholder="pageType === 'create' ? '请设置主机登录密码' : '请输入主机登陆密码, 若未修改主机用户名或端口可以为空'"></a-input-password>
|
||||
</a-form-item>
|
||||
- <!-- <a-form-item label="主机sudo密码">
|
||||
- <a-input-password
|
||||
- v-decorator="[
|
||||
- 'sudo_password',
|
||||
- {rules: [{required: true, message: '请输入主机sudo密码'}, {validator: passwordCheck}]}
|
||||
- ]"
|
||||
- placeholder="请设置sudo密码,长度8-20个字符"
|
||||
- />
|
||||
- </a-form-item> -->
|
||||
- <!-- <a-form-item label="加密密钥">
|
||||
- <a-input-password
|
||||
- v-decorator="['key', {rules: [{required: true, message: '请输入加密密钥'}, {validator: passwordCheck}]}]"
|
||||
- placeholder="请设置用于给主机私密信息加密的密钥,长度8-20个字符"
|
||||
- />
|
||||
- </a-form-item> -->
|
||||
<a-form-item :wrapper-col="{span: 10, offset: 5}">
|
||||
<a-button @click="handleCancel">取消</a-button>
|
||||
<a-button
|
||||
@@ -158,7 +145,9 @@ export default {
|
||||
hostGroupList: [],
|
||||
hostGroupIsLoading: false,
|
||||
form: this.$form.createForm(this),
|
||||
- submitLoading: false
|
||||
+ submitLoading: false,
|
||||
+ PortRequired: false,
|
||||
+ UserRequired: false
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -183,6 +172,10 @@ export default {
|
||||
}
|
||||
};
|
||||
},
|
||||
+ requiredRules() {
|
||||
+ // 当前为修改页面,只要端口号或主机用户名有一个改变时,密码为必须项
|
||||
+ return this.UserRequired || this.PortRequired
|
||||
+ },
|
||||
...mapState({
|
||||
hostInfo: (state) => state.host.hostInfo
|
||||
})
|
||||
@@ -200,6 +193,16 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
+ handleUserChange(value) {
|
||||
+ if (this.pageType === 'edit') {
|
||||
+ value.target.value === this.basicHostInfo.ssh_user ? this.UserRequired = false : this.UserRequired = true
|
||||
+ }
|
||||
+ },
|
||||
+ handlePortChange(value) {
|
||||
+ if (this.pageType === 'edit') {
|
||||
+ value === this.basicHostInfo.ssh_port ? this.PortRequired = false : this.PortRequired = true
|
||||
+ }
|
||||
+ },
|
||||
// 获取主机组列表数据
|
||||
getHostGroupList() {
|
||||
const _this = this;
|
||||
@@ -240,18 +243,23 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
- editHost(tableParams, this.hostId)
|
||||
- .then(function (res) {
|
||||
- _this.$message.success(res.message);
|
||||
- store.dispatch('resetHostInfo');
|
||||
- router.push('/assests/hosts-management');
|
||||
- })
|
||||
- .catch(function (err) {
|
||||
- _this.$message.error(err.response.message);
|
||||
- })
|
||||
- .finally(function () {
|
||||
- _this.submitLoading = false;
|
||||
- });
|
||||
+ if (JSON.stringify(tableParams) === '{}') {
|
||||
+ this.$message.info('未存在修改数据!')
|
||||
+ this.submitLoading = false;
|
||||
+ } else {
|
||||
+ editHost(tableParams, this.hostId)
|
||||
+ .then(function (res) {
|
||||
+ _this.$message.success(res.message);
|
||||
+ store.dispatch('resetHostInfo');
|
||||
+ router.push('/assests/hosts-management');
|
||||
+ })
|
||||
+ .catch(function (err) {
|
||||
+ _this.$message.error(err.response.message);
|
||||
+ })
|
||||
+ .finally(function () {
|
||||
+ _this.submitLoading = false;
|
||||
+ });
|
||||
+ }
|
||||
} else {
|
||||
addHost(values)
|
||||
.then(function (res) {
|
||||
@@ -278,15 +286,15 @@ export default {
|
||||
router.go(-1);
|
||||
},
|
||||
checkNameInput(rule, value, cb) {
|
||||
- if (/[^0-9a-z_.]/.test(value)) {
|
||||
+ if (!/^\S.*\S$/.test(value)) {
|
||||
/* eslint-disable */
|
||||
- cb('只能输入数字、小写字母和英文.和_');
|
||||
+ cb('首尾不允许空格');
|
||||
/* eslint-enable */
|
||||
return;
|
||||
}
|
||||
- if (/[_]$/.test(value)) {
|
||||
+ if (!/^(?!\s*$).+/.test(value)) {
|
||||
/* eslint-disable */
|
||||
- cb('结尾不能是英文下划线');
|
||||
+ cb('不允许全空格');
|
||||
/* eslint-enable */
|
||||
return;
|
||||
}
|
||||
diff --git a/src/views/assests/HostManagement.vue b/src/views/assests/HostManagement.vue
|
||||
index 81c25eb..080c145 100644
|
||||
--- a/src/views/assests/HostManagement.vue
|
||||
+++ b/src/views/assests/HostManagement.vue
|
||||
@@ -58,7 +58,7 @@
|
||||
slot="hostName"
|
||||
slot-scope="hostName, record">{{ hostName }}</router-link>
|
||||
<span slot="isManagement" slot-scope="isMana">{{ isMana ? '是' : '否' }}</span>
|
||||
- <span slot="statusItem" slot-scope="status">{{ statusMap(status) }}</span>
|
||||
+ <span slot="statusItem" slot-scope="status">{{ hostStatusMap[status] }}</span>
|
||||
<span slot="scene" slot-scope="scene">{{ scene ? ( scene === 'normal' ? '通用' : scene ) : '暂无' }}</span>
|
||||
<span slot="action" slot-scope="record">
|
||||
<!-- <a @click="openDetail(record.host_id)">查看</a>
|
||||
@@ -89,9 +89,17 @@ import MyPageHeaderWrapper from '@/views/utils/MyPageHeaderWrapper';
|
||||
import {getSelectedRow} from '@/views/utils/getSelectedRow';
|
||||
import HostDetailDrawer from './components/HostDetailDrawer';
|
||||
// import HostTerminal from '@/views/assests/components/HostTerminal';
|
||||
-
|
||||
import {hostList, deleteHost, hostGroupList} from '@/api/assest';
|
||||
|
||||
+const hostStatusMap = {
|
||||
+ '0': '在线',
|
||||
+ '1': '离线',
|
||||
+ '2': '未确认',
|
||||
+ '3': '扫描中',
|
||||
+ '4': '已完成',
|
||||
+ '5': '未知'
|
||||
+};
|
||||
+
|
||||
const defaultPagination = {
|
||||
current: 1,
|
||||
pageSize: 10,
|
||||
@@ -110,6 +118,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
+ hostStatusMap,
|
||||
rowKey: 'host_id',
|
||||
pagination: defaultPagination,
|
||||
filters: null,
|
||||
@@ -218,17 +227,6 @@ export default {
|
||||
handleUploadSuccess() {
|
||||
this.getHostList();
|
||||
},
|
||||
- statusMap(params) {
|
||||
- let status = '';
|
||||
- if (params === 1) {
|
||||
- status = '离线';
|
||||
- } else if (params === 2) {
|
||||
- status = '未连接';
|
||||
- } else {
|
||||
- status = '在线';
|
||||
- }
|
||||
- return status;
|
||||
- },
|
||||
onSelectChange(selectedRowKeys, selectedRows) {
|
||||
this.selectedRowKeys = selectedRowKeys;
|
||||
this.selectedRowsAll = getSelectedRow(selectedRowKeys, this.selectedRowsAll, this.tableData, 'host_id');
|
||||
diff --git a/src/views/assests/components/EditableCell.vue b/src/views/assests/components/EditableCell.vue
|
||||
index 102908a..282ba8c 100644
|
||||
--- a/src/views/assests/components/EditableCell.vue
|
||||
+++ b/src/views/assests/components/EditableCell.vue
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
- <div class="editable-cell">
|
||||
+ <div class="editable-cell" ref="childitem">
|
||||
<a-form-model
|
||||
ref="ruleForm"
|
||||
:model="form"
|
||||
@@ -7,7 +7,9 @@
|
||||
>
|
||||
<div v-if="editable" class="editable-cell-input-wrapper">
|
||||
<a-form-model-item :prop="formkey">
|
||||
- <a-input @change="handleChange" @pressEnter="check" v-model="form[formkey]" />
|
||||
+ <!-- 当formkey为密码时,使用密码框组件 -->
|
||||
+ <a-input-password v-if="formkey === 'password'" @change="handleChange" @pressEnter="check" v-model="form[formkey]" />
|
||||
+ <a-input v-else @change="handleChange" @pressEnter="check" v-model="form[formkey]" />
|
||||
<a-icon
|
||||
style="top: -7px;"
|
||||
type="check"
|
||||
@@ -19,7 +21,7 @@
|
||||
<div v-else class="editable-cell-text-wrapper">
|
||||
<div class="editable-content">
|
||||
<!-- <a-input :type="formkey === 'password' ? 'password' : 'text'" v-model="value" /> -->
|
||||
- <span v-if="formkey === 'password'">******</span>
|
||||
+ <span v-if="formkey === 'password'">{{ countStar(form[formkey]) }}</span>
|
||||
<span v-else>{{ value || ' ' }}</span>
|
||||
</div>
|
||||
<a-icon type="edit" class="editable-cell-icon" @click="edit" />
|
||||
@@ -58,15 +60,15 @@ export default {
|
||||
}
|
||||
};
|
||||
const checkNameInput = (rule, value, callback) => {
|
||||
- if (/[^0-9a-z_.]/.test(value)) {
|
||||
+ if (!/^\S.*\S$/.test(value)) {
|
||||
/* eslint-disable */
|
||||
- callback(new Error('只能输入数字、小写字母和英文.和_'));
|
||||
+ callback(new Error('首尾不允许空格'));
|
||||
/* eslint-enable */
|
||||
return;
|
||||
}
|
||||
- if (/[_]$/.test(value)) {
|
||||
+ if (!/^(?!\s*$).+/.test(value)) {
|
||||
/* eslint-disable */
|
||||
- callback(new Error('结尾不能是英文下划线'));
|
||||
+ callback(new Error('不允许全空格'));
|
||||
/* eslint-enable */
|
||||
return;
|
||||
}
|
||||
@@ -102,6 +104,13 @@ export default {
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
+ countStar(num) {
|
||||
+ let str = ''
|
||||
+ for (let i = 0; i < num.length; i++) {
|
||||
+ str += '*'
|
||||
+ }
|
||||
+ return str
|
||||
+ },
|
||||
handleChange(e) {
|
||||
const value = e.target.value;
|
||||
this.value = value;
|
||||
@@ -113,22 +122,39 @@ export default {
|
||||
check() {
|
||||
this.$refs.ruleForm.validate(valid => {
|
||||
if (valid) {
|
||||
- this.editable = false;
|
||||
- this.$emit('change', this.value);
|
||||
+ if (this.editable) {
|
||||
+ // 判断当前状态,只对处于修改状态的组件执行此操作,节省性能
|
||||
+ this.editable = false;
|
||||
+ this.$emit('allowSub')
|
||||
+ this.$emit('change', this.value);
|
||||
+ }
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
edit() {
|
||||
+ this.$emit('unSubmit')
|
||||
this.editable = true;
|
||||
+ },
|
||||
+ handleClickOutside(event) {
|
||||
+ // 鼠标监听事件
|
||||
+ const target = event.target
|
||||
+ const wrapper = this.$refs.childitem
|
||||
+ // 判断点击的区域是否是当前组件的区域
|
||||
+ if (!wrapper.contains(target)) {
|
||||
+ // 当点击组件之外时 执行校验操作
|
||||
+ this.check()
|
||||
+ }
|
||||
}
|
||||
},
|
||||
created() {
|
||||
},
|
||||
+ beforeDestroy() {
|
||||
+ document.removeEventListener('mouseup', this.handleClickOutside)
|
||||
+ },
|
||||
mounted() {
|
||||
- // this.edit()
|
||||
- // this.check()
|
||||
+ document.addEventListener('mouseup', this.handleClickOutside)
|
||||
},
|
||||
computed: {
|
||||
form () {
|
||||
diff --git a/src/views/assests/components/addMoreHost.vue b/src/views/assests/components/addMoreHost.vue
|
||||
index 830bf03..4cd9a65 100644
|
||||
--- a/src/views/assests/components/addMoreHost.vue
|
||||
+++ b/src/views/assests/components/addMoreHost.vue
|
||||
@@ -32,7 +32,8 @@
|
||||
ref="host_ip"
|
||||
formkey="host_ip"
|
||||
:text="String(text)"
|
||||
- @uploadstatus="uploadstatus($event)"
|
||||
+ @unSubmit="unSubmit()"
|
||||
+ @allowSub="allowSub()"
|
||||
@change="onCellChange(record.key, 'host_ip', $event)" />
|
||||
</template>
|
||||
<template slot="ssh_port" slot-scope="text, record">
|
||||
@@ -40,7 +41,8 @@
|
||||
ref="ssh_port"
|
||||
formkey="ssh_port"
|
||||
:text="String(text)"
|
||||
- @uploadstatus="uploadstatus($event)"
|
||||
+ @unSubmit="unSubmit()"
|
||||
+ @allowSub="allowSub()"
|
||||
@change="onCellChange(record.key, 'ssh_port', $event)" />
|
||||
</template>
|
||||
<template slot="ssh_user" slot-scope="text, record">
|
||||
@@ -48,7 +50,8 @@
|
||||
ref="ssh_user"
|
||||
formkey="ssh_user"
|
||||
:text="String(text)"
|
||||
- @uploadstatus="uploadstatus($event)"
|
||||
+ @unSubmit="unSubmit()"
|
||||
+ @allowSub="allowSub()"
|
||||
@change="onCellChange(record.key, 'ssh_user', $event)" />
|
||||
</template>
|
||||
<template slot="password" slot-scope="text, record">
|
||||
@@ -56,7 +59,8 @@
|
||||
ref="password"
|
||||
formkey="password"
|
||||
:text="String(text)"
|
||||
- @uploadstatus="uploadstatus($event)"
|
||||
+ @unSubmit="unSubmit()"
|
||||
+ @allowSub="allowSub()"
|
||||
@change="onCellChange(record.key, 'password', $event)" />
|
||||
</template>
|
||||
<template slot="host_name" slot-scope="text, record">
|
||||
@@ -64,7 +68,8 @@
|
||||
ref="host_name"
|
||||
formkey="host_name"
|
||||
:text="String(text)"
|
||||
- @uploadstatus="uploadstatus($event)"
|
||||
+ @unSubmit="unSubmit()"
|
||||
+ @allowSub="allowSub()"
|
||||
@change="onCellChange(record.key, 'host_name', $event)" />
|
||||
</template>
|
||||
<template slot="host_group_name" slot-scope="text, record">
|
||||
@@ -72,7 +77,8 @@
|
||||
ref="host_group_name"
|
||||
formkey="host_group_name"
|
||||
:text="String(text)"
|
||||
- @uploadstatus="uploadstatus($event)"
|
||||
+ @unSubmit="unSubmit()"
|
||||
+ @allowSub="allowSub()"
|
||||
@change="onCellChange(record.key, 'host_group_name', $event)" />
|
||||
</template>
|
||||
<template slot="management" slot-scope="text, record">
|
||||
@@ -80,7 +86,8 @@
|
||||
ref="management"
|
||||
formkey="management"
|
||||
:text="String(text)"
|
||||
- @uploadstatus="uploadstatus($event)"
|
||||
+ @unSubmit="unSubmit()"
|
||||
+ @allowSub="allowSub()"
|
||||
@change="onCellChange(record.key, 'management', $event)" />
|
||||
</template>
|
||||
<template slot="operation" slot-scope="text, record">
|
||||
@@ -108,7 +115,7 @@
|
||||
<div style="display: flex;justify-content: flex-end;">
|
||||
<a-button
|
||||
type="primary"
|
||||
- :disabled="fileDataList.length === 0 || tableData.length === 0"
|
||||
+ :disabled="fileDataList.length === 0 || tableData.length === 0 || isSubDisable"
|
||||
:loading="uploading"
|
||||
style="margin-top: 16px;width: 111px;"
|
||||
@click="goUpload">
|
||||
@@ -133,6 +140,7 @@ export default {
|
||||
props: {},
|
||||
data() {
|
||||
return {
|
||||
+ editNum: 0,
|
||||
dataAllow: true,
|
||||
count: '',
|
||||
rowKey: 'ip',
|
||||
@@ -156,6 +164,13 @@ export default {
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
+ isSubDisable() {
|
||||
+ if (this.editNum > 0) {
|
||||
+ return true
|
||||
+ } else {
|
||||
+ return false
|
||||
+ }
|
||||
+ },
|
||||
columns() {
|
||||
return [
|
||||
{
|
||||
@@ -224,7 +239,12 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
- uploadstatus(value) {},
|
||||
+ unSubmit() {
|
||||
+ this.editNum++;
|
||||
+ },
|
||||
+ allowSub() {
|
||||
+ this.editNum--;
|
||||
+ },
|
||||
onCellChange(key, dataIndex, value) {
|
||||
const dataSource = [...this.tableData];
|
||||
const target = dataSource.find((item) => item.key === key);
|
||||
@@ -413,6 +433,22 @@ export default {
|
||||
})
|
||||
_this.$message.error('全部主机添加失败!')
|
||||
} else {
|
||||
+ if (err.response.code === '1000') {
|
||||
+ const errorList = [];
|
||||
+ const errorData = {};
|
||||
+ err.response.data.forEach((item) => {
|
||||
+ errorList.push(item.host_ip);
|
||||
+ errorData[item.host_ip] = item.reason
|
||||
+ });
|
||||
+ _this.tableData.forEach((item) => {
|
||||
+ if (errorList.includes(item.host_ip)) {
|
||||
+ item.result = '添加失败'
|
||||
+ }
|
||||
+ if (Object.keys(errorData).includes(item.host_ip)) {
|
||||
+ item.reason = errorData[item.host_ip]
|
||||
+ }
|
||||
+ })
|
||||
+ }
|
||||
_this.$message.error(err.response.message || err.response.data.detail);
|
||||
}
|
||||
})
|
||||
diff --git a/src/views/leaks/components/UploadFile.vue b/src/views/leaks/components/UploadFile.vue
|
||||
index c4e072a..fc2c8a6 100644
|
||||
--- a/src/views/leaks/components/UploadFile.vue
|
||||
+++ b/src/views/leaks/components/UploadFile.vue
|
||||
@@ -17,7 +17,7 @@
|
||||
</a-upload>
|
||||
</div>
|
||||
<div style="margin-top: 14px;font-size: 15px;">
|
||||
- <a-radio-group name="radioGroup" v-model="value" :default-value="1" @change="onChange">
|
||||
+ <a-radio-group name="radioGroup" v-model="value" :default-value="2" @change="onChange">
|
||||
<a-radio :value="1">
|
||||
不受影响
|
||||
</a-radio>
|
||||
@@ -43,7 +43,7 @@ export default {
|
||||
props: {},
|
||||
data() {
|
||||
return {
|
||||
- value: 1,
|
||||
+ value: 2,
|
||||
fileDataList: [],
|
||||
visible: false,
|
||||
uploading: false
|
||||
diff --git a/src/views/user/Login.vue b/src/views/user/Login.vue
|
||||
index fae311a..a956fe0 100644
|
||||
--- a/src/views/user/Login.vue
|
||||
+++ b/src/views/user/Login.vue
|
||||
@@ -162,7 +162,7 @@ export default {
|
||||
}
|
||||
|
||||
.jump_registar {
|
||||
- margin-left: 245px;
|
||||
+ text-align: right;
|
||||
margin-top: -20px;
|
||||
.spin_top_jump {
|
||||
color:#005980;
|
||||
diff --git a/src/views/user/Register.vue b/src/views/user/Register.vue
|
||||
index 1b2c170..08205b4 100644
|
||||
--- a/src/views/user/Register.vue
|
||||
+++ b/src/views/user/Register.vue
|
||||
@@ -63,7 +63,7 @@
|
||||
<a-input
|
||||
size="large"
|
||||
type="text"
|
||||
- placeholder="输入由英文字母、数字、下划线、英文句号、以及中划线组成的邮箱地址"
|
||||
+ placeholder="输入邮箱地址,由英文字母、数字、下划线、英文句号、以及中划线组成"
|
||||
v-decorator="[
|
||||
'email',
|
||||
{
|
||||
@@ -72,7 +72,7 @@
|
||||
}
|
||||
]"
|
||||
>
|
||||
- <a-icon slot="prefix" type="user" :style="{color: 'rgba(0,0,0,.25)'}" />
|
||||
+ <a-icon slot="prefix" type="mail" :style="{color: 'rgba(0,0,0,.25)'}" />
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
|
||||
@@ -233,7 +233,7 @@ export default {
|
||||
}
|
||||
|
||||
.jump_login {
|
||||
- margin-left: 245px;
|
||||
+ text-align: right;
|
||||
margin-top: -20px;
|
||||
.spin_top_jump {
|
||||
color:#005980;
|
||||
--
|
||||
Gitee
|
||||
|
||||
@ -0,0 +1,146 @@
|
||||
From f4d44578c8ba9a0b54f37da416469eb73b68f7a6 Mon Sep 17 00:00:00 2001
|
||||
From: wkl505997900 <505997900@qq.com>
|
||||
Date: Fri, 28 Apr 2023 10:22:34 +0800
|
||||
Subject: [PATCH] add token exit interface and optimize Gitee authorization
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
---
|
||||
src/api/login.js | 7 ++---
|
||||
.../ant-design-pro/store/modules/user.js | 28 +++++++++++++------
|
||||
src/views/leaks/HostLeakDetail.vue | 5 ++++
|
||||
src/views/leaks/components/CvesTable.vue | 1 -
|
||||
src/views/user/Account.vue | 9 +++++-
|
||||
5 files changed, 35 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/src/api/login.js b/src/api/login.js
|
||||
index 4bb4a2c..57d72f0 100644
|
||||
--- a/src/api/login.js
|
||||
+++ b/src/api/login.js
|
||||
@@ -7,7 +7,7 @@ const userApi = {
|
||||
LoginInGitee: '/manage/account/authredirecturl',
|
||||
register: '/manage/account/add',
|
||||
Login: '/manage/account/login',
|
||||
- Logout: '/manage/logout',
|
||||
+ Logout: '/manage/account/logout',
|
||||
changePassword: '/manage/account/change',
|
||||
certificateKey: '/manage/account/certificate'
|
||||
};
|
||||
@@ -101,10 +101,9 @@ export function certificateKey(parameter) {
|
||||
});
|
||||
}
|
||||
|
||||
-export function logout(parameter) {
|
||||
+export function logout() {
|
||||
return request({
|
||||
url: userApi.Logout,
|
||||
- method: 'post',
|
||||
- data: parameter
|
||||
+ method: 'post'
|
||||
});
|
||||
}
|
||||
diff --git a/src/vendor/ant-design-pro/store/modules/user.js b/src/vendor/ant-design-pro/store/modules/user.js
|
||||
index 505ce1c..908d1ef 100644
|
||||
--- a/src/vendor/ant-design-pro/store/modules/user.js
|
||||
+++ b/src/vendor/ant-design-pro/store/modules/user.js
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import storage from 'store';
|
||||
import cookie from 'js-cookie';
|
||||
-import { login, refreshTokenFn } from '@/api/login';
|
||||
+import { login, logout, refreshTokenFn } from '@/api/login';
|
||||
import { ACCESS_TOKEN, REFRESH_TOKIN } from '@/vendor/ant-design-pro/store/mutation-types';
|
||||
|
||||
const user = {
|
||||
@@ -122,14 +122,24 @@ const user = {
|
||||
|
||||
// 登出
|
||||
Logout({ commit, state }) {
|
||||
- commit('SET_TOKEN', '');
|
||||
- commit('SET_ROLES', []);
|
||||
- commit('SET_RETOKEN', []);
|
||||
- storage.remove(ACCESS_TOKEN);
|
||||
- storage.remove(REFRESH_TOKIN);
|
||||
- cookie.remove('aops_token');
|
||||
- cookie.remove('user_name');
|
||||
- cookie.remove('refreshtoken');
|
||||
+ return new Promise(resolve => {
|
||||
+ logout()
|
||||
+ .then(() => {
|
||||
+ commit('SET_TOKEN', '');
|
||||
+ commit('SET_ROLES', []);
|
||||
+ commit('SET_RETOKEN', '');
|
||||
+ storage.remove(ACCESS_TOKEN);
|
||||
+ storage.remove(REFRESH_TOKIN);
|
||||
+ cookie.remove('aops_token');
|
||||
+ cookie.remove('user_name');
|
||||
+ cookie.remove('refreshtoken');
|
||||
+ resolve();
|
||||
+ })
|
||||
+ .catch(() => {
|
||||
+ resolve();
|
||||
+ })
|
||||
+ .finally(() => { });
|
||||
+ });
|
||||
},
|
||||
|
||||
// 刷新token
|
||||
diff --git a/src/views/leaks/HostLeakDetail.vue b/src/views/leaks/HostLeakDetail.vue
|
||||
index 334f559..b0accc2 100644
|
||||
--- a/src/views/leaks/HostLeakDetail.vue
|
||||
+++ b/src/views/leaks/HostLeakDetail.vue
|
||||
@@ -45,6 +45,7 @@
|
||||
<a-card :bordered="false" class="aops-theme">
|
||||
<h1>CVEs</h1>
|
||||
<cves-table
|
||||
+ ref="cve_table"
|
||||
:inputList="cveList"
|
||||
:inputLoading="cveIsLoading"
|
||||
:hostList="[detail]"
|
||||
@@ -202,6 +203,10 @@ export default {
|
||||
.then(function (res) {
|
||||
_this.$message.success(res.message);
|
||||
_this.scanStatus = 3;
|
||||
+ _this.$refs.cve_table.getCves();
|
||||
+ setTimeout(() => {
|
||||
+ _this.$refs.cve_table.getCvesAll();
|
||||
+ }, 500);
|
||||
_this.getScanStatue();
|
||||
})
|
||||
.catch(function (err) {
|
||||
diff --git a/src/views/leaks/components/CvesTable.vue b/src/views/leaks/components/CvesTable.vue
|
||||
index 1431cb6..35823d3 100644
|
||||
--- a/src/views/leaks/components/CvesTable.vue
|
||||
+++ b/src/views/leaks/components/CvesTable.vue
|
||||
@@ -514,7 +514,6 @@ export default {
|
||||
mounted() {
|
||||
setTimeout(() => {
|
||||
this.getCvesAll();
|
||||
- console.log(11111)
|
||||
}, 500);
|
||||
this.getCves();
|
||||
}
|
||||
diff --git a/src/views/user/Account.vue b/src/views/user/Account.vue
|
||||
index a1a2ea7..039bfbf 100644
|
||||
--- a/src/views/user/Account.vue
|
||||
+++ b/src/views/user/Account.vue
|
||||
@@ -82,7 +82,14 @@ export default {
|
||||
},
|
||||
created() {
|
||||
this.code = (window.location.search).split('=')[1];
|
||||
- this.getConnection(this.code)
|
||||
+ if (this.code === 'access_denied&error_description') {
|
||||
+ // 拒绝授权,跳转登陆页
|
||||
+ this.$message.info('拒绝授权!')
|
||||
+ this.$router.push('/user/login')
|
||||
+ } else {
|
||||
+ // 同意授权,跳转首页
|
||||
+ this.getConnection(this.code)
|
||||
+ }
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['LoginInGitee']),
|
||||
--
|
||||
Gitee
|
||||
|
||||
@ -2,12 +2,15 @@
|
||||
|
||||
Name: aops-hermes
|
||||
Version: v1.2.0
|
||||
Release: 1
|
||||
Release: 2
|
||||
Summary: Web for an intelligent diagnose frame
|
||||
License: MulanPSL2
|
||||
URL: https://gitee.com/openeuler/%{name}
|
||||
Source0: %{name}-%{version}.tar.gz
|
||||
Source1: node-modules.tar.gz
|
||||
Patch0001: 0001-optimize-page-loading-and-routing.patch
|
||||
Patch0002: 0002-fix-verify-the-host-name-field-issue.patch
|
||||
Patch0003: 0003-add-token-exit-interface-and-optimize-Gitee-authorization.patch
|
||||
|
||||
|
||||
BuildRequires: nodejs node-gyp nodejs-yarn
|
||||
@ -19,7 +22,7 @@ Web for an intelligent diagnose frame
|
||||
|
||||
|
||||
%prep
|
||||
%autosetup -n %{name}-%{version}
|
||||
%autosetup -n %{name}-%{version} -p1
|
||||
%setup -T -D -a 1
|
||||
|
||||
|
||||
@ -43,6 +46,18 @@ cp -r deploy/aops-hermes.service %{buildroot}/usr/lib/systemd/system/
|
||||
|
||||
|
||||
%changelog
|
||||
* Fri Apr 28 2023 wangkunlong<505997900@qq.com> - v1.2.0-2
|
||||
- Optimize page loading speed
|
||||
- Optimize routing
|
||||
- Optimize login and exit interface
|
||||
- Solve the inconsistency in verifying the host name field between the front and back ends when adding hosts in a single and batch manner
|
||||
- Optimize login interface UI display
|
||||
- Resolve the display of registration interface icons and text
|
||||
- Solve legacy issues with batch adding hosts and editing host interfaces
|
||||
- Optimize CVE list refresh logic
|
||||
- Add exit interface
|
||||
- Optimize Gitee authorization login jump logic
|
||||
|
||||
* Mon Apr 17 2023 wangkunlong<505997900@qq.com> - v1.2.0-1
|
||||
- add host interfaces, optimize the display effect of some interfaces
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user