@qzsy/dsh-yunxiao-panel 1.3.0 → 1.3.1
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/client.js +174 -2
- package/package.json +1 -1
- package/test/render-test.mjs +27 -2
package/dist/client.js
CHANGED
|
@@ -375,6 +375,9 @@ window.__ModuleLoader__.load({
|
|
|
375
375
|
viewList: '列表',
|
|
376
376
|
viewBoard: '看板',
|
|
377
377
|
boardEmpty: '暂无工作项',
|
|
378
|
+
moveTo: '移动状态',
|
|
379
|
+
moveTitle: '把 {serial} 移到',
|
|
380
|
+
moveEmpty: '没有可用的状态',
|
|
378
381
|
boardDropHint: '拖到这里改状态',
|
|
379
382
|
statusUnavailable: '这个工作项类型里没有该状态',
|
|
380
383
|
scopeMine: '我的',
|
|
@@ -580,6 +583,9 @@ window.__ModuleLoader__.load({
|
|
|
580
583
|
viewList: 'List',
|
|
581
584
|
viewBoard: 'Board',
|
|
582
585
|
boardEmpty: 'No items',
|
|
586
|
+
moveTo: 'Change status',
|
|
587
|
+
moveTitle: 'Move {serial} to',
|
|
588
|
+
moveEmpty: 'No status available',
|
|
583
589
|
boardDropHint: 'Drop here to change status',
|
|
584
590
|
statusUnavailable: 'That status is not part of this work item type',
|
|
585
591
|
scopeMine: 'Mine',
|
|
@@ -1047,6 +1053,21 @@ button.yx-bar-row:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
|
1047
1053
|
.yx-board-drop{display:flex;align-items:center;justify-content:center;border:1px dashed var(--dsw-alias-border-l3);border-radius:9px;color:var(--dsw-alias-label-tertiary);font-size:11px;padding:10px 6px}
|
|
1048
1054
|
.yx-board-drop-touch{display:none}
|
|
1049
1055
|
@media (max-width:760px){.yx-board{scroll-snap-type:x mandatory;padding-bottom:12px}.yx-board-col{flex:0 0 84%;min-width:0;max-width:84%;scroll-snap-align:start}.yx-board-drop-drag{display:none}.yx-board-drop-touch{display:inline}}
|
|
1056
|
+
.yx-board-top{display:flex;align-items:center;gap:6px;min-width:0}
|
|
1057
|
+
.yx-board-move{flex:none;margin-left:auto;width:22px;height:22px;border-radius:6px;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-secondary);font-size:12px;line-height:1;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;padding:0}
|
|
1058
|
+
.yx-board-move:hover{color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-border-l4)}
|
|
1059
|
+
.yx-board-tabs{display:none}
|
|
1060
|
+
.yx-board-tabs .yx-chip{flex:none}
|
|
1061
|
+
@media (max-width:760px){
|
|
1062
|
+
.yx-board-tabs{display:flex;gap:6px;overflow-x:auto;padding:2px 2px 8px;margin:0 -2px}
|
|
1063
|
+
.yx-board-move{width:30px;height:30px;font-size:14px}
|
|
1064
|
+
}
|
|
1065
|
+
.yx-move-list{display:flex;flex-direction:column;gap:4px;max-height:min(60vh,420px);overflow:auto}
|
|
1066
|
+
.yx-move-row{display:flex;align-items:center;gap:8px;width:100%;min-height:40px;padding:8px 10px;border:1px solid var(--dsw-alias-border-l2);border-radius:9px;background:var(--dsw-alias-bg-layer-1);color:inherit;font:inherit;font-size:13px;text-align:left;cursor:pointer}
|
|
1067
|
+
.yx-move-row:hover:not(:disabled){border-color:var(--dsw-alias-border-l4);background:var(--dsw-alias-interactive-bg-hover)}
|
|
1068
|
+
.yx-move-row[data-current="true"]{border-color:var(--dsw-alias-brand-primary);background:color-mix(in srgb,var(--dsw-alias-brand-primary) 8%,var(--dsw-alias-bg-layer-1))}
|
|
1069
|
+
.yx-move-row:disabled{opacity:.55;cursor:default}
|
|
1070
|
+
.yx-move-dot{width:8px;height:8px;border-radius:50%;flex:none}
|
|
1050
1071
|
@media (max-width:1100px){.yx-detail{position:absolute;right:0;top:0;bottom:0;width:min(440px,92vw);box-shadow:var(--dsw-elevation-prominent,-8px 0 24px rgba(0,0,0,.16));z-index:30}.yx-main{position:relative}}
|
|
1051
1072
|
@media (max-width:760px){
|
|
1052
1073
|
.yx-aside{position:absolute;left:0;top:0;bottom:0;z-index:40;width:min(300px,86vw);flex:0 0 auto;transform:translateX(-100%);transition:transform .2s ease;box-shadow:none}
|
|
@@ -2065,13 +2086,41 @@ button.yx-bar-row:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
|
2065
2086
|
})
|
|
2066
2087
|
}
|
|
2067
2088
|
|
|
2068
|
-
function WorkbenchPage({ t, state, data, error, onRetry, onRefresh, onOpenItem, refreshing, scope = 'mine', onScope, onMoveStatus }) {
|
|
2089
|
+
function WorkbenchPage({ t, state, data, error, onRetry, onRefresh, onOpenItem, refreshing, scope = 'mine', onScope, onMoveStatus, onLoadStatuses }) {
|
|
2069
2090
|
const isOrg = scope === 'org'
|
|
2070
2091
|
const [layout, setLayout] = useState(() =>
|
|
2071
2092
|
readStringStorage(WORKBENCH_VIEW_KEY) === 'board' ? 'board' : 'list',
|
|
2072
2093
|
)
|
|
2073
2094
|
const [dragId, setDragId] = useState('')
|
|
2074
2095
|
const [overColumn, setOverColumn] = useState('')
|
|
2096
|
+
const [moveTarget, setMoveTarget] = useState(null)
|
|
2097
|
+
const [moveList, setMoveList] = useState([])
|
|
2098
|
+
const [moveBusy, setMoveBusy] = useState(false)
|
|
2099
|
+
const [columnTab, setColumnTab] = useState('')
|
|
2100
|
+
const columnRefs = useRef({})
|
|
2101
|
+
const openMove = useCallback(
|
|
2102
|
+
async (item) => {
|
|
2103
|
+
setMoveTarget(item)
|
|
2104
|
+
setMoveList([])
|
|
2105
|
+
if (!onLoadStatuses) return
|
|
2106
|
+
setMoveBusy(true)
|
|
2107
|
+
try {
|
|
2108
|
+
setMoveList(await onLoadStatuses(item))
|
|
2109
|
+
} catch {
|
|
2110
|
+
setMoveList([])
|
|
2111
|
+
} finally {
|
|
2112
|
+
setMoveBusy(false)
|
|
2113
|
+
}
|
|
2114
|
+
},
|
|
2115
|
+
[onLoadStatuses],
|
|
2116
|
+
)
|
|
2117
|
+
const jumpToColumn = useCallback((name) => {
|
|
2118
|
+
setColumnTab(name)
|
|
2119
|
+
const node = columnRefs.current?.[name]
|
|
2120
|
+
if (node && typeof node.scrollIntoView === 'function') {
|
|
2121
|
+
node.scrollIntoView({ behavior: 'smooth', inline: 'start', block: 'nearest' })
|
|
2122
|
+
}
|
|
2123
|
+
}, [])
|
|
2075
2124
|
const switchLayout = useCallback((next) => {
|
|
2076
2125
|
setLayout(next === 'board' ? 'board' : 'list')
|
|
2077
2126
|
try {
|
|
@@ -2603,6 +2652,25 @@ button.yx-bar-row:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
|
2603
2652
|
),
|
|
2604
2653
|
hasFilter ? h('button', { className: 'yx-link-btn', onClick: clearFilters }, t('filterClear')) : null,
|
|
2605
2654
|
),
|
|
2655
|
+
filteredItems.length && layout === 'board'
|
|
2656
|
+
? h(
|
|
2657
|
+
'div',
|
|
2658
|
+
{ className: 'yx-board-tabs' },
|
|
2659
|
+
boardColumns.map((column) =>
|
|
2660
|
+
h(
|
|
2661
|
+
'button',
|
|
2662
|
+
{
|
|
2663
|
+
key: column.name,
|
|
2664
|
+
type: 'button',
|
|
2665
|
+
className: 'yx-chip',
|
|
2666
|
+
'data-active': String(columnTab === column.name),
|
|
2667
|
+
onClick: () => jumpToColumn(column.name),
|
|
2668
|
+
},
|
|
2669
|
+
`${column.name} ${column.rows.length}`,
|
|
2670
|
+
),
|
|
2671
|
+
),
|
|
2672
|
+
)
|
|
2673
|
+
: null,
|
|
2606
2674
|
filteredItems.length && layout === 'board'
|
|
2607
2675
|
? h(
|
|
2608
2676
|
'div',
|
|
@@ -2612,6 +2680,9 @@ button.yx-bar-row:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
|
2612
2680
|
'section',
|
|
2613
2681
|
{
|
|
2614
2682
|
key: column.name,
|
|
2683
|
+
ref: (node) => {
|
|
2684
|
+
columnRefs.current[column.name] = node
|
|
2685
|
+
},
|
|
2615
2686
|
className: 'yx-board-col',
|
|
2616
2687
|
'data-over': String(overColumn === column.name),
|
|
2617
2688
|
style: { '--tone': TONE_COLOR[column.tone] },
|
|
@@ -2670,7 +2741,7 @@ button.yx-bar-row:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
|
2670
2741
|
},
|
|
2671
2742
|
h(
|
|
2672
2743
|
'span',
|
|
2673
|
-
{ className: 'yx-board-card-top' },
|
|
2744
|
+
{ className: 'yx-board-card-top yx-board-top' },
|
|
2674
2745
|
h('span', { className: 'yx-serial' }, item.serialNumber),
|
|
2675
2746
|
item.workitemType
|
|
2676
2747
|
? h(
|
|
@@ -2682,6 +2753,22 @@ button.yx-bar-row:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
|
2682
2753
|
item.workitemType,
|
|
2683
2754
|
)
|
|
2684
2755
|
: null,
|
|
2756
|
+
onMoveStatus || onLoadStatuses
|
|
2757
|
+
? h(
|
|
2758
|
+
'button',
|
|
2759
|
+
{
|
|
2760
|
+
type: 'button',
|
|
2761
|
+
className: 'yx-board-move',
|
|
2762
|
+
title: t('moveTo'),
|
|
2763
|
+
'aria-label': t('moveTo'),
|
|
2764
|
+
onClick: (event) => {
|
|
2765
|
+
event.stopPropagation()
|
|
2766
|
+
openMove(item)
|
|
2767
|
+
},
|
|
2768
|
+
},
|
|
2769
|
+
'⇄',
|
|
2770
|
+
)
|
|
2771
|
+
: null,
|
|
2685
2772
|
),
|
|
2686
2773
|
h('span', { className: 'yx-board-subject' }, item.subject || '-'),
|
|
2687
2774
|
h(
|
|
@@ -2868,6 +2955,72 @@ button.yx-bar-row:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
|
2868
2955
|
),
|
|
2869
2956
|
),
|
|
2870
2957
|
),
|
|
2958
|
+
moveTarget
|
|
2959
|
+
? h(
|
|
2960
|
+
'div',
|
|
2961
|
+
{
|
|
2962
|
+
className: 'yx-modal',
|
|
2963
|
+
role: 'dialog',
|
|
2964
|
+
'aria-modal': 'true',
|
|
2965
|
+
onMouseDown: (event) => {
|
|
2966
|
+
if (event.target === event.currentTarget) setMoveTarget(null)
|
|
2967
|
+
},
|
|
2968
|
+
},
|
|
2969
|
+
h(
|
|
2970
|
+
'div',
|
|
2971
|
+
{ className: 'yx-modal-card' },
|
|
2972
|
+
h(
|
|
2973
|
+
'div',
|
|
2974
|
+
{ className: 'yx-modal-head' },
|
|
2975
|
+
h(
|
|
2976
|
+
'div',
|
|
2977
|
+
{ className: 'yx-modal-title' },
|
|
2978
|
+
t('moveTitle').replace('{serial}', moveTarget.serialNumber || ''),
|
|
2979
|
+
),
|
|
2980
|
+
h(
|
|
2981
|
+
'button',
|
|
2982
|
+
{ className: 'yx-icon-btn', onClick: () => setMoveTarget(null), 'aria-label': t('close') },
|
|
2983
|
+
'✕',
|
|
2984
|
+
),
|
|
2985
|
+
),
|
|
2986
|
+
moveBusy
|
|
2987
|
+
? h('p', { className: 'yx-muted' }, t('loading'))
|
|
2988
|
+
: moveList.length
|
|
2989
|
+
? h(
|
|
2990
|
+
'div',
|
|
2991
|
+
{ className: 'yx-move-list' },
|
|
2992
|
+
moveList.map((status) =>
|
|
2993
|
+
h(
|
|
2994
|
+
'button',
|
|
2995
|
+
{
|
|
2996
|
+
key: status.id,
|
|
2997
|
+
type: 'button',
|
|
2998
|
+
className: 'yx-move-row',
|
|
2999
|
+
'data-current': String(status.name === moveTarget.status),
|
|
3000
|
+
disabled: status.name === moveTarget.status,
|
|
3001
|
+
onClick: () => {
|
|
3002
|
+
const item = moveTarget
|
|
3003
|
+
setMoveTarget(null)
|
|
3004
|
+
if (onMoveStatus) onMoveStatus(item, status.name)
|
|
3005
|
+
},
|
|
3006
|
+
},
|
|
3007
|
+
h('span', {
|
|
3008
|
+
className: 'yx-move-dot',
|
|
3009
|
+
style: { background: TONE_COLOR[workTone(status.name)] },
|
|
3010
|
+
}),
|
|
3011
|
+
status.name,
|
|
3012
|
+
),
|
|
3013
|
+
),
|
|
3014
|
+
)
|
|
3015
|
+
: h('p', { className: 'yx-muted' }, t('moveEmpty')),
|
|
3016
|
+
h(
|
|
3017
|
+
'div',
|
|
3018
|
+
{ className: 'yx-modal-actions' },
|
|
3019
|
+
h('button', { className: 'yx-btn', onClick: () => setMoveTarget(null) }, t('cancel')),
|
|
3020
|
+
),
|
|
3021
|
+
),
|
|
3022
|
+
)
|
|
3023
|
+
: null,
|
|
2871
3024
|
)
|
|
2872
3025
|
}
|
|
2873
3026
|
|
|
@@ -3315,6 +3468,24 @@ button.yx-bar-row:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
|
3315
3468
|
[showToast, statusMutation, t],
|
|
3316
3469
|
)
|
|
3317
3470
|
|
|
3471
|
+
const loadStatusesFor = useCallback(
|
|
3472
|
+
async (item) => {
|
|
3473
|
+
const spaceId = item?.spaceId || item?.projectId || ''
|
|
3474
|
+
const typeId = item?.workitemTypeId || ''
|
|
3475
|
+
if (!spaceId || !typeId) return []
|
|
3476
|
+
const workflow = await queryClient.fetchQuery({
|
|
3477
|
+
queryKey: ['workflow', spaceId, typeId],
|
|
3478
|
+
queryFn: () =>
|
|
3479
|
+
getJson(
|
|
3480
|
+
`${API}/workflow?spaceId=${encodeURIComponent(spaceId)}&typeId=${encodeURIComponent(typeId)}`,
|
|
3481
|
+
),
|
|
3482
|
+
staleTime: 10 * 60_000,
|
|
3483
|
+
})
|
|
3484
|
+
return (workflow?.statuses ?? []).map((entry) => ({ id: entry.id, name: entry.name }))
|
|
3485
|
+
},
|
|
3486
|
+
[queryClient],
|
|
3487
|
+
)
|
|
3488
|
+
|
|
3318
3489
|
const moveStatusByName = useCallback(
|
|
3319
3490
|
async (item, statusName) => {
|
|
3320
3491
|
const spaceId = item?.spaceId || item?.projectId || ''
|
|
@@ -5244,6 +5415,7 @@ button.yx-bar-row:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
|
5244
5415
|
scope: workScope,
|
|
5245
5416
|
onScope: switchWorkScope,
|
|
5246
5417
|
onMoveStatus: moveStatusByName,
|
|
5418
|
+
onLoadStatuses: loadStatusesFor,
|
|
5247
5419
|
onOpenItem: (item) => openIssue(item, item.projectId),
|
|
5248
5420
|
})
|
|
5249
5421
|
: view === 'repo'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qzsy/dsh-yunxiao-panel",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Yunxiao (阿里云云效) panel for the DeepSeek Harness Web client: a cross-project workbench with charts, project/repository navigation, Projex work items, Codeup commits and merge requests.",
|
|
6
6
|
"license": "MIT",
|
package/test/render-test.mjs
CHANGED
|
@@ -54,7 +54,7 @@ const dict = {
|
|
|
54
54
|
kpiCompletion: '完成率', kpiShare: '占比', kpiOpenBugs: '{n} 个未关闭', kpiReviewHint: '点击定位到评审列表',
|
|
55
55
|
changeStatus: '改为其他状态…', markDone: '标记完成', statusSaving: '更新中…', statusFinished: '已完成',
|
|
56
56
|
statusChanged: '已改为「{name}」',
|
|
57
|
-
kpiReviewClear: '暂无待评审', viewList: '列表', viewBoard: '看板', boardDropHint: '拖到这里改状态', statusUnavailable: '这个类型没有该状态', scopeMine: '我的', scopeOrg: '组织', orgReviews: '组织待评审', byAssignee: '按负责人', assigneesUnit: '位负责人', heroSummary: '还有 {open} 项未完成,{bugs} 个缺陷待处理,{reviews} 个合并请求等你评审',
|
|
57
|
+
kpiReviewClear: '暂无待评审', viewList: '列表', viewBoard: '看板', boardDropHint: '拖到这里改状态', statusUnavailable: '这个类型没有该状态', moveTo: '移动状态', moveTitle: '把 {serial} 移到', moveEmpty: '没有可用的状态', scopeMine: '我的', scopeOrg: '组织', orgReviews: '组织待评审', byAssignee: '按负责人', assigneesUnit: '位负责人', heroSummary: '还有 {open} 项未完成,{bugs} 个缺陷待处理,{reviews} 个合并请求等你评审',
|
|
58
58
|
doneSection: '已完成 / 已关闭', statusUnit: '种状态', projectsUnit: '个项目', typesUnit: '种类型',
|
|
59
59
|
trendTotal: '合计 ', trendPeak: '峰值 ', trendLatest: '最近 ', toneTodo: '待处理', toneConfirm: '待确认',
|
|
60
60
|
toneDoing: '处理中', toneDone: '已完成', toneClosed: '已关闭',
|
|
@@ -221,7 +221,9 @@ global.fetch = async (input, init) => {
|
|
|
221
221
|
if (url.includes('/workitem-status') && method === 'POST') {
|
|
222
222
|
statusBody = JSON.parse(init.body)
|
|
223
223
|
const STATUS_NAMES = { '28': '待确认', '100010': '处理中', '29': '已修复', '100085': '已关闭' }
|
|
224
|
-
|
|
224
|
+
if (statusBody.id === 'w1') {
|
|
225
|
+
w1Status = { id: statusBody.statusId, name: STATUS_NAMES[statusBody.statusId] || '已修复' }
|
|
226
|
+
}
|
|
225
227
|
return json({ ...issues[0], workitemTypeId: 'type-bug', spaceId: 'space-1', statusId: w1Status.id, status: w1Status.name, comments: [] })
|
|
226
228
|
}
|
|
227
229
|
if (url.includes('/workitem?')) {
|
|
@@ -405,6 +407,29 @@ await flush()
|
|
|
405
407
|
if (!statusBody || statusBody.id !== 'w1' || statusBody.statusId !== '100010') {
|
|
406
408
|
throw new Error(`board drop sent the wrong status: ${JSON.stringify(statusBody)}`)
|
|
407
409
|
}
|
|
410
|
+
// touch screens use the per-card move dialog instead of dragging
|
|
411
|
+
if (!container.querySelector('.yx-board-tabs')) throw new Error('board column tabs missing for narrow screens')
|
|
412
|
+
const w2Card = [...board.querySelectorAll('.yx-board-card')].find((card) => card.textContent.includes('QXERP-62'))
|
|
413
|
+
if (!w2Card) throw new Error('second board card missing')
|
|
414
|
+
const moveButton = w2Card.querySelector('.yx-board-move')
|
|
415
|
+
if (!moveButton) throw new Error('per-card move button missing')
|
|
416
|
+
await act(async () => {
|
|
417
|
+
moveButton.dispatchEvent(new dom.window.MouseEvent('click', { bubbles: true }))
|
|
418
|
+
})
|
|
419
|
+
await flush()
|
|
420
|
+
const moveDialog = container.querySelector('.yx-modal')
|
|
421
|
+
if (!moveDialog) throw new Error('move dialog did not open')
|
|
422
|
+
const moveRow = [...moveDialog.querySelectorAll('.yx-move-row')].find((row) =>
|
|
423
|
+
row.textContent.includes('已修复'),
|
|
424
|
+
)
|
|
425
|
+
if (!moveRow) throw new Error('move dialog did not list workflow statuses')
|
|
426
|
+
await act(async () => {
|
|
427
|
+
moveRow.dispatchEvent(new dom.window.MouseEvent('click', { bubbles: true }))
|
|
428
|
+
})
|
|
429
|
+
await flush()
|
|
430
|
+
if (!statusBody || statusBody.id !== 'w2' || statusBody.statusId !== '29') {
|
|
431
|
+
throw new Error(`move dialog sent the wrong status: ${JSON.stringify(statusBody)}`)
|
|
432
|
+
}
|
|
408
433
|
const listButton = [...container.querySelectorAll('.yx-viewswitch-btn')].find((button) =>
|
|
409
434
|
button.textContent === '列表',
|
|
410
435
|
)
|