@qzsy/dsh-yunxiao-panel 1.2.1 → 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/README.md +6 -0
- package/dist/client.js +404 -3
- package/package.json +1 -1
- package/test/render-test.mjs +71 -5
package/README.md
CHANGED
|
@@ -38,6 +38,11 @@ and a repository chip row for its merge requests.
|
|
|
38
38
|
- a scrollable **work-item list** (serial, project code + **Chinese project
|
|
39
39
|
name**, assignee in organization scope, type, status, relative time) with
|
|
40
40
|
removable filter chips; rows open the detail pane,
|
|
41
|
+
- a **列表 / 看板** switch: the board groups the filtered items into one column
|
|
42
|
+
per status (ordered by workflow stage, empty columns still shown), and
|
|
43
|
+
**dragging a card onto another column changes its status** through the same
|
|
44
|
+
workflow lookup the detail pane uses — on touch screens a column becomes a
|
|
45
|
+
full-width swipe page and a tap opens the detail pane instead,
|
|
41
46
|
- merge requests waiting for review (all open ones in organization scope), with
|
|
42
47
|
a direct link to Yunxiao when the list is empty.
|
|
43
48
|
- **Change status from the detail pane** — the pane shows the current status, a
|
|
@@ -113,6 +118,7 @@ The panel is usable down to phone widths (≤ 760 px):
|
|
|
113
118
|
- the left menu becomes a **drawer** behind a hamburger button in a compact top
|
|
114
119
|
bar; it slides in with a scrim and closes on navigation, scrim click or Escape;
|
|
115
120
|
- workbench KPIs collapse to two columns and the charts stack vertically;
|
|
121
|
+
- the kanban board becomes one swipeable column per screen with snap scrolling;
|
|
116
122
|
- unbound repositories render as a single-column card list;
|
|
117
123
|
- the work-item detail pane becomes a full-width overlay with its own close
|
|
118
124
|
button, and dialogs use the full width with a scrollable body;
|
package/dist/client.js
CHANGED
|
@@ -209,6 +209,7 @@ window.__ModuleLoader__.load({
|
|
|
209
209
|
/** Remembered DSH workspace per Yunxiao project: { [projectId]: workspaceId, __last: workspaceId }. */
|
|
210
210
|
const CHAT_WORKSPACE_KEY = 'dsh.yunxiao.chatWorkspace'
|
|
211
211
|
const WORK_SCOPE_KEY = 'dsh.yunxiao.workScope'
|
|
212
|
+
const WORKBENCH_VIEW_KEY = 'dsh.yunxiao.workbenchView'
|
|
212
213
|
const UNASSIGNED = '未指派'
|
|
213
214
|
const PROJECT_ID_STORAGE_KEY = 'dsh.yunxiao.project'
|
|
214
215
|
const VIEW_STORAGE_KEY = 'dsh.yunxiao.view'
|
|
@@ -371,6 +372,14 @@ window.__ModuleLoader__.load({
|
|
|
371
372
|
kpiOpenBugs: '{n} 个未关闭',
|
|
372
373
|
kpiReviewHint: '点击定位到评审列表',
|
|
373
374
|
kpiReviewClear: '暂无待评审',
|
|
375
|
+
viewList: '列表',
|
|
376
|
+
viewBoard: '看板',
|
|
377
|
+
boardEmpty: '暂无工作项',
|
|
378
|
+
moveTo: '移动状态',
|
|
379
|
+
moveTitle: '把 {serial} 移到',
|
|
380
|
+
moveEmpty: '没有可用的状态',
|
|
381
|
+
boardDropHint: '拖到这里改状态',
|
|
382
|
+
statusUnavailable: '这个工作项类型里没有该状态',
|
|
374
383
|
scopeMine: '我的',
|
|
375
384
|
scopeOrg: '组织',
|
|
376
385
|
scopeHintMine: '只看指派给我的工作项',
|
|
@@ -571,6 +580,14 @@ window.__ModuleLoader__.load({
|
|
|
571
580
|
kpiOpenBugs: '{n} still open',
|
|
572
581
|
kpiReviewHint: 'Click to jump to reviews',
|
|
573
582
|
kpiReviewClear: 'Nothing to review',
|
|
583
|
+
viewList: 'List',
|
|
584
|
+
viewBoard: 'Board',
|
|
585
|
+
boardEmpty: 'No items',
|
|
586
|
+
moveTo: 'Change status',
|
|
587
|
+
moveTitle: 'Move {serial} to',
|
|
588
|
+
moveEmpty: 'No status available',
|
|
589
|
+
boardDropHint: 'Drop here to change status',
|
|
590
|
+
statusUnavailable: 'That status is not part of this work item type',
|
|
574
591
|
scopeMine: 'Mine',
|
|
575
592
|
scopeOrg: 'Organization',
|
|
576
593
|
scopeHintMine: 'Only items assigned to me',
|
|
@@ -1011,6 +1028,46 @@ button.yx-bar-row:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
|
1011
1028
|
.yx-scope-btn[data-scope="org"][data-active="true"]{color:#8b5cf6;background:color-mix(in srgb,#8b5cf6 12%,var(--dsw-alias-bg-layer-1))}
|
|
1012
1029
|
.yx-scope-hint{font-size:11.5px;color:var(--dsw-alias-label-tertiary)}
|
|
1013
1030
|
.yx-work-assignee{flex:none;max-width:96px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0 6px;border-radius:999px;font-size:10.5px;line-height:16px;color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-bg-layer-3)}
|
|
1031
|
+
.yx-viewswitch{display:inline-flex;padding:2px;gap:2px;border:1px solid var(--dsw-alias-border-l2);border-radius:8px;background:var(--dsw-alias-bg-layer-2)}
|
|
1032
|
+
.yx-viewswitch-btn{height:24px;padding:0 10px;border:0;border-radius:6px;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:11.5px;cursor:pointer}
|
|
1033
|
+
.yx-viewswitch-btn[data-active="true"]{background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);font-weight:600;box-shadow:0 1px 3px rgba(0,0,0,.1)}
|
|
1034
|
+
.yx-work-lists--board{grid-template-columns:1fr}
|
|
1035
|
+
.yx-board{display:flex;gap:10px;overflow-x:auto;padding:2px 2px 10px;align-items:flex-start;min-height:160px}
|
|
1036
|
+
.yx-board-col{--tone:#94a3b8;flex:1 1 214px;min-width:196px;max-width:340px;display:flex;flex-direction:column;gap:8px;border:1px solid var(--dsw-alias-border-l1);border-radius:11px;background:var(--dsw-alias-bg-layer-2);padding:8px;min-height:120px;transition:border-color .15s ease,background .15s ease}
|
|
1037
|
+
.yx-board-col[data-over="true"]{border-color:var(--tone);background:color-mix(in srgb,var(--tone) 8%,var(--dsw-alias-bg-layer-2));box-shadow:0 0 0 2px color-mix(in srgb,var(--tone) 22%,transparent)}
|
|
1038
|
+
.yx-board-head{display:flex;align-items:center;gap:6px;padding:2px 2px 4px;min-width:0}
|
|
1039
|
+
.yx-board-dot{width:8px;height:8px;border-radius:50%;background:var(--tone);flex:none}
|
|
1040
|
+
.yx-board-name{flex:1;min-width:0;font-size:12px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
1041
|
+
.yx-board-count{font-size:11px;color:var(--dsw-alias-label-tertiary);background:var(--dsw-alias-bg-layer-1);border-radius:999px;padding:0 7px;line-height:18px}
|
|
1042
|
+
.yx-board-body{display:flex;flex-direction:column;gap:6px;min-height:24px;max-height:460px;overflow-y:auto;padding-right:2px}
|
|
1043
|
+
.yx-board-card{display:flex;flex-direction:column;gap:4px;width:100%;text-align:left;font:inherit;color:inherit;border:1px solid var(--dsw-alias-border-l1);border-radius:9px;background:var(--dsw-alias-bg-layer-1);padding:8px;cursor:grab;transition:border-color .12s ease,box-shadow .12s ease}
|
|
1044
|
+
.yx-board-card:hover{border-color:var(--dsw-alias-border-l4);box-shadow:0 2px 8px rgba(0,0,0,.06)}
|
|
1045
|
+
.yx-board-card:active{cursor:grabbing}
|
|
1046
|
+
.yx-board-card.is-done{opacity:.66}
|
|
1047
|
+
.yx-board-card-top{display:flex;align-items:center;gap:6px;min-width:0}
|
|
1048
|
+
.yx-board-kind{flex:none;padding:0 6px;border-radius:4px;font-size:10px;line-height:16px}
|
|
1049
|
+
.yx-board-subject{font-size:12px;line-height:17px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
|
|
1050
|
+
.yx-board-meta{display:flex;align-items:center;gap:6px;font-size:10.5px;color:var(--dsw-alias-label-tertiary);min-width:0}
|
|
1051
|
+
.yx-board-time{margin-left:auto;white-space:nowrap}
|
|
1052
|
+
.yx-board-assignee{font-size:10.5px;line-height:16px;padding:0 6px;border-radius:999px;background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-secondary);align-self:flex-start;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
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}
|
|
1054
|
+
.yx-board-drop-touch{display:none}
|
|
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}
|
|
1014
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}}
|
|
1015
1072
|
@media (max-width:760px){
|
|
1016
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}
|
|
@@ -2029,8 +2086,49 @@ button.yx-bar-row:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
|
2029
2086
|
})
|
|
2030
2087
|
}
|
|
2031
2088
|
|
|
2032
|
-
function WorkbenchPage({ t, state, data, error, onRetry, onRefresh, onOpenItem, refreshing, scope = 'mine', onScope }) {
|
|
2089
|
+
function WorkbenchPage({ t, state, data, error, onRetry, onRefresh, onOpenItem, refreshing, scope = 'mine', onScope, onMoveStatus, onLoadStatuses }) {
|
|
2033
2090
|
const isOrg = scope === 'org'
|
|
2091
|
+
const [layout, setLayout] = useState(() =>
|
|
2092
|
+
readStringStorage(WORKBENCH_VIEW_KEY) === 'board' ? 'board' : 'list',
|
|
2093
|
+
)
|
|
2094
|
+
const [dragId, setDragId] = useState('')
|
|
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
|
+
}, [])
|
|
2124
|
+
const switchLayout = useCallback((next) => {
|
|
2125
|
+
setLayout(next === 'board' ? 'board' : 'list')
|
|
2126
|
+
try {
|
|
2127
|
+
window.localStorage.setItem(WORKBENCH_VIEW_KEY, next === 'board' ? 'board' : 'list')
|
|
2128
|
+
} catch {
|
|
2129
|
+
// storage is optional
|
|
2130
|
+
}
|
|
2131
|
+
}, [])
|
|
2034
2132
|
const [statusFilter, setStatusFilter] = useState(null)
|
|
2035
2133
|
const [typeFilter, setTypeFilter] = useState(null)
|
|
2036
2134
|
const [projectFilter, setProjectFilter] = useState(null)
|
|
@@ -2277,6 +2375,21 @@ button.yx-bar-row:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
|
2277
2375
|
].filter(Boolean)
|
|
2278
2376
|
|
|
2279
2377
|
const firstDoneIndex = filteredItems.findIndex((item) => !isOpenItem(item))
|
|
2378
|
+
const boardColumns = (() => {
|
|
2379
|
+
const map = new Map()
|
|
2380
|
+
for (const item of filteredItems) {
|
|
2381
|
+
const name = item.status || '—'
|
|
2382
|
+
if (!map.has(name)) map.set(name, [])
|
|
2383
|
+
map.get(name).push(item)
|
|
2384
|
+
}
|
|
2385
|
+
return [...map.entries()]
|
|
2386
|
+
.map(([name, rows]) => ({ name, rows, tone: workTone(name) }))
|
|
2387
|
+
.sort(
|
|
2388
|
+
(left, right) =>
|
|
2389
|
+
TONE_ORDER.indexOf(left.tone) - TONE_ORDER.indexOf(right.tone) ||
|
|
2390
|
+
right.rows.length - left.rows.length,
|
|
2391
|
+
)
|
|
2392
|
+
})()
|
|
2280
2393
|
|
|
2281
2394
|
const heroSegments = TONE_ORDER.filter((tone) => toneCounts[tone]).map((tone) => ({
|
|
2282
2395
|
tone,
|
|
@@ -2495,7 +2608,7 @@ button.yx-bar-row:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
|
2495
2608
|
),
|
|
2496
2609
|
h(
|
|
2497
2610
|
'div',
|
|
2498
|
-
{ className: 'yx-work-lists' },
|
|
2611
|
+
{ className: `yx-work-lists${layout === 'board' ? ' yx-work-lists--board' : ''}` },
|
|
2499
2612
|
h(
|
|
2500
2613
|
'section',
|
|
2501
2614
|
{ className: 'yx-card yx-list-card' },
|
|
@@ -2518,9 +2631,181 @@ button.yx-bar-row:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
|
2518
2631
|
)
|
|
2519
2632
|
: null,
|
|
2520
2633
|
h('span', { className: 'yx-spacer' }),
|
|
2634
|
+
h(
|
|
2635
|
+
'span',
|
|
2636
|
+
{ className: 'yx-viewswitch', role: 'tablist' },
|
|
2637
|
+
['list', 'board'].map((mode) =>
|
|
2638
|
+
h(
|
|
2639
|
+
'button',
|
|
2640
|
+
{
|
|
2641
|
+
key: mode,
|
|
2642
|
+
type: 'button',
|
|
2643
|
+
role: 'tab',
|
|
2644
|
+
className: 'yx-viewswitch-btn',
|
|
2645
|
+
'data-active': String(layout === mode),
|
|
2646
|
+
'aria-selected': String(layout === mode),
|
|
2647
|
+
onClick: () => switchLayout(mode),
|
|
2648
|
+
},
|
|
2649
|
+
mode === 'board' ? t('viewBoard') : t('viewList'),
|
|
2650
|
+
),
|
|
2651
|
+
),
|
|
2652
|
+
),
|
|
2521
2653
|
hasFilter ? h('button', { className: 'yx-link-btn', onClick: clearFilters }, t('filterClear')) : null,
|
|
2522
2654
|
),
|
|
2523
|
-
filteredItems.length
|
|
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,
|
|
2674
|
+
filteredItems.length && layout === 'board'
|
|
2675
|
+
? h(
|
|
2676
|
+
'div',
|
|
2677
|
+
{ className: 'yx-board' },
|
|
2678
|
+
boardColumns.map((column) =>
|
|
2679
|
+
h(
|
|
2680
|
+
'section',
|
|
2681
|
+
{
|
|
2682
|
+
key: column.name,
|
|
2683
|
+
ref: (node) => {
|
|
2684
|
+
columnRefs.current[column.name] = node
|
|
2685
|
+
},
|
|
2686
|
+
className: 'yx-board-col',
|
|
2687
|
+
'data-over': String(overColumn === column.name),
|
|
2688
|
+
style: { '--tone': TONE_COLOR[column.tone] },
|
|
2689
|
+
onDragOver: (event) => {
|
|
2690
|
+
if (!onMoveStatus || !dragId) return
|
|
2691
|
+
event.preventDefault()
|
|
2692
|
+
if (overColumn !== column.name) setOverColumn(column.name)
|
|
2693
|
+
},
|
|
2694
|
+
onDragLeave: () =>
|
|
2695
|
+
setOverColumn((current) => (current === column.name ? '' : current)),
|
|
2696
|
+
onDrop: (event) => {
|
|
2697
|
+
if (!onMoveStatus) return
|
|
2698
|
+
event.preventDefault()
|
|
2699
|
+
const id = event.dataTransfer?.getData('text/plain') || dragId
|
|
2700
|
+
setOverColumn('')
|
|
2701
|
+
setDragId('')
|
|
2702
|
+
const item = filteredItems.find((row) => String(row.id) === String(id))
|
|
2703
|
+
if (!item || item.status === column.name) return
|
|
2704
|
+
onMoveStatus(item, column.name)
|
|
2705
|
+
},
|
|
2706
|
+
},
|
|
2707
|
+
h(
|
|
2708
|
+
'header',
|
|
2709
|
+
{ className: 'yx-board-head' },
|
|
2710
|
+
h('span', { className: 'yx-board-dot', 'aria-hidden': 'true' }),
|
|
2711
|
+
h('span', { className: 'yx-board-name', title: column.name }, column.name),
|
|
2712
|
+
h('span', { className: 'yx-board-count' }, String(column.rows.length)),
|
|
2713
|
+
),
|
|
2714
|
+
h(
|
|
2715
|
+
'div',
|
|
2716
|
+
{ className: 'yx-board-body' },
|
|
2717
|
+
column.rows.map((item) => {
|
|
2718
|
+
const kindColor = typeColor(item.workitemType || item.categoryId)
|
|
2719
|
+
return h(
|
|
2720
|
+
'button',
|
|
2721
|
+
{
|
|
2722
|
+
key: item.id,
|
|
2723
|
+
type: 'button',
|
|
2724
|
+
className: `yx-board-card${isOpenItem(item) ? '' : ' is-done'}`,
|
|
2725
|
+
draggable: Boolean(onMoveStatus),
|
|
2726
|
+
title: item.subject || '',
|
|
2727
|
+
onClick: () => onOpenItem(item),
|
|
2728
|
+
onDragStart: (event) => {
|
|
2729
|
+
setDragId(String(item.id))
|
|
2730
|
+
try {
|
|
2731
|
+
event.dataTransfer?.setData('text/plain', String(item.id))
|
|
2732
|
+
if (event.dataTransfer) event.dataTransfer.effectAllowed = 'move'
|
|
2733
|
+
} catch {
|
|
2734
|
+
// some browsers restrict the data store
|
|
2735
|
+
}
|
|
2736
|
+
},
|
|
2737
|
+
onDragEnd: () => {
|
|
2738
|
+
setDragId('')
|
|
2739
|
+
setOverColumn('')
|
|
2740
|
+
},
|
|
2741
|
+
},
|
|
2742
|
+
h(
|
|
2743
|
+
'span',
|
|
2744
|
+
{ className: 'yx-board-card-top yx-board-top' },
|
|
2745
|
+
h('span', { className: 'yx-serial' }, item.serialNumber),
|
|
2746
|
+
item.workitemType
|
|
2747
|
+
? h(
|
|
2748
|
+
'span',
|
|
2749
|
+
{
|
|
2750
|
+
className: 'yx-board-kind',
|
|
2751
|
+
style: { color: kindColor, background: tint(kindColor, 12) },
|
|
2752
|
+
},
|
|
2753
|
+
item.workitemType,
|
|
2754
|
+
)
|
|
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,
|
|
2772
|
+
),
|
|
2773
|
+
h('span', { className: 'yx-board-subject' }, item.subject || '-'),
|
|
2774
|
+
h(
|
|
2775
|
+
'span',
|
|
2776
|
+
{ className: 'yx-board-meta' },
|
|
2777
|
+
item.projectCode
|
|
2778
|
+
? h(
|
|
2779
|
+
'span',
|
|
2780
|
+
{
|
|
2781
|
+
className: 'yx-badge',
|
|
2782
|
+
style: {
|
|
2783
|
+
color: paletteColor(item.projectCode),
|
|
2784
|
+
borderColor: tint(paletteColor(item.projectCode), 45),
|
|
2785
|
+
background: tint(paletteColor(item.projectCode), 10),
|
|
2786
|
+
},
|
|
2787
|
+
},
|
|
2788
|
+
item.projectCode,
|
|
2789
|
+
)
|
|
2790
|
+
: null,
|
|
2791
|
+
h('span', { className: 'yx-board-time' }, relativeTime(t, item.gmtModified)),
|
|
2792
|
+
),
|
|
2793
|
+
isOrg ? h('span', { className: 'yx-board-assignee' }, assigneeOf(item)) : null,
|
|
2794
|
+
)
|
|
2795
|
+
}),
|
|
2796
|
+
column.rows.length === 0
|
|
2797
|
+
? h(
|
|
2798
|
+
'div',
|
|
2799
|
+
{ className: 'yx-board-drop' },
|
|
2800
|
+
h('span', { className: 'yx-board-drop-drag' }, t('boardDropHint')),
|
|
2801
|
+
h('span', { className: 'yx-board-drop-touch' }, t('boardEmpty')),
|
|
2802
|
+
)
|
|
2803
|
+
: null,
|
|
2804
|
+
),
|
|
2805
|
+
),
|
|
2806
|
+
),
|
|
2807
|
+
)
|
|
2808
|
+
: filteredItems.length
|
|
2524
2809
|
? h(
|
|
2525
2810
|
'div',
|
|
2526
2811
|
{ className: 'yx-work-list' },
|
|
@@ -2670,6 +2955,72 @@ button.yx-bar-row:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
|
2670
2955
|
),
|
|
2671
2956
|
),
|
|
2672
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,
|
|
2673
3024
|
)
|
|
2674
3025
|
}
|
|
2675
3026
|
|
|
@@ -3117,6 +3468,54 @@ button.yx-bar-row:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
|
3117
3468
|
[showToast, statusMutation, t],
|
|
3118
3469
|
)
|
|
3119
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
|
+
|
|
3489
|
+
const moveStatusByName = useCallback(
|
|
3490
|
+
async (item, statusName) => {
|
|
3491
|
+
const spaceId = item?.spaceId || item?.projectId || ''
|
|
3492
|
+
const typeId = item?.workitemTypeId || ''
|
|
3493
|
+
if (!spaceId || !typeId) {
|
|
3494
|
+
showToast(t('statusUnavailable'))
|
|
3495
|
+
return
|
|
3496
|
+
}
|
|
3497
|
+
try {
|
|
3498
|
+
const workflow = await queryClient.fetchQuery({
|
|
3499
|
+
queryKey: ['workflow', spaceId, typeId],
|
|
3500
|
+
queryFn: () =>
|
|
3501
|
+
getJson(
|
|
3502
|
+
`${API}/workflow?spaceId=${encodeURIComponent(spaceId)}&typeId=${encodeURIComponent(typeId)}`,
|
|
3503
|
+
),
|
|
3504
|
+
staleTime: 10 * 60_000,
|
|
3505
|
+
})
|
|
3506
|
+
const status = (workflow?.statuses ?? []).find((entry) => entry.name === statusName)
|
|
3507
|
+
if (!status) {
|
|
3508
|
+
showToast(t('statusUnavailable'))
|
|
3509
|
+
return
|
|
3510
|
+
}
|
|
3511
|
+
await changeStatus(item, status)
|
|
3512
|
+
} catch (error) {
|
|
3513
|
+
showToast(error?.message || t('errorGeneric'))
|
|
3514
|
+
}
|
|
3515
|
+
},
|
|
3516
|
+
[changeStatus, queryClient, showToast, t],
|
|
3517
|
+
)
|
|
3518
|
+
|
|
3120
3519
|
const repoDetailQuery = useQuery({
|
|
3121
3520
|
queryKey: ['repo-detail', viewRepo?.id ?? ''],
|
|
3122
3521
|
queryFn: () => getJson(`${API}/repo-detail?id=${encodeURIComponent(viewRepo?.id ?? '')}`),
|
|
@@ -5015,6 +5414,8 @@ button.yx-bar-row:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
|
5015
5414
|
refreshing,
|
|
5016
5415
|
scope: workScope,
|
|
5017
5416
|
onScope: switchWorkScope,
|
|
5417
|
+
onMoveStatus: moveStatusByName,
|
|
5418
|
+
onLoadStatuses: loadStatusesFor,
|
|
5018
5419
|
onOpenItem: (item) => openIssue(item, item.projectId),
|
|
5019
5420
|
})
|
|
5020
5421
|
: view === 'repo'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qzsy/dsh-yunxiao-panel",
|
|
3
|
-
"version": "1.
|
|
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: '暂无待评审', 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: '已关闭',
|
|
@@ -104,7 +104,10 @@ const workbenchData = {
|
|
|
104
104
|
me: { id: 'u1', name: 'abc' },
|
|
105
105
|
generatedAt: Date.now(),
|
|
106
106
|
projects: bootstrap.projects,
|
|
107
|
-
items: [
|
|
107
|
+
items: [
|
|
108
|
+
{ ...issues[0], spaceId: 'space-1', workitemTypeId: 'type-bug', projectId: 'space-1', projectCode: 'QXERP', projectName: '群兴跨境电商ERP' },
|
|
109
|
+
{ ...issues[1], status: '处理中', spaceId: 'space-1', workitemTypeId: 'type-bug', projectId: 'space-1', projectCode: 'QXERP', projectName: '群兴跨境电商ERP' },
|
|
110
|
+
],
|
|
108
111
|
prs: [{ ...prs[0], reviewers: ['abc'] }],
|
|
109
112
|
stats: {
|
|
110
113
|
total: 1,
|
|
@@ -217,7 +220,10 @@ global.fetch = async (input, init) => {
|
|
|
217
220
|
}
|
|
218
221
|
if (url.includes('/workitem-status') && method === 'POST') {
|
|
219
222
|
statusBody = JSON.parse(init.body)
|
|
220
|
-
|
|
223
|
+
const STATUS_NAMES = { '28': '待确认', '100010': '处理中', '29': '已修复', '100085': '已关闭' }
|
|
224
|
+
if (statusBody.id === 'w1') {
|
|
225
|
+
w1Status = { id: statusBody.statusId, name: STATUS_NAMES[statusBody.statusId] || '已修复' }
|
|
226
|
+
}
|
|
221
227
|
return json({ ...issues[0], workitemTypeId: 'type-bug', spaceId: 'space-1', statusId: w1Status.id, status: w1Status.name, comments: [] })
|
|
222
228
|
}
|
|
223
229
|
if (url.includes('/workitem?')) {
|
|
@@ -373,6 +379,66 @@ if (!activeKpi || !activeKpi.textContent.includes('全部工作项')) {
|
|
|
373
379
|
}
|
|
374
380
|
if (container.querySelector('.yx-work-filters .yx-chip')) throw new Error('filter chips remained after clearing')
|
|
375
381
|
|
|
382
|
+
// kanban mode: columns per status, dropping a card changes its status
|
|
383
|
+
const boardButton = [...container.querySelectorAll('.yx-viewswitch-btn')].find((button) =>
|
|
384
|
+
button.textContent.includes('看板'),
|
|
385
|
+
)
|
|
386
|
+
if (!boardButton) throw new Error('board toggle missing')
|
|
387
|
+
await act(async () => {
|
|
388
|
+
boardButton.dispatchEvent(new dom.window.MouseEvent('click', { bubbles: true }))
|
|
389
|
+
})
|
|
390
|
+
await flush()
|
|
391
|
+
const board = container.querySelector('.yx-board')
|
|
392
|
+
if (!board) throw new Error('board view did not render')
|
|
393
|
+
const boardColumns = [...board.querySelectorAll('.yx-board-col')]
|
|
394
|
+
if (boardColumns.length !== 2) throw new Error(`expected 2 board columns, got ${boardColumns.length}`)
|
|
395
|
+
const doingColumn = boardColumns.find((column) => column.textContent.includes('处理中'))
|
|
396
|
+
if (!doingColumn) throw new Error('status column missing')
|
|
397
|
+
const draggingCard = board.querySelector('.yx-board-card')
|
|
398
|
+
if (!draggingCard || draggingCard.getAttribute('draggable') !== 'true') {
|
|
399
|
+
throw new Error('board cards are not draggable')
|
|
400
|
+
}
|
|
401
|
+
const dropEvent = new dom.window.Event('drop', { bubbles: true, cancelable: true })
|
|
402
|
+
Object.defineProperty(dropEvent, 'dataTransfer', { value: { getData: () => 'w1' } })
|
|
403
|
+
await act(async () => {
|
|
404
|
+
doingColumn.dispatchEvent(dropEvent)
|
|
405
|
+
})
|
|
406
|
+
await flush()
|
|
407
|
+
if (!statusBody || statusBody.id !== 'w1' || statusBody.statusId !== '100010') {
|
|
408
|
+
throw new Error(`board drop sent the wrong status: ${JSON.stringify(statusBody)}`)
|
|
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
|
+
}
|
|
433
|
+
const listButton = [...container.querySelectorAll('.yx-viewswitch-btn')].find((button) =>
|
|
434
|
+
button.textContent === '列表',
|
|
435
|
+
)
|
|
436
|
+
await act(async () => {
|
|
437
|
+
listButton.dispatchEvent(new dom.window.MouseEvent('click', { bubbles: true }))
|
|
438
|
+
})
|
|
439
|
+
await flush()
|
|
440
|
+
if (!container.querySelector('.yx-work-list')) throw new Error('list view did not come back')
|
|
441
|
+
|
|
376
442
|
// the query cache is persisted to localStorage after a debounce
|
|
377
443
|
await act(async () => { await new Promise((resolve) => setTimeout(resolve, 850)) })
|
|
378
444
|
const persisted = dom.window.localStorage.getItem('dsh.yunxiao.queryCache.v2')
|
|
@@ -554,7 +620,7 @@ if (!text().includes('QXERP-63')) throw new Error('work items did not render aft
|
|
|
554
620
|
const workbenchCalls = () => calls.filter((entry) => entry.includes('/workbench')).length
|
|
555
621
|
const issueCalls = () =>
|
|
556
622
|
calls.filter((entry) => entry.includes('/workitems?spaceId=space-1')).length
|
|
557
|
-
|
|
623
|
+
const workbenchBeforeNav = workbenchCalls()
|
|
558
624
|
const issuesBefore = issueCalls()
|
|
559
625
|
const workbenchNav = [...container.querySelectorAll('.yx-nav-item')].find((button) =>
|
|
560
626
|
button.textContent.includes('我的工作台'),
|
|
@@ -564,7 +630,7 @@ await act(async () => {
|
|
|
564
630
|
})
|
|
565
631
|
await flush()
|
|
566
632
|
if (!container.querySelector('.yx-work')) throw new Error('workbench did not come back from cache')
|
|
567
|
-
if (workbenchCalls() !==
|
|
633
|
+
if (workbenchCalls() !== workbenchBeforeNav) throw new Error('workbench was refetched within staleTime')
|
|
568
634
|
const projectAgain = [...container.querySelectorAll('.yx-nav-item')].find((button) =>
|
|
569
635
|
button.textContent.includes('群兴跨境电商ERP'),
|
|
570
636
|
)
|