@qzsy/dsh-yunxiao-panel 1.2.0 → 1.3.0
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 +65 -27
- package/dist/client.js +232 -3
- package/package.json +1 -1
- package/test/render-test.mjs +46 -5
package/README.md
CHANGED
|
@@ -24,19 +24,37 @@ and a repository chip row for its merge requests.
|
|
|
24
24
|
dynamic-programming fuzzy match): full pinyin (`qunxing`), pinyin initials
|
|
25
25
|
(`qxkj`), project codes (`QXERP`), and mixed forms all match, and the hit
|
|
26
26
|
ranges are highlighted in the rows.
|
|
27
|
-
- **我的工作台** —
|
|
28
|
-
|
|
29
|
-
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
- **我的工作台** — a cross-project workbench with two scopes, switched at the top
|
|
28
|
+
and remembered per browser:
|
|
29
|
+
- **我的** aggregates the work items assigned to the token's user; **组织** drops
|
|
30
|
+
that filter and covers every open item in the organization (up to 400, open
|
|
31
|
+
ones first), so an organization manager can triage work unrelated to them.
|
|
32
|
+
- a hero card with a status ring (completion in the middle), a plain-language
|
|
33
|
+
summary, and a **优先处理** row that picks the most urgent open item (bugs
|
|
34
|
+
first) and opens it in one click,
|
|
35
|
+
- four clickable KPI cards (**全部工作项 / 未完成 / 缺陷 / 待评审**), then status,
|
|
36
|
+
project, type and trend charts whose **bars, slices and legends filter the
|
|
37
|
+
list**; organization scope adds a **按负责人** chart,
|
|
34
38
|
- a scrollable **work-item list** (serial, project code + **Chinese project
|
|
35
|
-
name**, type, status, relative time) with
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
name**, assignee in organization scope, type, status, relative time) with
|
|
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,
|
|
46
|
+
- merge requests waiting for review (all open ones in organization scope), with
|
|
47
|
+
a direct link to Yunxiao when the list is empty.
|
|
48
|
+
- **Change status from the detail pane** — the pane shows the current status, a
|
|
49
|
+
dropdown of the whole workflow for that work item type, and a **标记完成**
|
|
50
|
+
button that picks the type's own done status (缺陷 → 已修复, 需求 → 已完成, else
|
|
51
|
+
已关闭). The item is repainted in the detail, every project list and the
|
|
52
|
+
workbench (including its status chart) before the request returns, and a
|
|
53
|
+
failure rolls every snapshot back.
|
|
54
|
+
- **在对话中处理** opens a workspace picker first: it lists the local DSH
|
|
55
|
+
workspaces (suggesting the one whose name matches the repository or project),
|
|
56
|
+
remembers the choice per Yunxiao project, and shows it on the button so the
|
|
57
|
+
next handoff is a single click with a **切换** action beside it.
|
|
40
58
|
- **Repository page** — clicking any repository (in the repository list or under
|
|
41
59
|
**未绑定的仓库**) opens its own page with four tabs:
|
|
42
60
|
**概览 / 提交 / 工作项 / 合并请求**.
|
|
@@ -100,6 +118,7 @@ The panel is usable down to phone widths (≤ 760 px):
|
|
|
100
118
|
- the left menu becomes a **drawer** behind a hamburger button in a compact top
|
|
101
119
|
bar; it slides in with a scrim and closes on navigation, scrim click or Escape;
|
|
102
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;
|
|
103
122
|
- unbound repositories render as a single-column card list;
|
|
104
123
|
- the work-item detail pane becomes a full-width overlay with its own close
|
|
105
124
|
button, and dialogs use the full width with a scrollable body;
|
|
@@ -124,23 +143,29 @@ while it revalidates in the background.
|
|
|
124
143
|
| Data | Query key | staleTime | gcTime |
|
|
125
144
|
|---|---|---|---|
|
|
126
145
|
| bootstrap (repos / namespaces / projects) | `['bootstrap']` | 30s | 10min |
|
|
127
|
-
| workbench aggregation | `['workbench']` |
|
|
146
|
+
| workbench aggregation (per scope) | `['workbench', scope]` | 30s (+90s poll while visible) | 10min |
|
|
128
147
|
| work items page | `['workitems', spaceId, category]` | 30s | 10min |
|
|
129
148
|
| merge requests page | `['prs', repoId, state]` | 30s | 10min |
|
|
130
|
-
| one work item | `['workitem', id]` |
|
|
149
|
+
| one work item | `['workitem', id]` | 15s | 10min |
|
|
150
|
+
| workflow statuses | `['workflow', spaceId, typeId]` | 10min | 10min |
|
|
151
|
+
| repository detail / activity | `['repo-detail' | 'repo-activity', …]` | 2min | 10min |
|
|
152
|
+
| DSH workspaces | `['workspaces']` | 60s | 10min |
|
|
131
153
|
| types / members / me | `['workitem-types' | 'members' | 'me', …]` | 5min | 10min |
|
|
132
154
|
|
|
133
155
|
- Window focus and reconnect revalidate stale queries (`refetchOnWindowFocus`).
|
|
134
|
-
- **刷新**
|
|
135
|
-
|
|
136
|
-
-
|
|
137
|
-
|
|
138
|
-
|
|
156
|
+
- **刷新** clears the Host cache, drops the localStorage snapshot, resets every
|
|
157
|
+
query, and tells other open tabs to refresh too.
|
|
158
|
+
- A status write paints the new status into the detail, every project list and the
|
|
159
|
+
workbench immediately, broadcasts it to other tabs, and rolls back on failure.
|
|
160
|
+
- The Host keeps its own short-lived cache and **overlays recent status writes on
|
|
161
|
+
stale search results** for 3 minutes, so a list refetched right after a write
|
|
162
|
+
cannot resurrect the old status.
|
|
139
163
|
- **localStorage persistence**: 700ms after the cache changes, the freshest
|
|
140
|
-
successful queries are snapshotted under `dsh.yunxiao.queryCache.
|
|
141
|
-
(2 MB cap, largest entries skipped, failures clear the snapshot).
|
|
142
|
-
|
|
143
|
-
|
|
164
|
+
successful queries are snapshotted under `dsh.yunxiao.queryCache.v2`
|
|
165
|
+
(2 MB cap, largest entries skipped, failures clear the snapshot). Snapshots
|
|
166
|
+
older than 24 hours are discarded on load; the v1 key is removed automatically.
|
|
167
|
+
Hydrated data keeps its original `updatedAt`, so the first paint after a reload
|
|
168
|
+
is instant and a background revalidation follows when the data is stale.
|
|
144
169
|
- The bundle is generated by `scripts/sync-vendor-query.mjs` from
|
|
145
170
|
`vendor/react-query.min.cjs` (React stays external and resolves through the
|
|
146
171
|
host module table); the license is kept at `vendor/react-query.LICENSE`.
|
|
@@ -154,7 +179,7 @@ loopback-only same-origin facade at `/api/yunxiao`:
|
|
|
154
179
|
|---|---|
|
|
155
180
|
| `GET /bootstrap` | repositories (all pages), namespaces, projects, connection state |
|
|
156
181
|
| `GET /repos?page&search` | one page of repositories |
|
|
157
|
-
| `GET /workbench` | cross-project aggregation:
|
|
182
|
+
| `GET /workbench?scope=mine\|org` | cross-project aggregation: items, stats, reviews per scope |
|
|
158
183
|
| `GET /repo-detail?id` | repository detail + decoded root README |
|
|
159
184
|
| `GET /repo-activity?id&ref` | recent commits + contributors (avatars) |
|
|
160
185
|
| `GET /file?repoId&ref&path` | raw file bytes (README images, relative links) |
|
|
@@ -165,6 +190,9 @@ loopback-only same-origin facade at `/api/yunxiao`:
|
|
|
165
190
|
| `GET /members?spaceId` | project members for the assignee picker |
|
|
166
191
|
| `GET /me` | the user behind the personal access token |
|
|
167
192
|
| `POST /workitems` | create a work item (`ProjexCreateWorkitem`) |
|
|
193
|
+
| `GET /workflow?spaceId&typeId` | workflow statuses of a work item type |
|
|
194
|
+
| `POST /workitem-status` | move a work item to another status (`PUT /workitems/{id}`) |
|
|
195
|
+
| `GET /workspaces` | local DSH workspaces for the chat handoff picker |
|
|
168
196
|
| `GET /prs?repoId&state&page` | `codeup .../changeRequests` |
|
|
169
197
|
| `GET /status` | token / organization presence |
|
|
170
198
|
| `POST /refresh` | drop the short-lived cache |
|
|
@@ -187,14 +215,24 @@ Published on npm as **`@qzsy/dsh-yunxiao-panel`**. Install it from the Harness
|
|
|
187
215
|
Plugin Manager by package name, or during development install this directory
|
|
188
216
|
with `plugin_manager install_bundle` (absolute package directory).
|
|
189
217
|
|
|
190
|
-
|
|
191
|
-
|
|
218
|
+
Each person needs their own Yunxiao personal access token in the environment
|
|
219
|
+
(see *Data path*); the panel never ships a credential. The token needs Codeup
|
|
220
|
+
read access and Projex read/write access (to change status and create work
|
|
221
|
+
items). After installation and setting the environment variables, restart the
|
|
222
|
+
Harness and reload the Web page; the 云效 icon appears in the left rail between
|
|
223
|
+
the command palette and the Git entry.
|
|
224
|
+
|
|
225
|
+
Project↔repository bindings, the remembered chat workspace and the workbench
|
|
226
|
+
scope live in the browser's local storage, so each teammate binds and picks once
|
|
227
|
+
per browser.
|
|
192
228
|
|
|
193
229
|
## Test
|
|
194
230
|
|
|
195
231
|
The browser half has a jsdom render test that mounts the real component against
|
|
196
232
|
a mocked facade and exercises repository switching, the unbound-project state,
|
|
197
|
-
the work-item list and detail pane,
|
|
233
|
+
the work-item list and detail pane, status changes (including the list repaint),
|
|
234
|
+
the chat handoff with its workspace picker and remembered choice, the workbench
|
|
235
|
+
scopes, and the merge-request tab.
|
|
198
236
|
|
|
199
237
|
```bash
|
|
200
238
|
npm install --no-save react@18 react-dom@18 jsdom@24
|
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,11 @@ window.__ModuleLoader__.load({
|
|
|
371
372
|
kpiOpenBugs: '{n} 个未关闭',
|
|
372
373
|
kpiReviewHint: '点击定位到评审列表',
|
|
373
374
|
kpiReviewClear: '暂无待评审',
|
|
375
|
+
viewList: '列表',
|
|
376
|
+
viewBoard: '看板',
|
|
377
|
+
boardEmpty: '暂无工作项',
|
|
378
|
+
boardDropHint: '拖到这里改状态',
|
|
379
|
+
statusUnavailable: '这个工作项类型里没有该状态',
|
|
374
380
|
scopeMine: '我的',
|
|
375
381
|
scopeOrg: '组织',
|
|
376
382
|
scopeHintMine: '只看指派给我的工作项',
|
|
@@ -571,6 +577,11 @@ window.__ModuleLoader__.load({
|
|
|
571
577
|
kpiOpenBugs: '{n} still open',
|
|
572
578
|
kpiReviewHint: 'Click to jump to reviews',
|
|
573
579
|
kpiReviewClear: 'Nothing to review',
|
|
580
|
+
viewList: 'List',
|
|
581
|
+
viewBoard: 'Board',
|
|
582
|
+
boardEmpty: 'No items',
|
|
583
|
+
boardDropHint: 'Drop here to change status',
|
|
584
|
+
statusUnavailable: 'That status is not part of this work item type',
|
|
574
585
|
scopeMine: 'Mine',
|
|
575
586
|
scopeOrg: 'Organization',
|
|
576
587
|
scopeHintMine: 'Only items assigned to me',
|
|
@@ -1011,6 +1022,31 @@ button.yx-bar-row:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
|
1011
1022
|
.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
1023
|
.yx-scope-hint{font-size:11.5px;color:var(--dsw-alias-label-tertiary)}
|
|
1013
1024
|
.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)}
|
|
1025
|
+
.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)}
|
|
1026
|
+
.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}
|
|
1027
|
+
.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)}
|
|
1028
|
+
.yx-work-lists--board{grid-template-columns:1fr}
|
|
1029
|
+
.yx-board{display:flex;gap:10px;overflow-x:auto;padding:2px 2px 10px;align-items:flex-start;min-height:160px}
|
|
1030
|
+
.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}
|
|
1031
|
+
.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)}
|
|
1032
|
+
.yx-board-head{display:flex;align-items:center;gap:6px;padding:2px 2px 4px;min-width:0}
|
|
1033
|
+
.yx-board-dot{width:8px;height:8px;border-radius:50%;background:var(--tone);flex:none}
|
|
1034
|
+
.yx-board-name{flex:1;min-width:0;font-size:12px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
1035
|
+
.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}
|
|
1036
|
+
.yx-board-body{display:flex;flex-direction:column;gap:6px;min-height:24px;max-height:460px;overflow-y:auto;padding-right:2px}
|
|
1037
|
+
.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}
|
|
1038
|
+
.yx-board-card:hover{border-color:var(--dsw-alias-border-l4);box-shadow:0 2px 8px rgba(0,0,0,.06)}
|
|
1039
|
+
.yx-board-card:active{cursor:grabbing}
|
|
1040
|
+
.yx-board-card.is-done{opacity:.66}
|
|
1041
|
+
.yx-board-card-top{display:flex;align-items:center;gap:6px;min-width:0}
|
|
1042
|
+
.yx-board-kind{flex:none;padding:0 6px;border-radius:4px;font-size:10px;line-height:16px}
|
|
1043
|
+
.yx-board-subject{font-size:12px;line-height:17px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
|
|
1044
|
+
.yx-board-meta{display:flex;align-items:center;gap:6px;font-size:10.5px;color:var(--dsw-alias-label-tertiary);min-width:0}
|
|
1045
|
+
.yx-board-time{margin-left:auto;white-space:nowrap}
|
|
1046
|
+
.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}
|
|
1047
|
+
.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
|
+
.yx-board-drop-touch{display:none}
|
|
1049
|
+
@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}}
|
|
1014
1050
|
@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
1051
|
@media (max-width:760px){
|
|
1016
1052
|
.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 +2065,21 @@ button.yx-bar-row:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
|
2029
2065
|
})
|
|
2030
2066
|
}
|
|
2031
2067
|
|
|
2032
|
-
function WorkbenchPage({ t, state, data, error, onRetry, onRefresh, onOpenItem, refreshing, scope = 'mine', onScope }) {
|
|
2068
|
+
function WorkbenchPage({ t, state, data, error, onRetry, onRefresh, onOpenItem, refreshing, scope = 'mine', onScope, onMoveStatus }) {
|
|
2033
2069
|
const isOrg = scope === 'org'
|
|
2070
|
+
const [layout, setLayout] = useState(() =>
|
|
2071
|
+
readStringStorage(WORKBENCH_VIEW_KEY) === 'board' ? 'board' : 'list',
|
|
2072
|
+
)
|
|
2073
|
+
const [dragId, setDragId] = useState('')
|
|
2074
|
+
const [overColumn, setOverColumn] = useState('')
|
|
2075
|
+
const switchLayout = useCallback((next) => {
|
|
2076
|
+
setLayout(next === 'board' ? 'board' : 'list')
|
|
2077
|
+
try {
|
|
2078
|
+
window.localStorage.setItem(WORKBENCH_VIEW_KEY, next === 'board' ? 'board' : 'list')
|
|
2079
|
+
} catch {
|
|
2080
|
+
// storage is optional
|
|
2081
|
+
}
|
|
2082
|
+
}, [])
|
|
2034
2083
|
const [statusFilter, setStatusFilter] = useState(null)
|
|
2035
2084
|
const [typeFilter, setTypeFilter] = useState(null)
|
|
2036
2085
|
const [projectFilter, setProjectFilter] = useState(null)
|
|
@@ -2277,6 +2326,21 @@ button.yx-bar-row:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
|
2277
2326
|
].filter(Boolean)
|
|
2278
2327
|
|
|
2279
2328
|
const firstDoneIndex = filteredItems.findIndex((item) => !isOpenItem(item))
|
|
2329
|
+
const boardColumns = (() => {
|
|
2330
|
+
const map = new Map()
|
|
2331
|
+
for (const item of filteredItems) {
|
|
2332
|
+
const name = item.status || '—'
|
|
2333
|
+
if (!map.has(name)) map.set(name, [])
|
|
2334
|
+
map.get(name).push(item)
|
|
2335
|
+
}
|
|
2336
|
+
return [...map.entries()]
|
|
2337
|
+
.map(([name, rows]) => ({ name, rows, tone: workTone(name) }))
|
|
2338
|
+
.sort(
|
|
2339
|
+
(left, right) =>
|
|
2340
|
+
TONE_ORDER.indexOf(left.tone) - TONE_ORDER.indexOf(right.tone) ||
|
|
2341
|
+
right.rows.length - left.rows.length,
|
|
2342
|
+
)
|
|
2343
|
+
})()
|
|
2280
2344
|
|
|
2281
2345
|
const heroSegments = TONE_ORDER.filter((tone) => toneCounts[tone]).map((tone) => ({
|
|
2282
2346
|
tone,
|
|
@@ -2495,7 +2559,7 @@ button.yx-bar-row:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
|
2495
2559
|
),
|
|
2496
2560
|
h(
|
|
2497
2561
|
'div',
|
|
2498
|
-
{ className: 'yx-work-lists' },
|
|
2562
|
+
{ className: `yx-work-lists${layout === 'board' ? ' yx-work-lists--board' : ''}` },
|
|
2499
2563
|
h(
|
|
2500
2564
|
'section',
|
|
2501
2565
|
{ className: 'yx-card yx-list-card' },
|
|
@@ -2518,9 +2582,143 @@ button.yx-bar-row:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
|
2518
2582
|
)
|
|
2519
2583
|
: null,
|
|
2520
2584
|
h('span', { className: 'yx-spacer' }),
|
|
2585
|
+
h(
|
|
2586
|
+
'span',
|
|
2587
|
+
{ className: 'yx-viewswitch', role: 'tablist' },
|
|
2588
|
+
['list', 'board'].map((mode) =>
|
|
2589
|
+
h(
|
|
2590
|
+
'button',
|
|
2591
|
+
{
|
|
2592
|
+
key: mode,
|
|
2593
|
+
type: 'button',
|
|
2594
|
+
role: 'tab',
|
|
2595
|
+
className: 'yx-viewswitch-btn',
|
|
2596
|
+
'data-active': String(layout === mode),
|
|
2597
|
+
'aria-selected': String(layout === mode),
|
|
2598
|
+
onClick: () => switchLayout(mode),
|
|
2599
|
+
},
|
|
2600
|
+
mode === 'board' ? t('viewBoard') : t('viewList'),
|
|
2601
|
+
),
|
|
2602
|
+
),
|
|
2603
|
+
),
|
|
2521
2604
|
hasFilter ? h('button', { className: 'yx-link-btn', onClick: clearFilters }, t('filterClear')) : null,
|
|
2522
2605
|
),
|
|
2523
|
-
filteredItems.length
|
|
2606
|
+
filteredItems.length && layout === 'board'
|
|
2607
|
+
? h(
|
|
2608
|
+
'div',
|
|
2609
|
+
{ className: 'yx-board' },
|
|
2610
|
+
boardColumns.map((column) =>
|
|
2611
|
+
h(
|
|
2612
|
+
'section',
|
|
2613
|
+
{
|
|
2614
|
+
key: column.name,
|
|
2615
|
+
className: 'yx-board-col',
|
|
2616
|
+
'data-over': String(overColumn === column.name),
|
|
2617
|
+
style: { '--tone': TONE_COLOR[column.tone] },
|
|
2618
|
+
onDragOver: (event) => {
|
|
2619
|
+
if (!onMoveStatus || !dragId) return
|
|
2620
|
+
event.preventDefault()
|
|
2621
|
+
if (overColumn !== column.name) setOverColumn(column.name)
|
|
2622
|
+
},
|
|
2623
|
+
onDragLeave: () =>
|
|
2624
|
+
setOverColumn((current) => (current === column.name ? '' : current)),
|
|
2625
|
+
onDrop: (event) => {
|
|
2626
|
+
if (!onMoveStatus) return
|
|
2627
|
+
event.preventDefault()
|
|
2628
|
+
const id = event.dataTransfer?.getData('text/plain') || dragId
|
|
2629
|
+
setOverColumn('')
|
|
2630
|
+
setDragId('')
|
|
2631
|
+
const item = filteredItems.find((row) => String(row.id) === String(id))
|
|
2632
|
+
if (!item || item.status === column.name) return
|
|
2633
|
+
onMoveStatus(item, column.name)
|
|
2634
|
+
},
|
|
2635
|
+
},
|
|
2636
|
+
h(
|
|
2637
|
+
'header',
|
|
2638
|
+
{ className: 'yx-board-head' },
|
|
2639
|
+
h('span', { className: 'yx-board-dot', 'aria-hidden': 'true' }),
|
|
2640
|
+
h('span', { className: 'yx-board-name', title: column.name }, column.name),
|
|
2641
|
+
h('span', { className: 'yx-board-count' }, String(column.rows.length)),
|
|
2642
|
+
),
|
|
2643
|
+
h(
|
|
2644
|
+
'div',
|
|
2645
|
+
{ className: 'yx-board-body' },
|
|
2646
|
+
column.rows.map((item) => {
|
|
2647
|
+
const kindColor = typeColor(item.workitemType || item.categoryId)
|
|
2648
|
+
return h(
|
|
2649
|
+
'button',
|
|
2650
|
+
{
|
|
2651
|
+
key: item.id,
|
|
2652
|
+
type: 'button',
|
|
2653
|
+
className: `yx-board-card${isOpenItem(item) ? '' : ' is-done'}`,
|
|
2654
|
+
draggable: Boolean(onMoveStatus),
|
|
2655
|
+
title: item.subject || '',
|
|
2656
|
+
onClick: () => onOpenItem(item),
|
|
2657
|
+
onDragStart: (event) => {
|
|
2658
|
+
setDragId(String(item.id))
|
|
2659
|
+
try {
|
|
2660
|
+
event.dataTransfer?.setData('text/plain', String(item.id))
|
|
2661
|
+
if (event.dataTransfer) event.dataTransfer.effectAllowed = 'move'
|
|
2662
|
+
} catch {
|
|
2663
|
+
// some browsers restrict the data store
|
|
2664
|
+
}
|
|
2665
|
+
},
|
|
2666
|
+
onDragEnd: () => {
|
|
2667
|
+
setDragId('')
|
|
2668
|
+
setOverColumn('')
|
|
2669
|
+
},
|
|
2670
|
+
},
|
|
2671
|
+
h(
|
|
2672
|
+
'span',
|
|
2673
|
+
{ className: 'yx-board-card-top' },
|
|
2674
|
+
h('span', { className: 'yx-serial' }, item.serialNumber),
|
|
2675
|
+
item.workitemType
|
|
2676
|
+
? h(
|
|
2677
|
+
'span',
|
|
2678
|
+
{
|
|
2679
|
+
className: 'yx-board-kind',
|
|
2680
|
+
style: { color: kindColor, background: tint(kindColor, 12) },
|
|
2681
|
+
},
|
|
2682
|
+
item.workitemType,
|
|
2683
|
+
)
|
|
2684
|
+
: null,
|
|
2685
|
+
),
|
|
2686
|
+
h('span', { className: 'yx-board-subject' }, item.subject || '-'),
|
|
2687
|
+
h(
|
|
2688
|
+
'span',
|
|
2689
|
+
{ className: 'yx-board-meta' },
|
|
2690
|
+
item.projectCode
|
|
2691
|
+
? h(
|
|
2692
|
+
'span',
|
|
2693
|
+
{
|
|
2694
|
+
className: 'yx-badge',
|
|
2695
|
+
style: {
|
|
2696
|
+
color: paletteColor(item.projectCode),
|
|
2697
|
+
borderColor: tint(paletteColor(item.projectCode), 45),
|
|
2698
|
+
background: tint(paletteColor(item.projectCode), 10),
|
|
2699
|
+
},
|
|
2700
|
+
},
|
|
2701
|
+
item.projectCode,
|
|
2702
|
+
)
|
|
2703
|
+
: null,
|
|
2704
|
+
h('span', { className: 'yx-board-time' }, relativeTime(t, item.gmtModified)),
|
|
2705
|
+
),
|
|
2706
|
+
isOrg ? h('span', { className: 'yx-board-assignee' }, assigneeOf(item)) : null,
|
|
2707
|
+
)
|
|
2708
|
+
}),
|
|
2709
|
+
column.rows.length === 0
|
|
2710
|
+
? h(
|
|
2711
|
+
'div',
|
|
2712
|
+
{ className: 'yx-board-drop' },
|
|
2713
|
+
h('span', { className: 'yx-board-drop-drag' }, t('boardDropHint')),
|
|
2714
|
+
h('span', { className: 'yx-board-drop-touch' }, t('boardEmpty')),
|
|
2715
|
+
)
|
|
2716
|
+
: null,
|
|
2717
|
+
),
|
|
2718
|
+
),
|
|
2719
|
+
),
|
|
2720
|
+
)
|
|
2721
|
+
: filteredItems.length
|
|
2524
2722
|
? h(
|
|
2525
2723
|
'div',
|
|
2526
2724
|
{ className: 'yx-work-list' },
|
|
@@ -3117,6 +3315,36 @@ button.yx-bar-row:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
|
3117
3315
|
[showToast, statusMutation, t],
|
|
3118
3316
|
)
|
|
3119
3317
|
|
|
3318
|
+
const moveStatusByName = useCallback(
|
|
3319
|
+
async (item, statusName) => {
|
|
3320
|
+
const spaceId = item?.spaceId || item?.projectId || ''
|
|
3321
|
+
const typeId = item?.workitemTypeId || ''
|
|
3322
|
+
if (!spaceId || !typeId) {
|
|
3323
|
+
showToast(t('statusUnavailable'))
|
|
3324
|
+
return
|
|
3325
|
+
}
|
|
3326
|
+
try {
|
|
3327
|
+
const workflow = await queryClient.fetchQuery({
|
|
3328
|
+
queryKey: ['workflow', spaceId, typeId],
|
|
3329
|
+
queryFn: () =>
|
|
3330
|
+
getJson(
|
|
3331
|
+
`${API}/workflow?spaceId=${encodeURIComponent(spaceId)}&typeId=${encodeURIComponent(typeId)}`,
|
|
3332
|
+
),
|
|
3333
|
+
staleTime: 10 * 60_000,
|
|
3334
|
+
})
|
|
3335
|
+
const status = (workflow?.statuses ?? []).find((entry) => entry.name === statusName)
|
|
3336
|
+
if (!status) {
|
|
3337
|
+
showToast(t('statusUnavailable'))
|
|
3338
|
+
return
|
|
3339
|
+
}
|
|
3340
|
+
await changeStatus(item, status)
|
|
3341
|
+
} catch (error) {
|
|
3342
|
+
showToast(error?.message || t('errorGeneric'))
|
|
3343
|
+
}
|
|
3344
|
+
},
|
|
3345
|
+
[changeStatus, queryClient, showToast, t],
|
|
3346
|
+
)
|
|
3347
|
+
|
|
3120
3348
|
const repoDetailQuery = useQuery({
|
|
3121
3349
|
queryKey: ['repo-detail', viewRepo?.id ?? ''],
|
|
3122
3350
|
queryFn: () => getJson(`${API}/repo-detail?id=${encodeURIComponent(viewRepo?.id ?? '')}`),
|
|
@@ -5015,6 +5243,7 @@ button.yx-bar-row:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
|
5015
5243
|
refreshing,
|
|
5016
5244
|
scope: workScope,
|
|
5017
5245
|
onScope: switchWorkScope,
|
|
5246
|
+
onMoveStatus: moveStatusByName,
|
|
5018
5247
|
onOpenItem: (item) => openIssue(item, item.projectId),
|
|
5019
5248
|
})
|
|
5020
5249
|
: 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.0",
|
|
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: '这个类型没有该状态', 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,8 @@ 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
|
+
w1Status = { id: statusBody.statusId, name: STATUS_NAMES[statusBody.statusId] || '已修复' }
|
|
221
225
|
return json({ ...issues[0], workitemTypeId: 'type-bug', spaceId: 'space-1', statusId: w1Status.id, status: w1Status.name, comments: [] })
|
|
222
226
|
}
|
|
223
227
|
if (url.includes('/workitem?')) {
|
|
@@ -373,6 +377,43 @@ if (!activeKpi || !activeKpi.textContent.includes('全部工作项')) {
|
|
|
373
377
|
}
|
|
374
378
|
if (container.querySelector('.yx-work-filters .yx-chip')) throw new Error('filter chips remained after clearing')
|
|
375
379
|
|
|
380
|
+
// kanban mode: columns per status, dropping a card changes its status
|
|
381
|
+
const boardButton = [...container.querySelectorAll('.yx-viewswitch-btn')].find((button) =>
|
|
382
|
+
button.textContent.includes('看板'),
|
|
383
|
+
)
|
|
384
|
+
if (!boardButton) throw new Error('board toggle missing')
|
|
385
|
+
await act(async () => {
|
|
386
|
+
boardButton.dispatchEvent(new dom.window.MouseEvent('click', { bubbles: true }))
|
|
387
|
+
})
|
|
388
|
+
await flush()
|
|
389
|
+
const board = container.querySelector('.yx-board')
|
|
390
|
+
if (!board) throw new Error('board view did not render')
|
|
391
|
+
const boardColumns = [...board.querySelectorAll('.yx-board-col')]
|
|
392
|
+
if (boardColumns.length !== 2) throw new Error(`expected 2 board columns, got ${boardColumns.length}`)
|
|
393
|
+
const doingColumn = boardColumns.find((column) => column.textContent.includes('处理中'))
|
|
394
|
+
if (!doingColumn) throw new Error('status column missing')
|
|
395
|
+
const draggingCard = board.querySelector('.yx-board-card')
|
|
396
|
+
if (!draggingCard || draggingCard.getAttribute('draggable') !== 'true') {
|
|
397
|
+
throw new Error('board cards are not draggable')
|
|
398
|
+
}
|
|
399
|
+
const dropEvent = new dom.window.Event('drop', { bubbles: true, cancelable: true })
|
|
400
|
+
Object.defineProperty(dropEvent, 'dataTransfer', { value: { getData: () => 'w1' } })
|
|
401
|
+
await act(async () => {
|
|
402
|
+
doingColumn.dispatchEvent(dropEvent)
|
|
403
|
+
})
|
|
404
|
+
await flush()
|
|
405
|
+
if (!statusBody || statusBody.id !== 'w1' || statusBody.statusId !== '100010') {
|
|
406
|
+
throw new Error(`board drop sent the wrong status: ${JSON.stringify(statusBody)}`)
|
|
407
|
+
}
|
|
408
|
+
const listButton = [...container.querySelectorAll('.yx-viewswitch-btn')].find((button) =>
|
|
409
|
+
button.textContent === '列表',
|
|
410
|
+
)
|
|
411
|
+
await act(async () => {
|
|
412
|
+
listButton.dispatchEvent(new dom.window.MouseEvent('click', { bubbles: true }))
|
|
413
|
+
})
|
|
414
|
+
await flush()
|
|
415
|
+
if (!container.querySelector('.yx-work-list')) throw new Error('list view did not come back')
|
|
416
|
+
|
|
376
417
|
// the query cache is persisted to localStorage after a debounce
|
|
377
418
|
await act(async () => { await new Promise((resolve) => setTimeout(resolve, 850)) })
|
|
378
419
|
const persisted = dom.window.localStorage.getItem('dsh.yunxiao.queryCache.v2')
|
|
@@ -554,7 +595,7 @@ if (!text().includes('QXERP-63')) throw new Error('work items did not render aft
|
|
|
554
595
|
const workbenchCalls = () => calls.filter((entry) => entry.includes('/workbench')).length
|
|
555
596
|
const issueCalls = () =>
|
|
556
597
|
calls.filter((entry) => entry.includes('/workitems?spaceId=space-1')).length
|
|
557
|
-
|
|
598
|
+
const workbenchBeforeNav = workbenchCalls()
|
|
558
599
|
const issuesBefore = issueCalls()
|
|
559
600
|
const workbenchNav = [...container.querySelectorAll('.yx-nav-item')].find((button) =>
|
|
560
601
|
button.textContent.includes('我的工作台'),
|
|
@@ -564,7 +605,7 @@ await act(async () => {
|
|
|
564
605
|
})
|
|
565
606
|
await flush()
|
|
566
607
|
if (!container.querySelector('.yx-work')) throw new Error('workbench did not come back from cache')
|
|
567
|
-
if (workbenchCalls() !==
|
|
608
|
+
if (workbenchCalls() !== workbenchBeforeNav) throw new Error('workbench was refetched within staleTime')
|
|
568
609
|
const projectAgain = [...container.querySelectorAll('.yx-nav-item')].find((button) =>
|
|
569
610
|
button.textContent.includes('群兴跨境电商ERP'),
|
|
570
611
|
)
|