Unverified Commit 759e1afc authored by Licho's avatar Licho Committed by GitHub

feat: add react-dev-inspector (#2289)

* feat: add @react-dev-inspector Signed-off-by: 's avatarLicho <lecho.sun@gmail.com> * Spotless Apply * trigger * trigger * trigger --------- Signed-off-by: 's avatarLicho <lecho.sun@gmail.com> Co-authored-by: 's avatarleechor <leechor@users.noreply.github.com>
parent 8546bb14
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
// https://umijs.org/config/
import { defineConfig } from 'umi';
export default defineConfig({
plugins: [
// https://github.com/zthxxx/react-dev-inspector
'@react-dev-inspector/umi4-plugin'
],
// https://github.com/zthxxx/react-dev-inspector#inspector-loader-props
inspectorConfig: {
exclude: [],
babelPlugins: [],
babelOptions: {}
}
/*webpack5: {
// lazyCompilation: {},
},*/
});
......@@ -58,7 +58,6 @@
"re-resizable": "6.9.9",
"react": "^18.2.0",
"react-countup": "^6.4.2",
"react-dev-inspector": "^1.8.1",
"react-dom": "^18.0.0",
"react-helmet-async": "^1.3.0",
"react-spring": "^9.7.1",
......@@ -88,6 +87,8 @@
"lint-staged": "^13",
"mockjs": "^1.1.0",
"prettier": "^2",
"react-dev-inspector": "^2.0.0",
"react-inspector": "^6.0.2",
"swagger-ui-dist": "^4.16.1",
"ts-node": "^10.9.1",
"typescript": "^4",
......
......@@ -58,23 +58,21 @@ export function patchRoutes({ routes }: any) {
}
const queryUserInfo = async () => {
return getDataByParamsReturnResult(API_CONSTANTS.CURRENT_USER).then(
(result) => {
const { user, roleList, tenantList, currentTenant, menuList, saTokenInfo } = result.datas;
const currentUser: API.CurrentUser = {
user: {
...user,
avatar: user.avatar ?? '/icons/user_avatar.png'
},
roleList: roleList,
tenantList: tenantList,
currentTenant: currentTenant,
menuList: menuList,
tokenInfo: saTokenInfo
};
return currentUser;
}
);
return getDataByParamsReturnResult(API_CONSTANTS.CURRENT_USER).then((result) => {
const { user, roleList, tenantList, currentTenant, menuList, saTokenInfo } = result.datas;
const currentUser: API.CurrentUser = {
user: {
...user,
avatar: user.avatar ?? '/icons/user_avatar.png'
},
roleList: roleList,
tenantList: tenantList,
currentTenant: currentTenant,
menuList: menuList,
tokenInfo: saTokenInfo
};
return currentUser;
});
};
/**
......@@ -86,7 +84,6 @@ export async function getInitialState(): Promise<{
loading?: boolean;
fetchUserInfo?: () => Promise<API.CurrentUser | undefined>;
}> {
const fetchUserInfo = async () => {
try {
return await queryUserInfo();
......@@ -220,11 +217,11 @@ export function patchClientRoutes({ routes }: { routes: SysMenu[] }) {
* 路由切换并只加载首次
*/
export function onRouteChange({
location,
clientRoutes,
routes,
action
}: {
location,
clientRoutes,
routes,
action
}: {
location: any;
clientRoutes: any;
routes: any;
......
......@@ -21,10 +21,9 @@ import { THEME } from '@/types/Public/data';
import { useLocalStorage } from '@/utils/hook/useLocalStorage';
import { l } from '@/utils/intl';
import { FullscreenExitOutlined, FullscreenOutlined, GlobalOutlined } from '@ant-design/icons';
import { useEmotionCss } from '@ant-design/use-emotion-css';
import { SelectLang, useModel } from '@umijs/max';
import { Space, Switch, Tooltip } from 'antd';
import React, { useCallback, useEffect, useState } from 'react';
import React, { useEffect, useState } from 'react';
import useCookie from 'react-use-cookie';
import screenfull from 'screenfull';
import Avatar from './AvatarDropdown';
......
......@@ -24,8 +24,8 @@ body,
overflow-x: auto;
overflow-y: auto;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
'Noto Color Emoji';
'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
'Noto Color Emoji';
}
// .login-form style --- start ----
......@@ -57,10 +57,10 @@ body,
}
.desc {
font-weight: 600;
font-size: 24px;
margin-top: 2rem;
margin-bottom: 1rem;
font-weight: 600;
font-size: 24px;
//color: @text-color-secondary;
//font-size: @font-size-base;
}
......@@ -83,8 +83,8 @@ body,
height: 100 * 100vw / 320;
margin-bottom: -15vh;
margin-left: 60vw;
box-shadow: 0 0 10px 5px rgba(0, 0, 0, 0.4);
border-radius: 10px;
box-shadow: 0 0 10px 5px rgba(0, 0, 0, 0.4);
}
.loginform {
......@@ -246,13 +246,11 @@ ol {
.ant-tree-node-content-wrapper {
display: flex;
}
}
}
.ant-tree-node-content-wrapper {
display: flex;
}
.gitCodeTree {
min-height: 70vh;
......@@ -418,4 +416,3 @@ h5 {
display: flex !important;
align-items: baseline !important;
}
......@@ -66,7 +66,7 @@ export const AccessContextProvider = ({
export const useAccess = () => useContext(AccessContext);
export function AuthorizedObject({ path, denied = null, children = null,access = {} }: any) {
export function AuthorizedObject({ path, denied = null, children = null, access = {} }: any) {
const { isAdmin, blocks = [] } = access;
if (isAdmin) return children;
......
......@@ -41,26 +41,28 @@ export const buildProjectTree = (
searchValue: string = '',
path?: string[]
): any =>
data?data.map((item: Catalogue) => {
const currentPath = path ? [...path, item.name] : [item.name];
return {
// isLeaf: (item.type && item.children.length === 0) ,
isLeaf: item.isLeaf,
name: item.name,
parentId: item.parentId,
label: searchTreeNode(item.name, searchValue),
icon: item.type && item.children.length === 0 && getTabIcon(item.type, 20),
value: item.id,
path: currentPath,
type: item.type,
title: <>{searchTreeNode(item.name, searchValue)}</>,
fullInfo: item,
key: item.id,
id: item.id,
taskId: item.taskId,
children: buildProjectTree(item.children, searchValue, currentPath)
};
}):[];
data
? data.map((item: Catalogue) => {
const currentPath = path ? [...path, item.name] : [item.name];
return {
// isLeaf: (item.type && item.children.length === 0) ,
isLeaf: item.isLeaf,
name: item.name,
parentId: item.parentId,
label: searchTreeNode(item.name, searchValue),
icon: item.type && item.children.length === 0 && getTabIcon(item.type, 20),
value: item.id,
path: currentPath,
type: item.type,
title: <>{searchTreeNode(item.name, searchValue)}</>,
fullInfo: item,
key: item.id,
id: item.id,
taskId: item.taskId,
children: buildProjectTree(item.children, searchValue, currentPath)
};
})
: [];
export const isUDF = (jobType: string) => {
return jobType === 'Scala' || jobType === 'Python' || jobType === 'Java';
......
......@@ -45,11 +45,11 @@ import {
} from '@/pages/DataStudio/RightContainer/JobConfig/service';
import { LeftBottomMoreTabs, LeftBottomSide, LeftSide, RightSide } from '@/pages/DataStudio/route';
import { l } from '@/utils/intl';
import { PageContainer } from '@ant-design/pro-layout';
import { Layout, Menu, Modal, theme, Typography } from 'antd';
import { useEffect, useState } from 'react';
import { PersistGate } from 'redux-persist/integration/react';
import { connect, getDvaApp } from 'umi';
import { PageContainer } from '@ant-design/pro-layout';
const { Text } = Typography;
......
......@@ -56,7 +56,12 @@ const DevOverView: React.FC = () => {
bodyStyle={noPadding}
>
<ProCard split='vertical' bodyStyle={noPadding}>
<ProCard title={l('home.job.development')} split='horizontal' colSpan={'40%'} bodyStyle={noPadding}>
<ProCard
title={l('home.job.development')}
split='horizontal'
colSpan={'40%'}
bodyStyle={noPadding}
>
<ProCard>
<BatchStreamProportion />
</ProCard>
......
......@@ -23,11 +23,11 @@ import JobRecoveryView from '@/pages/Home/JobOverView/JobRecoveryView';
import JobRunView from '@/pages/Home/JobOverView/JobRunView';
import JobStatusPie from '@/pages/Home/JobOverView/JobStatusPie';
import LoadScoreGauge from '@/pages/Home/JobOverView/LoadScoreGauge';
import {l} from '@/utils/intl';
import {ProCard} from '@ant-design/pro-components';
import {Badge} from 'antd';
import { l } from '@/utils/intl';
import { ProCard } from '@ant-design/pro-components';
import { Badge } from 'antd';
import RcResizeObserver from 'rc-resize-observer';
import React, {useState} from 'react';
import React, { useState } from 'react';
const noPadding = {
paddingInline: '0',
......@@ -47,7 +47,7 @@ const JobOverView: React.FC = () => {
<ProCard
title={
<>
<Badge status='processing'/>
<Badge status='processing' />
{l('home.job.metrics')}
</>
}
......@@ -59,26 +59,26 @@ const JobOverView: React.FC = () => {
>
<ProCard split={split} bodyStyle={noPadding}>
<ProCard split='horizontal'>
<ProCard bodyStyle={{padding: '0 12px'}}>
<JobRunView/>
<ProCard bodyStyle={{ padding: '0 12px' }}>
<JobRunView />
</ProCard>
<ProCard bodyStyle={{padding: '0 12px'}}>
<JobFinishedView/>
<ProCard bodyStyle={{ padding: '0 12px' }}>
<JobFinishedView />
</ProCard>
<ProCard bodyStyle={{padding: '0 12px'}}>
<JobRecoveryView/>
<ProCard bodyStyle={{ padding: '0 12px' }}>
<JobRecoveryView />
</ProCard>
</ProCard>
<ProCard title={l('home.job.running.status')} bodyStyle={noPadding}>
<JobStatusPie/>
<JobStatusPie />
</ProCard>
</ProCard>
<ProCard split={split} bodyStyle={noPadding}>
<ProCard title={l('home.server.load')} bodyStyle={noPadding}>
<LoadScoreGauge/>
<LoadScoreGauge />
</ProCard>
<ProCard split='horizontal' bodyStyle={noPadding}>
<JobErrorView/>
<JobErrorView />
</ProCard>
</ProCard>
</ProCard>
......
......@@ -15,7 +15,6 @@
* limitations under the License.
*/
import Scale from '@/components/Animation/Scale';
import { l } from '@/utils/intl';
import Settings from '../../../../../../config/defaultSettings';
import style from '../../../../../global.less';
......
......@@ -24,7 +24,7 @@ export const gotoRedirectUrl = () => {
if (!history) return;
setTimeout(() => {
const urlParams = new URL(window.location.href).searchParams;
window.location.href = urlParams.get('redirect') || '/' ;
window.location.href = urlParams.get('redirect') || '/';
}, 10);
};
......
......@@ -15,9 +15,9 @@
* limitations under the License.
*/
import SlowlyAppear from '@/components/Animation/SlowlyAppear';
import SettingOverView from '@/pages/SettingCenter/GlobalSetting/SettingOverView';
import { PageContainer } from '@ant-design/pro-components';
import SlowlyAppear from "@/components/Animation/SlowlyAppear";
export default () => {
return (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment