@yinuo-ngm/server 1.0.15 → 1.0.17

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.
Files changed (349) hide show
  1. package/lib/app.js +3 -15
  2. package/lib/common/editor.js +2 -2
  3. package/lib/env.d.ts +1 -0
  4. package/lib/env.js +1 -0
  5. package/lib/plugins/error-handler.plugin.d.ts +2 -2
  6. package/lib/plugins/error-handler.plugin.js +97 -88
  7. package/lib/plugins/ws/topics/nginx.ws.js +2 -1
  8. package/lib/plugins/ws/topics/svn.ws.d.ts +2 -1
  9. package/lib/plugins/ws/topics/svn.ws.js +3 -2
  10. package/lib/plugins/ws/topics/syslog.ws.d.ts +1 -1
  11. package/lib/plugins/ws/topics/task.ws.d.ts +2 -1
  12. package/lib/plugins/ws/topics/task.ws.js +2 -1
  13. package/lib/plugins/ws/ws.context.d.ts +1 -1
  14. package/lib/plugins/ws/ws.plugin.js +4 -3
  15. package/lib/plugins/ws/ws.router.d.ts +2 -2
  16. package/lib/plugins/ws/ws.router.js +8 -7
  17. package/lib/routes/api-client/collection.routes.js +8 -6
  18. package/lib/routes/api-client/env.routes.js +4 -3
  19. package/lib/routes/api-client/history.routes.js +3 -2
  20. package/lib/routes/api-client/hub-token.routes.js +32 -10
  21. package/lib/routes/api-client/request.routes.js +7 -6
  22. package/lib/routes/api-client/send.routes.js +3 -2
  23. package/lib/routes/config.routes.js +5 -5
  24. package/lib/routes/hub.routes.js +10 -10
  25. package/lib/routes/index.js +2 -0
  26. package/lib/routes/nginx/nginx-lifecycle.routes.js +4 -0
  27. package/lib/routes/nginx/nginx-route.context.js +23 -7
  28. package/lib/routes/nginx/nginx-server.routes.js +158 -6
  29. package/lib/routes/node-version.routes.d.ts +2 -0
  30. package/lib/routes/node-version.routes.js +56 -0
  31. package/lib/routes/project.routes.js +14 -9
  32. package/lib/routes/rss.routes.js +3 -3
  33. package/lib/routes/sprite-browse.routes.js +21 -6
  34. package/lib/routes/sprite.routes.js +18 -12
  35. package/lib/routes/static-files.routes.js +21 -5
  36. package/lib/routes/svn.routes.js +5 -3
  37. package/lib/routes/system.routes.js +20 -1
  38. package/lib/routes/task.routes.js +10 -3
  39. package/package.json +13 -6
  40. package/www/3rdpartylicenses.txt +66 -118
  41. package/www/browser/chunk-2L7NUOMX.js +2 -0
  42. package/www/browser/chunk-2NZJ7CN2.js +20 -0
  43. package/www/browser/chunk-3CM4SKDO.js +15 -0
  44. package/www/browser/chunk-3I7BQCXS.js +1 -0
  45. package/www/browser/chunk-3M56F2S2.js +1 -0
  46. package/www/browser/chunk-3OHBKMAA.js +1 -0
  47. package/www/browser/chunk-3XNNQFWR.js +1 -0
  48. package/www/browser/chunk-4BRW6LCZ.js +4 -0
  49. package/www/browser/chunk-4LBSLURA.js +1 -0
  50. package/www/browser/chunk-4X42HB6N.js +2 -0
  51. package/www/browser/chunk-5DYX4DUX.js +11 -0
  52. package/www/browser/chunk-6SYVDN5L.js +1 -0
  53. package/www/browser/chunk-6YYNHZ2A.js +1 -0
  54. package/www/browser/chunk-75W3GVSO.js +1 -0
  55. package/www/browser/chunk-7U44RF5F.js +63 -0
  56. package/www/browser/chunk-AELTP6YN.js +1 -0
  57. package/www/browser/chunk-AMXRL4GR.js +1 -0
  58. package/www/browser/chunk-AV2ZODEH.js +1 -0
  59. package/www/browser/chunk-AZ6SIMYH.js +1 -0
  60. package/www/browser/chunk-B3C35ET3.js +2 -0
  61. package/www/browser/chunk-BTQIUVTQ.js +1 -0
  62. package/www/browser/chunk-CN5J4WNO.js +1 -0
  63. package/www/browser/chunk-D2ODDESN.js +1 -0
  64. package/www/browser/chunk-DE6E23ET.js +1 -0
  65. package/www/browser/chunk-DIJPUYIA.js +1 -0
  66. package/www/browser/chunk-DLGJD6YU.js +4 -0
  67. package/www/browser/chunk-EEDA5U4V.js +1 -0
  68. package/www/browser/chunk-FK6Z4HLL.js +1 -0
  69. package/www/browser/chunk-FL6GDGHW.js +1 -0
  70. package/www/browser/chunk-FXCG34QS.js +1 -0
  71. package/www/browser/chunk-H2USFIYR.js +1 -0
  72. package/www/browser/chunk-H5HGMOE6.js +1 -0
  73. package/www/browser/chunk-HB3HECPD.js +1 -0
  74. package/www/browser/chunk-HDNG236Q.js +1 -0
  75. package/www/browser/chunk-HFZLJHYR.js +1 -0
  76. package/www/browser/chunk-HJTXXSMC.js +1 -0
  77. package/www/browser/chunk-HUMCWAKJ.js +3 -0
  78. package/www/browser/chunk-IKB3EQCP.js +2 -0
  79. package/www/browser/chunk-K7PESFPY.js +1 -0
  80. package/www/browser/chunk-KRYMOHYF.js +2 -0
  81. package/www/browser/chunk-M4QRBV3K.js +1 -0
  82. package/www/browser/chunk-N2PELLMM.js +30 -0
  83. package/www/browser/chunk-ONXBYGIG.js +1 -0
  84. package/www/browser/chunk-OSBDR36P.js +1 -0
  85. package/www/browser/chunk-OZCK4XVV.js +1 -0
  86. package/www/browser/chunk-QJP5F735.js +1 -0
  87. package/www/browser/chunk-RGOYDY7H.js +1 -0
  88. package/www/browser/chunk-UJKK4A7Y.js +1 -0
  89. package/www/browser/chunk-WD2EKZQC.js +1 -0
  90. package/www/browser/chunk-WUA5JFDD.js +1 -0
  91. package/www/browser/chunk-XLFHB7RS.js +3 -0
  92. package/www/browser/chunk-YNW4HEJO.js +37 -0
  93. package/www/browser/chunk-ZTDLWBW5.js +1 -0
  94. package/www/browser/dark.css +1 -30433
  95. package/www/browser/default.css +1 -30149
  96. package/www/browser/index.html +3 -3
  97. package/www/browser/main-N64WJCHX.js +34 -0
  98. package/www/browser/scripts-U25HCVEI.js +6 -0
  99. package/www/browser/styles-ROAHD7MY.css +1 -0
  100. package/www/browser/add-widget-drawer.component.css.map +0 -7
  101. package/www/browser/advanced-editor.component.css.map +0 -7
  102. package/www/browser/api-client.component.css.map +0 -7
  103. package/www/browser/api-history-drawer.component.css.map +0 -7
  104. package/www/browser/app.css.map +0 -7
  105. package/www/browser/attachment-viewer.component.css.map +0 -7
  106. package/www/browser/auth-editor.component.css.map +0 -7
  107. package/www/browser/body-editor.component.css.map +0 -7
  108. package/www/browser/chunk-2YSUXBGC.js +0 -627
  109. package/www/browser/chunk-2YSUXBGC.js.map +0 -1
  110. package/www/browser/chunk-3G2GEOPV.js +0 -456
  111. package/www/browser/chunk-3G2GEOPV.js.map +0 -1
  112. package/www/browser/chunk-3L72DF3R.js +0 -1683
  113. package/www/browser/chunk-3L72DF3R.js.map +0 -1
  114. package/www/browser/chunk-3MCIETCQ.js +0 -8279
  115. package/www/browser/chunk-3MCIETCQ.js.map +0 -1
  116. package/www/browser/chunk-665WC4RU.js +0 -5383
  117. package/www/browser/chunk-665WC4RU.js.map +0 -1
  118. package/www/browser/chunk-6QMSEZPT.js +0 -10044
  119. package/www/browser/chunk-6QMSEZPT.js.map +0 -1
  120. package/www/browser/chunk-6TBQERYX.js +0 -280
  121. package/www/browser/chunk-6TBQERYX.js.map +0 -1
  122. package/www/browser/chunk-6UW4MRJZ.js +0 -43
  123. package/www/browser/chunk-6UW4MRJZ.js.map +0 -7
  124. package/www/browser/chunk-6XUMIL3W.js +0 -5495
  125. package/www/browser/chunk-6XUMIL3W.js.map +0 -1
  126. package/www/browser/chunk-724YOJI3.js +0 -903
  127. package/www/browser/chunk-724YOJI3.js.map +0 -1
  128. package/www/browser/chunk-766T7YES.js +0 -437
  129. package/www/browser/chunk-766T7YES.js.map +0 -1
  130. package/www/browser/chunk-7FC7DN65.js +0 -728
  131. package/www/browser/chunk-7FC7DN65.js.map +0 -1
  132. package/www/browser/chunk-APGQRYWX.js +0 -156
  133. package/www/browser/chunk-APGQRYWX.js.map +0 -7
  134. package/www/browser/chunk-AQHSGTHS.js +0 -1960
  135. package/www/browser/chunk-AQHSGTHS.js.map +0 -1
  136. package/www/browser/chunk-CTOEAJQK.js +0 -40
  137. package/www/browser/chunk-CTOEAJQK.js.map +0 -7
  138. package/www/browser/chunk-DEGQJKKZ.js +0 -409
  139. package/www/browser/chunk-DEGQJKKZ.js.map +0 -1
  140. package/www/browser/chunk-DIJX2663.js +0 -1166
  141. package/www/browser/chunk-DIJX2663.js.map +0 -1
  142. package/www/browser/chunk-E4XD4GLT.js +0 -427
  143. package/www/browser/chunk-E4XD4GLT.js.map +0 -1
  144. package/www/browser/chunk-EQOY6A3M.js +0 -212
  145. package/www/browser/chunk-EQOY6A3M.js.map +0 -1
  146. package/www/browser/chunk-ETTBRXVA.js +0 -2643
  147. package/www/browser/chunk-ETTBRXVA.js.map +0 -1
  148. package/www/browser/chunk-FLSUSPBD.js +0 -5569
  149. package/www/browser/chunk-FLSUSPBD.js.map +0 -1
  150. package/www/browser/chunk-FZNHBEAZ.js +0 -102
  151. package/www/browser/chunk-FZNHBEAZ.js.map +0 -1
  152. package/www/browser/chunk-GJC7CZIJ.js +0 -361
  153. package/www/browser/chunk-GJC7CZIJ.js.map +0 -7
  154. package/www/browser/chunk-GMCNMOTD.js +0 -844
  155. package/www/browser/chunk-GMCNMOTD.js.map +0 -7
  156. package/www/browser/chunk-H43HGCRW.js +0 -198
  157. package/www/browser/chunk-H43HGCRW.js.map +0 -7
  158. package/www/browser/chunk-J447GBHM.js +0 -160
  159. package/www/browser/chunk-J447GBHM.js.map +0 -1
  160. package/www/browser/chunk-JN3VOWP7.js +0 -384
  161. package/www/browser/chunk-JN3VOWP7.js.map +0 -1
  162. package/www/browser/chunk-KSHAGY2M.js +0 -399
  163. package/www/browser/chunk-KSHAGY2M.js.map +0 -7
  164. package/www/browser/chunk-KV72AKOD.js +0 -59
  165. package/www/browser/chunk-KV72AKOD.js.map +0 -7
  166. package/www/browser/chunk-LAVMY2SJ.js +0 -26
  167. package/www/browser/chunk-LAVMY2SJ.js.map +0 -7
  168. package/www/browser/chunk-LLRVGHG5.js +0 -73
  169. package/www/browser/chunk-LLRVGHG5.js.map +0 -7
  170. package/www/browser/chunk-LPME4AJ3.js +0 -196
  171. package/www/browser/chunk-LPME4AJ3.js.map +0 -1
  172. package/www/browser/chunk-LVPSURVU.js +0 -4615
  173. package/www/browser/chunk-LVPSURVU.js.map +0 -1
  174. package/www/browser/chunk-MMPO7QLO.js +0 -4146
  175. package/www/browser/chunk-MMPO7QLO.js.map +0 -7
  176. package/www/browser/chunk-O7LB6VFM.js +0 -1953
  177. package/www/browser/chunk-O7LB6VFM.js.map +0 -1
  178. package/www/browser/chunk-P5CWA4FO.js +0 -685
  179. package/www/browser/chunk-P5CWA4FO.js.map +0 -1
  180. package/www/browser/chunk-RBWIWNTL.js +0 -203
  181. package/www/browser/chunk-RBWIWNTL.js.map +0 -7
  182. package/www/browser/chunk-RUXJCM3V.js +0 -26199
  183. package/www/browser/chunk-RUXJCM3V.js.map +0 -1
  184. package/www/browser/chunk-S77VVYUZ.js +0 -168
  185. package/www/browser/chunk-S77VVYUZ.js.map +0 -1
  186. package/www/browser/chunk-SCXPYFOB.js +0 -4316
  187. package/www/browser/chunk-SCXPYFOB.js.map +0 -1
  188. package/www/browser/chunk-SS73S33S.js +0 -471
  189. package/www/browser/chunk-SS73S33S.js.map +0 -7
  190. package/www/browser/chunk-T6UAOWNP.js +0 -600
  191. package/www/browser/chunk-T6UAOWNP.js.map +0 -1
  192. package/www/browser/chunk-TEW4MY4J.js +0 -148
  193. package/www/browser/chunk-TEW4MY4J.js.map +0 -7
  194. package/www/browser/chunk-TVORF3SF.js +0 -82
  195. package/www/browser/chunk-TVORF3SF.js.map +0 -7
  196. package/www/browser/chunk-UAN42EUZ.js +0 -2147
  197. package/www/browser/chunk-UAN42EUZ.js.map +0 -1
  198. package/www/browser/chunk-ULOHDK7Y.js +0 -1
  199. package/www/browser/chunk-ULOHDK7Y.js.map +0 -7
  200. package/www/browser/chunk-UYJ3FVRV.js +0 -3978
  201. package/www/browser/chunk-UYJ3FVRV.js.map +0 -1
  202. package/www/browser/chunk-VXHZMSDM.js +0 -5509
  203. package/www/browser/chunk-VXHZMSDM.js.map +0 -1
  204. package/www/browser/chunk-VYNQPZQO.js +0 -281
  205. package/www/browser/chunk-VYNQPZQO.js.map +0 -1
  206. package/www/browser/chunk-W3J23PZI.js +0 -9213
  207. package/www/browser/chunk-W3J23PZI.js.map +0 -1
  208. package/www/browser/chunk-W5HGHCQT.js +0 -1642
  209. package/www/browser/chunk-W5HGHCQT.js.map +0 -7
  210. package/www/browser/chunk-XF5H7E4L.js +0 -4723
  211. package/www/browser/chunk-XF5H7E4L.js.map +0 -1
  212. package/www/browser/chunk-XNFNEBMY.js +0 -398
  213. package/www/browser/chunk-XNFNEBMY.js.map +0 -7
  214. package/www/browser/chunk-XQY5SPGI.js +0 -30811
  215. package/www/browser/chunk-XQY5SPGI.js.map +0 -1
  216. package/www/browser/chunk-Y7JBZHNK.js +0 -514
  217. package/www/browser/chunk-Y7JBZHNK.js.map +0 -1
  218. package/www/browser/chunk-YWHRP4X3.js +0 -406
  219. package/www/browser/chunk-YWHRP4X3.js.map +0 -1
  220. package/www/browser/chunk-Z7FJIV62.js +0 -95
  221. package/www/browser/chunk-Z7FJIV62.js.map +0 -7
  222. package/www/browser/chunk-ZBZHXS46.js +0 -1674
  223. package/www/browser/chunk-ZBZHXS46.js.map +0 -1
  224. package/www/browser/chunk-ZZA5NVAI.js +0 -735
  225. package/www/browser/chunk-ZZA5NVAI.js.map +0 -1
  226. package/www/browser/collection-modal.component.css.map +0 -7
  227. package/www/browser/collection-tree-item.component.css.map +0 -7
  228. package/www/browser/collection-tree.component.css.map +0 -7
  229. package/www/browser/config-change-bar-component.css.map +0 -7
  230. package/www/browser/config-item-component.css.map +0 -7
  231. package/www/browser/config-nav-component.css.map +0 -7
  232. package/www/browser/config-section-component.css.map +0 -7
  233. package/www/browser/create-summary-aside.component.css.map +0 -7
  234. package/www/browser/curl-actions.component.css.map +0 -7
  235. package/www/browser/dark.css.map +0 -7
  236. package/www/browser/dashboard-canvas.component.css.map +0 -7
  237. package/www/browser/dashboard.component.css.map +0 -7
  238. package/www/browser/default.css.map +0 -7
  239. package/www/browser/detail-item-card.component.css.map +0 -7
  240. package/www/browser/ellipsis-text.component.css.map +0 -7
  241. package/www/browser/env-modal.component.css.map +0 -7
  242. package/www/browser/env-picker.component.css.map +0 -7
  243. package/www/browser/feedback.component.css.map +0 -7
  244. package/www/browser/fs-explorer.component.css.map +0 -7
  245. package/www/browser/git-import-modal.component.css.map +0 -7
  246. package/www/browser/hub-v2-personal-token-modal.component.css.map +0 -7
  247. package/www/browser/issue-action-area.component.css.map +0 -7
  248. package/www/browser/issue-add-participants-dialog.component.css.map +0 -7
  249. package/www/browser/issue-assign-dialog.component.css.map +0 -7
  250. package/www/browser/issue-attachment-area.component.css.map +0 -7
  251. package/www/browser/issue-base-info-area.component.css.map +0 -7
  252. package/www/browser/issue-branches.component.css.map +0 -7
  253. package/www/browser/issue-close-dialog.component.css.map +0 -7
  254. package/www/browser/issue-collaborators-panel.component.css.map +0 -7
  255. package/www/browser/issue-comment-editor.component.css.map +0 -7
  256. package/www/browser/issue-create-branch-dialog.component.css.map +0 -7
  257. package/www/browser/issue-description-area.component.css.map +0 -7
  258. package/www/browser/issue-detail.component.css.map +0 -7
  259. package/www/browser/issue-resolve-dialog.component.css.map +0 -7
  260. package/www/browser/issue-start-own-branch-dialog.component.css.map +0 -7
  261. package/www/browser/issues-list-table.component.css.map +0 -7
  262. package/www/browser/issues.component.css.map +0 -7
  263. package/www/browser/kill-port-widget.component.css.map +0 -7
  264. package/www/browser/kv-table.component.css.map +0 -7
  265. package/www/browser/layout-footer.component.css.map +0 -7
  266. package/www/browser/layout-header.component.css.map +0 -7
  267. package/www/browser/layout-menu.component.css.map +0 -7
  268. package/www/browser/layout-project-nav.component.css.map +0 -7
  269. package/www/browser/layout-sidebar.component.css.map +0 -7
  270. package/www/browser/layout.component.css.map +0 -7
  271. package/www/browser/less-viewport-component.css.map +0 -7
  272. package/www/browser/main.js +0 -1872
  273. package/www/browser/main.js.map +0 -1
  274. package/www/browser/markdown-viewer.component.css.map +0 -7
  275. package/www/browser/news-feed-widget.component.css.map +0 -7
  276. package/www/browser/ng-devtool.component.css.map +0 -7
  277. package/www/browser/nginx-config-editor.component.css.map +0 -7
  278. package/www/browser/nginx-log-viewer.component.css.map +0 -7
  279. package/www/browser/nginx-secondary-logs-tab.component.css.map +0 -7
  280. package/www/browser/nginx-secondary-perf-tab.component.css.map +0 -7
  281. package/www/browser/nginx-secondary-settings-tab.component.css.map +0 -7
  282. package/www/browser/nginx-secondary-ssl-tab.component.css.map +0 -7
  283. package/www/browser/nginx-secondary-test-tab.component.css.map +0 -7
  284. package/www/browser/nginx-secondary-traffic-tab.component.css.map +0 -7
  285. package/www/browser/nginx-secondary-upstream-tab.component.css.map +0 -7
  286. package/www/browser/nginx-section-card.component.css.map +0 -7
  287. package/www/browser/nginx-server-drawer.component.css.map +0 -7
  288. package/www/browser/nginx-server-list.component.css.map +0 -7
  289. package/www/browser/nginx-stat-card.component.css.map +0 -7
  290. package/www/browser/nginx.component.css.map +0 -7
  291. package/www/browser/page-layout.component.css.map +0 -7
  292. package/www/browser/pick-workspace-modal.component.css.map +0 -7
  293. package/www/browser/polyfills.js +0 -26584
  294. package/www/browser/polyfills.js.map +0 -7
  295. package/www/browser/project-conf.component.css.map +0 -7
  296. package/www/browser/project-create-modal.component.css.map +0 -7
  297. package/www/browser/project-create.component.css.map +0 -7
  298. package/www/browser/project-deps.component.css.map +0 -7
  299. package/www/browser/project-edit-modal.component.css.map +0 -7
  300. package/www/browser/project-import.component.css.map +0 -7
  301. package/www/browser/project-item-popover.component.css.map +0 -7
  302. package/www/browser/project-item.component.css.map +0 -7
  303. package/www/browser/project-list.component.css.map +0 -7
  304. package/www/browser/projects.component.css.map +0 -7
  305. package/www/browser/quick-task-widget.component.css.map +0 -7
  306. package/www/browser/rd-action-area.component.css.map +0 -7
  307. package/www/browser/rd-advance-stage-dialog.component.css.map +0 -7
  308. package/www/browser/rd-block-dialog.component.css.map +0 -7
  309. package/www/browser/rd-create-dialog.component.css.map +0 -7
  310. package/www/browser/rd-detail.component.css.map +0 -7
  311. package/www/browser/rd-item-card.component.css.map +0 -7
  312. package/www/browser/rd-list-board.component.css.map +0 -7
  313. package/www/browser/rd-list-table.component.css.map +0 -7
  314. package/www/browser/rd.component.css.map +0 -7
  315. package/www/browser/request-collections.component.css.map +0 -7
  316. package/www/browser/request-editor.component.css.map +0 -7
  317. package/www/browser/request-list-item.component.css.map +0 -7
  318. package/www/browser/request-list.component.css.map +0 -7
  319. package/www/browser/request-tabs-bar.component.css.map +0 -7
  320. package/www/browser/request-tabs.component.css.map +0 -7
  321. package/www/browser/request-urlbar.component.css.map +0 -7
  322. package/www/browser/response-viewer.component.css.map +0 -7
  323. package/www/browser/scripts.js +0 -245
  324. package/www/browser/scripts.js.map +0 -7
  325. package/www/browser/setting.component.css.map +0 -7
  326. package/www/browser/sprite-conf-modal.component.css.map +0 -7
  327. package/www/browser/sprite-icons-panel-component.css.map +0 -7
  328. package/www/browser/sprite-images-panel-component.css.map +0 -7
  329. package/www/browser/sprite-result-tabs.component.css.map +0 -7
  330. package/www/browser/sprite-viewport-component.css.map +0 -7
  331. package/www/browser/sprite.component.css.map +0 -7
  332. package/www/browser/step-advance.component.css.map +0 -7
  333. package/www/browser/step-basic.component.css.map +0 -7
  334. package/www/browser/step-config.component.css.map +0 -7
  335. package/www/browser/step-features.component.css.map +0 -7
  336. package/www/browser/step-preset.component.css.map +0 -7
  337. package/www/browser/step-summary-aside.component.css.map +0 -7
  338. package/www/browser/styles.css +0 -258
  339. package/www/browser/styles.css.map +0 -7
  340. package/www/browser/system-log.component.css.map +0 -7
  341. package/www/browser/task-actions.component.css.map +0 -7
  342. package/www/browser/task-console.component.css.map +0 -7
  343. package/www/browser/task-header.component.css.map +0 -7
  344. package/www/browser/task-list.component.css.map +0 -7
  345. package/www/browser/tasks.component.css.map +0 -7
  346. package/www/browser/terminal-view.component.css.map +0 -7
  347. package/www/browser/welcome-widget.component.css.map +0 -7
  348. package/www/browser/widget-base.component.css.map +0 -7
  349. package/www/browser/widget-host.component.css.map +0 -7
