refactor(web): 优化部署打包方案

This commit is contained in:
v-zhangjc9
2025-05-09 17:23:26 +08:00
parent 121f6688c6
commit aa93b52dd9
9 changed files with 378 additions and 115 deletions

View File

@@ -1,5 +1,5 @@
import {createRoot} from 'react-dom/client'
import {createBrowserRouter, RouterProvider} from 'react-router'
import {createHashRouter, RouterProvider} from 'react-router'
import './components/Registry.ts'
@@ -16,7 +16,7 @@ import Version from './pages/Version.tsx'
import Yarn from './pages/Yarn.tsx'
import YarnCluster from './pages/YarnCluster.tsx'
const routes = createBrowserRouter([
const routes = createHashRouter([
{
path: '/',
Component: App,

View File

@@ -33,7 +33,7 @@ const versionDetailDialog = (variable: string, target: string) => {
method: 'get',
url: `${commonInfo.baseUrl}/overview/version_detail`,
data: {
target: `${target}`,
target: target,
version: '${version}',
},
},
@@ -272,65 +272,78 @@ const Overview: React.FC = () => {
],
},
{type: 'divider'},
'<span class="italic text-gray-500 my-2">表数量 (重点表数量, 普通表数量)</span>',
{
type: 'service',
type: 'crud',
title: '同步表数量',
api: `${commonInfo.baseUrl}/overview`,
...crudCommonOptions(),
interval: 60000,
silentPolling: true,
body: [
columns: [
{
type: 'tpl',
tpl: '逻辑表:<span class="font-bold mr-1 font-mono">${PADSTART(table_count, 4)} (<span class="text-primary">${PADSTART(table_focus_count, 4)}</span>, ${PADSTART(table_count - table_focus_count, 4)})</span>',
name: 'type',
label: '表类型',
},
'<br>',
{
type: 'tpl',
tpl: '湖底表:<span class="font-bold mr-1 font-mono">${PADSTART(hudi_count, 4)} (<span class="text-primary">${PADSTART(hudi_focus_count, 4)}</span>, ${PADSTART(hudi_count - hudi_focus_count, 4)})</span>',
name: 'total',
label: '总表数',
width: 100,
align: 'center',
},
'<br>',
{
name: 'focus',
label: '重点表',
className: 'text-danger font-bold',
width: 100,
align: 'center',
},
{
label: '普通表',
type: 'tpl',
tpl: '嗨福表:<span class="font-bold mr-1 font-mono">${PADSTART(hive_count, 4)} (<span class="text-primary">${PADSTART(hive_focus_count, 4)}</span>, ${PADSTART(hive_count - hive_focus_count, 4)})</span>',
tpl: '${total - focus}',
width: 100,
align: 'center',
},
],
},
{type: 'divider'},
{
type: 'service',
type: 'crud',
title: '同步表数量',
api: `${commonInfo.baseUrl}/overview/sync_running_status`,
...crudCommonOptions(),
interval: 10000,
silentPolling: true,
body: [
columns: [
{
type: 'tpl',
tpl: '任务数<span class="font-bold m-2 font-mono">${totalJob}</span>',
name: 'type',
label: '类型',
},
{
className: 'mx-2',
type: 'tpl',
tpl: '运行中<span class="font-bold m-2 font-mono">${PADSTART(runningJob, 3)}</span>',
name: 'total',
label: '任务数',
width: 100,
align: 'center',
},
{
type: 'tpl',
tpl: '已停止<span class="font-bold m-2 font-mono text-danger">${PADSTART(unRunningJob, 3)}</span>',
},
tableDetailDialog('unRunningJob', 'unRunningJobList'),
'<br/>',
{
type: 'tpl',
tpl: '总表数<span class="font-bold m-2 font-mono">${totalTable}</span>',
name: 'running',
label: '运行中',
width: 100,
align: 'center',
},
{
className: 'mx-2',
type: 'tpl',
tpl: '运行中<span class="font-bold m-2 font-mono">${PADSTART(runningTable, 3)}</span>',
name: 'stopped',
label: '已停止',
className: 'text-danger font-bold',
width: 100,
align: 'center',
},
{
type: 'tpl',
tpl: '已停止<span class="font-bold m-2 font-mono text-danger">${PADSTART(unRunningTable, 3)}</span>',
type: 'operation',
label: '操作',
width: 100,
align: 'center',
buttons: [
tableDetailDialog('stopped', 'list'),
],
},
tableDetailDialog('unRunningTable', 'unRunningTableList'),
],
},
{type: 'divider'},
@@ -360,61 +373,74 @@ const Overview: React.FC = () => {
interval: 10000,
silentPolling: true,
body: [
'版本:',
{
type: 'tpl',
className: 'font-bold',
tpl: '${version}',
type: 'table',
title: '跨天情况 (${version})',
source: '${items}',
...crudCommonOptions(),
headerToolbar: [
'${version}'
],
columns: [
{
name: 'type',
label: '类型',
},
{
name: 'unReceive',
label: '未接收',
width: 100,
align: 'center',
},
{
type: 'operation',
label: '操作',
width: 100,
align: 'center',
buttons: [
versionDetailDialog('unReceive', 'unReceive_${key}'),
],
},
{
name: 'unScheduled',
label: '未跨天',
className: 'text-danger font-bold',
width: 100,
align: 'center',
},
{
type: 'operation',
label: '操作',
width: 100,
align: 'center',
buttons: [
versionDetailDialog('unScheduled', 'unScheduled_${key}'),
],
},
],
},
'<br/>',
'<span class="italic text-gray-500 my-2">未接收, 未跨天</span>',
'<br/>',
'重点表:',
{
type: 'tpl',
tpl: '<span class="font-bold font-mono">${PADSTART(unReceive.focus, 3)}</span>',
},
versionDetailDialog('unReceive.focus', 'unReceive_focus'),
',',
{
type: 'tpl',
tpl: '<span class="font-bold font-mono">${PADSTART(unSchedule.focus, 3)}</span>',
},
versionDetailDialog('unSchedule.focus', 'unScheduled_focus'),
'<br/>',
'普通表:',
{
type: 'tpl',
tpl: '<span class="font-bold font-mono">${PADSTART(unReceive.normal, 3)}</span>',
},
versionDetailDialog('unReceive.normal', 'unReceive_normal'),
',',
{
type: 'tpl',
tpl: '<span class="font-bold font-mono">${PADSTART(unSchedule.normal, 3)}</span>',
},
versionDetailDialog('unSchedule.normal', 'unScheduled_normal'),
],
},
{type: 'divider'},
{
type: 'service',
type: 'crud',
title: '调度策略',
api: `${commonInfo.baseUrl}/overview/schedule_jobs`,
...crudCommonOptions(),
interval: 60000,
silentPolling: true,
body: [
'调度策略',
loadDataOnce: true,
columns: [
{
type: 'each',
name: 'items',
items: {
type: 'tpl',
tpl: '<div class="font-mono"><span class="font-bold">${trigger}</span> <span class="text-gray-500">(${job})</span></div>',
},
name: 'trigger',
label: 'Cron表达式',
className: 'font-mono',
width: 300,
},
{
name: 'job',
label: '策略描述',
},
],
},
{type: 'divider'},
{
type: 'crud',
title: '监控指标运行进度',
@@ -426,13 +452,13 @@ const Overview: React.FC = () => {
{
name: 'name',
label: '名称',
width: 120,
width: 150,
},
{
name: 'running',
label: '状态',
type: 'mapping',
width: 50,
width: 70,
map: {
'true': '运行中',
'false': '未运行',