dirigent-server 0.17.2__tar.gz → 0.18.0__tar.gz
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.
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/PKG-INFO +5 -5
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/pyproject.toml +5 -5
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/pyproject.toml.orig +5 -5
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/routes/runs.py +2 -2
- dirigent_server-0.17.2/src/dirigent_server/static/assets/Alerting-BDQj-wWG.js → dirigent_server-0.18.0/src/dirigent_server/static/assets/Alerting-BVadHTDd.js +1 -1
- dirigent_server-0.17.2/src/dirigent_server/static/assets/Blocks-C81sBLSy.js → dirigent_server-0.18.0/src/dirigent_server/static/assets/Blocks-CcA-SwCs.js +1 -1
- dirigent_server-0.17.2/src/dirigent_server/static/assets/Connections-BQnSPRNV.js → dirigent_server-0.18.0/src/dirigent_server/static/assets/Connections-DL-8wF-b.js +1 -1
- dirigent_server-0.18.0/src/dirigent_server/static/assets/Dashboard-B66W8OTk.js +1 -0
- dirigent_server-0.18.0/src/dirigent_server/static/assets/ExamplePanel-D3yktwnO.js +1 -0
- dirigent_server-0.17.2/src/dirigent_server/static/assets/Examples-DhaoUWWI.js → dirigent_server-0.18.0/src/dirigent_server/static/assets/Examples-ag6cQ9RR.js +2 -2
- dirigent_server-0.17.2/src/dirigent_server/static/assets/JsonBlock-B6EXc4Jh.js → dirigent_server-0.18.0/src/dirigent_server/static/assets/JsonBlock-DxbyAXYR.js +1 -1
- dirigent_server-0.18.0/src/dirigent_server/static/assets/ListTable-BykeouTl.js +1 -0
- dirigent_server-0.17.2/src/dirigent_server/static/assets/Overview-CLoGCCLA.js → dirigent_server-0.18.0/src/dirigent_server/static/assets/Overview-B80kW7iv.js +1 -1
- dirigent_server-0.17.2/src/dirigent_server/static/assets/Picker-Cn4WWjGu.js → dirigent_server-0.18.0/src/dirigent_server/static/assets/Picker-CY13BPS4.js +1 -1
- dirigent_server-0.18.0/src/dirigent_server/static/assets/PipelineEditor-CipvUPp0.js +2 -0
- dirigent_server-0.18.0/src/dirigent_server/static/assets/PipelineGraph-Dz_0z78o.js +1 -0
- dirigent_server-0.17.2/src/dirigent_server/static/assets/PipelinePreview-aGl-aiEy.js → dirigent_server-0.18.0/src/dirigent_server/static/assets/PipelinePreview-DNLVNGi8.js +1 -1
- dirigent_server-0.17.2/src/dirigent_server/static/assets/PipelineTab-CToQhytj.js → dirigent_server-0.18.0/src/dirigent_server/static/assets/PipelineTab-BepoiZgc.js +2 -2
- dirigent_server-0.17.2/src/dirigent_server/static/assets/Refusal-7YedH2sJ.js → dirigent_server-0.18.0/src/dirigent_server/static/assets/Refusal-DFh6LEQQ.js +1 -1
- dirigent_server-0.17.2/src/dirigent_server/static/assets/RunDetail-vu4Db77w.js → dirigent_server-0.18.0/src/dirigent_server/static/assets/RunDetail-3uWgAAeF.js +3 -3
- dirigent_server-0.17.2/src/dirigent_server/static/assets/RunGraph-DZkfC7FS.js → dirigent_server-0.18.0/src/dirigent_server/static/assets/RunGraph-BSylHYqX.js +1 -1
- dirigent_server-0.17.2/src/dirigent_server/static/assets/SchemaForm-BojGlBVc.js → dirigent_server-0.18.0/src/dirigent_server/static/assets/SchemaForm-D3RjadEM.js +1 -1
- dirigent_server-0.17.2/src/dirigent_server/static/assets/Schemas-DhAypIFr.js → dirigent_server-0.18.0/src/dirigent_server/static/assets/Schemas-BDfRA4q1.js +1 -1
- dirigent_server-0.18.0/src/dirigent_server/static/assets/Segmented-u0lpCZgQ.js +1 -0
- dirigent_server-0.18.0/src/dirigent_server/static/assets/SettingsDialog-DhpjiaMQ.js +1 -0
- dirigent_server-0.17.2/src/dirigent_server/static/assets/StarterPicker-ChbAerdH.js → dirigent_server-0.18.0/src/dirigent_server/static/assets/StarterPicker-CkSY39C5.js +1 -1
- dirigent_server-0.17.2/src/dirigent_server/static/assets/TileCard-Be4l_R_7.js → dirigent_server-0.18.0/src/dirigent_server/static/assets/TileCard-gP1CtcIG.js +1 -1
- dirigent_server-0.17.2/src/dirigent_server/static/assets/Triggers-DdqGUyEx.js → dirigent_server-0.18.0/src/dirigent_server/static/assets/Triggers-Can3egyv.js +1 -1
- dirigent_server-0.17.2/src/dirigent_server/static/assets/Users-DS27s7xh.js → dirigent_server-0.18.0/src/dirigent_server/static/assets/Users-D2en-Umj.js +1 -1
- dirigent_server-0.17.2/src/dirigent_server/static/assets/WindowedPane-B_L6IZvq.js → dirigent_server-0.18.0/src/dirigent_server/static/assets/WindowedPane-DJe_7m8A.js +1 -1
- dirigent_server-0.17.2/src/dirigent_server/static/assets/Workers-CSbjQhTq.js → dirigent_server-0.18.0/src/dirigent_server/static/assets/Workers-BL1rSMN9.js +1 -1
- dirigent_server-0.17.2/src/dirigent_server/static/assets/WorkersTable-CBdORnjb.js → dirigent_server-0.18.0/src/dirigent_server/static/assets/WorkersTable-CSwkoqDd.js +1 -1
- dirigent_server-0.18.0/src/dirigent_server/static/assets/examples-vNFNdfIm.js +1 -0
- dirigent_server-0.18.0/src/dirigent_server/static/assets/index-Cf-yM9K1.css +2 -0
- dirigent_server-0.17.2/src/dirigent_server/static/assets/index-AVwkiv9z.js → dirigent_server-0.18.0/src/dirigent_server/static/assets/index-DBX30PmL.js +4 -4
- dirigent_server-0.17.2/src/dirigent_server/static/assets/select-BZLRZoLW.js → dirigent_server-0.18.0/src/dirigent_server/static/assets/select-CH0-4odb.js +1 -1
- dirigent_server-0.18.0/src/dirigent_server/static/assets/starters-CgC7I45V.js +15 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/index.html +3 -3
- dirigent_server-0.17.2/src/dirigent_server/static/assets/Dashboard--ZePo4SA.js +0 -1
- dirigent_server-0.17.2/src/dirigent_server/static/assets/ExamplePanel-BAKDvPSI.js +0 -1
- dirigent_server-0.17.2/src/dirigent_server/static/assets/ListTable-CKU-ULuI.js +0 -1
- dirigent_server-0.17.2/src/dirigent_server/static/assets/PipelineEditor-CRepUJaS.js +0 -2
- dirigent_server-0.17.2/src/dirigent_server/static/assets/PipelineGraph-f0hlgUJa.js +0 -1
- dirigent_server-0.17.2/src/dirigent_server/static/assets/Segmented-VHBNaGnm.js +0 -1
- dirigent_server-0.17.2/src/dirigent_server/static/assets/SettingsDialog-D0vUJwgm.js +0 -1
- dirigent_server-0.17.2/src/dirigent_server/static/assets/examples-a8AmyCVF.js +0 -1
- dirigent_server-0.17.2/src/dirigent_server/static/assets/index-BmsA0Zt5.css +0 -2
- dirigent_server-0.17.2/src/dirigent_server/static/assets/starters-CvbebKUN.js +0 -5
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/LICENSE +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/README.md +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/THIRD_PARTY_NOTICES.md +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/__init__.py +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/app.py +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/dependencies.py +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/errors.py +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/health.py +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/logging.py +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/messages.py +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/pagination.py +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/py.typed +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/routes/__init__.py +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/routes/alerts.py +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/routes/auth.py +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/routes/blocks.py +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/routes/connections.py +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/routes/examples.py +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/routes/hooks.py +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/routes/pipelines.py +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/routes/schema.py +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/routes/schemas.py +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/routes/system.py +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/routes/trigger_documents.py +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/routes/triggers.py +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/routes/users.py +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/routes/workers.py +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/security.py +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/.gitkeep +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/AdminOnly-922QAPCr.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/Breadcrumb-x6p00HyX.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/CodeEditor-0KFNLzta.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/CodeEditor-C4OnjBMt.css +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/Description-MmXUnb-9.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/Instant-mr1E5jAK.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/KindChip-CwU_Xxdy.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/Markdown-roa7jpVu.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/PageState-CGVhOaOE.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/Panel-CqrOYByl.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/ProgramReference-DF37mMAT.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/StepPorts-KFpmX5hF.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/api-Bm1JZLuC.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/auth-CHgfcdt9.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/badge-BovCxjd1.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/blocks-CclbVd8c.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/chevron-down-DAO3SUWv.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/chunk-OB3PAWPO-DOp4K52_.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/codicon-DCmgc-ay.ttf +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/connections-BuMoMUFi.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/copy-BeBwg8IR.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/dist-DD8kpv1W.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/docs-CCoB3shg.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/dropdown-menu-B-6CcHKw.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/editor.worker-CIvRzd4O.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/file-braces-Ep8AP5Yq.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/format-B5YbYOY-.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/ibm-plex-mono-cyrillic-400-normal-BSMlKf0J.woff2 +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/ibm-plex-mono-cyrillic-400-normal-CEL4l2ZJ.woff +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/ibm-plex-mono-cyrillic-500-normal-Ael50iVv.woff +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/ibm-plex-mono-cyrillic-500-normal-Bq9vWWag.woff2 +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/ibm-plex-mono-cyrillic-600-normal-CTOM6hUh.woff2 +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/ibm-plex-mono-cyrillic-600-normal-fLZuRloM.woff +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/ibm-plex-mono-cyrillic-ext-400-normal-DMdlQ8Kv.woff +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/ibm-plex-mono-cyrillic-ext-400-normal-xuaO2J-f.woff2 +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/ibm-plex-mono-cyrillic-ext-500-normal-BIfNGwUT.woff +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/ibm-plex-mono-cyrillic-ext-500-normal-BqneJy0T.woff2 +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/ibm-plex-mono-cyrillic-ext-600-normal-9HEixskS.woff +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/ibm-plex-mono-cyrillic-ext-600-normal-V-xxqcpd.woff2 +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/ibm-plex-mono-latin-500-normal-CB9ihrfo.woff +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2 +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/ibm-plex-mono-latin-600-normal-BgSNZQsw.woff2 +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/ibm-plex-mono-latin-600-normal-DWFSQ4vo.woff +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/ibm-plex-mono-latin-ext-400-normal-BmRBH3aV.woff2 +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/ibm-plex-mono-latin-ext-400-normal-D3D2R8hC.woff +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/ibm-plex-mono-latin-ext-500-normal-CAhNIIs5.woff2 +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/ibm-plex-mono-latin-ext-500-normal-CZ70TYgx.woff +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/ibm-plex-mono-latin-ext-600-normal-D38SheWl.woff2 +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/ibm-plex-mono-latin-ext-600-normal-DmB0ttJJ.woff +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/ibm-plex-mono-vietnamese-400-normal-BulugwFq.woff2 +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/ibm-plex-mono-vietnamese-400-normal-DDuiU_S-.woff +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/ibm-plex-mono-vietnamese-500-normal-C8zxqsMH.woff +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/ibm-plex-mono-vietnamese-500-normal-DZ4AoWbu.woff2 +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/ibm-plex-mono-vietnamese-600-normal-D2EvbN8M.woff2 +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/ibm-plex-mono-vietnamese-600-normal-iLQfcSjf.woff +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/ibm-plex-sans-cyrillic-ext-wght-normal-d45eAU9y.woff2 +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/ibm-plex-sans-cyrillic-wght-normal-BAAhND-U.woff2 +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/ibm-plex-sans-greek-wght-normal-CmyJS8uq.woff2 +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/ibm-plex-sans-latin-ext-wght-normal-CIII54If.woff2 +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/ibm-plex-sans-latin-wght-normal-IvpUvPa2.woff2 +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/ibm-plex-sans-vietnamese-wght-normal-Dg1JeJN0.woff2 +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/identity-BNZxCf_y.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/input-1fShkFXn.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/json.worker-fczZDBja.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/jsonMode-tILOm4tQ.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/maximize-2-BdFIT4cn.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/nav-i7bJ0lrA.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/paging-CpRIkEky.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/pipelines-DaeuXRxg.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/play-CPVSEWx6.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/preferences-DsqSnjg9.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/preload-helper-BZ1Pz5am.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/react-CQOZoUwg.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/resolveAriaLabelledBy-ClHvyYLK.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/rolldown-runtime-Dd_uD5pT.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/schemas-7KY_7aIc.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/shell-CC2rA5mh.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/sql-NEE52Syq.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/status-Ctx8x8Mf.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/store-C2zgoyrT.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/textarea-ljIbN_md.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/tooltip-D7_KwbOU.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/triggers-B42obFCk.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/twig-De2hgUGE.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/use-heartbeat-CBT8848s.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/use-store-CfRquqZF.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/users-CTGHiHMA.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/utils-CT7ZGLfR.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/with-selector-BXYKoaOE.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/workers-BH2Za19E.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/x-Dltw6Vbs.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/yaml-DSCysg4a.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/assets/yaml.worker-B2SaT_wA.js +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/favicon-32.png +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/static/logo.png +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/transactions.py +0 -0
- {dirigent_server-0.17.2 → dirigent_server-0.18.0}/src/dirigent_server/ui.py +0 -0
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dirigent-server
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.18.0
|
|
4
4
|
Summary: Dirigent FastAPI server: the REST API, its authentication, and the health probes.
|
|
5
5
|
License-Expression: LicenseRef-Proprietary
|
|
6
6
|
License-File: LICENSE
|
|
7
7
|
License-File: THIRD_PARTY_NOTICES.md
|
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
|
9
9
|
Classifier: Programming Language :: Python :: 3.13
|
|
10
|
-
Requires-Dist: dirigent-client==0.
|
|
11
|
-
Requires-Dist: dirigent-common==0.
|
|
12
|
-
Requires-Dist: dirigent-core==0.
|
|
13
|
-
Requires-Dist: dirigent-examples==0.
|
|
10
|
+
Requires-Dist: dirigent-client==0.18.0
|
|
11
|
+
Requires-Dist: dirigent-common==0.18.0
|
|
12
|
+
Requires-Dist: dirigent-core==0.18.0
|
|
13
|
+
Requires-Dist: dirigent-examples==0.18.0
|
|
14
14
|
Requires-Dist: fastapi>=0.141.1
|
|
15
15
|
Requires-Python: >=3.13
|
|
16
16
|
Description-Content-Type: text/markdown
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "dirigent-server"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.18.0"
|
|
4
4
|
description = "Dirigent FastAPI server: the REST API, its authentication, and the health probes."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.13"
|
|
@@ -14,10 +14,10 @@ classifiers = [
|
|
|
14
14
|
"Programming Language :: Python :: 3.13",
|
|
15
15
|
]
|
|
16
16
|
dependencies = [
|
|
17
|
-
"dirigent-client==0.
|
|
18
|
-
"dirigent-common==0.
|
|
19
|
-
"dirigent-core==0.
|
|
20
|
-
"dirigent-examples==0.
|
|
17
|
+
"dirigent-client==0.18.0",
|
|
18
|
+
"dirigent-common==0.18.0",
|
|
19
|
+
"dirigent-core==0.18.0",
|
|
20
|
+
"dirigent-examples==0.18.0",
|
|
21
21
|
"fastapi>=0.141.1",
|
|
22
22
|
]
|
|
23
23
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "dirigent-server"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.18.0"
|
|
4
4
|
description = "Dirigent FastAPI server: the REST API, its authentication, and the health probes."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.13"
|
|
@@ -11,10 +11,10 @@ classifiers = [
|
|
|
11
11
|
"Programming Language :: Python :: 3.13",
|
|
12
12
|
]
|
|
13
13
|
dependencies = [
|
|
14
|
-
"dirigent-client==0.
|
|
15
|
-
"dirigent-common==0.
|
|
16
|
-
"dirigent-core==0.
|
|
17
|
-
"dirigent-examples==0.
|
|
14
|
+
"dirigent-client==0.18.0",
|
|
15
|
+
"dirigent-common==0.18.0",
|
|
16
|
+
"dirigent-core==0.18.0",
|
|
17
|
+
"dirigent-examples==0.18.0",
|
|
18
18
|
"fastapi>=0.141.1",
|
|
19
19
|
]
|
|
20
20
|
|
|
@@ -30,7 +30,7 @@ from dirigent_client.schemas import (
|
|
|
30
30
|
)
|
|
31
31
|
from dirigent_common.durations import DurationError, parse_duration
|
|
32
32
|
from dirigent_core import telemetry
|
|
33
|
-
from dirigent_core.artifacts import JSON_CONTENT_TYPE, TEXT_KEY, canonical_json
|
|
33
|
+
from dirigent_core.artifacts import JSON_CONTENT_TYPE, TEXT_KEY, canonical_json, open_artifact
|
|
34
34
|
from dirigent_core.database import session_scope
|
|
35
35
|
from dirigent_core.engine.definition import PipelineDefinition, load_definition
|
|
36
36
|
from dirigent_core.engine.runs import cancel_run, retry_step
|
|
@@ -353,7 +353,7 @@ async def read_artifact(
|
|
|
353
353
|
if reference.uri is None:
|
|
354
354
|
raise Refusal(ARTIFACT_EMPTY, status=status.HTTP_404_NOT_FOUND, artifact_id=artifact_id)
|
|
355
355
|
storage = await services.bound_storage(session)
|
|
356
|
-
return StreamingResponse(storage
|
|
356
|
+
return StreamingResponse(await open_artifact(storage, reference), media_type=content_type)
|
|
357
357
|
|
|
358
358
|
|
|
359
359
|
async def _spilled(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-CQOZoUwg.js";import{r as n}from"./with-selector-BXYKoaOE.js";import{n as r}from"./chunk-OB3PAWPO-DOp4K52_.js";import{i,r as a}from"./api-Bm1JZLuC.js";import{n as o,o as s,t as c}from"./PageState-CGVhOaOE.js";import{r as l,t as u}from"./ListTable-CKU-ULuI.js";import{r as d}from"./utils-CT7ZGLfR.js";import{d as f,f as p}from"./paging-CpRIkEky.js";import{t as m}from"./input-1fShkFXn.js";import{t as h}from"./identity-BNZxCf_y.js";import{n as g,s as _}from"./pipelines-DaeuXRxg.js";import{$ as v,At as y,Dt as b,E as x,Ft as S,Mt as C,Nt as w,Ot as T,S as E,b as D,et as O,g as k,it as A,jt as j,kt as M,ot as N,pt as P,st as F,ut as I,v as L,y as R}from"./index-AVwkiv9z.js";import{t as z}from"./Description-MmXUnb-9.js";import{t as B}from"./WindowedPane-B_L6IZvq.js";import{u as V}from"./connections-BuMoMUFi.js";import{n as H,t as ee}from"./Refusal-7YedH2sJ.js";import{t as U}from"./Instant-mr1E5jAK.js";import{t as te}from"./Segmented-VHBNaGnm.js";import{t as ne}from"./ProgramReference-DF37mMAT.js";import{t as re}from"./Picker-Cn4WWjGu.js";import{t as ie}from"./AdminOnly-922QAPCr.js";var ae={name:`bell-plus`,size:24,node:[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M15 8h6`,key:`8ybuxh`}],[`path`,{d:`M18 5v6`,key:`g5ayrv`}],[`path`,{d:`M20.002 14.464a9 9 0 0 0 .738.863A1 1 0 0 1 20 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 8.75-5.332`,key:`1abcvy`}]]};ae.node;var W=n(ae),oe={name:`send`,size:24,node:[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]};oe.node;var se=n(oe),G=e(t(),1),ce=[`run_failed`,`run_completed_with_errors`,`run_succeeded`,`run_stuck`],le=[`pending`,`sending`,`sent`,`failed`],ue=`0s`;function de(e){return e===ue?`none`:e}function fe(e){return e.replaceAll(`_`,` `)}function pe(e){return e.scope===`pipeline`&&e.pipeline!==null?e.pipeline:`every pipeline`}function me(e){return e.active&&!e.paused}function he(e){return e===`sent`||e===`failed`}function ge(e,t=50){let n=new URLSearchParams({limit:String(t)});return e!==null&&n.set(`after`,e),`/alert-rules?${n.toString()}`}function _e(e){return a(ge(e))}function ve(e){return i(`/alert-rules`,`POST`,e)}function ye(e,t){return i(`/alert-rules/${encodeURIComponent(e)}`,`PATCH`,t)}function be(e,t){return ye(e,{paused:t})}function xe(e){return a(`/alert-rules/${encodeURIComponent(e)}`,{method:`DELETE`})}var Se={status:``,notifier:``};function Ce(e,t,n=50){let r=new URLSearchParams({limit:String(n)});return e.status!==``&&r.set(`status`,e.status),e.notifier!==``&&r.set(`notifier`,e.notifier),t!==null&&r.set(`after`,t),`/notifications?${r.toString()}`}function we(e,t){return a(Ce(e,t))}function Te(e){return a(`/notifications/${encodeURIComponent(e)}`)}function Ee(e){return i(`/notifications/${encodeURIComponent(e)}/$retry`,`POST`,{})}function De(e){return i(`/alert-rules/$test`,`POST`,e)}async function Oe(){return(await a(`/blocks`)).notifiers.map(e=>e.id)}function ke(e,t){let n=[];for(let r of e){if(r===`log`){n.push({id:r,notifier:r,connection:null,reachable:!0,last_check_at:null,last_check_healthy:null,last_check_detail:null});continue}let e=t.filter(e=>e.kind===r);if(e.length===0){n.push({id:r,notifier:r,connection:null,reachable:!1,last_check_at:null,last_check_healthy:null,last_check_detail:null});continue}for(let t of e)n.push({id:`${r}:${t.code}`,notifier:r,connection:t.code,reachable:!0,last_check_at:t.last_check_at,last_check_healthy:t.last_check_healthy,last_check_detail:t.last_check_detail})}return n}function Ae(e){return e.notifier===`log`?{tone:`good`,label:`built in`,detail:null}:e.reachable?e.last_check_at===null?{tone:`quiet`,label:`never checked`,detail:null}:{tone:e.last_check_healthy===!0?`good`:`critical`,label:e.last_check_healthy===!0?`checked`:`failing`,detail:e.last_check_detail}:{tone:`quiet`,label:`no connection`,detail:`Nothing delivers through this channel yet.`}}var je=/^[a-z0-9]+(?:[-_][a-z0-9]+)*$/u,Me=/^(?:\d+(?:ms|s|m|h|d|w))+$/u,Ne=`A Jinja template: {{ run.* }} reads the run's pipeline, status, id, error, trigger, duration_ms and url.`,Pe=`A Jinja template over the run's facts; report is the run's report document when it has one.`,K=`text/x-jinja`;function q(e){let t=e.trim();return t===``?null:t}var Fe=[{value:`global`,label:`Every pipeline`},{value:`pipeline`,label:`One pipeline`}],Ie={run_failed:`Failed`,run_completed_with_errors:`Completed with errors`,run_succeeded:`Succeeded`,run_stuck:`Stuck`};function J(e){return e!==``&&e!==`log`}function Le(e){if(e.code.trim()===``)return`A rule is addressed by its code, and this one has none.`;if(!je.test(e.code.trim()))return`A code is lowercase words joined by - or _.`;if(e.scope===`pipeline`&&e.pipeline===``)return`A rule watching one pipeline names that pipeline, and this one names none.`;if(e.notifier===``)return`A rule delivers through a channel, and this one names none.`;if(J(e.notifier)&&e.connection===``)return`The ${e.notifier} channel delivers through a connection, and this one names none.`;if(!Me.test(e.throttle.trim()))return`A throttle is a duration, such as 15m.`}function Re(e,t){if(e===``)return`A test goes through a channel, and this one names none.`;if(J(e)&&t===``)return`The ${e} channel delivers through a connection, and this one names none.`}var Y=d();function ze({rule:e,onChanged:t,onDeleted:n,onTest:r}){let[i,a]=(0,G.useState)(!1),[o,c]=(0,G.useState)(null),l=o===e.code,u=R(),d=(0,G.useCallback)(e=>we(Se,e),[]),{state:f}=L(d,He),m=f.rows.filter(t=>t.rule===e.code);return(0,Y.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,Y.jsxs)(Ge,{thing:e,children:[e.paused&&(0,Y.jsx)(We,{children:`paused`}),!e.active&&(0,Y.jsx)(We,{children:`off`})]}),(0,Y.jsx)(z,{text:e.description}),(0,Y.jsxs)(`dl`,{className:`space-y-1.5`,children:[(0,Y.jsx)(Z,{label:`Event`,children:fe(e.event)}),(0,Y.jsx)(Z,{label:`Scope`,children:pe(e)}),(0,Y.jsx)(Z,{label:`Delivers through`,children:(0,Y.jsx)(X,{notifier:e.notifier,connection:e.connection})}),(0,Y.jsx)(Z,{label:`Throttle`,children:de(e.throttle)}),l?(0,Y.jsx)(Be,{rule:e,onDone:()=>{c(null)},onSaved:e=>{t(e),c(null)}},e.code):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Z,{label:`Subject`,children:(0,Y.jsxs)(`span`,{className:`flex flex-wrap items-baseline gap-2`,children:[e.template===null?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`none`}):(0,Y.jsx)(`span`,{className:`font-mono text-xs break-all`,children:e.template}),(0,Y.jsx)(s,{why:u.why,children:(0,Y.jsx)(p,{variant:`ghost`,size:`xs`,disabled:!u.may,title:u.why,onClick:()=>{c(e.code)},children:`Edit`})})]})}),e.body!==null&&(0,Y.jsx)(Z,{label:`Body`,children:(0,Y.jsx)(`span`,{className:`line-clamp-3 font-mono text-xs break-words whitespace-pre-wrap`,children:e.body})})]}),(0,Y.jsx)(Z,{label:`Last sent`,children:e.last_sent_at===null?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`never`}):(0,Y.jsx)(U,{at:e.last_sent_at})})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Y.jsx)(s,{why:u.why,children:(0,Y.jsx)(p,{variant:`outline`,size:`sm`,disabled:i||!u.may,title:u.why,onClick:()=>{a(!0),be(e.code,!e.paused).then(t,H).finally(()=>{a(!1)})},children:e.paused?`Resume`:`Pause`})}),(0,Y.jsx)(s,{why:u.why,children:(0,Y.jsx)(p,{variant:`outline`,size:`sm`,disabled:!u.may,title:u.why,onClick:r,children:`Send a test`})}),(0,Y.jsx)(s,{why:u.why,children:(0,Y.jsx)(p,{variant:`outline`,size:`sm`,className:`destructive-action ml-auto`,disabled:i||!u.may,title:u.why,onClick:()=>{a(!0),xe(e.code).then(n,H).finally(()=>{a(!1)})},children:`Delete`})})]}),(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Recent deliveries`}),!f.read&&(0,Y.jsx)(`p`,{className:`text-xs text-faint`,children:`Reading from the server`}),f.read&&m.length===0&&(0,Y.jsx)(`p`,{className:`text-xs text-faint`,children:`Nothing sent.`}),(0,Y.jsx)(`ul`,{className:`divide-y divide-border`,children:m.map(e=>(0,Y.jsxs)(`li`,{className:`row-hover -mx-4 flex items-center gap-2 px-4 py-2`,children:[(0,Y.jsx)(E,{status:e.status}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs`,children:e.subject}),(0,Y.jsx)(U,{className:`shrink-0 text-xs text-faint`,at:e.created_at})]},e.id))})]})]})}function Be({rule:e,onDone:t,onSaved:n}){let[r,i]=(0,G.useState)(e.template??``),[a,o]=(0,G.useState)(e.body??``),[s,c]=(0,G.useState)(null),[l,u]=(0,G.useState)(!1),d=`alert-rule/${e.code}/body`,h=`rule-${e.code}-subject`;return(0,Y.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-border bg-secondary/30 p-3`,children:[(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(x,{htmlFor:h,children:`Subject`}),(0,Y.jsx)(m,{id:h,className:`font-mono`,spellCheck:!1,autoComplete:`off`,value:r,placeholder:`{{ run.pipeline }} run {{ run.status }}`,onChange:e=>{i(e.target.value)}}),(0,Y.jsx)(`p`,{className:`text-xs text-faint`,children:Ne})]}),(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(x,{children:`Body`}),(0,Y.jsx)(`p`,{className:`text-xs text-faint`,children:Pe}),(0,Y.jsx)(B,{name:`body`,className:`overflow-hidden rounded-md border border-border bg-background`,aside:(0,Y.jsx)(ne,{mediaType:K}),windowed:(0,Y.jsx)(A,{value:a,mediaType:K,path:d,label:`body, in a window`,className:`min-h-0 flex-1`,onChange:o}),children:(0,Y.jsx)(A,{value:a,mediaType:K,path:d,label:`body`,placeholder:`{{ run.pipeline }} ended {{ run.status }}: {{ run.url }}`,className:`h-40 min-h-32`,onChange:o})})]}),s!==null&&(0,Y.jsx)(ee,{problem:s}),(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Y.jsx)(p,{variant:`ghost`,size:`sm`,onClick:t,children:`Cancel`}),(0,Y.jsx)(p,{size:`sm`,disabled:l,onClick:()=>{let i={};if(q(r)!==e.template&&(i.template=q(r)),q(a)!==e.body&&(i.body=q(a)),Object.keys(i).length===0){t();return}u(!0),c(null),ye(e.code,i).then(n,e=>{c(f(e))}).finally(()=>{u(!1)})},children:l?`Saving`:`Save`})]})]})}function Ve({notification:e,onChanged:t}){let[n,i]=(0,G.useState)(!1),a=R();return(0,Y.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,Y.jsx)(`div`,{className:`space-y-1`,children:(0,Y.jsxs)(`p`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(E,{status:e.status}),(0,Y.jsx)(`span`,{className:`text-sm font-semibold`,children:e.subject})]})}),(0,Y.jsxs)(`dl`,{className:`space-y-1.5`,children:[e.rule===null?(0,Y.jsx)(Z,{label:`Raised by`,children:(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`a test, not a rule`})}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Z,{label:`Event`,children:fe(e.event)}),(0,Y.jsx)(Z,{label:`Rule`,children:(0,Y.jsx)(`span`,{className:`font-mono text-xs`,children:e.rule})})]}),(0,Y.jsx)(Z,{label:`Delivers through`,children:(0,Y.jsx)(X,{notifier:e.notifier,connection:e.connection})}),(0,Y.jsx)(Z,{label:`Run`,children:(0,Y.jsx)(Ue,{notification:e})}),(0,Y.jsx)(Z,{label:`Queued`,children:(0,Y.jsx)(U,{at:e.created_at})}),e.status===`sent`?(0,Y.jsx)(Z,{label:`Sent`,children:(0,Y.jsx)(U,{at:e.sent_at})}):(0,Y.jsx)(Z,{label:`Next try`,children:(0,Y.jsx)(U,{at:e.available_at})}),(0,Y.jsxs)(Z,{label:`Attempts`,children:[e.attempt,` of `,e.max_attempts]})]}),e.error!==null&&(0,Y.jsxs)(`div`,{className:`space-y-1`,children:[(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`What the channel said`}),(0,Y.jsx)(`p`,{className:`text-xs break-words text-critical`,children:e.error}),(0,Y.jsx)(`p`,{className:`text-xs text-faint`,children:`Only the latest refusal is kept. Earlier attempts are counted, not stored.`})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Y.jsx)(s,{why:a.why,children:(0,Y.jsx)(p,{variant:`outline`,size:`sm`,disabled:n||!a.may,title:a.why,onClick:()=>{i(!0),Ee(e.id).then(t,H).finally(()=>{i(!1)})},children:`Retry now`})}),e.run_id!==null&&(0,Y.jsx)(p,{variant:`outline`,size:`sm`,render:(0,Y.jsx)(r,{to:`/runs/${e.run_id}`}),children:`Open the run`})]})]})}var He=e=>e.id;function X({notifier:e,connection:t}){return(0,Y.jsxs)(`span`,{className:`flex flex-wrap items-baseline gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`text-sm`,children:e}),t!==null&&(0,Y.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:t})]})}function Ue({notification:e}){if(e.run_id===null)return(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`no run`});let t=e.run_pipeline??`a run`;return(0,Y.jsxs)(r,{className:`text-primary hover:underline`,to:`/runs/${e.run_id}`,children:[(0,Y.jsx)(`span`,{className:`text-sm`,children:t}),e.run_started_at!==null&&(0,Y.jsx)(U,{className:`ml-1.5 text-xs text-muted-foreground`,at:e.run_started_at})]})}function We({children:e}){return(0,Y.jsx)(`span`,{className:`rounded-sm border border-border px-1.5 text-xs text-muted-foreground`,children:e})}function Ge({thing:e,children:t}){let n=h(e);return(0,Y.jsxs)(`p`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:n.named?`text-sm font-semibold`:`font-mono text-sm font-semibold`,children:n.title}),t,n.code!==null&&(0,Y.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:n.code})]})}function Z({label:e,children:t}){return(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,Y.jsx)(`dt`,{className:`w-32 shrink-0 text-xs text-muted-foreground`,children:e}),(0,Y.jsx)(`dd`,{className:`min-w-0 text-sm`,children:t})]})}var Ke={good:`var(--good)`,critical:`var(--critical)`,quiet:`var(--faint)`};function qe({channels:e}){return(0,Y.jsx)(`ul`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-4`,children:e.map(e=>(0,Y.jsx)(Je,{channel:e},e.id))})}function Je({channel:e}){let t=Ae(e);return(0,Y.jsxs)(`li`,{className:`flex items-start justify-between gap-3 rounded-lg border border-border bg-card p-3`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,title:e.connection===null?e.notifier:`${e.notifier} ${e.connection}`,children:[(0,Y.jsx)(`span`,{className:`status-dot shrink-0`,style:{"--chip":Ke[t.tone]}}),(0,Y.jsx)(`span`,{className:`shrink-0 text-sm font-medium`,children:e.notifier}),e.connection!==null&&(0,Y.jsx)(`span`,{className:`truncate font-mono text-xs text-muted-foreground`,children:e.connection})]}),(0,Y.jsxs)(`span`,{className:`flex shrink-0 flex-col items-end`,children:[(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t.label}),e.last_check_at!==null&&(0,Y.jsx)(U,{className:`text-xs text-faint`,at:e.last_check_at}),t.detail!==null&&(0,Y.jsx)(`span`,{className:`max-w-48 truncate text-xs text-faint`,title:t.detail,children:t.detail})]})]})}function Q({id:e,label:t,value:n,onChange:r,placeholder:i,mono:a,hint:o}){return(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(x,{htmlFor:e,children:t}),(0,Y.jsx)(m,{id:e,className:a===!0?`font-mono`:void 0,spellCheck:!1,autoComplete:`off`,value:n,placeholder:i,onChange:e=>{r(e.target.value)}}),o!==void 0&&(0,Y.jsx)(`p`,{className:`text-xs text-faint`,children:o})]})}function Ye({id:e,notifiers:t,value:n,onChange:r}){return(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(x,{htmlFor:e,children:`Notifier`}),(0,Y.jsx)(re,{id:e,label:`Notifier`,value:n,options:t.map(e=>({value:e,label:e,aside:``})),placeholder:`Search the installed channels`,onChange:r})]})}function Xe({id:e,kind:t,value:n,onChange:r}){let i=Ze(t);return(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(x,{htmlFor:e,children:`Connection`}),(0,Y.jsx)(re,{id:e,label:`Connection`,value:n,options:i,placeholder:i.length===0?`No ${t} connection yet`:`Search by name or code`,onChange:r})]})}function Ze(e){let[t,n]=(0,G.useState)([]);return(0,G.useEffect)(()=>{if(e===``||e===`log`)return;let t=!0;return V().then(e=>{t&&n(e.items)},()=>{t&&n([])}),()=>{t=!1}},[e]),t.filter(t=>t.kind===e).map(e=>{let t=h(e);return{value:e.code,label:t.title,aside:t.code??``}})}var Qe=`0s`,$e=`alert-rule/new/body`,$=`body`;function et({open:e,onOpenChange:t,notifiers:n,onCreated:r}){let[i,a]=(0,G.useState)(``),[o,c]=(0,G.useState)(``),[l,u]=(0,G.useState)(``),[d,m]=(0,G.useState)(`run_failed`),[h,g]=(0,G.useState)(`global`),[_,v]=(0,G.useState)(``),[y,S]=(0,G.useState)(``),[E,O]=(0,G.useState)(``),[k,N]=(0,G.useState)(``),[P,F]=(0,G.useState)(``),[I,L]=(0,G.useState)(Qe),[z,V]=(0,G.useState)(null),[H,U]=(0,G.useState)(!1),ie=tt(e),ae=R(),W=D(ae.why,Le({code:i,scope:h,pipeline:_,notifier:y,connection:E,throttle:I}));return(0,Y.jsx)(b,{open:e,onOpenChange:t,children:(0,Y.jsxs)(M,{className:`flex max-h-[calc(100vh-4rem)] flex-col sm:max-w-3xl`,showCloseButton:!1,children:[(0,Y.jsx)(C,{children:(0,Y.jsx)(w,{children:`New rule`})}),(0,Y.jsxs)(`div`,{className:`-mx-1 min-h-0 flex-1 space-y-4 overflow-y-auto px-1`,children:[(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 md:grid-cols-2`,children:[(0,Y.jsx)(Q,{id:`rule-code`,label:`Code`,value:i,onChange:a,placeholder:`ops-slack-failed`,mono:!0}),(0,Y.jsx)(Q,{id:`rule-name`,label:`Name`,value:o,onChange:c,placeholder:`Tell the ops channel`})]}),(0,Y.jsx)(Q,{id:`rule-description`,label:`Description`,value:l,onChange:u,placeholder:`What this rule is for`}),(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(x,{children:`Event`}),(0,Y.jsx)(te,{label:`Event`,size:`md`,value:d,options:ce.map(e=>({value:e,label:Ie[e]})),onChoose:m})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 md:grid-cols-2`,children:[(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(x,{children:`Scope`}),(0,Y.jsx)(te,{label:`Scope`,size:`md`,value:h,options:Fe,onChoose:g})]}),h===`pipeline`&&(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(x,{htmlFor:`rule-pipeline`,children:`Pipeline`}),(0,Y.jsx)(re,{id:`rule-pipeline`,label:`Pipeline`,value:_,options:ie,placeholder:`Search by name or code`,onChange:v})]})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 md:grid-cols-2`,children:[(0,Y.jsx)(Ye,{id:`rule-notifier`,notifiers:n,value:y,onChange:e=>{S(e),O(``)}}),J(y)&&(0,Y.jsx)(Xe,{id:`rule-connection`,kind:y,value:E,onChange:O})]}),(0,Y.jsx)(Q,{id:`rule-subject`,label:`Subject`,value:k,onChange:N,placeholder:`{{ run.pipeline }} run {{ run.status }}`,mono:!0,hint:Ne}),(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(x,{children:`Body`}),(0,Y.jsx)(`p`,{className:`text-xs text-faint`,children:Pe}),(0,Y.jsx)(B,{name:$,className:`overflow-hidden rounded-md border border-border`,aside:(0,Y.jsx)(ne,{mediaType:K}),windowed:(0,Y.jsx)(A,{value:P,mediaType:K,path:$e,label:`${$}, in a window`,className:`min-h-0 flex-1`,onChange:F}),children:(0,Y.jsx)(A,{value:P,mediaType:K,path:$e,label:$,placeholder:`{{ run.pipeline }} ended {{ run.status }}: {{ run.url }}`,className:`h-40 min-h-32`,onChange:F})})]}),(0,Y.jsx)(`div`,{className:`grid grid-cols-1 gap-3 md:grid-cols-2`,children:(0,Y.jsx)(Q,{id:`rule-throttle`,label:`Throttle`,value:I,onChange:L,placeholder:`15m`,mono:!0})})]}),z!==null&&(0,Y.jsx)(ee,{problem:z}),(0,Y.jsxs)(j,{children:[(0,Y.jsx)(`p`,{className:`mr-auto self-center text-xs text-muted-foreground`,children:`A rule fires when a run settles. Nothing is sent now.`}),(0,Y.jsx)(T,{render:(0,Y.jsx)(p,{variant:`ghost`}),children:`Close`}),(0,Y.jsx)(s,{why:W,children:(0,Y.jsx)(p,{disabled:H||W!==void 0,title:W,onClick:()=>{U(!0),V(null),ve({code:i.trim(),name:q(o),description:q(l),event:d,notifier:y,scope:h,pipeline:h===`pipeline`?_:null,connection:J(y)?E:null,template:q(k),body:q(P),throttle:I.trim()}).then(()=>{r(),a(``),c(``),u(``),N(``),F(``),t(!1)},e=>{V(f(e))}).finally(()=>{U(!1)})},children:H?`Creating`:`Create`})})]})]})})}function tt(e){let[t,n]=(0,G.useState)([]);return(0,G.useEffect)(()=>{if(!e)return;let t=!0;return _().then(e=>{t&&n(e.toSorted(g).map(e=>{let t=h(e);return{value:e.code,label:t.title,aside:t.code??``}}))},()=>{t&&n([])}),()=>{t=!1}},[e]),t}var nt=1e3,rt=6e4,it=`dirigent test alert`,at={notifier:``,connection:``,subject:``};function ot({open:e,draft:t,onOpenChange:n,notifiers:r,onQueued:i,onOpenQueue:a}){let[o,c]=(0,G.useState)(t.notifier),[l,u]=(0,G.useState)(t.connection),[d,m]=(0,G.useState)(t.subject),[h,g]=(0,G.useState)(null),[_,v]=(0,G.useState)(null),[x,S]=(0,G.useState)(!1),E=ct(h),O=R(),k=E!==null&&he(E.status)?E.id:null;(0,G.useEffect)(()=>{k!==null&&i()},[k]);let A=D(O.why,Re(o,l));return(0,Y.jsx)(b,{open:e,onOpenChange:n,children:(0,Y.jsxs)(M,{className:`sm:max-w-lg`,showCloseButton:!1,children:[(0,Y.jsxs)(C,{children:[(0,Y.jsx)(w,{children:`Send a test`}),(0,Y.jsx)(y,{children:`The message goes through the same queue a real alert does, and a worker delivers it.`})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 md:grid-cols-2`,children:[(0,Y.jsx)(Ye,{id:`test-notifier`,notifiers:r,value:o,onChange:e=>{c(e),u(``)}}),J(o)&&(0,Y.jsx)(Xe,{id:`test-connection`,kind:o,value:l,onChange:u})]}),(0,Y.jsx)(Q,{id:`test-subject`,label:`Subject`,value:d,onChange:m,placeholder:it}),_!==null&&(0,Y.jsx)(ee,{problem:_}),E!==null&&(0,Y.jsx)(st,{row:E}),(0,Y.jsxs)(j,{children:[(0,Y.jsx)(T,{render:(0,Y.jsx)(p,{variant:`ghost`}),children:`Close`}),h!==null&&(0,Y.jsx)(p,{variant:`outline`,onClick:()=>{a(h)},children:`Open in the queue`}),(0,Y.jsx)(s,{why:A,children:(0,Y.jsx)(p,{disabled:x||A!==void 0,title:A,onClick:()=>{S(!0),v(null),g(null),De({notifier:o,connection:J(o)?l:null,...d.trim()===``?{}:{subject:d.trim()}}).then(e=>{g(e.notification_id),i()},e=>{v(f(e))}).finally(()=>{S(!1)})},children:h===null?`Send`:`Send again`})})]})]})})}function st({row:e}){return(0,Y.jsxs)(`div`,{className:`space-y-2 rounded-lg border border-border bg-secondary/40 p-3`,"data-testid":`test-delivery`,"aria-live":`polite`,children:[(0,Y.jsxs)(`p`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(E,{status:e.status}),(0,Y.jsx)(`span`,{className:`text-sm`,children:e.subject})]}),(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.status===`sent`?(0,Y.jsxs)(Y.Fragment,{children:[`Delivered `,(0,Y.jsx)(U,{at:e.sent_at}),`.`]}):e.status===`failed`?(0,Y.jsxs)(Y.Fragment,{children:[`Given up after `,e.attempt,` of `,e.max_attempts,` attempts.`]}):e.attempt===0?`Queued for the next worker pass.`:(0,Y.jsxs)(Y.Fragment,{children:[`Attempt `,e.attempt,` of `,e.max_attempts,`, next try`,` `,(0,Y.jsx)(U,{at:e.available_at}),`.`]})}),e.error!==null&&(0,Y.jsx)(`p`,{className:`text-xs break-words text-critical`,children:e.error})]})}function ct(e){let[t,n]=(0,G.useState)(null);return(0,G.useEffect)(()=>{if(e===null)return;let t=!0,r,i=Date.now()+rt,a=()=>{Te(e).then(o=>{t&&(n({id:e,row:o}),!(he(o.status)||Date.now()>i)&&(r=setTimeout(a,nt)))},()=>{})};return a(),()=>{t=!1,r!==void 0&&clearTimeout(r)}},[e]),t!==null&&t.id===e?t.row:null}var lt=e=>e.id,ut=e=>e.id;function dt(){return(0,Y.jsx)(ie,{children:(0,Y.jsx)(ft,{})})}function ft(){let[e,t]=(0,G.useState)(!1),[n,r]=(0,G.useState)(null),[i,a]=(0,G.useState)(null),[s,d]=(0,G.useState)(null),[f,p]=(0,G.useState)({status:``,notifier:``}),[m,h]=(0,G.useState)({}),[g,_]=(0,G.useState)({}),y=L((0,G.useCallback)(e=>_e(e),[]),lt),b=L((0,G.useCallback)(e=>we(f,e),[f]),ut),x=ht(),{reload:C}=y,{reload:w}=b,T=(0,G.useMemo)(()=>y.state.rows.map(e=>m[e.id]??e),[m,y.state.rows]),D=(0,G.useMemo)(()=>b.state.rows.map(e=>g[e.id]??e),[g,b.state.rows]),A=T.find(e=>e.id===i)??null,j=D.find(e=>e.id===s)??null,M=(0,G.useCallback)(e=>{r(t=>({draft:e,opened:(t?.opened??0)+1}))},[]);(0,G.useEffect)(()=>(O({note:null,tone:`quiet`,identifier:null}),v),[]),(0,G.useEffect)(()=>{if(A!==null){let e=A;return N([{id:`rule`,label:`Rule`,render:()=>(0,Y.jsx)(ze,{rule:e,onChanged:e=>{h(t=>({...t,[e.id]:e}))},onDeleted:()=>{a(null),C()},onTest:()=>{M({notifier:e.notifier,connection:e.connection??``,subject:``})}})}],{screen:`alerting`})}if(j!==null){let e=j;return N([{id:`notification`,label:`Notification`,render:()=>(0,Y.jsx)(Ve,{notification:e,onChanged:e=>{_(t=>({...t,[e.id]:e}))}})}],{screen:`alerting`})}},[j,A,M,C]);let z=R(`admin`),B=z.may;return(0,G.useEffect)(()=>P([...B?[{id:`alerting:rule`,title:`New alert rule`,group:I,screen:!0,icon:W,keywords:[`alert`,`event`,`create`],run:()=>{t(!0)}},{id:`alerting:test`,title:`Send a test through a channel`,group:I,screen:!0,icon:se,keywords:[`alert`,`notification`,`try`],run:()=>{M(at)}}]:[],{id:`alerting:reload`,title:`Read the alert rules again`,group:I,screen:!0,icon:S,keywords:[`refresh`,`reload`],run:()=>{C(),w()}}]),[B,M,w,C]),(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(c,{title:`Alerting`,aside:(0,Y.jsx)(l,{tag:`alerts`}),actions:[{id:`test`,label:`Send a test`,icon:se,variant:`outline`,disabled:!z.may,why:z.why,onClick:()=>{M(at)}},{id:`rule`,label:`New rule`,icon:W,disabled:!z.may,why:z.why,onClick:()=>{t(!0)}}]}),(0,Y.jsxs)(`section`,{className:`mb-6 space-y-2`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Channels`}),x.read?x.rows.length===0?(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No channel is installed.`}):(0,Y.jsx)(qe,{channels:x.rows}):(0,Y.jsx)(`p`,{className:`text-sm text-faint`,children:`Reading from the server`})]}),(0,Y.jsxs)(`section`,{className:`space-y-2`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Rules`}),(0,Y.jsx)(o,{loading:!y.state.read,problem:y.state.problem,empty:T.length===0,emptyMessage:`No rules.`,children:(0,Y.jsx)(u,{columns:gt,rows:T,rowKey:lt,rowClassName:e=>me(e)?void 0:`opacity-60`,reading:y.state.reading,next:y.state.next,onMore:y.more,noun:`rules`,onSelect:e=>{d(null),a(e.id),F()},selected:e=>e.id===i})})]}),(0,Y.jsxs)(`section`,{className:`mt-8 space-y-2`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Notifications`}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Y.jsx)(k,{label:`Status`,value:f.status,anything:`Any status`,options:le.map(e=>({value:e,label:e,mark:(0,Y.jsx)(E,{status:e})})),onChange:e=>{p(t=>({...t,status:e}))}}),(0,Y.jsx)(k,{label:`Notifier`,value:f.notifier,anything:`Any notifier`,options:mt(x.rows),onChange:e=>{p(t=>({...t,notifier:e}))}})]})]}),(0,Y.jsx)(o,{loading:!b.state.read,problem:b.state.problem,empty:D.length===0,emptyMessage:`Nothing queued.`,children:(0,Y.jsx)(u,{columns:_t,rows:D,rowKey:ut,reading:b.state.reading,next:b.state.next,onMore:b.more,noun:`notifications`,onSelect:e=>{a(null),d(e.id),F()},selected:e=>e.id===s})})]}),(0,Y.jsx)(et,{open:e,onOpenChange:t,notifiers:pt(x.rows),onCreated:C}),(0,Y.jsx)(ot,{open:n!==null,draft:n?.draft??at,onOpenChange:e=>{e||r(null)},notifiers:pt(x.rows),onQueued:w,onOpenQueue:e=>{r(null),a(null),d(e),w(),F()}},n?.opened??0)]})}function pt(e){return[...new Set(e.map(e=>e.notifier))]}function mt(e){return pt(e).map(e=>({value:e,label:e}))}function ht(){let[e,t]=(0,G.useState)(null),[n,r]=(0,G.useState)(null);return(0,G.useEffect)(()=>{let e=!0;return Oe().then(n=>{e&&t(n)},()=>{e&&t([])}),V().then(t=>{e&&r(t.items)},()=>{e&&r([])}),()=>{e=!1}},[]),{rows:(0,G.useMemo)(()=>ke(e??[],n??[]),[n,e]),read:e!==null&&n!==null}}var gt=[{id:`rule`,header:`Rule`,cell:e=>{let t=h(e);return(0,Y.jsxs)(`span`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,Y.jsx)(`span`,{className:t.named?`text-sm font-medium`:`font-mono text-sm font-medium`,children:t.title}),t.code!==null&&(0,Y.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:t.code})]})}},{id:`event`,header:`Event`,cell:e=>(0,Y.jsx)(`span`,{className:`text-sm`,children:Ie[e.event]})},{id:`scope`,header:`Scope`,cell:e=>(0,Y.jsx)(`span`,{className:e.scope===`pipeline`?`font-mono text-xs`:`text-sm`,children:pe(e)})},{id:`delivers`,header:`Delivers through`,cell:e=>(0,Y.jsx)(X,{notifier:e.notifier,connection:e.connection})},{id:`throttle`,header:`Throttle`,className:`font-mono text-xs`,cell:e=>(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:de(e.throttle)})},{id:`sent`,header:`Last sent`,className:`text-xs`,cell:e=>e.last_sent_at===null?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`never`}):(0,Y.jsx)(U,{className:`text-muted-foreground`,at:e.last_sent_at})},{id:`live`,header:`State`,cell:e=>e.paused?(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`paused`}):e.active?(0,Y.jsx)(`span`,{className:`text-xs text-good`,children:`active`}):(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`off`})}],_t=[{id:`status`,header:`Status`,cell:e=>(0,Y.jsx)(E,{status:e.status})},{id:`subject`,header:`Subject`,cell:e=>(0,Y.jsxs)(`span`,{className:`flex flex-col`,children:[(0,Y.jsx)(`span`,{className:`text-sm`,children:e.subject}),e.error!==null&&(0,Y.jsx)(`span`,{className:`max-w-96 truncate text-xs text-critical`,title:e.error,children:e.error})]})},{id:`delivers`,header:`Delivers through`,cell:e=>(0,Y.jsx)(X,{notifier:e.notifier,connection:e.connection})},{id:`run`,header:`Run`,cell:e=>(0,Y.jsx)(Ue,{notification:e})},{id:`queued`,header:`Queued`,className:`text-xs`,cell:e=>(0,Y.jsx)(U,{className:`text-muted-foreground`,at:e.created_at})},{id:`sent`,header:`Sent`,className:`text-xs`,cell:e=>e.status===`sent`?(0,Y.jsx)(U,{className:`text-muted-foreground`,at:e.sent_at}):e.attempt>0?(0,Y.jsxs)(`span`,{className:`text-faint`,children:[e.attempt,` of `,e.max_attempts,` attempts`]}):null}];export{dt as AdminAlerting};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-CQOZoUwg.js";import{r as n}from"./with-selector-BXYKoaOE.js";import{n as r}from"./chunk-OB3PAWPO-DOp4K52_.js";import{i,r as a}from"./api-Bm1JZLuC.js";import{n as o,o as s,t as c}from"./PageState-CGVhOaOE.js";import{r as l,t as u}from"./ListTable-BykeouTl.js";import{r as d}from"./utils-CT7ZGLfR.js";import{d as f,f as p}from"./paging-CpRIkEky.js";import{t as m}from"./input-1fShkFXn.js";import{t as h}from"./identity-BNZxCf_y.js";import{n as g,s as _}from"./pipelines-DaeuXRxg.js";import{$ as v,At as y,Dt as b,E as x,Ft as S,Mt as C,Nt as w,Ot as T,S as E,b as D,et as O,g as k,it as A,jt as j,kt as M,ot as N,pt as P,st as F,ut as I,v as L,y as R}from"./index-DBX30PmL.js";import{t as z}from"./Description-MmXUnb-9.js";import{t as B}from"./WindowedPane-DJe_7m8A.js";import{u as V}from"./connections-BuMoMUFi.js";import{n as H,t as ee}from"./Refusal-DFh6LEQQ.js";import{t as U}from"./Instant-mr1E5jAK.js";import{t as te}from"./Segmented-u0lpCZgQ.js";import{t as ne}from"./ProgramReference-DF37mMAT.js";import{t as re}from"./Picker-CY13BPS4.js";import{t as ie}from"./AdminOnly-922QAPCr.js";var ae={name:`bell-plus`,size:24,node:[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M15 8h6`,key:`8ybuxh`}],[`path`,{d:`M18 5v6`,key:`g5ayrv`}],[`path`,{d:`M20.002 14.464a9 9 0 0 0 .738.863A1 1 0 0 1 20 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 8.75-5.332`,key:`1abcvy`}]]};ae.node;var W=n(ae),oe={name:`send`,size:24,node:[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]};oe.node;var se=n(oe),G=e(t(),1),ce=[`run_failed`,`run_completed_with_errors`,`run_succeeded`,`run_stuck`],le=[`pending`,`sending`,`sent`,`failed`],ue=`0s`;function de(e){return e===ue?`none`:e}function fe(e){return e.replaceAll(`_`,` `)}function pe(e){return e.scope===`pipeline`&&e.pipeline!==null?e.pipeline:`every pipeline`}function me(e){return e.active&&!e.paused}function he(e){return e===`sent`||e===`failed`}function ge(e,t=50){let n=new URLSearchParams({limit:String(t)});return e!==null&&n.set(`after`,e),`/alert-rules?${n.toString()}`}function _e(e){return a(ge(e))}function ve(e){return i(`/alert-rules`,`POST`,e)}function ye(e,t){return i(`/alert-rules/${encodeURIComponent(e)}`,`PATCH`,t)}function be(e,t){return ye(e,{paused:t})}function xe(e){return a(`/alert-rules/${encodeURIComponent(e)}`,{method:`DELETE`})}var Se={status:``,notifier:``};function Ce(e,t,n=50){let r=new URLSearchParams({limit:String(n)});return e.status!==``&&r.set(`status`,e.status),e.notifier!==``&&r.set(`notifier`,e.notifier),t!==null&&r.set(`after`,t),`/notifications?${r.toString()}`}function we(e,t){return a(Ce(e,t))}function Te(e){return a(`/notifications/${encodeURIComponent(e)}`)}function Ee(e){return i(`/notifications/${encodeURIComponent(e)}/$retry`,`POST`,{})}function De(e){return i(`/alert-rules/$test`,`POST`,e)}async function Oe(){return(await a(`/blocks`)).notifiers.map(e=>e.id)}function ke(e,t){let n=[];for(let r of e){if(r===`log`){n.push({id:r,notifier:r,connection:null,reachable:!0,last_check_at:null,last_check_healthy:null,last_check_detail:null});continue}let e=t.filter(e=>e.kind===r);if(e.length===0){n.push({id:r,notifier:r,connection:null,reachable:!1,last_check_at:null,last_check_healthy:null,last_check_detail:null});continue}for(let t of e)n.push({id:`${r}:${t.code}`,notifier:r,connection:t.code,reachable:!0,last_check_at:t.last_check_at,last_check_healthy:t.last_check_healthy,last_check_detail:t.last_check_detail})}return n}function Ae(e){return e.notifier===`log`?{tone:`good`,label:`built in`,detail:null}:e.reachable?e.last_check_at===null?{tone:`quiet`,label:`never checked`,detail:null}:{tone:e.last_check_healthy===!0?`good`:`critical`,label:e.last_check_healthy===!0?`checked`:`failing`,detail:e.last_check_detail}:{tone:`quiet`,label:`no connection`,detail:`Nothing delivers through this channel yet.`}}var je=/^[a-z0-9]+(?:[-_][a-z0-9]+)*$/u,Me=/^(?:\d+(?:ms|s|m|h|d|w))+$/u,Ne=`A Jinja template: {{ run.* }} reads the run's pipeline, status, id, error, trigger, duration_ms and url.`,Pe=`A Jinja template over the run's facts; report is the run's report document when it has one.`,K=`text/x-jinja`;function q(e){let t=e.trim();return t===``?null:t}var Fe=[{value:`global`,label:`Every pipeline`},{value:`pipeline`,label:`One pipeline`}],Ie={run_failed:`Failed`,run_completed_with_errors:`Completed with errors`,run_succeeded:`Succeeded`,run_stuck:`Stuck`};function J(e){return e!==``&&e!==`log`}function Le(e){if(e.code.trim()===``)return`A rule is addressed by its code, and this one has none.`;if(!je.test(e.code.trim()))return`A code is lowercase words joined by - or _.`;if(e.scope===`pipeline`&&e.pipeline===``)return`A rule watching one pipeline names that pipeline, and this one names none.`;if(e.notifier===``)return`A rule delivers through a channel, and this one names none.`;if(J(e.notifier)&&e.connection===``)return`The ${e.notifier} channel delivers through a connection, and this one names none.`;if(!Me.test(e.throttle.trim()))return`A throttle is a duration, such as 15m.`}function Re(e,t){if(e===``)return`A test goes through a channel, and this one names none.`;if(J(e)&&t===``)return`The ${e} channel delivers through a connection, and this one names none.`}var Y=d();function ze({rule:e,onChanged:t,onDeleted:n,onTest:r}){let[i,a]=(0,G.useState)(!1),[o,c]=(0,G.useState)(null),l=o===e.code,u=R(),d=(0,G.useCallback)(e=>we(Se,e),[]),{state:f}=L(d,He),m=f.rows.filter(t=>t.rule===e.code);return(0,Y.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,Y.jsxs)(Ge,{thing:e,children:[e.paused&&(0,Y.jsx)(We,{children:`paused`}),!e.active&&(0,Y.jsx)(We,{children:`off`})]}),(0,Y.jsx)(z,{text:e.description}),(0,Y.jsxs)(`dl`,{className:`space-y-1.5`,children:[(0,Y.jsx)(Z,{label:`Event`,children:fe(e.event)}),(0,Y.jsx)(Z,{label:`Scope`,children:pe(e)}),(0,Y.jsx)(Z,{label:`Delivers through`,children:(0,Y.jsx)(X,{notifier:e.notifier,connection:e.connection})}),(0,Y.jsx)(Z,{label:`Throttle`,children:de(e.throttle)}),l?(0,Y.jsx)(Be,{rule:e,onDone:()=>{c(null)},onSaved:e=>{t(e),c(null)}},e.code):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Z,{label:`Subject`,children:(0,Y.jsxs)(`span`,{className:`flex flex-wrap items-baseline gap-2`,children:[e.template===null?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`none`}):(0,Y.jsx)(`span`,{className:`font-mono text-xs break-all`,children:e.template}),(0,Y.jsx)(s,{why:u.why,children:(0,Y.jsx)(p,{variant:`ghost`,size:`xs`,disabled:!u.may,title:u.why,onClick:()=>{c(e.code)},children:`Edit`})})]})}),e.body!==null&&(0,Y.jsx)(Z,{label:`Body`,children:(0,Y.jsx)(`span`,{className:`line-clamp-3 font-mono text-xs break-words whitespace-pre-wrap`,children:e.body})})]}),(0,Y.jsx)(Z,{label:`Last sent`,children:e.last_sent_at===null?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`never`}):(0,Y.jsx)(U,{at:e.last_sent_at})})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Y.jsx)(s,{why:u.why,children:(0,Y.jsx)(p,{variant:`outline`,size:`sm`,disabled:i||!u.may,title:u.why,onClick:()=>{a(!0),be(e.code,!e.paused).then(t,H).finally(()=>{a(!1)})},children:e.paused?`Resume`:`Pause`})}),(0,Y.jsx)(s,{why:u.why,children:(0,Y.jsx)(p,{variant:`outline`,size:`sm`,disabled:!u.may,title:u.why,onClick:r,children:`Send a test`})}),(0,Y.jsx)(s,{why:u.why,children:(0,Y.jsx)(p,{variant:`outline`,size:`sm`,className:`destructive-action ml-auto`,disabled:i||!u.may,title:u.why,onClick:()=>{a(!0),xe(e.code).then(n,H).finally(()=>{a(!1)})},children:`Delete`})})]}),(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Recent deliveries`}),!f.read&&(0,Y.jsx)(`p`,{className:`text-xs text-faint`,children:`Reading from the server`}),f.read&&m.length===0&&(0,Y.jsx)(`p`,{className:`text-xs text-faint`,children:`Nothing sent.`}),(0,Y.jsx)(`ul`,{className:`divide-y divide-border`,children:m.map(e=>(0,Y.jsxs)(`li`,{className:`row-hover -mx-4 flex items-center gap-2 px-4 py-2`,children:[(0,Y.jsx)(E,{status:e.status}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs`,children:e.subject}),(0,Y.jsx)(U,{className:`shrink-0 text-xs text-faint`,at:e.created_at})]},e.id))})]})]})}function Be({rule:e,onDone:t,onSaved:n}){let[r,i]=(0,G.useState)(e.template??``),[a,o]=(0,G.useState)(e.body??``),[s,c]=(0,G.useState)(null),[l,u]=(0,G.useState)(!1),d=`alert-rule/${e.code}/body`,h=`rule-${e.code}-subject`;return(0,Y.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-border bg-secondary/30 p-3`,children:[(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(x,{htmlFor:h,children:`Subject`}),(0,Y.jsx)(m,{id:h,className:`font-mono`,spellCheck:!1,autoComplete:`off`,value:r,placeholder:`{{ run.pipeline }} run {{ run.status }}`,onChange:e=>{i(e.target.value)}}),(0,Y.jsx)(`p`,{className:`text-xs text-faint`,children:Ne})]}),(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(x,{children:`Body`}),(0,Y.jsx)(`p`,{className:`text-xs text-faint`,children:Pe}),(0,Y.jsx)(B,{name:`body`,className:`overflow-hidden rounded-md border border-border bg-background`,aside:(0,Y.jsx)(ne,{mediaType:K}),windowed:(0,Y.jsx)(A,{value:a,mediaType:K,path:d,label:`body, in a window`,className:`min-h-0 flex-1`,onChange:o}),children:(0,Y.jsx)(A,{value:a,mediaType:K,path:d,label:`body`,placeholder:`{{ run.pipeline }} ended {{ run.status }}: {{ run.url }}`,className:`h-40 min-h-32`,onChange:o})})]}),s!==null&&(0,Y.jsx)(ee,{problem:s}),(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Y.jsx)(p,{variant:`ghost`,size:`sm`,onClick:t,children:`Cancel`}),(0,Y.jsx)(p,{size:`sm`,disabled:l,onClick:()=>{let i={};if(q(r)!==e.template&&(i.template=q(r)),q(a)!==e.body&&(i.body=q(a)),Object.keys(i).length===0){t();return}u(!0),c(null),ye(e.code,i).then(n,e=>{c(f(e))}).finally(()=>{u(!1)})},children:l?`Saving`:`Save`})]})]})}function Ve({notification:e,onChanged:t}){let[n,i]=(0,G.useState)(!1),a=R();return(0,Y.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,Y.jsx)(`div`,{className:`space-y-1`,children:(0,Y.jsxs)(`p`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(E,{status:e.status}),(0,Y.jsx)(`span`,{className:`text-sm font-semibold`,children:e.subject})]})}),(0,Y.jsxs)(`dl`,{className:`space-y-1.5`,children:[e.rule===null?(0,Y.jsx)(Z,{label:`Raised by`,children:(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`a test, not a rule`})}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Z,{label:`Event`,children:fe(e.event)}),(0,Y.jsx)(Z,{label:`Rule`,children:(0,Y.jsx)(`span`,{className:`font-mono text-xs`,children:e.rule})})]}),(0,Y.jsx)(Z,{label:`Delivers through`,children:(0,Y.jsx)(X,{notifier:e.notifier,connection:e.connection})}),(0,Y.jsx)(Z,{label:`Run`,children:(0,Y.jsx)(Ue,{notification:e})}),(0,Y.jsx)(Z,{label:`Queued`,children:(0,Y.jsx)(U,{at:e.created_at})}),e.status===`sent`?(0,Y.jsx)(Z,{label:`Sent`,children:(0,Y.jsx)(U,{at:e.sent_at})}):(0,Y.jsx)(Z,{label:`Next try`,children:(0,Y.jsx)(U,{at:e.available_at})}),(0,Y.jsxs)(Z,{label:`Attempts`,children:[e.attempt,` of `,e.max_attempts]})]}),e.error!==null&&(0,Y.jsxs)(`div`,{className:`space-y-1`,children:[(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`What the channel said`}),(0,Y.jsx)(`p`,{className:`text-xs break-words text-critical`,children:e.error}),(0,Y.jsx)(`p`,{className:`text-xs text-faint`,children:`Only the latest refusal is kept. Earlier attempts are counted, not stored.`})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Y.jsx)(s,{why:a.why,children:(0,Y.jsx)(p,{variant:`outline`,size:`sm`,disabled:n||!a.may,title:a.why,onClick:()=>{i(!0),Ee(e.id).then(t,H).finally(()=>{i(!1)})},children:`Retry now`})}),e.run_id!==null&&(0,Y.jsx)(p,{variant:`outline`,size:`sm`,render:(0,Y.jsx)(r,{to:`/runs/${e.run_id}`}),children:`Open the run`})]})]})}var He=e=>e.id;function X({notifier:e,connection:t}){return(0,Y.jsxs)(`span`,{className:`flex flex-wrap items-baseline gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`text-sm`,children:e}),t!==null&&(0,Y.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:t})]})}function Ue({notification:e}){if(e.run_id===null)return(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`no run`});let t=e.run_pipeline??`a run`;return(0,Y.jsxs)(r,{className:`text-primary hover:underline`,to:`/runs/${e.run_id}`,children:[(0,Y.jsx)(`span`,{className:`text-sm`,children:t}),e.run_started_at!==null&&(0,Y.jsx)(U,{className:`ml-1.5 text-xs text-muted-foreground`,at:e.run_started_at})]})}function We({children:e}){return(0,Y.jsx)(`span`,{className:`rounded-sm border border-border px-1.5 text-xs text-muted-foreground`,children:e})}function Ge({thing:e,children:t}){let n=h(e);return(0,Y.jsxs)(`p`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:n.named?`text-sm font-semibold`:`font-mono text-sm font-semibold`,children:n.title}),t,n.code!==null&&(0,Y.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:n.code})]})}function Z({label:e,children:t}){return(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,Y.jsx)(`dt`,{className:`w-32 shrink-0 text-xs text-muted-foreground`,children:e}),(0,Y.jsx)(`dd`,{className:`min-w-0 text-sm`,children:t})]})}var Ke={good:`var(--good)`,critical:`var(--critical)`,quiet:`var(--faint)`};function qe({channels:e}){return(0,Y.jsx)(`ul`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-4`,children:e.map(e=>(0,Y.jsx)(Je,{channel:e},e.id))})}function Je({channel:e}){let t=Ae(e);return(0,Y.jsxs)(`li`,{className:`flex items-start justify-between gap-3 rounded-lg border border-border bg-card p-3`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,title:e.connection===null?e.notifier:`${e.notifier} ${e.connection}`,children:[(0,Y.jsx)(`span`,{className:`status-dot shrink-0`,style:{"--chip":Ke[t.tone]}}),(0,Y.jsx)(`span`,{className:`shrink-0 text-sm font-medium`,children:e.notifier}),e.connection!==null&&(0,Y.jsx)(`span`,{className:`truncate font-mono text-xs text-muted-foreground`,children:e.connection})]}),(0,Y.jsxs)(`span`,{className:`flex shrink-0 flex-col items-end`,children:[(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t.label}),e.last_check_at!==null&&(0,Y.jsx)(U,{className:`text-xs text-faint`,at:e.last_check_at}),t.detail!==null&&(0,Y.jsx)(`span`,{className:`max-w-48 truncate text-xs text-faint`,title:t.detail,children:t.detail})]})]})}function Q({id:e,label:t,value:n,onChange:r,placeholder:i,mono:a,hint:o}){return(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(x,{htmlFor:e,children:t}),(0,Y.jsx)(m,{id:e,className:a===!0?`font-mono`:void 0,spellCheck:!1,autoComplete:`off`,value:n,placeholder:i,onChange:e=>{r(e.target.value)}}),o!==void 0&&(0,Y.jsx)(`p`,{className:`text-xs text-faint`,children:o})]})}function Ye({id:e,notifiers:t,value:n,onChange:r}){return(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(x,{htmlFor:e,children:`Notifier`}),(0,Y.jsx)(re,{id:e,label:`Notifier`,value:n,options:t.map(e=>({value:e,label:e,aside:``})),placeholder:`Search the installed channels`,onChange:r})]})}function Xe({id:e,kind:t,value:n,onChange:r}){let i=Ze(t);return(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(x,{htmlFor:e,children:`Connection`}),(0,Y.jsx)(re,{id:e,label:`Connection`,value:n,options:i,placeholder:i.length===0?`No ${t} connection yet`:`Search by name or code`,onChange:r})]})}function Ze(e){let[t,n]=(0,G.useState)([]);return(0,G.useEffect)(()=>{if(e===``||e===`log`)return;let t=!0;return V().then(e=>{t&&n(e.items)},()=>{t&&n([])}),()=>{t=!1}},[e]),t.filter(t=>t.kind===e).map(e=>{let t=h(e);return{value:e.code,label:t.title,aside:t.code??``}})}var Qe=`0s`,$e=`alert-rule/new/body`,$=`body`;function et({open:e,onOpenChange:t,notifiers:n,onCreated:r}){let[i,a]=(0,G.useState)(``),[o,c]=(0,G.useState)(``),[l,u]=(0,G.useState)(``),[d,m]=(0,G.useState)(`run_failed`),[h,g]=(0,G.useState)(`global`),[_,v]=(0,G.useState)(``),[y,S]=(0,G.useState)(``),[E,O]=(0,G.useState)(``),[k,N]=(0,G.useState)(``),[P,F]=(0,G.useState)(``),[I,L]=(0,G.useState)(Qe),[z,V]=(0,G.useState)(null),[H,U]=(0,G.useState)(!1),ie=tt(e),ae=R(),W=D(ae.why,Le({code:i,scope:h,pipeline:_,notifier:y,connection:E,throttle:I}));return(0,Y.jsx)(b,{open:e,onOpenChange:t,children:(0,Y.jsxs)(M,{className:`flex max-h-[calc(100vh-4rem)] flex-col sm:max-w-3xl`,showCloseButton:!1,children:[(0,Y.jsx)(C,{children:(0,Y.jsx)(w,{children:`New rule`})}),(0,Y.jsxs)(`div`,{className:`-mx-1 min-h-0 flex-1 space-y-4 overflow-y-auto px-1`,children:[(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 md:grid-cols-2`,children:[(0,Y.jsx)(Q,{id:`rule-code`,label:`Code`,value:i,onChange:a,placeholder:`ops-slack-failed`,mono:!0}),(0,Y.jsx)(Q,{id:`rule-name`,label:`Name`,value:o,onChange:c,placeholder:`Tell the ops channel`})]}),(0,Y.jsx)(Q,{id:`rule-description`,label:`Description`,value:l,onChange:u,placeholder:`What this rule is for`}),(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(x,{children:`Event`}),(0,Y.jsx)(te,{label:`Event`,size:`md`,value:d,options:ce.map(e=>({value:e,label:Ie[e]})),onChoose:m})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 md:grid-cols-2`,children:[(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(x,{children:`Scope`}),(0,Y.jsx)(te,{label:`Scope`,size:`md`,value:h,options:Fe,onChoose:g})]}),h===`pipeline`&&(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(x,{htmlFor:`rule-pipeline`,children:`Pipeline`}),(0,Y.jsx)(re,{id:`rule-pipeline`,label:`Pipeline`,value:_,options:ie,placeholder:`Search by name or code`,onChange:v})]})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 md:grid-cols-2`,children:[(0,Y.jsx)(Ye,{id:`rule-notifier`,notifiers:n,value:y,onChange:e=>{S(e),O(``)}}),J(y)&&(0,Y.jsx)(Xe,{id:`rule-connection`,kind:y,value:E,onChange:O})]}),(0,Y.jsx)(Q,{id:`rule-subject`,label:`Subject`,value:k,onChange:N,placeholder:`{{ run.pipeline }} run {{ run.status }}`,mono:!0,hint:Ne}),(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(x,{children:`Body`}),(0,Y.jsx)(`p`,{className:`text-xs text-faint`,children:Pe}),(0,Y.jsx)(B,{name:$,className:`overflow-hidden rounded-md border border-border`,aside:(0,Y.jsx)(ne,{mediaType:K}),windowed:(0,Y.jsx)(A,{value:P,mediaType:K,path:$e,label:`${$}, in a window`,className:`min-h-0 flex-1`,onChange:F}),children:(0,Y.jsx)(A,{value:P,mediaType:K,path:$e,label:$,placeholder:`{{ run.pipeline }} ended {{ run.status }}: {{ run.url }}`,className:`h-40 min-h-32`,onChange:F})})]}),(0,Y.jsx)(`div`,{className:`grid grid-cols-1 gap-3 md:grid-cols-2`,children:(0,Y.jsx)(Q,{id:`rule-throttle`,label:`Throttle`,value:I,onChange:L,placeholder:`15m`,mono:!0})})]}),z!==null&&(0,Y.jsx)(ee,{problem:z}),(0,Y.jsxs)(j,{children:[(0,Y.jsx)(`p`,{className:`mr-auto self-center text-xs text-muted-foreground`,children:`A rule fires when a run settles. Nothing is sent now.`}),(0,Y.jsx)(T,{render:(0,Y.jsx)(p,{variant:`ghost`}),children:`Close`}),(0,Y.jsx)(s,{why:W,children:(0,Y.jsx)(p,{disabled:H||W!==void 0,title:W,onClick:()=>{U(!0),V(null),ve({code:i.trim(),name:q(o),description:q(l),event:d,notifier:y,scope:h,pipeline:h===`pipeline`?_:null,connection:J(y)?E:null,template:q(k),body:q(P),throttle:I.trim()}).then(()=>{r(),a(``),c(``),u(``),N(``),F(``),t(!1)},e=>{V(f(e))}).finally(()=>{U(!1)})},children:H?`Creating`:`Create`})})]})]})})}function tt(e){let[t,n]=(0,G.useState)([]);return(0,G.useEffect)(()=>{if(!e)return;let t=!0;return _().then(e=>{t&&n(e.toSorted(g).map(e=>{let t=h(e);return{value:e.code,label:t.title,aside:t.code??``}}))},()=>{t&&n([])}),()=>{t=!1}},[e]),t}var nt=1e3,rt=6e4,it=`dirigent test alert`,at={notifier:``,connection:``,subject:``};function ot({open:e,draft:t,onOpenChange:n,notifiers:r,onQueued:i,onOpenQueue:a}){let[o,c]=(0,G.useState)(t.notifier),[l,u]=(0,G.useState)(t.connection),[d,m]=(0,G.useState)(t.subject),[h,g]=(0,G.useState)(null),[_,v]=(0,G.useState)(null),[x,S]=(0,G.useState)(!1),E=ct(h),O=R(),k=E!==null&&he(E.status)?E.id:null;(0,G.useEffect)(()=>{k!==null&&i()},[k]);let A=D(O.why,Re(o,l));return(0,Y.jsx)(b,{open:e,onOpenChange:n,children:(0,Y.jsxs)(M,{className:`sm:max-w-lg`,showCloseButton:!1,children:[(0,Y.jsxs)(C,{children:[(0,Y.jsx)(w,{children:`Send a test`}),(0,Y.jsx)(y,{children:`The message goes through the same queue a real alert does, and a worker delivers it.`})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 md:grid-cols-2`,children:[(0,Y.jsx)(Ye,{id:`test-notifier`,notifiers:r,value:o,onChange:e=>{c(e),u(``)}}),J(o)&&(0,Y.jsx)(Xe,{id:`test-connection`,kind:o,value:l,onChange:u})]}),(0,Y.jsx)(Q,{id:`test-subject`,label:`Subject`,value:d,onChange:m,placeholder:it}),_!==null&&(0,Y.jsx)(ee,{problem:_}),E!==null&&(0,Y.jsx)(st,{row:E}),(0,Y.jsxs)(j,{children:[(0,Y.jsx)(T,{render:(0,Y.jsx)(p,{variant:`ghost`}),children:`Close`}),h!==null&&(0,Y.jsx)(p,{variant:`outline`,onClick:()=>{a(h)},children:`Open in the queue`}),(0,Y.jsx)(s,{why:A,children:(0,Y.jsx)(p,{disabled:x||A!==void 0,title:A,onClick:()=>{S(!0),v(null),g(null),De({notifier:o,connection:J(o)?l:null,...d.trim()===``?{}:{subject:d.trim()}}).then(e=>{g(e.notification_id),i()},e=>{v(f(e))}).finally(()=>{S(!1)})},children:h===null?`Send`:`Send again`})})]})]})})}function st({row:e}){return(0,Y.jsxs)(`div`,{className:`space-y-2 rounded-lg border border-border bg-secondary/40 p-3`,"data-testid":`test-delivery`,"aria-live":`polite`,children:[(0,Y.jsxs)(`p`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(E,{status:e.status}),(0,Y.jsx)(`span`,{className:`text-sm`,children:e.subject})]}),(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.status===`sent`?(0,Y.jsxs)(Y.Fragment,{children:[`Delivered `,(0,Y.jsx)(U,{at:e.sent_at}),`.`]}):e.status===`failed`?(0,Y.jsxs)(Y.Fragment,{children:[`Given up after `,e.attempt,` of `,e.max_attempts,` attempts.`]}):e.attempt===0?`Queued for the next worker pass.`:(0,Y.jsxs)(Y.Fragment,{children:[`Attempt `,e.attempt,` of `,e.max_attempts,`, next try`,` `,(0,Y.jsx)(U,{at:e.available_at}),`.`]})}),e.error!==null&&(0,Y.jsx)(`p`,{className:`text-xs break-words text-critical`,children:e.error})]})}function ct(e){let[t,n]=(0,G.useState)(null);return(0,G.useEffect)(()=>{if(e===null)return;let t=!0,r,i=Date.now()+rt,a=()=>{Te(e).then(o=>{t&&(n({id:e,row:o}),!(he(o.status)||Date.now()>i)&&(r=setTimeout(a,nt)))},()=>{})};return a(),()=>{t=!1,r!==void 0&&clearTimeout(r)}},[e]),t!==null&&t.id===e?t.row:null}var lt=e=>e.id,ut=e=>e.id;function dt(){return(0,Y.jsx)(ie,{children:(0,Y.jsx)(ft,{})})}function ft(){let[e,t]=(0,G.useState)(!1),[n,r]=(0,G.useState)(null),[i,a]=(0,G.useState)(null),[s,d]=(0,G.useState)(null),[f,p]=(0,G.useState)({status:``,notifier:``}),[m,h]=(0,G.useState)({}),[g,_]=(0,G.useState)({}),y=L((0,G.useCallback)(e=>_e(e),[]),lt),b=L((0,G.useCallback)(e=>we(f,e),[f]),ut),x=ht(),{reload:C}=y,{reload:w}=b,T=(0,G.useMemo)(()=>y.state.rows.map(e=>m[e.id]??e),[m,y.state.rows]),D=(0,G.useMemo)(()=>b.state.rows.map(e=>g[e.id]??e),[g,b.state.rows]),A=T.find(e=>e.id===i)??null,j=D.find(e=>e.id===s)??null,M=(0,G.useCallback)(e=>{r(t=>({draft:e,opened:(t?.opened??0)+1}))},[]);(0,G.useEffect)(()=>(O({note:null,tone:`quiet`,identifier:null}),v),[]),(0,G.useEffect)(()=>{if(A!==null){let e=A;return N([{id:`rule`,label:`Rule`,render:()=>(0,Y.jsx)(ze,{rule:e,onChanged:e=>{h(t=>({...t,[e.id]:e}))},onDeleted:()=>{a(null),C()},onTest:()=>{M({notifier:e.notifier,connection:e.connection??``,subject:``})}})}],{screen:`alerting`})}if(j!==null){let e=j;return N([{id:`notification`,label:`Notification`,render:()=>(0,Y.jsx)(Ve,{notification:e,onChanged:e=>{_(t=>({...t,[e.id]:e}))}})}],{screen:`alerting`})}},[j,A,M,C]);let z=R(`admin`),B=z.may;return(0,G.useEffect)(()=>P([...B?[{id:`alerting:rule`,title:`New alert rule`,group:I,screen:!0,icon:W,keywords:[`alert`,`event`,`create`],run:()=>{t(!0)}},{id:`alerting:test`,title:`Send a test through a channel`,group:I,screen:!0,icon:se,keywords:[`alert`,`notification`,`try`],run:()=>{M(at)}}]:[],{id:`alerting:reload`,title:`Read the alert rules again`,group:I,screen:!0,icon:S,keywords:[`refresh`,`reload`],run:()=>{C(),w()}}]),[B,M,w,C]),(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(c,{title:`Alerting`,aside:(0,Y.jsx)(l,{tag:`alerts`}),actions:[{id:`test`,label:`Send a test`,icon:se,variant:`outline`,disabled:!z.may,why:z.why,onClick:()=>{M(at)}},{id:`rule`,label:`New rule`,icon:W,disabled:!z.may,why:z.why,onClick:()=>{t(!0)}}]}),(0,Y.jsxs)(`section`,{className:`mb-6 space-y-2`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Channels`}),x.read?x.rows.length===0?(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No channel is installed.`}):(0,Y.jsx)(qe,{channels:x.rows}):(0,Y.jsx)(`p`,{className:`text-sm text-faint`,children:`Reading from the server`})]}),(0,Y.jsxs)(`section`,{className:`space-y-2`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Rules`}),(0,Y.jsx)(o,{loading:!y.state.read,problem:y.state.problem,empty:T.length===0,emptyMessage:`No rules.`,children:(0,Y.jsx)(u,{columns:gt,rows:T,rowKey:lt,rowClassName:e=>me(e)?void 0:`opacity-60`,reading:y.state.reading,next:y.state.next,onMore:y.more,noun:`rules`,onSelect:e=>{d(null),a(e.id),F()},selected:e=>e.id===i})})]}),(0,Y.jsxs)(`section`,{className:`mt-8 space-y-2`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Y.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Notifications`}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Y.jsx)(k,{label:`Status`,value:f.status,anything:`Any status`,options:le.map(e=>({value:e,label:e,mark:(0,Y.jsx)(E,{status:e})})),onChange:e=>{p(t=>({...t,status:e}))}}),(0,Y.jsx)(k,{label:`Notifier`,value:f.notifier,anything:`Any notifier`,options:mt(x.rows),onChange:e=>{p(t=>({...t,notifier:e}))}})]})]}),(0,Y.jsx)(o,{loading:!b.state.read,problem:b.state.problem,empty:D.length===0,emptyMessage:`Nothing queued.`,children:(0,Y.jsx)(u,{columns:_t,rows:D,rowKey:ut,reading:b.state.reading,next:b.state.next,onMore:b.more,noun:`notifications`,onSelect:e=>{a(null),d(e.id),F()},selected:e=>e.id===s})})]}),(0,Y.jsx)(et,{open:e,onOpenChange:t,notifiers:pt(x.rows),onCreated:C}),(0,Y.jsx)(ot,{open:n!==null,draft:n?.draft??at,onOpenChange:e=>{e||r(null)},notifiers:pt(x.rows),onQueued:w,onOpenQueue:e=>{r(null),a(null),d(e),w(),F()}},n?.opened??0)]})}function pt(e){return[...new Set(e.map(e=>e.notifier))]}function mt(e){return pt(e).map(e=>({value:e,label:e}))}function ht(){let[e,t]=(0,G.useState)(null),[n,r]=(0,G.useState)(null);return(0,G.useEffect)(()=>{let e=!0;return Oe().then(n=>{e&&t(n)},()=>{e&&t([])}),V().then(t=>{e&&r(t.items)},()=>{e&&r([])}),()=>{e=!1}},[]),{rows:(0,G.useMemo)(()=>ke(e??[],n??[]),[n,e]),read:e!==null&&n!==null}}var gt=[{id:`rule`,header:`Rule`,cell:e=>{let t=h(e);return(0,Y.jsxs)(`span`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,Y.jsx)(`span`,{className:t.named?`text-sm font-medium`:`font-mono text-sm font-medium`,children:t.title}),t.code!==null&&(0,Y.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:t.code})]})}},{id:`event`,header:`Event`,cell:e=>(0,Y.jsx)(`span`,{className:`text-sm`,children:Ie[e.event]})},{id:`scope`,header:`Scope`,cell:e=>(0,Y.jsx)(`span`,{className:e.scope===`pipeline`?`font-mono text-xs`:`text-sm`,children:pe(e)})},{id:`delivers`,header:`Delivers through`,cell:e=>(0,Y.jsx)(X,{notifier:e.notifier,connection:e.connection})},{id:`throttle`,header:`Throttle`,className:`font-mono text-xs`,cell:e=>(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:de(e.throttle)})},{id:`sent`,header:`Last sent`,className:`text-xs`,cell:e=>e.last_sent_at===null?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`never`}):(0,Y.jsx)(U,{className:`text-muted-foreground`,at:e.last_sent_at})},{id:`live`,header:`State`,cell:e=>e.paused?(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`paused`}):e.active?(0,Y.jsx)(`span`,{className:`text-xs text-good`,children:`active`}):(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`off`})}],_t=[{id:`status`,header:`Status`,cell:e=>(0,Y.jsx)(E,{status:e.status})},{id:`subject`,header:`Subject`,cell:e=>(0,Y.jsxs)(`span`,{className:`flex flex-col`,children:[(0,Y.jsx)(`span`,{className:`text-sm`,children:e.subject}),e.error!==null&&(0,Y.jsx)(`span`,{className:`max-w-96 truncate text-xs text-critical`,title:e.error,children:e.error})]})},{id:`delivers`,header:`Delivers through`,cell:e=>(0,Y.jsx)(X,{notifier:e.notifier,connection:e.connection})},{id:`run`,header:`Run`,cell:e=>(0,Y.jsx)(Ue,{notification:e})},{id:`queued`,header:`Queued`,className:`text-xs`,cell:e=>(0,Y.jsx)(U,{className:`text-muted-foreground`,at:e.created_at})},{id:`sent`,header:`Sent`,className:`text-xs`,cell:e=>e.status===`sent`?(0,Y.jsx)(U,{className:`text-muted-foreground`,at:e.sent_at}):e.attempt>0?(0,Y.jsxs)(`span`,{className:`text-faint`,children:[e.attempt,` of `,e.max_attempts,` attempts`]}):null}];export{dt as AdminAlerting};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-CQOZoUwg.js";import{n}from"./chunk-OB3PAWPO-DOp4K52_.js";import{n as r,t as i}from"./PageState-CGVhOaOE.js";import{r as a,t as o}from"./ListTable-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-CQOZoUwg.js";import{n}from"./chunk-OB3PAWPO-DOp4K52_.js";import{n as r,t as i}from"./PageState-CGVhOaOE.js";import{r as a,t as o}from"./ListTable-BykeouTl.js";import{r as s}from"./utils-CT7ZGLfR.js";import{t as c}from"./input-1fShkFXn.js";import{$ as l,_ as u,et as d,ot as f,st as p}from"./index-DBX30PmL.js";import{t as m}from"./Markdown-roa7jpVu.js";import{n as h,r as g}from"./Panel-CqrOYByl.js";import{a as _,c as v,l as y,n as b,o as x,r as S,t as C}from"./blocks-CclbVd8c.js";import{_ as w}from"./connections-BuMoMUFi.js";import{l as T,r as E}from"./examples-vNFNdfIm.js";import{t as D}from"./KindChip-CwU_Xxdy.js";var O=e(t(),1),k=s(),A=e=>e.id,j=[{key:`scheme`,title:`Storage schemes`,noun:`schemes`},{key:`notifier`,title:`Notifiers`,noun:`notifiers`},{key:`connection`,title:`Connection kinds`,noun:`connection kinds`}],M=e=>t=>`${e}:${t.id}`,N=()=>{};function P(){let[e,t]=(0,O.useState)(``),[n,s]=(0,O.useState)(null),{value:m,problem:h,read:g}=u(v),y=u(T),b=(0,O.useMemo)(()=>E(y.value??[]),[y.value]),S=(0,O.useMemo)(()=>m?.blocks??[],[m]),w=(0,O.useMemo)(()=>_(S,e),[S,e]),D=(0,O.useMemo)(()=>C(w),[w]),P=(0,O.useMemo)(()=>x(m?.storage_schemes??[],e),[m,e]),I=(0,O.useMemo)(()=>x(m?.notifiers??[],e),[m,e]),B=(0,O.useMemo)(()=>x(m?.connection_kinds??[],e),[m,e]),V=(0,O.useMemo)(()=>F(b),[b]),H=S.find(e=>`block:${e.id}`===n)??null,U={scheme:P,notifier:I,connection:B},W=j.flatMap(e=>U[e.key].map(t=>({registry:e,entry:t}))).find(({registry:e,entry:t})=>M(e.key)(t)===n)??null;(0,O.useEffect)(()=>{if(g)return d({note:null,tone:`quiet`,identifier:null}),l},[S,g,m]),(0,O.useEffect)(()=>{if(H!==null)return f([{id:`block`,label:`Block`,render:()=>(0,k.jsx)(z,{entry:H})}],{screen:`blocks`});if(W!==null){let{registry:e,entry:t}=W;return f([{id:`entry`,label:e.title,render:()=>(0,k.jsx)(R,{entry:t})}],{screen:`blocks`})}},[H,W]);let G=(0,O.useCallback)(e=>{s(`block:${e.id}`),p()},[]);return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(i,{title:`Blocks`,aside:(0,k.jsx)(a,{tag:`blocks`})}),(0,k.jsx)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:(0,k.jsx)(c,{className:`w-56`,value:e,onChange:e=>{t(e.target.value)},placeholder:`Search blocks`,"aria-label":`Search blocks by id or summary`})}),(0,k.jsx)(r,{loading:!g,problem:h,empty:w.length===0&&P.length===0&&I.length===0&&B.length===0,emptyMessage:S.length===0?`No blocks installed — plugins contribute them.`:`Nothing in the catalog matches that.`,children:(0,k.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[D.map(([e,t])=>(0,k.jsxs)(`section`,{children:[(0,k.jsx)(`h2`,{className:`mb-1.5 font-mono text-xs font-semibold tracking-wide text-faint uppercase`,children:e}),(0,k.jsx)(o,{chrome:{footer:!1},fixed:!0,columns:V,rows:t,rowKey:A,reading:!1,next:null,onMore:N,noun:`blocks`,onSelect:G,selected:e=>`block:${e.id}`===n})]},e)),j.map(e=>{let t=U[e.key];return t.length===0?null:(0,k.jsxs)(`section`,{children:[(0,k.jsx)(`h2`,{className:`mb-1.5 font-mono text-xs font-semibold tracking-wide text-faint uppercase`,children:e.title}),(0,k.jsx)(o,{chrome:{footer:!1},fixed:!0,columns:L(e.key),rows:t,rowKey:M(e.key),reading:!1,next:null,onMore:N,noun:e.noun,onSelect:t=>{s(M(e.key)(t)),p()},selected:t=>M(e.key)(t)===n})]},e.key)})]})})]})}function F(e){return[{id:`block`,header:`Block`,className:`w-full max-w-0`,cell:e=>(0,k.jsxs)(`div`,{className:`min-w-0`,children:[(0,k.jsx)(`span`,{className:`font-mono text-sm font-semibold`,children:e.id}),(0,k.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:e.summary,children:e.summary})]})},{id:`kind`,header:`Kind`,className:`w-32 whitespace-nowrap`,cell:e=>(0,k.jsx)(D,{kind:e.kind})},{id:`examples`,header:`Examples`,className:`w-28 whitespace-nowrap`,cell:t=>(0,k.jsx)(I,{id:t.id,many:e.get(t.id)??0})},{id:`plugin`,header:`Plugin`,className:`w-36 font-mono text-xs whitespace-nowrap`,cell:e=>(0,k.jsx)(`span`,{className:`text-muted-foreground`,children:e.plugin})}]}function I({id:e,many:t}){if(t===0)return(0,k.jsx)(`span`,{className:`text-xs text-faint`,children:`none`});let r=`${String(t)} ${t===1?`example`:`examples`}`;return(0,k.jsx)(n,{className:`text-xs text-primary-ink hover:underline`,to:`/examples?block=${encodeURIComponent(e)}`,title:`The shipped documents that require ${e}`,onClick:e=>{e.stopPropagation()},children:r})}function L(e){let t=e===`scheme`?`storage`:e;return[{id:`entry`,header:`Entry`,className:`w-full max-w-0`,cell:e=>{let t=typeof e.config_schema.description==`string`?e.config_schema.description:``;return(0,k.jsxs)(`div`,{className:`min-w-0`,children:[(0,k.jsx)(`span`,{className:`font-mono text-sm font-semibold`,children:e.id}),(0,k.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:t,children:t})]})}},{id:`kind`,header:`Kind`,className:`w-32 whitespace-nowrap`,cell:()=>(0,k.jsx)(D,{kind:t})},{id:`plugin`,header:`Plugin`,className:`w-36 font-mono text-xs whitespace-nowrap`,cell:e=>(0,k.jsx)(`span`,{className:`text-muted-foreground`,children:e.plugin})}]}function R({entry:e}){let t=(0,O.useMemo)(()=>w(e.config_schema),[e]),n=typeof e.config_schema.description==`string`?e.config_schema.description:null;return(0,k.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[(0,k.jsxs)(`div`,{className:`space-y-1`,children:[(0,k.jsx)(`h2`,{className:`font-mono text-sm font-semibold`,children:e.id}),n!==null&&(0,k.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n}),(0,k.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-xs`,children:(0,k.jsx)(h,{term:`plugin`,detail:e.plugin})})]}),(0,k.jsx)(g,{title:`Config`,children:t.length===0?(0,k.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This takes no configuration.`}):(0,k.jsx)(`div`,{className:`flex flex-col gap-4`,children:t.map(e=>(0,k.jsx)(B,{field:e},e.name))})})]})}function z({entry:e}){let t=(0,O.useMemo)(()=>w(e.config_schema),[e]),n=S(e);return(0,k.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[(0,k.jsxs)(`div`,{className:`space-y-1`,children:[(0,k.jsx)(`h2`,{className:`font-mono text-sm font-semibold`,children:e.id}),(0,k.jsx)(`p`,{children:(0,k.jsx)(D,{kind:e.kind})}),(0,k.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.summary})]}),(0,k.jsx)(g,{title:`Facts`,children:(0,k.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-xs`,children:n.map(e=>(0,k.jsx)(h,{term:e.term,detail:e.detail},e.term))})}),(0,k.jsx)(g,{title:`Config`,children:t.length===0?(0,k.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This block takes no configuration.`}):(0,k.jsx)(`div`,{className:`flex flex-col gap-4`,children:t.map(e=>(0,k.jsx)(B,{field:e},e.name))})})]})}function B({field:e}){let t=b(e);return(0,k.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,k.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[(0,k.jsx)(`span`,{className:`font-mono text-sm font-medium`,children:e.name}),(0,k.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:y(e)}),e.required&&(0,k.jsx)(`span`,{className:`text-xs text-primary`,children:`required`}),e.hint!==null&&(0,k.jsx)(`span`,{className:`text-xs text-faint`,children:e.hint}),t!==null&&(0,k.jsxs)(`span`,{className:`text-xs text-faint`,children:[`default `,t]})]}),e.options.length>0&&(0,k.jsx)(`p`,{className:`font-mono text-xs text-muted-foreground`,children:e.options.map(e=>e.label).join(` · `)}),e.help!==null&&(0,k.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,k.jsx)(m,{text:e.help})})]})}export{P as Blocks};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-CQOZoUwg.js";import{r as n}from"./with-selector-BXYKoaOE.js";import{c as r,l as i}from"./chunk-OB3PAWPO-DOp4K52_.js";import{a,i as o,n as s,r as c,t as l}from"./select-BZLRZoLW.js";import{n as u,o as d,t as f}from"./PageState-CGVhOaOE.js";import{r as p,t as m}from"./ListTable-CKU-ULuI.js";import{r as h}from"./utils-CT7ZGLfR.js";import{d as g,f as _}from"./paging-CpRIkEky.js";import{t as v}from"./input-1fShkFXn.js";import{t as y}from"./SchemaForm-BojGlBVc.js";import{t as b}from"./textarea-ljIbN_md.js";import{d as x,l as S,s as C}from"./format-B5YbYOY-.js";import{n as w,t as T}from"./identity-BNZxCf_y.js";import{$ as E,At as D,Dt as O,E as k,Ft as A,Mt as j,Nt as M,Ot as ee,_ as N,b as P,et as F,ft as I,jt as te,kt as ne,ot as L,pt as R,st as z,v as B,y as V}from"./index-AVwkiv9z.js";import{t as H}from"./Description-MmXUnb-9.js";import{M as re,N as U,a as W,b as G,c as K,d as q,f as J,i as ie,l as Y,m as X,o as ae,p as Z,r as oe,s as se,t as ce,u as le}from"./connections-BuMoMUFi.js";import{n as ue,t as de}from"./Refusal-7YedH2sJ.js";import{t as fe}from"./KindChip-CwU_Xxdy.js";import{t as pe}from"./Instant-mr1E5jAK.js";var me={name:`plug-zap`,size:24,node:[[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m18 3-4 4h6l-4 4`,key:`16psg9`}]],aliases:[`plug-zap-2`]};me.node;var he=n(me),Q=e(t(),1),$=h();function ge({id:e,name:t,stored:n,value:r,onChange:i}){return(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(k,{htmlFor:e,className:`font-mono text-sm font-medium`,children:t}),(0,$.jsx)(v,{id:e,type:`password`,autoComplete:`new-password`,value:r,onChange:e=>{i(e.target.value)},placeholder:n?`stored — typing replaces it, blank keeps it`:`not set — type to set one`})]})}function _e({connection:e,schema:t,onSaved:n}){let[r,i]=(0,Q.useState)(e.name??``),[a,o]=(0,Q.useState)(e.description??``),[s,c]=(0,Q.useState)(()=>ye(e)),[l,u]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(()=>new Set),[m,h]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(!1),[w,E]=(0,Q.useState)(!1),D=T(e),O=(0,Q.useMemo)(()=>ve(e,t),[e,t]),A=(0,Q.useMemo)(()=>re(O,s),[O,s]),j=V(`admin`),M=P(j.why,G(A,f)?void 0:`A setting above is not what this kind accepts.`);return(0,$.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsxs)(`p`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:D.named?`text-sm font-semibold`:`font-mono text-sm font-semibold`,children:D.title}),(0,$.jsx)(fe,{kind:e.kind}),D.code!==null&&(0,$.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:D.code})]}),(0,$.jsxs)(`p`,{className:`text-xs text-faint`,children:[`Created `,(0,$.jsx)(pe,{at:e.created_at}),x(e.created_at,e.updated_at)&&(0,$.jsxs)($.Fragment,{children:[` · updated `,(0,$.jsx)(pe,{at:e.updated_at})]})]}),(0,$.jsx)(H,{text:e.description})]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(k,{htmlFor:`connection-name`,children:`Name`}),(0,$.jsx)(v,{id:`connection-name`,value:r,onChange:e=>{i(e.target.value),E(!1)},placeholder:`What to call this on screen`}),(0,$.jsxs)(`p`,{className:`text-xs text-faint`,children:[`Display only. Every reference to this credential is by its code, `,e.code,`.`]})]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(k,{htmlFor:`connection-description`,children:`Description`}),(0,$.jsx)(b,{id:`connection-description`,className:`h-24`,value:a,onChange:e=>{o(e.target.value),E(!1)},placeholder:`What this credential is for. Markdown is rendered.`})]}),(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsx)(`p`,{className:`text-xs font-semibold tracking-wide text-faint uppercase`,children:`Settings`}),(0,$.jsx)(y,{fields:O,values:s,problems:A,onChange:(e,t)=>{c(n=>({...n,[e]:t})),E(!1)},onUnreadable:(e,t)=>{p(n=>U(n,e,t))}}),e.secret_fields.map(t=>(0,$.jsx)(ge,{id:`secret-${t}`,name:t,stored:be(e.config[t]),value:l[t]??``,onChange:e=>{u(n=>({...n,[t]:e})),E(!1)}},t))]}),m!==null&&(0,$.jsx)(de,{problem:m}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(d,{why:M,children:(0,$.jsx)(_,{size:`sm`,onClick:()=>{let t=se(e,Se(e,s,l),xe(r),xe(a));if(t===null){E(!0);return}C(!0),h(null),Z(e.code,t).then(e=>{u({}),E(!0),n(e)},e=>{h(g(e))}).finally(()=>{C(!1)})},disabled:S||M!==void 0,title:M,children:S?`Saving`:`Save`})}),w&&(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Saved.`})]})]})}function ve(e,t){let n=new Set(e.secret_fields);return t===null?Object.keys(e.config).filter(e=>!n.has(e)).map(t=>({name:t,kind:typeof e.config[t]==`string`?`text`:`json`,help:null,required:!1,nullable:!0,fallback:void 0,options:[],mediaType:null,refers:null,hint:null,placeholder:``,bounds:{},accepts:[],holds:[]})):q(t,e.secret_fields)}function ye(e){let t=new Set(e.secret_fields),n={};for(let[r,i]of Object.entries(e.config))t.has(r)||(n[r]=i);return n}function be(e){return e!=null}function xe(e){let t=e.trim();return t===``?null:t}function Se(e,t,n){let r={};for(let[n,i]of Object.entries(t))Object.is(i,e.config[n])||(r[n]=i);for(let[e,t]of Object.entries(n))t!==``&&(r[e]=t);return r}function Ce({open:e,kinds:t,onOpenChange:n,onCreated:r}){let[i,u]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(``),[x,S]=(0,Q.useState)(``),[C,w]=(0,Q.useState)({}),[T,E]=(0,Q.useState)({}),[A,N]=(0,Q.useState)(()=>new Set),[F,I]=(0,Q.useState)(()=>new Set),[L,R]=(0,Q.useState)(!1),[z,B]=(0,Q.useState)(null),[H,W]=(0,Q.useState)(!1),G=t.find(e=>e.id===m)??null,K=q(G?.config_schema??null,G?.secret_fields??[]),J=re(K,C),Y=L?void 0:A,X=V(`admin`),Z=P(X.why,we(i,m,J,F));return(0,$.jsx)(O,{open:e,onOpenChange:n,children:(0,$.jsxs)(ne,{className:`sm:max-w-xl`,showCloseButton:!1,children:[(0,$.jsxs)(j,{children:[(0,$.jsx)(M,{children:`New connection`}),(0,$.jsx)(D,{children:`Secret fields are sealed on the way in and never read back out.`})]}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(k,{htmlFor:`connection-code`,children:`Code`}),(0,$.jsx)(v,{id:`connection-code`,className:`font-mono`,value:i,onChange:e=>{u(e.target.value)},placeholder:`postman-echo`})]}),(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(k,{htmlFor:`connection-kind`,children:`Kind`}),(0,$.jsxs)(l,{value:m,onValueChange:e=>{h(String(e)),w({}),E({}),N(new Set),I(new Set),R(!1)},children:[(0,$.jsx)(o,{id:`connection-kind`,className:`w-full font-mono`,children:(0,$.jsx)(a,{placeholder:`Choose a kind`})}),(0,$.jsx)(s,{children:t.map(e=>(0,$.jsx)(c,{value:e.id,className:`font-mono`,children:e.id},e.id))})]})]})]}),(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(k,{htmlFor:`connection-name-new`,children:`Name`}),(0,$.jsx)(v,{id:`connection-name-new`,value:f,onChange:e=>{p(e.target.value)},placeholder:`What to call it on screen. Optional; nothing references it.`})]}),(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(k,{htmlFor:`connection-description-new`,children:`Description`}),(0,$.jsx)(b,{id:`connection-description-new`,className:`h-24`,value:x,onChange:e=>{S(e.target.value)},placeholder:`What this credential is for. Markdown is rendered.`})]}),G!==null&&(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsx)(`p`,{className:`text-xs font-semibold tracking-wide text-faint uppercase`,children:`Settings`}),(0,$.jsxs)(`div`,{className:`max-h-[40vh] space-y-3 overflow-y-auto pr-1`,children:[(0,$.jsx)(y,{fields:K,values:C,problems:J,stated:Y,onChange:(e,t)=>{w(n=>{let r={...n};return t===void 0?delete r[e]:r[e]=t,r})},onTouch:e=>{N(t=>t.has(e)?t:new Set(t).add(e))},onUnreadable:(e,t)=>{I(n=>U(n,e,t))}}),G.secret_fields.map(e=>(0,$.jsx)(ge,{id:`new-secret-${e}`,name:e,stored:!1,value:T[e]??``,onChange:t=>{E(n=>({...n,[e]:t}))}},e))]})]}),z!==null&&(0,$.jsx)(de,{problem:z}),(0,$.jsxs)(te,{children:[(0,$.jsx)(ee,{render:(0,$.jsx)(_,{variant:`ghost`}),children:`Close`}),(0,$.jsx)(d,{why:Z,children:(0,$.jsx)(_,{disabled:H||Z!==void 0,title:Z,onClick:()=>{R(!0),W(!0),B(null),ie({code:i.trim(),name:Te(f),kind:m,description:Te(x),config:ae(C,T)}).then(e=>{r(e),u(``),p(``),S(``),h(``),w({}),E({}),N(new Set),I(new Set),R(!1),n(!1)},e=>{B(g(e))}).finally(()=>{W(!1)})},children:H?`Creating`:`Create`})})]})]})})}function we(e,t,n,r){if(e.trim()===``)return`A connection is addressed by its code, and this one has none.`;if(t===``)return`No kind is chosen, and a connection is a credential of one kind.`;if(r.size>0)return`A setting below holds text that is not a value.`;if(!G(n,r))return`A setting below is not what its kind accepts.`}function Te(e){let t=e.trim();return t===``?null:t}var Ee=e=>e.code,De={good:`var(--good)`,critical:`var(--critical)`};function Oe(){let{code:e=null}=i(),t=r(),[n,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)({}),[c,l]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(null),{state:v,more:y,reload:b}=B(le,Ee),x=(0,Q.useMemo)(()=>v.rows.map(e=>o[e.code]??e),[o,v.rows]),S=x.find(t=>t.code===e)??null,C=(0,Q.useCallback)(()=>e===null||S!==null?Promise.resolve(null):K(e),[e,S]),w=N(C).value,T=S??(w===null?null:o[w.code]??w);(0,Q.useEffect)(()=>{e!==null&&z()},[e]);let D=(0,Q.useCallback)(e=>{s(t=>({...t,[e.code]:e}))},[]),O=(0,Q.useCallback)(e=>{l(e.code),ce(e.code).then(t=>{D(X(e,t,new Date().toISOString()))},ue).finally(()=>{l(null)})},[D]),k=e!==null||n;(0,Q.useEffect)(()=>{if(!k||h!==null)return;let e=!0;return Y().then(t=>{e&&g(t)},()=>{}),()=>{e=!1}},[h,k]),(0,Q.useEffect)(()=>{let e=oe(x);if(e===null){E();return}return F({note:e,tone:`quiet`,identifier:null}),E},[x]),(0,Q.useEffect)(()=>{if(T===null)return;let e=h?.find(e=>e.id===T.kind)?.config_schema??null;return L([{id:`connection`,label:`Connection`,render:()=>(0,$.jsx)(_e,{connection:T,schema:e,onSaved:D},T.code)}],{screen:`connections`})},[D,h,T]);let j=V(`admin`),M=j.may;(0,Q.useEffect)(()=>R([...M?[{id:`connections:new`,title:`New connection`,group:I,screen:!0,icon:he,keywords:[`credential`,`create`,`add`],run:()=>{a(!0)}}]:[],{id:`connections:reload`,title:`Read the connections listing again`,group:I,screen:!0,icon:A,keywords:[`refresh`,`reload`],run:b}]),[M,b]);let ee=(0,Q.useMemo)(()=>ke(O,c,j.why),[O,c,j.why]);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(f,{title:`Connections`,aside:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(p,{tag:`connections`}),(0,$.jsx)(d,{why:j.why,children:(0,$.jsxs)(_,{size:`sm`,"aria-label":`New connection`,disabled:!j.may,title:j.why,onClick:()=>{a(!0)},children:[(0,$.jsx)(he,{"aria-hidden":!0}),`New`]})})]})}),(0,$.jsx)(u,{loading:!v.read,problem:v.problem,empty:x.length===0,emptyMessage:`No connections.`,children:(0,$.jsx)(m,{columns:ee,rows:x,rowKey:Ee,reading:v.reading,next:v.next,onMore:y,noun:`connections`,onSelect:e=>{t(`/connections/${encodeURIComponent(e.code)}`,{replace:!0})},selected:t=>t.code===e})}),(0,$.jsx)(Ce,{open:n,kinds:h??[],onOpenChange:a,onCreated:()=>{b()}})]})}function ke(e,t,n){return[{id:`connection`,header:`Connection`,cell:e=>(0,$.jsx)(Ae,{row:e})},{id:`description`,header:`Description`,cell:e=>(0,$.jsx)(je,{description:e.description})},{id:`health`,header:`Health`,cell:e=>(0,$.jsx)(Me,{row:e})},{id:`checked`,header:`Checked`,className:`text-xs`,cell:e=>(0,$.jsx)(Ne,{row:e})},{id:`check`,header:``,className:`text-right`,cell:r=>(0,$.jsx)(d,{why:n,children:(0,$.jsx)(_,{variant:`outline`,size:`sm`,disabled:t===r.code||n!==void 0,title:n,onClick:t=>{t.stopPropagation(),e(r)},children:t===r.code?`Checking`:`Check`})})}]}function Ae({row:e}){let t=T(e);return(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:t.named?`font-semibold`:`font-mono font-semibold`,children:t.title}),(0,$.jsx)(fe,{kind:e.kind}),t.code!==null&&(0,$.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:t.code})]}),(0,$.jsx)(`p`,{className:`max-w-md truncate text-xs text-muted-foreground`,title:J(e),children:J(e)})]})}function je({description:e}){let t=e===null?``:w(e);return t===``?null:(0,$.jsx)(`p`,{className:`max-w-64 truncate text-xs text-muted-foreground`,title:t,children:t})}function Me({row:e}){let t=W(e);return t.tone===null?(0,$.jsx)(`span`,{className:`text-xs text-faint`,children:`never checked`}):(0,$.jsxs)(`span`,{className:`flex items-center gap-2 text-xs`,children:[(0,$.jsx)(`span`,{className:`status-dot`,style:{"--chip":De[t.tone]},"aria-hidden":!0}),(0,$.jsx)(`span`,{children:t.label}),t.detail!==null&&(0,$.jsx)(`span`,{className:`max-w-64 truncate text-muted-foreground`,title:t.detail,children:t.detail})]})}function Ne({row:e}){return e.last_check_at===null?null:(0,$.jsx)(`span`,{className:`text-muted-foreground`,title:C(e.last_check_at),children:S(e.last_check_at)})}export{Oe as Connections};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-CQOZoUwg.js";import{r as n}from"./with-selector-BXYKoaOE.js";import{c as r,l as i}from"./chunk-OB3PAWPO-DOp4K52_.js";import{a,i as o,n as s,r as c,t as l}from"./select-CH0-4odb.js";import{n as u,o as d,t as f}from"./PageState-CGVhOaOE.js";import{r as p,t as m}from"./ListTable-BykeouTl.js";import{r as h}from"./utils-CT7ZGLfR.js";import{d as g,f as _}from"./paging-CpRIkEky.js";import{t as v}from"./input-1fShkFXn.js";import{t as y}from"./SchemaForm-D3RjadEM.js";import{t as b}from"./textarea-ljIbN_md.js";import{d as x,l as S,s as C}from"./format-B5YbYOY-.js";import{n as w,t as T}from"./identity-BNZxCf_y.js";import{$ as E,At as D,Dt as O,E as k,Ft as A,Mt as j,Nt as M,Ot as ee,_ as N,b as P,et as F,ft as I,jt as te,kt as ne,ot as L,pt as R,st as z,v as B,y as V}from"./index-DBX30PmL.js";import{t as H}from"./Description-MmXUnb-9.js";import{M as re,N as U,a as W,b as G,c as K,d as q,f as J,i as ie,l as Y,m as X,o as ae,p as Z,r as oe,s as se,t as ce,u as le}from"./connections-BuMoMUFi.js";import{n as ue,t as de}from"./Refusal-DFh6LEQQ.js";import{t as fe}from"./KindChip-CwU_Xxdy.js";import{t as pe}from"./Instant-mr1E5jAK.js";var me={name:`plug-zap`,size:24,node:[[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m18 3-4 4h6l-4 4`,key:`16psg9`}]],aliases:[`plug-zap-2`]};me.node;var he=n(me),Q=e(t(),1),$=h();function ge({id:e,name:t,stored:n,value:r,onChange:i}){return(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(k,{htmlFor:e,className:`font-mono text-sm font-medium`,children:t}),(0,$.jsx)(v,{id:e,type:`password`,autoComplete:`new-password`,value:r,onChange:e=>{i(e.target.value)},placeholder:n?`stored — typing replaces it, blank keeps it`:`not set — type to set one`})]})}function _e({connection:e,schema:t,onSaved:n}){let[r,i]=(0,Q.useState)(e.name??``),[a,o]=(0,Q.useState)(e.description??``),[s,c]=(0,Q.useState)(()=>ye(e)),[l,u]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(()=>new Set),[m,h]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(!1),[w,E]=(0,Q.useState)(!1),D=T(e),O=(0,Q.useMemo)(()=>ve(e,t),[e,t]),A=(0,Q.useMemo)(()=>re(O,s),[O,s]),j=V(`admin`),M=P(j.why,G(A,f)?void 0:`A setting above is not what this kind accepts.`);return(0,$.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsxs)(`p`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:D.named?`text-sm font-semibold`:`font-mono text-sm font-semibold`,children:D.title}),(0,$.jsx)(fe,{kind:e.kind}),D.code!==null&&(0,$.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:D.code})]}),(0,$.jsxs)(`p`,{className:`text-xs text-faint`,children:[`Created `,(0,$.jsx)(pe,{at:e.created_at}),x(e.created_at,e.updated_at)&&(0,$.jsxs)($.Fragment,{children:[` · updated `,(0,$.jsx)(pe,{at:e.updated_at})]})]}),(0,$.jsx)(H,{text:e.description})]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(k,{htmlFor:`connection-name`,children:`Name`}),(0,$.jsx)(v,{id:`connection-name`,value:r,onChange:e=>{i(e.target.value),E(!1)},placeholder:`What to call this on screen`}),(0,$.jsxs)(`p`,{className:`text-xs text-faint`,children:[`Display only. Every reference to this credential is by its code, `,e.code,`.`]})]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(k,{htmlFor:`connection-description`,children:`Description`}),(0,$.jsx)(b,{id:`connection-description`,className:`h-24`,value:a,onChange:e=>{o(e.target.value),E(!1)},placeholder:`What this credential is for. Markdown is rendered.`})]}),(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsx)(`p`,{className:`text-xs font-semibold tracking-wide text-faint uppercase`,children:`Settings`}),(0,$.jsx)(y,{fields:O,values:s,problems:A,onChange:(e,t)=>{c(n=>({...n,[e]:t})),E(!1)},onUnreadable:(e,t)=>{p(n=>U(n,e,t))}}),e.secret_fields.map(t=>(0,$.jsx)(ge,{id:`secret-${t}`,name:t,stored:be(e.config[t]),value:l[t]??``,onChange:e=>{u(n=>({...n,[t]:e})),E(!1)}},t))]}),m!==null&&(0,$.jsx)(de,{problem:m}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(d,{why:M,children:(0,$.jsx)(_,{size:`sm`,onClick:()=>{let t=se(e,Se(e,s,l),xe(r),xe(a));if(t===null){E(!0);return}C(!0),h(null),Z(e.code,t).then(e=>{u({}),E(!0),n(e)},e=>{h(g(e))}).finally(()=>{C(!1)})},disabled:S||M!==void 0,title:M,children:S?`Saving`:`Save`})}),w&&(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Saved.`})]})]})}function ve(e,t){let n=new Set(e.secret_fields);return t===null?Object.keys(e.config).filter(e=>!n.has(e)).map(t=>({name:t,kind:typeof e.config[t]==`string`?`text`:`json`,help:null,required:!1,nullable:!0,fallback:void 0,options:[],mediaType:null,refers:null,hint:null,placeholder:``,bounds:{},accepts:[],holds:[]})):q(t,e.secret_fields)}function ye(e){let t=new Set(e.secret_fields),n={};for(let[r,i]of Object.entries(e.config))t.has(r)||(n[r]=i);return n}function be(e){return e!=null}function xe(e){let t=e.trim();return t===``?null:t}function Se(e,t,n){let r={};for(let[n,i]of Object.entries(t))Object.is(i,e.config[n])||(r[n]=i);for(let[e,t]of Object.entries(n))t!==``&&(r[e]=t);return r}function Ce({open:e,kinds:t,onOpenChange:n,onCreated:r}){let[i,u]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(``),[x,S]=(0,Q.useState)(``),[C,w]=(0,Q.useState)({}),[T,E]=(0,Q.useState)({}),[A,N]=(0,Q.useState)(()=>new Set),[F,I]=(0,Q.useState)(()=>new Set),[L,R]=(0,Q.useState)(!1),[z,B]=(0,Q.useState)(null),[H,W]=(0,Q.useState)(!1),G=t.find(e=>e.id===m)??null,K=q(G?.config_schema??null,G?.secret_fields??[]),J=re(K,C),Y=L?void 0:A,X=V(`admin`),Z=P(X.why,we(i,m,J,F));return(0,$.jsx)(O,{open:e,onOpenChange:n,children:(0,$.jsxs)(ne,{className:`sm:max-w-xl`,showCloseButton:!1,children:[(0,$.jsxs)(j,{children:[(0,$.jsx)(M,{children:`New connection`}),(0,$.jsx)(D,{children:`Secret fields are sealed on the way in and never read back out.`})]}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(k,{htmlFor:`connection-code`,children:`Code`}),(0,$.jsx)(v,{id:`connection-code`,className:`font-mono`,value:i,onChange:e=>{u(e.target.value)},placeholder:`postman-echo`})]}),(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(k,{htmlFor:`connection-kind`,children:`Kind`}),(0,$.jsxs)(l,{value:m,onValueChange:e=>{h(String(e)),w({}),E({}),N(new Set),I(new Set),R(!1)},children:[(0,$.jsx)(o,{id:`connection-kind`,className:`w-full font-mono`,children:(0,$.jsx)(a,{placeholder:`Choose a kind`})}),(0,$.jsx)(s,{children:t.map(e=>(0,$.jsx)(c,{value:e.id,className:`font-mono`,children:e.id},e.id))})]})]})]}),(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(k,{htmlFor:`connection-name-new`,children:`Name`}),(0,$.jsx)(v,{id:`connection-name-new`,value:f,onChange:e=>{p(e.target.value)},placeholder:`What to call it on screen. Optional; nothing references it.`})]}),(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(k,{htmlFor:`connection-description-new`,children:`Description`}),(0,$.jsx)(b,{id:`connection-description-new`,className:`h-24`,value:x,onChange:e=>{S(e.target.value)},placeholder:`What this credential is for. Markdown is rendered.`})]}),G!==null&&(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsx)(`p`,{className:`text-xs font-semibold tracking-wide text-faint uppercase`,children:`Settings`}),(0,$.jsxs)(`div`,{className:`max-h-[40vh] space-y-3 overflow-y-auto pr-1`,children:[(0,$.jsx)(y,{fields:K,values:C,problems:J,stated:Y,onChange:(e,t)=>{w(n=>{let r={...n};return t===void 0?delete r[e]:r[e]=t,r})},onTouch:e=>{N(t=>t.has(e)?t:new Set(t).add(e))},onUnreadable:(e,t)=>{I(n=>U(n,e,t))}}),G.secret_fields.map(e=>(0,$.jsx)(ge,{id:`new-secret-${e}`,name:e,stored:!1,value:T[e]??``,onChange:t=>{E(n=>({...n,[e]:t}))}},e))]})]}),z!==null&&(0,$.jsx)(de,{problem:z}),(0,$.jsxs)(te,{children:[(0,$.jsx)(ee,{render:(0,$.jsx)(_,{variant:`ghost`}),children:`Close`}),(0,$.jsx)(d,{why:Z,children:(0,$.jsx)(_,{disabled:H||Z!==void 0,title:Z,onClick:()=>{R(!0),W(!0),B(null),ie({code:i.trim(),name:Te(f),kind:m,description:Te(x),config:ae(C,T)}).then(e=>{r(e),u(``),p(``),S(``),h(``),w({}),E({}),N(new Set),I(new Set),R(!1),n(!1)},e=>{B(g(e))}).finally(()=>{W(!1)})},children:H?`Creating`:`Create`})})]})]})})}function we(e,t,n,r){if(e.trim()===``)return`A connection is addressed by its code, and this one has none.`;if(t===``)return`No kind is chosen, and a connection is a credential of one kind.`;if(r.size>0)return`A setting below holds text that is not a value.`;if(!G(n,r))return`A setting below is not what its kind accepts.`}function Te(e){let t=e.trim();return t===``?null:t}var Ee=e=>e.code,De={good:`var(--good)`,critical:`var(--critical)`};function Oe(){let{code:e=null}=i(),t=r(),[n,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)({}),[c,l]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(null),{state:v,more:y,reload:b}=B(le,Ee),x=(0,Q.useMemo)(()=>v.rows.map(e=>o[e.code]??e),[o,v.rows]),S=x.find(t=>t.code===e)??null,C=(0,Q.useCallback)(()=>e===null||S!==null?Promise.resolve(null):K(e),[e,S]),w=N(C).value,T=S??(w===null?null:o[w.code]??w);(0,Q.useEffect)(()=>{e!==null&&z()},[e]);let D=(0,Q.useCallback)(e=>{s(t=>({...t,[e.code]:e}))},[]),O=(0,Q.useCallback)(e=>{l(e.code),ce(e.code).then(t=>{D(X(e,t,new Date().toISOString()))},ue).finally(()=>{l(null)})},[D]),k=e!==null||n;(0,Q.useEffect)(()=>{if(!k||h!==null)return;let e=!0;return Y().then(t=>{e&&g(t)},()=>{}),()=>{e=!1}},[h,k]),(0,Q.useEffect)(()=>{let e=oe(x);if(e===null){E();return}return F({note:e,tone:`quiet`,identifier:null}),E},[x]),(0,Q.useEffect)(()=>{if(T===null)return;let e=h?.find(e=>e.id===T.kind)?.config_schema??null;return L([{id:`connection`,label:`Connection`,render:()=>(0,$.jsx)(_e,{connection:T,schema:e,onSaved:D},T.code)}],{screen:`connections`})},[D,h,T]);let j=V(`admin`),M=j.may;(0,Q.useEffect)(()=>R([...M?[{id:`connections:new`,title:`New connection`,group:I,screen:!0,icon:he,keywords:[`credential`,`create`,`add`],run:()=>{a(!0)}}]:[],{id:`connections:reload`,title:`Read the connections listing again`,group:I,screen:!0,icon:A,keywords:[`refresh`,`reload`],run:b}]),[M,b]);let ee=(0,Q.useMemo)(()=>ke(O,c,j.why),[O,c,j.why]);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(f,{title:`Connections`,aside:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(p,{tag:`connections`}),(0,$.jsx)(d,{why:j.why,children:(0,$.jsxs)(_,{size:`sm`,"aria-label":`New connection`,disabled:!j.may,title:j.why,onClick:()=>{a(!0)},children:[(0,$.jsx)(he,{"aria-hidden":!0}),`New`]})})]})}),(0,$.jsx)(u,{loading:!v.read,problem:v.problem,empty:x.length===0,emptyMessage:`No connections.`,children:(0,$.jsx)(m,{columns:ee,rows:x,rowKey:Ee,reading:v.reading,next:v.next,onMore:y,noun:`connections`,onSelect:e=>{t(`/connections/${encodeURIComponent(e.code)}`,{replace:!0})},selected:t=>t.code===e})}),(0,$.jsx)(Ce,{open:n,kinds:h??[],onOpenChange:a,onCreated:()=>{b()}})]})}function ke(e,t,n){return[{id:`connection`,header:`Connection`,cell:e=>(0,$.jsx)(Ae,{row:e})},{id:`description`,header:`Description`,cell:e=>(0,$.jsx)(je,{description:e.description})},{id:`health`,header:`Health`,cell:e=>(0,$.jsx)(Me,{row:e})},{id:`checked`,header:`Checked`,className:`text-xs`,cell:e=>(0,$.jsx)(Ne,{row:e})},{id:`check`,header:``,className:`text-right`,cell:r=>(0,$.jsx)(d,{why:n,children:(0,$.jsx)(_,{variant:`outline`,size:`sm`,disabled:t===r.code||n!==void 0,title:n,onClick:t=>{t.stopPropagation(),e(r)},children:t===r.code?`Checking`:`Check`})})}]}function Ae({row:e}){let t=T(e);return(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:t.named?`font-semibold`:`font-mono font-semibold`,children:t.title}),(0,$.jsx)(fe,{kind:e.kind}),t.code!==null&&(0,$.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:t.code})]}),(0,$.jsx)(`p`,{className:`max-w-md truncate text-xs text-muted-foreground`,title:J(e),children:J(e)})]})}function je({description:e}){let t=e===null?``:w(e);return t===``?null:(0,$.jsx)(`p`,{className:`max-w-64 truncate text-xs text-muted-foreground`,title:t,children:t})}function Me({row:e}){let t=W(e);return t.tone===null?(0,$.jsx)(`span`,{className:`text-xs text-faint`,children:`never checked`}):(0,$.jsxs)(`span`,{className:`flex items-center gap-2 text-xs`,children:[(0,$.jsx)(`span`,{className:`status-dot`,style:{"--chip":De[t.tone]},"aria-hidden":!0}),(0,$.jsx)(`span`,{children:t.label}),t.detail!==null&&(0,$.jsx)(`span`,{className:`max-w-64 truncate text-muted-foreground`,title:t.detail,children:t.detail})]})}function Ne({row:e}){return e.last_check_at===null?null:(0,$.jsx)(`span`,{className:`text-muted-foreground`,title:C(e.last_check_at),children:S(e.last_check_at)})}export{Oe as Connections};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-CQOZoUwg.js";import{c as n,n as r}from"./chunk-OB3PAWPO-DOp4K52_.js";import{i,n as a,r as o,t as ee}from"./PageState-CGVhOaOE.js";import{r as te,t as s}from"./ListTable-BykeouTl.js";import{r as c,t as l}from"./utils-CT7ZGLfR.js";import{t as u}from"./use-store-CfRquqZF.js";import{t as d}from"./auth-CHgfcdt9.js";import{v as ne}from"./format-B5YbYOY-.js";import{t as re}from"./use-heartbeat-CBT8848s.js";import{t as f}from"./identity-BNZxCf_y.js";import{d as p}from"./pipelines-DaeuXRxg.js";import{Ft as m,S as h,_ as g,dt as _,l as v,m as y,pt as b,t as x,u as S}from"./index-DBX30PmL.js";import{n as C,r as w,u as T}from"./connections-BuMoMUFi.js";import{t as E}from"./Instant-mr1E5jAK.js";import{f as D,i as O,p as k,r as A,s as j,t as M,u as ie}from"./TileCard-gP1CtcIG.js";import{a as ae,i as N,r as P}from"./workers-BH2Za19E.js";import{f as F,s as I}from"./triggers-B42obFCk.js";var L=e(t(),1),R=c(),z={neutral:`bg-muted-foreground`,good:`bg-good`,info:`bg-info`,warning:`bg-warning`,critical:`bg-critical`};function B({rows:e,note:t,reading:n}){let a=u(d).identity?.role??null;return(0,R.jsx)(o,{className:`gap-0 p-0`,children:(0,R.jsxs)(i,{className:`flex h-full flex-col p-0`,children:[(0,R.jsxs)(`div`,{className:`space-y-1 px-3 py-3`,children:[(0,R.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Health`}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n?`Reading from the server`:`The workers claiming work, and every connection.`})]}),(0,R.jsx)(`ul`,{className:`max-h-64 grow overflow-y-auto`,children:e.map(e=>{let t=e.kind===`connection`?`/connections`:a===`admin`?`/admin/workers`:null,n=(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:l(`size-2 shrink-0 rounded-full`,z[e.tone]),"aria-hidden":!0}),(0,R.jsx)(`span`,{className:`max-w-[55%] shrink-0 truncate font-mono text-xs`,title:e.label,children:e.label}),(0,R.jsxs)(`span`,{className:`ml-auto flex min-w-0 items-baseline gap-2`,children:[(0,R.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,title:e.detail,children:e.detail}),e.at!==null&&(0,R.jsx)(E,{className:`shrink-0 text-xs text-faint`,at:e.at})]})]});return(0,R.jsx)(`li`,{className:`border-t border-border`,children:t===null?(0,R.jsx)(`span`,{className:`flex items-center gap-3 px-3 py-1.5`,children:n}):(0,R.jsx)(r,{to:t,className:`control-link flex items-center gap-3 px-3 py-1.5 hover:bg-accent/60`,children:n})},`${e.kind}:${e.id}`)})}),(0,R.jsx)(`p`,{className:`border-t border-border px-3 py-2 text-xs text-muted-foreground`,children:t})]})})}function V(e,t){return`${String(e)}${t.next===null?``:`+`}`}function H(e,t){return e===0?`neutral`:t}function U(e,t){return e.items.filter(e=>e.status===t).length}function W(e,t,n){let r=(t,n,r)=>{if(e===null)return null;let i=U(e,t);return{id:t,label:n,value:V(i,e),note:``,tone:H(i,r),to:S({...x,status:t,since:`24h`})}},i=(e,t,n,r,i)=>{if(i===null)return null;let a=i.items.length;return{id:e,label:t,value:V(a,i),note:a===0?``:r,tone:H(a,n),to:S({...x,status:e})}};return[{id:`runs`,tile:e===null?null:{id:`runs`,label:`Runs`,value:V(e.items.length,e),note:`Last 24 hours.`,tone:`neutral`,to:S({...x,since:`24h`})}},{id:`succeeded`,tile:r(`succeeded`,`Succeeded`,`good`)},{id:`failed`,tile:r(`failed`,`Failed`,`critical`)},{id:`completed_with_errors`,tile:r(`completed_with_errors`,`With errors`,`warning`)},{id:`running`,tile:i(`running`,`Running`,`info`,`Being worked on now.`,t)},{id:`queued`,tile:i(`queued`,`Queued`,`neutral`,`Waiting for a worker.`,n)}]}var G=36e5,K=864e5;function q(e,t){let n=e+t*6e4;return Math.floor(n/G)*G-t*6e4}function J(e,t){let n=e+t*6e4;return Math.floor((n%K+K)%K/G)}function oe(e,t,n,r=24){let i=q(t.getTime(),n)-(r-1)*G,a=Array.from({length:r},(e,t)=>{let r=i+t*G;return{start:r,hour:J(r,n),succeeded:0,withErrors:0,failed:0,total:0}});for(let t of e){let e=Date.parse(t.created_at);if(Number.isNaN(e))continue;let n=Math.floor((e-i)/G);if(n<0||n>=r)continue;let o=a[n];o.total+=1,t.status===`succeeded`?o.succeeded+=1:t.status===`completed_with_errors`?o.withErrors+=1:t.status===`failed`&&(o.failed+=1)}return a}function Y(e){return e.succeeded+e.withErrors+e.failed}function se(e){return e.reduce((e,t)=>Math.max(e,Y(t)),0)}function ce(e){let t=t=>e.reduce((e,n)=>e+t(n),0),n=t(e=>e.total);if(n===0)return`No run was started in the last 24 hours.`;let r=[`${String(t(e=>e.succeeded))} succeeded`,`${String(t(e=>e.withErrors))} finished with errors`,`${String(t(e=>e.failed))} failed`];return`${String(n)} runs started in the last 24 hours, by the hour: ${r.join(`, `)}.`}function le(e,t){let n=e.map(e=>{let t=P(e);return{id:e.id,kind:`worker`,label:e.name,tone:t===null?`good`:O(t),detail:t===null?`worker · ${String(e.concurrency)} ${e.concurrency===1?`slot`:`slots`}`:N(t),at:t===null?null:e.last_seen_at}}),r=t.map(e=>{let t=e.last_check_healthy;return{id:e.id,kind:`connection`,label:e.code,tone:t===null?`neutral`:t?`good`:`critical`,detail:t===null?`never checked`:e.last_check_detail??(t?`healthy`:`did not answer`),at:e.last_check_at}});return[...n,...r]}function ue(e,t){let n=e.filter(e=>P(e)===null).length,{healthy:r,total:i}=C(t),a=[];if(e.length===0?a.push(`no worker has registered`):n<e.length&&a.push(`${String(n)} of ${String(e.length)} workers healthy`),r<i){let e=w(t,`connections`);e!==null&&a.push(e)}if(a.length>0){let e=a.join(` · `);return`${e.charAt(0).toUpperCase()}${e.slice(1)}.`}return t.length===0?`Every worker is healthy, and this instance holds no connections.`:`Every worker and every connection is healthy.`}function de(e,t,n=6){return[...e,...t].toSorted((e,t)=>Date.parse(t.created_at)-Date.parse(e.created_at)).slice(0,n)}function fe(e,t=6){return e.flatMap(e=>{let t=I(e.schedule);return t.kind===`due`?[{...e,at:t.at}]:[]}).toSorted((e,t)=>Date.parse(e.at)-Date.parse(t.at)).slice(0,t)}async function X(e){let t=e.filter(e=>e.schedules>0);return(await Promise.all(t.map(async e=>(await F(e.code,null)).items.map(t=>({pipeline:e.code,schedule:t}))))).flat()}async function pe(){let e=await p(null);return{pipelines:e.items,schedules:await X(e.items)}}var me=6,Z=[{id:`failed`,label:`Failed`,fill:`bg-status-failed/80`},{id:`withErrors`,label:`With errors`,fill:`bg-status-completed-with-errors/80`},{id:`succeeded`,label:`Succeeded`,fill:`bg-status-succeeded/75`}];function he(e){let t=`${String(e.hour).padStart(2,`0`)}:00`;if(e.total===0)return`${t} — nothing ran`;let n=Z.filter(t=>e[t.id]>0).map(t=>`${String(e[t.id])} ${t.label.toLowerCase()}`),r=n.length===0?`none finished`:n.join(`, `);return`${t} — ${String(e.total)} started, ${r}`}function ge({buckets:e,reading:t,className:n}){let r=se(e);return(0,R.jsx)(o,{className:l(`gap-0 p-0`,n),children:(0,R.jsxs)(i,{className:`space-y-3 p-3`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1`,children:[(0,R.jsxs)(`div`,{className:`space-y-1`,children:[(0,R.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Runs over time`}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t?`Reading from the server`:`Every run started in the last 24 hours, by the hour it started in.`})]}),(0,R.jsx)(`ul`,{className:`flex items-center gap-3`,children:Z.map(e=>(0,R.jsxs)(`li`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,R.jsx)(`span`,{className:l(`size-2 shrink-0 rounded-sm`,e.fill),"aria-hidden":!0}),e.label]},e.id))})]}),(0,R.jsx)(`div`,{className:`flex h-32 items-end gap-px`,role:`img`,"aria-label":ce(e),children:e.map(e=>(0,R.jsxs)(`div`,{className:`flex h-full flex-1 flex-col justify-end rounded-sm hover:bg-accent/40`,title:he(e),children:[Z.map(t=>e[t.id]===0?null:(0,R.jsx)(`div`,{className:l(`min-h-0.5 w-full`,t.fill),style:{height:`${String(e[t.id]/Math.max(r,1)*100)}%`}},t.id)),Y(e)===0&&(0,R.jsx)(`div`,{className:`h-px w-full bg-border`})]},e.start))}),(0,R.jsx)(`div`,{className:`flex gap-px font-mono text-xs text-faint`,"aria-hidden":!0,children:e.map((e,t)=>(0,R.jsx)(`span`,{className:`flex-1 text-center`,children:t%me===0?`${String(e.hour).padStart(2,`0`)}`:``},e.start))})]})})}function _e(){let e=g((0,L.useCallback)(()=>v({...x,since:`24h`},null,500),[])),t=g((0,L.useCallback)(()=>v({...x,status:`running`},null),[])),r=g((0,L.useCallback)(()=>v({...x,status:`queued`},null),[])),i=g((0,L.useCallback)(()=>v({...x,status:`failed`},null),[])),o=g((0,L.useCallback)(()=>v({...x,status:`completed_with_errors`},null),[])),c=g(pe),d=g((0,L.useCallback)(()=>ae(null),[])),f=g((0,L.useCallback)(()=>T(null),[])),{again:p}=e,{again:h}=t,{again:S}=r,{again:C}=i,{again:w}=o,{again:E}=c,{again:O}=d,{again:N}=f,P=(0,L.useCallback)(()=>{p(),h(),S(),C(),w(),E(),O(),N()},[E,N,p,C,w,S,h,O]);(0,L.useEffect)(()=>b([{id:`dashboard:refresh`,title:`Refresh the dashboard`,group:_,screen:!0,icon:m,keywords:[`refresh`,`reload`,`home`],run:P}]),[P]);let F=n();re(P,u(y));let I=de(t.value?.items??[],r.value?.items??[]),z=ie(j(i.value?.items??[],o.value?.items??[]),c.value?.pipelines??[]),V=fe(c.value?.schedules??[]),H=W(e.value,t.value,r.value),U=new Date,G=oe(e.value?.items??[],U,ne(U)),K=d.problem===null&&f.problem===null;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(ee,{title:`Dashboard`,aside:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(te,{tag:`runs`}),(0,R.jsx)(k,{onRefresh:P})]})}),(0,R.jsx)(`div`,{className:`mb-3 grid grid-cols-2 gap-3 sm:grid-cols-3 xl:grid-cols-6`,children:H.map(e=>e.tile===null?(0,R.jsx)(A,{},e.id):(0,R.jsx)(M,{tile:e.tile},e.id))}),(0,R.jsxs)(`div`,{className:`mb-6 grid gap-3 lg:grid-cols-3`,children:[(0,R.jsx)(`div`,{className:l(K?`lg:col-span-2`:`lg:col-span-3`),children:e.problem===null?(0,R.jsx)(ge,{buckets:G,reading:!e.read}):(0,R.jsx)(a,{loading:!1,problem:e.problem,empty:!1,children:null})}),K&&(0,R.jsx)(B,{rows:le(d.value?.items??[],f.value?.items??[]),note:ue(d.value?.items??[],f.value?.items??[]),reading:!d.read||!f.read})]}),(0,R.jsx)(Q,{title:`Right now`,to:`/runs`,children:(0,R.jsx)(a,{loading:!t.read||!r.read,problem:t.problem??r.problem,empty:I.length===0,emptyMessage:`Nothing is running and nothing is waiting.`,children:(0,R.jsx)(s,{chrome:{footer:!1},columns:ve,rows:I,rowKey:e=>e.id,reading:!1,next:null,onMore:$,noun:`runs`,onSelect:e=>void F(`/runs/${e.id}`)})})}),(0,R.jsx)(Q,{title:`Needs a look`,to:`/runs`,children:(0,R.jsx)(a,{loading:!i.read||!o.read,problem:i.problem??o.problem,empty:z.length===0,emptyMessage:`Nothing has failed or finished with errors.`,children:(0,R.jsx)(s,{chrome:{footer:!1},columns:D,rows:z,rowKey:e=>e.run.id,reading:!1,next:null,onMore:$,noun:`runs`,onSelect:e=>void F(`/runs/${e.run.id}`)})})}),(0,R.jsx)(Q,{title:`Next fires`,to:`/triggers`,children:(0,R.jsx)(a,{loading:!c.read,problem:c.problem,empty:V.length===0,emptyMessage:`No schedule is due to fire.`,children:(0,R.jsx)(s,{chrome:{footer:!1},columns:ye,rows:V,rowKey:e=>`${e.pipeline}:${e.schedule.code}`,reading:!1,next:null,onMore:$,noun:`firings`,onSelect:e=>void F(`/pipelines/${encodeURIComponent(e.pipeline)}`)})})})]})}function Q({title:e,to:t,children:n}){return(0,R.jsxs)(`section`,{className:`mb-6 space-y-2 last:mb-0`,children:[(0,R.jsx)(`div`,{className:`space-y-1`,children:(0,R.jsx)(`h2`,{className:`text-sm font-semibold`,children:(0,R.jsx)(r,{to:t,className:`hover:text-primary`,children:e})})}),n]})}var $=()=>{},ve=[{id:`status`,header:`Status`,cell:e=>(0,R.jsx)(h,{status:e.status})},{id:`pipeline`,header:`Pipeline`,cell:e=>(0,R.jsx)(`span`,{className:`font-mono text-sm`,children:f({code:e.pipeline}).title})},{id:`since`,header:`Since`,className:`text-right`,cell:e=>(0,R.jsx)(E,{className:`text-xs text-faint`,at:e.started_at??e.created_at})}],ye=[{id:`pipeline`,header:`Pipeline`,cell:e=>(0,R.jsx)(`span`,{className:`font-mono text-sm`,children:f({code:e.pipeline}).title})},{id:`schedule`,header:`Schedule`,cell:e=>{let t=f(e.schedule);return(0,R.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,R.jsx)(`span`,{className:l(`truncate text-xs`,t.named?`text-foreground`:`font-mono`),children:t.title}),t.code!==null&&(0,R.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:t.code})]})}},{id:`fires`,header:`Fires`,className:`text-right`,cell:e=>(0,R.jsx)(E,{className:`text-xs text-faint`,at:e.at})}];export{_e as Dashboard};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-CQOZoUwg.js";import{n}from"./PageState-CGVhOaOE.js";import{r,t as i}from"./utils-CT7ZGLfR.js";import{f as a}from"./paging-CpRIkEky.js";import{t as o}from"./identity-BNZxCf_y.js";import{T as s,_ as c,it as l}from"./index-DBX30PmL.js";import{t as u}from"./Description-MmXUnb-9.js";import{n as d,r as f}from"./Panel-CqrOYByl.js";import{t as p}from"./badge-BovCxjd1.js";import{t as m}from"./WindowedPane-DJe_7m8A.js";import{f as h,n as g,u as _}from"./examples-vNFNdfIm.js";import{t as v}from"./starters-CgC7I45V.js";var y=e(t(),1),b=r(),x=`The document`,S={connection:`connection`,schema:`schema`,block:`block`,pipeline:`pipeline`,storage:`storage`,worker:`worker tag`};function C({example:e,holdings:t,onUse:r}){let C=e.code,E=c((0,y.useCallback)(()=>_(C),[C])),D=o(e),O=(0,y.useMemo)(()=>h(e.requires,t),[e.requires,t]),k=g(e),A=e.tags.filter(e=>e!==v),j=E.value?.source??``;return(0,b.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[(0,b.jsxs)(`div`,{className:`space-y-1`,children:[(0,b.jsx)(`h2`,{className:i(`text-sm font-semibold`,!D.named&&`font-mono`),children:D.title}),D.code!==null&&(0,b.jsx)(`p`,{className:`font-mono text-xs text-muted-foreground`,children:D.code}),(e.starter||k!==null)&&(0,b.jsxs)(`p`,{className:`flex flex-wrap items-center gap-2 pt-0.5`,children:[e.starter&&(0,b.jsx)(p,{variant:`outline`,children:`Starter`}),k!==null&&(0,b.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:k})]}),(0,b.jsx)(u,{text:e.description})]}),A.length>0&&(0,b.jsx)(`p`,{className:`flex flex-wrap items-center gap-1`,children:A.map(e=>(0,b.jsx)(s,{tag:e},e))}),(0,b.jsx)(f,{title:`Facts`,children:(0,b.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-xs`,children:[(0,b.jsx)(d,{term:`plugin`,detail:e.plugin}),(0,b.jsx)(d,{term:`shelf`,detail:e.shelf===``?`the root`:e.shelf}),E.value!==null&&(0,b.jsx)(d,{term:`path`,detail:(0,b.jsx)(`span`,{className:`font-mono break-all`,children:E.value.path})})]})}),(0,b.jsx)(f,{title:`Requires`,children:O.length===0?(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`This document requires nothing in particular of an instance.`}):(0,b.jsx)(`ul`,{className:`space-y-1 text-xs`,children:O.map(e=>(0,b.jsxs)(`li`,{className:`flex items-baseline gap-2`,children:[(0,b.jsx)(`span`,{className:`text-faint`,children:S[e.kind]}),(0,b.jsx)(`span`,{className:`font-mono break-all`,children:e.name}),(0,b.jsx)(`span`,{className:i(`ml-auto shrink-0`,T(e)),children:w(e)})]},`${e.kind}:${e.name}`))})}),(0,b.jsx)(f,{title:`Source`,children:!E.read||E.problem!==null?(0,b.jsx)(n,{loading:!E.read,problem:E.problem,empty:!1,children:null}):(0,b.jsx)(m,{name:x,className:`overflow-hidden rounded-md border border-border`,windowed:(0,b.jsx)(l,{value:j,path:`example-${C}-window`,label:`${x}, in a window`,className:`min-h-0 flex-1`,readOnly:!0}),children:(0,b.jsx)(l,{value:j,path:`example-${C}`,label:x,className:`h-72 min-h-40`,readOnly:!0})})}),e.starter&&(0,b.jsx)(a,{size:`sm`,className:`self-start`,disabled:E.value===null,onClick:()=>{r(j,C)},children:`Use as starter`})]})}function w(e){return e.met===null?`not checked`:e.met?`here`:`missing`}function T(e){return e.met===null?`text-faint`:e.met?`text-good`:`text-critical`}export{C as ExamplePanel};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ExamplePanel-
|
|
2
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-CQOZoUwg.js";import{t as n}from"./preload-helper-BZ1Pz5am.js";import{c as r,u as i}from"./chunk-OB3PAWPO-DOp4K52_.js";import{n as a}from"./nav-i7bJ0lrA.js";import{n as o,t as s}from"./PageState-CGVhOaOE.js";import{r as c,t as l}from"./ListTable-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ExamplePanel-D3yktwnO.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/react-CQOZoUwg.js","assets/PageState-CGVhOaOE.js","assets/with-selector-BXYKoaOE.js","assets/dropdown-menu-B-6CcHKw.js","assets/api-Bm1JZLuC.js","assets/utils-CT7ZGLfR.js","assets/paging-CpRIkEky.js","assets/identity-BNZxCf_y.js","assets/index-DBX30PmL.js","assets/dist-DD8kpv1W.js","assets/preload-helper-BZ1Pz5am.js","assets/chunk-OB3PAWPO-DOp4K52_.js","assets/nav-i7bJ0lrA.js","assets/play-CPVSEWx6.js","assets/file-braces-Ep8AP5Yq.js","assets/chevron-down-DAO3SUWv.js","assets/ListTable-BykeouTl.js","assets/docs-CCoB3shg.js","assets/x-Dltw6Vbs.js","assets/tooltip-D7_KwbOU.js","assets/input-1fShkFXn.js","assets/textarea-ljIbN_md.js","assets/use-store-CfRquqZF.js","assets/store-C2zgoyrT.js","assets/auth-CHgfcdt9.js","assets/format-B5YbYOY-.js","assets/status-Ctx8x8Mf.js","assets/use-heartbeat-CBT8848s.js","assets/pipelines-DaeuXRxg.js","assets/index-Cf-yM9K1.css","assets/Description-MmXUnb-9.js","assets/Panel-CqrOYByl.js","assets/copy-BeBwg8IR.js","assets/badge-BovCxjd1.js","assets/WindowedPane-DJe_7m8A.js","assets/maximize-2-BdFIT4cn.js","assets/examples-vNFNdfIm.js","assets/blocks-CclbVd8c.js","assets/connections-BuMoMUFi.js","assets/schemas-7KY_7aIc.js","assets/starters-CgC7I45V.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-CQOZoUwg.js";import{t as n}from"./preload-helper-BZ1Pz5am.js";import{c as r,u as i}from"./chunk-OB3PAWPO-DOp4K52_.js";import{n as a}from"./nav-i7bJ0lrA.js";import{n as o,t as s}from"./PageState-CGVhOaOE.js";import{r as c,t as l}from"./ListTable-BykeouTl.js";import{r as u,t as d}from"./utils-CT7ZGLfR.js";import{t as f}from"./input-1fShkFXn.js";import{n as p,t as m}from"./identity-BNZxCf_y.js";import{$ as h,Ft as ee,Lt as g,T as _,_ as v,ct as y,et as b,ft as x,g as S,ot as C,pt as w,w as te,x as T}from"./index-DBX30PmL.js";import{t as E}from"./badge-BovCxjd1.js";import{_ as D,a as O,c as k,d as A,f as j,h as M,i as N,l as P,n as F,o as I,p as L,s as R,t as z}from"./examples-vNFNdfIm.js";import{n as B,t as V}from"./starters-CgC7I45V.js";import{t as H}from"./Segmented-u0lpCZgQ.js";var U=e(t(),1),W=u(),G=(0,U.lazy)(()=>n(()=>import(`./ExamplePanel-D3yktwnO.js`).then(e=>({default:e.ExamplePanel})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42]))),K=`example`,q=()=>{},J=e=>e.code,Y=[{value:`all`,label:`All`},{value:`starters`,label:`Starters`}];function X(){let e=r(),[t,n]=i(),[u,d]=(0,U.useState)(null),p=(0,U.useMemo)(()=>N(t),[t]),m=(0,U.useCallback)(e=>{n(k(e),{replace:!0})},[n]),T=v(P),E=v(A),O=(0,U.useMemo)(()=>E.value??{blocks:null,connections:null,schemas:null},[E.value]),j=(0,U.useMemo)(()=>T.value??[],[T.value]),F=(0,U.useMemo)(()=>I(j,p),[p,j]),L=(0,U.useMemo)(()=>M(j),[j]),V=(0,U.useMemo)(()=>R(j),[j]),X=(0,U.useMemo)(()=>D(j),[j]),Q=(0,U.useCallback)(e=>{p.tags.includes(e)||m({...p,tags:[...p.tags,e]})},[m,p]),re=(0,U.useMemo)(()=>ne(O,V,Q),[Q,O,V]),$=(0,U.useCallback)((t,n)=>{e(a,{state:{document:B(t,n)}})},[e]);return(0,U.useEffect)(()=>(b({note:null,tone:`quiet`,identifier:null}),h),[j.length]),(0,U.useEffect)(()=>w([{id:`examples:starters`,title:`Show only the starters`,group:x,screen:!0,icon:g,keywords:[`starter`,`copy`,`new`],run:()=>{m({...p,starters:!0})}},{id:`examples:clear`,title:`Clear the filters on the examples listing`,group:x,screen:!0,icon:ee,keywords:[`reset`,`all`],run:()=>{m({needle:``,tags:[],shelf:``,plugin:``,starters:!1,block:``})}}]),[m,p]),(0,U.useEffect)(()=>{if(u!==null)return C([{id:K,label:`Example`,render:()=>(0,W.jsx)(U.Suspense,{fallback:(0,W.jsx)(Z,{}),children:(0,W.jsx)(G,{example:u,holdings:O,onUse:$},u.code)})}],{screen:`examples`})},[u,O,$]),(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(s,{title:`Examples`,aside:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(c,{tag:`examples`}),F.length!==j.length&&(0,W.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[String(F.length),` of `,String(j.length)]})]})}),(0,W.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(f,{className:`w-56`,value:p.needle,onChange:e=>{m({...p,needle:e.target.value})},placeholder:`Search examples`,"aria-label":`Search examples by code, name, description or tag`}),(0,W.jsx)(H,{label:`Which documents`,value:p.starters?`starters`:`all`,options:Y,onChoose:e=>{m({...p,starters:e===`starters`})}}),(0,W.jsx)(te,{chosen:p.tags,offered:X,onChange:e=>{m({...p,tags:e})}}),(0,W.jsx)(S,{label:`Shelf`,value:p.shelf,anything:`Any shelf`,options:L.map(e=>({value:e,label:e})),onChange:e=>{m({...p,shelf:e===``?``:e})}}),V.length>1&&(0,W.jsx)(S,{label:`Plugin`,value:p.plugin,anything:`Any plugin`,options:V.map(e=>({value:e,label:e})),onChange:e=>{m({...p,plugin:e===``?``:e})}}),p.block!==``&&(0,W.jsx)(_,{tag:p.block,label:`Stop narrowing to ${p.block}`,onSelect:()=>{m({...p,block:``})}})]}),(0,W.jsx)(o,{loading:!T.read,problem:T.problem,empty:F.length===0,emptyMessage:j.length===0?`No examples installed — plugins contribute them.`:z(p)?`Nothing in the corpus matches that.`:`No examples.`,children:(0,W.jsx)(l,{columns:re,rows:F,rowKey:J,reading:!1,next:null,onMore:q,noun:`examples`,onSelect:e=>{d(e),y(K)},selected:e=>e.code===u?.code})})]})}function Z(){return(0,W.jsx)(`div`,{className:`p-4`,children:(0,W.jsx)(o,{loading:!0,problem:null,empty:!1,children:null})})}function ne(e,t,n){return[{id:`example`,header:`Example`,className:`w-full max-w-0`,cell:e=>{let t=m(e),n=F(e);return(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`span`,{className:d(`truncate font-semibold`,`max-lg:overflow-visible max-lg:whitespace-normal`,!t.named&&`font-mono`),title:t.title,children:t.title}),e.starter&&(0,W.jsx)(E,{variant:`outline`,className:`shrink-0`,children:`Starter`}),n!==null&&(0,W.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,title:`An instance refuses a document that carries these, so a copy names them under requires instead.`,children:n})]}),(0,W.jsxs)(`p`,{className:`flex items-center gap-2 text-xs`,children:[t.code!==null&&(0,W.jsx)(`span`,{className:`font-mono text-muted-foreground`,children:t.code}),e.description!==null&&(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-muted-foreground`,title:p(e.description),children:p(e.description)})]})]})}},{id:`tags`,header:`Tags`,cell:e=>(0,W.jsx)(T,{tags:e.tags.filter(e=>e!==V),onSelect:n})},{id:`requires`,header:`Requires`,className:`whitespace-nowrap`,cell:t=>(0,W.jsx)(Q,{example:t,holdings:e})},...t.length>1?[{id:`plugin`,header:`Plugin`,className:`w-32 font-mono text-xs whitespace-nowrap`,cell:e=>(0,W.jsx)(`span`,{className:`text-muted-foreground`,children:e.plugin})}]:[]]}function Q({example:e,holdings:t}){let n=j(e.requires,t),r=L(n);if(r===null)return null;let i=O(n);return(0,W.jsx)(`span`,{className:d(`text-xs`,i===0?`text-muted-foreground`:`text-critical`),children:r})}export{X as Examples};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-CQOZoUwg.js";import{t as n}from"./maximize-2-BdFIT4cn.js";import{r,t as i}from"./utils-CT7ZGLfR.js";import{f as a}from"./paging-CpRIkEky.js";import{Dt as o,Nt as s,it as c,kt as l}from"./index-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-CQOZoUwg.js";import{t as n}from"./maximize-2-BdFIT4cn.js";import{r,t as i}from"./utils-CT7ZGLfR.js";import{f as a}from"./paging-CpRIkEky.js";import{Dt as o,Nt as s,it as c,kt as l}from"./index-DBX30PmL.js";var u=e(t(),1),d=r();function f({title:e,text:t,mediaType:r,path:i}){let[f,p]=(0,u.useState)(!1);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a,{variant:`ghost`,size:`icon`,"aria-label":`Open ${e} in a window`,className:`absolute top-1.5 right-3.5 size-6 rounded-md border border-border bg-background/90 text-faint`,onClick:()=>{p(!0)},children:(0,d.jsx)(n,{className:`size-3.5`,"aria-hidden":!0})}),(0,d.jsx)(o,{open:f,onOpenChange:p,children:(0,d.jsxs)(l,{finalFocus:!1,className:`flex h-[85vh] w-[min(64rem,90vw)] max-w-[min(64rem,90vw)] flex-col gap-3 sm:max-w-[min(64rem,90vw)]`,children:[(0,d.jsx)(s,{className:`font-mono text-sm`,children:e}),(0,d.jsx)(c,{value:t,mediaType:r,path:i,label:e,readOnly:!0,className:`min-h-0 flex-1`})]})})]})}var p=/("(?:[^"\\]|\\.)*")(\s*:)?|(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)|(true|false|null)/g;function m(e){let t=[],n=0;for(let r of e.matchAll(p)){r.index>n&&t.push({kind:`punctuation`,text:e.slice(n,r.index)});let[,i,a,o,s]=r;i===void 0?o===void 0?s!==void 0&&t.push({kind:`literal`,text:s}):t.push({kind:`number`,text:o}):(t.push({kind:a===void 0?`string`:`key`,text:i}),a!==void 0&&t.push({kind:`punctuation`,text:a})),n=r.index+r[0].length}return n<e.length&&t.push({kind:`punctuation`,text:e.slice(n)}),t}var h={key:`text-info-ink`,string:`text-good-ink`,number:`text-warning-ink`,literal:`text-warning-ink`,punctuation:`text-muted-foreground`};function g({title:e,text:t,className:n}){let r=(0,u.useMemo)(()=>m(t),[t]);return(0,d.jsxs)(`div`,{className:`relative`,children:[(0,d.jsx)(`pre`,{className:i(`overflow-auto rounded-lg border border-border bg-background p-2 font-mono text-xs`,n),children:r.map((e,t)=>(0,d.jsx)(`span`,{className:h[e.kind],children:e.text},t))}),(0,d.jsx)(f,{title:e,text:t,mediaType:`application/json`,path:`window/${e}`})]})}export{g as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-CQOZoUwg.js";import{r as n}from"./with-selector-BXYKoaOE.js";import{s as r}from"./PageState-CGVhOaOE.js";import{r as i,t as a}from"./utils-CT7ZGLfR.js";import{f as o,o as s}from"./paging-CpRIkEky.js";import{i as c}from"./docs-CCoB3shg.js";var l={name:`external-link`,size:24,node:[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]};l.node;var u=n(l),d=i();function f({tag:e}){return(0,d.jsxs)(`a`,{className:`control-link inline-flex items-center gap-1 rounded-sm border border-border px-3 py-0.5 text-xs text-muted-foreground hover:bg-secondary hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none md:px-1.5`,href:c(e),target:`_blank`,rel:`noreferrer`,title:`The ${e} section of this instance's API documentation`,children:[`API`,(0,d.jsx)(u,{className:`size-3`,"aria-hidden":!0})]})}var p=e(t(),1),m=(0,p.createContext)(0);function h({width:e,children:t}){return(0,d.jsx)(m,{value:e,children:t})}function g(){return(0,p.use)(m)}function _({className:e,containerClassName:t,...n}){return(0,d.jsx)(`div`,{"data-slot":`table-container`,className:a(`relative w-full overflow-x-auto`,t),children:(0,d.jsx)(`table`,{"data-slot":`table`,className:a(`w-full caption-bottom text-sm`,e),...n})})}function v({className:e,...t}){return(0,d.jsx)(`thead`,{"data-slot":`table-header`,className:a(`[&_tr]:border-b`,e),...t})}function y({className:e,...t}){return(0,d.jsx)(`tbody`,{"data-slot":`table-body`,className:a(`[&_tr:last-child]:border-0`,e),...t})}function b({className:e,...t}){return(0,d.jsx)(`tr`,{"data-slot":`table-row`,className:a(`border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted`,e),...t})}function x({className:e,...t}){return(0,d.jsx)(`th`,{"data-slot":`table-head`,className:a(`h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0`,e),...t})}function S({className:e,...t}){return(0,d.jsx)(`td`,{"data-slot":`table-cell`,className:a(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,e),...t})}function C(e){let[t,n]=(0,p.useState)(0);return(0,p.useEffect)(()=>{if(e===null||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(e=>{let t=e[0]?.contentRect;t!==void 0&&n(t.width)});return t.observe(e),()=>{t.disconnect()}},[e]),t}var w=`300px`;function T(e){return e.cardLabel===void 0?typeof e.header==`string`&&e.header!==``?e.header:null:e.cardLabel}function E(e){return e!=null&&e!==!1&&e!==``}function D({chrome:e,fixed:t,columns:n,rows:i,rowKey:c,rowClassName:l,reading:u,next:f,onMore:m,noun:g,onSelect:D,selected:O}){let[k,A]=(0,p.useState)(null);(0,p.useEffect)(()=>{if(k===null)return;let e=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&m()},{rootMargin:w});return e.observe(k),()=>{e.disconnect()}},[m,k]);let j=e=>D===void 0?{}:{tabIndex:0,"aria-selected":O?.(e),onClick:()=>{D(e)},onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&t.target===t.currentTarget&&(t.preventDefault(),D(e))}},M=n[0],N=n.slice(1),P=r(),[F,I]=(0,p.useState)(null),L=C(F);return(0,d.jsx)(h,{width:L,children:(0,d.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden rounded-md border border-border-strong bg-card`,children:[(0,d.jsxs)(`div`,{ref:I,className:`list-scroll @container min-h-0 flex-1 overflow-auto`,children:[P&&M!==void 0?(0,d.jsx)(`ul`,{className:`divide-y divide-border`,children:i.map(e=>(0,d.jsxs)(`li`,{...j(e),className:a(`row-hover flex min-h-finger flex-col justify-center gap-2 px-3 py-3`,O?.(e)===!0&&`bg-accent/70`,D!==void 0&&`cursor-pointer`,l?.(e)),children:[(0,d.jsx)(`div`,{className:`min-w-0`,children:M.cell(e)}),N.some(t=>E(t.cell(e)))&&(0,d.jsx)(`dl`,{className:`grid grid-cols-[7rem_minmax(0,1fr)] gap-x-3 gap-y-1 text-xs`,children:N.map(t=>{let n=t.cell(e);if(!E(n))return null;let r=T(t);return(0,d.jsxs)(p.Fragment,{children:[(0,d.jsx)(`dt`,{className:`text-faint`,children:r}),(0,d.jsx)(`dd`,{className:`min-w-0`,children:n})]},t.id)})})]},c(e)))}):(0,d.jsxs)(_,{containerClassName:`overflow-x-visible`,className:a(t&&`table-fixed`),children:[e?.header!==!1&&(0,d.jsx)(v,{className:`sticky top-0 z-10 bg-card`,children:(0,d.jsx)(b,{className:`border-border-strong hover:bg-transparent`,children:n.map(e=>(0,d.jsx)(x,{className:a(`px-3 text-xs font-medium text-muted-foreground`,e.className),children:e.header},e.id))})}),(0,d.jsx)(y,{children:i.map(e=>(0,d.jsx)(b,{className:a(`row-hover border-border`,O?.(e)===!0?`bg-accent/70 even:bg-accent/70 hover:bg-accent/70`:a(`even:bg-secondary/30`,D!==void 0&&`hover:bg-accent/60`),D!==void 0&&`cursor-pointer`,l?.(e)),...j(e),children:n.map(t=>(0,d.jsx)(S,{className:a(`px-3 py-2`,t.className),children:t.cell(e)},t.id))},c(e)))})]}),f!==null&&(0,d.jsx)(`div`,{ref:A,className:`border-t border-border p-1.5`,children:(0,d.jsx)(o,{variant:`ghost`,size:`sm`,className:`w-full text-muted-foreground`,onClick:m,disabled:u,children:u?`Reading`:`Load 50 more`})})]}),e?.footer!==!1&&(0,d.jsx)(`div`,{className:`shrink-0 border-t border-border px-3 py-2 text-xs text-faint`,children:s(i.length,g,f!==null)})]})})}export{g as n,f as r,D as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-CQOZoUwg.js";import{c as n}from"./chunk-OB3PAWPO-DOp4K52_.js";import{n as r,t as i}from"./PageState-CGVhOaOE.js";import{r as a,t as o}from"./ListTable-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./react-CQOZoUwg.js";import{c as n}from"./chunk-OB3PAWPO-DOp4K52_.js";import{n as r,t as i}from"./PageState-CGVhOaOE.js";import{r as a,t as o}from"./ListTable-BykeouTl.js";import{r as s}from"./utils-CT7ZGLfR.js";import{t as c}from"./use-store-CfRquqZF.js";import{t as l}from"./use-heartbeat-CBT8848s.js";import{d as u}from"./pipelines-DaeuXRxg.js";import{$ as d,Ft as f,_ as p,et as m,l as h,m as g,pt as _,t as v,ut as y,v as b}from"./index-DBX30PmL.js";import{u as x}from"./connections-BuMoMUFi.js";import{a as S,c as ee,d as C,f as w,l as T,n as E,o as D,p as O,r as k,s as A,u as j}from"./TileCard-gP1CtcIG.js";import{a as M}from"./workers-BH2Za19E.js";import{t as N}from"./AdminOnly-922QAPCr.js";import{t as P}from"./WorkersTable-CSwkoqDd.js";var F=e(t(),1),I=s(),L=e=>e.id,R=()=>{};function z(){return(0,I.jsx)(N,{children:(0,I.jsx)(B,{})})}function B(){let e=p((0,F.useCallback)(()=>h({...v,since:`24h`},null,500),[])),t=p((0,F.useCallback)(()=>h({...v,status:`failed`},null),[])),s=p((0,F.useCallback)(()=>h({...v,status:`completed_with_errors`},null),[])),N=p((0,F.useCallback)(()=>x(null),[])),z=p((0,F.useCallback)(()=>u(null,[],500),[])),B=b((0,F.useCallback)(e=>M(e),[]),L),{again:V,value:H,problem:U,read:W}=e,{again:G}=t,{again:K}=s,{again:q}=N,{again:J}=z,{reload:Y}=B,X=(0,F.useCallback)(()=>{V(),G(),K(),q(),J(),Y()},[q,V,G,K,J,Y]),Z=n();l(X,c(g)),(0,F.useEffect)(()=>(m({note:null,tone:`quiet`,identifier:null}),d),[]),(0,F.useEffect)(()=>_([{id:`admin:reload`,title:`Refresh the overview`,group:y,screen:!0,icon:f,keywords:[`refresh`,`reload`,`dashboard`],run:X}]),[X]);let Q=[{id:`day`,tile:H===null?null:D(H)},{id:`now`,tile:H===null?null:ee(H)},{id:`workers`,tile:B.state.read?C({items:B.state.rows,next:B.state.next}):null},{id:`connections`,tile:N.value===null?null:S(N.value)},{id:`schedules`,tile:z.value===null?null:T(z.value)}],$=j(A(t.value?.items??[],s.value?.items??[]),z.value?.items??[]);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(i,{title:`Overview`,aside:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(a,{tag:`system`}),(0,I.jsx)(O,{onRefresh:X})]})}),(0,I.jsx)(`div`,{className:`mb-6 grid gap-3 sm:grid-cols-2 xl:grid-cols-5`,children:Q.map(e=>e.tile===null?(0,I.jsx)(k,{},e.id):(0,I.jsx)(E,{tile:e.tile},e.id))}),W&&U!==null&&(0,I.jsx)(r,{loading:!1,problem:U,empty:!1,children:null}),(0,I.jsxs)(`section`,{className:`mb-6 space-y-2`,children:[(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Needs a look`}),(0,I.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Every run that failed or finished with errors, newest first.`})]}),(0,I.jsx)(r,{loading:!t.read||!s.read,problem:t.problem??s.problem,empty:$.length===0,emptyMessage:`Nothing has failed or finished with errors.`,children:(0,I.jsx)(o,{chrome:{footer:!1},columns:w,rows:$,rowKey:e=>e.run.id,reading:!1,next:null,onMore:R,noun:`runs`,onSelect:e=>void Z(`/runs/${e.run.id}`)})})]}),(0,I.jsxs)(`section`,{className:`space-y-2`,children:[(0,I.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Workers`}),(0,I.jsx)(P,{state:B.state,more:B.more,empty:`No workers. Start one with dg worker; nothing is claimed until one registers.`})]})]})}export{z as AdminOverview};
|