Browse Source

Merge pull request 'fix: 流水线anchor-point错误' (#39) from dev-zw into dev

pull/40/head
cp3hnu 1 year ago
parent
commit
6d00eaa4b9
8 changed files with 47 additions and 24 deletions
  1. +0
    -1
      react-ui/config/config.ts
  2. +2
    -0
      react-ui/src/app.tsx
  3. +7
    -1
      react-ui/src/overrides.less
  4. +4
    -4
      react-ui/src/pages/Pipeline/editPipeline/index.jsx
  5. +20
    -16
      react-ui/src/requestConfig.ts
  6. +7
    -1
      react-ui/src/styles/theme.less
  7. +6
    -0
      react-ui/src/types.ts
  8. +1
    -1
      react-ui/src/utils/ui.tsx

+ 0
- 1
react-ui/config/config.ts View File

@@ -163,5 +163,4 @@ export default defineConfig({
},
javascriptEnabled: true,
},
// plugins: ['umi-plugin-keep-alive'],
});

+ 2
- 0
react-ui/src/app.tsx View File

@@ -29,6 +29,8 @@ export async function getInitialState(): Promise<{
loading?: boolean;
fetchUserInfo?: () => Promise<API.CurrentUser | undefined>;
}> {
console.log('getInitialState');

const fetchUserInfo = async () => {
try {
const response = await getUserInfo({


+ 7
- 1
react-ui/src/overrides.less View File

@@ -1,3 +1,9 @@
/*
* @Author: 赵伟
* @Date: 2024-04-28 08:47:43
* @Description: 覆盖 antd 样式
*/

// 设置 Table 可以滑动
.vertical-scroll-table {
.ant-table-wrapper {
@@ -9,7 +15,7 @@
height: 100%;

.ant-table {
height: calc(100% - 74px);
height: calc(100% - 74px); // 分页控件的高度

.ant-table-container {
height: 100%;


+ 4
- 4
react-ui/src/pages/Pipeline/editPipeline/index.jsx View File

@@ -380,10 +380,10 @@ const EditPipeline = () => {
return (
cfg.anchorPoints || [
// 四个
// [0.5, 0],
// [0.5, 1],
[0, 0.5],
[1, 0.5],
[0.5, 0],
[0.5, 1],
// [0, 0.5],
// [1, 0.5],
]
);
},


+ 20
- 16
react-ui/src/requestConfig.ts View File

@@ -1,11 +1,11 @@
/*
* @Author: 赵伟
* @Date: 2024-03-25 13:52:54
* @Description:
* @Description: 网络请求配置,详情请参考 https://umijs.org/docs/max/request
*/
import type { RequestConfig } from '@umijs/max';
import { message } from 'antd';
import { clearSessionToken, getAccessToken, getRefreshToken, getTokenExpireTime } from './access';
import { clearSessionToken, getAccessToken } from './access';
import { setRemoteMenu } from './services/session';
import { gotoLoginPage } from './utils/ui';

@@ -21,21 +21,25 @@ export const requestConfig: RequestConfig = {
const authHeader = headers['Authorization'];
const isToken = headers['isToken'];
if (!authHeader && isToken !== false) {
const expireTime = getTokenExpireTime();
if (expireTime) {
const left = Number(expireTime) - new Date().getTime();
const refreshToken = getRefreshToken();
if (left < 0 && refreshToken) {
clearSessionToken();
} else {
const accessToken = getAccessToken();
if (accessToken) {
headers['Authorization'] = `Bearer ${accessToken}`;
}
}
} else {
clearSessionToken();
const accessToken = getAccessToken();
if (accessToken) {
headers['Authorization'] = `Bearer ${accessToken}`;
}
// const expireTime = getTokenExpireTime();
// if (expireTime) {
// const left = Number(expireTime) - new Date().getTime();
// const refreshToken = getRefreshToken();
// if (left < 0 && refreshToken) {
// clearSessionToken();
// } else {
// const accessToken = getAccessToken();
// if (accessToken) {
// headers['Authorization'] = `Bearer ${accessToken}`;
// }
// }
// } else {
// clearSessionToken();
// }
}
return { url, options };
},


+ 7
- 1
react-ui/src/styles/theme.less View File

@@ -1,4 +1,10 @@
// 全局颜色变量
/*
* @Author: 赵伟
* @Date: 2024-04-28 08:47:43
* @Description: 全局变量,可以直接在 less 文件里使用,无需引入;也可以导入到 js 里使用;为 antd 主题修改提供常量值
*/

// 颜色
@primary-color: #1664ff; // 主色调
@primary-color-hover: #69b1ff;
@background-color: #f9fafb; // 页面背景颜色


+ 6
- 0
react-ui/src/types.ts View File

@@ -1,3 +1,9 @@
/*
* @Author: 赵伟
* @Date: 2024-04-08 09:54:39
* @Description: 定义全局类型,比如无关联的页面都需要要的类型
*/

// 流水线全局参数
export type PipelineGlobalParam = {
param_name: string;


+ 1
- 1
react-ui/src/utils/ui.tsx View File

@@ -48,7 +48,7 @@ export const getFileListFromEvent = (e: any) => {

// 去登录页面
export const gotoLoginPage = (toHome: boolean = true) => {
const { search, pathname } = window.location;
const { pathname, search } = window.location;
const urlParams = new URLSearchParams();
urlParams.append('redirect', pathname + search);
const newSearch = toHome ? '' : urlParams.toString();


Loading…
Cancel
Save