Skip to content

Commit

Permalink
[Optimization] optimize some image addresses as relative paths (DataL…
Browse files Browse the repository at this point in the history
…inkDC#3178)

Co-authored-by: Zzm0809 <[email protected]>
  • Loading branch information
2 people authored and gaoyan1998 committed Mar 19, 2024
1 parent 64fe391 commit e595984
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 16 deletions.
2 changes: 1 addition & 1 deletion dinky-admin/src/main/resources/application-h2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ spring:
h2:
console:
enabled: true
path: /h2
path: /api/h2
sql:
init:
schema-locations: classpath:db/db-h2-ddl.sql
Expand Down
5 changes: 4 additions & 1 deletion dinky-web/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import routes from './routes';

const { REACT_APP_ENV = 'dev' } = process.env;

// @ts-ignore
export default defineConfig({
/**
* tags router:
Expand All @@ -44,6 +45,7 @@ export default defineConfig({
*/
hash: true,
esbuildMinifyIIFE: true,
publicPath: process.env.NODE_ENV === 'production' ? './' : '/',
history: {
type: 'hash'
},
Expand Down Expand Up @@ -86,6 +88,7 @@ export default defineConfig({
* @doc 代理介绍 https://umijs.org/docs/guides/proxy
* @doc 代理配置 https://umijs.org/docs/api/config#proxy
*/
// @ts-ignore
proxy: proxy[REACT_APP_ENV as keyof typeof proxy],
/**
* @name 快速热更新配置
Expand Down Expand Up @@ -166,7 +169,7 @@ export default defineConfig({
*/
headScripts: [
// 解决首次加载时白屏的问题
{ src: '/scripts/loading.js', async: true }
{ src: './scripts/loading.js', async: true }
],
//================ pro 插件配置 =================
presets: ['umi-presets-pro'],
Expand Down
2 changes: 1 addition & 1 deletion dinky-web/config/defaultSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const Settings: ProLayoutProps & {
// 这里不能删除,需要先设置,否则会导致页面白屏, 然后在 layout 进行重新赋值
title: 'Dinky Real-time Platform ',
pwa: true,
logo: '/dinky.svg',
logo: './dinky.svg',
iconfontUrl: '',
splitMenus: true,
menu: {
Expand Down
8 changes: 5 additions & 3 deletions dinky-web/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import { API } from './services/data';
// const isDev = process.env.NODE_ENV === "development";
const loginPath = API_CONSTANTS.LOGIN_PATH;

const whiteList = ['/user', '/user/login'];
const whiteList = ['/user', loginPath];

let extraRoutes: SysMenu[] = [];
let rendered = false;
Expand All @@ -65,7 +65,7 @@ const queryUserInfo = async () => {
const currentUser: API.CurrentUser = {
user: {
...user,
avatar: user.avatar ?? '/icons/user_avatar.png'
avatar: user.avatar ?? './icons/user_avatar.png'
},
roleList: roleList,
tenantList: tenantList,
Expand Down Expand Up @@ -183,7 +183,9 @@ export const layout: RunTimeLayoutConfig = ({ initialState }) => {
* @doc https://umijs.org/docs/max/request#配置
*/
export const request = {
...errorConfig
...errorConfig,
// 修改为相对请求路径, 避免请求路径出现错误 会自动拼接为完整请求路径
baseURL: API_CONSTANTS.BASE_URL
};

// 这个是redux-persist 的配置
Expand Down
2 changes: 1 addition & 1 deletion dinky-web/src/components/Footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const Footer: React.FC = () => {
return (
<DefaultFooter
style={{
background: 'url(/icons/footer-bg.svg) 100% 100% no-repeat',
background: 'url(./icons/footer-bg.svg) 100% 100% no-repeat',
backgroundSize: 'cover',
bottom: 0
}}
Expand Down
3 changes: 2 additions & 1 deletion dinky-web/src/models/Sse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import { postAll } from '@/services/api';
import { ErrorMessage } from '@/utils/messages';
import { useEffect, useRef, useState } from 'react';
// @ts-ignore
import { v4 as uuidv4 } from 'uuid';

const session_invalid_label = 'SESSION_INVALID';
Expand Down Expand Up @@ -51,7 +52,7 @@ export default () => {
};
const reconnectSse = () => {
uuidRef.current = uuidv4();
const sseUrl = '/api/sse/connect?sessionKey=' + uuidRef.current;
const sseUrl = 'api/sse/connect?sessionKey=' + uuidRef.current;
eventSource?.close();
setEventSource(new EventSource(sseUrl));
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const MainWithStyle = (props: any) => {
const { children } = props;

return (
<div className={style.loginformMain} style={{ backgroundImage: `url('/icons/main-bg.svg')` }}>
<div className={style.loginformMain} style={{ backgroundImage: `url('./icons/main-bg.svg')` }}>
<img className={style.logo} src={Settings.logo} />
<div className={style.form}>
<div className={style.top}>
Expand Down
15 changes: 8 additions & 7 deletions dinky-web/src/services/endpoints.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

export enum API_CONSTANTS {
BASE_URL = '.',
GET_SERVICE_VERSION = '/api/version',

// --- user ---
Expand Down Expand Up @@ -236,12 +237,12 @@ export enum API_CONSTANTS {
REFRESH_JOB_DETAIL = '/api/jobInstance/refreshJobInfoDetail',
READ_CHECKPOINT = '/api/flinkConf/readCheckPoint',
GET_JOB_VERSION = '/api/task/version',
GET_JOBMANAGER_LOG = 'api/jobInstance/getJobManagerLog',
GET_JOBMANAGER_STDOUT = 'api/jobInstance/getJobManagerStdOut',
GET_JOBMANAGER_THREAD_DUMP = 'api/jobInstance/getJobManagerThreadDump',
GET_TASKMANAGER_LIST = 'api/jobInstance/getTaskManagerList',
GET_TASKMANAGER_LOG = 'api/jobInstance/getTaskManagerLog',
GET_JOB_METRICS_ITEMS = 'api/jobInstance/getJobMetricsItems',
GET_JOBMANAGER_LOG = '/api/jobInstance/getJobManagerLog',
GET_JOBMANAGER_STDOUT = '/api/jobInstance/getJobManagerStdOut',
GET_JOBMANAGER_THREAD_DUMP = '/api/jobInstance/getJobManagerThreadDump',
GET_TASKMANAGER_LIST = '/api/jobInstance/getTaskManagerList',
GET_TASKMANAGER_LOG = '/api/jobInstance/getTaskManagerLog',
GET_JOB_METRICS_ITEMS = '/api/jobInstance/getJobMetricsItems',
CANCEL_JOB = '/api/task/cancel',
// /api/studio/getLineage
STUDIO_GET_LINEAGE = '/api/studio/getLineage',
Expand All @@ -263,7 +264,7 @@ export enum API_CONSTANTS {
LDAP_IMPORT_USERS = '/api/ldap/importUsers',

// -- home
GET_STATUS_COUNT = 'api/jobInstance/getStatusCount',
GET_STATUS_COUNT = '/api/jobInstance/getStatusCount',
GET_RESOURCE_OVERVIEW = '/api/home/getResourceOverview',
GET_JOB_STATUS_OVERVIEW = '/api/home/getJobStatusOverview',
GET_JOB_TYPE_OVERVIEW = '/api/home/getJobTypeOverview',
Expand Down

0 comments on commit e595984

Please sign in to comment.