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 @@ ...@@ -58,7 +58,6 @@
"re-resizable": "6.9.9", "re-resizable": "6.9.9",
"react": "^18.2.0", "react": "^18.2.0",
"react-countup": "^6.4.2", "react-countup": "^6.4.2",
"react-dev-inspector": "^1.8.1",
"react-dom": "^18.0.0", "react-dom": "^18.0.0",
"react-helmet-async": "^1.3.0", "react-helmet-async": "^1.3.0",
"react-spring": "^9.7.1", "react-spring": "^9.7.1",
...@@ -88,6 +87,8 @@ ...@@ -88,6 +87,8 @@
"lint-staged": "^13", "lint-staged": "^13",
"mockjs": "^1.1.0", "mockjs": "^1.1.0",
"prettier": "^2", "prettier": "^2",
"react-dev-inspector": "^2.0.0",
"react-inspector": "^6.0.2",
"swagger-ui-dist": "^4.16.1", "swagger-ui-dist": "^4.16.1",
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"typescript": "^4", "typescript": "^4",
......
...@@ -58,23 +58,21 @@ export function patchRoutes({ routes }: any) { ...@@ -58,23 +58,21 @@ export function patchRoutes({ routes }: any) {
} }
const queryUserInfo = async () => { const queryUserInfo = async () => {
return getDataByParamsReturnResult(API_CONSTANTS.CURRENT_USER).then( return getDataByParamsReturnResult(API_CONSTANTS.CURRENT_USER).then((result) => {
(result) => { const { user, roleList, tenantList, currentTenant, menuList, saTokenInfo } = result.datas;
const { user, roleList, tenantList, currentTenant, menuList, saTokenInfo } = result.datas; const currentUser: API.CurrentUser = {
const currentUser: API.CurrentUser = { user: {
user: { ...user,
...user, avatar: user.avatar ?? '/icons/user_avatar.png'
avatar: user.avatar ?? '/icons/user_avatar.png' },
}, roleList: roleList,
roleList: roleList, tenantList: tenantList,
tenantList: tenantList, currentTenant: currentTenant,
currentTenant: currentTenant, menuList: menuList,
menuList: menuList, tokenInfo: saTokenInfo
tokenInfo: saTokenInfo };
}; return currentUser;
return currentUser; });
}
);
}; };
/** /**
...@@ -86,7 +84,6 @@ export async function getInitialState(): Promise<{ ...@@ -86,7 +84,6 @@ export async function getInitialState(): Promise<{
loading?: boolean; loading?: boolean;
fetchUserInfo?: () => Promise<API.CurrentUser | undefined>; fetchUserInfo?: () => Promise<API.CurrentUser | undefined>;
}> { }> {
const fetchUserInfo = async () => { const fetchUserInfo = async () => {
try { try {
return await queryUserInfo(); return await queryUserInfo();
...@@ -220,11 +217,11 @@ export function patchClientRoutes({ routes }: { routes: SysMenu[] }) { ...@@ -220,11 +217,11 @@ export function patchClientRoutes({ routes }: { routes: SysMenu[] }) {
* 路由切换并只加载首次 * 路由切换并只加载首次
*/ */
export function onRouteChange({ export function onRouteChange({
location, location,
clientRoutes, clientRoutes,
routes, routes,
action action
}: { }: {
location: any; location: any;
clientRoutes: any; clientRoutes: any;
routes: any; routes: any;
......
...@@ -21,10 +21,9 @@ import { THEME } from '@/types/Public/data'; ...@@ -21,10 +21,9 @@ import { THEME } from '@/types/Public/data';
import { useLocalStorage } from '@/utils/hook/useLocalStorage'; import { useLocalStorage } from '@/utils/hook/useLocalStorage';
import { l } from '@/utils/intl'; import { l } from '@/utils/intl';
import { FullscreenExitOutlined, FullscreenOutlined, GlobalOutlined } from '@ant-design/icons'; import { FullscreenExitOutlined, FullscreenOutlined, GlobalOutlined } from '@ant-design/icons';
import { useEmotionCss } from '@ant-design/use-emotion-css';
import { SelectLang, useModel } from '@umijs/max'; import { SelectLang, useModel } from '@umijs/max';
import { Space, Switch, Tooltip } from 'antd'; 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 useCookie from 'react-use-cookie';
import screenfull from 'screenfull'; import screenfull from 'screenfull';
import Avatar from './AvatarDropdown'; import Avatar from './AvatarDropdown';
......
...@@ -24,8 +24,8 @@ body, ...@@ -24,8 +24,8 @@ body,
overflow-x: auto; overflow-x: auto;
overflow-y: auto; overflow-y: auto;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 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 Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
'Noto Color Emoji'; 'Noto Color Emoji';
} }
// .login-form style --- start ---- // .login-form style --- start ----
...@@ -57,10 +57,10 @@ body, ...@@ -57,10 +57,10 @@ body,
} }
.desc { .desc {
font-weight: 600;
font-size: 24px;
margin-top: 2rem; margin-top: 2rem;
margin-bottom: 1rem; margin-bottom: 1rem;
font-weight: 600;
font-size: 24px;
//color: @text-color-secondary; //color: @text-color-secondary;
//font-size: @font-size-base; //font-size: @font-size-base;
} }
...@@ -83,8 +83,8 @@ body, ...@@ -83,8 +83,8 @@ body,
height: 100 * 100vw / 320; height: 100 * 100vw / 320;
margin-bottom: -15vh; margin-bottom: -15vh;
margin-left: 60vw; margin-left: 60vw;
box-shadow: 0 0 10px 5px rgba(0, 0, 0, 0.4);
border-radius: 10px; border-radius: 10px;
box-shadow: 0 0 10px 5px rgba(0, 0, 0, 0.4);
} }
.loginform { .loginform {
...@@ -246,13 +246,11 @@ ol { ...@@ -246,13 +246,11 @@ ol {
.ant-tree-node-content-wrapper { .ant-tree-node-content-wrapper {
display: flex; display: flex;
} }
} }
} }
.ant-tree-node-content-wrapper { .ant-tree-node-content-wrapper {
display: flex; display: flex;
} }
.gitCodeTree { .gitCodeTree {
min-height: 70vh; min-height: 70vh;
...@@ -418,4 +416,3 @@ h5 { ...@@ -418,4 +416,3 @@ h5 {
display: flex !important; display: flex !important;
align-items: baseline !important; align-items: baseline !important;
} }
...@@ -66,7 +66,7 @@ export const AccessContextProvider = ({ ...@@ -66,7 +66,7 @@ export const AccessContextProvider = ({
export const useAccess = () => useContext(AccessContext); 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; const { isAdmin, blocks = [] } = access;
if (isAdmin) return children; if (isAdmin) return children;
......
...@@ -41,26 +41,28 @@ export const buildProjectTree = ( ...@@ -41,26 +41,28 @@ export const buildProjectTree = (
searchValue: string = '', searchValue: string = '',
path?: string[] path?: string[]
): any => ): any =>
data?data.map((item: Catalogue) => { data
const currentPath = path ? [...path, item.name] : [item.name]; ? data.map((item: Catalogue) => {
return { const currentPath = path ? [...path, item.name] : [item.name];
// isLeaf: (item.type && item.children.length === 0) , return {
isLeaf: item.isLeaf, // isLeaf: (item.type && item.children.length === 0) ,
name: item.name, isLeaf: item.isLeaf,
parentId: item.parentId, name: item.name,
label: searchTreeNode(item.name, searchValue), parentId: item.parentId,
icon: item.type && item.children.length === 0 && getTabIcon(item.type, 20), label: searchTreeNode(item.name, searchValue),
value: item.id, icon: item.type && item.children.length === 0 && getTabIcon(item.type, 20),
path: currentPath, value: item.id,
type: item.type, path: currentPath,
title: <>{searchTreeNode(item.name, searchValue)}</>, type: item.type,
fullInfo: item, title: <>{searchTreeNode(item.name, searchValue)}</>,
key: item.id, fullInfo: item,
id: item.id, key: item.id,
taskId: item.taskId, id: item.id,
children: buildProjectTree(item.children, searchValue, currentPath) taskId: item.taskId,
}; children: buildProjectTree(item.children, searchValue, currentPath)
}):[]; };
})
: [];
export const isUDF = (jobType: string) => { export const isUDF = (jobType: string) => {
return jobType === 'Scala' || jobType === 'Python' || jobType === 'Java'; return jobType === 'Scala' || jobType === 'Python' || jobType === 'Java';
......
...@@ -45,11 +45,11 @@ import { ...@@ -45,11 +45,11 @@ import {
} from '@/pages/DataStudio/RightContainer/JobConfig/service'; } from '@/pages/DataStudio/RightContainer/JobConfig/service';
import { LeftBottomMoreTabs, LeftBottomSide, LeftSide, RightSide } from '@/pages/DataStudio/route'; import { LeftBottomMoreTabs, LeftBottomSide, LeftSide, RightSide } from '@/pages/DataStudio/route';
import { l } from '@/utils/intl'; import { l } from '@/utils/intl';
import { PageContainer } from '@ant-design/pro-layout';
import { Layout, Menu, Modal, theme, Typography } from 'antd'; import { Layout, Menu, Modal, theme, Typography } from 'antd';
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { PersistGate } from 'redux-persist/integration/react'; import { PersistGate } from 'redux-persist/integration/react';
import { connect, getDvaApp } from 'umi'; import { connect, getDvaApp } from 'umi';
import { PageContainer } from '@ant-design/pro-layout';
const { Text } = Typography; const { Text } = Typography;
......
...@@ -56,7 +56,12 @@ const DevOverView: React.FC = () => { ...@@ -56,7 +56,12 @@ const DevOverView: React.FC = () => {
bodyStyle={noPadding} bodyStyle={noPadding}
> >
<ProCard split='vertical' 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> <ProCard>
<BatchStreamProportion /> <BatchStreamProportion />
</ProCard> </ProCard>
......
...@@ -23,11 +23,11 @@ import JobRecoveryView from '@/pages/Home/JobOverView/JobRecoveryView'; ...@@ -23,11 +23,11 @@ import JobRecoveryView from '@/pages/Home/JobOverView/JobRecoveryView';
import JobRunView from '@/pages/Home/JobOverView/JobRunView'; import JobRunView from '@/pages/Home/JobOverView/JobRunView';
import JobStatusPie from '@/pages/Home/JobOverView/JobStatusPie'; import JobStatusPie from '@/pages/Home/JobOverView/JobStatusPie';
import LoadScoreGauge from '@/pages/Home/JobOverView/LoadScoreGauge'; import LoadScoreGauge from '@/pages/Home/JobOverView/LoadScoreGauge';
import {l} from '@/utils/intl'; import { l } from '@/utils/intl';
import {ProCard} from '@ant-design/pro-components'; import { ProCard } from '@ant-design/pro-components';
import {Badge} from 'antd'; import { Badge } from 'antd';
import RcResizeObserver from 'rc-resize-observer'; import RcResizeObserver from 'rc-resize-observer';
import React, {useState} from 'react'; import React, { useState } from 'react';
const noPadding = { const noPadding = {
paddingInline: '0', paddingInline: '0',
...@@ -47,7 +47,7 @@ const JobOverView: React.FC = () => { ...@@ -47,7 +47,7 @@ const JobOverView: React.FC = () => {
<ProCard <ProCard
title={ title={
<> <>
<Badge status='processing'/> <Badge status='processing' />
{l('home.job.metrics')} {l('home.job.metrics')}
</> </>
} }
...@@ -59,26 +59,26 @@ const JobOverView: React.FC = () => { ...@@ -59,26 +59,26 @@ const JobOverView: React.FC = () => {
> >
<ProCard split={split} bodyStyle={noPadding}> <ProCard split={split} bodyStyle={noPadding}>
<ProCard split='horizontal'> <ProCard split='horizontal'>
<ProCard bodyStyle={{padding: '0 12px'}}> <ProCard bodyStyle={{ padding: '0 12px' }}>
<JobRunView/> <JobRunView />
</ProCard> </ProCard>
<ProCard bodyStyle={{padding: '0 12px'}}> <ProCard bodyStyle={{ padding: '0 12px' }}>
<JobFinishedView/> <JobFinishedView />
</ProCard> </ProCard>
<ProCard bodyStyle={{padding: '0 12px'}}> <ProCard bodyStyle={{ padding: '0 12px' }}>
<JobRecoveryView/> <JobRecoveryView />
</ProCard> </ProCard>
</ProCard> </ProCard>
<ProCard title={l('home.job.running.status')} bodyStyle={noPadding}> <ProCard title={l('home.job.running.status')} bodyStyle={noPadding}>
<JobStatusPie/> <JobStatusPie />
</ProCard> </ProCard>
</ProCard> </ProCard>
<ProCard split={split} bodyStyle={noPadding}> <ProCard split={split} bodyStyle={noPadding}>
<ProCard title={l('home.server.load')} bodyStyle={noPadding}> <ProCard title={l('home.server.load')} bodyStyle={noPadding}>
<LoadScoreGauge/> <LoadScoreGauge />
</ProCard> </ProCard>
<ProCard split='horizontal' bodyStyle={noPadding}> <ProCard split='horizontal' bodyStyle={noPadding}>
<JobErrorView/> <JobErrorView />
</ProCard> </ProCard>
</ProCard> </ProCard>
</ProCard> </ProCard>
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
import Scale from '@/components/Animation/Scale';
import { l } from '@/utils/intl'; import { l } from '@/utils/intl';
import Settings from '../../../../../../config/defaultSettings'; import Settings from '../../../../../../config/defaultSettings';
import style from '../../../../../global.less'; import style from '../../../../../global.less';
......
...@@ -24,7 +24,7 @@ export const gotoRedirectUrl = () => { ...@@ -24,7 +24,7 @@ export const gotoRedirectUrl = () => {
if (!history) return; if (!history) return;
setTimeout(() => { setTimeout(() => {
const urlParams = new URL(window.location.href).searchParams; const urlParams = new URL(window.location.href).searchParams;
window.location.href = urlParams.get('redirect') || '/' ; window.location.href = urlParams.get('redirect') || '/';
}, 10); }, 10);
}; };
......
...@@ -15,9 +15,9 @@ ...@@ -15,9 +15,9 @@
* limitations under the License. * limitations under the License.
*/ */
import SlowlyAppear from '@/components/Animation/SlowlyAppear';
import SettingOverView from '@/pages/SettingCenter/GlobalSetting/SettingOverView'; import SettingOverView from '@/pages/SettingCenter/GlobalSetting/SettingOverView';
import { PageContainer } from '@ant-design/pro-components'; import { PageContainer } from '@ant-design/pro-components';
import SlowlyAppear from "@/components/Animation/SlowlyAppear";
export default () => { export default () => {
return ( 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