review code.

This commit is contained in:
lijiahangmax
2023-11-30 22:21:25 +08:00
parent 973825d92a
commit 875c873622
29 changed files with 389 additions and 123 deletions

View File

@@ -1 +1,2 @@
VITE_API_BASE_URL= 'http://127.0.0.1:9200/orion-api'
VITE_APP_VERSION= '1.0.0'

View File

@@ -1 +1,2 @@
VITE_API_BASE_URL= 'http://127.0.0.1:9200/orion-api'
VITE_APP_VERSION= '1.0.0'

View File

@@ -0,0 +1,34 @@
import type { HostGroupQueryResponse } from '@/api/asset/host-group';
import type { HostQueryResponse } from './host';
import type { HostKeyQueryResponse } from './host-key';
import type { HostIdentityQueryResponse } from './host-identity';
import axios from 'axios';
/**
* 已授权的主机分组 查询响应
*/
export interface AuthorizedHostGroupQueryResponse {
groupTree: Array<HostGroupQueryResponse>;
hostList: Array<HostQueryResponse>;
}
/**
* 查询当前用户已授权的主机分组
*/
export function getCurrentAuthorizedHostGroup() {
return axios.get<AuthorizedHostGroupQueryResponse>('/asset/authorized-data/current-host-group');
}
/**
* 查询当前用户已授权的主机秘钥
*/
export function getCurrentAuthorizedHostKey() {
return axios.get<HostKeyQueryResponse>('/asset/authorized-data/current-host-key');
}
/**
* 查询当前用户已授权的主机身份
*/
export function getCurrentAuthorizedHostIdentity() {
return axios.get<HostIdentityQueryResponse>('/asset/authorized-data/current-host-identity');
}

View File

@@ -0,0 +1,60 @@
import axios from 'axios';
/**
* 数据授权 请求对象
*/
export interface AssetDataGrantRequest {
userId?: number;
roleId?: number;
idList?: Array<number>;
}
/**
* 授权数据 查询请求对象
*/
export interface AssetAuthorizedDataQueryRequest {
userId?: number;
roleId?: number;
}
/**
* 主机分组授权
*/
export function grantHostGroup(request: AssetDataGrantRequest) {
return axios.put('/asset/host-group/grant-host-group', request);
}
/**
* 获取已授权的主机分组
*/
export function getAuthorizedHostGroup(params: AssetAuthorizedDataQueryRequest) {
return axios.get<Array<number>>('/asset/data-grant/get-host-group', { params });
}
/**
* 主机秘钥授权
*/
export function grantHostKey(request: AssetDataGrantRequest) {
return axios.put('/asset/host-group/grant-host-key', request);
}
/**
* 获取已授权的主机秘钥
*/
export function getAuthorizedHostKey(params: AssetAuthorizedDataQueryRequest) {
return axios.get<Array<number>>('/asset/data-grant/get-host-key', { params });
}
/**
* 主机身份授权
*/
export function grantHostIdentity(request: AssetDataGrantRequest) {
return axios.put('/asset/host-group/grant-host-identity', request);
}
/**
* 获取已授权的主机身份
*/
export function getAuthorizedHostIdentity(params: AssetAuthorizedDataQueryRequest) {
return axios.get<Array<number>>('/asset/data-grant/get-host-identity', { params });
}

View File

@@ -1,9 +0,0 @@
import type { HostGroupQueryResponse } from '@/api/asset/host-group';
import axios from 'axios';
/**
* 查询已授权的主机分组
*/
export function getAuthorizedHostGroup() {
return axios.get<Array<HostGroupQueryResponse>>('/asset/authorized-data/host-group');
}

View File

@@ -1,3 +1,4 @@
import type { HostQueryResponse } from './host';
import axios from 'axios';
/**
@@ -33,7 +34,7 @@ export interface HostGroupQueryResponse {
parentId: number;
title: string;
children: Array<HostGroupQueryResponse>;
hosts: Array<number>;
hostList: Array<HostQueryResponse>;
}
/**
@@ -44,21 +45,6 @@ export interface HostGroupRelUpdateRequest {
hostIdList?: Array<string>;
}
/**
* 主机分组授权 查询请求对象
*/
export interface HostGroupGrantQueryRequest {
userId?: number;
roleId?: number;
}
/**
* 主机分组 授权请求对象
*/
export interface HostGroupGrantRequest extends HostGroupGrantQueryRequest {
groupIdList?: Array<number>;
}
/**
* 创建主机分组
*/
@@ -107,17 +93,3 @@ export function getHostGroupRelList(groupId: number) {
export function updateHostGroupRel(request: HostGroupRelUpdateRequest) {
return axios.put('/asset/host-group/update-rel', request);
}
/**
* 获取已授权的分组
*/
export function getAuthorizedHostGroup(params: HostGroupGrantQueryRequest) {
return axios.get<Array<number>>('/asset/host-group/get-authorized-group', { params });
}
/**
* 主机分组授权
*/
export function grantHostGroup(request: HostGroupGrantRequest) {
return axios.put('/asset/host-group/grant', request);
}

View File

@@ -7,6 +7,7 @@
<a target="_blank" href="https://github.com/lijiahangmax/orion-ops-pro">教程</a>
<a target="_blank" href="https://github.com/lijiahangmax/orion-ops-pro">github</a>
<a target="_blank" href="https://gitee.com/lijiahangmax/orion-ops-pro">gitee</a>
<span title="当前版本">v{{ version }}</span>
</a-space>
<span class="copyright">
Copyright<icon-copyright /> 2023 By OrionOpsPro
@@ -16,6 +17,7 @@
</template>
<script lang="ts" setup>
const version = import.meta.env.VITE_APP_VERSION;
</script>
<style lang="less" scoped>
@@ -26,7 +28,7 @@
text-align: center;
height: 64px;
a {
a, span {
text-decoration: none;
color: rgb(var(--primary-6));
}

View File

@@ -377,7 +377,6 @@
margin: -16px -16px 0 -16px;
padding: 16px 16px 12px 16px;
position: fixed;
background: var(--color-fill-2);
z-index: 999;
height: @top-height;
transition: none;

View File

@@ -71,7 +71,7 @@
display: flex;
flex-direction: column;
user-select: none;
background: var(--color-bg-1);
background: var(--color-bg-2);
}
.tab-item {

View File

@@ -9,6 +9,7 @@ declare module '*.vue' {
interface ImportMetaEnv {
readonly VITE_API_BASE_URL: string;
readonly VITE_APP_VERSION: string;
}
// editor

View File

@@ -238,13 +238,13 @@ export function cleanXss(s: string) {
*/
export function replaceHtmlTag(message: string) {
return cleanXss(message)
.replaceAll('&lt;sb 0&gt;', '<span class="span-blue mx0">')
.replaceAll('&lt;sb&gt;', '<span class="span-blue mx0">')
.replaceAll('&lt;sb 2&gt;', '<span class="span-blue mx2">')
.replaceAll('&lt;sb&gt;', '<span class="span-blue mx4">')
.replaceAll('&lt;sb 4&gt;', '<span class="span-blue mx4">')
.replaceAll('&lt;/sb&gt;', '</span>')
.replaceAll('&lt;sr 0&gt;', '<span class="span-red mx0">')
.replaceAll('&lt;sr&gt;', '<span class="span-red mx0">')
.replaceAll('&lt;sr 2&gt;', '<span class="span-red mx2">')
.replaceAll('&lt;sr&gt;', '<span class="span-red mx4">')
.replaceAll('&lt;sr 4&gt;', '<span class="span-red mx4">')
.replaceAll('&lt;/sr&gt;', '</span>')
.replaceAll('&lt;b&gt;', '<b>')
.replaceAll('&lt;/b&gt;', '</b>');

View File

@@ -126,7 +126,7 @@
width: 100%;
height: 100%;
position: relative;
background: var(--color-bg-1);
background: var(--color-bg-2);
}
:deep(.arco-tabs-tab-title){

View File

@@ -102,7 +102,7 @@
<style lang="less" scoped>
.tabs-container {
background: var(--color-bg-1);
background: var(--color-bg-2);
margin: 16px 16px 0 16px;
padding: 16px;
display: flex;