@gadmin2n/schematics 0.0.84 → 0.0.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/hooks/useDynamicResources.tsx +14 -0
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/hooks/useUserPageAccess.ts +13 -3
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/agenda/index.tsx +38 -10
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/agenda/show.tsx +10 -5
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/editor.tsx +1 -3
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/index.tsx +1 -1
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/instance-detail.tsx +1 -3
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/instances.tsx +1 -3
- package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/node-instances/components/NodeInstanceForm.tsx +5 -3
- package/package.json +1 -1
package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/hooks/useDynamicResources.tsx
CHANGED
|
@@ -211,6 +211,20 @@ export const useDynamicResources = (): IResourceItem[] => {
|
|
|
211
211
|
const dynamicResources = resultResources;
|
|
212
212
|
const allResources = dynamicResources;
|
|
213
213
|
|
|
214
|
+
// 防御性保护:用户已有角色但算出来 0 个资源,说明 rolePagesData
|
|
215
|
+
// 还没到位(isLoading 误报为 false 时进了这条分支),不要把空结果
|
|
216
|
+
// 永久写入 cachedResources,否则后续真正加载完成后无法重算
|
|
217
|
+
if (allResources.length === 0 && roleNames.length > 0) {
|
|
218
|
+
isComputing = false;
|
|
219
|
+
if (import.meta.env.DEV) {
|
|
220
|
+
console.warn(
|
|
221
|
+
'[useDynamicResources] ⚠️ Skip caching: 0 resources but roles present',
|
|
222
|
+
{ roleNames },
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
return [];
|
|
226
|
+
}
|
|
227
|
+
|
|
214
228
|
// Cache the result - will be used for all subsequent calls
|
|
215
229
|
cachedResources = allResources;
|
|
216
230
|
isComputing = false;
|
package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/hooks/useUserPageAccess.ts
CHANGED
|
@@ -333,10 +333,20 @@ export const useUserPageAccess = (): UseUserPageAccessResult => {
|
|
|
333
333
|
if (hasCache && pagesData && rolePagesData) return false;
|
|
334
334
|
if (isRoleLoading) return true;
|
|
335
335
|
if (!pagesData) return true;
|
|
336
|
-
|
|
337
|
-
|
|
336
|
+
// 等待 /role/findMany 返回(roleNames 已拿到但 rolesData 还在路上)
|
|
337
|
+
if (roleNames.length > 0 && !rolesData) return true;
|
|
338
|
+
// 等待 /rolePages/findMany 返回
|
|
339
|
+
if (roleIds.length > 0 && !rolePagesData) return true;
|
|
338
340
|
return false;
|
|
339
|
-
}, [
|
|
341
|
+
}, [
|
|
342
|
+
isRoleLoading,
|
|
343
|
+
pagesData,
|
|
344
|
+
roleNames,
|
|
345
|
+
rolesData,
|
|
346
|
+
roleIds,
|
|
347
|
+
rolePagesData,
|
|
348
|
+
hasCache,
|
|
349
|
+
]);
|
|
340
350
|
|
|
341
351
|
return {
|
|
342
352
|
accessiblePageIds,
|
|
@@ -102,16 +102,20 @@ function RunDot({
|
|
|
102
102
|
count,
|
|
103
103
|
color,
|
|
104
104
|
label,
|
|
105
|
+
onClick,
|
|
105
106
|
}: {
|
|
106
107
|
count: number;
|
|
107
108
|
color: string;
|
|
108
109
|
label: string;
|
|
110
|
+
onClick?: () => void;
|
|
109
111
|
}) {
|
|
110
112
|
const size = 28;
|
|
111
113
|
const hasCount = count > 0;
|
|
114
|
+
const clickable = hasCount && !!onClick;
|
|
112
115
|
return (
|
|
113
116
|
<Tooltip title={`${label}: ${count}`}>
|
|
114
117
|
<span
|
|
118
|
+
onClick={clickable ? onClick : undefined}
|
|
115
119
|
style={{
|
|
116
120
|
display: 'inline-flex',
|
|
117
121
|
alignItems: 'center',
|
|
@@ -124,7 +128,7 @@ function RunDot({
|
|
|
124
128
|
fontSize: 11,
|
|
125
129
|
fontWeight: 600,
|
|
126
130
|
color: hasCount ? color : '#d9d9d9',
|
|
127
|
-
cursor: 'default',
|
|
131
|
+
cursor: clickable ? 'pointer' : 'default',
|
|
128
132
|
lineHeight: 1,
|
|
129
133
|
}}
|
|
130
134
|
>
|
|
@@ -339,14 +343,38 @@ export default function AgendaJobsPage() {
|
|
|
339
343
|
title: 'Runs',
|
|
340
344
|
key: 'runs',
|
|
341
345
|
width: 170,
|
|
342
|
-
render: (_: any, record: JobItem) =>
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
<
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
346
|
+
render: (_: any, record: JobItem) => {
|
|
347
|
+
const go = (status: string) =>
|
|
348
|
+
navigate(`show/${encodeURIComponent(record.name)}?status=${status}`);
|
|
349
|
+
return (
|
|
350
|
+
<Space size={6}>
|
|
351
|
+
<RunDot
|
|
352
|
+
count={record.runs.queued}
|
|
353
|
+
color="#faad14"
|
|
354
|
+
label="Queued"
|
|
355
|
+
onClick={() => go('queued')}
|
|
356
|
+
/>
|
|
357
|
+
<RunDot
|
|
358
|
+
count={record.runs.success}
|
|
359
|
+
color="#006d32"
|
|
360
|
+
label="Success"
|
|
361
|
+
onClick={() => go('success')}
|
|
362
|
+
/>
|
|
363
|
+
<RunDot
|
|
364
|
+
count={record.runs.running}
|
|
365
|
+
color="#52c41a"
|
|
366
|
+
label="Running"
|
|
367
|
+
onClick={() => go('running')}
|
|
368
|
+
/>
|
|
369
|
+
<RunDot
|
|
370
|
+
count={record.runs.failed}
|
|
371
|
+
color="#ff4d4f"
|
|
372
|
+
label="Failed"
|
|
373
|
+
onClick={() => go('failed')}
|
|
374
|
+
/>
|
|
375
|
+
</Space>
|
|
376
|
+
);
|
|
377
|
+
},
|
|
350
378
|
},
|
|
351
379
|
{
|
|
352
380
|
title: 'Schedule',
|
|
@@ -451,7 +479,7 @@ export default function AgendaJobsPage() {
|
|
|
451
479
|
icon={<DatabaseOutlined />}
|
|
452
480
|
onClick={() => navigate('/admin/data-mngt/agenda-job')}
|
|
453
481
|
>
|
|
454
|
-
|
|
482
|
+
任务原始表
|
|
455
483
|
</Button>
|
|
456
484
|
</Tooltip>
|
|
457
485
|
<Button
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
DeleteOutlined,
|
|
23
23
|
PlayCircleOutlined,
|
|
24
24
|
} from '@ant-design/icons';
|
|
25
|
-
import { useNavigate, useParams } from 'react-router-dom';
|
|
25
|
+
import { useNavigate, useParams, useSearchParams } from 'react-router-dom';
|
|
26
26
|
import { customRequest } from 'helpers/http';
|
|
27
27
|
import { useECharts } from 'hooks/useECharts';
|
|
28
28
|
import dayjs from 'dayjs';
|
|
@@ -216,6 +216,8 @@ export default function AgendaJobShow() {
|
|
|
216
216
|
const { jobName: rawJobName } = useParams<{ jobName: string }>();
|
|
217
217
|
const jobName = decodeURIComponent(rawJobName || '');
|
|
218
218
|
const navigate = useNavigate();
|
|
219
|
+
const [searchParams] = useSearchParams();
|
|
220
|
+
const initialStatus = searchParams.get('status') || undefined;
|
|
219
221
|
|
|
220
222
|
const [detail, setDetail] = useState<JobDetail | null>(null);
|
|
221
223
|
const [loading, setLoading] = useState(true);
|
|
@@ -231,7 +233,9 @@ export default function AgendaJobShow() {
|
|
|
231
233
|
// Chart filters
|
|
232
234
|
const [filterBefore, setFilterBefore] = useState<dayjs.Dayjs | null>(dayjs());
|
|
233
235
|
const [filterLimit, setFilterLimit] = useState(25);
|
|
234
|
-
const [filterStatus, setFilterStatus] = useState<string | undefined>(
|
|
236
|
+
const [filterStatus, setFilterStatus] = useState<string | undefined>(
|
|
237
|
+
initialStatus,
|
|
238
|
+
);
|
|
235
239
|
|
|
236
240
|
// Fetch job detail
|
|
237
241
|
const fetchDetail = useCallback(async () => {
|
|
@@ -327,9 +331,10 @@ export default function AgendaJobShow() {
|
|
|
327
331
|
if (!detail) {
|
|
328
332
|
return (
|
|
329
333
|
<div style={{ padding: 24 }}>
|
|
330
|
-
<Button
|
|
331
|
-
|
|
332
|
-
|
|
334
|
+
<Button
|
|
335
|
+
icon={<ArrowLeftOutlined />}
|
|
336
|
+
onClick={() => navigate(-1)}
|
|
337
|
+
></Button>
|
|
333
338
|
<div style={{ marginTop: 24, textAlign: 'center', color: '#999' }}>
|
|
334
339
|
Job 不存在
|
|
335
340
|
</div>
|
|
@@ -234,9 +234,7 @@ export default function WorkflowInstanceDetailPage() {
|
|
|
234
234
|
type="text"
|
|
235
235
|
icon={<ArrowLeftOutlined />}
|
|
236
236
|
onClick={() => navigate(-1)}
|
|
237
|
-
>
|
|
238
|
-
Back
|
|
239
|
-
</Button>
|
|
237
|
+
></Button>
|
|
240
238
|
<Title level={4} style={{ margin: 0 }}>
|
|
241
239
|
{data.workflow.name} — Instance #{data.id}
|
|
242
240
|
</Title>
|
package/dist/lib/application/files/gadmin2-game-angle-demo/web/src/routes/workflow/instances.tsx
CHANGED
|
@@ -197,9 +197,7 @@ export default function WorkflowInstancesPage() {
|
|
|
197
197
|
type="text"
|
|
198
198
|
icon={<ArrowLeftOutlined />}
|
|
199
199
|
onClick={() => navigate('/admin/workflow')}
|
|
200
|
-
>
|
|
201
|
-
Back
|
|
202
|
-
</Button>
|
|
200
|
+
></Button>
|
|
203
201
|
<Title level={4} style={{ margin: 0 }}>
|
|
204
202
|
{workflowName || 'Workflow'} — Execution History
|
|
205
203
|
</Title>
|
|
@@ -93,9 +93,11 @@ export function NodeInstanceForm({
|
|
|
93
93
|
}}
|
|
94
94
|
>
|
|
95
95
|
<div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
|
|
96
|
-
<Button
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
<Button
|
|
97
|
+
type="text"
|
|
98
|
+
icon={<ArrowLeftOutlined />}
|
|
99
|
+
onClick={onBack}
|
|
100
|
+
></Button>
|
|
99
101
|
<Title level={4} style={{ margin: 0 }}>
|
|
100
102
|
{title}
|
|
101
103
|
</Title>
|