Commit 1a0bbe3
authored
feat(similarity): 相似度检测管理前端 (#61)
* update .gitignore
* feat(similarity): scaffold admin similarity dashboard route + menu
Add DiffOutlined menu entry and active-key detection for /admin/similarity.
Create similarity page, SimilarityDashboardClient tabs shell, and five
placeholder tab components (PairsTable, SuspectsTable, IntegrityReviewTable,
IntegrityWhitelistTable, PairWhitelistTable).
* feat(similarity): add frontend similarity API service client
Typed service class wrapping all admin + public similarity endpoints:
pairs list/detail, suspects list, pair whitelist, integrity reviews,
integrity whitelist, and evidence pair detail.
* feat(similarity): add zh-CN translations for Phase 3 admin panel
Merge admin.navigation.similarity, admin.similarity (tabs, columns,
status labels, action labels, drawer/modal strings), similarity.evidence
(disclaimer), and errors.integrity_rejected into the zh-CN locale file.
* feat(similarity): implement PairsTable tab
* feat(similarity): implement SuspectsTable tab
* fix(similarity): integrity_score 0 rendering and consolidate antd imports
- integrity_score === 0 now renders as 0.00 instead of -
- merge split antd imports in SuspectsTable
* feat(similarity): implement integrity review queue tab
* fix(similarity): use non-deprecated Drawer props (size/destroyOnHidden)
* fix(similarity): destroy ResolveReviewModal form on close to prevent state leak
* feat(similarity): add removePairWhitelistByID API client method
* feat(similarity): implement whitelist management tabs
* feat(similarity): add admin pair detail page with Monaco diff viewer
Implements Task 17 — pair detail page under admin/similarity/pairs/[pairId]
with metadata descriptions, whitelist action button, and a CodeDiffViewer
component that uses @monaco-editor/react DiffEditor with per-segment line
decorations via createDecorationsCollection.
* feat(similarity): add semi-public pair evidence page
Implements Task 18 — public-facing evidence page at similarity/pair/[id]
that wraps PairDetailClient with a warning Alert disclaimer banner, sourced
from getEvidencePair API endpoint.
* fix(similarity): use Alert.title instead of deprecated message prop
* fix(similarity): use real CSS class for diff highlights and correct byte→line conversion
- replace Tailwind class names (which Tailwind purges from non-JSX strings)
with similarity-match-highlight defined in globals.css
- convert UTF-8 byte offsets via TextEncoder to handle non-ASCII source code
correctly, instead of iterating JS UTF-16 code units
* feat(similarity): show integrity rejection alert on script publish/update
* feat(similarity): add Phase 3 translations for all supported locales
- en-US: proper English translations
- zh-TW: Traditional Chinese translations
- ja-JP / de-DE / ru-RU: English stopgap (pending Crowdin)
* feat(similarity): Phase 4 backfill control panel + stop-fp refresh
Adds the admin UI for §8.5 bootstrap operations:
- BackfillControl component in a new "回填与重扫" dashboard tab,
polling /admin/similarity/backfill/status every 5s while running.
Shows total/cursor/progress bar/started_at/finished_at in a
Descriptions panel with start + restart-from-zero (§8.5 step 9) +
refresh buttons gated by running flag.
- Manual per-script rescan card with script ID input.
- Stop-fingerprint refresh card with warning copy ("通常不需要手动
触发"), invoking POST /admin/similarity/stop-fp/refresh — used at
§8.5 step 8 after the first full backfill completes.
- similarityService adds triggerBackfill / getBackfillStatus /
manualScan / refreshStopFp methods and BackfillStatus type.
- New admin.similarity.tab_backfill + admin.similarity.backfill.*
translation keys in zh-CN.
* fix(similarity): flag deleted scripts in pair list with toggle filter
Backend now marks each ScriptBrief with is_deleted and accepts an
exclude_deleted query param. Render deleted scripts with a strikethrough
link and red tag, and add a Switch above the table that lets admins hide
any pair whose either side has been soft-deleted.
* feat(similarity): show signal descriptions in integrity review table
* refactor(similarity): move SIGNAL_DESCRIPTIONS hardcoded Chinese strings to i18n
Replace the hardcoded SIGNAL_DESCRIPTIONS constant in IntegrityReviewTable with
next-intl t() calls under admin.similarity.signal_desc.*, adding translations
for all 6 locales (zh-CN, en-US, de-DE, ja-JP, ru-RU, zh-TW).
* feat(i18n): add missing Phase 4 similarity keys to all non-zh-CN locales
Backfills script_deleted, filter_exclude_deleted, tab_backfill, and the
full backfill sub-object (28 keys) into en-US, de-DE, ja-JP, ru-RU, and
zh-TW — inserted before signal_desc to maintain consistent key ordering.
* style: fix prettier formatting in IntegrityReviewTable
* refactor: extract PairDetailClient and CodeDiffViewer to shared components
Move these components from admin route directory to src/components/similarity/
so both the admin detail page and public evidence page import from the same
shared location, eliminating the cross-layer dependency.1 parent 7d59fa6 commit 1a0bbe3
27 files changed
Lines changed: 2366 additions & 8 deletions
File tree
- public/locales
- de-DE
- en-US
- ja-JP
- ru-RU
- zh-CN
- zh-TW
- src
- app
- [locale]/(main)
- admin
- components
- similarity
- components
- pairs/[pairId]
- similarity/pair/[id]
- components
- components
- IntegrityErrorAlert
- ScriptEditor
- similarity
- lib/api
- services
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
| 52 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
211 | 212 | | |
212 | 213 | | |
213 | 214 | | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
214 | 320 | | |
215 | 321 | | |
216 | 322 | | |
| |||
1841 | 1947 | | |
1842 | 1948 | | |
1843 | 1949 | | |
| 1950 | + | |
| 1951 | + | |
| 1952 | + | |
| 1953 | + | |
| 1954 | + | |
| 1955 | + | |
| 1956 | + | |
| 1957 | + | |
| 1958 | + | |
| 1959 | + | |
| 1960 | + | |
| 1961 | + | |
1844 | 1962 | | |
1845 | 1963 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
| 69 | + | |
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
| |||
250 | 251 | | |
251 | 252 | | |
252 | 253 | | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
253 | 359 | | |
254 | 360 | | |
255 | 361 | | |
| |||
1883 | 1989 | | |
1884 | 1990 | | |
1885 | 1991 | | |
| 1992 | + | |
| 1993 | + | |
| 1994 | + | |
| 1995 | + | |
| 1996 | + | |
| 1997 | + | |
| 1998 | + | |
| 1999 | + | |
| 2000 | + | |
| 2001 | + | |
| 2002 | + | |
| 2003 | + | |
1886 | 2004 | | |
1887 | 2005 | | |
0 commit comments