@@ -1,4723 +0,0 @@
1
- import {
2
- NzLayoutModule
3
- } from "./chunk-YWHRP4X3.js";
4
- import {
5
- NzPopconfirmModule
6
- } from "./chunk-Y7JBZHNK.js";
7
- import "./chunk-Z7FJIV62.js";
8
- import {
9
- NzTabsModule
10
- } from "./chunk-O7LB6VFM.js";
11
- import {
12
- NzDrawerModule
13
- } from "./chunk-7FC7DN65.js";
14
- import {
15
- DragDropModule,
16
- NZ_MODAL_DATA,
17
- NzModalModule,
18
- NzModalRef,
19
- NzModalService
20
- } from "./chunk-FLSUSPBD.js";
21
- import {
22
- Clipboard,
23
- ClipboardModule
24
- } from "./chunk-LPME4AJ3.js";
25
- import {
26
- NzCheckboxModule
27
- } from "./chunk-766T7YES.js";
28
- import "./chunk-S77VVYUZ.js";
29
- import "./chunk-ULOHDK7Y.js";
30
- import {
31
- NzSpinModule
32
- } from "./chunk-EQOY6A3M.js";
33
- import {
34
- NzTagModule
35
- } from "./chunk-J447GBHM.js";
36
- import {
37
- NzContextMenuService,
38
- NzDropDownModule,
39
- NzMenuModule
40
- } from "./chunk-ZBZHXS46.js";
41
- import "./chunk-KSHAGY2M.js";
42
- import {
43
- require_lodash
44
- } from "./chunk-VXHZMSDM.js";
45
- import {
46
- NzEmptyModule,
47
- NzSelectModule
48
- } from "./chunk-ETTBRXVA.js";
49
- import {
50
- NzPopoverModule,
51
- PageLayoutComponent
52
- } from "./chunk-6QMSEZPT.js";
53
- import {
54
- ProjectContextStore
55
- } from "./chunk-TEW4MY4J.js";
56
- import "./chunk-APGQRYWX.js";
57
- import {
58
- ApiClient,
59
- LS_KEYS,
60
- LocalStateStore,
61
- NzMessageService
62
- } from "./chunk-2YSUXBGC.js";
63
- import {
64
- Directionality,
65
- FormsModule,
66
- NzButtonModule,
67
- NzIconDirective,
68
- NzIconModule,
69
- NzInputModule,
70
- NzOutletModule,
71
- NzSpaceModule,
72
- NzStringTemplateOutletDirective,
73
- NzTooltipModule,
74
- WithConfig,
75
- onConfigChangeEventForComponent,
76
- slideAlertMotion,
77
- takeUntilDestroyed
78
- } from "./chunk-RUXJCM3V.js";
79
- import "./chunk-VYNQPZQO.js";
80
- import {
81
- RouterModule
82
- } from "./chunk-665WC4RU.js";
83
- import {
84
- CommonModule,
85
- HttpParams
86
- } from "./chunk-3MCIETCQ.js";
87
- import {
88
- ChangeDetectionStrategy,
89
- ChangeDetectorRef,
90
- Component,
91
- DestroyRef,
92
- EventEmitter,
93
- FactoryTarget,
94
- HostListener,
95
- Injectable,
96
- Input,
97
- NgModule,
98
- Output,
99
- ViewChild,
100
- ViewEncapsulation,
101
- __decorate,
102
- __esDecorate,
103
- __objRest,
104
- __publicField,
105
- __runInitializers,
106
- __spreadProps,
107
- __spreadValues,
108
- __toESM,
109
- booleanAttribute,
110
- computed,
111
- core_exports,
112
- effect,
113
- firstValueFrom,
114
- inject,
115
- input,
116
- model,
117
- signal,
118
- ɵɵngDeclareClassMetadata,
119
- ɵɵngDeclareComponent,
120
- ɵɵngDeclareFactory,
121
- ɵɵngDeclareInjector,
122
- ɵɵngDeclareNgModule
123
- } from "./chunk-XQY5SPGI.js";
124
-
125
- // angular:jit:style:inline:src\app\pages\api-client\api-client.component.ts;CiAgICAucGFnZXsKICAgICAgaGVpZ2h0OiAxMDAlOwogICAgICBkaXNwbGF5OiBmbGV4OwogICAgICBmbGV4LWRpcmVjdGlvbjogcm93OwogICAgICBvdmVyZmxvdzogaGlkZGVuOwogICAgICBnYXA6IDE2cHg7CiAgICAgIHBhZGRpbmc6MCAxNnB4OwogICAgfQogICAgLmNvbnRlbnQgewogICAgICBmbGV4OiAxIDEgYXV0bzsKICAgICAgd2lkdGg6IDA7CiAgICAgIGRpc3BsYXk6IGZsZXg7CiAgICAgIGZsZXgtZGlyZWN0aW9uOiBjb2x1bW47CiAgICAgIGhlaWdodDogMTAwJTsKICAgICAgb3ZlcmZsb3c6IGhpZGRlbjsKICAgIH0KICAgIC5lZGl0b3ItYXJlYSB7CiAgICAgIGZsZXg6IDEgMSBhdXRvOwogICAgICBkaXNwbGF5OiBmbGV4OwogICAgICBmbGV4LWRpcmVjdGlvbjogY29sdW1uOwogICAgICBtaW4taGVpZ2h0OiAwOwogICAgfQogICAgYXBwLXJlcXVlc3QtZWRpdG9yIHsKICAgICAgZmxleDogMCAwIGF1dG87CiAgICAgIGhlaWdodDo1MCU7CiAgICB9CiAgICBhcHAtcmVzcG9uc2Utdmlld2VyIHsKICAgICAgZmxleDogMCAwIGF1dG87CiAgICAgIGhlaWdodDo1MCU7CiAgICAgIG92ZXJmbG93OiBhdXRvOwogICAgfQogICAg
126
- var api_client_component_default = "/* angular:styles/component:less;43d540c6ba4e6e48b509c83db85e36183929b3703b772c49b4f9f3fa50efdf2e;D:\\ng-manager\\webapp\\src\\app\\pages\\api-client\\api-client.component.ts */\n.page {\n height: 100%;\n display: flex;\n flex-direction: row;\n overflow: hidden;\n gap: 16px;\n padding: 0 16px;\n}\n.content {\n flex: 1 1 auto;\n width: 0;\n display: flex;\n flex-direction: column;\n height: 100%;\n overflow: hidden;\n}\n.editor-area {\n flex: 1 1 auto;\n display: flex;\n flex-direction: column;\n min-height: 0;\n}\napp-request-editor {\n flex: 0 0 auto;\n height: 50%;\n}\napp-response-viewer {\n flex: 0 0 auto;\n height: 50%;\n overflow: auto;\n}\n/*# sourceMappingURL=api-client.component.css.map */\n";
127
-
128
- // angular:jit:style:inline:src\app\pages\api-client\components\history\api-history-drawer.component.ts;CiAgICAubGlzdHsKICAgICAgZGlzcGxheTpmbGV4OwogICAgICBmbGV4LWRpcmVjdGlvbjpjb2x1bW47CiAgICAgIGdhcDoxMnB4OwogICAgfQogICAgLml0ZW17CiAgICAgIGJvcmRlcjoxcHggc29saWQgI2YwZjBmMDsKICAgICAgYm9yZGVyLXJhZGl1czo4cHg7CiAgICAgIHBhZGRpbmc6MTBweDsKICAgIH0KICAgIC5yb3d7CiAgICAgIGRpc3BsYXk6ZmxleDsKICAgICAgZ2FwOjhweDsKICAgICAgYWxpZ24taXRlbXM6Y2VudGVyOwogICAgICBmb250LXdlaWdodDo1MDA7CiAgICB9CiAgICAudXJsewogICAgICBmbGV4OjE7CiAgICAgIG92ZXJmbG93OmhpZGRlbjsKICAgICAgdGV4dC1vdmVyZmxvdzplbGxpcHNpczsKICAgICAgd2hpdGUtc3BhY2U6bm93cmFwOwogICAgfQogICAgLm1ldGF7CiAgICAgIG1hcmdpbi10b3A6NnB4OwogICAgICBkaXNwbGF5OmZsZXg7CiAgICAgIGdhcDo4cHg7CiAgICAgIGZvbnQtc2l6ZToxMnB4OwogICAgICBvcGFjaXR5Oi43OwogICAgfQogICAgLmFjdGlvbnN7CiAgICAgIG1hcmdpbi10b3A6OHB4OwogICAgICBkaXNwbGF5OmZsZXg7CiAgICAgIGdhcDo4cHg7CiAgICB9CiAgICAuZW1wdHl7CiAgICAgIHBhZGRpbmc6MTZweDsKICAgICAgb3BhY2l0eTouNjsKICAgICAgdGV4dC1hbGlnbjpjZW50ZXI7CiAgICB9CiAg
129
- var api_history_drawer_component_default = "/* angular:styles/component:less;d7b4f4dbc085d63893d028214b767bd20de371e514440bbc69820402fa10f93a;D:\\ng-manager\\webapp\\src\\app\\pages\\api-client\\components\\history\\api-history-drawer.component.ts */\n.list {\n display: flex;\n flex-direction: column;\n gap: 12px;\n}\n.item {\n border: 1px solid #f0f0f0;\n border-radius: 8px;\n padding: 10px;\n}\n.row {\n display: flex;\n gap: 8px;\n align-items: center;\n font-weight: 500;\n}\n.url {\n flex: 1;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.meta {\n margin-top: 6px;\n display: flex;\n gap: 8px;\n font-size: 12px;\n opacity: 0.7;\n}\n.actions {\n margin-top: 8px;\n display: flex;\n gap: 8px;\n}\n.empty {\n padding: 16px;\n opacity: 0.6;\n text-align: center;\n}\n/*# sourceMappingURL=api-history-drawer.component.css.map */\n";
130
-
131
- // src/app/pages/api-client/components/history/api-history-drawer.component.ts
132
- var ApiHistoryDrawerComponent = class ApiHistoryDrawerComponent2 {
133
- loading = false;
134
- histories = [];
135
- close = new EventEmitter();
136
- replay = new EventEmitter();
137
- copy(text) {
138
- navigator.clipboard.writeText(text);
139
- }
140
- static propDecorators = {
141
- loading: [{ type: Input }],
142
- histories: [{ type: Input }],
143
- close: [{ type: Output }],
144
- replay: [{ type: Output }]
145
- };
146
- };
147
- ApiHistoryDrawerComponent = __decorate([
148
- Component({
149
- selector: "app-api-history-drawer",
150
- standalone: true,
151
- imports: [
152
- CommonModule,
153
- NzDrawerModule,
154
- NzButtonModule,
155
- NzSpinModule,
156
- NzTagModule
157
- ],
158
- template: `
159
- <nz-drawer
160
- nzTitle="\u8BF7\u6C42\u5386\u53F2"
161
- [nzVisible]="true"
162
- nzPlacement="right"
163
- [nzWidth]="520"
164
- (nzOnClose)="close.emit()"
165
- >
166
- <ng-container *nzDrawerContent>
167
- @if(loading){
168
- <nz-spin />
169
- } @else {
170
- <div class="list">
171
- @for (h of histories; track h.id) {
172
- <div class="item">
173
- <div class="row">
174
- <nz-tag>{{h.requestSnapshot.method}}</nz-tag>
175
- <span class="url">{{h.requestSnapshot.url}}</span>
176
- </div>
177
-
178
- <div class="meta">
179
- <span>{{h.metrics.durationMs}} ms</span>
180
- @if(h.response){
181
- <nz-tag>HTTP {{h.response.status}}</nz-tag>
182
- }
183
- @if(h.error){
184
- <nz-tag nzColor="red">ERR</nz-tag>
185
- }
186
- </div>
187
-
188
- <div class="actions">
189
- <button nz-button nzSize="small" (click)="replay.emit(h)">\u91CD\u653E</button>
190
- @if(h.resolved.curl){
191
- <button nz-button nzSize="small" (click)="copy(h.resolved.curl.bash)">curl</button>
192
- }
193
- </div>
194
- </div>
195
- }
196
-
197
- @if(!histories.length){
198
- <div class="empty">\u6682\u65E0\u5386\u53F2\u8BB0\u5F55</div>
199
- }
200
- </div>
201
- }
202
- </ng-container>
203
- </nz-drawer>
204
- `,
205
- styles: [api_history_drawer_component_default]
206
- })
207
- ], ApiHistoryDrawerComponent);
208
-
209
- // angular:jit:style:inline:src\app\pages\api-client\components\request-collections\request-list.component.ts;CiAgICAubGlzdHsgZGlzcGxheTpmbGV4OyBmbGV4LWRpcmVjdGlvbjpjb2x1bW47IGdhcDo4cHg7IHBhZGRpbmc6MTBweDsgfQogICAgCiAgICAucm93MXsgZGlzcGxheTpmbGV4OyBnYXA6OHB4OyBhbGlnbi1pdGVtczpjZW50ZXI7IH0KICAgIC5tZXRob2R7IG1hcmdpbjowOyB9CiAgICAubmFtZXsKICAgICAgZm9udC13ZWlnaHQ6NjAwOwogICAgICBvdmVyZmxvdzpoaWRkZW47CiAgICAgIHRleHQtb3ZlcmZsb3c6ZWxsaXBzaXM7CiAgICAgIHdoaXRlLXNwYWNlOm5vd3JhcDsKICAgICAgZmxleDoxOwogICAgICBtaW4td2lkdGg6MDsKICAgIH0KICAgIC5yb3cyeyBtYXJnaW4tdG9wOjZweDsgZm9udC1zaXplOjEycHg7IG9wYWNpdHk6Ljc1OyB9CiAgICAudXJsewogICAgICBvdmVyZmxvdzpoaWRkZW47CiAgICAgIHRleHQtb3ZlcmZsb3c6ZWxsaXBzaXM7CiAgICAgIHdoaXRlLXNwYWNlOm5vd3JhcDsKICAgICAgZGlzcGxheTpibG9jazsKICAgIH0KICAgIC5yb3czeyBtYXJnaW4tdG9wOjZweDsgZm9udC1zaXplOjEycHg7IG9wYWNpdHk6LjU1OyB9CiAgICAuZW1wdHl7IHBhZGRpbmc6MTZweDsgb3BhY2l0eTouNjsgdGV4dC1hbGlnbjpjZW50ZXI7IH0KICA=
210
- var request_list_component_default = "/* angular:styles/component:less;ae07397b8578d7f6bec40f1ea1a29780a45a5679bc745311900bac751387d82b;D:\\ng-manager\\webapp\\src\\app\\pages\\api-client\\components\\request-collections\\request-list.component.ts */\n.list {\n display: flex;\n flex-direction: column;\n gap: 8px;\n padding: 10px;\n}\n.row1 {\n display: flex;\n gap: 8px;\n align-items: center;\n}\n.method {\n margin: 0;\n}\n.name {\n font-weight: 600;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n flex: 1;\n min-width: 0;\n}\n.row2 {\n margin-top: 6px;\n font-size: 12px;\n opacity: 0.75;\n}\n.url {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n display: block;\n}\n.row3 {\n margin-top: 6px;\n font-size: 12px;\n opacity: 0.55;\n}\n.empty {\n padding: 16px;\n opacity: 0.6;\n text-align: center;\n}\n/*# sourceMappingURL=request-list.component.css.map */\n";
211
-
212
- // angular:jit:style:inline:src\app\pages\api-client\components\request-collections\request-list-item.component.ts;CiAgICAgIDpob3N0LnJlcXVlc3QtaXRlbSB7CiAgICAgICAgZGlzcGxheTogZmxleDsKICAgICAgICBhbGlnbi1pdGVtczogY2VudGVyOwogICAgICAgIGp1c3RpZnktY29udGVudDogc3BhY2UtYmV0d2VlbjsKICAgICAgICBnYXA6IDhweDsKICAgICAgICBwYWRkaW5nOiA4cHggMTBweDsKICAgICAgICBib3JkZXItcmFkaXVzOiA2cHg7CiAgICAgICAgY3Vyc29yOiBwb2ludGVyOwogICAgICAgIHRyYW5zaXRpb246IGJhY2tncm91bmQtY29sb3IgMC4ycyBlYXNlOwogICAgICB9CiAgICAgIAogICAgICA6aG9zdC5yZXF1ZXN0LWl0ZW06aG92ZXIgewogICAgICAgIGJhY2tncm91bmQtY29sb3I6IHJnYmEoMCwgMCwgMCwgMC4wNCk7CiAgICAgIH0KICAgICAgCiAgICAgIDpob3N0LnJlcXVlc3QtaXRlbS5hY3RpdmUgewogICAgICAgIGJhY2tncm91bmQtY29sb3I6ICNlNmY3ZmY7CiAgICAgIH0KICAgICAgCiAgICAgIDpob3N0LnJlcXVlc3QtaXRlbS5hY3RpdmU6aG92ZXIgewogICAgICAgIGJhY2tncm91bmQtY29sb3I6ICNiYWU3ZmY7CiAgICAgIH0KICAgICAgCiAgICAgIC5jb250ZW50IHsKICAgICAgICBkaXNwbGF5OiBmbGV4OwogICAgICAgIGFsaWduLWl0ZW1zOiBjZW50ZXI7CiAgICAgICAgZ2FwOiA4cHg7CiAgICAgICAgZmxleDogMTsKICAgICAgICBvdmVyZmxvdzogaGlkZGVuOwogICAgICB9CiAgICAgIAogICAgICBidXR0b24ubW9yZS1hY3Rpb25zIHsKICAgICAgICBmbGV4OiAwIDAgYXV0bzsKICAgICAgICB3aWR0aDogMjBweDsKICAgICAgICBoZWlnaHQ6IDIwcHg7CiAgICAgICAgcGFkZGluZzogMCAhaW1wb3J0YW50OwogICAgICAgIHZpc2liaWxpdHk6IGhpZGRlbjsKICAgICAgICBvcGFjaXR5OiAwLjU7CiAgICAgIH0KICAgICAgCiAgICAgIGJ1dHRvbi5tb3JlLWFjdGlvbnM6aG92ZXIgewogICAgICAgIG9wYWNpdHk6IDE7CiAgICAgIH0KICAgICAgCiAgICAgIDpob3N0LnJlcXVlc3QtaXRlbTpob3ZlciBidXR0b24ubW9yZS1hY3Rpb25zIHsKICAgICAgICB2aXNpYmlsaXR5OiB2aXNpYmxlOwogICAgICB9CiAgICAgIAogICAgICAubWV0aG9kIHsKICAgICAgICBmbGV4OiAwIDAgYXV0bzsKICAgICAgICBmb250LXNpemU6IDEwcHg7CiAgICAgICAgZm9udC13ZWlnaHQ6IDYwMDsKICAgICAgICBsaW5lLWhlaWdodDogMS40OwogICAgICAgIHBhZGRpbmc6IDAgNHB4OwogICAgICAgIG1hcmdpbjogMDsKICAgICAgfQogICAgICAKICAgICAgLm5hbWUgewogICAgICAgIGZsZXg6IDEgMSBhdXRvOwogICAgICAgIGZvbnQtc2l6ZTogMTNweDsKICAgICAgICBmb250LXdlaWdodDogNTAwOwogICAgICAgIG92ZXJmbG93OiBoaWRkZW47CiAgICAgICAgdGV4dC1vdmVyZmxvdzogZWxsaXBzaXM7CiAgICAgICAgd2hpdGUtc3BhY2U6IG5vd3JhcDsKICAgICAgICBjb2xvcjogcmdiYSgwLCAwLCAwLCAwLjg1KTsKICAgICAgfQogICAgICAKICAgICAgLm1lbnUtaXRlbSB7CiAgICAgICAgZGlzcGxheTogZmxleDsKICAgICAgICBhbGlnbi1pdGVtczogY2VudGVyOwogICAgICB9CiAgICA=
213
- var request_list_item_component_default = "/* angular:styles/component:less;fa00256422daa02f76d2e7176add9a62a7c1e427676c0200d0ada9f3a2f19e2c;D:\\ng-manager\\webapp\\src\\app\\pages\\api-client\\components\\request-collections\\request-list-item.component.ts */\n:host.request-item {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n padding: 8px 10px;\n border-radius: 6px;\n cursor: pointer;\n transition: background-color 0.2s ease;\n}\n:host.request-item:hover {\n background-color: rgba(0, 0, 0, 0.04);\n}\n:host.request-item.active {\n background-color: #e6f7ff;\n}\n:host.request-item.active:hover {\n background-color: #bae7ff;\n}\n.content {\n display: flex;\n align-items: center;\n gap: 8px;\n flex: 1;\n overflow: hidden;\n}\nbutton.more-actions {\n flex: 0 0 auto;\n width: 20px;\n height: 20px;\n padding: 0 !important;\n visibility: hidden;\n opacity: 0.5;\n}\nbutton.more-actions:hover {\n opacity: 1;\n}\n:host.request-item:hover button.more-actions {\n visibility: visible;\n}\n.method {\n flex: 0 0 auto;\n font-size: 10px;\n font-weight: 600;\n line-height: 1.4;\n padding: 0 4px;\n margin: 0;\n}\n.name {\n flex: 1 1 auto;\n font-size: 13px;\n font-weight: 500;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: rgba(0, 0, 0, 0.85);\n}\n.menu-item {\n display: flex;\n align-items: center;\n}\n/*# sourceMappingURL=request-list-item.component.css.map */\n";
214
-
215
- // src/app/pages/api-client/components/request-collections/request-list-item.component.ts
216
- var RequestListItemComponent = class RequestListItemComponent2 {
217
- r;
218
- activeId = null;
219
- select = new EventEmitter();
220
- delete = new EventEmitter();
221
- mouseover = false;
222
- /**
223
- * 获取方法对应的颜色
224
- */
225
- getMethodColor(method) {
226
- const colors = {
227
- GET: "#61affe",
228
- POST: "#49cc90",
229
- PUT: "#fca130",
230
- PATCH: "#50e3c2",
231
- DELETE: "#f93e3e",
232
- HEAD: "#909090",
233
- OPTIONS: "#909090"
234
- };
235
- return colors[method.toUpperCase()] || "#909090";
236
- }
237
- static propDecorators = {
238
- r: [{ type: Input }],
239
- activeId: [{ type: Input }],
240
- select: [{ type: Output }],
241
- delete: [{ type: Output }]
242
- };
243
- };
244
- RequestListItemComponent = __decorate([
245
- Component({
246
- selector: "app-request-list-item",
247
- imports: [CommonModule, NzTagModule, NzIconModule, NzButtonModule, NzPopoverModule, NzMenuModule, NzTooltipModule],
248
- host: {
249
- "[class.request-item]": "true",
250
- "[class.active]": "r.id === activeId",
251
- "(click)": "$event.stopPropagation();select.emit(r.id)",
252
- "(mouseover)": "$event.stopPropagation();mouseover=true",
253
- "(mouseleave)": "$event.stopPropagation();mouseover=false"
254
- },
255
- template: `
256
- <div class="content" [nz-tooltip]="r.url" [nzTooltipTrigger]="'hover'" nzTooltipPlacement="right">
257
- <nz-tag class="method" [nzColor]="getMethodColor(r.method)">{{r.method}}</nz-tag>
258
- <span class="name">{{r.name || '\u672A\u547D\u540D'}}</span>
259
- </div>
260
- <button class="more-actions" nz-button nzType="text" nzSize="small" (click)="$event.stopPropagation();"
261
- nz-popover
262
- nzPopoverTrigger="click"
263
- [nzPopoverContent]="contentTemplate"
264
- nzPopoverPlacement="topRight"
265
- [nzPopoverOverlayClassName]="'project-item-popover'">
266
- <nz-icon nzType="more" nzTheme="outline" />
267
- </button>
268
- <ng-template #contentTemplate>
269
- <ul nz-menu>
270
- <li nz-menu-item class="menu-item">
271
- <nz-icon nzType="edit" nzTheme="outline" />
272
- <span>\u91CD\u547D\u540D</span>
273
- </li>
274
- <li nz-menu-item class="menu-item">
275
- <nz-icon nzType="folder" nzTheme="outline" />
276
- <span>\u79FB\u52A8\u5230</span>
277
- </li>
278
- <li nz-menu-item class="menu-item">
279
- <nz-icon nzType="export" nzTheme="outline" />
280
- <span>\u5BFC\u51FA</span>
281
- </li>
282
- <li nz-menu-item class="menu-item">
283
- <nz-icon nzType="copy" nzTheme="outline" />
284
- <span>\u590D\u5236cURL</span>
285
- </li>
286
- <li nz-menu-divider></li>
287
- <li nz-menu-item nzDanger class="menu-item" (click)="delete.emit(r.id)">
288
- <nz-icon nzType="delete"></nz-icon>
289
- <span>\u5220\u9664</span>
290
- </li>
291
- </ul>
292
- </ng-template>
293
- `,
294
- styles: [request_list_item_component_default]
295
- })
296
- ], RequestListItemComponent);
297
-
298
- // src/app/pages/api-client/components/request-collections/request-list.component.ts
299
- var RequestListComponent = class RequestListComponent2 {
300
- requests = [];
301
- activeId = null;
302
- select = new EventEmitter();
303
- static propDecorators = {
304
- requests: [{ type: Input }],
305
- activeId: [{ type: Input }],
306
- select: [{ type: Output }]
307
- };
308
- };
309
- RequestListComponent = __decorate([
310
- Component({
311
- selector: "app-request-list",
312
- standalone: true,
313
- imports: [CommonModule, NzTagModule, NzIconModule, RequestListItemComponent],
314
- template: `
315
- <div class="list">
316
- @for (r of requests; track r.id) {
317
- <app-request-list-item [r]="r" [activeId]="activeId" (select)="select.emit($event)" />
318
- }
319
- @if(!requests.length){
320
- <div class="empty">\u6682\u65E0\u8BF7\u6C42</div>
321
- }
322
- </div>
323
- `,
324
- styles: [request_list_component_default]
325
- })
326
- ], RequestListComponent);
327
-
328
- // angular:jit:style:inline:src\app\pages\api-client\components\request-collections\request-collections.component.ts;CiAgICA6aG9zdCB7IAogICAgICBoZWlnaHQ6IDEwMCU7IAogICAgICBkaXNwbGF5OiBmbGV4OyAKICAgICAgZmxleC1kaXJlY3Rpb246IGNvbHVtbjsgCiAgICAgIHdpZHRoOiAzMDBweDsgCiAgICAgIGZsZXg6IDAgMCAzMDBweDsgCiAgICB9CiAgICAKICAgIC53cmFwIHsgCiAgICAgIGhlaWdodDogMTAwJTsgCiAgICAgIGRpc3BsYXk6IGZsZXg7IAogICAgICBmbGV4LWRpcmVjdGlvbjogY29sdW1uOyAKICAgICAgYm9yZGVyOiAxcHggc29saWQgcmdiYSgwLCAwLCAwLCAwLjA4KTsgCiAgICAgIGJvcmRlci1yYWRpdXM6IDhweDsgCiAgICAgIG92ZXJmbG93OiBoaWRkZW47IAogICAgICBiYWNrZ3JvdW5kOiAjZmZmOwogICAgfQogICAgCiAgICAuaGVhZGVyIHsKICAgICAgd2lkdGg6IDEwMCU7CiAgICAgIHBhZGRpbmc6IDhweCAxMHB4OwogICAgICBkaXNwbGF5OiBmbGV4OwogICAgICBnYXA6IDZweDsKICAgICAgYWxpZ24taXRlbXM6IGNlbnRlcjsKICAgICAganVzdGlmeS1jb250ZW50OiBzcGFjZS1iZXR3ZWVuOwogICAgICBib3JkZXItYm90dG9tOiAxcHggc29saWQgcmdiYSgwLCAwLCAwLCAwLjA2KTsKICAgICAgZmxleDogMCAwIGF1dG87CiAgICAgIGJhY2tncm91bmQ6ICNmYWZhZmE7CiAgICB9CiAgICAKICAgIC5oZWFkZXIgbnotaW5wdXQtd3JhcHBlciB7CiAgICAgIGZsZXg6IDE7CiAgICAgIG1pbi13aWR0aDogMDsKICAgIH0KICAgIAogICAgLmhlYWRlciBpbnB1dFtuei1pbnB1dF0gewogICAgICBmb250LXNpemU6IDEzcHg7CiAgICB9CiAgICAKICAgIC5oZWFkZXIgYnV0dG9uIHsKICAgICAgd2lkdGg6IDMycHg7CiAgICAgIGhlaWdodDogMzJweDsKICAgICAgcGFkZGluZzogMCAhaW1wb3J0YW50OwogICAgfQogICAgCiAgICAuc2VhcmNoLWljb24gewogICAgICBjb2xvcjogcmdiYSgwLCAwLCAwLCAwLjM1KTsKICAgIH0KICAgIAogICAgLmJvZHkgewogICAgICBmbGV4OiAxIDEgYXV0bzsKICAgICAgaGVpZ2h0OiAwOwogICAgICBkaXNwbGF5OiBmbGV4OwogICAgICBmbGV4LWRpcmVjdGlvbjogY29sdW1uOwogICAgfQogIA==
329
- var request_collections_component_default = "/* angular:styles/component:less;8c134f25627adb86b870a69d79105b1c916e594d1e9bf0bd33729449a7d255a2;D:\\ng-manager\\webapp\\src\\app\\pages\\api-client\\components\\request-collections\\request-collections.component.ts */\n:host {\n height: 100%;\n display: flex;\n flex-direction: column;\n width: 300px;\n flex: 0 0 300px;\n}\n.wrap {\n height: 100%;\n display: flex;\n flex-direction: column;\n border: 1px solid rgba(0, 0, 0, 0.08);\n border-radius: 8px;\n overflow: hidden;\n background: #fff;\n}\n.header {\n width: 100%;\n padding: 8px 10px;\n display: flex;\n gap: 6px;\n align-items: center;\n justify-content: space-between;\n border-bottom: 1px solid rgba(0, 0, 0, 0.06);\n flex: 0 0 auto;\n background: #fafafa;\n}\n.header nz-input-wrapper {\n flex: 1;\n min-width: 0;\n}\n.header input[nz-input] {\n font-size: 13px;\n}\n.header button {\n width: 32px;\n height: 32px;\n padding: 0 !important;\n}\n.search-icon {\n color: rgba(0, 0, 0, 0.35);\n}\n.body {\n flex: 1 1 auto;\n height: 0;\n display: flex;\n flex-direction: column;\n}\n/*# sourceMappingURL=request-collections.component.css.map */\n";
330
-
331
- // angular:jit:style:inline:src\app\pages\api-client\components\request-collections\collection-tree.component.ts;CiAgICA6aG9zdC50cmVlLWJvZHkgewogICAgICBmbGV4OiAxIDEgYXV0bzsKICAgICAgaGVpZ2h0OiAwOwogICAgICBvdmVyZmxvdzogYXV0bzsKICAgICAgcGFkZGluZzogOHB4OwogICAgICBkaXNwbGF5OiBmbGV4OwogICAgICBmbGV4LWRpcmVjdGlvbjogY29sdW1uOwogICAgICBnYXA6IDRweDsKICAgIH0KICAgIAogICAgOmhvc3QudHJlZS1ib2R5IC5lbXB0eSB7CiAgICAgIHBhZGRpbmc6IDI0cHggMTZweDsKICAgICAgb3BhY2l0eTogMC41OwogICAgICB0ZXh0LWFsaWduOiBjZW50ZXI7CiAgICAgIGZvbnQtc2l6ZTogMTNweDsKICAgIH0KICA=
332
- var collection_tree_component_default = "/* angular:styles/component:less;af15c27645b8067eb1a68b8b7ac91bd403934fa4e1f4585fd97bd3b9b4d6baf4;D:\\ng-manager\\webapp\\src\\app\\pages\\api-client\\components\\request-collections\\collection-tree.component.ts */\n:host.tree-body {\n flex: 1 1 auto;\n height: 0;\n overflow: auto;\n padding: 8px;\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n:host.tree-body .empty {\n padding: 24px 16px;\n opacity: 0.5;\n text-align: center;\n font-size: 13px;\n}\n/*# sourceMappingURL=collection-tree.component.css.map */\n";
333
-
334
- // angular:jit:style:inline:src\app\pages\api-client\components\request-collections\collection-tree-item.component.ts;CiAgICA6aG9zdC5jdHJlZS1pdGVtIHsgCiAgICAgIGRpc3BsYXk6IGJsb2NrOyAKICAgIH0KICAgIAogICAgLnJvdyB7CiAgICAgIGRpc3BsYXk6IGZsZXg7CiAgICAgIGFsaWduLWl0ZW1zOiBjZW50ZXI7CiAgICAgIGdhcDogNHB4OwogICAgICBwYWRkaW5nOiA2cHggOHB4OwogICAgICBib3JkZXItcmFkaXVzOiA2cHg7CiAgICAgIGN1cnNvcjogcG9pbnRlcjsKICAgICAgdHJhbnNpdGlvbjogYmFja2dyb3VuZC1jb2xvciAwLjJzIGVhc2U7CiAgICB9CiAgICAKICAgIC5yb3c6aG92ZXIgewogICAgICBiYWNrZ3JvdW5kLWNvbG9yOiByZ2JhKDAsIDAsIDAsIDAuMDQpOwogICAgfQogICAgCiAgICAucm93LmFjdGl2ZSB7CiAgICAgIGJhY2tncm91bmQtY29sb3I6ICNlNmY3ZmY7CiAgICB9CiAgICAKICAgIC5yb3cuYWN0aXZlOmhvdmVyIHsKICAgICAgYmFja2dyb3VuZC1jb2xvcjogI2JhZTdmZjsKICAgIH0KICAgIAogICAgLmNoZXYgewogICAgICBmbGV4OiAwIDAgYXV0bzsKICAgICAgd2lkdGg6IDIwcHg7CiAgICAgIGhlaWdodDogMjBweDsKICAgICAgcGFkZGluZzogMCAhaW1wb3J0YW50OwogICAgfQogICAgCiAgICAuY2hldi1pY29uIHsKICAgICAgZm9udC1zaXplOiAxMnB4OwogICAgICB0cmFuc2l0aW9uOiB0cmFuc2Zvcm0gMC4ycyBlYXNlOwogICAgICBjb2xvcjogcmdiYSgwLCAwLCAwLCAwLjQ1KTsKICAgIH0KICAgIAogICAgLmNoZXYtaWNvbi5leHBhbmRlZCB7CiAgICAgIHRyYW5zZm9ybTogcm90YXRlKDkwZGVnKTsKICAgIH0KICAgIAogICAgLm1haW4gewogICAgICBkaXNwbGF5OiBmbGV4OwogICAgICBhbGlnbi1pdGVtczogY2VudGVyOwogICAgICBnYXA6IDhweDsKICAgICAgZmxleDogMTsKICAgICAgbWluLXdpZHRoOiAwOwogICAgfQogICAgCiAgICAuaWNvbiB7CiAgICAgIG9wYWNpdHk6IDAuNjU7CiAgICAgIGZvbnQtc2l6ZTogMTRweDsKICAgIH0KICAgIAogICAgLm1ldGhvZCB7CiAgICAgIGZsZXg6IDAgMCBhdXRvOwogICAgICBmb250LXNpemU6IDEwcHg7CiAgICAgIGZvbnQtd2VpZ2h0OiA2MDA7CiAgICAgIGxpbmUtaGVpZ2h0OiAxLjQ7CiAgICAgIHBhZGRpbmc6IDAgNHB4OwogICAgICBtYXJnaW46IDA7CiAgICB9CiAgICAKICAgIC50ZXh0cyB7CiAgICAgIGZsZXg6IDE7CiAgICAgIG1pbi13aWR0aDogMDsKICAgIH0KICAgIAogICAgLnRpdGxlIHsKICAgICAgZm9udC1zaXplOiAxM3B4OwogICAgICBmb250LXdlaWdodDogNTAwOwogICAgICBvdmVyZmxvdzogaGlkZGVuOwogICAgICB0ZXh0LW92ZXJmbG93OiBlbGxpcHNpczsKICAgICAgd2hpdGUtc3BhY2U6IG5vd3JhcDsKICAgICAgY29sb3I6IHJnYmEoMCwgMCwgMCwgMC44NSk7CiAgICB9CiAgICAKICAgIC5zdWIgewogICAgICBmb250LXNpemU6IDEycHg7CiAgICAgIG9wYWNpdHk6IDAuNTsKICAgICAgb3ZlcmZsb3c6IGhpZGRlbjsKICAgICAgdGV4dC1vdmVyZmxvdzogZWxsaXBzaXM7CiAgICAgIHdoaXRlLXNwYWNlOiBub3dyYXA7CiAgICAgIG1hcmdpbi10b3A6IDJweDsKICAgIH0KICAgIAogICAgLm1vcmUgewogICAgICBmbGV4OiAwIDAgYXV0bzsKICAgICAgd2lkdGg6IDIwcHg7CiAgICAgIGhlaWdodDogMjBweDsKICAgICAgcGFkZGluZzogMCAhaW1wb3J0YW50OwogICAgICB2aXNpYmlsaXR5OiBoaWRkZW47CiAgICAgIG9wYWNpdHk6IDAuNTsKICAgIH0KICAgIAogICAgLm1vcmU6aG92ZXIgewogICAgICBvcGFjaXR5OiAxOwogICAgfQogICAgCiAgICAucm93OmhvdmVyIC5tb3JlIHsKICAgICAgdmlzaWJpbGl0eTogdmlzaWJsZTsKICAgIH0KICAgIAogICAgLmNoaWxkcmVuIHsKICAgICAgbWFyZ2luLWxlZnQ6IDIwcHg7CiAgICAgIHBhZGRpbmctbGVmdDogNHB4OwogICAgICBib3JkZXItbGVmdDogMXB4IGRhc2hlZCByZ2JhKDAsIDAsIDAsIDAuMDgpOwogICAgICBtYXJnaW4tdG9wOiA0cHg7CiAgICAgIGRpc3BsYXk6IGZsZXg7CiAgICAgIGZsZXgtZGlyZWN0aW9uOiBjb2x1bW47CiAgICAgIGdhcDogMnB4OwogICAgfQogIA==
335
- var collection_tree_item_component_default = "/* angular:styles/component:less;7bee656b24f9348f17008487fee6e233f0ebe6503bec878d24d192302de93953;D:\\ng-manager\\webapp\\src\\app\\pages\\api-client\\components\\request-collections\\collection-tree-item.component.ts */\n:host.ctree-item {\n display: block;\n}\n.row {\n display: flex;\n align-items: center;\n gap: 4px;\n padding: 6px 8px;\n border-radius: 6px;\n cursor: pointer;\n transition: background-color 0.2s ease;\n}\n.row:hover {\n background-color: rgba(0, 0, 0, 0.04);\n}\n.row.active {\n background-color: #e6f7ff;\n}\n.row.active:hover {\n background-color: #bae7ff;\n}\n.chev {\n flex: 0 0 auto;\n width: 20px;\n height: 20px;\n padding: 0 !important;\n}\n.chev-icon {\n font-size: 12px;\n transition: transform 0.2s ease;\n color: rgba(0, 0, 0, 0.45);\n}\n.chev-icon.expanded {\n transform: rotate(90deg);\n}\n.main {\n display: flex;\n align-items: center;\n gap: 8px;\n flex: 1;\n min-width: 0;\n}\n.icon {\n opacity: 0.65;\n font-size: 14px;\n}\n.method {\n flex: 0 0 auto;\n font-size: 10px;\n font-weight: 600;\n line-height: 1.4;\n padding: 0 4px;\n margin: 0;\n}\n.texts {\n flex: 1;\n min-width: 0;\n}\n.title {\n font-size: 13px;\n font-weight: 500;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: rgba(0, 0, 0, 0.85);\n}\n.sub {\n font-size: 12px;\n opacity: 0.5;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n margin-top: 2px;\n}\n.more {\n flex: 0 0 auto;\n width: 20px;\n height: 20px;\n padding: 0 !important;\n visibility: hidden;\n opacity: 0.5;\n}\n.more:hover {\n opacity: 1;\n}\n.row:hover .more {\n visibility: visible;\n}\n.children {\n margin-left: 20px;\n padding-left: 4px;\n border-left: 1px dashed rgba(0, 0, 0, 0.08);\n margin-top: 4px;\n display: flex;\n flex-direction: column;\n gap: 2px;\n}\n/*# sourceMappingURL=collection-tree-item.component.css.map */\n";
336
-
337
- // src/app/pages/api-client/components/request-collections/collection-tree-item.component.ts
338
- var CollectionTreeItemComponent = class CollectionTreeItemComponent2 {
339
- node;
340
- expanded = false;
341
- activeKey = null;
342
- toggle = new EventEmitter();
343
- selectRequest = new EventEmitter();
344
- selectCollection = new EventEmitter();
345
- createRequest = new EventEmitter();
346
- createFolder = new EventEmitter();
347
- rename = new EventEmitter();
348
- move = new EventEmitter();
349
- copyCurl = new EventEmitter();
350
- delete = new EventEmitter();
351
- visible = false;
352
- get hasChildren() {
353
- return (this.node.children?.length ?? 0) > 0;
354
- }
355
- get iconType() {
356
- if (this.node.kind === "request")
357
- return "";
358
- return this.node.kind === "folder" ? "folder" : "database";
359
- }
360
- onClick() {
361
- if (this.node.kind === "request")
362
- this.selectRequest.emit(this.node.id);
363
- else
364
- this.selectCollection.emit(this.node.id);
365
- }
366
- /**
367
- * 获取方法对应的颜色
368
- */
369
- getMethodColor(method) {
370
- const colors = {
371
- GET: "#61affe",
372
- POST: "#49cc90",
373
- PUT: "#fca130",
374
- PATCH: "#50e3c2",
375
- DELETE: "#f93e3e",
376
- HEAD: "#909090",
377
- OPTIONS: "#909090"
378
- };
379
- return colors[method?.toUpperCase() || ""] || "#909090";
380
- }
381
- static propDecorators = {
382
- node: [{ type: Input }],
383
- expanded: [{ type: Input }],
384
- activeKey: [{ type: Input }],
385
- toggle: [{ type: Output }],
386
- selectRequest: [{ type: Output }],
387
- selectCollection: [{ type: Output }],
388
- createRequest: [{ type: Output }],
389
- createFolder: [{ type: Output }],
390
- rename: [{ type: Output }],
391
- move: [{ type: Output }],
392
- copyCurl: [{ type: Output }],
393
- delete: [{ type: Output }]
394
- };
395
- };
396
- CollectionTreeItemComponent = __decorate([
397
- Component({
398
- selector: "app-collection-tree-item",
399
- imports: [CommonModule, NzButtonModule, FormsModule, NzIconModule, NzPopoverModule, NzMenuModule, NzTagModule, NzPopconfirmModule],
400
- template: `
401
- <div class="row" [class.active]="activeKey === node.key">
402
- @if(hasChildren){
403
- <button
404
- class="chev"
405
- nz-button
406
- nzType="text"
407
- nzSize="small"
408
- (click)="toggle.emit(node.key); $event.stopPropagation()"
409
- >
410
- <nz-icon class="chev-icon" [class.expanded]="expanded" [nzType]="'right'"></nz-icon>
411
- </button>
412
- }
413
-
414
- <div class="main" (click)="onClick()">
415
- @if(iconType){
416
- <nz-icon class="icon" [nzType]="iconType"></nz-icon>
417
- }
418
-
419
- @if (node.kind === 'request') {
420
- <nz-tag class="method" [nzColor]="getMethodColor(node.method)">{{ node.method || '' }}</nz-tag>
421
- }
422
-
423
- <div class="texts">
424
- <div class="title">{{ node.title }}</div>
425
- @if (node.subtitle) {
426
- <div class="sub">{{ node.subtitle }}</div>
427
- }
428
- </div>
429
- </div>
430
-
431
- <button
432
- class="more"
433
- nz-button
434
- nzType="text"
435
- nzSize="small"
436
- (click)="$event.stopPropagation()"
437
- nz-popover
438
- nzPopoverTrigger="click"
439
- [(nzPopoverVisible)]="visible"
440
- nzPopover
441
- [nzPopoverContent]="menuTpl"
442
- nzPopoverPlacement="right"
443
- [nzPopoverOverlayClassName]="'project-item-popover'">
444
- <nz-icon nzType="more" nzTheme="outline"></nz-icon>
445
- </button>
446
-
447
- <ng-template #menuTpl>
448
- <ul nz-menu>
449
- @if (node.kind !== 'request') {
450
- @if(node.kind==='collection') {
451
- <li nz-menu-item (click)="createFolder.emit(node.id); visible = false">
452
- <nz-icon nzType="folder"></nz-icon>
453
- <span>\u65B0\u5EFA\u76EE\u5F55</span>
454
- </li>
455
- }
456
- <li nz-menu-item (click)="createRequest.emit(node.id); visible = false">
457
- <nz-icon nzType="plus"></nz-icon>
458
- <span>\u65B0\u5EFA\u8BF7\u6C42</span>
459
- </li>
460
- @if(node.kind==='folder') {
461
- <li nz-menu-item (click)="move.emit(node.id); visible = false">
462
- <nz-icon nzType="folder"></nz-icon>
463
- <span>\u79FB\u52A8\u5230</span>
464
- </li>
465
- }
466
- <li nz-menu-item (click)="rename.emit(node.id); visible = false">
467
- <nz-icon nzType="edit"></nz-icon>
468
- <span>\u91CD\u547D\u540D</span>
469
- </li>
470
- <li nz-menu-divider></li>
471
- <li nz-menu-item nzDanger nz-popconfirm nzPopconfirmTitle="\u786E\u8BA4\u5220\u9664\u5417\uFF1F" (nzOnConfirm)="delete.emit(node.id)">
472
- <nz-icon nzType="delete"></nz-icon>
473
- <span>\u5220\u9664</span>
474
- </li>
475
-
476
- } @else {
477
- <li nz-menu-item (click)="move.emit(node.id); visible = false">
478
- <nz-icon nzType="folder"></nz-icon>
479
- <span>\u79FB\u52A8\u5230</span>
480
- </li>
481
- <li nz-menu-item (click)="rename.emit(node.id); visible = false">
482
- <nz-icon nzType="edit"></nz-icon>
483
- <span>\u91CD\u547D\u540D</span>
484
- </li>
485
- <li nz-menu-divider></li>
486
- <li nz-menu-item nzDanger nz-popconfirm nzPopconfirmTitle="\u786E\u8BA4\u5220\u9664\u5417\uFF1F" (nzOnConfirm)="delete.emit(node.id)">
487
- <nz-icon nzType="delete"></nz-icon>
488
- <span>\u5220\u9664</span>
489
- </li>
490
- }
491
- </ul>
492
- </ng-template>
493
- </div>
494
-
495
- @if (hasChildren && expanded) {
496
- <div class="children">
497
- <ng-content />
498
- </div>
499
- }
500
- `,
501
- host: {
502
- "[class.ctree-item]": "true"
503
- },
504
- styles: [collection_tree_item_component_default]
505
- })
506
- ], CollectionTreeItemComponent);
507
-
508
- // src/app/pages/api-client/components/request-collections/collection-tree.component.ts
509
- var CollectionTreeComponent = class CollectionTreeComponent2 {
510
- nodes = [];
511
- activeRequestId = input(null);
512
- selectRequest = new EventEmitter();
513
- selectCollection = new EventEmitter();
514
- createRequest = new EventEmitter();
515
- createFolder = new EventEmitter();
516
- rename = new EventEmitter();
517
- move = new EventEmitter();
518
- copyCurl = new EventEmitter();
519
- delete = new EventEmitter();
520
- // activeKey:给选中样式用(request 优先)
521
- activeKey = computed(() => {
522
- return this.activeRequestId() ? `r:${this.activeRequestId()}` : null;
523
- });
524
- // 当前选中的 collection(用于“新建请求”默认归属)
525
- _activeCollectionId = signal(null);
526
- activeCollectionId = computed(() => this._activeCollectionId());
527
- // 展开态:key -> boolean
528
- expandedMap = signal({});
529
- expanded(key) {
530
- return !!this.expandedMap()[key];
531
- }
532
- toggle(key) {
533
- const m = __spreadValues({}, this.expandedMap());
534
- m[key] = !m[key];
535
- this.expandedMap.set(m);
536
- }
537
- onSelectRequest(id) {
538
- this.selectRequest.emit(id);
539
- }
540
- onSelectCollection(id) {
541
- this._activeCollectionId.set(id);
542
- this.selectCollection.emit(id);
543
- const key = `c:${id}`;
544
- const m = __spreadValues({}, this.expandedMap());
545
- m[key] = true;
546
- this.expandedMap.set(m);
547
- }
548
- static propDecorators = {
549
- nodes: [{ type: Input }],
550
- activeRequestId: [{ type: Input, args: [{ isSignal: true, alias: "activeRequestId", required: false, transform: void 0 }] }],
551
- selectRequest: [{ type: Output }],
552
- selectCollection: [{ type: Output }],
553
- createRequest: [{ type: Output }],
554
- createFolder: [{ type: Output }],
555
- rename: [{ type: Output }],
556
- move: [{ type: Output }],
557
- copyCurl: [{ type: Output }],
558
- delete: [{ type: Output }]
559
- };
560
- };
561
- CollectionTreeComponent = __decorate([
562
- Component({
563
- selector: "app-collection-tree",
564
- imports: [CommonModule, FormsModule, NzInputModule, NzIconModule, NzButtonModule, CollectionTreeItemComponent],
565
- host: {
566
- "[class.tree-body]": "true"
567
- },
568
- template: `
569
- @for (n of nodes; track n.key) {
570
- <ng-container [ngTemplateOutlet]="nodeTpl" [ngTemplateOutletContext]="{ $implicit: n }" />
571
- }
572
- @if (!nodes.length) {
573
- <div class="empty">\u6682\u65E0\u8BF7\u6C42</div>
574
- }
575
- <ng-template #nodeTpl let-node>
576
- <app-collection-tree-item
577
- [node]="node"
578
- [expanded]="expanded(node.key)"
579
- [activeKey]="activeKey()"
580
- (toggle)="toggle($event)"
581
- (selectRequest)="onSelectRequest($event)"
582
- (selectCollection)="onSelectCollection($event)"
583
- (createRequest)="createRequest.emit({ collectionId: $event })"
584
- (createFolder)="createFolder.emit({ collectionId: $event })"
585
- (rename)="rename.emit({ id: $event, kind: node.kind })"
586
- (move)="move.emit({ id: $event, kind: node.kind })"
587
- (copyCurl)="copyCurl.emit($event)"
588
- (delete)="delete.emit({ id: $event, kind: node.kind })"
589
- >
590
- @for (c of node.children; track c.key) {
591
- <ng-container [ngTemplateOutlet]="nodeTpl" [ngTemplateOutletContext]="{ $implicit: c }" />
592
- }
593
- </app-collection-tree-item>
594
- </ng-template>
595
- `,
596
- styles: [collection_tree_component_default]
597
- })
598
- ], CollectionTreeComponent);
599
-
600
- // src/app/pages/api-client/components/request-collections/request-collections.component.ts
601
- var RequestCollectionsComponent = class RequestCollectionsComponent2 {
602
- nodes = input([]);
603
- q = model("");
604
- activeId = input(null);
605
- loading = false;
606
- select = new EventEmitter();
607
- createRequest = new EventEmitter();
608
- createCollection = new EventEmitter();
609
- createFolder = new EventEmitter();
610
- reload = new EventEmitter();
611
- delete = new EventEmitter();
612
- rename = new EventEmitter();
613
- move = new EventEmitter();
614
- visible = false;
615
- static propDecorators = {
616
- nodes: [{ type: Input, args: [{ isSignal: true, alias: "nodes", required: false, transform: void 0 }] }],
617
- q: [{ type: Input, args: [{ isSignal: true, alias: "q", required: false }] }, { type: Output, args: ["qChange"] }],
618
- activeId: [{ type: Input, args: [{ isSignal: true, alias: "activeId", required: false, transform: void 0 }] }],
619
- loading: [{ type: Input }],
620
- select: [{ type: Output }],
621
- createRequest: [{ type: Output }],
622
- createCollection: [{ type: Output }],
623
- createFolder: [{ type: Output }],
624
- reload: [{ type: Output }],
625
- delete: [{ type: Output }],
626
- rename: [{ type: Output }],
627
- move: [{ type: Output }]
628
- };
629
- };
630
- RequestCollectionsComponent = __decorate([
631
- Component({
632
- selector: "app-request-collections",
633
- standalone: true,
634
- imports: [
635
- CommonModule,
636
- FormsModule,
637
- NzButtonModule,
638
- NzInputModule,
639
- NzIconModule,
640
- NzMenuModule,
641
- NzPopoverModule,
642
- CollectionTreeComponent
643
- ],
644
- template: `
645
- <div class="wrap">
646
- <div class="header">
647
- <nz-input-wrapper>
648
- <nz-icon class="search-icon" nzInputPrefix nzType="search" />
649
- <input
650
- nz-input
651
- placeholder="\u641C\u7D22"
652
- [(ngModel)]="q"
653
- />
654
- </nz-input-wrapper>
655
- <button nz-button (click)="reload.emit()" nzType="text">
656
- <nz-icon [nzType]="loading ? 'loading' : 'reload'" nzTheme="outline" />
657
- </button>
658
- <button
659
- nz-button
660
- nz-popover
661
- nzPopoverTrigger="click"
662
- [(nzPopoverVisible)]="visible"
663
- [nzPopoverContent]="menuTpl"
664
- nzPopoverPlacement="bottomCenter"
665
- [nzPopoverOverlayClassName]="'project-item-popover'"
666
- nzType="text"
667
- >
668
- <nz-icon nzType="plus" nzTheme="outline" />
669
- </button>
670
- </div>
671
- <div class="body">
672
- <!-- <app-request-list
673
- [requests]="filtered()"
674
- [activeId]="activeId"
675
- (select)="select.emit($event)"
676
- /> -->
677
- <app-collection-tree
678
- [nodes]="nodes()"
679
- [activeRequestId]="activeId()"
680
- (selectRequest)="select.emit($event)"
681
- (createRequest)="createRequest.emit({ collectionId: $event.collectionId })"
682
- (createFolder)="createFolder.emit({ collectionId: $event.collectionId ?? null })"
683
- (rename)="rename.emit($event)"
684
- (move)="move.emit($event)"
685
- (delete)="delete.emit({ id: $event.id, kind: $event.kind })"
686
- >
687
- </app-collection-tree>
688
- </div>
689
- </div>
690
- <ng-template #menuTpl>
691
- <ul nz-menu>
692
- <li nz-menu-item (click)="createRequest.emit({ collectionId: null });visible=false" class="item">
693
- <nz-icon nzType="api"></nz-icon>
694
- <span>\u65B0\u5EFA\u8BF7\u6C42</span>
695
- </li>
696
- <li nz-menu-item (click)="createCollection.emit()" class="item">
697
- <nz-icon nzType="folder-add"></nz-icon>
698
- <span>\u65B0\u5EFA\u96C6\u5408</span>
699
- </li>
700
- </ul>
701
- </ng-template>
702
- `,
703
- styles: [request_collections_component_default]
704
- })
705
- ], RequestCollectionsComponent);
706
-
707
- // angular:jit:style:inline:src\app\pages\api-client\components\request-editor\auth-editor.component.ts;CiAgICAgIC53cmFweyBkaXNwbGF5OmZsZXg7IGZsZXgtZGlyZWN0aW9uOmNvbHVtbjsgaGVpZ2h0OjEwMCU7IG1pbi1oZWlnaHQ6MjIwcHg7IH0KICAgICAgLmJhcnsKICAgICAgICBkaXNwbGF5OmZsZXg7IGdhcDoxMHB4OyBhbGlnbi1pdGVtczpjZW50ZXI7CiAgICAgICAgcGFkZGluZzo4cHggMDsgYm9yZGVyLWJvdHRvbToxcHggc29saWQgI2YwZjBmMDsKICAgICAgfQogICAgICAudHlwZXsgd2lkdGg6MTYwcHg7IH0KICAgICAgLmlueyB3aWR0aDoxNDBweDsgfQoKICAgICAgLm1haW57IGZsZXg6MSAxIGF1dG87IG92ZXJmbG93OmF1dG87IHBhZGRpbmctdG9wOjEwcHg7IH0KICAgICAgLmVtcHR5eyBwYWRkaW5nOjEycHg7IG9wYWNpdHk6Ljc7IH0KCiAgICAgIC5ncmlkeyBkaXNwbGF5OmZsZXg7IGZsZXgtZGlyZWN0aW9uOmNvbHVtbjsgZ2FwOjEwcHg7IH0KICAgICAgLnJvd3sgZGlzcGxheTpncmlkOyBncmlkLXRlbXBsYXRlLWNvbHVtbnM6IDEwMHB4IDFmcjsgYWxpZ24taXRlbXM6Y2VudGVyOyBnYXA6MTBweDsgfQogICAgICAucm93LXRvcHsgYWxpZ24taXRlbXM6c3RhcnQ7IH0KICAgICAgLmxhYmVseyBmb250LXNpemU6MTJweDsgb3BhY2l0eTouODsgfQogICAg
708
- var auth_editor_component_default = "/* angular:styles/component:less;328f2c49622602f7047f70a3035d2e6ad9d23054ae6c988c99f892be532b2c3a;D:\\ng-manager\\webapp\\src\\app\\pages\\api-client\\components\\request-editor\\auth-editor.component.ts */\n.wrap {\n display: flex;\n flex-direction: column;\n height: 100%;\n min-height: 220px;\n}\n.bar {\n display: flex;\n gap: 10px;\n align-items: center;\n padding: 8px 0;\n border-bottom: 1px solid #f0f0f0;\n}\n.type {\n width: 160px;\n}\n.in {\n width: 140px;\n}\n.main {\n flex: 1 1 auto;\n overflow: auto;\n padding-top: 10px;\n}\n.empty {\n padding: 12px;\n opacity: 0.7;\n}\n.grid {\n display: flex;\n flex-direction: column;\n gap: 10px;\n}\n.row {\n display: grid;\n grid-template-columns: 100px 1fr;\n align-items: center;\n gap: 10px;\n}\n.row-top {\n align-items: start;\n}\n.label {\n font-size: 12px;\n opacity: 0.8;\n}\n/*# sourceMappingURL=auth-editor.component.css.map */\n";
709
-
710
- // node_modules/ng-zorro-antd/fesm2022/ng-zorro-antd-alert.mjs
711
- var NZ_CONFIG_MODULE_NAME = "alert";
712
- var NzAlertComponent = (() => {
713
- var _a;
714
- let _nzCloseable_decorators;
715
- let _nzCloseable_initializers = [];
716
- let _nzCloseable_extraInitializers = [];
717
- let _nzShowIcon_decorators;
718
- let _nzShowIcon_initializers = [];
719
- let _nzShowIcon_extraInitializers = [];
720
- return _a = class {
721
- cdr = inject(ChangeDetectorRef);
722
- directionality = inject(Directionality);
723
- destroyRef = inject(DestroyRef);
724
- _nzModuleName = NZ_CONFIG_MODULE_NAME;
725
- nzAction = null;
726
- nzCloseText = null;
727
- nzIconType = null;
728
- nzMessage = null;
729
- nzDescription = null;
730
- nzType = "info";
731
- nzCloseable = __runInitializers(this, _nzCloseable_initializers, false);
732
- nzShowIcon = (__runInitializers(this, _nzCloseable_extraInitializers), __runInitializers(this, _nzShowIcon_initializers, false));
733
- nzBanner = (__runInitializers(this, _nzShowIcon_extraInitializers), false);
734
- nzNoAnimation = false;
735
- nzIcon = null;
736
- nzOnClose = new EventEmitter();
737
- closed = false;
738
- iconTheme = "fill";
739
- inferredIconType = "info-circle";
740
- dir = "ltr";
741
- isTypeSet = false;
742
- isShowIconSet = false;
743
- constructor() {
744
- onConfigChangeEventForComponent(NZ_CONFIG_MODULE_NAME, () => this.cdr.markForCheck());
745
- }
746
- ngOnInit() {
747
- this.directionality.change?.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((direction) => {
748
- this.dir = direction;
749
- this.cdr.detectChanges();
750
- });
751
- this.dir = this.directionality.value;
752
- }
753
- closeAlert() {
754
- this.closed = true;
755
- }
756
- onFadeAnimationDone() {
757
- if (this.closed) {
758
- this.nzOnClose.emit(true);
759
- }
760
- }
761
- ngOnChanges(changes) {
762
- const { nzShowIcon, nzDescription, nzType, nzBanner } = changes;
763
- if (nzShowIcon) {
764
- this.isShowIconSet = true;
765
- }
766
- if (nzType) {
767
- this.isTypeSet = true;
768
- switch (this.nzType) {
769
- case "error":
770
- this.inferredIconType = "close-circle";
771
- break;
772
- case "success":
773
- this.inferredIconType = "check-circle";
774
- break;
775
- case "info":
776
- this.inferredIconType = "info-circle";
777
- break;
778
- case "warning":
779
- this.inferredIconType = "exclamation-circle";
780
- break;
781
- }
782
- }
783
- if (nzDescription) {
784
- this.iconTheme = this.nzDescription ? "outline" : "fill";
785
- }
786
- if (nzBanner) {
787
- if (!this.isTypeSet) {
788
- this.nzType = "warning";
789
- }
790
- if (!this.isShowIconSet) {
791
- this.nzShowIcon = true;
792
- }
793
- }
794
- }
795
- }, (() => {
796
- const _metadata = typeof Symbol === "function" && Symbol.metadata ? /* @__PURE__ */ Object.create(null) : void 0;
797
- _nzCloseable_decorators = [WithConfig()];
798
- _nzShowIcon_decorators = [WithConfig()];
799
- __esDecorate(null, null, _nzCloseable_decorators, { kind: "field", name: "nzCloseable", static: false, private: false, access: { has: (obj) => "nzCloseable" in obj, get: (obj) => obj.nzCloseable, set: (obj, value) => {
800
- obj.nzCloseable = value;
801
- } }, metadata: _metadata }, _nzCloseable_initializers, _nzCloseable_extraInitializers);
802
- __esDecorate(null, null, _nzShowIcon_decorators, { kind: "field", name: "nzShowIcon", static: false, private: false, access: { has: (obj) => "nzShowIcon" in obj, get: (obj) => obj.nzShowIcon, set: (obj, value) => {
803
- obj.nzShowIcon = value;
804
- } }, metadata: _metadata }, _nzShowIcon_initializers, _nzShowIcon_extraInitializers);
805
- if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
806
- })(), __publicField(_a, "\u0275fac", \u0275\u0275ngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: core_exports, type: _a, deps: [], target: FactoryTarget.Component })), __publicField(_a, "\u0275cmp", \u0275\u0275ngDeclareComponent({ minVersion: "17.0.0", version: "20.3.0", type: _a, isStandalone: true, selector: "nz-alert", inputs: { nzAction: "nzAction", nzCloseText: "nzCloseText", nzIconType: "nzIconType", nzMessage: "nzMessage", nzDescription: "nzDescription", nzType: "nzType", nzCloseable: ["nzCloseable", "nzCloseable", booleanAttribute], nzShowIcon: ["nzShowIcon", "nzShowIcon", booleanAttribute], nzBanner: ["nzBanner", "nzBanner", booleanAttribute], nzNoAnimation: ["nzNoAnimation", "nzNoAnimation", booleanAttribute], nzIcon: "nzIcon" }, outputs: { nzOnClose: "nzOnClose" }, exportAs: ["nzAlert"], usesOnChanges: true, ngImport: core_exports, template: `
807
- @if (!closed) {
808
- <div
809
- class="ant-alert"
810
- [class.ant-alert-rtl]="dir === 'rtl'"
811
- [class.ant-alert-success]="nzType === 'success'"
812
- [class.ant-alert-info]="nzType === 'info'"
813
- [class.ant-alert-warning]="nzType === 'warning'"
814
- [class.ant-alert-error]="nzType === 'error'"
815
- [class.ant-alert-no-icon]="!nzShowIcon"
816
- [class.ant-alert-banner]="nzBanner"
817
- [class.ant-alert-closable]="nzCloseable"
818
- [class.ant-alert-with-description]="!!nzDescription"
819
- [@.disabled]="nzNoAnimation"
820
- [@slideAlertMotion]
821
- (@slideAlertMotion.done)="onFadeAnimationDone()"
822
- >
823
- @if (nzShowIcon) {
824
- <div class="ant-alert-icon">
825
- @if (nzIcon) {
826
- <ng-container *nzStringTemplateOutlet="nzIcon"></ng-container>
827
- } @else {
828
- <nz-icon [nzType]="nzIconType || inferredIconType" [nzTheme]="iconTheme" />
829
- }
830
- </div>
831
- }
832
-
833
- @if (nzMessage || nzDescription) {
834
- <div class="ant-alert-content">
835
- @if (nzMessage) {
836
- <span class="ant-alert-message">
837
- <ng-container *nzStringTemplateOutlet="nzMessage">{{ nzMessage }}</ng-container>
838
- </span>
839
- }
840
- @if (nzDescription) {
841
- <span class="ant-alert-description">
842
- <ng-container *nzStringTemplateOutlet="nzDescription">{{ nzDescription }}</ng-container>
843
- </span>
844
- }
845
- </div>
846
- }
847
-
848
- @if (nzAction) {
849
- <div class="ant-alert-action">
850
- <ng-container *nzStringTemplateOutlet="nzAction">{{ nzAction }}</ng-container>
851
- </div>
852
- }
853
-
854
- @if (nzCloseable || nzCloseText) {
855
- <button type="button" tabindex="0" class="ant-alert-close-icon" (click)="closeAlert()">
856
- @if (nzCloseText) {
857
- <ng-container *nzStringTemplateOutlet="nzCloseText">
858
- <span class="ant-alert-close-text">{{ nzCloseText }}</span>
859
- </ng-container>
860
- } @else {
861
- <nz-icon nzType="close" />
862
- }
863
- </button>
864
- }
865
- </div>
866
- }
867
- `, isInline: true, dependencies: [{ kind: "ngmodule", type: NzIconModule }, { kind: "directive", type: NzIconDirective, selector: "nz-icon,[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "ngmodule", type: NzOutletModule }, { kind: "directive", type: NzStringTemplateOutletDirective, selector: "[nzStringTemplateOutlet]", inputs: ["nzStringTemplateOutletContext", "nzStringTemplateOutlet"], exportAs: ["nzStringTemplateOutlet"] }], animations: [slideAlertMotion], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None })), _a;
868
- })();
869
- \u0275\u0275ngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: core_exports, type: NzAlertComponent, decorators: [{
870
- type: Component,
871
- args: [{
872
- selector: "nz-alert",
873
- exportAs: "nzAlert",
874
- animations: [slideAlertMotion],
875
- imports: [NzIconModule, NzOutletModule],
876
- template: `
877
- @if (!closed) {
878
- <div
879
- class="ant-alert"
880
- [class.ant-alert-rtl]="dir === 'rtl'"
881
- [class.ant-alert-success]="nzType === 'success'"
882
- [class.ant-alert-info]="nzType === 'info'"
883
- [class.ant-alert-warning]="nzType === 'warning'"
884
- [class.ant-alert-error]="nzType === 'error'"
885
- [class.ant-alert-no-icon]="!nzShowIcon"
886
- [class.ant-alert-banner]="nzBanner"
887
- [class.ant-alert-closable]="nzCloseable"
888
- [class.ant-alert-with-description]="!!nzDescription"
889
- [@.disabled]="nzNoAnimation"
890
- [@slideAlertMotion]
891
- (@slideAlertMotion.done)="onFadeAnimationDone()"
892
- >
893
- @if (nzShowIcon) {
894
- <div class="ant-alert-icon">
895
- @if (nzIcon) {
896
- <ng-container *nzStringTemplateOutlet="nzIcon"></ng-container>
897
- } @else {
898
- <nz-icon [nzType]="nzIconType || inferredIconType" [nzTheme]="iconTheme" />
899
- }
900
- </div>
901
- }
902
-
903
- @if (nzMessage || nzDescription) {
904
- <div class="ant-alert-content">
905
- @if (nzMessage) {
906
- <span class="ant-alert-message">
907
- <ng-container *nzStringTemplateOutlet="nzMessage">{{ nzMessage }}</ng-container>
908
- </span>
909
- }
910
- @if (nzDescription) {
911
- <span class="ant-alert-description">
912
- <ng-container *nzStringTemplateOutlet="nzDescription">{{ nzDescription }}</ng-container>
913
- </span>
914
- }
915
- </div>
916
- }
917
-
918
- @if (nzAction) {
919
- <div class="ant-alert-action">
920
- <ng-container *nzStringTemplateOutlet="nzAction">{{ nzAction }}</ng-container>
921
- </div>
922
- }
923
-
924
- @if (nzCloseable || nzCloseText) {
925
- <button type="button" tabindex="0" class="ant-alert-close-icon" (click)="closeAlert()">
926
- @if (nzCloseText) {
927
- <ng-container *nzStringTemplateOutlet="nzCloseText">
928
- <span class="ant-alert-close-text">{{ nzCloseText }}</span>
929
- </ng-container>
930
- } @else {
931
- <nz-icon nzType="close" />
932
- }
933
- </button>
934
- }
935
- </div>
936
- }
937
- `,
938
- changeDetection: ChangeDetectionStrategy.OnPush,
939
- encapsulation: ViewEncapsulation.None
940
- }]
941
- }], ctorParameters: () => [], propDecorators: { nzAction: [{
942
- type: Input
943
- }], nzCloseText: [{
944
- type: Input
945
- }], nzIconType: [{
946
- type: Input
947
- }], nzMessage: [{
948
- type: Input
949
- }], nzDescription: [{
950
- type: Input
951
- }], nzType: [{
952
- type: Input
953
- }], nzCloseable: [{
954
- type: Input,
955
- args: [{ transform: booleanAttribute }]
956
- }], nzShowIcon: [{
957
- type: Input,
958
- args: [{ transform: booleanAttribute }]
959
- }], nzBanner: [{
960
- type: Input,
961
- args: [{ transform: booleanAttribute }]
962
- }], nzNoAnimation: [{
963
- type: Input,
964
- args: [{ transform: booleanAttribute }]
965
- }], nzIcon: [{
966
- type: Input
967
- }], nzOnClose: [{
968
- type: Output
969
- }] } });
970
- var NzAlertModule = class _NzAlertModule {
971
- static \u0275fac = \u0275\u0275ngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: core_exports, type: _NzAlertModule, deps: [], target: FactoryTarget.NgModule });
972
- static \u0275mod = \u0275\u0275ngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.0", ngImport: core_exports, type: _NzAlertModule, imports: [NzAlertComponent], exports: [NzAlertComponent] });
973
- static \u0275inj = \u0275\u0275ngDeclareInjector({ minVersion: "12.0.0", version: "20.3.0", ngImport: core_exports, type: _NzAlertModule, imports: [NzAlertComponent] });
974
- };
975
- \u0275\u0275ngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: core_exports, type: NzAlertModule, decorators: [{
976
- type: NgModule,
977
- args: [{
978
- exports: [NzAlertComponent],
979
- imports: [NzAlertComponent]
980
- }]
981
- }] });
982
-
983
- // src/app/pages/api-client/components/request-editor/auth-editor.component.ts
984
- var AuthEditorComponent = class AuthEditorComponent2 {
985
- auth = input(void 0);
986
- authChange = new EventEmitter();
987
- types = ["none", "basic", "bearer", "cookie", "apikey"];
988
- type = computed(() => this.auth()?.type ?? "none");
989
- basicUsername = computed(() => this.auth()?.type === "basic" ? this.auth()?.basic?.username ?? "" : "");
990
- basicPassword = computed(() => this.auth()?.type === "basic" ? this.auth()?.basic?.password ?? "" : "");
991
- bearerToken = computed(() => this.auth()?.type === "bearer" ? this.auth()?.bearer?.token ?? "" : "");
992
- cookieValue = computed(() => this.auth()?.type === "cookie" ? this.auth()?.cookie?.value ?? "" : "");
993
- apiKeyIn = computed(() => {
994
- if (this.auth()?.type !== "apikey")
995
- return "header";
996
- return this.auth()?.apikey?.in ?? "header";
997
- });
998
- apiKeyKey = computed(() => this.auth()?.type === "apikey" ? this.auth()?.apikey?.key ?? "" : "");
999
- apiKeyValue = computed(() => this.auth()?.type === "apikey" ? this.auth()?.apikey?.value ?? "" : "");
1000
- setType(t) {
1001
- if (t === "none") {
1002
- this.authChange.emit({ type: "none" });
1003
- return;
1004
- }
1005
- if (t === "basic") {
1006
- this.authChange.emit({
1007
- type: "basic",
1008
- basic: { username: "", password: "" }
1009
- });
1010
- return;
1011
- }
1012
- if (t === "bearer") {
1013
- this.authChange.emit({
1014
- type: "bearer",
1015
- bearer: { token: "" }
1016
- });
1017
- return;
1018
- }
1019
- if (t === "cookie") {
1020
- this.authChange.emit({
1021
- type: "cookie",
1022
- cookie: { value: "" }
1023
- });
1024
- return;
1025
- }
1026
- this.authChange.emit({
1027
- type: "apikey",
1028
- apikey: { in: "header", key: "", value: "" }
1029
- });
1030
- }
1031
- setBasicUsername(v) {
1032
- const current = this.auth();
1033
- const next = __spreadProps(__spreadValues({}, current ?? { type: "basic" }), { type: "basic", basic: __spreadProps(__spreadValues({}, current?.basic), { username: v }) });
1034
- this.authChange.emit(next);
1035
- }
1036
- setBasicPassword(v) {
1037
- const current = this.auth();
1038
- const next = __spreadProps(__spreadValues({}, current ?? { type: "basic" }), { type: "basic", basic: __spreadProps(__spreadValues({}, current?.basic), { password: v }) });
1039
- this.authChange.emit(next);
1040
- }
1041
- setBearerToken(v) {
1042
- const current = this.auth();
1043
- const next = __spreadProps(__spreadValues({}, current ?? { type: "bearer" }), { type: "bearer", bearer: __spreadProps(__spreadValues({}, current?.bearer), { token: v }) });
1044
- this.authChange.emit(next);
1045
- }
1046
- setCookieValue(v) {
1047
- const current = this.auth();
1048
- const next = __spreadProps(__spreadValues({}, current ?? { type: "cookie" }), { type: "cookie", cookie: __spreadProps(__spreadValues({}, current?.cookie), { value: v }) });
1049
- this.authChange.emit(next);
1050
- }
1051
- setApiKeyIn(v) {
1052
- const current = this.auth();
1053
- const next = __spreadProps(__spreadValues({}, current ?? { type: "apikey" }), {
1054
- type: "apikey",
1055
- apikey: __spreadProps(__spreadValues({}, current?.apikey), { in: v, key: this.apiKeyKey(), value: this.apiKeyValue() })
1056
- });
1057
- this.authChange.emit(next);
1058
- }
1059
- setApiKeyKey(v) {
1060
- const current = this.auth();
1061
- const next = __spreadProps(__spreadValues({}, current ?? { type: "apikey" }), {
1062
- type: "apikey",
1063
- apikey: __spreadProps(__spreadValues({}, current?.apikey), { in: this.apiKeyIn(), key: v, value: this.apiKeyValue() })
1064
- });
1065
- this.authChange.emit(next);
1066
- }
1067
- setApiKeyValue(v) {
1068
- const current = this.auth();
1069
- const next = __spreadProps(__spreadValues({}, current ?? { type: "apikey" }), {
1070
- type: "apikey",
1071
- apikey: __spreadProps(__spreadValues({}, current?.apikey), { in: this.apiKeyIn(), key: this.apiKeyKey(), value: v })
1072
- });
1073
- this.authChange.emit(next);
1074
- }
1075
- static propDecorators = {
1076
- auth: [{ type: Input, args: [{ isSignal: true, alias: "auth", required: false, transform: void 0 }] }],
1077
- authChange: [{ type: Output }]
1078
- };
1079
- };
1080
- AuthEditorComponent = __decorate([
1081
- Component({
1082
- selector: "app-auth-editor",
1083
- standalone: true,
1084
- imports: [CommonModule, FormsModule, NzSelectModule, NzInputModule, NzAlertModule],
1085
- template: `
1086
- <div class="wrap">
1087
- <div class="bar">
1088
- <nz-select class="type" [ngModel]="type()" (ngModelChange)="setType($event)">
1089
- @for (t of types; track t) {
1090
- <nz-option [nzValue]="t" [nzLabel]="t"></nz-option>
1091
- }
1092
- </nz-select>
1093
-
1094
- @if(type()==='apikey'){
1095
- <nz-select class="in" [ngModel]="apiKeyIn()" (ngModelChange)="setApiKeyIn($event)">
1096
- <nz-option nzValue="header" nzLabel="in: header"></nz-option>
1097
- <nz-option nzValue="query" nzLabel="in: query"></nz-option>
1098
- </nz-select>
1099
- }
1100
- </div>
1101
-
1102
- <div class="main">
1103
- @switch (type()) {
1104
- @case ('none') {
1105
- <div class="empty">\u65E0\u9274\u6743</div>
1106
- }
1107
-
1108
- @case ('basic') {
1109
- <div class="grid">
1110
- <div class="row">
1111
- <div class="label">Username</div>
1112
- <input
1113
- nz-input
1114
- placeholder="username"
1115
- [ngModel]="basicUsername()"
1116
- (ngModelChange)="setBasicUsername($event)"
1117
- />
1118
- </div>
1119
-
1120
- <div class="row">
1121
- <div class="label">Password</div>
1122
- <input
1123
- nz-input
1124
- placeholder="password"
1125
- type="password"
1126
- [ngModel]="basicPassword()"
1127
- (ngModelChange)="setBasicPassword($event)"
1128
- />
1129
- </div>
1130
- </div>
1131
- }
1132
-
1133
- @case ('bearer') {
1134
- <div class="grid">
1135
- <div class="row">
1136
- <div class="label">Token</div>
1137
- <input
1138
- nz-input
1139
- placeholder="Bearer token"
1140
- [ngModel]="bearerToken()"
1141
- (ngModelChange)="setBearerToken($event)"
1142
- />
1143
- </div>
1144
- </div>
1145
- }
1146
-
1147
- @case ('cookie') {
1148
- <div class="grid">
1149
- <div class="row row-top">
1150
- <div class="label">Cookie</div>
1151
- <textarea
1152
- nz-input
1153
- rows="4"
1154
- placeholder="ngm_hub_token=...; other=value"
1155
- [ngModel]="cookieValue()"
1156
- (ngModelChange)="setCookieValue($event)"
1157
- ></textarea>
1158
- </div>
1159
-
1160
- <nz-alert
1161
- nzType="info"
1162
- nzShowIcon
1163
- nzMessage="\u586B\u5199\u5B8C\u6574 Cookie \u5934\u503C\u3002\u9002\u5408\u5148\u8C03\u7528\u767B\u5F55\u63A5\u53E3\u62FF\u5230 Set-Cookie\uFF0C\u518D\u7C98\u8D34\u5230\u8FD9\u91CC\u590D\u7528\u4F1A\u8BDD\u3002"
1164
- ></nz-alert>
1165
- </div>
1166
- }
1167
-
1168
- @case ('apikey') {
1169
- <div class="grid">
1170
- <div class="row">
1171
- <div class="label">Key</div>
1172
- <input
1173
- nz-input
1174
- placeholder="x-api-key / api_key"
1175
- [ngModel]="apiKeyKey()"
1176
- (ngModelChange)="setApiKeyKey($event)"
1177
- />
1178
- </div>
1179
-
1180
- <div class="row">
1181
- <div class="label">Value</div>
1182
- <input
1183
- nz-input
1184
- placeholder="value"
1185
- [ngModel]="apiKeyValue()"
1186
- (ngModelChange)="setApiKeyValue($event)"
1187
- />
1188
- </div>
1189
-
1190
- @if(apiKeyIn()==='query'){
1191
- <nz-alert
1192
- nzType="info"
1193
- nzShowIcon
1194
- nzMessage="\u63D0\u793A\uFF1Aquery \u578B API Key \u4E0D\u4F1A\u5199\u5165\u8BF7\u6C42\u5934\uFF0C\u4F1A\u5728\u53D1\u9001\u65F6\u62FC\u63A5\u5230 URL \u67E5\u8BE2\u53C2\u6570\u4E2D\u3002"
1195
- ></nz-alert>
1196
- }
1197
- @if(apiKeyIn()==='header'){
1198
- <nz-alert
1199
- nzType="info"
1200
- nzShowIcon
1201
- nzMessage="\u63D0\u793A\uFF1Aheader \u578B API Key \u4F1A\u5728\u53D1\u9001\u65F6\u5199\u5165\u8BF7\u6C42\u5934\u3002"
1202
- ></nz-alert>
1203
- }
1204
- </div>
1205
- }
1206
- }
1207
- </div>
1208
- </div>
1209
- `,
1210
- styles: [auth_editor_component_default]
1211
- })
1212
- ], AuthEditorComponent);
1213
-
1214
- // angular:jit:style:inline:src\app\pages\api-client\components\request-editor\body-editor.component.ts;CiAgICAud3JhcHsgZGlzcGxheTpmbGV4OyBmbGV4LWRpcmVjdGlvbjpjb2x1bW47IGhlaWdodDoxMDAlOyBtaW4taGVpZ2h0OjI2MHB4OyB9CiAgICAuYmFyewogICAgICBkaXNwbGF5OmZsZXg7IGdhcDoxMHB4OyBhbGlnbi1pdGVtczpjZW50ZXI7CiAgICAgIHBhZGRpbmc6OHB4IDA7IGJvcmRlci1ib3R0b206MXB4IHNvbGlkICNmMGYwZjA7CiAgICB9CiAgICAubW9kZXsgd2lkdGg6MTQwcHg7IH0KICAgIC5jdHlwZXsgZmxleDoxIDEgYXV0bzsgfQogICAgLm1haW57IGZsZXg6MSAxIGF1dG87IG92ZXJmbG93OmF1dG87IHBhZGRpbmctdG9wOjEwcHg7IH0KICAgIC50YXsgd2lkdGg6MTAwJTsgaGVpZ2h0OjEwMCU7IG1pbi1oZWlnaHQ6MjQwcHg7IGZvbnQtZmFtaWx5OiB1aS1tb25vc3BhY2UsIFNGTW9uby1SZWd1bGFyLCBNZW5sbywgTW9uYWNvLCBDb25zb2xhcywgIkxpYmVyYXRpb24gTW9ubyIsICJDb3VyaWVyIE5ldyIsIG1vbm9zcGFjZTsgZm9udC1zaXplOjEycHg7IH0KICAgIC5lbXB0eXsgcGFkZGluZzoxMnB4OyBvcGFjaXR5Oi43OyB9CiAgICAuZXJyeyBtYXJnaW4tdG9wOjhweDsgY29sb3I6I2E4MDcxYTsgZm9udC1zaXplOjEycHg7IH0KICA=
1215
- var body_editor_component_default = '/* angular:styles/component:less;a2d138daa1be7ada152d2490f4e888dcacc12e206ea493e4a20e8f2b036ce7b0;D:\\ng-manager\\webapp\\src\\app\\pages\\api-client\\components\\request-editor\\body-editor.component.ts */\n.wrap {\n display: flex;\n flex-direction: column;\n height: 100%;\n min-height: 260px;\n}\n.bar {\n display: flex;\n gap: 10px;\n align-items: center;\n padding: 8px 0;\n border-bottom: 1px solid #f0f0f0;\n}\n.mode {\n width: 140px;\n}\n.ctype {\n flex: 1 1 auto;\n}\n.main {\n flex: 1 1 auto;\n overflow: auto;\n padding-top: 10px;\n}\n.ta {\n width: 100%;\n height: 100%;\n min-height: 240px;\n font-family:\n ui-monospace,\n SFMono-Regular,\n Menlo,\n Monaco,\n Consolas,\n "Liberation Mono",\n "Courier New",\n monospace;\n font-size: 12px;\n}\n.empty {\n padding: 12px;\n opacity: 0.7;\n}\n.err {\n margin-top: 8px;\n color: #a8071a;\n font-size: 12px;\n}\n/*# sourceMappingURL=body-editor.component.css.map */\n';
1216
-
1217
- // angular:jit:style:inline:src\app\pages\api-client\components\request-editor\kv-table.component.ts;CiAgICAua3Ytd3JhcHsgZGlzcGxheTpmbGV4OyBmbGV4LWRpcmVjdGlvbjpjb2x1bW47IGhlaWdodDoxMDAlOyB9CiAgICAua3YtdG9vbGJhcnsKICAgICAgcGFkZGluZzo4cHggMDsKICAgICAgZGlzcGxheTpmbGV4OwogICAgICBqdXN0aWZ5LWNvbnRlbnQ6c3BhY2UtYmV0d2VlbjsKICAgICAgYWxpZ24taXRlbXM6Y2VudGVyOwogICAgICBnYXA6MTBweDsKICAgIH0KICAgIC5rdi10b29sYmFyIC5sZWZ0LCAua3YtdG9vbGJhciAucmlnaHR7IGRpc3BsYXk6ZmxleDsgZ2FwOjhweDsgYWxpZ24taXRlbXM6Y2VudGVyOyB9CiAgICAuaGludHsgZm9udC1zaXplOjEycHg7IG9wYWNpdHk6Ljc7IH0KCiAgICAua3YtaGVhZHsKICAgICAgZGlzcGxheTpncmlkOwogICAgICBncmlkLXRlbXBsYXRlLWNvbHVtbnM6IDQwcHggMWZyIDFmciAyZnIgNDRweDsKICAgICAgZ2FwOjhweDsKICAgICAgcGFkZGluZzo2cHggMDsKICAgICAgZm9udC1zaXplOjE0cHg7CiAgICAgIGJvcmRlci1ib3R0b206MXB4IHNvbGlkICNmMGYwZjA7CiAgICAgIGFsaWduLWl0ZW1zOmNlbnRlcjsKICAgICAgLmMta2V5LCAuYy12YWwsIC5jLWRlc3sKICAgICAgICBvcGFjaXR5Oi43NTsKICAgICAgfQogICAgfQoKICAgIC5rdi1ib2R5ewogICAgICBmbGV4OjEgMSBhdXRvOwogICAgICBvdmVyZmxvdzphdXRvOwogICAgICBwYWRkaW5nOjhweCAwOwogICAgfQoKICAgIC5rdi1yb3d7CiAgICAgIGRpc3BsYXk6Z3JpZDsKICAgICAgZ3JpZC10ZW1wbGF0ZS1jb2x1bW5zOiA0MHB4IDFmciAxZnIgMmZyIDQ0cHg7CiAgICAgIGdhcDo4cHg7CiAgICAgIGFsaWduLWl0ZW1zOmNlbnRlcjsKICAgICAgcGFkZGluZzo2cHggMDsKICAgICAgYm9yZGVyLWJvdHRvbToxcHggZGFzaGVkICNmMGYwZjA7CiAgICB9CgogICAgLmMtY2hlY2t7IGRpc3BsYXk6ZmxleDsganVzdGlmeS1jb250ZW50OmNlbnRlcjsgfQogICAgLmMtb3B7IGRpc3BsYXk6ZmxleDsganVzdGlmeS1jb250ZW50OmNlbnRlcjsgfQoKICAgIC5rdi1lbXB0eXsKICAgICAgcGFkZGluZzoxNnB4OwogICAgICBvcGFjaXR5Oi43NTsKICAgICAgZGlzcGxheTpmbGV4OwogICAgICBhbGlnbi1pdGVtczpjZW50ZXI7CiAgICAgIGp1c3RpZnktY29udGVudDpzcGFjZS1iZXR3ZWVuOwogICAgICBib3JkZXI6MXB4IGRhc2hlZCAjZThlOGU4OwogICAgICBib3JkZXItcmFkaXVzOjhweDsKICAgICAgbWFyZ2luLXRvcDo4cHg7CiAgICB9CiAg
1218
- var kv_table_component_default = "/* angular:styles/component:less;050f257cd99878760f38d3077de3741ff43d594fd3d097d70835075f643e2358;D:\\ng-manager\\webapp\\src\\app\\pages\\api-client\\components\\request-editor\\kv-table.component.ts */\n.kv-wrap {\n display: flex;\n flex-direction: column;\n height: 100%;\n}\n.kv-toolbar {\n padding: 8px 0;\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 10px;\n}\n.kv-toolbar .left,\n.kv-toolbar .right {\n display: flex;\n gap: 8px;\n align-items: center;\n}\n.hint {\n font-size: 12px;\n opacity: 0.7;\n}\n.kv-head {\n display: grid;\n grid-template-columns: 40px 1fr 1fr 2fr 44px;\n gap: 8px;\n padding: 6px 0;\n font-size: 14px;\n border-bottom: 1px solid #f0f0f0;\n align-items: center;\n}\n.kv-head .c-key,\n.kv-head .c-val,\n.kv-head .c-des {\n opacity: 0.75;\n}\n.kv-body {\n flex: 1 1 auto;\n overflow: auto;\n padding: 8px 0;\n}\n.kv-row {\n display: grid;\n grid-template-columns: 40px 1fr 1fr 2fr 44px;\n gap: 8px;\n align-items: center;\n padding: 6px 0;\n border-bottom: 1px dashed #f0f0f0;\n}\n.c-check {\n display: flex;\n justify-content: center;\n}\n.c-op {\n display: flex;\n justify-content: center;\n}\n.kv-empty {\n padding: 16px;\n opacity: 0.75;\n display: flex;\n align-items: center;\n justify-content: space-between;\n border: 1px dashed #e8e8e8;\n border-radius: 8px;\n margin-top: 8px;\n}\n/*# sourceMappingURL=kv-table.component.css.map */\n";
1219
-
1220
- // src/app/pages/api-client/components/request-editor/kv-table.component.ts
1221
- function generateRowId() {
1222
- return `kv_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
1223
- }
1224
- var KvTableComponent = class KvTableComponent2 {
1225
- ngOnChanges(changes) {
1226
- if (changes["rows"]) {
1227
- this.rows = this.withTrailingBlank(this.ensureRowIds(this.rows));
1228
- }
1229
- }
1230
- rows = [];
1231
- rowsChange = new EventEmitter();
1232
- keyLabel = "Key";
1233
- valueLabel = "Value";
1234
- keyPlaceholder = "key";
1235
- valuePlaceholder = "value";
1236
- descriptionLabel = "Description";
1237
- keepTrailingBlank = true;
1238
- enabledCount = computed(() => this.rows.filter((x) => x.enabled).length);
1239
- isAllEnabled() {
1240
- return this.rows.length > 0 && this.rows.every((x) => x.enabled);
1241
- }
1242
- toggleEnabled(checked) {
1243
- const next = this.rows.map((r) => __spreadProps(__spreadValues({}, r), { enabled: checked }));
1244
- this.emit(next);
1245
- }
1246
- emit(next) {
1247
- this.rowsChange.emit(next);
1248
- }
1249
- /**
1250
- * 确保所有行都有唯一 ID
1251
- */
1252
- ensureRowIds(rows) {
1253
- return rows.map((r) => {
1254
- if (!r.id || r.id.trim() === "") {
1255
- return __spreadProps(__spreadValues({}, r), { id: generateRowId() });
1256
- }
1257
- return r;
1258
- });
1259
- }
1260
- withTrailingBlank(rows) {
1261
- return this.keepTrailingBlank ? this.ensureTrailingBlank(rows) : rows;
1262
- }
1263
- createBlankRow() {
1264
- return { id: generateRowId(), key: "", value: "", description: "", enabled: true };
1265
- }
1266
- isBlankRow(r) {
1267
- if (!r)
1268
- return true;
1269
- const k = (r.key ?? "").trim();
1270
- const v = (r.value ?? "").trim();
1271
- const d = (r.description ?? "").trim();
1272
- return !k && !v && !d;
1273
- }
1274
- /** 核心:保证末尾永远有一行空白行 */
1275
- ensureTrailingBlank(rows) {
1276
- const list = Array.isArray(rows) ? rows : [];
1277
- if (list.length === 0)
1278
- return [this.createBlankRow()];
1279
- const last = list[list.length - 1];
1280
- if (this.isBlankRow(last))
1281
- return list;
1282
- return [...list, this.createBlankRow()];
1283
- }
1284
- /** 轻量比较:同引用直接认为相同;否则只比较长度+最后一行是否空白(避免频繁 emit) */
1285
- sameRowsRefOrContent(a, b) {
1286
- if (a === b)
1287
- return true;
1288
- if (a.length !== b.length)
1289
- return false;
1290
- const aLastBlank = this.isBlankRow(a[a.length - 1]);
1291
- const bLastBlank = this.isBlankRow(b[b.length - 1]);
1292
- return aLastBlank === bLastBlank;
1293
- }
1294
- removeRow(i) {
1295
- const base = this.rows.filter((_, idx) => idx !== i);
1296
- this.emit(this.withTrailingBlank(base));
1297
- }
1298
- setEnabled(i, enabled) {
1299
- const base = this.rows.map((r, idx) => idx === i ? __spreadProps(__spreadValues({}, r), { enabled }) : r);
1300
- this.emit(base);
1301
- }
1302
- setValue(i, value) {
1303
- this.patchRow(i, { value });
1304
- }
1305
- setKey(i, key) {
1306
- this.patchRow(i, { key });
1307
- }
1308
- setDescription(i, description) {
1309
- this.patchRow(i, { description });
1310
- }
1311
- patchRow(i, partial) {
1312
- const base = this.rows.map((r, idx) => idx === i ? __spreadValues(__spreadValues({}, r), partial) : r);
1313
- this.emit(this.withTrailingBlank(base));
1314
- }
1315
- addRow() {
1316
- const base = [...this.rows, this.createBlankRow()];
1317
- this.emit(this.withTrailingBlank(base));
1318
- }
1319
- clearDisabled() {
1320
- const base = this.rows.filter((x) => x.enabled);
1321
- this.emit(this.withTrailingBlank(base));
1322
- }
1323
- static propDecorators = {
1324
- rows: [{ type: Input }],
1325
- rowsChange: [{ type: Output }],
1326
- keyLabel: [{ type: Input }],
1327
- valueLabel: [{ type: Input }],
1328
- keyPlaceholder: [{ type: Input }],
1329
- valuePlaceholder: [{ type: Input }],
1330
- descriptionLabel: [{ type: Input }],
1331
- keepTrailingBlank: [{ type: Input }]
1332
- };
1333
- };
1334
- KvTableComponent = __decorate([
1335
- Component({
1336
- selector: "app-kv-table",
1337
- standalone: true,
1338
- imports: [
1339
- CommonModule,
1340
- FormsModule,
1341
- NzButtonModule,
1342
- NzCheckboxModule,
1343
- NzInputModule,
1344
- NzIconModule,
1345
- NzTooltipModule
1346
- ],
1347
- template: `
1348
- <div class="kv-wrap">
1349
- <div class="kv-head">
1350
- <div class="c-check">
1351
- @if(keepTrailingBlank){
1352
- <label nz-checkbox [ngModel]="isAllEnabled()"
1353
- (ngModelChange)="toggleEnabled($event); "
1354
- ></label>
1355
- }
1356
- </div>
1357
- <div class="c-key">{{keyLabel}}</div>
1358
- <div class="c-val">{{valueLabel}}</div>
1359
- <div class="c-des">{{descriptionLabel}}</div>
1360
- <div class="c-op"></div>
1361
- </div>
1362
- <div class="kv-body">
1363
- @for (r of rows; let idx = $index; track r.id) {
1364
- <div class="kv-row">
1365
- <div class="c-check">
1366
- <label nz-checkbox [ngModel]="r.enabled" [nzDisabled]="!keepTrailingBlank" (ngModelChange)="setEnabled($index, $event)"></label>
1367
- </div>
1368
- <div class="c-key" [nz-tooltip]="!keepTrailingBlank ? '\u81EA\u52A8\u63D0\u53D6Url \u4E2D\u7684 Path \u53C2\u6570\uFF0C\u652F\u6301{param} \u4E0E :param' : ''">
1369
- <input
1370
- nz-input
1371
- [readonly]="!keepTrailingBlank"
1372
- [placeholder]="keyPlaceholder"
1373
- [ngModel]="r.key"
1374
- (ngModelChange)="setKey(idx, $event)"
1375
- />
1376
- </div>
1377
- <div class="c-val">
1378
- <input
1379
- nz-input
1380
- [placeholder]="valuePlaceholder"
1381
- [ngModel]="r.value"
1382
- (ngModelChange)="setValue(idx, $event)"
1383
- />
1384
- </div>
1385
- <div class="c-des">
1386
- <input
1387
- nz-input
1388
- [placeholder]="descriptionLabel"
1389
- [ngModel]="r.description"
1390
- (ngModelChange)="setDescription(idx, $event)"
1391
- />
1392
- </div>
1393
- <div class="c-op">
1394
- <button nz-button nzType="text" (click)="removeRow(idx)" nz-tooltip nzTooltipTitle="\u5220\u9664">
1395
- <nz-icon nzType="minus-circle" nzTheme="outline" />
1396
- </button>
1397
- </div>
1398
- </div>
1399
- }
1400
- </div>
1401
- </div>
1402
- `,
1403
- styles: [kv_table_component_default]
1404
- })
1405
- ], KvTableComponent);
1406
-
1407
- // src/app/pages/api-client/components/request-editor/body-editor.component.ts
1408
- var import_lodash = __toESM(require_lodash());
1409
- var BodyEditorComponent = class BodyEditorComponent2 {
1410
- msg = inject(NzMessageService);
1411
- body;
1412
- bodyChange = new EventEmitter();
1413
- //用 signal 承载输入
1414
- bodySig = signal(void 0);
1415
- modes = ["none", "json", "text", "urlencoded", "form", "binary"];
1416
- // local json text buffer(避免用户输入过程中频繁 JSON.parse 崩)
1417
- _jsonText = signal("");
1418
- mode = computed(() => this.bodySig()?.mode ?? "none");
1419
- contentType = computed(() => this.bodySig()?.contentType ?? "");
1420
- jsonText = computed(() => {
1421
- if (this.mode() !== "json")
1422
- return "";
1423
- const c = this.body?.content;
1424
- if (typeof c === "string")
1425
- return c;
1426
- if (c == null)
1427
- return this._jsonText() || "";
1428
- try {
1429
- return JSON.stringify(c, null, 2);
1430
- } catch {
1431
- return this._jsonText() || "";
1432
- }
1433
- });
1434
- jsonError = signal("");
1435
- textBody = computed(() => this.body?.mode === "text" ? String(this.body?.content ?? "") : "");
1436
- urlRows = computed(() => {
1437
- if (this.body?.mode !== "urlencoded")
1438
- return [];
1439
- const c = this.body?.content;
1440
- if (!c || typeof c !== "object" || Array.isArray(c))
1441
- return [];
1442
- return Object.entries(c).map(([k, v]) => ({ key: k, value: String(v ?? ""), enabled: true, id: (0, import_lodash.uniqueId)() }));
1443
- });
1444
- setMode(m) {
1445
- const prev = this.body;
1446
- const next = __spreadProps(__spreadValues({}, prev ?? {}), { mode: m });
1447
- if (!next.contentType) {
1448
- if (m === "json")
1449
- next.contentType = "application/json; charset=utf-8";
1450
- if (m === "text")
1451
- next.contentType = "text/plain; charset=utf-8";
1452
- if (m === "urlencoded")
1453
- next.contentType = "application/x-www-form-urlencoded; charset=utf-8";
1454
- if (m === "none")
1455
- next.contentType = void 0;
1456
- }
1457
- if (m === "none") {
1458
- this.bodyChange.emit({ mode: "none" });
1459
- return;
1460
- }
1461
- if (m === "json" && prev?.mode !== "json")
1462
- next.content = {};
1463
- if (m === "text" && prev?.mode !== "text")
1464
- next.content = "";
1465
- if (m === "urlencoded" && prev?.mode !== "urlencoded")
1466
- next.content = {};
1467
- this.bodyChange.emit(next);
1468
- }
1469
- ngOnChanges(changes) {
1470
- if (changes["body"]) {
1471
- const b = changes["body"].currentValue;
1472
- this.bodySig.set(b);
1473
- if (b?.mode === "json") {
1474
- if (typeof b.content === "string")
1475
- this._jsonText.set(b.content);
1476
- else
1477
- this._jsonText.set(b.content ? JSON.stringify(b.content, null, 2) : "");
1478
- this.jsonError.set("");
1479
- }
1480
- }
1481
- }
1482
- setContentType(v) {
1483
- const m = this.mode();
1484
- const next = __spreadProps(__spreadValues({}, this.body ?? { mode: m }), { contentType: v });
1485
- this.bodyChange.emit(next);
1486
- }
1487
- setTextBody(v) {
1488
- const next = __spreadProps(__spreadValues({}, this.body ?? { mode: "text" }), { mode: "text", content: v });
1489
- this.bodyChange.emit(next);
1490
- }
1491
- setJsonText(v) {
1492
- this._jsonText.set(v);
1493
- this.jsonError.set("");
1494
- try {
1495
- const parsed = v.trim() ? JSON.parse(v) : {};
1496
- const next = __spreadProps(__spreadValues({}, this.body ?? { mode: "json" }), { mode: "json", content: parsed });
1497
- this.bodyChange.emit(next);
1498
- } catch (e) {
1499
- this.jsonError.set("JSON \u4E0D\u5408\u6CD5\uFF08\u7EE7\u7EED\u8F93\u5165\u5373\u53EF\uFF09");
1500
- }
1501
- }
1502
- formatJson() {
1503
- const m = this.mode();
1504
- if (m !== "json")
1505
- return;
1506
- const c = this.body?.content;
1507
- try {
1508
- const text = JSON.stringify(c ?? {}, null, 2);
1509
- this._jsonText.set(text);
1510
- this.jsonError.set("");
1511
- const next = __spreadProps(__spreadValues({}, this.body ?? { mode: "json" }), { mode: "json", content: c ?? {} });
1512
- this.bodyChange.emit(next);
1513
- this.msg.success("\u5DF2\u683C\u5F0F\u5316");
1514
- } catch {
1515
- this.msg.error("\u683C\u5F0F\u5316\u5931\u8D25");
1516
- }
1517
- }
1518
- setUrlRows(rows) {
1519
- const obj = {};
1520
- for (const r of rows) {
1521
- if (!r.enabled)
1522
- continue;
1523
- const k = (r.key ?? "").trim();
1524
- if (!k)
1525
- continue;
1526
- obj[k] = String(r.value ?? "");
1527
- }
1528
- const next = __spreadProps(__spreadValues({}, this.body ?? { mode: "urlencoded" }), { mode: "urlencoded", content: obj });
1529
- this.bodyChange.emit(next);
1530
- }
1531
- static propDecorators = {
1532
- body: [{ type: Input }],
1533
- bodyChange: [{ type: Output }]
1534
- };
1535
- };
1536
- BodyEditorComponent = __decorate([
1537
- Component({
1538
- selector: "app-body-editor",
1539
- standalone: true,
1540
- imports: [CommonModule, FormsModule, NzButtonModule, NzInputModule, NzSelectModule, KvTableComponent],
1541
- template: `
1542
- <div class="wrap">
1543
- <div class="bar">
1544
- <nz-select class="mode" [ngModel]="mode()" (ngModelChange)="setMode($event)">
1545
- @for (m of modes; track m) {
1546
- <nz-option [nzValue]="m" [nzLabel]="m"></nz-option>
1547
- }
1548
- </nz-select>
1549
-
1550
- <input
1551
- nz-input
1552
- class="ctype"
1553
- placeholder="content-type\uFF08\u53EF\u9009\uFF09"
1554
- [ngModel]="contentType()"
1555
- (ngModelChange)="setContentType($event)"
1556
- />
1557
-
1558
- @if(mode()==='json'){
1559
- <button nz-button nzType="default" (click)="formatJson()">\u683C\u5F0F\u5316 JSON</button>
1560
- }
1561
- </div>
1562
-
1563
- <div class="main">
1564
- @switch (mode()) {
1565
- @case ('none') {
1566
- <div class="empty">\u65E0 Body</div>
1567
- }
1568
- @case ('text') {
1569
- <textarea
1570
- nz-input
1571
- class="ta"
1572
- placeholder="\u6587\u672C\u5185\u5BB9"
1573
- [ngModel]="textBody()"
1574
- (ngModelChange)="setTextBody($event)"
1575
- ></textarea>
1576
- }
1577
- @case ('json') {
1578
- <textarea
1579
- nz-input
1580
- class="ta"
1581
- placeholder="{ }"
1582
- [ngModel]="jsonText()"
1583
- (ngModelChange)="setJsonText($event)"
1584
- ></textarea>
1585
- @if(jsonError()){
1586
- <div class="err">{{jsonError()}}</div>
1587
- }
1588
- }
1589
- @case ('urlencoded') {
1590
- <app-kv-table
1591
- [rows]="urlRows()"
1592
- (rowsChange)="setUrlRows($event)"
1593
- keyLabel="Key"
1594
- valueLabel="Value"
1595
- keyPlaceholder="a"
1596
- valuePlaceholder="1"
1597
- />
1598
- }
1599
- @default {
1600
- <div class="empty">MVP \u4EC5\u652F\u6301 none/json/text/urlencoded</div>
1601
- }
1602
- }
1603
- </div>
1604
- </div>
1605
- `,
1606
- styles: [body_editor_component_default]
1607
- })
1608
- ], BodyEditorComponent);
1609
-
1610
- // angular:jit:style:inline:src\app\pages\api-client\components\request-editor\env-picker.component.ts;CiAgICAucGlja2VyeyBkaXNwbGF5OmZsZXg7IGdhcDo4cHg7IGFsaWduLWl0ZW1zOmNlbnRlcjsgfQogICAgLnNlbHsgd2lkdGg6MTYwcHg7IH0KICA=
1611
- var env_picker_component_default = "/* angular:styles/component:less;989bfd31cb990865c0ab42417664c48b1b5293cfb0401f010d5e9468c95df56e;D:\\ng-manager\\webapp\\src\\app\\pages\\api-client\\components\\request-editor\\env-picker.component.ts */\n.picker {\n display: flex;\n gap: 8px;\n align-items: center;\n}\n.sel {\n width: 160px;\n}\n/*# sourceMappingURL=env-picker.component.css.map */\n";
1612
-
1613
- // src/app/pages/api-client/services/api-client-state.service.ts
1614
- var import_lodash5 = __toESM(require_lodash());
1615
-
1616
- // src/app/pages/api-client/store/api-client-tab.store.ts
1617
- var import_lodash2 = __toESM(require_lodash());
1618
- var TAB_STORAGE_KEY = "hub-v2:api-client:tabs";
1619
- var MAX_STORAGE_AGE = 7 * 24 * 60 * 60 * 1e3;
1620
- function now() {
1621
- return Date.now();
1622
- }
1623
- function generateTabId() {
1624
- return `tab_${now().toString(16)}_${Math.random().toString(16).slice(2, 8)}`;
1625
- }
1626
- var ApiClientTabStore = class ApiClientTabStore2 {
1627
- maxTabs = 20;
1628
- // State
1629
- tabs = signal([]);
1630
- activeTabId = signal(null);
1631
- sending = signal(false);
1632
- // Computed
1633
- activeTab = computed(() => {
1634
- const id = this.activeTabId();
1635
- const tabs = this.tabs();
1636
- return id ? tabs.find((t) => t.id === id) ?? null : null;
1637
- });
1638
- activeRequest = computed(() => this.activeTab()?.request ?? null);
1639
- activeResponse = computed(() => this.activeTab()?.lastResponse ?? null);
1640
- canOpenMore = computed(() => this.tabs().length < this.maxTabs);
1641
- tabCount = computed(() => this.tabs().length);
1642
- constructor() {
1643
- this.restoreFromStorage();
1644
- effect(() => {
1645
- const tabs = this.tabs();
1646
- const activeId = this.activeTabId();
1647
- this.saveToStorage(tabs, activeId);
1648
- });
1649
- }
1650
- /**
1651
- * 创建空白 Tab
1652
- */
1653
- createEmptyTab(collectionId) {
1654
- const t = now();
1655
- const request = {
1656
- id: `req_${t.toString(16)}_${Math.random().toString(16).slice(2, 6)}`,
1657
- name: "",
1658
- method: "GET",
1659
- url: "",
1660
- collectionId: collectionId ?? null,
1661
- query: [],
1662
- pathParams: [],
1663
- headers: [],
1664
- body: { mode: "none" },
1665
- auth: { type: "none" },
1666
- options: { followRedirects: true, timeoutMs: 3e4 },
1667
- tags: [],
1668
- createdAt: t,
1669
- updatedAt: t
1670
- };
1671
- return {
1672
- id: generateTabId(),
1673
- requestId: null,
1674
- request,
1675
- title: "New Request",
1676
- isDirty: false,
1677
- lastResponse: null,
1678
- createdAt: t,
1679
- updatedAt: t
1680
- };
1681
- }
1682
- /**
1683
- * 新建 Tab
1684
- */
1685
- openNewTab(collectionId) {
1686
- if (!this.canOpenMore()) {
1687
- throw new Error("\u5DF2\u8FBE\u5230\u6700\u5927 Tab \u6570\u91CF\u9650\u5236");
1688
- }
1689
- const tab = this.createEmptyTab(collectionId);
1690
- this.tabs.update((tabs) => [...tabs, tab]);
1691
- this.activeTabId.set(tab.id);
1692
- return tab.id;
1693
- }
1694
- /**
1695
- * 在新 Tab 中打开请求
1696
- */
1697
- openRequestInTab(request, requestId) {
1698
- const existing = this.tabs().find((t2) => t2.requestId === request.id);
1699
- if (existing) {
1700
- this.activeTabId.set(existing.id);
1701
- return existing.id;
1702
- }
1703
- if (!this.canOpenMore()) {
1704
- throw new Error("\u5DF2\u8FBE\u5230\u6700\u5927 Tab \u6570\u91CF\u9650\u5236");
1705
- }
1706
- const t = now();
1707
- const requestCopy = __spreadValues({}, request);
1708
- const tab = {
1709
- id: generateTabId(),
1710
- requestId: request.id,
1711
- request: requestCopy,
1712
- savedSnapshot: requestCopy,
1713
- // 保存快照用于比较
1714
- title: this.generateTabTitle(request),
1715
- isDirty: false,
1716
- lastResponse: null,
1717
- createdAt: t,
1718
- updatedAt: t
1719
- };
1720
- this.tabs.update((tabs) => [...tabs, tab]);
1721
- this.activeTabId.set(tab.id);
1722
- return tab.id;
1723
- }
1724
- /**
1725
- * 关闭 Tab
1726
- */
1727
- closeTab(tabId) {
1728
- const tabs = this.tabs();
1729
- const index = tabs.findIndex((t) => t.id === tabId);
1730
- if (index < 0)
1731
- return;
1732
- const isActive = this.activeTabId() === tabId;
1733
- this.tabs.update((list) => list.filter((t) => t.id !== tabId));
1734
- if (this.tabs().length === 0) {
1735
- const newTab = this.createEmptyTab();
1736
- this.tabs.set([newTab]);
1737
- this.activeTabId.set(newTab.id);
1738
- return;
1739
- }
1740
- if (isActive) {
1741
- const newTabs = this.tabs();
1742
- const newIndex = Math.min(index, newTabs.length - 1);
1743
- this.activeTabId.set(newTabs[newIndex]?.id ?? null);
1744
- }
1745
- }
1746
- /**
1747
- * 关闭其他 Tab
1748
- */
1749
- closeOtherTabs(tabId) {
1750
- const tab = this.tabs().find((t) => t.id === tabId);
1751
- if (!tab)
1752
- return;
1753
- this.tabs.set([tab]);
1754
- this.activeTabId.set(tabId);
1755
- }
1756
- /**
1757
- * 关闭右侧 Tab
1758
- */
1759
- closeRightTabs(tabId) {
1760
- const index = this.tabs().findIndex((t) => t.id === tabId);
1761
- if (index < 0)
1762
- return;
1763
- this.tabs.update((tabs) => tabs.slice(0, index + 1));
1764
- if (!this.tabs().find((t) => t.id === this.activeTabId())) {
1765
- this.activeTabId.set(tabId);
1766
- }
1767
- }
1768
- /**
1769
- * 关闭已保存的 Tab
1770
- */
1771
- closeSavedTabs() {
1772
- const activeId = this.activeTabId();
1773
- const activeTab = this.tabs().find((t) => t.id === activeId);
1774
- this.tabs.update((tabs) => tabs.filter((t) => t.isDirty || !t.requestId));
1775
- if (!this.tabs().find((t) => t.id === activeId)) {
1776
- const firstTab = this.tabs()[0];
1777
- if (firstTab) {
1778
- this.activeTabId.set(firstTab.id);
1779
- } else {
1780
- const newTab = this.createEmptyTab();
1781
- this.tabs.set([newTab]);
1782
- this.activeTabId.set(newTab.id);
1783
- }
1784
- }
1785
- }
1786
- /**
1787
- * 关闭所有 Tab(保留一个空白 Tab)
1788
- */
1789
- closeAllTabs() {
1790
- const newTab = this.createEmptyTab();
1791
- this.tabs.set([newTab]);
1792
- this.activeTabId.set(newTab.id);
1793
- }
1794
- /**
1795
- * 复制 Tab(创建新 Tab 并复制请求)
1796
- */
1797
- duplicateTab(tabId) {
1798
- const tab = this.tabs().find((t2) => t2.id === tabId);
1799
- if (!tab)
1800
- throw new Error("Tab not found");
1801
- if (!this.canOpenMore()) {
1802
- throw new Error("\u5DF2\u8FBE\u5230\u6700\u5927 Tab \u6570\u91CF\u9650\u5236");
1803
- }
1804
- const t = now();
1805
- const requestCopy = __spreadProps(__spreadValues({}, tab.request), {
1806
- id: `req_${t.toString(16)}_${Math.random().toString(16).slice(2, 6)}`,
1807
- name: `${tab.request.name || "\u672A\u547D\u540D"} (\u526F\u672C)`,
1808
- createdAt: t,
1809
- updatedAt: t
1810
- });
1811
- const newTab = {
1812
- id: generateTabId(),
1813
- requestId: null,
1814
- // 新请求,未保存
1815
- request: requestCopy,
1816
- savedSnapshot: null,
1817
- title: this.generateTabTitle(requestCopy),
1818
- isDirty: true,
1819
- // 副本视为有修改
1820
- lastResponse: null,
1821
- createdAt: t,
1822
- updatedAt: t
1823
- };
1824
- const index = this.tabs().findIndex((t2) => t2.id === tabId);
1825
- this.tabs.update((tabs) => {
1826
- const result = [...tabs];
1827
- result.splice(index + 1, 0, newTab);
1828
- return result;
1829
- });
1830
- this.activeTabId.set(newTab.id);
1831
- return newTab.id;
1832
- }
1833
- /**
1834
- * 获取 Tab 的 URL
1835
- */
1836
- getTabUrl(tabId) {
1837
- const tab = this.tabs().find((t) => t.id === tabId);
1838
- return tab?.request.url ?? null;
1839
- }
1840
- /**
1841
- * 切换 Tab
1842
- */
1843
- switchTab(tabId) {
1844
- const tab = this.tabs().find((t) => t.id === tabId);
1845
- if (tab) {
1846
- this.activeTabId.set(tabId);
1847
- }
1848
- }
1849
- /**
1850
- * 重命名 Tab - 同时更新 request.name
1851
- */
1852
- renameTab(tabId, title) {
1853
- this.tabs.update((tabs) => tabs.map((t) => {
1854
- if (t.id !== tabId)
1855
- return t;
1856
- const updatedRequest = __spreadProps(__spreadValues({}, t.request), { name: title, updatedAt: now() });
1857
- return __spreadProps(__spreadValues({}, t), {
1858
- title,
1859
- request: updatedRequest,
1860
- isDirty: t.requestId ? true : t.isDirty,
1861
- // 已保存的请求重命名后标记为 dirty
1862
- updatedAt: now()
1863
- });
1864
- }));
1865
- }
1866
- /**
1867
- * 重排序 Tab
1868
- */
1869
- reorderTabs(fromIndex, toIndex) {
1870
- if (fromIndex === toIndex)
1871
- return;
1872
- this.tabs.update((tabs) => {
1873
- const result = [...tabs];
1874
- const [removed] = result.splice(fromIndex, 1);
1875
- result.splice(toIndex, 0, removed);
1876
- return result;
1877
- });
1878
- }
1879
- /**
1880
- * 更新当前 Tab 的请求
1881
- */
1882
- updateActiveRequest(patch) {
1883
- const activeId = this.activeTabId();
1884
- if (!activeId)
1885
- return;
1886
- this.tabs.update((tabs) => tabs.map((t) => {
1887
- if (t.id !== activeId)
1888
- return t;
1889
- const updated = __spreadProps(__spreadValues(__spreadValues({}, t.request), patch), { updatedAt: now() });
1890
- const snapshot = t.savedSnapshot;
1891
- const hasChanges = snapshot ? this.hasChanges(snapshot, updated) : true;
1892
- return __spreadProps(__spreadValues({}, t), {
1893
- request: updated,
1894
- title: this.generateTabTitle(updated),
1895
- isDirty: hasChanges,
1896
- updatedAt: now()
1897
- });
1898
- }));
1899
- }
1900
- /**
1901
- * 更新当前 Tab 的响应
1902
- */
1903
- updateActiveResponse(response) {
1904
- const activeId = this.activeTabId();
1905
- if (!activeId)
1906
- return;
1907
- this.tabs.update((tabs) => tabs.map((t) => t.id === activeId ? __spreadProps(__spreadValues({}, t), { lastResponse: response, updatedAt: now() }) : t));
1908
- }
1909
- /**
1910
- * 标记当前 Tab 为已保存
1911
- */
1912
- markActiveSaved(requestId) {
1913
- const activeId = this.activeTabId();
1914
- if (!activeId)
1915
- return;
1916
- this.tabs.update((tabs) => tabs.map((t) => {
1917
- if (t.id !== activeId)
1918
- return t;
1919
- return __spreadProps(__spreadValues({}, t), {
1920
- requestId,
1921
- savedSnapshot: __spreadValues({}, t.request),
1922
- // 更新快照
1923
- isDirty: false,
1924
- updatedAt: now()
1925
- });
1926
- }));
1927
- }
1928
- /**
1929
- * 标记当前 Tab 为脏
1930
- */
1931
- markActiveDirty() {
1932
- const activeId = this.activeTabId();
1933
- if (!activeId)
1934
- return;
1935
- this.tabs.update((tabs) => tabs.map((t) => t.id === activeId ? __spreadProps(__spreadValues({}, t), { isDirty: true, updatedAt: now() }) : t));
1936
- }
1937
- /**
1938
- * 设置发送状态
1939
- */
1940
- setSending(value) {
1941
- this.sending.set(value);
1942
- }
1943
- /**
1944
- * 获取 Tab
1945
- */
1946
- getTab(tabId) {
1947
- return this.tabs().find((t) => t.id === tabId) ?? null;
1948
- }
1949
- /**
1950
- * 检查 Tab 是否有未保存修改
1951
- */
1952
- isTabDirty(tabId) {
1953
- return this.getTab(tabId)?.isDirty ?? false;
1954
- }
1955
- // ========== Private Methods ==========
1956
- generateTabTitle(request) {
1957
- if (request.name)
1958
- return request.name;
1959
- if (!request.url)
1960
- return "New Request";
1961
- const url = request.url.replace(/^\{\{[^}]+\}\}/, "").replace(/^https?:\/\/[^/]+/, "");
1962
- const path = url.split("?")[0] || "/";
1963
- return `${request.method} ${path}`;
1964
- }
1965
- hasChanges(original, current) {
1966
- const _a = original, { updatedAt: _1 } = _a, originalWithoutTime = __objRest(_a, ["updatedAt"]);
1967
- const _b = current, { updatedAt: _2 } = _b, currentWithoutTime = __objRest(_b, ["updatedAt"]);
1968
- return !(0, import_lodash2.isEqual)(originalWithoutTime, currentWithoutTime);
1969
- }
1970
- restoreFromStorage() {
1971
- try {
1972
- const raw = localStorage.getItem(TAB_STORAGE_KEY);
1973
- if (!raw) {
1974
- this.createInitialTab();
1975
- return;
1976
- }
1977
- const data = JSON.parse(raw);
1978
- const age = Date.now() - data.savedAt;
1979
- if (age > MAX_STORAGE_AGE || !Array.isArray(data.tabs) || data.tabs.length === 0) {
1980
- this.createInitialTab();
1981
- return;
1982
- }
1983
- const validTabs = data.tabs.filter((t) => t.id && t.request);
1984
- if (validTabs.length === 0) {
1985
- this.createInitialTab();
1986
- return;
1987
- }
1988
- this.tabs.set(validTabs);
1989
- this.activeTabId.set(data.activeTabId ?? validTabs[0].id);
1990
- } catch {
1991
- this.createInitialTab();
1992
- }
1993
- }
1994
- saveToStorage(tabs, activeTabId) {
1995
- try {
1996
- const minimalTabs = tabs.map((t) => ({
1997
- id: t.id,
1998
- requestId: t.requestId,
1999
- request: t.request,
2000
- title: t.title,
2001
- isDirty: t.isDirty,
2002
- createdAt: t.createdAt,
2003
- updatedAt: t.updatedAt
2004
- }));
2005
- localStorage.setItem(TAB_STORAGE_KEY, JSON.stringify({
2006
- tabs: minimalTabs,
2007
- activeTabId,
2008
- savedAt: Date.now()
2009
- }));
2010
- } catch {
2011
- localStorage.removeItem(TAB_STORAGE_KEY);
2012
- }
2013
- }
2014
- createInitialTab() {
2015
- const tab = this.createEmptyTab();
2016
- this.tabs.set([tab]);
2017
- this.activeTabId.set(tab.id);
2018
- }
2019
- static ctorParameters = () => [];
2020
- };
2021
- ApiClientTabStore = __decorate([
2022
- Injectable({ providedIn: "root" })
2023
- ], ApiClientTabStore);
2024
-
2025
- // src/app/pages/api-client/utils/variable-resolver.ts
2026
- var VAR_RE = /\{\{\s*([a-zA-Z0-9_.-]+)\s*\}\}/g;
2027
- function envVarsToRecord(vars = []) {
2028
- const out = {};
2029
- for (const v of vars) {
2030
- if (!v.enabled)
2031
- continue;
2032
- out[v.key] = String(v.value ?? "");
2033
- }
2034
- return out;
2035
- }
2036
- function resolveTemplate(input2, vars) {
2037
- const missing = /* @__PURE__ */ new Set();
2038
- const out = input2.replace(VAR_RE, (_, key) => {
2039
- if (key in vars)
2040
- return String(vars[key] ?? "");
2041
- missing.add(key);
2042
- return `{{${key}}}`;
2043
- });
2044
- return { out, missing: [...missing] };
2045
- }
2046
- function collectMissingFromStrings(inputs, vars) {
2047
- const miss = /* @__PURE__ */ new Set();
2048
- for (const s of inputs) {
2049
- if (!s)
2050
- continue;
2051
- const { missing } = resolveTemplate(s, vars);
2052
- missing.forEach((k) => miss.add(k));
2053
- }
2054
- return [...miss];
2055
- }
2056
-
2057
- // src/app/pages/api-client/utils/sync-path-params.ts
2058
- var import_lodash3 = __toESM(require_lodash());
2059
- function extractPathParamKeys(url) {
2060
- if (!url)
2061
- return [];
2062
- let pathRaw = url;
2063
- try {
2064
- const u = new URL(url);
2065
- pathRaw = u.pathname || "";
2066
- } catch {
2067
- pathRaw = url.split("?")[0].split("#")[0] || "";
2068
- const idx = pathRaw.indexOf("/");
2069
- if (idx >= 0)
2070
- pathRaw = pathRaw.slice(idx);
2071
- }
2072
- const path = safeDecodeURIComponent(pathRaw);
2073
- const keys = [];
2074
- const colonRe = /(?:^|\/):([A-Za-z_][A-Za-z0-9_]*)/g;
2075
- let m;
2076
- while (m = colonRe.exec(path))
2077
- keys.push(m[1]);
2078
- const braceRe = /\{([A-Za-z_][A-Za-z0-9_]*)\}/g;
2079
- while (m = braceRe.exec(path))
2080
- keys.push(m[1]);
2081
- return keys;
2082
- }
2083
- function safeDecodeURIComponent(s) {
2084
- try {
2085
- return decodeURIComponent(s);
2086
- } catch {
2087
- return s;
2088
- }
2089
- }
2090
- function syncPathParamsByUrl(url, current) {
2091
- const keys = extractPathParamKeys(url);
2092
- const list = Array.isArray(current) ? current : [];
2093
- const map = /* @__PURE__ */ new Map();
2094
- for (const r of list) {
2095
- const k = (r.key ?? "").trim();
2096
- if (!k)
2097
- continue;
2098
- if (!map.has(k))
2099
- map.set(k, r);
2100
- }
2101
- const next = keys.map((k) => {
2102
- const old = map.get(k);
2103
- if (old) {
2104
- return __spreadProps(__spreadValues({}, old), { key: k, enabled: true });
2105
- }
2106
- return { key: k, value: "", description: "", enabled: true, id: (0, import_lodash3.uniqueId)() };
2107
- });
2108
- return next;
2109
- }
2110
-
2111
- // src/app/pages/api-client/utils/env-mapper.ts
2112
- var import_lodash4 = __toESM(require_lodash());
2113
- function envVarsToRows(vars) {
2114
- return (vars ?? []).map((v) => ({
2115
- key: v.key,
2116
- value: v.value,
2117
- enabled: v.enabled,
2118
- id: (0, import_lodash4.uniqueId)(),
2119
- description: v.description
2120
- }));
2121
- }
2122
- function rowsToEnvVars(rows, prev) {
2123
- const prevMap = new Map(prev?.map((v) => [v.key, v]));
2124
- return rows.filter((r) => r.key?.trim()).map((r) => ({
2125
- key: r.key.trim(),
2126
- value: String(r.value ?? ""),
2127
- enabled: r.enabled !== false,
2128
- secret: prevMap.get(r.key)?.secret
2129
- }));
2130
- }
2131
-
2132
- // src/app/pages/api-client/utils/collection-node.ts
2133
- function matchRequest(r, kw) {
2134
- if (!kw)
2135
- return true;
2136
- const name = (r.name ?? "").toLowerCase();
2137
- const url = (r.url ?? "").toLowerCase();
2138
- return name.includes(kw) || url.includes(kw);
2139
- }
2140
- function normId(v) {
2141
- if (v === null || v === void 0)
2142
- return null;
2143
- const s = String(v).trim();
2144
- if (!s)
2145
- return null;
2146
- const l = s.toLowerCase();
2147
- if (l === "null" || l === "undefined")
2148
- return null;
2149
- return s;
2150
- }
2151
- function sortCollections(a, b) {
2152
- return (a.parentId ?? "").localeCompare(b.parentId ?? "") || (a.order ?? 0) - (b.order ?? 0) || (a.name ?? "").localeCompare(b.name ?? "");
2153
- }
2154
- function sortRequests(a, b) {
2155
- return (normId(a.collectionId) ?? "").localeCompare(normId(b.collectionId) ?? "") || (a.order ?? 0) - (b.order ?? 0) || (a.name ?? "").localeCompare(b.name ?? "") || (a.url ?? "").localeCompare(b.url ?? "");
2156
- }
2157
- function genCollectionTreeNodes(collections, requests, q) {
2158
- const kw = q?.trim().toLowerCase() || "";
2159
- const colsSorted = [...collections ?? []].sort(sortCollections);
2160
- const reqsSorted = [...requests ?? []].sort(sortRequests);
2161
- const colChildren = /* @__PURE__ */ new Map();
2162
- for (const c of colsSorted) {
2163
- const pid = normId(c.parentId);
2164
- const arr = colChildren.get(pid) ?? [];
2165
- arr.push(c);
2166
- colChildren.set(pid, arr);
2167
- }
2168
- const reqChildren = /* @__PURE__ */ new Map();
2169
- for (const r of reqsSorted) {
2170
- if (!matchRequest(r, kw))
2171
- continue;
2172
- const cid = normId(r.collectionId);
2173
- const arr = reqChildren.get(cid) ?? [];
2174
- arr.push(r);
2175
- reqChildren.set(cid, arr);
2176
- }
2177
- const buildReqNode = (r, parentKey) => ({
2178
- key: `r:${String(r.id)}`,
2179
- kind: "request",
2180
- id: String(r.id),
2181
- title: r.name ?? "\u672A\u547D\u540D",
2182
- name: r.name,
2183
- subtitle: r.url ?? "",
2184
- method: r.method ?? "",
2185
- parentKey,
2186
- children: []
2187
- });
2188
- const buildCol = (c, parentKey) => {
2189
- const id = normId(c.id);
2190
- const key = `c:${id}`;
2191
- const childCols = colChildren.get(id) ?? [];
2192
- const childReqs = reqChildren.get(id) ?? [];
2193
- return {
2194
- key,
2195
- kind: c.kind ?? "collection",
2196
- id,
2197
- title: c.name ?? "\u672A\u547D\u540D",
2198
- name: c.name,
2199
- parentKey,
2200
- children: [
2201
- ...childCols.map((cc) => buildCol(cc, key)),
2202
- ...childReqs.map((r) => buildReqNode(r, key))
2203
- ]
2204
- };
2205
- };
2206
- const rootCols = colChildren.get(null) ?? [];
2207
- const rootReqs = reqChildren.get(null) ?? [];
2208
- return [
2209
- ...rootCols.map((c) => buildCol(c, null)),
2210
- ...rootReqs.map((r) => buildReqNode(r, null))
2211
- ];
2212
- }
2213
-
2214
- // src/app/pages/api-client/services/api-client.service.ts
2215
- var ApiClientService = class ApiClientService2 {
2216
- http = inject(ApiClient);
2217
- ls = inject(LocalStateStore);
2218
- base = "/api/client";
2219
- async listRequests(scope, projectId) {
2220
- let params = new HttpParams().set("scope", scope);
2221
- if (projectId)
2222
- params = params.set("projectId", projectId);
2223
- return await firstValueFrom(this.http.get(`${this.base}/requests`, params));
2224
- }
2225
- async saveRequest(scope, projectId, request) {
2226
- return await firstValueFrom(this.http.post(`${this.base}/requests`, { scope, projectId, request }));
2227
- }
2228
- async updateRequest(scope, projectId, request) {
2229
- return await firstValueFrom(this.http.post(`${this.base}/requests/update`, { scope, projectId, request }));
2230
- }
2231
- async deleteRequest(id, scope, projectId) {
2232
- let params = new HttpParams().set("scope", scope);
2233
- if (projectId)
2234
- params = params.set("projectId", projectId);
2235
- return await firstValueFrom(this.http.delete(`${this.base}/requests/${id}`, params));
2236
- }
2237
- async send(body) {
2238
- return await firstValueFrom(this.http.post(`${this.base}/send`, body));
2239
- }
2240
- async hubTokenRequest(body) {
2241
- const tokenType = body.tokenType ?? "project";
2242
- let personalToken = body.personalToken;
2243
- if (tokenType === "personal" && !personalToken) {
2244
- personalToken = this.ls.get(LS_KEYS.token.hubV2PersonalToken, "").trim() || void 0;
2245
- }
2246
- return await firstValueFrom(this.http.post(`${this.base}/hub-token/request`, {
2247
- projectId: body.projectId,
2248
- tokenType,
2249
- path: body.path,
2250
- method: body.method ?? "GET",
2251
- query: body.query,
2252
- body: body.payload,
2253
- headers: body.headers,
2254
- personalToken
2255
- }));
2256
- }
2257
- async listHistory(scope, projectId) {
2258
- let params = new HttpParams().set("scope", scope);
2259
- if (projectId)
2260
- params = params.set("projectId", projectId);
2261
- return await firstValueFrom(this.http.get(`${this.base}/history`, params));
2262
- }
2263
- async listEnvs(scope, projectId) {
2264
- let params = new HttpParams().set("scope", scope);
2265
- if (projectId)
2266
- params = params.set("projectId", projectId);
2267
- return await firstValueFrom(this.http.get(`${this.base}/envs`, params));
2268
- }
2269
- async saveEnv(scope, projectId, env) {
2270
- return await firstValueFrom(this.http.post(`${this.base}/envs`, { scope, projectId, env }));
2271
- }
2272
- async deleteEnv(id, scope, projectId) {
2273
- let params = new HttpParams().set("scope", scope);
2274
- if (projectId)
2275
- params = params.set("projectId", projectId);
2276
- return await firstValueFrom(this.http.delete(`${this.base}/envs/${id}`, params));
2277
- }
2278
- // Collection APIs
2279
- async listCollections(scope, projectId) {
2280
- let params = new HttpParams().set("scope", scope);
2281
- if (projectId)
2282
- params = params.set("projectId", projectId);
2283
- return await firstValueFrom(this.http.get(`${this.base}/collections`, params));
2284
- }
2285
- async createCollection(body) {
2286
- return await firstValueFrom(this.http.post(`${this.base}/collections`, body));
2287
- }
2288
- async updateCollection(id, body, scope, projectId) {
2289
- const params = new HttpParams().set("scope", scope).set("projectId", projectId ?? "");
2290
- return await firstValueFrom(this.http.post(`${this.base}/collections/${id}`, body, params));
2291
- }
2292
- async deleteCollection(id, scope, projectId) {
2293
- const params = new HttpParams().set("scope", scope).set("projectId", projectId ?? "");
2294
- return await firstValueFrom(this.http.delete(`${this.base}/collections/${id}`, params));
2295
- }
2296
- };
2297
- ApiClientService = __decorate([
2298
- Injectable({
2299
- providedIn: "root"
2300
- })
2301
- ], ApiClientService);
2302
-
2303
- // angular:jit:style:inline:src\app\pages\api-client\components\request-collections\collection-modal.component.ts;CiAgICAubW9kYWwtYm9keSB7IGRpc3BsYXk6IGdyaWQ7IGdhcDogMTJweDsgfQogICAgLmxhYmVseyBmb250LXdlaWdodDo2MDA7IH0KICAgIC5oaW50IHsgZm9udC1zaXplOiAxMnB4OyBvcGFjaXR5OiAuNzU7IH0KICAgIC5oaW50LmVycnsgY29sb3I6I2NmMTMyMjsgb3BhY2l0eToxOyB9CgogICAgLnBpY2tlcnsKICAgICAgbWF4LWhlaWdodDogNTJ2aDsKICAgICAgb3ZlcmZsb3c6YXV0bzsKICAgICAgYm9yZGVyOiAxcHggc29saWQgcmdiYSgwLDAsMCwuMDgpOwogICAgICBib3JkZXItcmFkaXVzOiAxMnB4OwogICAgICBwYWRkaW5nOiA4cHg7CiAgICAgIGRpc3BsYXk6ZmxleDsKICAgICAgZmxleC1kaXJlY3Rpb246Y29sdW1uOwogICAgICBnYXA6NnB4OwogICAgfQogICAgLnJvd3sKICAgICAgZGlzcGxheTpmbGV4OwogICAgICBhbGlnbi1pdGVtczpjZW50ZXI7CiAgICAgIGdhcDo4cHg7CiAgICAgIHBhZGRpbmc6OHB4IDhweDsKICAgICAgYm9yZGVyLXJhZGl1czoxMHB4OwogICAgICBjdXJzb3I6cG9pbnRlcjsKICAgICAgdXNlci1zZWxlY3Q6bm9uZTsKICAgICAgdHJhbnNpdGlvbjogYmFja2dyb3VuZCAuMTVzOwogICAgICBib3JkZXI6IDFweCBzb2xpZCB0cmFuc3BhcmVudDsKICAgIH0KICAgIC5yb3c6aG92ZXJ7IGJhY2tncm91bmQ6IHJnYmEoMCwwLDAsLjA0KTsgfQogICAgLnJvdy5zZWxlY3RlZHsgYmFja2dyb3VuZDogcmdiYSgwLDAsMCwuMDgpOyBib3JkZXItY29sb3I6IHJnYmEoMCwwLDAsLjA4KTsgfQogICAgLnJvdy5yb290eyBmb250LXdlaWdodDo2MDA7IH0KICAgIC5jaGV2eyBmbGV4OjAgMCBhdXRvOyBuei1pY29ue2ZvbnQtc2l6ZToxMnB4O3RyYW5zaXRpb246dHJhbnNmb3JtIC4xNXN9IH0KICAgIC5pY29ueyBvcGFjaXR5Oi43NTsgfQogICAgLnRpdGxleyBmbGV4OjE7IG1pbi13aWR0aDowOyBvdmVyZmxvdzpoaWRkZW47IHRleHQtb3ZlcmZsb3c6ZWxsaXBzaXM7IHdoaXRlLXNwYWNlOm5vd3JhcDsgfQogICAgLmVtcHR5eyBwYWRkaW5nOjE2cHg7IG9wYWNpdHk6LjY7IHRleHQtYWxpZ246Y2VudGVyOyB9CgogICAgLmZvb3RlciB7IGRpc3BsYXk6IGZsZXg7IGp1c3RpZnktY29udGVudDogZmxleC1lbmQ7IGdhcDogOHB4OyBtYXJnaW4tdG9wOiAxNnB4OyB9CiAg
2304
- var collection_modal_component_default = "/* angular:styles/component:less;32be14231e9363af865b7f69f0194cb76bf9c5d76ff7c68f00d4860a8e3402d3;D:\\ng-manager\\webapp\\src\\app\\pages\\api-client\\components\\request-collections\\collection-modal.component.ts */\n.modal-body {\n display: grid;\n gap: 12px;\n}\n.label {\n font-weight: 600;\n}\n.hint {\n font-size: 12px;\n opacity: 0.75;\n}\n.hint.err {\n color: #cf1322;\n opacity: 1;\n}\n.picker {\n max-height: 52vh;\n overflow: auto;\n border: 1px solid rgba(0, 0, 0, 0.08);\n border-radius: 12px;\n padding: 8px;\n display: flex;\n flex-direction: column;\n gap: 6px;\n}\n.row {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 8px 8px;\n border-radius: 10px;\n cursor: pointer;\n -webkit-user-select: none;\n user-select: none;\n transition: background 0.15s;\n border: 1px solid transparent;\n}\n.row:hover {\n background: rgba(0, 0, 0, 0.04);\n}\n.row.selected {\n background: rgba(0, 0, 0, 0.08);\n border-color: rgba(0, 0, 0, 0.08);\n}\n.row.root {\n font-weight: 600;\n}\n.chev {\n flex: 0 0 auto;\n}\n.chev nz-icon {\n font-size: 12px;\n transition: transform 0.15s;\n}\n.icon {\n opacity: 0.75;\n}\n.title {\n flex: 1;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.empty {\n padding: 16px;\n opacity: 0.6;\n text-align: center;\n}\n.footer {\n display: flex;\n justify-content: flex-end;\n gap: 8px;\n margin-top: 16px;\n}\n/*# sourceMappingURL=collection-modal.component.css.map */\n";
2305
-
2306
- // src/app/pages/api-client/components/request-collections/collection-modal.component.ts
2307
- function toKey(id) {
2308
- return id ? `c:${id}` : null;
2309
- }
2310
- function keyToId(key) {
2311
- if (!key)
2312
- return null;
2313
- return key.startsWith("c:") ? key.slice(2) : null;
2314
- }
2315
- var CollectionModalComponent = class CollectionModalComponent2 {
2316
- data = inject(NZ_MODAL_DATA);
2317
- modalRef = inject(NzModalRef);
2318
- // state
2319
- q = signal("");
2320
- name = signal("");
2321
- selectedKey = signal(null);
2322
- // move 时使用,null=根目录
2323
- expandedMap = signal({});
2324
- // mode
2325
- mode = computed(() => this.data.mode ?? this.data.handleType);
2326
- // 兼容你旧字段,建议尽快统一为 mode
2327
- // 只有 move 才显示树
2328
- showParentPicker = computed(() => this.mode() === "move" || this.mode() === "pick");
2329
- // create/rename 才显示 name;move 不显示 name
2330
- showName = computed(() => this.mode() === "create" || this.mode() === "rename");
2331
- iconForKind = computed(() => {
2332
- const kind = this.data.kind ?? (this.data.createBody?.kind ?? "collection");
2333
- return kind === "folder" ? "folder" : kind === "request" ? "api" : "database";
2334
- });
2335
- // init
2336
- ngOnInit() {
2337
- const mode = this.mode();
2338
- if (mode === "create") {
2339
- const body = this.data.createBody;
2340
- this.name.set(body?.name ?? "");
2341
- this.selectedKey.set(null);
2342
- return;
2343
- }
2344
- if (mode === "rename" || mode === "update") {
2345
- const upd = this.data;
2346
- this.name.set(upd?.initialName ?? "");
2347
- this.selectedKey.set(null);
2348
- return;
2349
- }
2350
- const initial = this.data.initialParentId;
2351
- this.selectedKey.set(initial ? initial.startsWith("c:") ? initial : toKey(initial) : null);
2352
- const nodes = this.data.nodes ?? [];
2353
- const m = {};
2354
- for (const n of nodes)
2355
- m[n.key] = true;
2356
- this.expandedMap.set(m);
2357
- }
2358
- // tree helpers
2359
- expanded(key) {
2360
- return !!this.expandedMap()[key];
2361
- }
2362
- toggle(key) {
2363
- const m = __spreadValues({}, this.expandedMap());
2364
- m[key] = !m[key];
2365
- this.expandedMap.set(m);
2366
- }
2367
- select(key) {
2368
- this.selectedKey.set(key);
2369
- }
2370
- // ---------- 仅 move 场景:过滤非法父级(移动文件夹/集合时防环) ----------
2371
- forbiddenKeys = computed(() => {
2372
- if (this.mode() !== "move" || this.mode() !== "pick")
2373
- return /* @__PURE__ */ new Set();
2374
- const t = this.data.target;
2375
- if (!t || t.kind === "request")
2376
- return /* @__PURE__ */ new Set();
2377
- const selfKey = `c:${t.id}`;
2378
- const set = /* @__PURE__ */ new Set([selfKey]);
2379
- const nodes = this.data.nodes ?? [];
2380
- const collect = (node) => {
2381
- for (const c of node.children ?? []) {
2382
- if (c.kind === "request")
2383
- continue;
2384
- set.add(c.key);
2385
- collect(c);
2386
- }
2387
- };
2388
- const walk = (arr) => {
2389
- for (const n of arr) {
2390
- if (n.key === selfKey)
2391
- collect(n);
2392
- else if (n.children?.length)
2393
- walk(n.children);
2394
- }
2395
- };
2396
- walk(nodes);
2397
- return set;
2398
- });
2399
- nodesForPicker = computed(() => {
2400
- const nodes = (this.data.nodes ?? []).filter((n) => n.kind !== "request");
2401
- const forbid = this.forbiddenKeys();
2402
- const prune = (arr) => {
2403
- const out = [];
2404
- for (const n of arr) {
2405
- if (n.kind === "request")
2406
- continue;
2407
- if (forbid.has(n.key))
2408
- continue;
2409
- const children = prune(n.children ?? []);
2410
- out.push(__spreadProps(__spreadValues({}, n), { children }));
2411
- }
2412
- return out;
2413
- };
2414
- return prune(nodes);
2415
- });
2416
- filteredNodes = computed(() => {
2417
- if (!this.showParentPicker())
2418
- return [];
2419
- const kw = this.q().trim().toLowerCase();
2420
- if (!kw)
2421
- return this.nodesForPicker();
2422
- const match = (n) => (n.title ?? "").toLowerCase().includes(kw);
2423
- const keepPath = (arr) => {
2424
- const out = [];
2425
- for (const n of arr) {
2426
- const children = keepPath(n.children ?? []);
2427
- if (match(n) || children.length)
2428
- out.push(__spreadProps(__spreadValues({}, n), { children }));
2429
- }
2430
- return out;
2431
- };
2432
- const r = keepPath(this.nodesForPicker());
2433
- const m = __spreadValues({}, this.expandedMap());
2434
- const mark = (arr) => {
2435
- for (const n of arr) {
2436
- if (n.children?.length)
2437
- m[n.key] = true;
2438
- if (n.children?.length)
2439
- mark(n.children);
2440
- }
2441
- };
2442
- mark(r);
2443
- this.expandedMap.set(m);
2444
- return r;
2445
- });
2446
- // ---------- validation ----------
2447
- nameErr = computed(() => {
2448
- if (!this.showName())
2449
- return "";
2450
- const v = (this.name() ?? "").trim();
2451
- if (!v)
2452
- return "\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A";
2453
- if (v.length > 50)
2454
- return "\u540D\u79F0\u8FC7\u957F\uFF08<= 50\uFF09";
2455
- return "";
2456
- });
2457
- moveErr = computed(() => {
2458
- if (!this.showParentPicker())
2459
- return "";
2460
- return "";
2461
- });
2462
- canSubmit = computed(() => {
2463
- if (this.showName() && !!this.nameErr())
2464
- return false;
2465
- if (this.showParentPicker()) {
2466
- return true;
2467
- }
2468
- return true;
2469
- });
2470
- // ---------- submit ----------
2471
- ok() {
2472
- const mode = this.mode();
2473
- if (mode === "rename" || mode === "update") {
2474
- const data = { name: (this.name() ?? "").trim() };
2475
- this.modalRef.close(data);
2476
- return;
2477
- }
2478
- if (mode === "create") {
2479
- const body = this.data.createBody;
2480
- const data = __spreadProps(__spreadValues({}, body), {
2481
- name: (this.name() ?? "").trim(),
2482
- // parentId 不在 modal 里改:完全沿用外部传入
2483
- parentId: body.parentId ?? null
2484
- });
2485
- this.modalRef.close(data);
2486
- return;
2487
- }
2488
- const parentId = keyToId(this.selectedKey());
2489
- this.modalRef.close({ parentId });
2490
- }
2491
- cancel() {
2492
- this.modalRef.close(null);
2493
- }
2494
- };
2495
- CollectionModalComponent = __decorate([
2496
- Component({
2497
- selector: "app-collection-modal",
2498
- standalone: true,
2499
- imports: [CommonModule, FormsModule, NzInputModule, NzButtonModule, NzIconModule],
2500
- template: `
2501
- <div class="modal-body">
2502
- @if (showName()) {
2503
- <label class="label">\u540D\u79F0</label>
2504
- <nz-input-wrapper >
2505
- <input
2506
- nz-input
2507
- [ngModel]="name()"
2508
- (ngModelChange)="name.set($event)"
2509
- placeholder="\u8BF7\u8F93\u5165\u540D\u79F0"
2510
- autofocus
2511
- />
2512
- <nz-icon nzInputPrefix [nzType]="iconForKind()" nzTheme="outline"></nz-icon>
2513
- </nz-input-wrapper>
2514
- @if (nameErr()) { <div class="hint err">{{ nameErr() }}</div> }
2515
- }
2516
-
2517
- @if (showParentPicker()) {
2518
- <!-- <label class="label">{{mode() === 'move' ? '\u79FB\u52A8\u5230' : '\u9009\u62E9\u76EE\u5F55'}}</label> -->
2519
- <!-- <nz-input-wrapper >
2520
- <input nz-input placeholder="\u641C\u7D22\u76EE\u5F55" [ngModel]="q()" (ngModelChange)="q.set($event)" />
2521
- <nz-icon class="search-icon" nzInputSuffix nzType="search" />
2522
- </nz-input-wrapper> -->
2523
-
2524
- <div class="picker">
2525
- <div class="row root" [class.selected]="selectedKey() === null" (click)="select(null)">
2526
- <nz-icon nzType="home"></nz-icon>
2527
- <span>\u6839\u76EE\u5F55</span>
2528
- </div>
2529
-
2530
- @for (n of filteredNodes(); track n.key) {
2531
- <ng-container
2532
- [ngTemplateOutlet]="nodeTpl"
2533
- [ngTemplateOutletContext]="{ $implicit: n, level: 0 }"
2534
- />
2535
- }
2536
-
2537
- @if (!filteredNodes().length) {
2538
- <div class="empty">\u6682\u65E0\u76EE\u5F55</div>
2539
- }
2540
- </div>
2541
-
2542
- @if (moveErr()) { <div class="hint err">{{ moveErr() }}</div> }
2543
- }
2544
- </div>
2545
-
2546
- <div class="footer">
2547
- <button nz-button (click)="cancel()">\u53D6\u6D88</button>
2548
- <button nz-button nzType="primary" [disabled]="!canSubmit()" (click)="ok()">
2549
- \u786E\u5B9A
2550
- </button>
2551
- </div>
2552
-
2553
- <ng-template #nodeTpl let-node let-level="level">
2554
- <div
2555
- class="row"
2556
- [style.paddingLeft.px]="8 + level * 16"
2557
- [class.selected]="selectedKey() === node.key"
2558
- (click)="select(node.key)"
2559
- >
2560
- <button
2561
- class="chev"
2562
- nz-button
2563
- nzType="text"
2564
- nzSize="small"
2565
- (click)="toggle(node.key); $event.stopPropagation()"
2566
- [disabled]="!node.children?.length"
2567
- >
2568
- <nz-icon [nzType]="node.children?.length ? (expanded(node.key) ? 'down' : 'right') : 'minus'"></nz-icon>
2569
- </button>
2570
- <nz-icon class="icon" [nzType]="node.kind === 'folder' ? 'folder' : 'database'"></nz-icon>
2571
- <span class="title">{{ node.title }}</span>
2572
- </div>
2573
-
2574
- @if ((node.children?.length ?? 0) && expanded(node.key)) {
2575
- @for (c of node.children; track c.key) {
2576
- <ng-container
2577
- [ngTemplateOutlet]="nodeTpl"
2578
- [ngTemplateOutletContext]="{ $implicit: c, level: level + 1 }"
2579
- />
2580
- }
2581
- }
2582
- </ng-template>
2583
- `,
2584
- styles: [collection_modal_component_default]
2585
- })
2586
- ], CollectionModalComponent);
2587
-
2588
- // src/app/pages/api-client/services/collection-modal.service.ts
2589
- var CollectionModalService = class CollectionModalService2 {
2590
- modal = inject(NzModalService);
2591
- async createCollection(opts) {
2592
- const ref = this.modal.create({
2593
- nzTitle: opts.kind === "folder" ? "\u65B0\u5EFA\u76EE\u5F55" : "\u65B0\u5EFA\u96C6\u5408",
2594
- nzContent: CollectionModalComponent,
2595
- nzFooter: null,
2596
- nzWidth: 520,
2597
- nzMaskClosable: false,
2598
- nzData: {
2599
- mode: "create",
2600
- createBody: opts.createBody,
2601
- nodes: opts.nodes
2602
- }
2603
- });
2604
- return await firstValueFrom(ref.afterClose);
2605
- }
2606
- async renameCollection(opts) {
2607
- const ref = this.modal.create({
2608
- nzTitle: "\u91CD\u547D\u540D",
2609
- nzContent: CollectionModalComponent,
2610
- nzFooter: null,
2611
- nzWidth: 520,
2612
- nzMaskClosable: false,
2613
- nzData: {
2614
- mode: "rename",
2615
- kind: opts.kind,
2616
- nodes: opts.nodes,
2617
- targetId: opts.targetId,
2618
- initialName: opts.initialName
2619
- }
2620
- });
2621
- return await firstValueFrom(ref.afterClose);
2622
- }
2623
- async moveTarget(opts) {
2624
- const ref = this.modal.create({
2625
- nzTitle: "\u79FB\u52A8\u5230",
2626
- nzContent: CollectionModalComponent,
2627
- nzFooter: null,
2628
- nzWidth: 520,
2629
- nzMaskClosable: false,
2630
- nzData: {
2631
- mode: "move",
2632
- nodes: opts.nodes,
2633
- target: opts.target,
2634
- initialParentId: opts.initialParentId ?? null
2635
- }
2636
- });
2637
- return await firstValueFrom(ref.afterClose);
2638
- }
2639
- async pickCollection(opts) {
2640
- const ref = this.modal.create({
2641
- nzTitle: "\u9009\u62E9\u96C6\u5408/\u76EE\u5F55",
2642
- nzContent: CollectionModalComponent,
2643
- nzFooter: null,
2644
- nzWidth: 520,
2645
- nzMaskClosable: false,
2646
- nzData: {
2647
- mode: "pick",
2648
- nodes: opts.nodes
2649
- }
2650
- });
2651
- return await firstValueFrom(ref.afterClose);
2652
- }
2653
- };
2654
- CollectionModalService = __decorate([
2655
- Injectable({ providedIn: "root" })
2656
- ], CollectionModalService);
2657
-
2658
- // src/app/pages/api-client/services/api-client-state.service.ts
2659
- var ApiClientStateService = class ApiClientStateService2 {
2660
- api = inject(ApiClientService);
2661
- msg = inject(NzMessageService);
2662
- projectContext = inject(ProjectContextStore);
2663
- collectionModal = inject(CollectionModalService);
2664
- // Tab Store
2665
- tabStore = inject(ApiClientTabStore);
2666
- // request state
2667
- scope = signal("project");
2668
- loading = signal(false);
2669
- q = signal("");
2670
- // 搜索关键词
2671
- // 使用 Tab Store 的 sending 状态
2672
- sending = this.tabStore.sending;
2673
- requests = signal([]);
2674
- // 全部请求列表
2675
- // 当前选中请求 ID - 改用 Tab Store
2676
- activeRequestId = computed(() => this.tabStore.activeTab()?.requestId ?? null);
2677
- collections = signal([]);
2678
- activeCollectionId = signal(null);
2679
- nodes = computed(() => {
2680
- return genCollectionTreeNodes(this.collections(), this.requests(), "").filter((n) => n.kind !== "request");
2681
- });
2682
- filteredNodes = computed(() => {
2683
- const q = this.q().toLowerCase();
2684
- return genCollectionTreeNodes(this.collections(), this.requests(), q ?? "");
2685
- });
2686
- // history state
2687
- historyOpen = signal(false);
2688
- // 是否打开 history 面板
2689
- historyLoading = signal(false);
2690
- // history 加载中
2691
- histories = signal([]);
2692
- // 历史记录列表
2693
- // environments state
2694
- envs = signal([]);
2695
- envLoading = signal(false);
2696
- activeEnvId = signal(null);
2697
- // send result - 改用 Tab Store
2698
- lastResult = this.tabStore.activeResponse;
2699
- // project info
2700
- projectId = computed(() => {
2701
- const p = this.projectContext.currentProject();
2702
- return p?.id ?? "";
2703
- });
2704
- // activeRequest 改用 Tab Store
2705
- activeRequest = this.tabStore.activeRequest;
2706
- // Tab 相关
2707
- tabs = this.tabStore.tabs;
2708
- activeTabId = this.tabStore.activeTabId;
2709
- activeTab = this.tabStore.activeTab;
2710
- canOpenMore = this.tabStore.canOpenMore;
2711
- activeEnv = computed(() => {
2712
- const id = this.activeEnvId();
2713
- if (!id)
2714
- return null;
2715
- return this.envs().find((e) => e.id === id) ?? null;
2716
- });
2717
- envVarRecord = computed(() => {
2718
- const env = this.activeEnv();
2719
- if (!env)
2720
- return {};
2721
- return envVarsToRecord(env.variables);
2722
- });
2723
- collectionPath = computed(() => {
2724
- const colId = this.activeCollectionId();
2725
- if (!colId)
2726
- return null;
2727
- const col = this.collections().find((c) => c.id === colId);
2728
- if (!col)
2729
- return null;
2730
- const pathNames = [];
2731
- let parentKey = `${col.id}`;
2732
- while (parentKey) {
2733
- const parentNode = this.collections().find((n) => n.id === parentKey);
2734
- if (parentNode) {
2735
- pathNames.unshift(parentNode.name || "\u672A\u547D\u540D");
2736
- parentKey = parentNode.parentId ? `${parentNode.parentId}` : null;
2737
- } else {
2738
- parentKey = null;
2739
- }
2740
- }
2741
- return pathNames.join(" / ");
2742
- });
2743
- projectCtx = computed(() => {
2744
- const p = this.projectContext.currentProject();
2745
- if (!p)
2746
- return null;
2747
- return {
2748
- scope: "project",
2749
- projectId: p.id
2750
- };
2751
- });
2752
- constructor() {
2753
- effect(() => {
2754
- if (this.scope() !== "project")
2755
- return;
2756
- const pid = this.projectId();
2757
- if (!pid)
2758
- return;
2759
- void this.loadAll();
2760
- });
2761
- effect(() => {
2762
- const scope = this.scope();
2763
- if (scope !== "project") {
2764
- void this.loadEnvs();
2765
- return;
2766
- }
2767
- const pid = this.projectId();
2768
- if (!pid)
2769
- return;
2770
- void this.loadEnvs();
2771
- });
2772
- }
2773
- async loadAll() {
2774
- const ctx = this.projectCtx();
2775
- if (!ctx)
2776
- return;
2777
- this.loading.set(true);
2778
- try {
2779
- const [cols, reqs] = await Promise.all([
2780
- this.api.listCollections(ctx.scope, ctx.projectId),
2781
- this.api.listRequests(ctx.scope, ctx.projectId)
2782
- ]);
2783
- this.collections.set(cols ?? []);
2784
- this.requests.set(reqs ?? []);
2785
- } finally {
2786
- this.loading.set(false);
2787
- }
2788
- }
2789
- async reloadCollections() {
2790
- const ctx = this.projectCtx();
2791
- if (!ctx)
2792
- return;
2793
- const cols = await this.api.listCollections(ctx.scope, ctx.projectId);
2794
- this.collections.set(cols ?? []);
2795
- }
2796
- async reloadRequests() {
2797
- const ctx = this.projectCtx();
2798
- if (!ctx)
2799
- return;
2800
- const reqs = await this.api.listRequests(ctx.scope, ctx.projectId);
2801
- this.requests.set(reqs ?? []);
2802
- }
2803
- /**
2804
- * 加载请求列表
2805
- */
2806
- async loadRequests() {
2807
- const ctx = this.projectCtx();
2808
- if (!ctx)
2809
- return;
2810
- this.loading.set(true);
2811
- try {
2812
- const list = await this.api.listRequests(ctx.scope, ctx.projectId);
2813
- this.requests.set(list);
2814
- const active = this.activeRequestId();
2815
- if (active && list.some((x) => x.id === active))
2816
- return;
2817
- if (list.length) {
2818
- this.selectRequest(list[0].id);
2819
- } else {
2820
- this.newTab();
2821
- }
2822
- } catch (e) {
2823
- this.msg.error(e?.message ?? "\u52A0\u8F7D\u8BF7\u6C42\u5931\u8D25");
2824
- } finally {
2825
- this.loading.set(false);
2826
- }
2827
- }
2828
- /**
2829
- * 选择请求 - 在新 Tab 中打开
2830
- */
2831
- selectRequest(id) {
2832
- const req = this.requests().find((x) => x.id === id) || null;
2833
- if (req) {
2834
- this.tabStore.openRequestInTab(req, id);
2835
- this.activeCollectionId.set(req.collectionId ?? null);
2836
- }
2837
- }
2838
- /**
2839
- * 切换 Tab
2840
- */
2841
- switchTab(tabId) {
2842
- this.tabStore.switchTab(tabId);
2843
- const tab = this.tabStore.getTab(tabId);
2844
- if (tab?.request.collectionId) {
2845
- this.activeCollectionId.set(tab.request.collectionId);
2846
- }
2847
- }
2848
- /**
2849
- * 关闭 Tab
2850
- */
2851
- closeTab(tabId) {
2852
- this.tabStore.closeTab(tabId);
2853
- }
2854
- /**
2855
- * 新建 Tab
2856
- */
2857
- newTab(collectionId) {
2858
- try {
2859
- this.tabStore.openNewTab(collectionId);
2860
- this.activeCollectionId.set(collectionId ?? null);
2861
- } catch (e) {
2862
- this.msg.warning(e.message);
2863
- }
2864
- }
2865
- /**
2866
- * 重命名 Tab
2867
- */
2868
- renameTab(tabId, title) {
2869
- this.tabStore.renameTab(tabId, title);
2870
- }
2871
- /**
2872
- * 重排序 Tab
2873
- */
2874
- reorderTabs(from, to) {
2875
- this.tabStore.reorderTabs(from, to);
2876
- }
2877
- /**
2878
- * 处理右键菜单操作
2879
- */
2880
- handleTabContextMenu(event) {
2881
- switch (event.action) {
2882
- case "close":
2883
- this.closeTab(event.tabId);
2884
- break;
2885
- case "closeOthers":
2886
- this.tabStore.closeOtherTabs(event.tabId);
2887
- break;
2888
- case "closeRight":
2889
- this.tabStore.closeRightTabs(event.tabId);
2890
- break;
2891
- case "closeSaved":
2892
- this.tabStore.closeSavedTabs();
2893
- break;
2894
- case "closeAll":
2895
- this.tabStore.closeAllTabs();
2896
- break;
2897
- case "rename":
2898
- break;
2899
- case "duplicate":
2900
- try {
2901
- this.tabStore.duplicateTab(event.tabId);
2902
- this.msg.success("\u5DF2\u590D\u5236\u8BF7\u6C42");
2903
- } catch (e) {
2904
- this.msg.warning(e.message);
2905
- }
2906
- break;
2907
- case "copyUrl":
2908
- const url = this.tabStore.getTabUrl(event.tabId);
2909
- if (url) {
2910
- navigator.clipboard.writeText(url).then(() => {
2911
- this.msg.success("URL \u5DF2\u590D\u5236\u5230\u526A\u8D34\u677F");
2912
- }).catch(() => {
2913
- this.msg.error("\u590D\u5236\u5931\u8D25");
2914
- });
2915
- }
2916
- break;
2917
- case "moveTo":
2918
- const tab = this.tabStore.getTab(event.tabId);
2919
- if (tab?.requestId) {
2920
- this.moveCollection(tab.requestId, "request");
2921
- }
2922
- break;
2923
- }
2924
- }
2925
- /**
2926
- * 选择集合
2927
- */
2928
- selectCollection(id) {
2929
- this.activeCollectionId.set(id);
2930
- }
2931
- /**
2932
- * 新建集合 / 文件夹
2933
- */
2934
- async newCollection(input2) {
2935
- const ctx = this.projectCtx();
2936
- if (!ctx)
2937
- return;
2938
- const body = {
2939
- scope: ctx.scope,
2940
- projectId: ctx.projectId,
2941
- name: input2.name ?? "",
2942
- kind: input2.kind ?? "collection",
2943
- parentId: input2.parentId ?? null
2944
- };
2945
- const nodes = this.nodes();
2946
- const createdBody = await this.collectionModal.createCollection({ createBody: body, nodes, kind: body.kind, initialParentId: body.parentId ?? null });
2947
- if (createdBody) {
2948
- const newCol = await this.api.createCollection(createdBody);
2949
- this.msg.success("\u521B\u5EFA\u6210\u529F");
2950
- this.collections.update((list) => [...list, newCol]);
2951
- this.activeCollectionId.set(newCol.id);
2952
- }
2953
- }
2954
- // 删除集合/文件夹
2955
- async deleteCollection(id, kind) {
2956
- if (kind === "request") {
2957
- this.removeRequest(id);
2958
- return;
2959
- }
2960
- await this.api.deleteCollection(id, this.scope(), this.projectId());
2961
- this.msg.success("\u5DF2\u5220\u9664");
2962
- this.collections.update((list) => list.filter((c) => c.id !== id));
2963
- if (this.activeCollectionId() === id) {
2964
- const firstCol = this.collections()[0];
2965
- this.activeCollectionId.set(firstCol?.id ?? null);
2966
- }
2967
- }
2968
- /**
2969
- * 移动集合/文件夹/请求
2970
- */
2971
- async moveCollection(id, kind) {
2972
- let initialParentId = "";
2973
- if (kind == "request") {
2974
- const req = this.requests().find((r) => r.id === id);
2975
- if (!req) {
2976
- this.msg.error("\u8BF7\u6C42\u4E0D\u5B58\u5728");
2977
- return;
2978
- }
2979
- initialParentId = req.collectionId ?? "";
2980
- } else {
2981
- const col = this.collections().find((c) => c.id === id);
2982
- if (!col) {
2983
- this.msg.error("\u96C6\u5408\u4E0D\u5B58\u5728");
2984
- return;
2985
- }
2986
- initialParentId = col.parentId ?? "";
2987
- }
2988
- const nodes = this.nodes();
2989
- const { parentId } = await this.collectionModal.moveTarget({
2990
- nodes,
2991
- target: { kind, id },
2992
- initialParentId
2993
- }) || {};
2994
- if (parentId === void 0)
2995
- return;
2996
- if (kind === "request") {
2997
- const req = this.requests().find((r) => r.id === id);
2998
- if (!req) {
2999
- this.msg.error("\u8BF7\u6C42\u4E0D\u5B58\u5728");
3000
- return;
3001
- }
3002
- const updated = {
3003
- collectionId: parentId ?? null,
3004
- id: req.id
3005
- };
3006
- req.collectionId = parentId ?? null;
3007
- await this.api.updateRequest(this.scope(), this.projectId(), updated);
3008
- this.requests.update((list) => list.map((r) => r.id === id ? __spreadProps(__spreadValues({}, r), { collectionId: parentId ?? null }) : r));
3009
- const tab = this.tabs().find((t) => t.requestId === id);
3010
- if (tab) {
3011
- this.tabStore.updateActiveRequest({ collectionId: parentId ?? null });
3012
- }
3013
- this.msg.success("\u4FEE\u6539\u6210\u529F");
3014
- } else {
3015
- const updated = {
3016
- parentId: parentId ?? null
3017
- };
3018
- const newCol = await this.api.updateCollection(id, updated, this.scope(), this.projectId());
3019
- this.collections.update((list) => list.map((c) => c.id === id ? newCol : c));
3020
- this.activeCollectionId.set(newCol.id);
3021
- this.msg.success("\u4FEE\u6539\u6210\u529F");
3022
- }
3023
- }
3024
- /**
3025
- * 重命名集合/文件夹/请求
3026
- */
3027
- async renameCollection(id, kind) {
3028
- let name = "";
3029
- if (kind == "request") {
3030
- const req = this.requests().find((r) => r.id === id);
3031
- if (!req) {
3032
- this.msg.error("\u8BF7\u6C42\u4E0D\u5B58\u5728");
3033
- return;
3034
- }
3035
- name = req.name ?? "";
3036
- } else {
3037
- const col = this.collections().find((c) => c.id === id);
3038
- if (!col) {
3039
- this.msg.error("\u96C6\u5408\u4E0D\u5B58\u5728");
3040
- return;
3041
- }
3042
- name = col.name ?? "";
3043
- }
3044
- const nodes = this.nodes();
3045
- const updated = await this.collectionModal.renameCollection({
3046
- nodes,
3047
- kind,
3048
- targetId: id,
3049
- initialName: name
3050
- });
3051
- if (!updated)
3052
- return;
3053
- if (kind === "request") {
3054
- await this.api.updateRequest(this.scope(), this.projectId(), { id, name: updated.name });
3055
- this.requests.update((list) => list.map((r) => r.id === id ? __spreadProps(__spreadValues({}, r), { name: updated.name ?? r.name }) : r));
3056
- this.msg.success("\u4FEE\u6539\u6210\u529F");
3057
- this.reloadRequests();
3058
- } else {
3059
- const newCol = await this.api.updateCollection(id, updated, this.scope(), this.projectId());
3060
- this.collections.update((list) => list.map((c) => c.id === id ? newCol : c));
3061
- this.msg.success("\u4FEE\u6539\u6210\u529F");
3062
- this.reloadCollections();
3063
- }
3064
- }
3065
- /**
3066
- * 新建请求 - 在新 Tab 中打开
3067
- */
3068
- newRequest(input2 = {}) {
3069
- const pid = this.projectId();
3070
- if (this.scope() === "project" && !pid) {
3071
- this.msg.warning("\u8BF7\u5148\u9009\u62E9\u9879\u76EE");
3072
- return;
3073
- }
3074
- this.newTab(input2.collectionId);
3075
- }
3076
- /**
3077
- * 更新当前请求字段 - 使用 Tab Store
3078
- */
3079
- patchActive(patch) {
3080
- this.tabStore.updateActiveRequest(patch);
3081
- }
3082
- /**
3083
- * 保存当前请求 - 使用 Tab Store
3084
- */
3085
- async saveActive() {
3086
- const req = this.activeRequest();
3087
- if (!req)
3088
- return;
3089
- const scope = this.scope();
3090
- const pid = scope === "project" ? this.projectId() : void 0;
3091
- if (scope === "project" && !pid)
3092
- throw new Error("projectId missing");
3093
- if (!req.name?.trim()) {
3094
- this.msg.warning("\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A");
3095
- return;
3096
- }
3097
- if (!req.url?.trim()) {
3098
- this.msg.warning("URL \u4E0D\u80FD\u4E3A\u7A7A");
3099
- return;
3100
- }
3101
- if (!req.collectionId) {
3102
- const nodes = this.nodes();
3103
- const { parentId } = await this.collectionModal.pickCollection({
3104
- nodes
3105
- }) || {};
3106
- req.collectionId = parentId ?? null;
3107
- this.tabStore.updateActiveRequest({ collectionId: req.collectionId });
3108
- }
3109
- this.loading.set(true);
3110
- try {
3111
- const result = await this.api.saveRequest(scope, pid, req);
3112
- this.msg.success("\u5DF2\u4FDD\u5B58");
3113
- this.tabStore.markActiveSaved(result.id);
3114
- await this.loadRequests();
3115
- } catch (e) {
3116
- this.msg.error(e?.message ?? "\u4FDD\u5B58\u5931\u8D25");
3117
- } finally {
3118
- this.loading.set(false);
3119
- }
3120
- }
3121
- /**
3122
- * 发送当前请求 - 使用 Tab Store
3123
- */
3124
- async sendActive() {
3125
- const req = this.activeRequest();
3126
- if (!req)
3127
- return;
3128
- await this.sendResolvedRequest(req);
3129
- }
3130
- async sendHubV2Issues() {
3131
- const project = this.projectContext.currentProject();
3132
- if (!project?.id) {
3133
- this.msg.warning("\u8BF7\u5148\u9009\u62E9\u9879\u76EE");
3134
- return;
3135
- }
3136
- const startedAt = Date.now();
3137
- this.tabStore.setSending(true);
3138
- this.tabStore.updateActiveResponse(null);
3139
- try {
3140
- const data = await this.api.hubTokenRequest({
3141
- projectId: project.id,
3142
- path: `/issues`,
3143
- method: "GET",
3144
- query: { page: 1, pageSize: 20 }
3145
- });
3146
- const bodyText = JSON.stringify(data, null, 2);
3147
- const endedAt = Date.now();
3148
- this.tabStore.updateActiveResponse({
3149
- historyId: `hub_token_${endedAt}`,
3150
- response: {
3151
- status: 200,
3152
- statusText: "OK",
3153
- headers: { "content-type": "application/json; charset=utf-8" },
3154
- bodyText,
3155
- bodySize: bodyText.length
3156
- },
3157
- metrics: {
3158
- startedAt,
3159
- endedAt,
3160
- durationMs: endedAt - startedAt
3161
- }
3162
- });
3163
- this.msg.success(`Hub Issues \u8BF7\u6C42\u6210\u529F (${Date.now() - startedAt}ms)`);
3164
- } catch (e) {
3165
- const endedAt = Date.now();
3166
- this.tabStore.updateActiveResponse({
3167
- historyId: `hub_token_${endedAt}`,
3168
- error: {
3169
- code: "HUB_TOKEN_REQUEST_ERROR",
3170
- message: e?.message ?? "Hub Issues \u8BF7\u6C42\u5931\u8D25"
3171
- },
3172
- metrics: {
3173
- startedAt,
3174
- endedAt,
3175
- durationMs: endedAt - startedAt
3176
- }
3177
- });
3178
- this.msg.error(e?.message ?? "Hub Issues \u8BF7\u6C42\u5931\u8D25");
3179
- } finally {
3180
- this.tabStore.setSending(false);
3181
- }
3182
- }
3183
- /**
3184
- * 删除请求
3185
- */
3186
- async removeRequest(id) {
3187
- await this.api.deleteRequest(id, this.scope(), this.projectId());
3188
- this.msg.success("\u5DF2\u5220\u9664");
3189
- const list = this.requests().filter((r) => r.id !== id);
3190
- this.requests.set(list);
3191
- const tab = this.tabs().find((t) => t.requestId === id);
3192
- if (tab) {
3193
- this.tabStore.closeTab(tab.id);
3194
- }
3195
- }
3196
- /**
3197
- * 确保 Kv 行有 ID
3198
- */
3199
- ensureKvId(rows) {
3200
- return rows.map((ele) => {
3201
- if (!ele.id) {
3202
- ele.id = (0, import_lodash5.uniqueId)();
3203
- }
3204
- return ele;
3205
- });
3206
- }
3207
- /**
3208
- * 打开历史记录面板
3209
- */
3210
- openHistory() {
3211
- this.historyOpen.set(true);
3212
- void this.loadHistory();
3213
- }
3214
- /**
3215
- * 关闭历史记录面板
3216
- */
3217
- closeHistory() {
3218
- this.historyOpen.set(false);
3219
- }
3220
- /**
3221
- * 加载历史记录列表
3222
- */
3223
- async loadHistory() {
3224
- this.historyLoading.set(true);
3225
- try {
3226
- const list = await this.api.listHistory(this.scope(), this.projectId());
3227
- this.histories.set(list);
3228
- } finally {
3229
- this.historyLoading.set(false);
3230
- }
3231
- }
3232
- /**
3233
- * 重放历史记录 - 在新 Tab 中打开
3234
- */
3235
- async replayHistory(h) {
3236
- this.tabStore.openRequestInTab(h.requestSnapshot);
3237
- await this.sendResolvedRequest(h.requestSnapshot);
3238
- }
3239
- /**
3240
- * 发送已解析的请求 - 使用 Tab Store
3241
- */
3242
- async sendResolvedRequest(request) {
3243
- const scope = this.scope();
3244
- const pid = scope === "project" ? this.projectId() : void 0;
3245
- if (scope === "project" && !pid) {
3246
- this.msg.warning("\u8BF7\u5148\u9009\u62E9\u9879\u76EE");
3247
- return;
3248
- }
3249
- this.tabStore.setSending(true);
3250
- this.tabStore.updateActiveResponse(null);
3251
- try {
3252
- const res = await this.api.send({
3253
- scope,
3254
- projectId: pid || void 0,
3255
- request,
3256
- envId: this.activeEnvId() ?? void 0,
3257
- projectRoot: this.projectContext.currentProject()?.root
3258
- // 有就传,没有就 undefined
3259
- });
3260
- this.tabStore.updateActiveResponse(res);
3261
- if (res.error) {
3262
- this.msg.error(`${res.error.code}: ${res.error.message}`);
3263
- } else {
3264
- this.msg.success(`HTTP ${res.response?.status ?? ""} (${res.metrics.durationMs}ms)`);
3265
- }
3266
- } catch (e) {
3267
- this.msg.error(e?.message ?? "\u53D1\u9001\u5931\u8D25");
3268
- } finally {
3269
- this.tabStore.setSending(false);
3270
- }
3271
- }
3272
- async loadEnvs() {
3273
- const scope = this.scope();
3274
- const pid = scope === "project" ? this.projectId() : void 0;
3275
- if (scope === "project" && !pid)
3276
- return;
3277
- this.envLoading.set(true);
3278
- try {
3279
- const list = await this.api.listEnvs(scope, pid);
3280
- this.envs.set(list);
3281
- const cur = this.activeEnvId();
3282
- if (cur && list.some((x) => x.id === cur))
3283
- return;
3284
- this.activeEnvId.set(list[0]?.id ?? null);
3285
- } finally {
3286
- this.envLoading.set(false);
3287
- }
3288
- }
3289
- // 给 UI 用:切换 env
3290
- setActiveEnv(id) {
3291
- this.activeEnvId.set(id);
3292
- }
3293
- // upsert env(MVP:简单做保存后 reload)
3294
- async saveEnv(env) {
3295
- const scope = this.scope();
3296
- const pid = scope === "project" ? this.projectId() : void 0;
3297
- await this.api.saveEnv(scope, pid || void 0, env);
3298
- await this.loadEnvs();
3299
- }
3300
- async deleteEnv(id) {
3301
- await this.api.deleteEnv(id, this.scope(), this.projectId());
3302
- if (this.activeEnvId() === id) {
3303
- this.activeEnvId.set(null);
3304
- }
3305
- await this.loadEnvs();
3306
- }
3307
- static ctorParameters = () => [];
3308
- };
3309
- ApiClientStateService = __decorate([
3310
- Injectable({
3311
- providedIn: "root"
3312
- })
3313
- ], ApiClientStateService);
3314
-
3315
- // angular:jit:style:inline:src\app\pages\api-client\components\request-editor\env-modal.component.ts;CiAgICAuZHJhd2VyeyBkaXNwbGF5OmdyaWQ7IGdyaWQtdGVtcGxhdGUtY29sdW1uczogMTgwcHggMWZyOyBnYXA6MTJweDsgaGVpZ2h0OjEwMCU7IH0KICAgIC5sZWZ0eyBib3JkZXItcmlnaHQ6MXB4IHNvbGlkICNmMGYwZjA7IHBhZGRpbmctcmlnaHQ6MTJweDsgfQogICAgLnRvb2xiYXJ7IHBhZGRpbmctYm90dG9tOjEwcHg7IH0KICAgIC5lbnYtbGlzdHsgZGlzcGxheTpmbGV4OyBmbGV4LWRpcmVjdGlvbjpjb2x1bW47IGdhcDo4cHg7IH0KICAgIC5lbnYtaXRlbXsgcGFkZGluZzo4cHg7IGJvcmRlcjoxcHggc29saWQgI2YwZjBmMDsgYm9yZGVyLXJhZGl1czo4cHg7IGN1cnNvcjpwb2ludGVyOyB9CiAgICAuZW52LWl0ZW0uYWN0aXZleyBiYWNrZ3JvdW5kOiNmNWY1ZjU7IH0KICAgIC5uYW1leyBmb250LXdlaWdodDo2MDA7IH0KICAgIC5tZXRheyBmb250LXNpemU6MTJweDsgb3BhY2l0eTouNzsgfQogICAgLnJpZ2h0eyBtaW4td2lkdGg6MDsgfQogICAgLmVtcHR5eyBwYWRkaW5nOjEycHg7IG9wYWNpdHk6Ljc7IH0KICAgIC5yb3d7IGRpc3BsYXk6Z3JpZDsgZ3JpZC10ZW1wbGF0ZS1jb2x1bW5zOiA3MHB4IDFmcjsgZ2FwOjEwcHg7IGFsaWduLWl0ZW1zOmNlbnRlcjsgbWFyZ2luLWJvdHRvbToxMHB4OyB9CiAgICAubGFiZWx7IGZvbnQtc2l6ZToxNHB4OyBvcGFjaXR5Oi44OyB9CiAgICAudmFyc3sgaGVpZ2h0OiA0MjBweDsgfQogICAgLmFjdGlvbnN7IGRpc3BsYXk6ZmxleDsgZ2FwOjhweDsgbWFyZ2luLXRvcDoxMnB4OyB9CiAg
3316
- var env_modal_component_default = "/* angular:styles/component:less;eabe06dfbf0a15b95c1f401a19b9b1c63a1f01a532d9737274095873e85fa695;D:\\ng-manager\\webapp\\src\\app\\pages\\api-client\\components\\request-editor\\env-modal.component.ts */\n.drawer {\n display: grid;\n grid-template-columns: 180px 1fr;\n gap: 12px;\n height: 100%;\n}\n.left {\n border-right: 1px solid #f0f0f0;\n padding-right: 12px;\n}\n.toolbar {\n padding-bottom: 10px;\n}\n.env-list {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n.env-item {\n padding: 8px;\n border: 1px solid #f0f0f0;\n border-radius: 8px;\n cursor: pointer;\n}\n.env-item.active {\n background: #f5f5f5;\n}\n.name {\n font-weight: 600;\n}\n.meta {\n font-size: 12px;\n opacity: 0.7;\n}\n.right {\n min-width: 0;\n}\n.empty {\n padding: 12px;\n opacity: 0.7;\n}\n.row {\n display: grid;\n grid-template-columns: 70px 1fr;\n gap: 10px;\n align-items: center;\n margin-bottom: 10px;\n}\n.label {\n font-size: 14px;\n opacity: 0.8;\n}\n.vars {\n height: 420px;\n}\n.actions {\n display: flex;\n gap: 8px;\n margin-top: 12px;\n}\n/*# sourceMappingURL=env-modal.component.css.map */\n";
3317
-
3318
- // src/app/pages/api-client/components/request-editor/env-modal.component.ts
3319
- function now2() {
3320
- return Date.now();
3321
- }
3322
- function newId(prefix) {
3323
- const rand = Math.random().toString(16).slice(2, 10);
3324
- return `${prefix}_${rand}_${Date.now().toString(16)}`;
3325
- }
3326
- var EnvModalComponent = class EnvModalComponent2 {
3327
- envChange = new EventEmitter();
3328
- store = inject(ApiClientStateService);
3329
- modalRef = inject(NzModalRef);
3330
- msg = inject(NzMessageService);
3331
- // 编辑缓存
3332
- draft = signal(null);
3333
- varsRows = signal([]);
3334
- selectEditEnv(id) {
3335
- this.store.activeEnvId.set(id);
3336
- const cur = this.store.envs().find((e) => e.id === id);
3337
- if (!cur)
3338
- return;
3339
- this.draft.set(__spreadProps(__spreadValues({}, cur), { variables: cur.variables }));
3340
- this.varsRows.set(envVarsToRows(cur.variables));
3341
- }
3342
- createEnv() {
3343
- const t = now2();
3344
- const env = {
3345
- id: newId("env"),
3346
- scope: "project",
3347
- name: "\u672A\u547D\u540D\u73AF\u5883",
3348
- variables: [],
3349
- createdAt: t,
3350
- updatedAt: t
3351
- };
3352
- this.draft.set(env);
3353
- this.varsRows.set(envVarsToRows(env.variables));
3354
- }
3355
- setName(name) {
3356
- const d = this.draft();
3357
- if (!d)
3358
- return;
3359
- this.draft.set(__spreadProps(__spreadValues({}, d), { name }));
3360
- }
3361
- setBaseUrl(baseUrl) {
3362
- const d = this.draft();
3363
- if (!d)
3364
- return;
3365
- this.draft.set(__spreadProps(__spreadValues({}, d), { baseUrl }));
3366
- }
3367
- async save() {
3368
- const d = this.draft();
3369
- if (!d)
3370
- return;
3371
- const env = __spreadProps(__spreadValues({}, d), {
3372
- variables: rowsToEnvVars(this.varsRows(), d.variables),
3373
- updatedAt: now2()
3374
- });
3375
- await this.store.saveEnv(env);
3376
- this.store.activeEnvId.set(env.id);
3377
- this.msg.success("\u73AF\u5883\u53D8\u91CF\u4FDD\u5B58\u6210\u529F");
3378
- this.draft.set(env);
3379
- }
3380
- async remove() {
3381
- const id = this.store.activeEnvId();
3382
- if (!id)
3383
- return;
3384
- await this.store.deleteEnv(id);
3385
- this.store.activeEnvId.set(null);
3386
- this.draft.set(null);
3387
- this.varsRows.set([]);
3388
- this.msg.success("\u73AF\u5883\u53D8\u91CF\u5220\u9664\u6210\u529F");
3389
- }
3390
- useThisEnv() {
3391
- const id = this.store.activeEnvId();
3392
- if (!id)
3393
- return;
3394
- this.store.setActiveEnv(id);
3395
- }
3396
- close() {
3397
- this.modalRef.close();
3398
- }
3399
- static propDecorators = {
3400
- envChange: [{ type: Output }]
3401
- };
3402
- };
3403
- EnvModalComponent = __decorate([
3404
- Component({
3405
- selector: "app-env-modal.component",
3406
- imports: [CommonModule, FormsModule, KvTableComponent, NzButtonModule, NzInputModule, NzPopconfirmModule],
3407
- template: `
3408
- <div class="drawer">
3409
- <div class="left">
3410
- <div class="toolbar">
3411
- <button nz-button nzType="primary" (click)="createEnv()">\u65B0\u5EFA</button>
3412
- </div>
3413
-
3414
- <div class="env-list">
3415
- @for (e of store.envs(); track e.id) {
3416
- <div class="env-item" [class.active]="e.id===draft()?.id" (click)="selectEditEnv(e.id)">
3417
- <div class="name">{{e.name}}</div>
3418
- <div class="meta">{{e.variables.length}} vars</div>
3419
- </div>
3420
- }
3421
- @if(!store.envs().length){
3422
- <div class="empty">\u6682\u65E0\u73AF\u5883</div>
3423
- }
3424
- </div>
3425
- </div>
3426
-
3427
- <div class="right">
3428
- @if(!draft()?.id){
3429
- <div class="empty">\u9009\u62E9\u4E00\u4E2A\u73AF\u5883\u8FDB\u884C\u7F16\u8F91</div>
3430
- } @else {
3431
- <div class="form">
3432
- <div class="row">
3433
- <div class="label">\u540D\u79F0</div>
3434
- <input nz-input [ngModel]="draft()!.name" (ngModelChange)="setName($event)" />
3435
- </div>
3436
- <div class="row">
3437
- <div class="label">\u524D\u7F6EURL</div>
3438
- <input nz-input [ngModel]="draft()!.baseUrl" (ngModelChange)="setBaseUrl($event)" />
3439
- </div>
3440
- <div class="vars">
3441
- <app-kv-table
3442
- [rows]="varsRows()"
3443
- (rowsChange)="varsRows.set($event)"
3444
- keyLabel="Key"
3445
- valueLabel="Value"
3446
- keyPlaceholder="TOKEN"
3447
- valuePlaceholder="xxx"
3448
- />
3449
- </div>
3450
-
3451
- <div class="actions">
3452
- <button nz-button nzType="primary" (click)="save()">\u4FDD\u5B58</button>
3453
- <button
3454
- nz-button
3455
- nzType="default"
3456
- nzDanger
3457
- nz-popconfirm
3458
- nzPopconfirmTitle="\u786E\u8BA4\u5220\u9664\u8BE5\u73AF\u5883\uFF1F"
3459
- (nzOnConfirm)="remove()"
3460
- >
3461
- \u5220\u9664
3462
- </button>
3463
- <button nz-button nzType="default" (click)="useThisEnv()">\u8BBE\u4E3A\u5F53\u524D</button>
3464
- </div>
3465
- </div>
3466
- }
3467
- </div>
3468
- </div>
3469
- `,
3470
- styles: [env_modal_component_default]
3471
- })
3472
- ], EnvModalComponent);
3473
-
3474
- // src/app/pages/api-client/components/request-editor/env-picker.component.ts
3475
- var EnvPickerComponent = class EnvPickerComponent2 {
3476
- store = inject(ApiClientStateService);
3477
- modalService = inject(NzModalService);
3478
- openEnvModal() {
3479
- const modal = this.modalService.create({
3480
- nzTitle: "\u73AF\u5883\u53D8\u91CF",
3481
- nzFooter: null,
3482
- nzMaskClosable: false,
3483
- nzContent: EnvModalComponent,
3484
- nzWidth: "1020px",
3485
- nzCentered: true
3486
- });
3487
- modal.afterOpen.subscribe(() => {
3488
- const instance = modal.getContentComponent();
3489
- if (instance && this.store.activeEnvId()) {
3490
- instance.selectEditEnv(this.store.activeEnvId() ?? "");
3491
- } else {
3492
- instance.createEnv();
3493
- }
3494
- });
3495
- }
3496
- };
3497
- EnvPickerComponent = __decorate([
3498
- Component({
3499
- selector: "app-env-picker",
3500
- standalone: true,
3501
- imports: [
3502
- CommonModule,
3503
- FormsModule,
3504
- NzSelectModule,
3505
- NzButtonModule,
3506
- NzDrawerModule,
3507
- NzInputModule,
3508
- NzTooltipModule,
3509
- NzIconModule,
3510
- NzPopconfirmModule
3511
- ],
3512
- template: `
3513
- <div class="picker">
3514
- <nz-select
3515
- class="sel"
3516
- [nzPlaceHolder]="'Env'"
3517
- [ngModel]="store.activeEnvId()"
3518
- (ngModelChange)="store.setActiveEnv($event)"
3519
- [nzAllowClear]="true"
3520
- >
3521
- @for (e of store.envs(); track e.id) {
3522
- <nz-option [nzValue]="e.id" [nzLabel]="e.name"></nz-option>
3523
- }
3524
- </nz-select>
3525
- <button nz-button nzType="text" (click)="openEnvModal()" nz-tooltip nzTooltipTitle="\u7BA1\u7406\u73AF\u5883\u53D8\u91CF">
3526
- <nz-icon nzType="setting" nzTheme="outline"></nz-icon>
3527
- </button>
3528
- </div>
3529
- `,
3530
- styles: [env_picker_component_default]
3531
- })
3532
- ], EnvPickerComponent);
3533
-
3534
- // angular:jit:style:inline:src\app\pages\api-client\components\request-editor\request-tabs.component.ts;CiAgICAgIDpob3N0eyBkaXNwbGF5OmZsZXg7IGZsZXgtZGlyZWN0aW9uOmNvbHVtbjsgaGVpZ2h0OjEwMCU7IG1pbi1oZWlnaHQ6MDsgfQogICAgICBhcHAta3YtdGFibGV7CiAgICAgICAgZGlzcGxheTogYmxvY2s7CiAgICAgICAgaGVpZ2h0OiAxMDAlOwogICAgICB9CiAgICAgIC50YWJzICB7CiAgICAgICAgICBmbGV4OiAxIDEgYXV0bzsKICAgICAgICAgIG92ZXJmbG93OiBoaWRkZW47CiAgICAgICAgICBoZWlnaHQ6IDEwMCU7CiAgICAgIH0KICAgICAgLnRhYnsKICAgICAgICBoZWlnaHQ6IDEwMCU7CiAgICAgICAgb3ZlcmZsb3c6IGhpZGRlbiBhdXRvOwogICAgICB9CiAgICAgIDo6bmctZGVlcCBuei10YWJzLnRhYnN7CiAgICAgICAgLmFudC10YWJzLWNvbnRlbnR7CiAgICAgICAgICBoZWlnaHQ6IDEwMCU7CiAgICAgICAgICAuYW50LXRhYnMtdGFicGFuZXsKICAgICAgICAgICAgaGVpZ2h0OjEwMCU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICA=
3535
- var request_tabs_component_default = "/* angular:styles/component:less;22c649d587fc7dc66f49bbcdaa66d8df46262c892c4428b4ab5dcd2400dd84e3;D:\\ng-manager\\webapp\\src\\app\\pages\\api-client\\components\\request-editor\\request-tabs.component.ts */\n:host {\n display: flex;\n flex-direction: column;\n height: 100%;\n min-height: 0;\n}\napp-kv-table {\n display: block;\n height: 100%;\n}\n.tabs {\n flex: 1 1 auto;\n overflow: hidden;\n height: 100%;\n}\n.tab {\n height: 100%;\n overflow: hidden auto;\n}\n::ng-deep nz-tabs.tabs .ant-tabs-content {\n height: 100%;\n}\n::ng-deep nz-tabs.tabs .ant-tabs-content .ant-tabs-tabpane {\n height: 100%;\n}\n/*# sourceMappingURL=request-tabs.component.css.map */\n";
3536
-
3537
- // angular:jit:style:inline:src\app\pages\api-client\components\request-editor\advanced-editor.component.ts;CiAgICAud3JhcHsKICAgICAgZGlzcGxheTpmbGV4OwogICAgICBmbGV4LWRpcmVjdGlvbjpjb2x1bW47CiAgICAgIGhlaWdodDoxMDAlOwogICAgICBtaW4taGVpZ2h0OjI0MHB4OwogICAgfQoKICAgIC5ncmlkewogICAgICBkaXNwbGF5OmZsZXg7CiAgICAgIGZsZXgtZGlyZWN0aW9uOmNvbHVtbjsKICAgICAgZ2FwOjE0cHg7CiAgICAgIHBhZGRpbmctdG9wOjEwcHg7CiAgICB9CgogICAgLnJvd3sKICAgICAgZGlzcGxheTpncmlkOwogICAgICBncmlkLXRlbXBsYXRlLWNvbHVtbnM6IDE0MHB4IDFmcjsKICAgICAgYWxpZ24taXRlbXM6Y2VudGVyOwogICAgICBnYXA6MTBweDsKICAgIH0KCiAgICAucm93LmNoZWNrYm94ewogICAgICBncmlkLXRlbXBsYXRlLWNvbHVtbnM6IDFmcjsKICAgIH0KCiAgICAubGFiZWx7CiAgICAgIGZvbnQtc2l6ZToxMnB4OwogICAgICBvcGFjaXR5Oi44OwogICAgfQoKICAgIC5kZXNjewogICAgICBncmlkLWNvbHVtbjogMiAvIHNwYW4gMTsKICAgICAgZm9udC1zaXplOjEycHg7CiAgICAgIG9wYWNpdHk6LjY1OwogICAgfQoKICAgIC5yb3cuY2hlY2tib3ggLmRlc2N7CiAgICAgIGdyaWQtY29sdW1uOiAxIC8gc3BhbiAxOwogICAgICBtYXJnaW4tbGVmdDoyNHB4OwogICAgfQoKICAgIC5tdXRlZHsKICAgICAgY29sb3I6Izk5OTsKICAgIH0KICA=
3538
- var advanced_editor_component_default = "/* angular:styles/component:less;911626d8e9e42e1af92f11315b5e8d0350782730be994257d01c744bb8b89678;D:\\ng-manager\\webapp\\src\\app\\pages\\api-client\\components\\request-editor\\advanced-editor.component.ts */\n.wrap {\n display: flex;\n flex-direction: column;\n height: 100%;\n min-height: 240px;\n}\n.grid {\n display: flex;\n flex-direction: column;\n gap: 14px;\n padding-top: 10px;\n}\n.row {\n display: grid;\n grid-template-columns: 140px 1fr;\n align-items: center;\n gap: 10px;\n}\n.row.checkbox {\n grid-template-columns: 1fr;\n}\n.label {\n font-size: 12px;\n opacity: 0.8;\n}\n.desc {\n grid-column: 2 / span 1;\n font-size: 12px;\n opacity: 0.65;\n}\n.row.checkbox .desc {\n grid-column: 1 / span 1;\n margin-left: 24px;\n}\n.muted {\n color: #999;\n}\n/*# sourceMappingURL=advanced-editor.component.css.map */\n";
3539
-
3540
- // src/app/pages/api-client/components/request-editor/advanced-editor.component.ts
3541
- var AdvancedEditorComponent = class AdvancedEditorComponent2 {
3542
- options;
3543
- optionsChange = new EventEmitter();
3544
- timeoutMs = computed(() => this.options?.timeoutMs ?? 3e4);
3545
- followRedirects = computed(() => this.options?.followRedirects ?? true);
3546
- insecureTLS = computed(() => this.options?.insecureTLS ?? false);
3547
- proxy = computed(() => this.options?.proxy ?? "");
3548
- emit(next) {
3549
- this.optionsChange.emit(next);
3550
- }
3551
- setTimeout(v) {
3552
- const n = Number(v);
3553
- this.emit(__spreadProps(__spreadValues({}, this.options ?? {}), { timeoutMs: isNaN(n) ? void 0 : n }));
3554
- }
3555
- setFollowRedirects(v) {
3556
- this.emit(__spreadProps(__spreadValues({}, this.options ?? {}), { followRedirects: v }));
3557
- }
3558
- setInsecureTLS(v) {
3559
- this.emit(__spreadProps(__spreadValues({}, this.options ?? {}), { insecureTLS: v }));
3560
- }
3561
- setProxy(v) {
3562
- this.emit(__spreadProps(__spreadValues({}, this.options ?? {}), { proxy: v || void 0 }));
3563
- }
3564
- static propDecorators = {
3565
- options: [{ type: Input }],
3566
- optionsChange: [{ type: Output }]
3567
- };
3568
- };
3569
- AdvancedEditorComponent = __decorate([
3570
- Component({
3571
- selector: "app-advanced-editor",
3572
- standalone: true,
3573
- imports: [
3574
- CommonModule,
3575
- FormsModule,
3576
- NzCheckboxModule,
3577
- NzInputModule,
3578
- NzAlertModule
3579
- ],
3580
- template: `
3581
- <div class="wrap">
3582
- <div class="grid">
3583
- <!-- timeout -->
3584
- <div class="row">
3585
- <div class="label">Timeout (ms)</div>
3586
- <input
3587
- nz-input
3588
- type="number"
3589
- min="0"
3590
- placeholder="30000"
3591
- [ngModel]="timeoutMs()"
3592
- (ngModelChange)="setTimeout($event)"
3593
- />
3594
- <div class="desc">\u8BF7\u6C42\u8D85\u65F6\u65F6\u95F4\uFF0C\u5355\u4F4D\u6BEB\u79D2\uFF080 \u8868\u793A\u4E0D\u8D85\u65F6\uFF09</div>
3595
- </div>
3596
-
3597
- <!-- follow redirects -->
3598
- <div class="row checkbox">
3599
- <label nz-checkbox [ngModel]="followRedirects()" (ngModelChange)="setFollowRedirects($event)">
3600
- Follow Redirects
3601
- </label>
3602
- <div class="desc">\u662F\u5426\u81EA\u52A8\u8DDF\u968F HTTP \u91CD\u5B9A\u5411\uFF08302 / 301\uFF09</div>
3603
- </div>
3604
-
3605
- <!-- insecure TLS -->
3606
- <div class="row checkbox">
3607
- <label nz-checkbox [ngModel]="insecureTLS()" (ngModelChange)="setInsecureTLS($event)">
3608
- Insecure TLS
3609
- </label>
3610
- <div class="desc">\u8DF3\u8FC7 TLS \u8BC1\u4E66\u6821\u9A8C\uFF08\u4EC5\u5728 Node \u73AF\u5883\u4E0B\u5C3D\u529B\u652F\u6301\uFF09</div>
3611
- </div>
3612
-
3613
- <!-- proxy -->
3614
- <div class="row">
3615
- <div class="label">Proxy</div>
3616
- <input
3617
- nz-input
3618
- placeholder="http://127.0.0.1:7890"
3619
- [ngModel]="proxy()"
3620
- (ngModelChange)="setProxy($event)"
3621
- />
3622
- <div class="desc muted">\u4EE3\u7406\u5730\u5740\uFF08\u5F53\u524D\u7248\u672C\u4EC5\u4FDD\u5B58\uFF0C\u4E0D\u53C2\u4E0E\u5B9E\u9645\u8BF7\u6C42\uFF09</div>
3623
- </div>
3624
-
3625
- <nz-alert
3626
- nzType="info"
3627
- nzShowIcon
3628
- nzMessage="\u8BF4\u660E\uFF1AProxy \u914D\u7F6E\u5DF2\u4FDD\u5B58\uFF0C\u4F46\u5F53\u524D NodeHttpClient \u5C1A\u672A\u5B9E\u73B0\u4EE3\u7406\u652F\u6301\uFF0C\u8BF7\u52FF\u4F9D\u8D56\u8BE5\u9009\u9879\u8FDB\u884C\u8C03\u8BD5\u3002"
3629
- ></nz-alert>
3630
- </div>
3631
- </div>
3632
- `,
3633
- styles: [advanced_editor_component_default]
3634
- })
3635
- ], AdvancedEditorComponent);
3636
-
3637
- // src/app/pages/api-client/components/request-editor/request-tabs.component.ts
3638
- var RequestTabsComponent = class RequestTabsComponent2 {
3639
- req = null;
3640
- patch = new EventEmitter();
3641
- static propDecorators = {
3642
- req: [{ type: Input }],
3643
- patch: [{ type: Output }]
3644
- };
3645
- };
3646
- RequestTabsComponent = __decorate([
3647
- Component({
3648
- selector: "app-request-tabs",
3649
- imports: [NzTabsModule, KvTableComponent, BodyEditorComponent, AuthEditorComponent, AdvancedEditorComponent],
3650
- template: `
3651
- <nz-tabs class="tabs">
3652
- <nz-tab nzTitle="Params">
3653
- <div class="tab">
3654
- <div class="item">
3655
- <div class="title">Query \u53C2\u6570</div>
3656
- <app-kv-table
3657
- [rows]="req?.query || []"
3658
- (rowsChange)="patch.emit({ query: $event })"
3659
- keyLabel="\u53C2\u6570\u540D"
3660
- valueLabel="\u53C2\u6570\u503C"
3661
- descriptionLabel="\u8BF4\u660E"
3662
- keyPlaceholder="param"
3663
- valuePlaceholder="value"
3664
- />
3665
- </div>
3666
- @if(req?.pathParams?.length){
3667
- <div class="item">
3668
- <div class="title">Path \u53C2\u6570</div>
3669
- <app-kv-table
3670
- [keepTrailingBlank]="false"
3671
- [rows]="req?.pathParams || []"
3672
- (rowsChange)="patch.emit({ pathParams: $event })"
3673
- keyLabel="\u53C2\u6570\u540D"
3674
- valueLabel="\u53C2\u6570\u503C"
3675
- descriptionLabel="\u8BF4\u660E"
3676
- keyPlaceholder="param"
3677
- valuePlaceholder="value"
3678
- />
3679
- </div>
3680
- }
3681
- </div>
3682
- </nz-tab>
3683
- <nz-tab nzTitle="Headers">
3684
- <div class="tab">
3685
- <app-kv-table
3686
- [rows]="req?.headers || []"
3687
- (rowsChange)="patch.emit({ headers: $event })"
3688
- keyLabel="Header"
3689
- valueLabel="Value"
3690
- keyPlaceholder="x-header"
3691
- valuePlaceholder="value"
3692
- />
3693
- </div>
3694
- </nz-tab>
3695
- <nz-tab nzTitle="Body">
3696
- <div class="tab">
3697
- <app-body-editor
3698
- [body]="req?.body"
3699
- (bodyChange)="patch.emit({ body: $event })"
3700
- />
3701
- </div>
3702
- </nz-tab>
3703
- <nz-tab nzTitle="Auth">
3704
- <div class="tab">
3705
- <app-auth-editor
3706
- [auth]="req?.auth"
3707
- (authChange)="patch.emit({ auth: $event })"
3708
- />
3709
- </div>
3710
- </nz-tab>
3711
- <nz-tab nzTitle="Advanced">
3712
- <div class="tab">
3713
- <app-advanced-editor
3714
- [options]="req?.options"
3715
- (optionsChange)="patch.emit({ options: $event })"
3716
- />
3717
- </div>
3718
- </nz-tab>
3719
- </nz-tabs>
3720
- `,
3721
- styles: [request_tabs_component_default]
3722
- })
3723
- ], RequestTabsComponent);
3724
-
3725
- // angular:jit:style:inline:src\app\pages\api-client\components\request-editor\request-editor.component.ts;CiAgICA6aG9zdHsgZGlzcGxheTogZmxleDsgZmxleC1kaXJlY3Rpb246IGNvbHVtbjt9CiAgICAubmFtZXsgcGFkZGluZzoxMHB4OyBib3JkZXItYm90dG9tOjFweCBzb2xpZCAjZjBmMGYwOyB9CiAgICAudGFic3sgZmxleDoxIDEgYXV0bzsgb3ZlcmZsb3c6aGlkZGVuOyBwYWRkaW5nOjAgMTBweDsgfQogICAgYXBwLXJlcXVlc3QtdGFic3tmbGV4OjEgMSBhdXRvOyBoZWlnaHQ6MDt9CiAg
3726
- var request_editor_component_default = "/* angular:styles/component:less;de9c446db3f77e43cef20849dae466a91b77073ebfb25617c2d7838e1fbb525b;D:\\ng-manager\\webapp\\src\\app\\pages\\api-client\\components\\request-editor\\request-editor.component.ts */\n:host {\n display: flex;\n flex-direction: column;\n}\n.name {\n padding: 10px;\n border-bottom: 1px solid #f0f0f0;\n}\n.tabs {\n flex: 1 1 auto;\n overflow: hidden;\n padding: 0 10px;\n}\napp-request-tabs {\n flex: 1 1 auto;\n height: 0;\n}\n/*# sourceMappingURL=request-editor.component.css.map */\n";
3727
-
3728
- // angular:jit:style:inline:src\app\pages\api-client\components\request-editor\request-urlbar.component.ts;CiAgICAuYmFyewogICAgICBkaXNwbGF5OmZsZXg7CiAgICAgIGdhcDoxMHB4OwogICAgICBwYWRkaW5nOjEwcHg7CiAgICAgIGJvcmRlci1ib3R0b206MXB4IHNvbGlkICNmMGYwZjA7CiAgICAgIGFsaWduLWl0ZW1zOmNlbnRlcjsKICAgIH0KICAgIC5tZXRob2R7IHdpZHRoOjEyMHB4OyB9CiAgICAudXJseyBmbGV4OjEgMSBhdXRvOyB9CiAgICAudmFyLWhpbnR7CiAgICAgIHBhZGRpbmc6IDRweCAxMHB4IDhweDsKICAgICAgZm9udC1zaXplOiAxMnB4OwogICAgICBkaXNwbGF5OiBmbGV4OwogICAgICBnYXA6IDhweDsKICAgICAgYWxpZ24taXRlbXM6IGNlbnRlcjsKICAgIH0KICA=
3729
- var request_urlbar_component_default = "/* angular:styles/component:less;2545a7f8140b00be966602c60632d1077fd891b1e8b774540c3a89ad3cc4f9d7;D:\\ng-manager\\webapp\\src\\app\\pages\\api-client\\components\\request-editor\\request-urlbar.component.ts */\n.bar {\n display: flex;\n gap: 10px;\n padding: 10px;\n border-bottom: 1px solid #f0f0f0;\n align-items: center;\n}\n.method {\n width: 120px;\n}\n.url {\n flex: 1 1 auto;\n}\n.var-hint {\n padding: 4px 10px 8px;\n font-size: 12px;\n display: flex;\n gap: 8px;\n align-items: center;\n}\n/*# sourceMappingURL=request-urlbar.component.css.map */\n";
3730
-
3731
- // src/app/pages/api-client/components/request-editor/request-urlbar.component.ts
3732
- var RequestUrlbarComponent = class RequestUrlbarComponent2 {
3733
- envVars = {};
3734
- openEnv;
3735
- method = "GET";
3736
- url = "";
3737
- sending = false;
3738
- envName = null;
3739
- baseUrl = null;
3740
- methodChange = new EventEmitter();
3741
- urlChange = new EventEmitter();
3742
- urlCommit = new EventEmitter();
3743
- send = new EventEmitter();
3744
- save = new EventEmitter();
3745
- methods = ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"];
3746
- missingVars = computed(() => collectMissingFromStrings([this.draftUrl], this.envVars));
3747
- draftUrl = "";
3748
- t;
3749
- ngOnChanges(changes) {
3750
- if (changes["url"]) {
3751
- this.draftUrl = this.url ?? "";
3752
- }
3753
- }
3754
- onDraftChange(v) {
3755
- this.draftUrl = v ?? "";
3756
- if (this.t)
3757
- window.clearTimeout(this.t);
3758
- this.t = window.setTimeout(() => {
3759
- this.urlChange.emit(this.draftUrl);
3760
- }, 250);
3761
- }
3762
- commit() {
3763
- if (this.t) {
3764
- window.clearTimeout(this.t);
3765
- this.t = void 0;
3766
- }
3767
- this.urlChange.emit(this.draftUrl);
3768
- this.urlCommit.emit(this.draftUrl);
3769
- }
3770
- placeholder = computed(() => {
3771
- return this.baseUrl ? `"/"\u5F00\u5934` : "http://...";
3772
- });
3773
- previewUrl = computed(() => {
3774
- const raw = (this.url ?? "").trim();
3775
- if (!raw)
3776
- return "";
3777
- if (isAbsoluteUrl(raw))
3778
- return "";
3779
- const base = (this.baseUrl ?? "").trim();
3780
- if (!base)
3781
- return "";
3782
- try {
3783
- return new URL(raw, base).toString();
3784
- } catch {
3785
- return "";
3786
- }
3787
- });
3788
- static propDecorators = {
3789
- envVars: [{ type: Input }],
3790
- openEnv: [{ type: Input }],
3791
- method: [{ type: Input }],
3792
- url: [{ type: Input }],
3793
- sending: [{ type: Input }],
3794
- envName: [{ type: Input }],
3795
- baseUrl: [{ type: Input }],
3796
- methodChange: [{ type: Output }],
3797
- urlChange: [{ type: Output }],
3798
- urlCommit: [{ type: Output }],
3799
- send: [{ type: Output }],
3800
- save: [{ type: Output }]
3801
- };
3802
- };
3803
- RequestUrlbarComponent = __decorate([
3804
- Component({
3805
- selector: "app-request-urlbar",
3806
- standalone: true,
3807
- imports: [CommonModule, FormsModule, NzButtonModule, NzInputModule, NzSelectModule, NzTagModule],
3808
- template: `
3809
- <div class="bar">
3810
- <nz-select class="method" [ngModel]="method" (ngModelChange)="methodChange.emit($event)">
3811
- @for (m of methods; track m) {
3812
- <nz-option [nzValue]="m" [nzLabel]="m" class="m"></nz-option>
3813
- }
3814
- </nz-select>
3815
- <nz-input-wrapper class="url" [nzAddonBefore]="baseUrl ? baseUrl + ' ' : undefined" >
3816
- <input
3817
- nz-input
3818
- [placeholder]="placeholder()"
3819
- [ngModel]="draftUrl"
3820
- (ngModelChange)="onDraftChange($event)"
3821
- (blur)="commit()"
3822
- (keydown.enter)="commit()"
3823
- />
3824
- </nz-input-wrapper>
3825
- <button nz-button nzType="primary" [nzLoading]="sending" (click)="send.emit()">\u53D1\u9001</button>
3826
- <button nz-button nzType="default" (click)="save.emit()">\u4FDD\u5B58</button>
3827
- </div>
3828
- @if (missingVars().length) {
3829
- <div class="var-hint">
3830
- <nz-tag nzColor="warning">
3831
- \u672A\u89E3\u6790\u53D8\u91CF\uFF1A{{ missingVars().join(', ') }}
3832
- </nz-tag>
3833
- <a (click)="openEnv()">\u53BB\u914D\u7F6E</a>
3834
- </div>
3835
- }
3836
- `,
3837
- styles: [request_urlbar_component_default]
3838
- })
3839
- ], RequestUrlbarComponent);
3840
- function isAbsoluteUrl(u) {
3841
- return /^https?:\/\//i.test(u);
3842
- }
3843
-
3844
- // src/app/pages/api-client/components/request-editor/request-editor.component.ts
3845
- var RequestEditorComponent = class RequestEditorComponent2 {
3846
- request = null;
3847
- sending = false;
3848
- envVars = {};
3849
- openEnv;
3850
- baseUrl = null;
3851
- patch = new EventEmitter();
3852
- send = new EventEmitter();
3853
- save = new EventEmitter();
3854
- collectionPath = null;
3855
- methods = ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"];
3856
- onUrlCommit(nextUrl) {
3857
- const cur = this.request;
3858
- if (!cur)
3859
- return;
3860
- const nextPathParams = syncPathParamsByUrl(nextUrl, cur.pathParams);
3861
- const curKeys = extractPathParamKeys(cur.url ?? "");
3862
- const nextKeys = extractPathParamKeys(nextUrl ?? "");
3863
- const keysChanged = curKeys.length !== nextKeys.length || curKeys.some((k, i) => k !== nextKeys[i]);
3864
- if (keysChanged) {
3865
- this.patch.emit({ pathParams: nextPathParams });
3866
- }
3867
- }
3868
- onUrlChange(nextUrl) {
3869
- const cur = this.request;
3870
- if (!cur) {
3871
- this.patch.emit({ url: nextUrl });
3872
- return;
3873
- }
3874
- const nextPathParams = syncPathParamsByUrl(nextUrl, cur.pathParams);
3875
- const curKeys = extractPathParamKeys(cur.url ?? "");
3876
- const nextKeys = extractPathParamKeys(nextUrl ?? "");
3877
- const keysChanged = curKeys.length !== nextKeys.length || curKeys.some((k, i) => k !== nextKeys[i]);
3878
- if (keysChanged) {
3879
- this.patch.emit({ url: nextUrl, pathParams: nextPathParams });
3880
- } else {
3881
- this.patch.emit({ url: nextUrl });
3882
- }
3883
- }
3884
- static propDecorators = {
3885
- request: [{ type: Input }],
3886
- sending: [{ type: Input }],
3887
- envVars: [{ type: Input }],
3888
- openEnv: [{ type: Input }],
3889
- baseUrl: [{ type: Input }],
3890
- patch: [{ type: Output }],
3891
- send: [{ type: Output }],
3892
- save: [{ type: Output }],
3893
- collectionPath: [{ type: Input }]
3894
- };
3895
- };
3896
- RequestEditorComponent = __decorate([
3897
- Component({
3898
- selector: "app-request-editor",
3899
- standalone: true,
3900
- imports: [
3901
- CommonModule,
3902
- FormsModule,
3903
- NzButtonModule,
3904
- NzInputModule,
3905
- NzSelectModule,
3906
- NzSpinModule,
3907
- RequestTabsComponent,
3908
- RequestUrlbarComponent
3909
- ],
3910
- template: `
3911
- @if(request){
3912
- <app-request-urlbar
3913
- [method]="request.method"
3914
- [baseUrl]="baseUrl"
3915
- [envVars]="envVars"
3916
- [openEnv]="openEnv"
3917
- [url]="request.url"
3918
- [sending]="sending"
3919
- (methodChange)="patch.emit({method:$event})"
3920
- (urlChange)="onUrlChange($event)"
3921
- (urlCommit)="onUrlCommit($event)"
3922
- (send)="send.emit()"
3923
- (save)="save.emit()"
3924
- />
3925
- <div class="name">
3926
- <nz-input-wrapper [nzAddonBefore]=" (collectionPath || '\u672A\u5206\u7C7B')">
3927
- <input nz-input placeholder="\u672A\u547D\u540D\u63A5\u53E3\u540D\u79F0" [ngModel]="request.name" (ngModelChange)="patch.emit({name:$event})" />
3928
- </nz-input-wrapper>
3929
- </div>
3930
- <app-request-tabs class="tabs" [req]="request" (patch)="patch.emit($event)" />
3931
- }
3932
- `,
3933
- styles: [request_editor_component_default]
3934
- })
3935
- ], RequestEditorComponent);
3936
-
3937
- // angular:jit:style:inline:src\app\pages\api-client\components\response-viewer\curl-actions.component.ts;
3938
- var curl_actions_component_default = "/* angular:styles/component:less;e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855;D:\\ng-manager\\webapp\\src\\app\\pages\\api-client\\components\\response-viewer\\curl-actions.component.ts */\n/*# sourceMappingURL=curl-actions.component.css.map */\n";
3939
-
3940
- // src/app/pages/api-client/components/response-viewer/curl-actions.component.ts
3941
- var CurlActionsComponent = class CurlActionsComponent2 {
3942
- clipboard = inject(Clipboard);
3943
- curl = null;
3944
- copy(text) {
3945
- this.clipboard.copy(text);
3946
- }
3947
- static propDecorators = {
3948
- curl: [{ type: Input }]
3949
- };
3950
- };
3951
- CurlActionsComponent = __decorate([
3952
- Component({
3953
- selector: "app-curl-actions",
3954
- imports: [CommonModule, ClipboardModule, NzSpaceModule, NzButtonModule, NzIconModule, NzDropDownModule],
3955
- template: `
3956
- <div class="wrap">
3957
- <nz-space >
3958
- <button nz-button [disabled]="!curl" nz-dropdown [nzDropdownMenu]="menu" nzType="default" nzTrigger="hover" nzPlacement="bottomCenter">
3959
- <nz-icon nzType="copy" nzTheme="outline"/>
3960
- cURL
3961
- </button>
3962
- </nz-space>
3963
- <nz-dropdown-menu #menu="nzDropdownMenu" >
3964
- <ul nz-menu>
3965
- <li nz-menu-item>
3966
- <button nz-button nzType="text" [disabled]="!curl?.bash" (click)="copy(curl!.bash)">
3967
- cURL (Bash)
3968
- </button>
3969
- </li>
3970
- <li nz-menu-item>
3971
- <button nz-button nzType="text" [disabled]="!curl?.powershell" (click)="copy(curl!.powershell)">
3972
- cURL (PS)
3973
- </button>
3974
- </li>
3975
- <li nz-menu-item>
3976
- <button nz-button nzType="text" [disabled]="!curl?.cmd" (click)="copy(curl!.cmd)">
3977
- cURL (CMD)
3978
- </button>
3979
- </li>
3980
- </ul>
3981
- </nz-dropdown-menu>
3982
- </div>
3983
- `,
3984
- styles: [curl_actions_component_default]
3985
- })
3986
- ], CurlActionsComponent);
3987
-
3988
- // angular:jit:style:inline:src\app\pages\api-client\components\response-viewer\response-viewer.component.ts;CiAgICA6aG9zdHsgZGlzcGxheTpmbGV4OyBoZWlnaHQ6MTAwJTsgbWluLWhlaWdodDowOyB9CiAgICAud3JhcHsgZGlzcGxheTpmbGV4OyBmbGV4LWRpcmVjdGlvbjpjb2x1bW47IGhlaWdodDoxMDAlOyBtaW4taGVpZ2h0OjA7IHdpZHRoOjEwMCU7IH0KCiAgICAudG9wewogICAgICBkaXNwbGF5OmZsZXg7CiAgICAgIGp1c3RpZnktY29udGVudDpzcGFjZS1iZXR3ZWVuOwogICAgICBhbGlnbi1pdGVtczpjZW50ZXI7CiAgICAgIHBhZGRpbmc6MTBweCAxMnB4OwogICAgICBib3JkZXItYm90dG9tOjFweCBzb2xpZCAjZjBmMGYwOwogICAgfQogICAgLmxlZnR7IGRpc3BsYXk6ZmxleDsgZ2FwOjEwcHg7IGFsaWduLWl0ZW1zOmNlbnRlcjsgfQogICAgLnRpdGxleyBmb250LXdlaWdodDo3MDA7IH0KICAgIC5tZXRheyBmb250LXNpemU6MTJweDsgb3BhY2l0eTouNjU7IH0KCiAgICAubG9hZGluZ3sgcGFkZGluZzoxNnB4OyB9CiAgICAuZW1wdHl7IHBhZGRpbmc6MTZweDsgb3BhY2l0eTouNjsgfQoKICAgIC50YWJzeyBmbGV4OjEgMSBhdXRvOyBtaW4taGVpZ2h0OjA7IH0KICAgIC5wYW5leyBoZWlnaHQ6MTAwJTsgbWluLWhlaWdodDowOyBvdmVyZmxvdzphdXRvOyBwYWRkaW5nOjEwcHggMTJweDsgfQoKICAgIC5jb2RlewogICAgICBtYXJnaW46MDsKICAgICAgZm9udC1mYW1pbHk6IHVpLW1vbm9zcGFjZSwgU0ZNb25vLVJlZ3VsYXIsIE1lbmxvLCBNb25hY28sIENvbnNvbGFzLCAiTGliZXJhdGlvbiBNb25vIiwgIkNvdXJpZXIgTmV3IiwgbW9ub3NwYWNlOwogICAgICBmb250LXNpemU6MTJweDsKICAgICAgbGluZS1oZWlnaHQ6MS41OwogICAgICB3aGl0ZS1zcGFjZTpwcmUtd3JhcDsKICAgICAgd29yZC1icmVhazpicmVhay13b3JkOwogICAgfQoKICAgIC5obGlzdHsgZGlzcGxheTpmbGV4OyBmbGV4LWRpcmVjdGlvbjpjb2x1bW47IGdhcDo4cHg7IH0KICAgIC5ocm93ewogICAgICBkaXNwbGF5OmdyaWQ7CiAgICAgIGdyaWQtdGVtcGxhdGUtY29sdW1uczogMjAwcHggMWZyOwogICAgICBnYXA6MTBweDsKICAgICAgcGFkZGluZzo4cHg7CiAgICAgIGJvcmRlcjoxcHggc29saWQgI2YwZjBmMDsKICAgICAgYm9yZGVyLXJhZGl1czo4cHg7CiAgICB9CiAgICAuaGt7IGZvbnQtd2VpZ2h0OjYwMDsgZm9udC1zaXplOjEycHg7IH0KICAgIC5odnsgZm9udC1zaXplOjEycHg7IG9wYWNpdHk6Ljg1OyB3b3JkLWJyZWFrOmJyZWFrLXdvcmQ7IH0KICA=
3989
- var response_viewer_component_default = '/* angular:styles/component:less;5a3667eac1a001012f88fa45835368589b34b87936c1945179fde1d4aee84900;D:\\ng-manager\\webapp\\src\\app\\pages\\api-client\\components\\response-viewer\\response-viewer.component.ts */\n:host {\n display: flex;\n height: 100%;\n min-height: 0;\n}\n.wrap {\n display: flex;\n flex-direction: column;\n height: 100%;\n min-height: 0;\n width: 100%;\n}\n.top {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 10px 12px;\n border-bottom: 1px solid #f0f0f0;\n}\n.left {\n display: flex;\n gap: 10px;\n align-items: center;\n}\n.title {\n font-weight: 700;\n}\n.meta {\n font-size: 12px;\n opacity: 0.65;\n}\n.loading {\n padding: 16px;\n}\n.empty {\n padding: 16px;\n opacity: 0.6;\n}\n.tabs {\n flex: 1 1 auto;\n min-height: 0;\n}\n.pane {\n height: 100%;\n min-height: 0;\n overflow: auto;\n padding: 10px 12px;\n}\n.code {\n margin: 0;\n font-family:\n ui-monospace,\n SFMono-Regular,\n Menlo,\n Monaco,\n Consolas,\n "Liberation Mono",\n "Courier New",\n monospace;\n font-size: 12px;\n line-height: 1.5;\n white-space: pre-wrap;\n word-break: break-word;\n}\n.hlist {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n.hrow {\n display: grid;\n grid-template-columns: 200px 1fr;\n gap: 10px;\n padding: 8px;\n border: 1px solid #f0f0f0;\n border-radius: 8px;\n}\n.hk {\n font-weight: 600;\n font-size: 12px;\n}\n.hv {\n font-size: 12px;\n opacity: 0.85;\n word-break: break-word;\n}\n/*# sourceMappingURL=response-viewer.component.css.map */\n';
3990
-
3991
- // src/app/pages/api-client/components/response-viewer/response-viewer.component.ts
3992
- var ResponseViewerComponent = class ResponseViewerComponent2 {
3993
- sending = false;
3994
- result = null;
3995
- resultSig = signal(null);
3996
- tabIndex = 0;
3997
- ngOnChanges(changes) {
3998
- if (changes["result"]) {
3999
- const r = changes["result"].currentValue;
4000
- this.resultSig.set(r);
4001
- }
4002
- }
4003
- error = computed(() => {
4004
- const res = this.resultSig();
4005
- if (!res)
4006
- return null;
4007
- return res.error ? res.error.message : null;
4008
- });
4009
- curl = computed(() => {
4010
- const res = this.resultSig();
4011
- if (!res)
4012
- return null;
4013
- return res.curl ? res.curl : null;
4014
- });
4015
- response = computed(() => {
4016
- const res = this.resultSig();
4017
- if (!res)
4018
- return null;
4019
- return res.response;
4020
- });
4021
- headerKeys = computed(() => {
4022
- const h = this.response()?.headers ?? {};
4023
- return Object.keys(h).sort((a, b) => a.localeCompare(b));
4024
- });
4025
- statusColor = computed(() => {
4026
- const s = this.response()?.status ?? 0;
4027
- if (!s)
4028
- return "default";
4029
- if (s >= 200 && s < 300)
4030
- return "green";
4031
- if (s >= 300 && s < 400)
4032
- return "blue";
4033
- if (s >= 400 && s < 500)
4034
- return "orange";
4035
- return "red";
4036
- });
4037
- isJson = computed(() => {
4038
- const res = this.response();
4039
- if (!res)
4040
- return false;
4041
- const ct = (res.headers?.["content-type"] ?? res.headers?.["Content-Type"] ?? "").toLowerCase();
4042
- if (ct.includes("application/json"))
4043
- return true;
4044
- const t = (res.bodyText ?? "").trim();
4045
- return t.startsWith("{") && t.endsWith("}") || t.startsWith("[") && t.endsWith("]");
4046
- });
4047
- prettyJson = computed(() => {
4048
- const t = (this.response()?.bodyText ?? "").trim();
4049
- try {
4050
- const obj = JSON.parse(t);
4051
- return JSON.stringify(obj, null, 2);
4052
- } catch {
4053
- return this.response()?.bodyText ?? "";
4054
- }
4055
- });
4056
- rawDump = computed(() => {
4057
- if (!this.response())
4058
- return "";
4059
- return JSON.stringify(this.response(), null, 2);
4060
- });
4061
- static propDecorators = {
4062
- sending: [{ type: Input }],
4063
- result: [{ type: Input }]
4064
- };
4065
- };
4066
- ResponseViewerComponent = __decorate([
4067
- Component({
4068
- selector: "app-response-viewer",
4069
- standalone: true,
4070
- imports: [CommonModule, NzTabsModule, NzTagModule, NzSpinModule, NzAlertModule, CurlActionsComponent],
4071
- template: `
4072
- <div class="wrap">
4073
- <div class="top">
4074
- <div class="left">
4075
- <div class="title">Response</div>
4076
-
4077
- @if (response()) {
4078
- <nz-tag [nzColor]="statusColor()">
4079
- {{ response()?.status }} {{ response()?.statusText || '' }}
4080
- </nz-tag>
4081
-
4082
- <span class="meta">{{ response()?.bodySize }} bytes</span>
4083
- } @else {
4084
- <span class="meta">-</span>
4085
- }
4086
- </div>
4087
-
4088
- <div class="right">
4089
- <app-curl-actions [curl]="curl()"></app-curl-actions>
4090
- </div>
4091
- </div>
4092
-
4093
- @if (sending) {
4094
- <div class="loading">
4095
- <nz-spin></nz-spin>
4096
- </div>
4097
- } @else if (error()) {
4098
- <nz-alert nzType="error" nzShowIcon [nzMessage]="error()"></nz-alert>
4099
- } @else if (!response()) {
4100
- <div class="empty">\u53D1\u9001\u8BF7\u6C42\u540E\u5728\u6B64\u67E5\u770B\u54CD\u5E94</div>
4101
- } @else {
4102
- <nz-tabs class="tabs" [(nzSelectedIndex)]="tabIndex">
4103
- <nz-tab nzTitle="Body">
4104
- <div class="pane">
4105
- @if (isJson()) {
4106
- <pre class="code">{{ prettyJson() }}</pre>
4107
- } @else {
4108
- <pre class="code">{{ response()?.bodyText }}</pre>
4109
- }
4110
- </div>
4111
- </nz-tab>
4112
-
4113
- <nz-tab nzTitle="Headers">
4114
- <div class="pane">
4115
- <div class="hlist">
4116
- @for (k of headerKeys(); track k) {
4117
- <div class="hrow">
4118
- <div class="hk">{{ k }}</div>
4119
- <div class="hv">{{ response()?.headers?.[k] }}</div>
4120
- </div>
4121
- }
4122
- </div>
4123
- </div>
4124
- </nz-tab>
4125
-
4126
- <nz-tab nzTitle="Raw">
4127
- <div class="pane">
4128
- <pre class="code">{{ rawDump() }}</pre>
4129
- </div>
4130
- </nz-tab>
4131
- </nz-tabs>
4132
- }
4133
- </div>
4134
- `,
4135
- styles: [response_viewer_component_default]
4136
- })
4137
- ], ResponseViewerComponent);
4138
-
4139
- // angular:jit:template:src\app\pages\api-client\components\request-tabs-bar\request-tabs-bar.component.html
4140
- var request_tabs_bar_component_default = `<div class="tabs-container" cdkDropList (cdkDropListDropped)="onDrop($event)">\r
4141
- @for (tab of tabs(); track tab.id; let i = $index) {\r
4142
- <div\r
4143
- class="tab-item"\r
4144
- [class.active]="tab.id === activeTabId()"\r
4145
- [class.dirty]="tab.isDirty"\r
4146
- [cdkDragData]="tab"\r
4147
- cdkDrag\r
4148
- (click)="onTabClick(tab.id)"\r
4149
- (contextmenu)="onContextMenu($event, tab, i)"\r
4150
- >\r
4151
- <!-- \u62D6\u62FD\u624B\u67C4 -->\r
4152
- <span class="drag-handle" cdkDragHandle>\r
4153
- <nz-icon nzType="holder" nzTheme="outline" />\r
4154
- </span>\r
4155
- \r
4156
- <!-- Tab \u5185\u5BB9 -->\r
4157
- @if (editingTabId() === tab.id) {\r
4158
- <input\r
4159
- #editInput\r
4160
- class="title-input"\r
4161
- [ngModel]="editingTitle()"\r
4162
- (ngModelChange)="editingTitle.set($event)"\r
4163
- (blur)="finishEdit()"\r
4164
- (keydown.enter)="finishEdit()"\r
4165
- (keydown.escape)="cancelEdit()"\r
4166
- />\r
4167
- } @else {\r
4168
- <span class="method" [class]="getMethodClass(tab.request.method)">\r
4169
- {{ tab.request.method }}\r
4170
- </span>\r
4171
- <span\r
4172
- class="title"\r
4173
- (dblclick)="startEdit(tab)"\r
4174
- nz-tooltip\r
4175
- [nzTooltipTitle]="getFullTitle(tab)"\r
4176
- >\r
4177
- {{ getDisplayTitle(tab) }}\r
4178
- </span>\r
4179
- @if (tab.isDirty) {\r
4180
- <span class="dirty-dot" title="\u672A\u4FDD\u5B58">\u25CF</span>\r
4181
- }\r
4182
- }\r
4183
- \r
4184
- <!-- \u5173\u95ED\u6309\u94AE -->\r
4185
- <button\r
4186
- class="close-btn"\r
4187
- nz-button\r
4188
- nzType="text"\r
4189
- nzSize="small"\r
4190
- (click)="onCloseClick(tab.id, $event)"\r
4191
- >\r
4192
- <nz-icon nzType="close" nzTheme="outline" />\r
4193
- </button>\r
4194
- </div>\r
4195
- }\r
4196
- \r
4197
- <!-- \u65B0\u5EFA\u6309\u94AE -->\r
4198
- @if (canOpenMore) {\r
4199
- <button\r
4200
- class="add-btn"\r
4201
- nz-button\r
4202
- nzType="text"\r
4203
- (click)="onAddClick()"\r
4204
- nz-tooltip\r
4205
- nzTooltipTitle="\u65B0\u5EFA\u8BF7\u6C42 (Ctrl+T)"\r
4206
- >\r
4207
- <nz-icon nzType="plus" nzTheme="outline" />\r
4208
- </button>\r
4209
- }\r
4210
- </div>\r
4211
- \r
4212
- <!-- \u53F3\u952E\u83DC\u5355 -->\r
4213
- <nz-dropdown-menu #contextMenu="nzDropdownMenu" nzOverlayClassName="tab-context-menu">\r
4214
- <ul nz-menu class="context-menu">\r
4215
- <!-- \u5173\u95ED\u64CD\u4F5C -->\r
4216
- <li nz-menu-item (click)="onMenuAction('close')">\r
4217
- <nz-icon nzType="close" />\r
4218
- <span>\u5173\u95ED</span>\r
4219
- <!-- <span class="shortcut">Ctrl+W</span> -->\r
4220
- </li>\r
4221
- <li nz-menu-item (click)="onMenuAction('closeOthers')" [nzDisabled]="tabs().length <= 1">\r
4222
- <nz-icon nzType="close-circle" />\r
4223
- <span>\u5173\u95ED\u5176\u4ED6</span>\r
4224
- </li>\r
4225
- <li nz-menu-item (click)="onMenuAction('closeRight')" [nzDisabled]="!hasRightTabs()">\r
4226
- <nz-icon nzType="right-circle" />\r
4227
- <span>\u5173\u95ED\u53F3\u4FA7</span>\r
4228
- </li>\r
4229
- <li nz-menu-item (click)="onMenuAction('closeSaved')" [nzDisabled]="!hasSavedTabs()">\r
4230
- <nz-icon nzType="check-circle" />\r
4231
- <span>\u5173\u95ED\u5DF2\u4FDD\u5B58</span>\r
4232
- </li>\r
4233
- <li nz-menu-item (click)="onMenuAction('closeAll')" [nzDisabled]="tabs().length <= 1">\r
4234
- <nz-icon nzType="delete" />\r
4235
- <span>\u5173\u95ED\u6240\u6709</span>\r
4236
- </li>\r
4237
- \r
4238
- <li nz-menu-divider></li>\r
4239
- \r
4240
- <!-- \u7F16\u8F91\u64CD\u4F5C -->\r
4241
- <li nz-menu-item (click)="onMenuAction('rename')">\r
4242
- <nz-icon nzType="edit" />\r
4243
- <span>\u91CD\u547D\u540D</span>\r
4244
- <!-- <span class="shortcut">F2</span> -->\r
4245
- </li>\r
4246
- <li nz-menu-item (click)="onMenuAction('duplicate')">\r
4247
- <nz-icon nzType="copy" />\r
4248
- <span>\u590D\u5236\u8BF7\u6C42</span>\r
4249
- </li>\r
4250
- \r
4251
- <li nz-menu-divider></li>\r
4252
- \r
4253
- <!-- \u5176\u4ED6\u64CD\u4F5C -->\r
4254
- @if (contextTab()?.request?.url) {\r
4255
- <li nz-menu-item (click)="onMenuAction('copyUrl')">\r
4256
- <nz-icon nzType="link" />\r
4257
- <span>\u590D\u5236 URL</span>\r
4258
- </li>\r
4259
- }\r
4260
- @if (contextTab()?.requestId) {\r
4261
- <li nz-menu-item (click)="onMenuAction('moveTo')">\r
4262
- <nz-icon nzType="folder" />\r
4263
- <span>\u79FB\u52A8\u5230</span>\r
4264
- </li>\r
4265
- }\r
4266
- </ul>\r
4267
- </nz-dropdown-menu>\r
4268
- `;
4269
-
4270
- // angular:jit:style:src\app\pages\api-client\components\request-tabs-bar\request-tabs-bar.component.less
4271
- var request_tabs_bar_component_default2 = "/* src/app/pages/api-client/components/request-tabs-bar/request-tabs-bar.component.less */\n:host {\n display: block;\n width: 100%;\n}\n.tabs-container {\n display: flex;\n align-items: center;\n gap: 2px;\n padding: 4px 8px;\n background: #fafafa;\n border-bottom: 1px solid #f0f0f0;\n overflow-x: auto;\n flex-wrap: nowrap;\n}\n.tabs-container::-webkit-scrollbar {\n height: 4px;\n}\n.tabs-container::-webkit-scrollbar-thumb {\n background: #d9d9d9;\n border-radius: 2px;\n}\n.tab-item {\n display: flex;\n align-items: center;\n gap: 6px;\n padding: 4px 8px;\n min-width: 100px;\n max-width: 200px;\n height: 28px;\n border-radius: 4px 4px 0 0;\n background: #fff;\n border: 1px solid transparent;\n border-bottom: none;\n cursor: pointer;\n -webkit-user-select: none;\n user-select: none;\n transition: all 0.15s;\n}\n.tab-item:hover {\n background: #f5f5f5;\n}\n.tab-item.active {\n background: #fff;\n border-color: #1890ff;\n border-bottom: 1px solid #fff;\n margin-bottom: -1px;\n z-index: 1;\n}\n.tab-item.dirty .title {\n color: #1890ff;\n}\n.drag-handle {\n display: flex;\n align-items: center;\n opacity: 0.3;\n cursor: grab;\n font-size: 10px;\n}\n.drag-handle:hover {\n opacity: 0.6;\n}\n.method {\n font-size: 10px;\n font-weight: 600;\n text-transform: uppercase;\n flex-shrink: 0;\n}\n.method.get {\n color: #61affe;\n}\n.method.post {\n color: #49cc90;\n}\n.method.put {\n color: #fca130;\n}\n.method.patch {\n color: #50e3c2;\n}\n.method.delete {\n color: #f93e3e;\n}\n.method.head,\n.method.options {\n color: #909090;\n}\n.title {\n flex: 1;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-size: 13px;\n color: #333;\n}\n.dirty-dot {\n color: #1890ff;\n font-size: 8px;\n flex-shrink: 0;\n}\n.title-input {\n flex: 1;\n border: none;\n background: transparent;\n outline: none;\n font-size: 12px;\n min-width: 60px;\n padding: 0 2px;\n}\n.close-btn {\n padding: 0 2px !important;\n height: 16px !important;\n width: 16px !important;\n font-size: 10px;\n opacity: 0.3;\n flex-shrink: 0;\n}\n.close-btn:hover {\n opacity: 1;\n}\n.add-btn {\n padding: 0 8px !important;\n height: 28px !important;\n opacity: 0.6;\n}\n.add-btn:hover {\n opacity: 1;\n}\n:host ::ng-deep .tab-context-menu .shortcut {\n margin-left: auto;\n opacity: 0.5;\n font-size: 12px;\n font-family: monospace;\n}\n.context-menu ::ng-deep .ant-menu-title-content {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n/*# sourceMappingURL=request-tabs-bar.component.css.map */\n";
4272
-
4273
- // src/app/pages/api-client/components/request-tabs-bar/request-tabs-bar.component.ts
4274
- var RequestTabsBarComponent = class RequestTabsBarComponent2 {
4275
- contextMenuService = inject(NzContextMenuService);
4276
- tabs = signal([]);
4277
- activeTabId = signal(null);
4278
- canOpenMore = true;
4279
- tabChange = new EventEmitter();
4280
- tabClose = new EventEmitter();
4281
- tabAdd = new EventEmitter();
4282
- tabRename = new EventEmitter();
4283
- tabReorder = new EventEmitter();
4284
- tabContextMenu = new EventEmitter();
4285
- startRenameEdit = new EventEmitter();
4286
- editInput;
4287
- contextMenu;
4288
- editingTabId = signal(null);
4289
- editingTitle = signal("");
4290
- // 右键菜单状态
4291
- contextTab = signal(null);
4292
- contextIndex = signal(-1);
4293
- activeIndex = computed(() => {
4294
- const id = this.activeTabId();
4295
- const tabs = this.tabs();
4296
- return id ? tabs.findIndex((t) => t.id === id) : -1;
4297
- });
4298
- /** 是否有右侧 Tab */
4299
- hasRightTabs() {
4300
- const idx = this.contextIndex();
4301
- return idx >= 0 && idx < this.tabs().length - 1;
4302
- }
4303
- /** 是否有已保存的 Tab */
4304
- hasSavedTabs() {
4305
- return this.tabs().some((t) => !t.isDirty && t.requestId);
4306
- }
4307
- onKeyDown(event) {
4308
- if (event.ctrlKey && event.key === "t") {
4309
- event.preventDefault();
4310
- this.onAddClick();
4311
- return;
4312
- }
4313
- if (event.ctrlKey && event.key === "w") {
4314
- event.preventDefault();
4315
- const activeId = this.activeTabId();
4316
- if (activeId) {
4317
- this.tabClose.emit(activeId);
4318
- }
4319
- return;
4320
- }
4321
- if (event.key === "F2") {
4322
- event.preventDefault();
4323
- const activeId = this.activeTabId();
4324
- if (activeId) {
4325
- const tab = this.tabs().find((t) => t.id === activeId);
4326
- if (tab) {
4327
- this.startEdit(tab);
4328
- }
4329
- }
4330
- return;
4331
- }
4332
- }
4333
- getMethodClass(method) {
4334
- return method.toLowerCase();
4335
- }
4336
- getDisplayTitle(tab) {
4337
- if (tab.title && tab.title !== "New Request") {
4338
- return this.truncate(tab.title, 20);
4339
- }
4340
- const request = tab.request;
4341
- if (!request.url)
4342
- return "New Request";
4343
- const path = this.extractPath(request.url);
4344
- return this.truncate(path, 20);
4345
- }
4346
- getFullTitle(tab) {
4347
- if (tab.title && tab.title !== "New Request") {
4348
- return tab.title;
4349
- }
4350
- const request = tab.request;
4351
- if (!request.url)
4352
- return "New Request";
4353
- return `${request.method} ${request.url}`;
4354
- }
4355
- extractPath(url) {
4356
- const cleaned = url.replace(/^\{\{[^}]+\}\}/, "").replace(/^https?:\/\/[^/]+/, "");
4357
- return cleaned.split("?")[0] || "/";
4358
- }
4359
- truncate(str, maxLen) {
4360
- if (str.length <= maxLen)
4361
- return str;
4362
- return str.slice(0, maxLen - 2) + "\u2026";
4363
- }
4364
- onTabClick(tabId) {
4365
- if (tabId !== this.activeTabId()) {
4366
- this.tabChange.emit(tabId);
4367
- }
4368
- }
4369
- onCloseClick(tabId, event) {
4370
- event.stopPropagation();
4371
- this.tabClose.emit(tabId);
4372
- }
4373
- onAddClick() {
4374
- this.tabAdd.emit();
4375
- }
4376
- /** 右键菜单 */
4377
- onContextMenu(event, tab, index) {
4378
- event.preventDefault();
4379
- this.contextTab.set(tab);
4380
- this.contextIndex.set(index);
4381
- this.contextMenuService.create(event, this.contextMenu);
4382
- }
4383
- /** 右键菜单操作 */
4384
- onMenuAction(action) {
4385
- const tab = this.contextTab();
4386
- if (!tab)
4387
- return;
4388
- if (action === "rename") {
4389
- this.switchToTab(tab.id);
4390
- this.startEdit(tab);
4391
- this.clearContext();
4392
- return;
4393
- }
4394
- this.tabContextMenu.emit({
4395
- tabId: tab.id,
4396
- action
4397
- });
4398
- this.clearContext();
4399
- }
4400
- /** 切换到指定 Tab */
4401
- switchToTab(tabId) {
4402
- if (tabId !== this.activeTabId()) {
4403
- this.tabChange.emit(tabId);
4404
- }
4405
- }
4406
- /** 开始编辑 */
4407
- startEdit(tab) {
4408
- this.editingTabId.set(tab.id);
4409
- this.editingTitle.set(tab.title || tab.request.name || "New Request");
4410
- setTimeout(() => {
4411
- this.editInput?.nativeElement?.focus();
4412
- this.editInput?.nativeElement?.select();
4413
- }, 0);
4414
- }
4415
- finishEdit() {
4416
- const id = this.editingTabId();
4417
- const title = this.editingTitle().trim();
4418
- if (id && title) {
4419
- this.tabRename.emit({ id, title });
4420
- }
4421
- this.cancelEdit();
4422
- }
4423
- cancelEdit() {
4424
- this.editingTabId.set(null);
4425
- this.editingTitle.set("");
4426
- }
4427
- onDrop(event) {
4428
- if (event.previousIndex !== event.currentIndex) {
4429
- this.tabReorder.emit({
4430
- from: event.previousIndex,
4431
- to: event.currentIndex
4432
- });
4433
- }
4434
- }
4435
- /** 清除右键菜单状态 */
4436
- clearContext() {
4437
- this.contextTab.set(null);
4438
- this.contextIndex.set(-1);
4439
- }
4440
- static propDecorators = {
4441
- tabs: [{ type: Input }],
4442
- activeTabId: [{ type: Input }],
4443
- canOpenMore: [{ type: Input }],
4444
- tabChange: [{ type: Output }],
4445
- tabClose: [{ type: Output }],
4446
- tabAdd: [{ type: Output }],
4447
- tabRename: [{ type: Output }],
4448
- tabReorder: [{ type: Output }],
4449
- tabContextMenu: [{ type: Output }],
4450
- startRenameEdit: [{ type: Output }],
4451
- editInput: [{ type: ViewChild, args: ["editInput"] }],
4452
- contextMenu: [{ type: ViewChild, args: ["contextMenu"] }],
4453
- onKeyDown: [{ type: HostListener, args: ["window:keydown", ["$event"]] }]
4454
- };
4455
- };
4456
- RequestTabsBarComponent = __decorate([
4457
- Component({
4458
- selector: "app-request-tabs-bar",
4459
- standalone: true,
4460
- imports: [
4461
- CommonModule,
4462
- FormsModule,
4463
- DragDropModule,
4464
- NzTabsModule,
4465
- NzButtonModule,
4466
- NzIconModule,
4467
- NzTooltipModule,
4468
- NzDropDownModule,
4469
- NzMenuModule
4470
- ],
4471
- template: request_tabs_bar_component_default,
4472
- styles: [request_tabs_bar_component_default2]
4473
- })
4474
- ], RequestTabsBarComponent);
4475
-
4476
- // src/app/pages/api-client/api-client.component.ts
4477
- var ApiClientComponent = class ApiClientComponent2 {
4478
- store = inject(ApiClientStateService);
4479
- modal = inject(NzModalService);
4480
- envPicker;
4481
- openEnv = () => {
4482
- this.envPicker.openEnvModal();
4483
- };
4484
- /**
4485
- * 处理 Tab 关闭
4486
- */
4487
- handleTabClose(tabId) {
4488
- const tab = this.store.tabs().find((t) => t.id === tabId);
4489
- if (tab?.isDirty) {
4490
- this.modal.confirm({
4491
- nzTitle: "\u5173\u95ED\u786E\u8BA4",
4492
- nzContent: "\u5F53\u524D\u8BF7\u6C42\u6709\u672A\u4FDD\u5B58\u7684\u4FEE\u6539\uFF0C\u786E\u5B9A\u8981\u5173\u95ED\u5417\uFF1F",
4493
- nzOkText: "\u5173\u95ED",
4494
- nzCancelText: "\u53D6\u6D88",
4495
- nzOnOk: () => {
4496
- this.store.closeTab(tabId);
4497
- }
4498
- });
4499
- } else {
4500
- this.store.closeTab(tabId);
4501
- }
4502
- }
4503
- /**
4504
- * 处理右键菜单操作
4505
- */
4506
- handleTabContextMenu(event) {
4507
- const { tabId, action } = event;
4508
- switch (action) {
4509
- case "close":
4510
- this.handleTabClose(tabId);
4511
- break;
4512
- case "closeOthers": {
4513
- const dirtyTabs = this.store.tabs().filter((t) => t.id !== tabId && t.isDirty);
4514
- if (dirtyTabs.length > 0) {
4515
- this.modal.confirm({
4516
- nzTitle: "\u5173\u95ED\u5176\u4ED6\u6807\u7B7E\u9875",
4517
- nzContent: `\u6709 ${dirtyTabs.length} \u4E2A\u6807\u7B7E\u9875\u6709\u672A\u4FDD\u5B58\u7684\u4FEE\u6539\uFF0C\u786E\u5B9A\u8981\u5168\u90E8\u5173\u95ED\u5417\uFF1F`,
4518
- nzOkText: "\u5168\u90E8\u5173\u95ED",
4519
- nzCancelText: "\u53D6\u6D88",
4520
- nzOnOk: () => {
4521
- this.store.tabStore.closeOtherTabs(tabId);
4522
- }
4523
- });
4524
- } else {
4525
- this.store.tabStore.closeOtherTabs(tabId);
4526
- }
4527
- break;
4528
- }
4529
- case "closeRight": {
4530
- const idx = this.store.tabs().findIndex((t) => t.id === tabId);
4531
- const rightTabs = this.store.tabs().slice(idx + 1);
4532
- const dirtyTabs = rightTabs.filter((t) => t.isDirty);
4533
- if (dirtyTabs.length > 0) {
4534
- this.modal.confirm({
4535
- nzTitle: "\u5173\u95ED\u53F3\u4FA7\u6807\u7B7E\u9875",
4536
- nzContent: `\u53F3\u4FA7\u6709 ${dirtyTabs.length} \u4E2A\u6807\u7B7E\u9875\u6709\u672A\u4FDD\u5B58\u7684\u4FEE\u6539\uFF0C\u786E\u5B9A\u8981\u5168\u90E8\u5173\u95ED\u5417\uFF1F`,
4537
- nzOkText: "\u5168\u90E8\u5173\u95ED",
4538
- nzCancelText: "\u53D6\u6D88",
4539
- nzOnOk: () => {
4540
- this.store.tabStore.closeRightTabs(tabId);
4541
- }
4542
- });
4543
- } else {
4544
- this.store.tabStore.closeRightTabs(tabId);
4545
- }
4546
- break;
4547
- }
4548
- case "closeSaved": {
4549
- const savedTabs = this.store.tabs().filter((t) => !t.isDirty && t.requestId);
4550
- if (savedTabs.length > 0) {
4551
- this.modal.confirm({
4552
- nzTitle: "\u5173\u95ED\u5DF2\u4FDD\u5B58\u7684\u6807\u7B7E\u9875",
4553
- nzContent: `\u786E\u5B9A\u8981\u5173\u95ED ${savedTabs.length} \u4E2A\u5DF2\u4FDD\u5B58\u7684\u6807\u7B7E\u9875\u5417\uFF1F`,
4554
- nzOkText: "\u5173\u95ED",
4555
- nzCancelText: "\u53D6\u6D88",
4556
- nzOnOk: () => {
4557
- this.store.tabStore.closeSavedTabs();
4558
- }
4559
- });
4560
- }
4561
- break;
4562
- }
4563
- case "duplicate":
4564
- try {
4565
- this.store.tabStore.duplicateTab(tabId);
4566
- } catch (e) {
4567
- console.error(e);
4568
- }
4569
- break;
4570
- case "copyUrl": {
4571
- const url = this.store.tabStore.getTabUrl(tabId);
4572
- if (url) {
4573
- navigator.clipboard.writeText(url);
4574
- }
4575
- break;
4576
- }
4577
- case "moveTo": {
4578
- const tab = this.store.tabStore.getTab(tabId);
4579
- if (tab?.requestId) {
4580
- this.store.moveCollection(tab.requestId, "request");
4581
- }
4582
- break;
4583
- }
4584
- }
4585
- }
4586
- static propDecorators = {
4587
- envPicker: [{ type: ViewChild, args: ["envPicker"] }]
4588
- };
4589
- };
4590
- ApiClientComponent = __decorate([
4591
- Component({
4592
- selector: "app-api-client.component",
4593
- imports: [
4594
- CommonModule,
4595
- PageLayoutComponent,
4596
- NzButtonModule,
4597
- NzIconModule,
4598
- NzLayoutModule,
4599
- NzTooltipModule,
4600
- NzModalModule,
4601
- RequestCollectionsComponent,
4602
- RequestEditorComponent,
4603
- ResponseViewerComponent,
4604
- RequestTabsBarComponent,
4605
- ApiHistoryDrawerComponent,
4606
- EnvPickerComponent,
4607
- NzEmptyModule
4608
- ],
4609
- template: `
4610
- <app-page-layout [title]="'API \u8BF7\u6C42'" [loading]="store.loading()" [isFullscreen]="true" [isOverflowYAuto]="false">
4611
- <ng-container ngProjectAs="actions">
4612
- <app-env-picker/>
4613
- <!-- <button nz-button nzType="default" (click)="store.sendHubV2Issues()" nz-tooltip nzTooltipTitle="\u8BFB\u53D6\u5F53\u524D\u9879\u76EE Hub V2 Issues">
4614
- Hub Issues
4615
- </button> -->
4616
- <button nz-button nzType="text" (click)="store.openHistory()" nz-tooltip nzTooltipTitle="\u5386\u53F2\u8BB0\u5F55">
4617
- <nz-icon nzType="history" nzTheme="outline" />
4618
- </button>
4619
- </ng-container>
4620
- <nz-layout class="page">
4621
- <app-request-collections
4622
- [nodes]="store.filteredNodes()"
4623
- [(q)]="store.q"
4624
- [activeId]="store.activeRequestId()"
4625
- (select)="store.selectRequest($event)"
4626
- (createRequest)="store.newRequest({collectionId: $event.collectionId})"
4627
- (createCollection)="store.newCollection({kind:'collection'})"
4628
- (createFolder)="store.newCollection({kind:'folder', parentId: $event.collectionId})"
4629
- (reload)="store.loadAll()"
4630
- (delete)="store.deleteCollection($event.id, $event.kind)"
4631
- (rename)="store.renameCollection($event.id, $event.kind)"
4632
- (move)="store.moveCollection($event.id, $event.kind)"
4633
- [loading]="store.loading()"
4634
- />
4635
- <div class="content">
4636
- <!-- Tabs \u6807\u7B7E\u680F -->
4637
- <app-request-tabs-bar
4638
- [tabs]="store.tabs"
4639
- [activeTabId]="store.activeTabId"
4640
- [canOpenMore]="store.canOpenMore()"
4641
- (tabChange)="store.switchTab($event)"
4642
- (tabClose)="handleTabClose($event)"
4643
- (tabAdd)="store.newTab()"
4644
- (tabRename)="store.renameTab($event.id, $event.title)"
4645
- (tabReorder)="store.reorderTabs($event.from, $event.to)"
4646
- (tabContextMenu)="handleTabContextMenu($event)"
4647
- />
4648
-
4649
- @if(store.activeRequest()){
4650
- <div class="editor-area">
4651
- <app-request-editor
4652
- [collectionPath]="store.collectionPath()"
4653
- [baseUrl]="store.activeEnv()?.baseUrl ?? null"
4654
- [request]="store.activeRequest()"
4655
- [sending]="store.sending()"
4656
- [envVars]="store.envVarRecord()"
4657
- [openEnv]="openEnv"
4658
- (patch)="store.patchActive($event)"
4659
- (save)="store.saveActive()"
4660
- (send)="store.sendActive()"
4661
- />
4662
- <app-response-viewer
4663
- [sending]="store.sending()"
4664
- [result]="store.lastResult()"
4665
- />
4666
- </div>
4667
- }@else{
4668
- <nz-empty
4669
- [nzNotFoundContent]="contentTpl"
4670
- [nzNotFoundFooter]="footerTpl">
4671
- </nz-empty>
4672
- }
4673
- <ng-template #contentTpl>
4674
- <span>\u6682\u65E0\u8BF7\u6C42\uFF0C\u70B9\u51FB\u5DE6\u4FA7\u9762\u677F\u53F3\u4E0A\u89D2"+" \u521B\u5EFA\u8BF7\u6C42</span>
4675
- </ng-template>
4676
- <ng-template #footerTpl>
4677
- <button nz-button nzType="primary" (click)="store.newTab()">\u7ACB\u5373\u65B0\u589E</button>
4678
- </ng-template>
4679
- </div>
4680
- </nz-layout>
4681
- </app-page-layout>
4682
- @if (store.historyOpen()) {
4683
- <app-api-history-drawer
4684
- [loading]="store.historyLoading()"
4685
- [histories]="store.histories()"
4686
- (close)="store.closeHistory()"
4687
- (replay)="store.replayHistory($event)"
4688
- />
4689
- }
4690
- `,
4691
- styles: [api_client_component_default]
4692
- })
4693
- ], ApiClientComponent);
4694
-
4695
- // src/app/pages/api-client/api-client-routing.module.ts
4696
- var routes = [
4697
- { path: "", component: ApiClientComponent }
4698
- ];
4699
- var ApiClientRoutingModule = class ApiClientRoutingModule2 {
4700
- };
4701
- ApiClientRoutingModule = __decorate([
4702
- NgModule({
4703
- imports: [RouterModule.forChild(routes)],
4704
- exports: [RouterModule]
4705
- })
4706
- ], ApiClientRoutingModule);
4707
-
4708
- // src/app/pages/api-client/api-client.module.ts
4709
- var ApiClientModule = class ApiClientModule2 {
4710
- };
4711
- ApiClientModule = __decorate([
4712
- NgModule({
4713
- declarations: [],
4714
- imports: [
4715
- CommonModule,
4716
- ApiClientRoutingModule
4717
- ]
4718
- })
4719
- ], ApiClientModule);
4720
- export {
4721
- ApiClientModule
4722
- };
4723
- //# sourceMappingURL=chunk-XF5H7E4L.js.map