prefect 3.6.14.dev6__py3-none-any.whl → 3.6.14.dev7__py3-none-any.whl
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.
- prefect/_build_info.py +3 -3
- prefect/server/ui-v2/assets/{artifact-card-fXxwNG3f.js → artifact-card-9Cw_dMVb.js} +2 -2
- prefect/server/ui-v2/assets/{artifact-card-fXxwNG3f.js.map → artifact-card-9Cw_dMVb.js.map} +1 -1
- prefect/server/ui-v2/assets/{artifact._id-BIyzb0Jb.js → artifact._id-zuZ8P2RD.js} +2 -2
- prefect/server/ui-v2/assets/{artifact._id-BIyzb0Jb.js.map → artifact._id-zuZ8P2RD.js.map} +1 -1
- prefect/server/ui-v2/assets/{automation-wizard-bDZICLpV.js → automation-wizard-D7nVgckT.js} +2 -2
- prefect/server/ui-v2/assets/{automation-wizard-bDZICLpV.js.map → automation-wizard-D7nVgckT.js.map} +1 -1
- prefect/server/ui-v2/assets/{automation._id-CmDL_Eta.js → automation._id-BhEFaDc6.js} +2 -2
- prefect/server/ui-v2/assets/{automation._id-CmDL_Eta.js.map → automation._id-BhEFaDc6.js.map} +1 -1
- prefect/server/ui-v2/assets/{automation_._id.edit-DY7_SAuk.js → automation_._id.edit-CffnUlbj.js} +2 -2
- prefect/server/ui-v2/assets/{automation_._id.edit-DY7_SAuk.js.map → automation_._id.edit-CffnUlbj.js.map} +1 -1
- prefect/server/ui-v2/assets/{automations-header-CgxOgR53.js → automations-header-qb94agIp.js} +2 -2
- prefect/server/ui-v2/assets/{automations-header-CgxOgR53.js.map → automations-header-qb94agIp.js.map} +1 -1
- prefect/server/ui-v2/assets/{base-job-template-form-section-DilLn1Ul.js → base-job-template-form-section-DdDSFAJa.js} +2 -2
- prefect/server/ui-v2/assets/{base-job-template-form-section-DilLn1Ul.js.map → base-job-template-form-section-DdDSFAJa.js.map} +1 -1
- prefect/server/ui-v2/assets/{block-type-details-Cx4npO8Y.js → block-type-details-2rIqbqoZ.js} +2 -2
- prefect/server/ui-v2/assets/{block-type-details-Cx4npO8Y.js.map → block-type-details-2rIqbqoZ.js.map} +1 -1
- prefect/server/ui-v2/assets/block-type-logo-DV1pSkV0.js +2 -0
- prefect/server/ui-v2/assets/{block-type-logo-FrtMLMYr.js.map → block-type-logo-DV1pSkV0.js.map} +1 -1
- prefect/server/ui-v2/assets/{block._id-CWi9g5N3.js → block._id-OeCbdPeL.js} +2 -2
- prefect/server/ui-v2/assets/{block._id-CWi9g5N3.js.map → block._id-OeCbdPeL.js.map} +1 -1
- prefect/server/ui-v2/assets/{block_._id.edit-wf0QVPUL.js → block_._id.edit-CD22VllN.js} +2 -2
- prefect/server/ui-v2/assets/{block_._id.edit-wf0QVPUL.js.map → block_._id.edit-CD22VllN.js.map} +1 -1
- prefect/server/ui-v2/assets/{catalog-Iv1gLDUd.js → catalog-Dj7lYV7b.js} +2 -2
- prefect/server/ui-v2/assets/{catalog-Iv1gLDUd.js.map → catalog-Dj7lYV7b.js.map} +1 -1
- prefect/server/ui-v2/assets/{catalog_._slug-DEHFXZzp.js → catalog_._slug-NLgWS8vG.js} +2 -2
- prefect/server/ui-v2/assets/{catalog_._slug-DEHFXZzp.js.map → catalog_._slug-NLgWS8vG.js.map} +1 -1
- prefect/server/ui-v2/assets/{catalog_._slug_.create-C-vFPUOy.js → catalog_._slug_.create-D0vc1Piy.js} +2 -2
- prefect/server/ui-v2/assets/{catalog_._slug_.create-C-vFPUOy.js.map → catalog_._slug_.create-D0vc1Piy.js.map} +1 -1
- prefect/server/ui-v2/assets/{collapsible-BlEqjqQu.js → collapsible-Dgk2Qvjj.js} +2 -2
- prefect/server/ui-v2/assets/{collapsible-BlEqjqQu.js.map → collapsible-Dgk2Qvjj.js.map} +1 -1
- prefect/server/ui-v2/assets/{concurrency-limit._id-VfgyonlO.js → concurrency-limit._id-BZiyM0NT.js} +2 -2
- prefect/server/ui-v2/assets/{concurrency-limit._id-VfgyonlO.js.map → concurrency-limit._id-BZiyM0NT.js.map} +1 -1
- prefect/server/ui-v2/assets/{create-fSiDZ1kD.js → create-1j1-8yhV.js} +2 -2
- prefect/server/ui-v2/assets/{create-fSiDZ1kD.js.map → create-1j1-8yhV.js.map} +1 -1
- prefect/server/ui-v2/assets/{create-CC32TiFK.js → create-H21iiYVl.js} +2 -2
- prefect/server/ui-v2/assets/{create-CC32TiFK.js.map → create-H21iiYVl.js.map} +1 -1
- prefect/server/ui-v2/assets/{data-table-B2NqBPUR.js → data-table-DHlbTUL7.js} +2 -2
- prefect/server/ui-v2/assets/{data-table-B2NqBPUR.js.map → data-table-DHlbTUL7.js.map} +1 -1
- prefect/server/ui-v2/assets/delete-confirmation-dialog-B9-8JHV7.js +2 -0
- prefect/server/ui-v2/assets/{delete-confirmation-dialog-jlBI67Pk.js.map → delete-confirmation-dialog-B9-8JHV7.js.map} +1 -1
- prefect/server/ui-v2/assets/{deployment-action-header-C203ndcC.js → deployment-action-header-DlD2GSJB.js} +2 -2
- prefect/server/ui-v2/assets/{deployment-action-header-C203ndcC.js.map → deployment-action-header-DlD2GSJB.js.map} +1 -1
- prefect/server/ui-v2/assets/{deployment-form-DB4i73UE.js → deployment-form-CFcOIeIi.js} +3 -3
- prefect/server/ui-v2/assets/{deployment-form-DB4i73UE.js.map → deployment-form-CFcOIeIi.js.map} +1 -1
- prefect/server/ui-v2/assets/{deployment-links-UZYTtmnK.js → deployment-links-DN2Oa0r1.js} +2 -2
- prefect/server/ui-v2/assets/{deployment-links-UZYTtmnK.js.map → deployment-links-DN2Oa0r1.js.map} +1 -1
- prefect/server/ui-v2/assets/{deployment._id-Drmf70gG.js → deployment._id-C8NPwIIQ.js} +2 -2
- prefect/server/ui-v2/assets/{deployment._id-Drmf70gG.js.map → deployment._id-C8NPwIIQ.js.map} +1 -1
- prefect/server/ui-v2/assets/{deployment._id-Bk44iuUn.js → deployment._id-DsVQUPNp.js} +2 -2
- prefect/server/ui-v2/assets/{deployment._id-Bk44iuUn.js.map → deployment._id-DsVQUPNp.js.map} +1 -1
- prefect/server/ui-v2/assets/deployment_._id.duplicate-4uYFgdPg.js +2 -0
- prefect/server/ui-v2/assets/{deployment_._id.duplicate-aUHtHuNO.js.map → deployment_._id.duplicate-4uYFgdPg.js.map} +1 -1
- prefect/server/ui-v2/assets/deployment_._id.edit-Z859_W76.js +2 -0
- prefect/server/ui-v2/assets/{deployment_._id.edit-CPRKkA-W.js.map → deployment_._id.edit-Z859_W76.js.map} +1 -1
- prefect/server/ui-v2/assets/{deployment_._id.run-C8EGDJeT.js → deployment_._id.run-MW5q2SRM.js} +2 -2
- prefect/server/ui-v2/assets/{deployment_._id.run-C8EGDJeT.js.map → deployment_._id.run-MW5q2SRM.js.map} +1 -1
- prefect/server/ui-v2/assets/{dropdown-menu-CT6uZu-V.js → dropdown-menu-DF4QR3Cp.js} +2 -2
- prefect/server/ui-v2/assets/{dropdown-menu-CT6uZu-V.js.map → dropdown-menu-DF4QR3Cp.js.map} +1 -1
- prefect/server/ui-v2/assets/{event-resource-display-DmCKu0PD.js → event-resource-display-DR3zL_k_.js} +2 -2
- prefect/server/ui-v2/assets/{event-resource-display-DmCKu0PD.js.map → event-resource-display-DR3zL_k_.js.map} +1 -1
- prefect/server/ui-v2/assets/{event._eventDate._eventId-DqO9viGu.js → event._eventDate._eventId-DfU7SalU.js} +2 -2
- prefect/server/ui-v2/assets/{event._eventDate._eventId-DqO9viGu.js.map → event._eventDate._eventId-DfU7SalU.js.map} +1 -1
- prefect/server/ui-v2/assets/flow-run-graph-Bf9t75GK.js +2 -0
- prefect/server/ui-v2/assets/{flow-run-graph-CIvkp1kl.js.map → flow-run-graph-Bf9t75GK.js.map} +1 -1
- prefect/server/ui-v2/assets/flow-run._id-33WKPXsZ.js +4 -0
- prefect/server/ui-v2/assets/flow-run._id-33WKPXsZ.js.map +1 -0
- prefect/server/ui-v2/assets/{flow-run._id-xahYswsG.js → flow-run._id-DTsj_xO3.js} +2 -2
- prefect/server/ui-v2/assets/{flow-run._id-xahYswsG.js.map → flow-run._id-DTsj_xO3.js.map} +1 -1
- prefect/server/ui-v2/assets/{flow-run._id-DyUEsBSd.js → flow-run._id-RL0qeSLl.js} +2 -2
- prefect/server/ui-v2/assets/{flow-run._id-DyUEsBSd.js.map → flow-run._id-RL0qeSLl.js.map} +1 -1
- prefect/server/ui-v2/assets/{flow-runs-pagination--FfnMca3.js → flow-runs-pagination-Bfelp8UO.js} +2 -2
- prefect/server/ui-v2/assets/{flow-runs-pagination--FfnMca3.js.map → flow-runs-pagination-Bfelp8UO.js.map} +1 -1
- prefect/server/ui-v2/assets/{flow._id-C_ho4p55.js → flow._id-DuQ5AUjj.js} +2 -2
- prefect/server/ui-v2/assets/{flow._id-C_ho4p55.js.map → flow._id-DuQ5AUjj.js.map} +1 -1
- prefect/server/ui-v2/assets/{form-CxD6-5Qf.js → form-DHWphysD.js} +2 -2
- prefect/server/ui-v2/assets/{form-CxD6-5Qf.js.map → form-DHWphysD.js.map} +1 -1
- prefect/server/ui-v2/assets/{header-iN9gVtk7.js → header-B9SuuoZx.js} +2 -2
- prefect/server/ui-v2/assets/{header-iN9gVtk7.js.map → header-B9SuuoZx.js.map} +1 -1
- prefect/server/ui-v2/assets/{header-CYjjmMrB.js → header-BK_NuSng.js} +2 -2
- prefect/server/ui-v2/assets/{header-CYjjmMrB.js.map → header-BK_NuSng.js.map} +1 -1
- prefect/server/ui-v2/assets/{header-Cjet3B6Z.js → header-nu-ZKuen.js} +2 -2
- prefect/server/ui-v2/assets/{header-Cjet3B6Z.js.map → header-nu-ZKuen.js.map} +1 -1
- prefect/server/ui-v2/assets/{index-CfMaY6sy.js → index-BCR-yD58.js} +2 -2
- prefect/server/ui-v2/assets/{index-CfMaY6sy.js.map → index-BCR-yD58.js.map} +1 -1
- prefect/server/ui-v2/assets/{index-ltOkPb3X.js → index-BPXdHXTb.js} +2 -2
- prefect/server/ui-v2/assets/{index-ltOkPb3X.js.map → index-BPXdHXTb.js.map} +1 -1
- prefect/server/ui-v2/assets/{index-CTeNzxT9.js → index-BqwU5GSv.js} +2 -2
- prefect/server/ui-v2/assets/{index-CTeNzxT9.js.map → index-BqwU5GSv.js.map} +1 -1
- prefect/server/ui-v2/assets/index-Br7MUvka.css +1 -0
- prefect/server/ui-v2/assets/{index-D-yYhKPg.js → index-C0MMjoUe.js} +2 -2
- prefect/server/ui-v2/assets/{index-D-yYhKPg.js.map → index-C0MMjoUe.js.map} +1 -1
- prefect/server/ui-v2/assets/{index-0opjCZAR.js → index-CPFMHkRh.js} +2 -2
- prefect/server/ui-v2/assets/{index-0opjCZAR.js.map → index-CPFMHkRh.js.map} +1 -1
- prefect/server/ui-v2/assets/{index-D8SbV2Tp.js → index-CYjH7t93.js} +2 -2
- prefect/server/ui-v2/assets/{index-D8SbV2Tp.js.map → index-CYjH7t93.js.map} +1 -1
- prefect/server/ui-v2/assets/{index-BF3HB5BS.js → index-Cj5ihRiw.js} +2 -2
- prefect/server/ui-v2/assets/{index-BF3HB5BS.js.map → index-Cj5ihRiw.js.map} +1 -1
- prefect/server/ui-v2/assets/{index-d9_i_klL.js → index-CqUa3fbN.js} +2 -2
- prefect/server/ui-v2/assets/{index-d9_i_klL.js.map → index-CqUa3fbN.js.map} +1 -1
- prefect/server/ui-v2/assets/{index-CSQa2wYx.js → index-DFS5GNpT.js} +2 -2
- prefect/server/ui-v2/assets/{index-CSQa2wYx.js.map → index-DFS5GNpT.js.map} +1 -1
- prefect/server/ui-v2/assets/{index-B5eJQPOP.js → index-DNuhJlQK.js} +2 -2
- prefect/server/ui-v2/assets/{index-B5eJQPOP.js.map → index-DNuhJlQK.js.map} +1 -1
- prefect/server/ui-v2/assets/{index-DQOPH4Rq.js → index-DSBmxhwG.js} +2 -2
- prefect/server/ui-v2/assets/{index-DQOPH4Rq.js.map → index-DSBmxhwG.js.map} +1 -1
- prefect/server/ui-v2/assets/{index-CT2kL3dS.js → index-DVsNA4UN.js} +2 -2
- prefect/server/ui-v2/assets/{index-CT2kL3dS.js.map → index-DVsNA4UN.js.map} +1 -1
- prefect/server/ui-v2/assets/{index-D4df3B9r.js → index-DWGx9irM.js} +2 -2
- prefect/server/ui-v2/assets/{index-D4df3B9r.js.map → index-DWGx9irM.js.map} +1 -1
- prefect/server/ui-v2/assets/{index-Cwd5Gvad.js → index-DcMpyvW7.js} +2 -2
- prefect/server/ui-v2/assets/{index-Cwd5Gvad.js.map → index-DcMpyvW7.js.map} +1 -1
- prefect/server/ui-v2/assets/{index-C2ayqOiQ.js → index-Dl_iSX0z.js} +2 -2
- prefect/server/ui-v2/assets/{index-C2ayqOiQ.js.map → index-Dl_iSX0z.js.map} +1 -1
- prefect/server/ui-v2/assets/{index-DI-aZXNg.js → index-DsK1RlS9.js} +2 -2
- prefect/server/ui-v2/assets/{index-DI-aZXNg.js.map → index-DsK1RlS9.js.map} +1 -1
- prefect/server/ui-v2/assets/{index-C3A0XavU.js → index-DtrQRjt_.js} +2 -2
- prefect/server/ui-v2/assets/{index-C3A0XavU.js.map → index-DtrQRjt_.js.map} +1 -1
- prefect/server/ui-v2/assets/{index-nxDkMXcY.js → index-_0OOjqn5.js} +13 -13
- prefect/server/ui-v2/assets/index-_0OOjqn5.js.map +1 -0
- prefect/server/ui-v2/assets/{index-BfXKkd3I.js → index-mj9GNKt7.js} +2 -2
- prefect/server/ui-v2/assets/{index-BfXKkd3I.js.map → index-mj9GNKt7.js.map} +1 -1
- prefect/server/ui-v2/assets/{index-D0ANIqVp.js → index-vRbn9rG4.js} +2 -2
- prefect/server/ui-v2/assets/{index-D0ANIqVp.js.map → index-vRbn9rG4.js.map} +1 -1
- prefect/server/ui-v2/assets/{json-input-BGfZindW.js → json-input-CMZiW5M2.js} +2 -2
- prefect/server/ui-v2/assets/{json-input-BGfZindW.js.map → json-input-CMZiW5M2.js.map} +1 -1
- prefect/server/ui-v2/assets/{key._key-mnO405kp.js → key._key-CdonPtNh.js} +2 -2
- prefect/server/ui-v2/assets/{key._key-mnO405kp.js.map → key._key-CdonPtNh.js.map} +1 -1
- prefect/server/ui-v2/assets/{lazy-markdown-CLclUkkd.js → lazy-markdown-CKcd9ksG.js} +2 -2
- prefect/server/ui-v2/assets/{lazy-markdown-CLclUkkd.js.map → lazy-markdown-CKcd9ksG.js.map} +1 -1
- prefect/server/ui-v2/assets/{login-ST_-h2GY.js → login-Dnd-tV90.js} +2 -2
- prefect/server/ui-v2/assets/{login-ST_-h2GY.js.map → login-Dnd-tV90.js.map} +1 -1
- prefect/server/ui-v2/assets/{markdown-input-DemuemAs.js → markdown-input-D6rfyTa_.js} +2 -2
- prefect/server/ui-v2/assets/{markdown-input-DemuemAs.js.map → markdown-input-D6rfyTa_.js.map} +1 -1
- prefect/server/ui-v2/assets/{python-example-snippet-BUllaeTS.js → python-example-snippet-eWuRXCxE.js} +3 -3
- prefect/server/ui-v2/assets/{python-example-snippet-BUllaeTS.js.map → python-example-snippet-eWuRXCxE.js.map} +1 -1
- prefect/server/ui-v2/assets/{python-input-DTpMdYLs.js → python-input-itfwkkBT.js} +2 -2
- prefect/server/ui-v2/assets/{python-input-DTpMdYLs.js.map → python-input-itfwkkBT.js.map} +1 -1
- prefect/server/ui-v2/assets/{radio-group-CJhtPDwC.js → radio-group-DeN-_krn.js} +2 -2
- prefect/server/ui-v2/assets/{radio-group-CJhtPDwC.js.map → radio-group-DeN-_krn.js.map} +1 -1
- prefect/server/ui-v2/assets/{route-error-state-D0wedcpP.js → route-error-state-tYzhKCqH.js} +2 -2
- prefect/server/ui-v2/assets/{route-error-state-D0wedcpP.js.map → route-error-state-tYzhKCqH.js.map} +1 -1
- prefect/server/ui-v2/assets/{schema-form-Cx-6swYW.js → schema-form-DDUzvjpL.js} +2 -2
- prefect/server/ui-v2/assets/{schema-form-Cx-6swYW.js.map → schema-form-DDUzvjpL.js.map} +1 -1
- prefect/server/ui-v2/assets/{schema-form-input-string-format-datetime-CZkUje5U.js → schema-form-input-string-format-datetime-DrpJmvST.js} +4 -4
- prefect/server/ui-v2/assets/{schema-form-input-string-format-datetime-CZkUje5U.js.map → schema-form-input-string-format-datetime-DrpJmvST.js.map} +1 -1
- prefect/server/ui-v2/assets/{settings-nHtCkknH.js → settings-OdrJDFrk.js} +2 -2
- prefect/server/ui-v2/assets/{settings-nHtCkknH.js.map → settings-OdrJDFrk.js.map} +1 -1
- prefect/server/ui-v2/assets/{sort-filter-QjOHFWPI.js → sort-filter-DaBGDmua.js} +2 -2
- prefect/server/ui-v2/assets/{sort-filter-QjOHFWPI.js.map → sort-filter-DaBGDmua.js.map} +1 -1
- prefect/server/ui-v2/assets/{table-Bx2Ol4j-.js → table-4GUC4YOD.js} +2 -2
- prefect/server/ui-v2/assets/{table-Bx2Ol4j-.js.map → table-4GUC4YOD.js.map} +1 -1
- prefect/server/ui-v2/assets/{tags-input-C7cxdTyV.js → tags-input-BvH9UY8h.js} +2 -2
- prefect/server/ui-v2/assets/{tags-input-C7cxdTyV.js.map → tags-input-BvH9UY8h.js.map} +1 -1
- prefect/server/ui-v2/assets/{task-run-concurrency-limits-reset-dialog-CG2F0Ufy.js → task-run-concurrency-limits-reset-dialog-CLZz3kwW.js} +2 -2
- prefect/server/ui-v2/assets/{task-run-concurrency-limits-reset-dialog-CG2F0Ufy.js.map → task-run-concurrency-limits-reset-dialog-CLZz3kwW.js.map} +1 -1
- prefect/server/ui-v2/assets/{task-run._id-CapS5wad.js → task-run._id-DHHzTQ9d.js} +2 -2
- prefect/server/ui-v2/assets/{task-run._id-CapS5wad.js.map → task-run._id-DHHzTQ9d.js.map} +1 -1
- prefect/server/ui-v2/assets/{task-run._id-CevQxX-E.js → task-run._id-DgXFfCuq.js} +2 -2
- prefect/server/ui-v2/assets/{task-run._id-CevQxX-E.js.map → task-run._id-DgXFfCuq.js.map} +1 -1
- prefect/server/ui-v2/assets/{task-runs-pagination-Dbwa2yPe.js → task-runs-pagination-fR9zqj38.js} +2 -2
- prefect/server/ui-v2/assets/{task-runs-pagination-Dbwa2yPe.js.map → task-runs-pagination-fR9zqj38.js.map} +1 -1
- prefect/server/ui-v2/assets/{textarea-vy4DM6KG.js → textarea-DL9UCBaB.js} +2 -2
- prefect/server/ui-v2/assets/{textarea-vy4DM6KG.js.map → textarea-DL9UCBaB.js.map} +1 -1
- prefect/server/ui-v2/assets/{timezone-select-DDUTUy-L.js → timezone-select-qBEoPcyO.js} +2 -2
- prefect/server/ui-v2/assets/{timezone-select-DDUTUy-L.js.map → timezone-select-qBEoPcyO.js.map} +1 -1
- prefect/server/ui-v2/assets/{toggle-group-Dx_fy9WJ.js → toggle-group-Cf-ZSSDP.js} +2 -2
- prefect/server/ui-v2/assets/{toggle-group-Dx_fy9WJ.js.map → toggle-group-Cf-ZSSDP.js.map} +1 -1
- prefect/server/ui-v2/assets/{use-delete-automation-confirmation-dialog-ClQsotEa.js → use-delete-automation-confirmation-dialog-DRX9Kvie.js} +2 -2
- prefect/server/ui-v2/assets/{use-delete-automation-confirmation-dialog-ClQsotEa.js.map → use-delete-automation-confirmation-dialog-DRX9Kvie.js.map} +1 -1
- prefect/server/ui-v2/assets/{use-delete-block-document-confirmation-dialog-DM0Dy1PL.js → use-delete-block-document-confirmation-dialog-CogrfdiO.js} +2 -2
- prefect/server/ui-v2/assets/{use-delete-block-document-confirmation-dialog-DM0Dy1PL.js.map → use-delete-block-document-confirmation-dialog-CogrfdiO.js.map} +1 -1
- prefect/server/ui-v2/assets/{use-flow-runs-selected-rows-UhMaQqzZ.js → use-flow-runs-selected-rows-CdMKKvm5.js} +2 -2
- prefect/server/ui-v2/assets/{use-flow-runs-selected-rows-UhMaQqzZ.js.map → use-flow-runs-selected-rows-CdMKKvm5.js.map} +1 -1
- prefect/server/ui-v2/assets/{use-get-artifacts-flow-task-runs-P8C-ARMZ.js → use-get-artifacts-flow-task-runs-Be1qg-IF.js} +2 -2
- prefect/server/ui-v2/assets/{use-get-artifacts-flow-task-runs-P8C-ARMZ.js.map → use-get-artifacts-flow-task-runs-Be1qg-IF.js.map} +1 -1
- prefect/server/ui-v2/assets/{use-quick-run-DT0VEa9Z.js → use-quick-run-DXDfXpvs.js} +2 -2
- prefect/server/ui-v2/assets/{use-quick-run-DT0VEa9Z.js.map → use-quick-run-DXDfXpvs.js.map} +1 -1
- prefect/server/ui-v2/assets/{use-state-favicon-DfEAuEQL.js → use-state-favicon-Dhkg1tqx.js} +2 -2
- prefect/server/ui-v2/assets/{use-state-favicon-DfEAuEQL.js.map → use-state-favicon-Dhkg1tqx.js.map} +1 -1
- prefect/server/ui-v2/assets/{use-stepper-1OG0a_eo.js → use-stepper-jTTsXpho.js} +2 -2
- prefect/server/ui-v2/assets/{use-stepper-1OG0a_eo.js.map → use-stepper-jTTsXpho.js.map} +1 -1
- prefect/server/ui-v2/assets/{utilities-DabzLyXd.js → utilities-CgJi7g2F.js} +2 -2
- prefect/server/ui-v2/assets/{utilities-DabzLyXd.js.map → utilities-CgJi7g2F.js.map} +1 -1
- prefect/server/ui-v2/assets/{work-pool-filter-CTTGgdIN.js → work-pool-filter-DLkRAAHz.js} +2 -2
- prefect/server/ui-v2/assets/{work-pool-filter-CTTGgdIN.js.map → work-pool-filter-DLkRAAHz.js.map} +1 -1
- prefect/server/ui-v2/assets/{work-pool-queue-toggle-B9KQxNdY.js → work-pool-queue-toggle-BFodtXQe.js} +2 -2
- prefect/server/ui-v2/assets/{work-pool-queue-toggle-B9KQxNdY.js.map → work-pool-queue-toggle-BFodtXQe.js.map} +1 -1
- prefect/server/ui-v2/assets/{work-pool._workPoolName-CGqG95Pv.js → work-pool._workPoolName-Bjh_bO5G.js} +2 -2
- prefect/server/ui-v2/assets/{work-pool._workPoolName-CGqG95Pv.js.map → work-pool._workPoolName-Bjh_bO5G.js.map} +1 -1
- prefect/server/ui-v2/assets/{work-pool_._workPoolName.edit-CcFrethu.js → work-pool_._workPoolName.edit-B-gnp5dc.js} +2 -2
- prefect/server/ui-v2/assets/{work-pool_._workPoolName.edit-CcFrethu.js.map → work-pool_._workPoolName.edit-B-gnp5dc.js.map} +1 -1
- prefect/server/ui-v2/assets/{work-pool_._workPoolName.queue._workQueueName-CwPnpSI9.js → work-pool_._workPoolName.queue._workQueueName-C7aVwLhH.js} +2 -2
- prefect/server/ui-v2/assets/{work-pool_._workPoolName.queue._workQueueName-CwPnpSI9.js.map → work-pool_._workPoolName.queue._workQueueName-C7aVwLhH.js.map} +1 -1
- prefect/server/ui-v2/assets/{work-queue-icon-text-Bix0rRM1.js → work-queue-icon-text-BK_qfkJJ.js} +2 -2
- prefect/server/ui-v2/assets/{work-queue-icon-text-Bix0rRM1.js.map → work-queue-icon-text-BK_qfkJJ.js.map} +1 -1
- prefect/server/ui-v2/index.html +2 -2
- {prefect-3.6.14.dev6.dist-info → prefect-3.6.14.dev7.dist-info}/METADATA +1 -1
- {prefect-3.6.14.dev6.dist-info → prefect-3.6.14.dev7.dist-info}/RECORD +202 -202
- prefect/server/ui-v2/assets/block-type-logo-FrtMLMYr.js +0 -2
- prefect/server/ui-v2/assets/delete-confirmation-dialog-jlBI67Pk.js +0 -2
- prefect/server/ui-v2/assets/deployment_._id.duplicate-aUHtHuNO.js +0 -2
- prefect/server/ui-v2/assets/deployment_._id.edit-CPRKkA-W.js +0 -2
- prefect/server/ui-v2/assets/flow-run-graph-CIvkp1kl.js +0 -2
- prefect/server/ui-v2/assets/flow-run._id-BT3wztDF.js +0 -4
- prefect/server/ui-v2/assets/flow-run._id-BT3wztDF.js.map +0 -1
- prefect/server/ui-v2/assets/index-CYc_PWA3.css +0 -1
- prefect/server/ui-v2/assets/index-nxDkMXcY.js.map +0 -1
- {prefect-3.6.14.dev6.dist-info → prefect-3.6.14.dev7.dist-info}/WHEEL +0 -0
- {prefect-3.6.14.dev6.dist-info → prefect-3.6.14.dev7.dist-info}/entry_points.txt +0 -0
- {prefect-3.6.14.dev6.dist-info → prefect-3.6.14.dev7.dist-info}/licenses/LICENSE +0 -0
prefect/_build_info.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Generated by versioningit
|
|
2
|
-
__version__ = "3.6.14.
|
|
3
|
-
__build_date__ = "2026-01-
|
|
4
|
-
__git_commit__ = "
|
|
2
|
+
__version__ = "3.6.14.dev7"
|
|
3
|
+
__build_date__ = "2026-01-29 08:17:12.716885+00:00"
|
|
4
|
+
__git_commit__ = "6bcea54d944a687a7bab896b64900a65ac691613"
|
|
5
5
|
__dirty__ = False
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as o,j as e,L as t}from"./vendor-tanstack-BcZfOOfy.js";import{L as n}from"./lazy-markdown-
|
|
2
|
-
//# sourceMappingURL=artifact-card-
|
|
1
|
+
import{r as o,j as e,L as t}from"./vendor-tanstack-BcZfOOfy.js";import{L as n}from"./lazy-markdown-CKcd9ksG.js";import{aM as i,C as m,m as x,al as r,o as c,aW as d}from"./index-_0OOjqn5.js";const f=({artifact:s,compact:a=!1})=>{const l=o.useMemo(()=>i(new Date(s.created??""),"dateTime"),[s.created]);return e.jsx(t,{to:"/artifacts/key/$key",params:{key:s.key??""},children:e.jsxs(m,{className:"hover:shadow-lg hover:border-blue-700",children:[e.jsx(x,{children:e.jsx(r,{variant:"bodySmall",className:"font-bold text-muted-foreground",children:s.type?.toUpperCase()})}),e.jsxs(c,{children:[e.jsxs("div",{className:d("flex",a?"flex-row justify-between":"flex-col"),children:[e.jsx(r,{variant:a?"h4":"h3",className:"font-bold",children:s.key}),e.jsxs("div",{className:d("flex mt-2",a?"flex-col-reverse items-end":"justify-between"),children:[e.jsx(r,{variant:a?"bodySmall":"xsmall",className:"",fontFamily:"mono",children:l}),e.jsx(r,{variant:"bodySmall",className:"text-muted-foreground",children:"Created"})]})]}),e.jsx("hr",{className:"my-2"}),s.description?e.jsx("div",{className:"text-muted-foreground overflow-hidden truncate",children:e.jsx(n,{children:s.description??""})}):e.jsx(r,{variant:"bodySmall",className:"text-muted-foreground italic",children:"No description"})]})]})})};export{f as A};
|
|
2
|
+
//# sourceMappingURL=artifact-card-9Cw_dMVb.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifact-card-
|
|
1
|
+
{"version":3,"file":"artifact-card-9Cw_dMVb.js","sources":["../../src/components/artifacts/artifact-card.tsx"],"sourcesContent":["import { Link } from \"@tanstack/react-router\";\nimport { useMemo } from \"react\";\nimport type { Artifact } from \"@/api/artifacts\";\nimport { LazyMarkdown } from \"@/components/ui/lazy-markdown\";\nimport { cn } from \"@/utils\";\nimport { formatDate } from \"@/utils/date\";\nimport { Card, CardContent, CardHeader } from \"../ui/card\";\nimport { Typography } from \"../ui/typography\";\n\nexport type ArtifactsCardProps = {\n\tartifact: Artifact;\n\tcompact?: boolean;\n};\n\nexport const ArtifactCard = ({\n\tartifact,\n\tcompact = false,\n}: ArtifactsCardProps) => {\n\tconst createdAtDate = useMemo(() => {\n\t\treturn formatDate(new Date(artifact.created ?? \"\"), \"dateTime\");\n\t}, [artifact.created]);\n\treturn (\n\t\t<Link to=\"/artifacts/key/$key\" params={{ key: artifact.key ?? \"\" }}>\n\t\t\t<Card className=\"hover:shadow-lg hover:border-blue-700\">\n\t\t\t\t<CardHeader>\n\t\t\t\t\t<Typography\n\t\t\t\t\t\tvariant=\"bodySmall\"\n\t\t\t\t\t\tclassName=\"font-bold text-muted-foreground\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{artifact.type?.toUpperCase()}\n\t\t\t\t\t</Typography>\n\t\t\t\t</CardHeader>\n\t\t\t\t<CardContent>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\"flex\",\n\t\t\t\t\t\t\tcompact ? \"flex-row justify-between\" : \"flex-col\",\n\t\t\t\t\t\t)}\n\t\t\t\t\t>\n\t\t\t\t\t\t<Typography variant={compact ? \"h4\" : \"h3\"} className=\"font-bold\">\n\t\t\t\t\t\t\t{artifact.key}\n\t\t\t\t\t\t</Typography>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\"flex mt-2\",\n\t\t\t\t\t\t\t\tcompact ? \"flex-col-reverse items-end\" : \"justify-between\",\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Typography\n\t\t\t\t\t\t\t\tvariant={compact ? \"bodySmall\" : \"xsmall\"}\n\t\t\t\t\t\t\t\tclassName=\"\"\n\t\t\t\t\t\t\t\tfontFamily=\"mono\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{createdAtDate}\n\t\t\t\t\t\t\t</Typography>\n\t\t\t\t\t\t\t<Typography variant=\"bodySmall\" className=\"text-muted-foreground\">\n\t\t\t\t\t\t\t\tCreated\n\t\t\t\t\t\t\t</Typography>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<hr className=\"my-2\" />\n\t\t\t\t\t{artifact.description ? (\n\t\t\t\t\t\t<div className=\"text-muted-foreground overflow-hidden truncate\">\n\t\t\t\t\t\t\t<LazyMarkdown>{artifact.description ?? \"\"}</LazyMarkdown>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<Typography\n\t\t\t\t\t\t\tvariant=\"bodySmall\"\n\t\t\t\t\t\t\tclassName=\"text-muted-foreground italic\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tNo description\n\t\t\t\t\t\t</Typography>\n\t\t\t\t\t)}\n\t\t\t\t</CardContent>\n\t\t\t</Card>\n\t\t</Link>\n\t);\n};\n"],"names":["ArtifactCard","artifact","compact","createdAtDate","useMemo","formatDate","jsx","Link","jsxs","Card","CardHeader","Typography","CardContent","cn","LazyMarkdown"],"mappings":"8LAcO,MAAMA,EAAe,CAAC,CAC5B,SAAAC,EACA,QAAAC,EAAU,EACX,IAA0B,CACzB,MAAMC,EAAgBC,EAAAA,QAAQ,IACtBC,EAAW,IAAI,KAAKJ,EAAS,SAAW,EAAE,EAAG,UAAU,EAC5D,CAACA,EAAS,OAAO,CAAC,EACrB,OACCK,EAAAA,IAACC,EAAA,CAAK,GAAG,sBAAsB,OAAQ,CAAE,IAAKN,EAAS,KAAO,EAAA,EAC7D,SAAAO,EAAAA,KAACC,EAAA,CAAK,UAAU,wCACf,SAAA,CAAAH,MAACI,EAAA,CACA,SAAAJ,EAAAA,IAACK,EAAA,CACA,QAAQ,YACR,UAAU,kCAET,SAAAV,EAAS,MAAM,YAAA,CAAY,CAAA,EAE9B,SACCW,EAAA,CACA,SAAA,CAAAJ,EAAAA,KAAC,MAAA,CACA,UAAWK,EACV,OACAX,EAAU,2BAA6B,UAAA,EAGxC,SAAA,CAAAI,EAAAA,IAACK,EAAA,CAAW,QAAST,EAAU,KAAO,KAAM,UAAU,YACpD,WAAS,GAAA,CACX,EACAM,EAAAA,KAAC,MAAA,CACA,UAAWK,EACV,YACAX,EAAU,6BAA+B,iBAAA,EAG1C,SAAA,CAAAI,EAAAA,IAACK,EAAA,CACA,QAAST,EAAU,YAAc,SACjC,UAAU,GACV,WAAW,OAEV,SAAAC,CAAA,CAAA,QAEDQ,EAAA,CAAW,QAAQ,YAAY,UAAU,wBAAwB,SAAA,SAAA,CAElE,CAAA,CAAA,CAAA,CACD,CAAA,CAAA,EAEDL,EAAAA,IAAC,KAAA,CAAG,UAAU,MAAA,CAAO,EACpBL,EAAS,YACTK,MAAC,MAAA,CAAI,UAAU,iDACd,SAAAA,EAAAA,IAACQ,EAAA,CAAc,SAAAb,EAAS,aAAe,EAAA,CAAG,CAAA,CAC3C,EAEAK,EAAAA,IAACK,EAAA,CACA,QAAQ,YACR,UAAU,+BACV,SAAA,gBAAA,CAAA,CAED,CAAA,CAEF,CAAA,CAAA,CACD,CAAA,CACD,CAEF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as e,r as l,s as y}from"./vendor-tanstack-BcZfOOfy.js";import{B as j,g as p,h as c,bs as u,bB as x,D as w,al as h,q as b,I as v,y as N,O as k,
|
|
2
|
-
//# sourceMappingURL=artifact._id-
|
|
1
|
+
import{j as e,r as l,s as y}from"./vendor-tanstack-BcZfOOfy.js";import{B as j,g as p,h as c,bs as u,bB as x,D as w,al as h,q as b,I as v,y as N,O as k,dz as D,dy as S}from"./index-_0OOjqn5.js";import{a as T}from"./use-get-artifacts-flow-task-runs-Be1qg-IF.js";import{L as f}from"./lazy-markdown-CKcd9ksG.js";import{u as C,E as L}from"./vendor-codemirror-LnHkUyAP.js";import{T as B,a as _,b as g,c as A,d as R,e as I}from"./table-4GUC4YOD.js";import"./vendor-react-Bce9NwRC.js";import"./vendor-radix-BTiKGWfR.js";import"./vendor-recharts-BAN776s_.js";import"./vendor-forms-ClCIacbh.js";import"./vendor-date-wwuDAncJ.js";const M=({artifact:s})=>{let a=e.jsx(e.Fragment,{});return s.key?a=e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(j,{children:e.jsxs(p,{children:[e.jsx(c,{children:e.jsx(u,{to:"/artifacts/key/$key",params:{key:s.key},className:"text-xl font-semibold",children:s.key})}),e.jsx(x,{}),e.jsx(c,{className:"text-xl font-semibold",children:s.id})]})})}):a=e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(j,{children:e.jsxs(p,{children:[s.flow_run&&e.jsxs(e.Fragment,{children:[e.jsx(c,{children:e.jsx(u,{to:"/runs/flow-run/$id",params:{id:s.flow_run_id??""},className:"text-xl font-semibold",children:s.flow_run.name})}),e.jsx(x,{})]}),s.task_run&&e.jsxs(e.Fragment,{children:[e.jsx(c,{children:e.jsx(u,{to:"/runs/task-run/$id",params:{id:s.task_run_id??""},className:"text-xl font-semibold",children:s.task_run.name})}),e.jsx(x,{})]}),e.jsx(c,{className:"text-xl font-semibold",children:s.id})]})})}),e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[a,e.jsx(w,{id:"artifacts-guide",label:"Documentation"})]}),s.description&&e.jsx("div",{className:"",children:e.jsx(h,{variant:"h2",className:"my-4 font-bold prose lg:prose-xl",children:e.jsx(f,{children:s.description})})}),e.jsx("hr",{})]})},z=({artifact:s})=>{const[a,r]=l.useState(!1),d=()=>{r(o=>!o)},n=l.useRef(null),m={highlightActiveLine:!1,foldGutter:!1,highlightActiveLineGutter:!1},{setContainer:t}=C({container:n.current,extensions:[L.lineWrapping],value:String(s.data),indentWithTab:!1,editable:!0,basicSetup:m});l.useEffect(()=>{n.current&&t(n.current)},[t]);const i=o=>{N.success("Copied to clipboard"),navigator.clipboard.writeText(o)};return e.jsxs("div",{className:"flex flex-col justify-center items-center",children:[e.jsxs(b,{"data-testid":"show-raw-data-button",variant:"outline",onClick:d,className:"my-4",children:[a?"Hide":"Show"," Raw Data"]}),e.jsx("div",{className:"rounded-md border shadow-xs focus-within:outline-hidden focus-within:ring-1 focus-within:ring-ring relative",style:{display:a?"block":"none"},ref:o=>{n.current=o},"data-testid":"raw-data-display",children:e.jsx(b,{onClick:()=>i(s.data),variant:"ghost",size:"icon",className:"absolute top-0 right-0 z-10","aria-label":"copy",children:e.jsx(v,{id:"Copy",className:"size-2"})})})]})},E=({url:s})=>e.jsxs("div",{"data-testid":s,className:"prose mt-2",children:[e.jsx("img",{"data-testid":`image-${s}`,src:s,alt:"artifact-image",className:"w-full"}),e.jsxs(h,{variant:"bodyLarge",children:["Image URL:"," ",e.jsx("a",{className:"text-blue-700 hover:underline",target:"_blank",href:s,rel:"noreferrer",children:s})]})]}),F=({markdown:s})=>e.jsx("div",{"data-testid":"markdown-display",className:"mt-4 prose",children:e.jsx(f,{children:s})}),H=({progress:s})=>e.jsxs(h,{"data-testid":"progress-display",variant:"bodyLarge",children:["Progress: ",s,"%"]}),O=({tableData:s})=>{const a=JSON.parse(s),r=Object.keys(a[0]),[d,n]=l.useState(""),m=l.useMemo(()=>a.filter(t=>Object.values(t).some(i=>String(i).toLowerCase().includes(d.toLowerCase()))),[d,a]);return e.jsxs("div",{"data-testid":"table-display",className:"mt-4",children:[e.jsx("div",{className:"flex flex-row justify-end items-center mb-2",children:e.jsx("div",{children:e.jsx(k,{placeholder:"Search",value:d,onChange:t=>n(t.target.value)})})}),e.jsx("div",{className:"rounded-md border",children:e.jsxs(B,{children:[e.jsx(_,{className:"bg-muted",children:e.jsx(g,{children:r.map(t=>e.jsx(A,{className:"py-2 text-foreground",children:t},t))})}),e.jsx(R,{children:m.map(t=>e.jsx(g,{children:r.map(i=>e.jsx(I,{children:t[i]},i))},t.id))})]})})]})},G=({artifact:s})=>{const a=l.useMemo(()=>{switch(s.type){case"markdown":case"link":return e.jsx(F,{markdown:s.data});case"image":return e.jsx(E,{url:s.data});case"progress":return e.jsx(H,{progress:s.data});case"table":return e.jsx(O,{tableData:s.data});default:return e.jsx("pre",{children:JSON.stringify(s.data,null,2)})}},[s]);return e.jsxs("div",{children:[e.jsx(M,{artifact:s}),a,e.jsx(z,{artifact:s})]})};function Z(){const{id:s}=D.useParams(),{data:a}=y(S(s)),r=T(s);return e.jsx(G,{artifact:r??a})}export{Z as component};
|
|
2
|
+
//# sourceMappingURL=artifact._id-zuZ8P2RD.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifact._id-BIyzb0Jb.js","sources":["../../src/components/artifacts/artifact/artifact-detail-header.tsx","../../src/components/artifacts/artifact/artifact-raw-data-display.tsx","../../src/components/artifacts/artifact/detail-image.tsx","../../src/components/artifacts/artifact/detail-markdown.tsx","../../src/components/artifacts/artifact/detail-progress.tsx","../../src/components/artifacts/artifact/detail-table.tsx","../../src/components/artifacts/artifact/artifact-detail-page.tsx","../../src/routes/artifacts/artifact.$id.tsx?tsr-split=component"],"sourcesContent":["import type { ArtifactWithFlowRunAndTaskRun } from \"@/api/artifacts\";\nimport {\n\tBreadcrumb,\n\tBreadcrumbItem,\n\tBreadcrumbLink,\n\tBreadcrumbList,\n\tBreadcrumbSeparator,\n} from \"@/components/ui/breadcrumb\";\nimport { DocsLink } from \"@/components/ui/docs-link\";\nimport { LazyMarkdown } from \"@/components/ui/lazy-markdown\";\nimport { Typography } from \"@/components/ui/typography\";\n\nexport type ArtifactDetailHeaderProps = {\n\tartifact: ArtifactWithFlowRunAndTaskRun;\n};\n\nexport const ArtifactDetailHeader = ({\n\tartifact,\n}: ArtifactDetailHeaderProps) => {\n\tlet header = <></>;\n\tif (artifact.key) {\n\t\theader = (\n\t\t\t<div className=\"flex items-center gap-2\">\n\t\t\t\t<Breadcrumb>\n\t\t\t\t\t<BreadcrumbList>\n\t\t\t\t\t\t<BreadcrumbItem>\n\t\t\t\t\t\t\t<BreadcrumbLink\n\t\t\t\t\t\t\t\tto=\"/artifacts/key/$key\"\n\t\t\t\t\t\t\t\tparams={{ key: artifact.key }}\n\t\t\t\t\t\t\t\tclassName=\"text-xl font-semibold\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{artifact.key}\n\t\t\t\t\t\t\t</BreadcrumbLink>\n\t\t\t\t\t\t</BreadcrumbItem>\n\t\t\t\t\t\t<BreadcrumbSeparator />\n\t\t\t\t\t\t<BreadcrumbItem className=\"text-xl font-semibold\">\n\t\t\t\t\t\t\t{artifact.id}\n\t\t\t\t\t\t</BreadcrumbItem>\n\t\t\t\t\t</BreadcrumbList>\n\t\t\t\t</Breadcrumb>\n\t\t\t</div>\n\t\t);\n\t} else {\n\t\theader = (\n\t\t\t<div className=\"flex items-center gap-2\">\n\t\t\t\t<Breadcrumb>\n\t\t\t\t\t<BreadcrumbList>\n\t\t\t\t\t\t{artifact.flow_run && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<BreadcrumbItem>\n\t\t\t\t\t\t\t\t\t<BreadcrumbLink\n\t\t\t\t\t\t\t\t\t\tto=\"/runs/flow-run/$id\"\n\t\t\t\t\t\t\t\t\t\tparams={{ id: artifact.flow_run_id ?? \"\" }}\n\t\t\t\t\t\t\t\t\t\tclassName=\"text-xl font-semibold\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{artifact.flow_run.name}\n\t\t\t\t\t\t\t\t\t</BreadcrumbLink>\n\t\t\t\t\t\t\t\t</BreadcrumbItem>\n\t\t\t\t\t\t\t\t<BreadcrumbSeparator />\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{artifact.task_run && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<BreadcrumbItem>\n\t\t\t\t\t\t\t\t\t<BreadcrumbLink\n\t\t\t\t\t\t\t\t\t\tto=\"/runs/task-run/$id\"\n\t\t\t\t\t\t\t\t\t\tparams={{ id: artifact.task_run_id ?? \"\" }}\n\t\t\t\t\t\t\t\t\t\tclassName=\"text-xl font-semibold\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{artifact.task_run.name}\n\t\t\t\t\t\t\t\t\t</BreadcrumbLink>\n\t\t\t\t\t\t\t\t</BreadcrumbItem>\n\t\t\t\t\t\t\t\t<BreadcrumbSeparator />\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t<BreadcrumbItem className=\"text-xl font-semibold\">\n\t\t\t\t\t\t\t{artifact.id}\n\t\t\t\t\t\t</BreadcrumbItem>\n\t\t\t\t\t</BreadcrumbList>\n\t\t\t\t</Breadcrumb>\n\t\t\t</div>\n\t\t);\n\t}\n\treturn (\n\t\t<>\n\t\t\t<div className=\"flex items-center justify-between\">\n\t\t\t\t{header}\n\t\t\t\t<DocsLink id=\"artifacts-guide\" label=\"Documentation\" />\n\t\t\t</div>\n\t\t\t{artifact.description && (\n\t\t\t\t<div className=\"\">\n\t\t\t\t\t<Typography variant=\"h2\" className=\"my-4 font-bold prose lg:prose-xl\">\n\t\t\t\t\t\t<LazyMarkdown>{artifact.description}</LazyMarkdown>\n\t\t\t\t\t</Typography>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t\t<hr />\n\t\t</>\n\t);\n};\n","import { EditorView, useCodeMirror } from \"@uiw/react-codemirror\";\nimport { useEffect, useRef, useState } from \"react\";\nimport { toast } from \"sonner\";\nimport type { ArtifactWithFlowRunAndTaskRun } from \"@/api/artifacts\";\nimport { Button } from \"@/components/ui/button\";\nimport { Icon } from \"@/components/ui/icons\";\n\ntype ArtifactDataDisplayProps = {\n\tartifact: ArtifactWithFlowRunAndTaskRun;\n};\n\nexport const ArtifactDataDisplay = ({ artifact }: ArtifactDataDisplayProps) => {\n\tconst [showData, setShowData] = useState(false);\n\n\tconst toggleShowData = () => {\n\t\tsetShowData((val) => !val);\n\t};\n\n\tconst editor = useRef<HTMLDivElement | null>(null);\n\tconst basicSetup = {\n\t\thighlightActiveLine: false,\n\t\tfoldGutter: false,\n\t\thighlightActiveLineGutter: false,\n\t};\n\tconst { setContainer } = useCodeMirror({\n\t\tcontainer: editor.current,\n\t\textensions: [EditorView.lineWrapping],\n\t\tvalue: String(artifact.data),\n\t\tindentWithTab: false,\n\t\teditable: true,\n\t\tbasicSetup,\n\t});\n\n\tuseEffect(() => {\n\t\tif (editor.current) {\n\t\t\tsetContainer(editor.current);\n\t\t}\n\t}, [setContainer]);\n\n\tconst handleCopy = (_value: string) => {\n\t\ttoast.success(\"Copied to clipboard\");\n\t\tvoid navigator.clipboard.writeText(_value);\n\t};\n\n\treturn (\n\t\t<div className=\"flex flex-col justify-center items-center\">\n\t\t\t<Button\n\t\t\t\tdata-testid=\"show-raw-data-button\"\n\t\t\t\tvariant={\"outline\"}\n\t\t\t\tonClick={toggleShowData}\n\t\t\t\tclassName=\"my-4\"\n\t\t\t>\n\t\t\t\t{showData ? \"Hide\" : \"Show\"} Raw Data\n\t\t\t</Button>\n\n\t\t\t<div\n\t\t\t\tclassName=\"rounded-md border shadow-xs focus-within:outline-hidden focus-within:ring-1 focus-within:ring-ring relative\"\n\t\t\t\tstyle={{\n\t\t\t\t\tdisplay: showData ? \"block\" : \"none\",\n\t\t\t\t}}\n\t\t\t\tref={(node) => {\n\t\t\t\t\teditor.current = node;\n\t\t\t\t}}\n\t\t\t\tdata-testid=\"raw-data-display\"\n\t\t\t>\n\t\t\t\t<Button\n\t\t\t\t\tonClick={() => handleCopy(artifact.data as string)}\n\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\tsize=\"icon\"\n\t\t\t\t\tclassName=\"absolute top-0 right-0 z-10\"\n\t\t\t\t\taria-label=\"copy\"\n\t\t\t\t>\n\t\t\t\t\t<Icon id=\"Copy\" className=\"size-2\" />\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n","import { Typography } from \"@/components/ui/typography\";\n\nexport type DetailImageProps = {\n\turl: string;\n};\n\nexport const DetailImage = ({ url }: DetailImageProps) => {\n\treturn (\n\t\t<div data-testid={url} className=\"prose mt-2\">\n\t\t\t<img\n\t\t\t\tdata-testid={`image-${url}`}\n\t\t\t\tsrc={url}\n\t\t\t\talt=\"artifact-image\"\n\t\t\t\tclassName=\"w-full\"\n\t\t\t/>\n\n\t\t\t<Typography variant=\"bodyLarge\">\n\t\t\t\tImage URL:{\" \"}\n\t\t\t\t<a\n\t\t\t\t\tclassName=\"text-blue-700 hover:underline\"\n\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\thref={url}\n\t\t\t\t\trel=\"noreferrer\"\n\t\t\t\t>\n\t\t\t\t\t{url}\n\t\t\t\t</a>\n\t\t\t</Typography>\n\t\t</div>\n\t);\n};\n","import { LazyMarkdown } from \"@/components/ui/lazy-markdown\";\n\nexport type DetailMarkdownProps = {\n\tmarkdown: string;\n};\n\nexport const DetailMarkdown = ({ markdown }: DetailMarkdownProps) => {\n\treturn (\n\t\t<div data-testid=\"markdown-display\" className=\"mt-4 prose\">\n\t\t\t<LazyMarkdown>{markdown}</LazyMarkdown>\n\t\t</div>\n\t);\n};\n","import { Typography } from \"@/components/ui/typography\";\n\nexport type DetailProgressProps = {\n\tprogress: number;\n};\n\nexport const DetailProgress = ({ progress }: DetailProgressProps) => {\n\treturn (\n\t\t<Typography data-testid=\"progress-display\" variant=\"bodyLarge\">\n\t\t\tProgress: {progress}%\n\t\t</Typography>\n\t);\n};\n","import { useMemo, useState } from \"react\";\nimport { SearchInput } from \"@/components/ui/input\";\nimport {\n\tTable,\n\tTableBody,\n\tTableCell,\n\tTableHead,\n\tTableHeader,\n\tTableRow,\n} from \"@/components/ui/table\";\n\nexport type DetailTableProps = {\n\ttableData: string;\n};\n\nexport const DetailTable = ({ tableData }: DetailTableProps) => {\n\tconst table = JSON.parse(tableData) as Record<string, string>[];\n\tconst headers = Object.keys(table[0]);\n\tconst [input, setInput] = useState<string>(\"\");\n\n\tconst filteredTable = useMemo(() => {\n\t\treturn table.filter((row) => {\n\t\t\treturn Object.values(row).some((value: string) =>\n\t\t\t\tString(value).toLowerCase().includes(input.toLowerCase()),\n\t\t\t);\n\t\t});\n\t}, [input, table]);\n\n\treturn (\n\t\t<div data-testid=\"table-display\" className=\"mt-4\">\n\t\t\t<div className=\"flex flex-row justify-end items-center mb-2\">\n\t\t\t\t<div>\n\t\t\t\t\t<SearchInput\n\t\t\t\t\t\tplaceholder=\"Search\"\n\t\t\t\t\t\tvalue={input}\n\t\t\t\t\t\tonChange={(e) => setInput(e.target.value)}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div className=\"rounded-md border\">\n\t\t\t\t<Table>\n\t\t\t\t\t<TableHeader className=\"bg-muted\">\n\t\t\t\t\t\t<TableRow>\n\t\t\t\t\t\t\t{headers.map((header) => {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<TableHead key={header} className=\"py-2 text-foreground\">\n\t\t\t\t\t\t\t\t\t\t{header}\n\t\t\t\t\t\t\t\t\t</TableHead>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t</TableRow>\n\t\t\t\t\t</TableHeader>\n\t\t\t\t\t<TableBody>\n\t\t\t\t\t\t{filteredTable.map((row) => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<TableRow key={row.id}>\n\t\t\t\t\t\t\t\t\t{headers.map((header) => {\n\t\t\t\t\t\t\t\t\t\treturn <TableCell key={header}>{row[header]}</TableCell>;\n\t\t\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\t\t</TableRow>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t})}\n\t\t\t\t\t</TableBody>\n\t\t\t\t</Table>\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n","import { useMemo } from \"react\";\nimport type { ArtifactWithFlowRunAndTaskRun } from \"@/api/artifacts\";\nimport { ArtifactDetailHeader } from \"./artifact-detail-header\";\nimport { ArtifactDataDisplay } from \"./artifact-raw-data-display\";\nimport { DetailImage } from \"./detail-image\";\nimport { DetailMarkdown } from \"./detail-markdown\";\nimport { DetailProgress } from \"./detail-progress\";\nimport { DetailTable } from \"./detail-table\";\n\nexport type ArtifactDetailPageProps = {\n\tartifact: ArtifactWithFlowRunAndTaskRun;\n};\n\nexport const ArtifactDetailPage = ({ artifact }: ArtifactDetailPageProps) => {\n\tconst mapArtifactHoc = useMemo(() => {\n\t\tswitch (artifact.type) {\n\t\t\tcase \"markdown\":\n\t\t\tcase \"link\":\n\t\t\t\treturn <DetailMarkdown markdown={artifact.data as string} />;\n\t\t\tcase \"image\":\n\t\t\t\treturn <DetailImage url={artifact.data as string} />;\n\t\t\tcase \"progress\":\n\t\t\t\treturn <DetailProgress progress={artifact.data as number} />;\n\t\t\tcase \"table\":\n\t\t\t\treturn <DetailTable tableData={artifact.data as string} />;\n\t\t\tdefault:\n\t\t\t\treturn <pre>{JSON.stringify(artifact.data, null, 2)}</pre>;\n\t\t}\n\t}, [artifact]);\n\treturn (\n\t\t<div>\n\t\t\t<ArtifactDetailHeader artifact={artifact} />\n\t\t\t{mapArtifactHoc}\n\t\t\t<ArtifactDataDisplay artifact={artifact} />\n\t\t</div>\n\t);\n};\n","import { useSuspenseQuery } from \"@tanstack/react-query\";\nimport { createFileRoute } from \"@tanstack/react-router\";\nimport { buildGetArtifactQuery } from \"@/api/artifacts\";\nimport { useGetArtifactFlowTaskRuns } from \"@/api/artifacts/use-get-artifacts-flow-task-runs/use-get-artifacts-flow-task-runs\";\nimport { ArtifactDetailPage } from \"@/components/artifacts/artifact/artifact-detail-page\";\n\nexport const Route = createFileRoute(\"/artifacts/artifact/$id\")({\n\tcomponent: RouteComponent,\n\tloader: async ({ context, params }) => {\n\t\tconst { id } = params;\n\n\t\tconst artifact = await context.queryClient.ensureQueryData(\n\t\t\tbuildGetArtifactQuery(id),\n\t\t);\n\n\t\treturn { artifact };\n\t},\n});\n\nfunction RouteComponent() {\n\tconst { id } = Route.useParams();\n\n\tconst { data: artifact } = useSuspenseQuery(buildGetArtifactQuery(id));\n\n\tconst artifactWithMetadata = useGetArtifactFlowTaskRuns(id);\n\n\treturn <ArtifactDetailPage artifact={artifactWithMetadata ?? artifact} />;\n}\n"],"names":["ArtifactDetailHeader","artifact","header","jsx","Fragment","Breadcrumb","BreadcrumbList","BreadcrumbItem","BreadcrumbLink","BreadcrumbSeparator","jsxs","DocsLink","Typography","LazyMarkdown","ArtifactDataDisplay","showData","setShowData","useState","toggleShowData","val","editor","useRef","basicSetup","setContainer","useCodeMirror","EditorView","useEffect","handleCopy","_value","toast","Button","node","Icon","DetailImage","url","DetailMarkdown","markdown","DetailProgress","progress","DetailTable","tableData","table","headers","input","setInput","filteredTable","useMemo","row","value","SearchInput","e","Table","TableHeader","TableRow","TableHead","TableBody","TableCell","ArtifactDetailPage","mapArtifactHoc","RouteComponent","id","Route","useParams","data","useSuspenseQuery","buildGetArtifactQuery","artifactWithMetadata","useGetArtifactFlowTaskRuns"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"artifact._id-zuZ8P2RD.js","sources":["../../src/components/artifacts/artifact/artifact-detail-header.tsx","../../src/components/artifacts/artifact/artifact-raw-data-display.tsx","../../src/components/artifacts/artifact/detail-image.tsx","../../src/components/artifacts/artifact/detail-markdown.tsx","../../src/components/artifacts/artifact/detail-progress.tsx","../../src/components/artifacts/artifact/detail-table.tsx","../../src/components/artifacts/artifact/artifact-detail-page.tsx","../../src/routes/artifacts/artifact.$id.tsx?tsr-split=component"],"sourcesContent":["import type { ArtifactWithFlowRunAndTaskRun } from \"@/api/artifacts\";\nimport {\n\tBreadcrumb,\n\tBreadcrumbItem,\n\tBreadcrumbLink,\n\tBreadcrumbList,\n\tBreadcrumbSeparator,\n} from \"@/components/ui/breadcrumb\";\nimport { DocsLink } from \"@/components/ui/docs-link\";\nimport { LazyMarkdown } from \"@/components/ui/lazy-markdown\";\nimport { Typography } from \"@/components/ui/typography\";\n\nexport type ArtifactDetailHeaderProps = {\n\tartifact: ArtifactWithFlowRunAndTaskRun;\n};\n\nexport const ArtifactDetailHeader = ({\n\tartifact,\n}: ArtifactDetailHeaderProps) => {\n\tlet header = <></>;\n\tif (artifact.key) {\n\t\theader = (\n\t\t\t<div className=\"flex items-center gap-2\">\n\t\t\t\t<Breadcrumb>\n\t\t\t\t\t<BreadcrumbList>\n\t\t\t\t\t\t<BreadcrumbItem>\n\t\t\t\t\t\t\t<BreadcrumbLink\n\t\t\t\t\t\t\t\tto=\"/artifacts/key/$key\"\n\t\t\t\t\t\t\t\tparams={{ key: artifact.key }}\n\t\t\t\t\t\t\t\tclassName=\"text-xl font-semibold\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{artifact.key}\n\t\t\t\t\t\t\t</BreadcrumbLink>\n\t\t\t\t\t\t</BreadcrumbItem>\n\t\t\t\t\t\t<BreadcrumbSeparator />\n\t\t\t\t\t\t<BreadcrumbItem className=\"text-xl font-semibold\">\n\t\t\t\t\t\t\t{artifact.id}\n\t\t\t\t\t\t</BreadcrumbItem>\n\t\t\t\t\t</BreadcrumbList>\n\t\t\t\t</Breadcrumb>\n\t\t\t</div>\n\t\t);\n\t} else {\n\t\theader = (\n\t\t\t<div className=\"flex items-center gap-2\">\n\t\t\t\t<Breadcrumb>\n\t\t\t\t\t<BreadcrumbList>\n\t\t\t\t\t\t{artifact.flow_run && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<BreadcrumbItem>\n\t\t\t\t\t\t\t\t\t<BreadcrumbLink\n\t\t\t\t\t\t\t\t\t\tto=\"/runs/flow-run/$id\"\n\t\t\t\t\t\t\t\t\t\tparams={{ id: artifact.flow_run_id ?? \"\" }}\n\t\t\t\t\t\t\t\t\t\tclassName=\"text-xl font-semibold\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{artifact.flow_run.name}\n\t\t\t\t\t\t\t\t\t</BreadcrumbLink>\n\t\t\t\t\t\t\t\t</BreadcrumbItem>\n\t\t\t\t\t\t\t\t<BreadcrumbSeparator />\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{artifact.task_run && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<BreadcrumbItem>\n\t\t\t\t\t\t\t\t\t<BreadcrumbLink\n\t\t\t\t\t\t\t\t\t\tto=\"/runs/task-run/$id\"\n\t\t\t\t\t\t\t\t\t\tparams={{ id: artifact.task_run_id ?? \"\" }}\n\t\t\t\t\t\t\t\t\t\tclassName=\"text-xl font-semibold\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{artifact.task_run.name}\n\t\t\t\t\t\t\t\t\t</BreadcrumbLink>\n\t\t\t\t\t\t\t\t</BreadcrumbItem>\n\t\t\t\t\t\t\t\t<BreadcrumbSeparator />\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t<BreadcrumbItem className=\"text-xl font-semibold\">\n\t\t\t\t\t\t\t{artifact.id}\n\t\t\t\t\t\t</BreadcrumbItem>\n\t\t\t\t\t</BreadcrumbList>\n\t\t\t\t</Breadcrumb>\n\t\t\t</div>\n\t\t);\n\t}\n\treturn (\n\t\t<>\n\t\t\t<div className=\"flex items-center justify-between\">\n\t\t\t\t{header}\n\t\t\t\t<DocsLink id=\"artifacts-guide\" label=\"Documentation\" />\n\t\t\t</div>\n\t\t\t{artifact.description && (\n\t\t\t\t<div className=\"\">\n\t\t\t\t\t<Typography variant=\"h2\" className=\"my-4 font-bold prose lg:prose-xl\">\n\t\t\t\t\t\t<LazyMarkdown>{artifact.description}</LazyMarkdown>\n\t\t\t\t\t</Typography>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t\t<hr />\n\t\t</>\n\t);\n};\n","import { EditorView, useCodeMirror } from \"@uiw/react-codemirror\";\nimport { useEffect, useRef, useState } from \"react\";\nimport { toast } from \"sonner\";\nimport type { ArtifactWithFlowRunAndTaskRun } from \"@/api/artifacts\";\nimport { Button } from \"@/components/ui/button\";\nimport { Icon } from \"@/components/ui/icons\";\n\ntype ArtifactDataDisplayProps = {\n\tartifact: ArtifactWithFlowRunAndTaskRun;\n};\n\nexport const ArtifactDataDisplay = ({ artifact }: ArtifactDataDisplayProps) => {\n\tconst [showData, setShowData] = useState(false);\n\n\tconst toggleShowData = () => {\n\t\tsetShowData((val) => !val);\n\t};\n\n\tconst editor = useRef<HTMLDivElement | null>(null);\n\tconst basicSetup = {\n\t\thighlightActiveLine: false,\n\t\tfoldGutter: false,\n\t\thighlightActiveLineGutter: false,\n\t};\n\tconst { setContainer } = useCodeMirror({\n\t\tcontainer: editor.current,\n\t\textensions: [EditorView.lineWrapping],\n\t\tvalue: String(artifact.data),\n\t\tindentWithTab: false,\n\t\teditable: true,\n\t\tbasicSetup,\n\t});\n\n\tuseEffect(() => {\n\t\tif (editor.current) {\n\t\t\tsetContainer(editor.current);\n\t\t}\n\t}, [setContainer]);\n\n\tconst handleCopy = (_value: string) => {\n\t\ttoast.success(\"Copied to clipboard\");\n\t\tvoid navigator.clipboard.writeText(_value);\n\t};\n\n\treturn (\n\t\t<div className=\"flex flex-col justify-center items-center\">\n\t\t\t<Button\n\t\t\t\tdata-testid=\"show-raw-data-button\"\n\t\t\t\tvariant={\"outline\"}\n\t\t\t\tonClick={toggleShowData}\n\t\t\t\tclassName=\"my-4\"\n\t\t\t>\n\t\t\t\t{showData ? \"Hide\" : \"Show\"} Raw Data\n\t\t\t</Button>\n\n\t\t\t<div\n\t\t\t\tclassName=\"rounded-md border shadow-xs focus-within:outline-hidden focus-within:ring-1 focus-within:ring-ring relative\"\n\t\t\t\tstyle={{\n\t\t\t\t\tdisplay: showData ? \"block\" : \"none\",\n\t\t\t\t}}\n\t\t\t\tref={(node) => {\n\t\t\t\t\teditor.current = node;\n\t\t\t\t}}\n\t\t\t\tdata-testid=\"raw-data-display\"\n\t\t\t>\n\t\t\t\t<Button\n\t\t\t\t\tonClick={() => handleCopy(artifact.data as string)}\n\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\tsize=\"icon\"\n\t\t\t\t\tclassName=\"absolute top-0 right-0 z-10\"\n\t\t\t\t\taria-label=\"copy\"\n\t\t\t\t>\n\t\t\t\t\t<Icon id=\"Copy\" className=\"size-2\" />\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n","import { Typography } from \"@/components/ui/typography\";\n\nexport type DetailImageProps = {\n\turl: string;\n};\n\nexport const DetailImage = ({ url }: DetailImageProps) => {\n\treturn (\n\t\t<div data-testid={url} className=\"prose mt-2\">\n\t\t\t<img\n\t\t\t\tdata-testid={`image-${url}`}\n\t\t\t\tsrc={url}\n\t\t\t\talt=\"artifact-image\"\n\t\t\t\tclassName=\"w-full\"\n\t\t\t/>\n\n\t\t\t<Typography variant=\"bodyLarge\">\n\t\t\t\tImage URL:{\" \"}\n\t\t\t\t<a\n\t\t\t\t\tclassName=\"text-blue-700 hover:underline\"\n\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\thref={url}\n\t\t\t\t\trel=\"noreferrer\"\n\t\t\t\t>\n\t\t\t\t\t{url}\n\t\t\t\t</a>\n\t\t\t</Typography>\n\t\t</div>\n\t);\n};\n","import { LazyMarkdown } from \"@/components/ui/lazy-markdown\";\n\nexport type DetailMarkdownProps = {\n\tmarkdown: string;\n};\n\nexport const DetailMarkdown = ({ markdown }: DetailMarkdownProps) => {\n\treturn (\n\t\t<div data-testid=\"markdown-display\" className=\"mt-4 prose\">\n\t\t\t<LazyMarkdown>{markdown}</LazyMarkdown>\n\t\t</div>\n\t);\n};\n","import { Typography } from \"@/components/ui/typography\";\n\nexport type DetailProgressProps = {\n\tprogress: number;\n};\n\nexport const DetailProgress = ({ progress }: DetailProgressProps) => {\n\treturn (\n\t\t<Typography data-testid=\"progress-display\" variant=\"bodyLarge\">\n\t\t\tProgress: {progress}%\n\t\t</Typography>\n\t);\n};\n","import { useMemo, useState } from \"react\";\nimport { SearchInput } from \"@/components/ui/input\";\nimport {\n\tTable,\n\tTableBody,\n\tTableCell,\n\tTableHead,\n\tTableHeader,\n\tTableRow,\n} from \"@/components/ui/table\";\n\nexport type DetailTableProps = {\n\ttableData: string;\n};\n\nexport const DetailTable = ({ tableData }: DetailTableProps) => {\n\tconst table = JSON.parse(tableData) as Record<string, string>[];\n\tconst headers = Object.keys(table[0]);\n\tconst [input, setInput] = useState<string>(\"\");\n\n\tconst filteredTable = useMemo(() => {\n\t\treturn table.filter((row) => {\n\t\t\treturn Object.values(row).some((value: string) =>\n\t\t\t\tString(value).toLowerCase().includes(input.toLowerCase()),\n\t\t\t);\n\t\t});\n\t}, [input, table]);\n\n\treturn (\n\t\t<div data-testid=\"table-display\" className=\"mt-4\">\n\t\t\t<div className=\"flex flex-row justify-end items-center mb-2\">\n\t\t\t\t<div>\n\t\t\t\t\t<SearchInput\n\t\t\t\t\t\tplaceholder=\"Search\"\n\t\t\t\t\t\tvalue={input}\n\t\t\t\t\t\tonChange={(e) => setInput(e.target.value)}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div className=\"rounded-md border\">\n\t\t\t\t<Table>\n\t\t\t\t\t<TableHeader className=\"bg-muted\">\n\t\t\t\t\t\t<TableRow>\n\t\t\t\t\t\t\t{headers.map((header) => {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<TableHead key={header} className=\"py-2 text-foreground\">\n\t\t\t\t\t\t\t\t\t\t{header}\n\t\t\t\t\t\t\t\t\t</TableHead>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t</TableRow>\n\t\t\t\t\t</TableHeader>\n\t\t\t\t\t<TableBody>\n\t\t\t\t\t\t{filteredTable.map((row) => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<TableRow key={row.id}>\n\t\t\t\t\t\t\t\t\t{headers.map((header) => {\n\t\t\t\t\t\t\t\t\t\treturn <TableCell key={header}>{row[header]}</TableCell>;\n\t\t\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\t\t</TableRow>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t})}\n\t\t\t\t\t</TableBody>\n\t\t\t\t</Table>\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n","import { useMemo } from \"react\";\nimport type { ArtifactWithFlowRunAndTaskRun } from \"@/api/artifacts\";\nimport { ArtifactDetailHeader } from \"./artifact-detail-header\";\nimport { ArtifactDataDisplay } from \"./artifact-raw-data-display\";\nimport { DetailImage } from \"./detail-image\";\nimport { DetailMarkdown } from \"./detail-markdown\";\nimport { DetailProgress } from \"./detail-progress\";\nimport { DetailTable } from \"./detail-table\";\n\nexport type ArtifactDetailPageProps = {\n\tartifact: ArtifactWithFlowRunAndTaskRun;\n};\n\nexport const ArtifactDetailPage = ({ artifact }: ArtifactDetailPageProps) => {\n\tconst mapArtifactHoc = useMemo(() => {\n\t\tswitch (artifact.type) {\n\t\t\tcase \"markdown\":\n\t\t\tcase \"link\":\n\t\t\t\treturn <DetailMarkdown markdown={artifact.data as string} />;\n\t\t\tcase \"image\":\n\t\t\t\treturn <DetailImage url={artifact.data as string} />;\n\t\t\tcase \"progress\":\n\t\t\t\treturn <DetailProgress progress={artifact.data as number} />;\n\t\t\tcase \"table\":\n\t\t\t\treturn <DetailTable tableData={artifact.data as string} />;\n\t\t\tdefault:\n\t\t\t\treturn <pre>{JSON.stringify(artifact.data, null, 2)}</pre>;\n\t\t}\n\t}, [artifact]);\n\treturn (\n\t\t<div>\n\t\t\t<ArtifactDetailHeader artifact={artifact} />\n\t\t\t{mapArtifactHoc}\n\t\t\t<ArtifactDataDisplay artifact={artifact} />\n\t\t</div>\n\t);\n};\n","import { useSuspenseQuery } from \"@tanstack/react-query\";\nimport { createFileRoute } from \"@tanstack/react-router\";\nimport { buildGetArtifactQuery } from \"@/api/artifacts\";\nimport { useGetArtifactFlowTaskRuns } from \"@/api/artifacts/use-get-artifacts-flow-task-runs/use-get-artifacts-flow-task-runs\";\nimport { ArtifactDetailPage } from \"@/components/artifacts/artifact/artifact-detail-page\";\n\nexport const Route = createFileRoute(\"/artifacts/artifact/$id\")({\n\tcomponent: RouteComponent,\n\tloader: async ({ context, params }) => {\n\t\tconst { id } = params;\n\n\t\tconst artifact = await context.queryClient.ensureQueryData(\n\t\t\tbuildGetArtifactQuery(id),\n\t\t);\n\n\t\treturn { artifact };\n\t},\n});\n\nfunction RouteComponent() {\n\tconst { id } = Route.useParams();\n\n\tconst { data: artifact } = useSuspenseQuery(buildGetArtifactQuery(id));\n\n\tconst artifactWithMetadata = useGetArtifactFlowTaskRuns(id);\n\n\treturn <ArtifactDetailPage artifact={artifactWithMetadata ?? artifact} />;\n}\n"],"names":["ArtifactDetailHeader","artifact","header","jsx","Fragment","Breadcrumb","BreadcrumbList","BreadcrumbItem","BreadcrumbLink","BreadcrumbSeparator","jsxs","DocsLink","Typography","LazyMarkdown","ArtifactDataDisplay","showData","setShowData","useState","toggleShowData","val","editor","useRef","basicSetup","setContainer","useCodeMirror","EditorView","useEffect","handleCopy","_value","toast","Button","node","Icon","DetailImage","url","DetailMarkdown","markdown","DetailProgress","progress","DetailTable","tableData","table","headers","input","setInput","filteredTable","useMemo","row","value","SearchInput","e","Table","TableHeader","TableRow","TableHead","TableBody","TableCell","ArtifactDetailPage","mapArtifactHoc","RouteComponent","id","Route","useParams","data","useSuspenseQuery","buildGetArtifactQuery","artifactWithMetadata","useGetArtifactFlowTaskRuns"],"mappings":"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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as e,r as m,t as E,L as Qe}from"./vendor-tanstack-BcZfOOfy.js";import{a as Je}from"./zod-Cuos7J7w.js";import{g as _,p as D,q as Ge,Z as Re,c as Ye}from"./vendor-forms-ClCIacbh.js";import{S as B,a as z,b as Q,c as J,d as Me,di as He,e as G,b5 as Ke,bm as Ve,bp as Oe,ac as R,ad as M,ae as V,af as O,ah as W,ag as I,ai as F,aj as k,I as Y,dj as We,bN as me,p as Z,al as re,br as Xe,be as Ze,ab as ie,M as pe,d2 as Ie,q as U,i as xe,aW as et,a_ as tt,ap as st,cP as je,ak as ve,aq as be,aw as rt,ax as nt,ay as Se,az as we,L as ot,C as at,o as lt,dk as ct}from"./index-nxDkMXcY.js";import{b as w,c as b,d as S,e as y,a as C,F as it}from"./form-CxD6-5Qf.js";import{u as ut,S as dt}from"./use-stepper-1OG0a_eo.js";import{U as te,T as Pe,A as ht}from"./automation-schema-BIBsyp0j.js";import{T as fe}from"./textarea-vy4DM6KG.js";import{S as mt,R as pt,a as $e,b as ye,c as xt}from"./index-Cwd5Gvad.js";import{R as ft,a as gt}from"./radio-group-CJhtPDwC.js";import{u as jt,C as vt,a as bt,b as St}from"./collapsible-BlEqjqQu.js";import{T as wt}from"./tags-input-C7cxdTyV.js";const Ce={"cancel-flow-run":"Cancel a flow run","suspend-flow-run":"Suspend a flow run","resume-flow-run":"Resume a flow run","change-flow-run-state":"Change flow run's state","run-deployment":"Run a deployment","pause-deployment":"Pause a deployment","resume-deployment":"Resume a deployment","pause-work-queue":"Pause a work queue","resume-work-queue":"Resume a work queue","pause-work-pool":"Pause a work pool","resume-work-pool":"Resume a work pool","pause-automation":"Pause an automation","resume-automation":"Resume an automation","send-notification":"Send a notification","call-webhook":"Call a webhook"},yt=({index:t})=>{const s=_();return e.jsx(w,{control:s.control,name:`actions.${t}.type`,render:({field:n})=>e.jsxs(b,{children:[e.jsx(S,{children:"Action Type"}),e.jsx(y,{children:e.jsxs(B,{...n,onValueChange:r=>{n.onChange(r);const a=Ct({index:t,type:r});a&&s.setValue(a,te)},children:[e.jsx(z,{"aria-label":"select action",className:"w-full",children:e.jsx(Q,{placeholder:"Select action"})}),e.jsx(J,{children:e.jsxs(Me,{children:[e.jsx(He,{children:"Actions"}),Object.keys(Ce).map(r=>e.jsx(G,{value:r,children:Ce[r]},r))]})})]})})]})})};function Ct({index:t,type:s}){switch(s){case"run-deployment":case"pause-deployment":case"resume-deployment":return`actions.${t}.deployment_id`;case"pause-work-queue":case"resume-work-queue":return`actions.${t}.work_queue_id`;case"pause-work-pool":case"resume-work-pool":return`actions.${t}.work_pool_id`;case"pause-automation":case"resume-automation":return`actions.${t}.automation_id`;default:return null}}const kt=4,ee=({length:t=kt})=>Array.from({length:t},(s,n)=>e.jsx(Ke,{className:"mt-2 p-4 h-2 w-full"},n)),Nt=({index:t})=>{const s=_(),[n,r]=m.useState(""),{data:a,isLoading:o}=E(Ve({offset:0,block_types:{slug:{any_:["webhook"]}}})),l=m.useMemo(()=>a?.map(i=>i.slug)??[],[a]),{data:h,isLoading:p}=E(Oe({block_types:l.length>0?{slug:{any_:l}}:void 0,include_secrets:!1,sort:"BLOCK_TYPE_AND_NAME_ASC",offset:0},{enabled:l.length>0})),d=o||p,c=m.useMemo(()=>!a||!h?[]:a.map(i=>({blockType:i,documents:h.filter(f=>f.block_type_id===i.id)})).filter(i=>i.documents.length>0),[a,h]),x=m.useMemo(()=>{if(!n)return c;const i=n.toLowerCase();return c.map(f=>({...f,documents:f.documents.filter(j=>j.name?.toLowerCase().includes(i))})).filter(f=>f.documents.length>0)},[c,n]),u=m.useCallback(i=>{if(!(!i||!h))return h.find(f=>f.id===i)},[h]);return e.jsxs("div",{className:"space-y-4",children:[e.jsx(w,{control:s.control,name:`actions.${t}.block_document_id`,render:({field:i})=>{const f=u(i.value);return e.jsxs(b,{className:"flex flex-col",children:[e.jsx(S,{children:"Block"}),e.jsxs(R,{children:[e.jsx(M,{selected:!!f,"aria-label":"Select webhook block",children:f?f.name:"Select a webhook block"}),e.jsxs(V,{children:[e.jsx(O,{value:n,onValueChange:r,placeholder:"Search for a block..."}),e.jsx(W,{children:"No webhook blocks found"}),e.jsx(I,{children:d?e.jsx(ee,{}):x.map(j=>e.jsx(F,{heading:j.blockType.name,children:j.documents.map(A=>e.jsx(k,{value:A.id,selected:i.value===A.id,onSelect:i.onChange,children:A.name},A.id))},j.blockType.id))})]})]}),e.jsx(C,{})]})}}),e.jsx(_t,{index:t}),e.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-blue-200 bg-blue-50 p-3 text-sm text-blue-800 dark:border-blue-800 dark:bg-blue-950 dark:text-blue-200",children:[e.jsx(Y,{id:"Info",className:"mt-0.5 size-4 shrink-0"}),e.jsxs("p",{children:["In addition to any fields present on the triggering event, the following objects can be used in webhook payload templates:"," ",e.jsx("code",{className:"rounded bg-blue-100 px-1 py-0.5 font-mono text-xs dark:bg-blue-900",children:"flow"}),","," ",e.jsx("code",{className:"rounded bg-blue-100 px-1 py-0.5 font-mono text-xs dark:bg-blue-900",children:"deployment"}),","," ",e.jsx("code",{className:"rounded bg-blue-100 px-1 py-0.5 font-mono text-xs dark:bg-blue-900",children:"flow_run"}),","," ",e.jsx("code",{className:"rounded bg-blue-100 px-1 py-0.5 font-mono text-xs dark:bg-blue-900",children:"work_pool"}),", and"," ",e.jsx("code",{className:"rounded bg-blue-100 px-1 py-0.5 font-mono text-xs dark:bg-blue-900",children:"work_queue"}),"."]})]})]})},_t=({index:t})=>{const s=_(),{validateTemplate:n}=We(),[r,a]=m.useState(null),[o,l]=m.useState(!1),h=s.watch(`actions.${t}.payload`),p=me(h,1e3);return m.useEffect(()=>{(async()=>{if(!p||p.trim()===""){a(null);return}l(!0);try{const c=await n(p);c.valid?a(null):a(c.error)}catch{a(null)}finally{l(!1)}})()},[p,n]),e.jsx(w,{control:s.control,name:`actions.${t}.payload`,render:({field:d})=>e.jsxs(b,{children:[e.jsxs(S,{className:"flex items-center gap-2",children:["Payload",o&&e.jsx(Y,{id:"Loader2",className:"size-3 animate-spin"})]}),e.jsx(y,{children:e.jsx(fe,{...d,value:d.value??"",placeholder:"Enter webhook payload...",className:r?"border-destructive":"",rows:5})}),r&&e.jsx("p",{className:"text-sm text-destructive",children:r}),e.jsx(C,{})]})})},Tt=({index:t})=>{const s=_(),n=s.watch(`actions.${t}.state`);return e.jsxs(e.Fragment,{children:[e.jsx(w,{control:s.control,name:`actions.${t}.state`,render:({field:r})=>e.jsxs(b,{children:[e.jsx(S,{children:"State"}),e.jsx(y,{children:e.jsx(mt,{value:r.value,onValueChange:r.onChange})}),e.jsx(C,{})]})}),e.jsx(w,{control:s.control,name:`actions.${t}.name`,render:({field:r})=>e.jsxs(b,{children:[e.jsx(S,{children:"Name"}),e.jsx(y,{children:e.jsx(Z,{type:"text",...r,value:r.value??"",placeholder:n?pt[n]:void 0})}),e.jsx(C,{})]})}),e.jsx(w,{control:s.control,name:`actions.${t}.message`,render:({field:r})=>e.jsxs(b,{children:[e.jsx(S,{children:"Message"}),e.jsx(y,{children:e.jsx(fe,{...r,placeholder:"State changed by Automation <id>"})}),e.jsx(C,{})]})})]})},ae=({action:t})=>{const s=t==="Resume"?"Resume a flow run inferred from the triggering event":`${t} flow run inferred from the triggering event`;return e.jsx(re,{variant:"bodySmall",className:"text-muted-foreground",children:s})},H={value:te,name:"Infer Automation"},At=(t,s)=>{if(s===H.value)return H.name;const n=t?.find(r=>r.id===s);if(n)return n.name},ke=({action:t,index:s})=>{const[n,r]=m.useState(""),a=_(),{data:o,isSuccess:l}=E(Xe()),h=m.useDeferredValue(n),p=m.useMemo(()=>o?o.filter(c=>c.name.toLowerCase().includes(h.toLowerCase())):[],[o,h]),d=H.name.toLowerCase().includes(h.toLowerCase());return e.jsx(w,{control:a.control,name:`actions.${s}.automation_id`,render:({field:c})=>{const x=At(o,c.value);return e.jsxs(b,{className:"flex flex-col",children:[e.jsxs(S,{children:["Automation To ",t]}),e.jsxs(R,{children:[e.jsx(M,{selected:!!x,"aria-label":`Select Automation to ${t}`,children:x??"Select automation"}),e.jsxs(V,{children:[e.jsx(O,{value:n,onValueChange:r,placeholder:"Search for an automation..."}),e.jsx(W,{children:"No automation found"}),e.jsx(I,{children:e.jsxs(F,{children:[d&&e.jsx(k,{selected:c.value===H.value,onSelect:u=>{c.onChange(u),r("")},value:H.value,children:H.name}),l?p.map(u=>e.jsx(k,{selected:c.value===u.id,onSelect:i=>{c.onChange(i),r("")},value:u.id,children:u.name},u.id)):e.jsx(ee,{})]})})]})]}),e.jsx(C,{})]})}})},Et=(t={page:1,limit:100,sort:"NAME_ASC"})=>{const{data:s,status:n}=E(Ze(t)),r=new Set(s?.results.map(l=>l.flow_id)),{data:a,status:o}=E(ie({flows:{operator:"or_",id:{any_:Array.from(r)}},sort:"NAME_DESC",offset:0},{enabled:r.size>0}));return m.useMemo(()=>{if(a&&s){const l=new Map(a.map(i=>[i.id,i])),h=s.results.map(i=>({...i,flow:l.get(i.flow_id)})),{count:p,limit:d,pages:c,page:x}=s;return{data:{count:p,limit:d,pages:c,page:x,results:h},status:"success"}}return o==="error"||n==="error"?{data:void 0,status:"error"}:{data:void 0,status:"pending"}},[s,n,a,o])},q={value:te,name:"Infer Deployment"},Lt=(t,s)=>{if(s===q.value)return q.name;const n=t?.find(r=>r.id===s);if(n)return e.jsx(qe,{deploymentWithFlow:n})},le=({action:t,index:s})=>{const[n,r]=m.useState(""),a=_(),o=a.watch(`actions.${s}.type`),l=D({name:`actions.${s}.deployment_id`}),h=me(n,500),{data:p}=Et({page:1,sort:"NAME_ASC",deployments:{operator:"or_",flow_or_deployment_name:{like_:h}}}),d=q.name.toLowerCase().includes(n.toLowerCase()),c=p?.results;return e.jsxs(e.Fragment,{children:[e.jsx(w,{control:a.control,name:`actions.${s}.deployment_id`,render:({field:x})=>{const u=Lt(c,x.value);return e.jsxs(b,{className:"flex flex-col",children:[e.jsxs(S,{children:["Deployment To ",t]}),e.jsxs(R,{children:[e.jsx(M,{selected:!!u,"aria-label":`Select Deployment to ${t}`,children:u??"Select deployment"}),e.jsxs(V,{children:[e.jsx(O,{value:n,onValueChange:r,placeholder:"Search for an deployment..."}),e.jsx(W,{children:"No deployment found"}),e.jsx(I,{children:e.jsxs(F,{children:[d&&e.jsx(k,{selected:x.value===q.value,onSelect:x.onChange,value:q.value,children:q.name}),c?c.map(i=>e.jsx(k,{"aria-label":i.name,selected:x.value===i.id,onSelect:x.onChange,value:i.id,children:e.jsx(qe,{deploymentWithFlow:i})},i.id)):e.jsx(ee,{})]})})]})]}),e.jsx(C,{})]})}}),l!==q.value&&o==="run-deployment"&&e.jsx("div",{children:"TODO: Additional fields"})]})},qe=({deploymentWithFlow:t})=>t.flow?e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx("div",{children:t.flow.name}),e.jsx(Y,{className:"size-4",id:"ChevronRight"}),e.jsx("div",{children:t.name})]}):t.name,K={value:te,name:"Infer Work Pool"},Dt=(t,s)=>{if(s===K.value)return K.name;const n=t?.find(r=>r.id===s);if(n)return n.name},Ne=({action:t,index:s})=>{const[n,r]=m.useState(""),a=_(),{data:o,isSuccess:l}=E(pe()),h=m.useDeferredValue(n),p=m.useMemo(()=>o?o.filter(c=>c.name.toLowerCase().includes(h.toLowerCase())):[],[o,h]),d=K.name.toLowerCase().includes(h.toLowerCase());return e.jsx(w,{control:a.control,name:`actions.${s}.work_pool_id`,render:({field:c})=>{const x=Dt(o,c.value);return e.jsxs(b,{className:"flex flex-col",children:[e.jsxs(S,{children:["Work Pool To ",t]}),e.jsxs(R,{children:[e.jsx(M,{selected:!!x,"aria-label":`Select Work Pool to ${t}`,children:x??"Select Work Pool"}),e.jsxs(V,{children:[e.jsx(O,{value:n,onValueChange:r,placeholder:"Search for a work pool..."}),e.jsx(W,{children:"No work pool found"}),e.jsx(I,{children:e.jsxs(F,{children:[d&&e.jsx(k,{selected:c.value===K.value,onSelect:u=>{c.onChange(u),r("")},value:K.value,children:K.name}),l?p.map(u=>e.jsx(k,{selected:c.value===u.id,onSelect:i=>{c.onChange(i),r("")},value:u.id,children:u.name},u.id)):e.jsx(ee,{})]})})]})]}),e.jsx(C,{})]})}})},X={value:te,name:"Infer Work Queue"},Ft=(t,s)=>{if(s===X.value)return X.name;const n=t?.find(r=>r.id===s);if(n)return n.name},_e=({action:t,index:s})=>{const[n,r]=m.useState(""),a=_(),{data:o}=E(Ie()),l=m.useDeferredValue(n),h=m.useMemo(()=>{if(!o)return;const d=new Map,c=o.filter(x=>x.name.toLowerCase().includes(l.toLowerCase()));for(const x of c){const{work_pool_name:u}=x;if(!u)throw new Error("'work_pool_name expected");d.set(u,[...d.get(u)??[],x])}return d},[o,l]),p=X.name.toLowerCase().includes(l.toLowerCase());return e.jsx(w,{control:a.control,name:`actions.${s}.work_queue_id`,render:({field:d})=>{const c=Ft(o,d.value);return e.jsxs(b,{className:"flex flex-col",children:[e.jsxs(S,{children:["Work Queue To ",t]}),e.jsxs(R,{children:[e.jsx(M,{selected:!!c,"aria-label":`Select Work Queue to ${t}`,children:c??"Select Work Queue"}),e.jsxs(V,{children:[e.jsx(O,{value:n,onValueChange:r,placeholder:"Search for a work queue..."}),e.jsx(W,{children:"No work queue found"}),e.jsx(I,{children:e.jsxs(F,{children:[p&&e.jsx(k,{selected:d.value===X.value,onSelect:x=>{d.onChange(x),r("")},value:X.value,children:X.name}),h?Array.from(h).map(([x,u])=>e.jsxs("div",{className:"border-b",children:[e.jsx(k,{disabled:!0,children:x}),u.map(i=>e.jsx(k,{selected:d.value===i.id,onSelect:f=>{d.onChange(f),r("")},value:i.id,children:i.name},i.id))]},x)):e.jsx(ee,{})]})})]})]}),e.jsx(C,{})]})}})},Rt=({index:t})=>{const s=_(),[n,r]=m.useState(""),{data:a,isLoading:o}=E(Ve({offset:0,block_schemas:{operator:"and_",block_capabilities:{all_:["notify"]}}})),l=m.useMemo(()=>a?.map(i=>i.slug)??[],[a]),{data:h,isLoading:p}=E(Oe({block_types:l.length>0?{slug:{any_:l}}:void 0,include_secrets:!1,sort:"BLOCK_TYPE_AND_NAME_ASC",offset:0},{enabled:l.length>0})),d=o||p,c=m.useMemo(()=>!a||!h?[]:a.map(i=>({blockType:i,documents:h.filter(f=>f.block_type_id===i.id)})).filter(i=>i.documents.length>0),[a,h]),x=m.useMemo(()=>{if(!n)return c;const i=n.toLowerCase();return c.map(f=>({...f,documents:f.documents.filter(j=>j.name?.toLowerCase().includes(i))})).filter(f=>f.documents.length>0)},[c,n]),u=m.useCallback(i=>{if(!(!i||!h))return h.find(f=>f.id===i)},[h]);return e.jsxs("div",{className:"space-y-4",children:[e.jsx(w,{control:s.control,name:`actions.${t}.block_document_id`,render:({field:i})=>{const f=u(i.value);return e.jsxs(b,{className:"flex flex-col",children:[e.jsx(S,{children:"Block"}),e.jsxs(R,{children:[e.jsx(M,{selected:!!f,"aria-label":"Select notification block",children:f?f.name:"Select a notification block"}),e.jsxs(V,{children:[e.jsx(O,{value:n,onValueChange:r,placeholder:"Search for a block..."}),e.jsx(W,{children:"No notification blocks found"}),e.jsx(I,{children:d?e.jsx(ee,{}):x.map(j=>e.jsx(F,{heading:j.blockType.name,children:j.documents.map(A=>e.jsx(k,{value:A.id,selected:i.value===A.id,onSelect:i.onChange,children:A.name},A.id))},j.blockType.id))})]})]}),e.jsx(C,{})]})}}),e.jsx(Te,{index:t,name:"subject",label:"Subject",placeholder:"Enter notification subject..."}),e.jsx(Te,{index:t,name:"body",label:"Body",placeholder:"Enter notification body...",multiline:!0}),e.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-blue-200 bg-blue-50 p-3 text-sm text-blue-800 dark:border-blue-800 dark:bg-blue-950 dark:text-blue-200",children:[e.jsx(Y,{id:"Info",className:"mt-0.5 size-4 shrink-0"}),e.jsxs("p",{children:["In addition to any fields present on the triggering event, the following objects can be used in notification templates:"," ",e.jsx("code",{className:"rounded bg-blue-100 px-1 py-0.5 font-mono text-xs dark:bg-blue-900",children:"flow"}),","," ",e.jsx("code",{className:"rounded bg-blue-100 px-1 py-0.5 font-mono text-xs dark:bg-blue-900",children:"deployment"}),","," ",e.jsx("code",{className:"rounded bg-blue-100 px-1 py-0.5 font-mono text-xs dark:bg-blue-900",children:"flow_run"}),","," ",e.jsx("code",{className:"rounded bg-blue-100 px-1 py-0.5 font-mono text-xs dark:bg-blue-900",children:"work_pool"}),","," ",e.jsx("code",{className:"rounded bg-blue-100 px-1 py-0.5 font-mono text-xs dark:bg-blue-900",children:"work_queue"}),", and"," ",e.jsx("code",{className:"rounded bg-blue-100 px-1 py-0.5 font-mono text-xs dark:bg-blue-900",children:"metric"}),"."]})]})]})},Te=({index:t,name:s,label:n,placeholder:r,multiline:a=!1})=>{const o=_(),{validateTemplate:l}=We(),[h,p]=m.useState(null),[d,c]=m.useState(!1),x=o.watch(`actions.${t}.${s}`),u=me(x,1e3);m.useEffect(()=>{(async()=>{if(!u||u.trim()===""){p(null);return}c(!0);try{const j=await l(u);j.valid?p(null):p(j.error)}catch{p(null)}finally{c(!1)}})()},[u,l]);const i=a?fe:Z;return e.jsx(w,{control:o.control,name:`actions.${t}.${s}`,render:({field:f})=>e.jsxs(b,{children:[e.jsxs(S,{className:"flex items-center gap-2",children:[n,d&&e.jsx(Y,{id:"Loader2",className:"size-3 animate-spin"})]}),e.jsx(y,{children:e.jsx(i,{...f,value:f.value??"",placeholder:r,className:h?"border-destructive":""})}),h&&e.jsx("p",{className:"text-sm text-destructive",children:h}),e.jsx(C,{})]})})},Mt=({index:t,onRemove:s})=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs(re,{variant:"body",className:"font-semibold",children:["Action ",t+1]}),e.jsx(U,{size:"icon","aria-label":`remove action ${t+1}`,onClick:s,variant:"outline",children:e.jsx(Y,{id:"Trash2",className:"size-4"})})]}),e.jsx(yt,{index:t}),e.jsx(Vt,{index:t}),e.jsx("hr",{className:"my-8"})]},t),Vt=({index:t})=>{switch(D({name:`actions.${t}.type`})){case"change-flow-run-state":return e.jsx(Tt,{index:t});case"run-deployment":return e.jsx(le,{action:"Run",index:t});case"pause-deployment":return e.jsx(le,{action:"Pause",index:t});case"resume-deployment":return e.jsx(le,{action:"Resume",index:t});case"pause-work-queue":return e.jsx(_e,{action:"Pause",index:t});case"resume-work-queue":return e.jsx(_e,{action:"Resume",index:t});case"pause-work-pool":return e.jsx(Ne,{action:"Pause",index:t});case"resume-work-pool":return e.jsx(Ne,{action:"Resume",index:t});case"pause-automation":return e.jsx(ke,{action:"Pause",index:t});case"resume-automation":return e.jsx(ke,{action:"Resume",index:t});case"send-notification":return e.jsx(Rt,{index:t});case"call-webhook":return e.jsx(Nt,{index:t});case"cancel-flow-run":return e.jsx(ae,{action:"Cancel"});case"suspend-flow-run":return e.jsx(ae,{action:"Suspend"});case"resume-flow-run":return e.jsx(ae,{action:"Resume"});default:return null}},Ot=()=>{const t=_(),{fields:s,append:n,remove:r}=Ge({control:t.control,name:"actions",shouldUnregister:!1,rules:{minLength:1}});return e.jsxs("div",{children:[s.map(({id:a},o)=>e.jsx(Mt,{index:o,onRemove:()=>r(o)},a)),e.jsxs(U,{type:"button",variant:"outline",onClick:()=>n({type:"cancel-flow-run"}),children:[e.jsx(Y,{id:"Plus",className:"mr-2 size-4"})," Add Action"]})]})},Wt=()=>{const t=_();return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(w,{control:t.control,name:"name",render:({field:s})=>e.jsxs(b,{children:[e.jsx(S,{children:"Automation Name"}),e.jsx(y,{children:e.jsx(Z,{type:"text",...s,value:s.value??""})}),e.jsx(C,{})]})}),e.jsx(w,{control:t.control,name:"description",render:({field:s})=>e.jsxs(b,{children:[e.jsx(S,{children:"Description (Optional)"}),e.jsx(y,{children:e.jsx(Z,{type:"text",...s,value:s.value??""})}),e.jsx(C,{})]})})]})},It=[{value:"Reactive",label:"Observe"},{value:"Proactive",label:"Don't observe"}],Pt=30,$t=()=>{const t=_(),s=n=>{const r=t.getValues("trigger.posture");if(t.setValue("trigger.posture",n),r==="Reactive"&&n==="Proactive"){const a=t.getValues("trigger.expect")??[];t.setValue("trigger.after",a),t.setValue("trigger.expect",[]),t.getValues("trigger.within")===0&&t.setValue("trigger.within",Pt)}else if(r==="Proactive"&&n==="Reactive"){const a=t.getValues("trigger.after")??[];t.setValue("trigger.expect",a),t.setValue("trigger.after",[])}};return e.jsx(w,{control:t.control,name:"trigger.posture",render:({field:n})=>e.jsxs(b,{children:[e.jsx(S,{children:"When I"}),e.jsx(y,{children:e.jsx(ft,{value:n.value,onValueChange:s,className:"flex gap-4",children:It.map(r=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(gt,{value:r.value,id:`custom-${r.value}`}),e.jsx(xe,{htmlFor:`custom-${r.value}`,children:r.label})]},r.value))})})]})})},ue=60,de=3600,he=86400,qt=[{label:"Seconds",value:1},{label:"Minutes",value:ue},{label:"Hours",value:de},{label:"Days",value:he}];function Ut(t){return t>0&&t%he===0?he:t>0&&t%de===0?de:t>0&&t%ue===0?ue:1}function se({value:t,onChange:s,min:n=0,max:r,className:a,disabled:o=!1}){const[l,h]=m.useState(()=>Ut(t)),p=m.useMemo(()=>qt.filter(u=>u.value>=n),[n]),d=m.useMemo(()=>t/l,[t,l]),c=m.useCallback(u=>{let i=u*l;r!==void 0&&i>r&&(i=r),s(i)},[s,l,r]),x=m.useCallback(u=>{const i=Number(u),f=l;h(i);let j=t/f*i;r!==void 0&&j>r&&(j=r),s(j)},[s,l,t,r]);return m.useEffect(()=>{if(!p.some(u=>u.value===l)){const u=p[0];u&&h(u.value)}},[p,l]),e.jsxs("div",{className:et("grid grid-cols-[1fr_7rem] gap-2 w-full",a),children:[e.jsx(Z,{type:"number",min:0,value:d,onChange:u=>c(Number(u.target.value)),disabled:o,"aria-label":"Duration quantity"}),e.jsxs(B,{value:String(l),onValueChange:x,disabled:o,children:[e.jsx(z,{"aria-label":"Duration unit",children:e.jsx(Q,{})}),e.jsx(J,{children:p.map(u=>e.jsx(G,{value:String(u.value),children:u.label},u.value))})]})]})}const Bt=2,zt=40;function Ae({selectedResourceIds:t,onToggleResource:s,emptyMessage:n="All resources"}){const[r,a]=m.useState(""),o=m.useDeferredValue(r),[l,h]=m.useState(0),p=m.useRef(null),d=m.useRef(null);m.useEffect(()=>{const g=p.current;if(!g)return;const v=new ResizeObserver(N=>{for(const T of N)h(T.contentRect.width)});return v.observe(g),()=>v.disconnect()},[]);const{resourceOptions:c}=jt(),x=m.useMemo(()=>{const g=[{label:"Automations",options:[]},{label:"Blocks",options:[]},{label:"Deployments",options:[]},{label:"Flows",options:[]},{label:"Work Pools",options:[]},{label:"Work Queues",options:[]}];for(const v of c){const N={label:v.name,value:v.resourceId};switch(v.type){case"automation":g[0].options.push(N);break;case"block":g[1].options.push(N);break;case"deployment":g[2].options.push(N);break;case"flow":g[3].options.push(N);break;case"work-pool":g[4].options.push(N);break;case"work-queue":g[5].options.push(N);break}}return g.map(v=>({...v,options:v.options.sort((N,T)=>N.label.localeCompare(T.label))})).filter(v=>v.options.length>0)},[c]),u=m.useMemo(()=>{if(!o)return x;const g=o.toLowerCase();return x.map(v=>({...v,options:v.options.filter(N=>N.label.toLowerCase().includes(g)||N.value.toLowerCase().includes(g))})).filter(v=>v.options.length>0)},[x,o]),i=m.useMemo(()=>{if(!o.trim()||!o.includes("."))return!1;const g=o.toLowerCase();return!c.some(v=>v.resourceId.toLowerCase()===g)},[o,c]),f=m.useCallback(g=>{const v=d.current;if(!v||l===0||g.length===0)return Math.min(g.length,Bt);const N=g.length>1?l-zt:l;let T=0;for(let L=0;L<g.length&&(v.textContent=g.slice(0,L+1).join(", "),v.offsetWidth<=N);L++)T=L+1;return T===g.length?g.length:Math.max(1,T)},[l]),j=()=>{if(t.length===0)return e.jsx("span",{className:"text-muted-foreground",children:n});const g=t.map(L=>c.find(ze=>ze.resourceId===L)?.name??L),v=f(g),N=g.slice(0,v),T=g.length-v;return e.jsxs("div",{ref:p,className:"flex flex-1 min-w-0 items-center gap-2",children:[e.jsx("div",{className:"flex flex-1 min-w-0 items-center gap-2 overflow-hidden",children:e.jsx("span",{className:"truncate",children:N.join(", ")})}),T>0&&e.jsxs(re,{variant:"bodySmall",className:"shrink-0",children:["+ ",T]}),e.jsx("div",{ref:d,className:"absolute invisible whitespace-nowrap","aria-hidden":"true"})]})},A=g=>{s(g),a("")};return e.jsxs(R,{children:[e.jsx(M,{selected:t.length>0,children:j()}),e.jsxs(V,{children:[e.jsx(O,{value:r,onValueChange:a,placeholder:"Search resources..."}),e.jsxs(I,{children:[e.jsx(W,{children:"No resources found"}),i&&e.jsx(F,{children:e.jsxs(k,{selected:t.includes(o),onSelect:()=>A(o),closeOnSelect:!1,value:o,children:['Add "',o,'"']},"__custom__")}),u.map(g=>e.jsx(F,{heading:g.label,children:g.options.map(v=>e.jsx(k,{selected:t.includes(v.value),onSelect:()=>A(v.value),closeOnSelect:!1,value:v.value,children:v.label},v.value))},g.label))]})]})]})}function Qt(t){const s=new Map;for(const n of t){const r=n.split(".");for(let a=1;a<r.length;a++){const o=r.slice(0,a).join(".");s.set(o,(s.get(o)??0)+1)}}return Array.from(s.entries()).filter(([,n])=>n>1&&n<t.length).map(([n])=>`${n}.*`)}function Ee({selectedEvents:t,onToggleEvent:s,emptyMessage:n="All events"}){const[r,a]=m.useState(""),o=m.useDeferredValue(r),[l]=m.useState(()=>({since:new Date(Date.now()-10080*60*1e3).toISOString(),until:new Date().toISOString()})),{data:h=[]}=E(tt("event",{filter:{occurred:l,order:"DESC"},time_unit:"day",time_interval:1})),p=m.useMemo(()=>{const i=h.map(j=>j.label),f=Qt(i);return[...i,...f].sort((j,A)=>j.localeCompare(A))},[h]),d=m.useMemo(()=>{if(!o)return p;const i=o.toLowerCase();return p.filter(f=>f.toLowerCase().includes(i))},[p,o]),c=m.useMemo(()=>{if(!o.trim())return!1;const i=o.toLowerCase();return!p.some(f=>f.toLowerCase()===i)},[o,p]),x=()=>{if(t.length===0)return e.jsx("span",{className:"text-muted-foreground",children:n});const i=t.slice(0,2),f=t.length-i.length;return e.jsxs("div",{className:"flex min-w-0 items-center justify-start gap-1",children:[e.jsx("span",{className:"truncate min-w-0 text-left",children:i.join(", ")}),f>0&&e.jsxs("span",{className:"shrink-0 text-muted-foreground",children:["+",f]})]})},u=i=>{s(i),a("")};return e.jsxs(R,{children:[e.jsx(M,{selected:t.length>0,children:x()}),e.jsxs(V,{children:[e.jsx(O,{value:r,onValueChange:a,placeholder:"Search events..."}),e.jsxs(I,{children:[e.jsx(W,{children:"No events found"}),e.jsxs(F,{children:[c&&e.jsxs(k,{selected:t.includes(o),onSelect:()=>u(o),closeOnSelect:!1,value:o,children:['Add "',o,'"']},"__custom__"),d.map(i=>e.jsx(k,{selected:t.includes(i),onSelect:()=>u(i),closeOnSelect:!1,value:i,children:i},i))]})]})]})]})}const Jt=()=>{const t=_(),s=D({name:"trigger.posture"});return e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex items-end gap-4",children:e.jsx($t,{})}),e.jsx(w,{control:t.control,name:"trigger.expect",render:({field:n})=>{const r=n.value??[];return e.jsxs(b,{children:[e.jsx(S,{children:"Any event matching"}),e.jsx(y,{children:e.jsx(Ee,{selectedEvents:r,onToggleEvent:a=>{const o=r.includes(a)?r.filter(l=>l!==a):[...r,a];n.onChange(o)}})}),e.jsx(C,{})]})}}),e.jsx(w,{control:t.control,name:"trigger.match",render:({field:n})=>{const r=n.value?.["prefect.resource.id"]??[],a=Array.isArray(r)?r:[r];return e.jsxs(b,{children:[e.jsx(S,{children:"From the following resources"}),e.jsx(y,{children:e.jsx(Ae,{selectedResourceIds:a,onToggleResource:o=>{const l=a.includes(o)?a.filter(h=>h!==o):[...a,o];l.length>0?n.onChange({"prefect.resource.id":l}):n.onChange({})}})}),e.jsx(C,{})]})}}),e.jsxs("div",{className:"flex items-end gap-2",children:[e.jsx(w,{control:t.control,name:"trigger.threshold",render:({field:n})=>e.jsxs(b,{className:"w-20",children:[e.jsx(y,{children:e.jsx(Z,{type:"number",min:1,...n,onChange:r=>n.onChange(Number(r.target.value))})}),e.jsx(C,{})]})}),e.jsx("span",{className:"pb-2 text-sm text-muted-foreground",children:"times within"}),e.jsx(w,{control:t.control,name:"trigger.within",render:({field:n})=>e.jsxs(b,{children:[e.jsx(y,{children:e.jsx(se,{value:n.value??0,onChange:n.onChange,min:s==="Proactive"?10:0})}),e.jsx(C,{})]})})]}),e.jsxs(vt,{children:[e.jsxs(bt,{className:"flex items-center gap-2 text-sm font-medium",children:[e.jsx(st,{className:"h-4 w-4 transition-transform data-[state=open]:rotate-90"}),"Evaluation Options"]}),e.jsxs(St,{className:"mt-4 space-y-4 pl-6",children:[e.jsx(w,{control:t.control,name:"trigger.after",render:({field:n})=>{const r=n.value??[];return e.jsxs(b,{children:[e.jsx(S,{children:"Evaluate trigger only after observing an event matching"}),e.jsx(y,{children:e.jsx(Ee,{selectedEvents:r,onToggleEvent:a=>{const o=r.includes(a)?r.filter(l=>l!==a):[...r,a];n.onChange(o)}})}),e.jsx(C,{})]})}}),e.jsx(w,{control:t.control,name:"trigger.match_related",render:({field:n})=>{const r=n.value?.["prefect.resource.id"]??[],a=Array.isArray(r)?r:[r];return e.jsxs(b,{children:[e.jsx(S,{children:"Filter for events related to"}),e.jsx(y,{children:e.jsx(Ae,{selectedResourceIds:a,onToggleResource:o=>{const l=a.includes(o)?a.filter(h=>h!==o):[...a,o];l.length>0?n.onChange({"prefect.resource.id":l}):n.onChange({})}})}),e.jsx(C,{})]})}})]})]})]})},Gt=2,Yt=40,Ht=({selectedDeploymentIds:t,onSelectDeploymentIds:s})=>{const[n,r]=m.useState(""),a=m.useDeferredValue(n),[o,l]=m.useState(0),h=m.useRef(null),p=m.useRef(null),d=m.useMemo(()=>new Set(t),[t]);m.useEffect(()=>{const g=h.current;if(!g)return;const v=new ResizeObserver(N=>{for(const T of N)l(T.contentRect.width)});return v.observe(g),()=>v.disconnect()},[]);const{data:c=[]}=E(je({deployments:a?{operator:"and_",name:{like_:a}}:void 0,limit:100,offset:0,sort:"NAME_ASC"})),{data:x=[]}=E(je({deployments:d.size>0?{operator:"and_",id:{any_:t}}:void 0,limit:d.size||1,offset:0,sort:"NAME_ASC"},{enabled:d.size>0})),u=g=>{const v=new Set(d);d.has(g)?v.delete(g):v.add(g),s(Array.from(v))},i=()=>{s([])},f=m.useCallback(g=>{const v=p.current;if(!v||o===0||g.length===0)return Math.min(g.length,Gt);const N=g.length>1?o-Yt:o;let T=0;for(let L=0;L<g.length&&(v.textContent=g.slice(0,L+1).join(", "),v.offsetWidth<=N);L++)T=L+1;return T===g.length?g.length:Math.max(1,T)},[o]),j=()=>{if(d.size===0)return"All deployments";const g=x.filter(L=>d.has(L.id)).map(L=>L.name),v=f(g),N=g.slice(0,v),T=g.length-v;return e.jsxs("div",{ref:h,className:"flex flex-1 min-w-0 items-center gap-2",children:[e.jsx("div",{className:"flex flex-1 min-w-0 items-center gap-2 overflow-hidden",children:e.jsx("span",{className:"truncate",children:N.join(", ")})}),T>0&&e.jsxs(re,{variant:"bodySmall",className:"shrink-0",children:["+ ",T]}),e.jsx("div",{ref:p,className:"absolute invisible whitespace-nowrap","aria-hidden":"true"})]})},A=m.useMemo(()=>c.filter(g=>!a||g.name.toLowerCase().includes(a.toLowerCase())),[c,a]);return e.jsxs(R,{children:[e.jsx(M,{"aria-label":"Select deployments",selected:d.size===0,children:j()}),e.jsxs(V,{children:[e.jsx(O,{value:n,onValueChange:r,placeholder:"Search deployments..."}),e.jsxs(I,{children:[e.jsx(W,{children:"No deployments found"}),e.jsxs(F,{children:[e.jsxs(k,{"aria-label":"All deployments",onSelect:i,closeOnSelect:!1,value:"__all__",children:[e.jsx(ve,{checked:d.size===0}),"All deployments"]}),A.map(g=>e.jsxs(k,{"aria-label":g.name,onSelect:()=>u(g.id),closeOnSelect:!1,value:g.id,children:[e.jsx(ve,{checked:d.has(g.id)}),g.name]},g.id))]})]})]})]})},Kt=[{value:"Reactive",label:"Enters"},{value:"Proactive",label:"Stays in"}],Xt=30,ne=()=>{const t=_();return e.jsx(w,{control:t.control,name:"trigger.posture",render:({field:s})=>e.jsx(b,{children:e.jsx(y,{children:e.jsxs(B,{value:s.value,onValueChange:n=>{const r=s.value;if(s.onChange(n),r==="Reactive"&&n==="Proactive"){const a=t.getValues("trigger.expect")??[];t.setValue("trigger.after",a),t.setValue("trigger.expect",[]),t.getValues("trigger.within")===0&&t.setValue("trigger.within",Xt)}else if(r==="Proactive"&&n==="Reactive"){const a=t.getValues("trigger.after")??[];t.setValue("trigger.expect",a),t.setValue("trigger.after",[])}},children:[e.jsx(z,{"aria-label":"select posture",className:"w-[160px]",children:e.jsx(Q,{placeholder:"Select posture"})}),e.jsx(J,{children:Kt.map(n=>e.jsx(G,{value:n.value,children:n.label},n.value))})]})})})})},Zt=86400,es=30*Zt,ts=[{value:"prefect.deployment.ready",label:"Ready"},{value:"prefect.deployment.not-ready",label:"Not Ready"},{value:"prefect.deployment.disabled",label:"Disabled"}],Ue="prefect.deployment.",Be="prefect.deployment.*",ss=t=>t?(Array.isArray(t)?t:[t]).filter(n=>n!==Be).map(n=>n.replace(Ue,"")):[],rs=t=>t.length===0?Be:t.map(s=>`${Ue}${s}`),ns=()=>{const t=_(),s=D({name:"trigger.posture"}),n=D({name:"trigger.match"}),r=m.useMemo(()=>{const l=n?.["prefect.resource.id"];return ss(l)},[n]),a=m.useCallback(o=>{const l=t.getValues("trigger.match")??{};t.setValue("trigger.match",{...l,"prefect.resource.id":rs(o)})},[t]);return e.jsxs("div",{className:"space-y-4",children:[e.jsxs(b,{children:[e.jsx(S,{children:"Deployments"}),e.jsx(y,{children:e.jsx(Ht,{selectedDeploymentIds:r,onSelectDeploymentIds:a})})]}),e.jsxs(b,{children:[e.jsx(S,{children:"Deployment"}),e.jsxs("div",{className:"grid gap-2",style:{gridTemplateColumns:"10rem 1fr"},children:[e.jsx(ne,{}),e.jsx(w,{control:t.control,name:"trigger.expect",render:({field:o})=>{const l=o.value?.[0];return e.jsxs(B,{value:l??"",onValueChange:h=>o.onChange([h]),children:[e.jsx(z,{className:"w-full",children:e.jsx(Q,{placeholder:"Select status"})}),e.jsx(J,{children:ts.map(h=>e.jsx(G,{value:h.value,children:h.label},h.value))})]})}})]})]}),s==="Proactive"&&e.jsx(w,{control:t.control,name:"trigger.within",render:({field:o})=>e.jsxs(b,{children:[e.jsx(S,{children:"Within"}),e.jsx(y,{children:e.jsx(se,{value:o.value??0,onChange:o.onChange,min:10,max:es})}),e.jsx(C,{})]})})]})},os=2;function as({selectedFlowIds:t,onToggleFlow:s,emptyMessage:n="Any flow"}){const[r,a]=m.useState(""),o=m.useDeferredValue(r),{data:l=[]}=E(ie({flows:o?{operator:"and_",name:{like_:o}}:void 0,limit:100,offset:0,sort:"NAME_ASC"})),{data:h=[]}=E(ie({flows:t.length>0?{operator:"and_",id:{any_:t}}:void 0,limit:t.length||1,offset:0,sort:"NAME_ASC"},{enabled:t.length>0})),p=m.useMemo(()=>l.filter(c=>!o||c.name.toLowerCase().includes(o.toLowerCase())),[l,o]),d=()=>{if(t.length===0)return e.jsx("span",{className:"text-muted-foreground",children:n});const x=h.filter(i=>t.includes(i.id)).map(i=>i.name).slice(0,os),u=t.length-x.length;return e.jsxs("div",{className:"flex min-w-0 items-center justify-start gap-1",children:[e.jsx("span",{className:"truncate min-w-0 text-left",children:x.join(", ")}),u>0&&e.jsxs("span",{className:"shrink-0 text-muted-foreground",children:["+",u]})]})};return e.jsxs(R,{children:[e.jsx(M,{selected:t.length>0,children:d()}),e.jsxs(V,{children:[e.jsx(O,{value:r,onValueChange:a,placeholder:"Search flows..."}),e.jsxs(I,{children:[e.jsx(W,{children:"No flows found"}),e.jsx(F,{children:p.map(c=>e.jsx(k,{selected:t.includes(c.id),onSelect:()=>{s(c.id),a("")},closeOnSelect:!1,value:c.id,children:c.name},c.id))})]})]})]})}const P="All run states",$="All except scheduled";function ls(t){return t.length!==$e.length-1?!1:!t.includes("Scheduled")}function cs({selectedStates:t,onStateChange:s,emptyMessage:n="Any state"}){const[r,a]=m.useState(""),o=m.useDeferredValue(r),l=m.useMemo(()=>t.length===0?P:ls(t)?$:t,[t]),h=m.useMemo(()=>{const u=o.toLowerCase();return $e.filter(i=>i.toLowerCase().includes(u))},[o]),p=m.useMemo(()=>{const u=o.toLowerCase();return P.toLowerCase().includes(u)||$.toLowerCase().includes(u)},[o]),d=u=>{u===P?s([]):u===$&&s([...xt]),a("")},c=u=>{t.includes(u)?s(t.filter(i=>i!==u)):s([...t,u]),a("")},x=()=>l===P?e.jsx("span",{className:"text-muted-foreground",children:n}):l===$?e.jsx("span",{children:"All except scheduled"}):e.jsx("div",{className:"flex flex-wrap gap-1",children:t.map(u=>e.jsx(be,{type:ye[u],name:u,className:"cursor-pointer"},u))});return e.jsxs(R,{children:[e.jsx(M,{selected:t.length>0,children:x()}),e.jsxs(V,{children:[e.jsx(O,{value:r,onValueChange:a,placeholder:"Search states..."}),e.jsx(W,{children:"No state found"}),e.jsx(I,{children:e.jsxs(F,{children:[p&&e.jsxs(e.Fragment,{children:[e.jsx(k,{selected:l===P,onSelect:()=>d(P),value:P,closeOnSelect:!1,children:"All run states"},P),e.jsx(k,{selected:l===$,onSelect:()=>d($),value:$,closeOnSelect:!1,children:"All except scheduled"},$)]}),h.map(u=>e.jsx(k,{selected:t.includes(u),onSelect:()=>c(u),value:u,closeOnSelect:!1,children:e.jsx(be,{type:ye[u],name:u})},u))]})})]})]})}function is(t){return t.length===0?["prefect.flow-run.*"]:t.map(s=>`prefect.flow-run.${s}`)}function us(t){return!t||t.length===0?[]:t.includes("prefect.flow-run.*")?[]:t.filter(s=>s.startsWith("prefect.flow-run.")).map(s=>s.replace("prefect.flow-run.",""))}function ds(t){if(!t)return[];const s=t["prefect.resource.id"];return s?(Array.isArray(s)?s:[s]).filter(r=>r.startsWith("prefect.flow.")).map(r=>r.replace("prefect.flow.","")):[]}function hs(t){if(!t)return[];const s=t["prefect.resource.id"];return s?(Array.isArray(s)?s:[s]).filter(r=>r.startsWith("prefect.tag.")).map(r=>r.replace("prefect.tag.","")):[]}function Le(t,s){const n=t.map(l=>`prefect.flow.${l}`),r=s.map(l=>`prefect.tag.${l}`);if(n.length===0&&r.length===0)return{};const a=n.length>0?"flow":"tag",o=[...n,...r];return{"prefect.resource.role":a,"prefect.resource.id":o}}const ms=()=>{const t=_(),s=D({name:"trigger.posture"}),n=s==="Proactive"?"trigger.after":"trigger.expect",r=D({name:"trigger.match_related"}),a=ds(r),o=hs(r),l=d=>{const c=a,x=c.includes(d)?c.filter(i=>i!==d):[...c,d],u=x.length>0?[]:o;t.setValue("trigger.match_related",Le(x,u))},h=d=>{t.setValue("trigger.match_related",Le(a,d))},p=a.length===0;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs(b,{children:[e.jsx(S,{children:"Flows"}),e.jsx(y,{children:e.jsx(as,{selectedFlowIds:a,onToggleFlow:l,emptyMessage:"All flows"})})]}),p&&e.jsxs(b,{children:[e.jsx(S,{children:"Flow Run Tags"}),e.jsx(y,{children:e.jsx(wt,{value:o,onChange:h,placeholder:"All tags"})})]}),e.jsxs(b,{children:[e.jsx(S,{children:"Flow Run"}),e.jsxs("div",{className:"grid grid-cols-[10rem_1fr] gap-2",children:[e.jsx(ne,{}),e.jsx(w,{control:t.control,name:n,render:({field:d})=>{const c=d.value??[],x=us(c);return e.jsx(y,{children:e.jsx(cs,{selectedStates:x,onStateChange:u=>{d.onChange(is(u))},emptyMessage:"Any state"})})}})]})]}),s==="Proactive"&&e.jsx(w,{control:t.control,name:"trigger.within",render:({field:d})=>e.jsxs(b,{children:[e.jsx(S,{children:"For"}),e.jsx(y,{children:e.jsx(se,{value:d.value??0,onChange:d.onChange,min:0})}),e.jsx(C,{})]})})]})},ps=({defaultValue:t="Form",value:s,onValueChange:n,formContent:r,jsonContent:a})=>{const o=s!==void 0?{value:s,onValueChange:n}:{defaultValue:t};return e.jsxs(rt,{...o,children:[e.jsx("div",{className:"flex justify-center",children:e.jsxs(nt,{children:[e.jsx(Se,{value:"Form",children:"Form"}),e.jsx(Se,{value:"JSON",children:"JSON"})]})}),e.jsx(we,{value:"Form",children:r}),e.jsx(we,{value:"JSON",children:a})]})},xs=({value:t,onChange:s,error:n})=>{const[r,a]=m.useState(null),o=()=>{try{const h=JSON.parse(t);s(JSON.stringify(h,null,2))}catch{}},l=h=>{try{const p=JSON.parse(h);return Pe.parse(p),a(null),!0}catch(p){return p instanceof SyntaxError?a("Invalid JSON syntax"):p instanceof Re&&a(p.errors[0]?.message??"Invalid trigger configuration"),!1}};return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(xe,{children:"Trigger Configuration"}),e.jsx(U,{variant:"ghost",size:"sm",onClick:o,children:"Format"})]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Edit the trigger configuration as JSON."," ",e.jsx("a",{href:"https://docs.prefect.io/v3/automate/events/automations-triggers",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-foreground",children:"View documentation"})]}),e.jsx(ot,{value:t,onChange:s,onBlur:()=>l(t)}),(r||n)&&e.jsx("p",{className:"text-sm text-destructive",children:r||n})]})},De={"deployment-status":"Deployment status","flow-run-state":"Flow run state","work-pool-status":"Work pool status","work-queue-status":"Work queue status",custom:"Custom"},fs=({onValueChange:t,value:s})=>e.jsxs("div",{className:"space-y-2",children:[e.jsx(xe,{htmlFor:"automations-trigger-template-select",children:"Trigger Template"}),e.jsxs(B,{value:s,onValueChange:t,children:[e.jsx(z,{id:"automations-trigger-template-select",className:"w-full",children:e.jsx(Q,{placeholder:"Select template"})}),e.jsx(J,{children:e.jsx(Me,{children:Object.keys(De).map(n=>e.jsx(G,{value:n,children:De[n]},n))})})]})]}),gs=({onTemplateChange:t})=>{const s=_();return e.jsx(w,{control:s.control,name:"triggerTemplate",render:({field:n})=>e.jsx(b,{children:e.jsx(y,{children:e.jsx(fs,{value:n.value,onValueChange:r=>{n.onChange(r),t?.(r)}})})})})},js={type:"event",posture:"Reactive",threshold:1,within:0},vs=t=>{switch(t){case"flow-run-state":return{type:"event",match:{"prefect.resource.id":"prefect.flow-run.*"},match_related:{},after:[],expect:["prefect.flow-run.*"],for_each:["prefect.resource.id"],posture:"Reactive",threshold:1,within:0};case"deployment-status":return{type:"event",match:{"prefect.resource.id":"prefect.deployment.*"},match_related:{},after:[],expect:["prefect.deployment.not-ready"],for_each:["prefect.resource.id"],posture:"Reactive",threshold:1,within:0};case"work-pool-status":return{type:"event",match:{"prefect.resource.id":"prefect.work-pool.*"},match_related:{},after:[],expect:["prefect.work-pool.not-ready","prefect.work-pool.not_ready"],for_each:["prefect.resource.id"],posture:"Reactive",threshold:1,within:0};case"work-queue-status":return{type:"event",match:{"prefect.resource.id":"prefect.work-queue.*"},match_related:{},after:[],expect:["prefect.work-queue.not-ready"],for_each:["prefect.resource.id"],posture:"Reactive",threshold:1,within:0};case"custom":return{type:"event",match:{"prefect.resource.id":["prefect.flow-run.*"]},match_related:{},after:[],expect:["prefect.flow-run.Failed"],for_each:[],posture:"Reactive",threshold:5,within:60};default:return js}};function bs({selectedWorkPoolIds:t,onToggleWorkPool:s,emptyMessage:n="All work pools"}){const[r,a]=m.useState(""),o=m.useDeferredValue(r),{data:l=[]}=E(pe()),h=m.useMemo(()=>l.filter(c=>c.status!==null).filter(c=>!o||c.name.toLowerCase().includes(o.toLowerCase())),[l,o]),p=m.useMemo(()=>l.filter(c=>t.includes(c.id)),[l,t]),d=()=>{if(t.length===0)return e.jsx("span",{className:"text-muted-foreground",children:n});const c=p.map(x=>x.name);return e.jsx("span",{className:"truncate min-w-0 text-left",children:c.join(", ")})};return e.jsxs(R,{children:[e.jsx(M,{selected:t.length>0,children:d()}),e.jsxs(V,{children:[e.jsx(O,{value:r,onValueChange:a,placeholder:"Search work pools..."}),e.jsxs(I,{children:[e.jsx(W,{children:"No work pools found"}),e.jsx(F,{children:h.map(c=>e.jsx(k,{selected:t.includes(c.id),onSelect:()=>{s(c.id),a("")},closeOnSelect:!1,value:c.id,children:c.name},c.id))})]})]})]})}const oe=[{value:"ready",label:"Ready",events:["prefect.work-pool.ready"]},{value:"not_ready",label:"Not Ready",events:["prefect.work-pool.not-ready","prefect.work-pool.not_ready"]},{value:"paused",label:"Paused",events:["prefect.work-pool.paused"]}];function Fe(t){if(!t||t.length===0)return"not_ready";for(const s of oe)if(s.events.some(n=>t.includes(n)))return s.value;return"not_ready"}function Ss(t){const s=oe.find(n=>n.value===t);return s?[...s.events]:[]}function ws(t){return oe.filter(s=>s.value!==t).flatMap(s=>[...s.events])}function ys(t){if(!t)return[];const s=t["prefect.resource.id"];return s?s==="prefect.work-pool.*"?[]:(Array.isArray(s)?s:[s]).filter(r=>r.startsWith("prefect.work-pool.")&&r!=="prefect.work-pool.*").map(r=>r.replace("prefect.work-pool.","")):[]}function Cs(t){return t.length===0?{"prefect.resource.id":"prefect.work-pool.*"}:{"prefect.resource.id":t.map(s=>`prefect.work-pool.${s}`)}}const ks=()=>{const t=_(),s=D({name:"trigger.posture"}),n=D({name:"trigger.expect"}),r=D({name:"trigger.after"}),a=Fe(s==="Proactive"?r:n),o=l=>{const h=Ss(l),p=ws(l);s==="Proactive"?(t.setValue("trigger.after",h),t.setValue("trigger.expect",p)):(t.setValue("trigger.expect",h),t.setValue("trigger.after",[]))};return e.jsxs(B,{value:a,onValueChange:o,children:[e.jsx(z,{"aria-label":"select status",className:"min-w-0 flex-1",children:e.jsx(Q,{placeholder:"Select status"})}),e.jsx(J,{children:oe.map(l=>e.jsx(G,{value:l.value,children:l.label},l.value))})]})},Ns=()=>{const t=_(),s=D({name:"trigger.posture"}),n=D({name:"trigger.match"}),r=ys(n),a=o=>{const l=r,h=l.includes(o)?l.filter(p=>p!==o):[...l,o];t.setValue("trigger.match",Cs(h))};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs(b,{children:[e.jsx(S,{children:"Work Pools"}),e.jsx(y,{children:e.jsx(bs,{selectedWorkPoolIds:r,onToggleWorkPool:a,emptyMessage:"All work pools"})})]}),e.jsxs(b,{children:[e.jsx(S,{children:"Work Pool"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{}),e.jsx(ks,{})]})]}),s==="Proactive"&&e.jsx(w,{control:t.control,name:"trigger.within",render:({field:o})=>e.jsxs(b,{children:[e.jsx(S,{children:"For"}),e.jsx(y,{children:e.jsx(se,{value:o.value??30,onChange:o.onChange,min:0})}),e.jsx(C,{})]})})]})};function _s({selectedWorkPoolIds:t,onToggleWorkPool:s,emptyMessage:n="All work pools"}){const[r,a]=m.useState(""),o=m.useDeferredValue(r),{data:l=[]}=E(pe({limit:100,offset:0})),h=m.useMemo(()=>l.filter(d=>d.status?o?d.name.toLowerCase().includes(o.toLowerCase()):!0:!1),[l,o]),p=()=>{if(t.length===0)return e.jsx("span",{className:"text-muted-foreground",children:n});const d=l.filter(c=>t.includes(c.id)).map(c=>c.name);return e.jsx("span",{className:"truncate min-w-0 text-left",children:d.join(", ")})};return e.jsxs(R,{children:[e.jsx(M,{selected:t.length>0,children:p()}),e.jsxs(V,{children:[e.jsx(O,{value:r,onValueChange:a,placeholder:"Search work pools..."}),e.jsxs(I,{children:[e.jsx(W,{children:"No work pools found"}),e.jsx(F,{children:h.map(d=>e.jsx(k,{selected:t.includes(d.id),onSelect:()=>{s(d.id),a("")},closeOnSelect:!1,value:d.id,children:d.name},d.id))})]})]})]})}function Ts({selectedWorkQueueIds:t,onToggleWorkQueue:s,workPoolIds:n=[],emptyMessage:r="All work queues"}){const[a,o]=m.useState(""),l=m.useDeferredValue(a),{data:h=[]}=E(Ie({limit:100,offset:0})),p=m.useMemo(()=>h.filter(x=>n.length>0&&(!x.work_pool_id||!n.includes(x.work_pool_id))?!1:l?x.name.toLowerCase().includes(l.toLowerCase()):!0),[h,n,l]),d=m.useMemo(()=>{const x={};for(const i of p){const f=i.work_pool_name??"Unknown";x[f]||(x[f]=[]),x[f].push(i)}return Object.keys(x).sort((i,f)=>i.localeCompare(f)).map(i=>({poolName:i,queues:x[i].sort((f,j)=>f.name.localeCompare(j.name))}))},[p]),c=()=>{if(t.length===0)return e.jsx("span",{className:"text-muted-foreground",children:r});const x=h.filter(u=>t.includes(u.id)).map(u=>u.name);return e.jsx("span",{className:"truncate min-w-0 text-left",children:x.join(", ")})};return e.jsxs(R,{children:[e.jsx(M,{selected:t.length>0,children:c()}),e.jsxs(V,{children:[e.jsx(O,{value:a,onValueChange:o,placeholder:"Search work queues..."}),e.jsxs(I,{children:[e.jsx(W,{children:"No work queues found"}),d.map(x=>e.jsx(F,{heading:x.poolName,children:x.queues.map(u=>e.jsx(k,{selected:t.includes(u.id),onSelect:()=>{s(u.id),o("")},closeOnSelect:!1,value:u.id,children:u.name},u.id))},x.poolName))]})]})]})}const As=[{value:"prefect.work-queue.ready",label:"Ready"},{value:"prefect.work-queue.not-ready",label:"Not Ready"},{value:"prefect.work-queue.paused",label:"Paused"}];function Es(t){if(!t)return[];const s=t["prefect.resource.id"];return s?(Array.isArray(s)?s:[s]).filter(r=>r.startsWith("prefect.work-pool.")).map(r=>r.replace("prefect.work-pool.","")):[]}function Ls(t){if(!t)return[];const s=t["prefect.resource.id"];if(!s)return[];const n=Array.isArray(s)?s:[s];return n.includes("prefect.work-queue.*")?[]:n.filter(r=>r.startsWith("prefect.work-queue.")).map(r=>r.replace("prefect.work-queue.",""))}function Ds(t){return t.length===0?{}:{"prefect.resource.role":"work-pool","prefect.resource.id":t.map(n=>`prefect.work-pool.${n}`)}}function Fs(t){return t.length===0?{"prefect.resource.id":"prefect.work-queue.*"}:{"prefect.resource.id":t.map(n=>`prefect.work-queue.${n}`)}}const Rs=()=>{const t=_(),s=D({name:"trigger.posture"}),n=D({name:"trigger.match_related"}),r=D({name:"trigger.match"}),a=Es(n),o=Ls(r),l=p=>{const d=a,c=d.includes(p)?d.filter(x=>x!==p):[...d,p];t.setValue("trigger.match_related",Ds(c))},h=p=>{const d=o,c=d.includes(p)?d.filter(x=>x!==p):[...d,p];t.setValue("trigger.match",Fs(c))};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs(b,{children:[e.jsx(S,{children:"Work Pools"}),e.jsx(y,{children:e.jsx(_s,{selectedWorkPoolIds:a,onToggleWorkPool:l,emptyMessage:"All work pools"})})]}),e.jsxs(b,{children:[e.jsx(S,{children:"Work Queues"}),e.jsx(y,{children:e.jsx(Ts,{selectedWorkQueueIds:o,onToggleWorkQueue:h,workPoolIds:a,emptyMessage:"All work queues"})})]}),e.jsxs(b,{children:[e.jsx(S,{children:"Work Queue"}),e.jsxs("div",{className:"grid grid-cols-[10rem_1fr] gap-2",children:[e.jsx(ne,{}),e.jsx(w,{control:t.control,name:"trigger.expect",render:({field:p})=>{const d=p.value?.[0];return e.jsx(y,{children:e.jsxs(B,{value:d??"",onValueChange:c=>p.onChange([c]),children:[e.jsx(z,{className:"w-full",children:e.jsx(Q,{placeholder:"Select status"})}),e.jsx(J,{children:As.map(c=>e.jsx(G,{value:c.value,children:c.label},c.value))})]})})}})]})]}),s==="Proactive"&&e.jsx(w,{control:t.control,name:"trigger.within",render:({field:p})=>e.jsxs(b,{children:[e.jsx(S,{children:"For"}),e.jsx(y,{children:e.jsx(se,{value:p.value??0,onChange:p.onChange,min:0})}),e.jsx(C,{})]})})]})},Ms=()=>{const t=_(),s=t.watch("triggerTemplate"),n=t.watch("trigger"),[r,a]=m.useState("Form"),[o,l]=m.useState(""),[h,p]=m.useState(void 0),d=m.useCallback(()=>JSON.stringify(n,null,2),[n]);m.useEffect(()=>{r==="Form"&&l(d())},[r,d]);const c=m.useCallback(f=>{try{const j=JSON.parse(f);return{valid:!0,trigger:Pe.parse(j)}}catch(j){return j instanceof SyntaxError?{valid:!1,error:"Invalid JSON syntax"}:j instanceof Re?{valid:!1,error:j.errors[0]?.message??"Invalid trigger configuration"}:{valid:!1,error:"Unknown error"}}},[]),x=m.useCallback(f=>{if(r!==f){if(f==="Form"){const j=c(o);if(!j.valid){p(j.error);return}j.trigger&&t.setValue("trigger",j.trigger),p(void 0)}else l(d()),p(void 0);a(f)}},[r,o,c,t,d]),u=m.useCallback(f=>{l(f);const j=c(f);j.valid&&j.trigger&&(t.setValue("trigger",j.trigger),p(void 0))},[c,t]),i=f=>{const j=vs(f);t.setValue("trigger",j),l(JSON.stringify(j,null,2)),p(void 0)};return e.jsxs("div",{className:"space-y-6",children:[e.jsx(gs,{onTemplateChange:i}),s&&e.jsx(ps,{value:r,onValueChange:x,formContent:e.jsx(Vs,{template:s}),jsonContent:e.jsx(xs,{value:o,onChange:u,error:h})})]})},Vs=({template:t})=>{switch(t){case"flow-run-state":return e.jsx(ms,{});case"deployment-status":return e.jsx(ns,{});case"work-pool-status":return e.jsx(Ns,{});case"work-queue-status":return e.jsx(Rs,{});case"custom":return e.jsx(Jt,{});default:return null}},ce=["Trigger","Actions","Details"],Os={actions:[{type:void 0}],trigger:{type:"event",posture:"Reactive",threshold:1,within:0}},Hs=({defaultValues:t={},onSubmit:s,submitLabel:n="Save",isSubmitting:r=!1})=>{const o=!!(t&&Object.keys(t).length>0)?new Set([0,1,2]):new Set([0]),l=ut(ce.length,0,o),h=Ye({resolver:Je(ht),defaultValues:{...Os,...t}}),p=ce[l.currentStep],d={Trigger:{render:()=>e.jsx(Ms,{}),trigger:()=>h.trigger("trigger")},Actions:{render:()=>e.jsx(Ot,{}),trigger:()=>h.trigger("actions")},Details:{render:()=>e.jsx(Wt,{}),trigger:()=>h.trigger(["description","name"])}},c=async x=>{await d[x].trigger()&&l.incrementStep()};return e.jsx(it,{...h,children:e.jsx("form",{onSubmit:x=>{h.handleSubmit(s)(x)},children:e.jsxs("div",{className:"flex flex-col gap-8",children:[e.jsx(dt,{steps:ce,currentStepNum:l.currentStep,onClick:x=>l.changeStep(x.stepNum),completedSteps:l.completedStepsSet,visitedSteps:l.visitedStepsSet}),e.jsxs(at,{className:"p-4 pt-8",children:[e.jsxs(lt,{children:[d[p].render(),e.jsx(C,{children:h.formState.errors.root?.message})]}),e.jsxs(ct,{className:"mt-6 flex gap-2 justify-end",children:[e.jsx(U,{type:"button",variant:"outline",children:e.jsx(Qe,{to:"/automations",children:"Cancel"})}),e.jsx(U,{disabled:l.isStartingStep,type:"button",variant:"outline",onClick:l.decrementStep,children:"Previous"}),l.isFinalStep?e.jsx(U,{type:"submit",loading:r,children:n},"save"):e.jsx(U,{type:"button",onClick:()=>{c(p)},children:"Next"},"next")]})]})]})})})};export{Hs as A};
|
|
2
|
-
//# sourceMappingURL=automation-wizard-
|
|
1
|
+
import{j as e,r as m,t as E,L as Qe}from"./vendor-tanstack-BcZfOOfy.js";import{a as Je}from"./zod-Cuos7J7w.js";import{g as _,p as D,q as Ge,Z as Re,c as Ye}from"./vendor-forms-ClCIacbh.js";import{S as B,a as z,b as Q,c as J,d as Me,dk as He,e as G,b5 as Ke,bm as Ve,bp as Oe,ac as R,ad as M,ae as V,af as O,ah as W,ag as I,ai as F,aj as k,I as Y,dl as We,bN as me,p as Z,al as re,br as Xe,be as Ze,ab as ie,M as pe,d4 as Ie,q as U,i as xe,aW as et,a_ as tt,ap as st,cZ as je,ak as ve,aq as be,aw as rt,ax as nt,ay as Se,az as we,L as ot,C as at,o as lt,dm as ct}from"./index-_0OOjqn5.js";import{b as w,c as b,d as S,e as y,a as C,F as it}from"./form-DHWphysD.js";import{u as ut,S as dt}from"./use-stepper-jTTsXpho.js";import{U as te,T as Pe,A as ht}from"./automation-schema-BIBsyp0j.js";import{T as fe}from"./textarea-DL9UCBaB.js";import{S as mt,R as pt,a as $e,b as ye,c as xt}from"./index-DcMpyvW7.js";import{R as ft,a as gt}from"./radio-group-DeN-_krn.js";import{u as jt,C as vt,a as bt,b as St}from"./collapsible-Dgk2Qvjj.js";import{T as wt}from"./tags-input-BvH9UY8h.js";const Ce={"cancel-flow-run":"Cancel a flow run","suspend-flow-run":"Suspend a flow run","resume-flow-run":"Resume a flow run","change-flow-run-state":"Change flow run's state","run-deployment":"Run a deployment","pause-deployment":"Pause a deployment","resume-deployment":"Resume a deployment","pause-work-queue":"Pause a work queue","resume-work-queue":"Resume a work queue","pause-work-pool":"Pause a work pool","resume-work-pool":"Resume a work pool","pause-automation":"Pause an automation","resume-automation":"Resume an automation","send-notification":"Send a notification","call-webhook":"Call a webhook"},yt=({index:t})=>{const s=_();return e.jsx(w,{control:s.control,name:`actions.${t}.type`,render:({field:n})=>e.jsxs(b,{children:[e.jsx(S,{children:"Action Type"}),e.jsx(y,{children:e.jsxs(B,{...n,onValueChange:r=>{n.onChange(r);const a=Ct({index:t,type:r});a&&s.setValue(a,te)},children:[e.jsx(z,{"aria-label":"select action",className:"w-full",children:e.jsx(Q,{placeholder:"Select action"})}),e.jsx(J,{children:e.jsxs(Me,{children:[e.jsx(He,{children:"Actions"}),Object.keys(Ce).map(r=>e.jsx(G,{value:r,children:Ce[r]},r))]})})]})})]})})};function Ct({index:t,type:s}){switch(s){case"run-deployment":case"pause-deployment":case"resume-deployment":return`actions.${t}.deployment_id`;case"pause-work-queue":case"resume-work-queue":return`actions.${t}.work_queue_id`;case"pause-work-pool":case"resume-work-pool":return`actions.${t}.work_pool_id`;case"pause-automation":case"resume-automation":return`actions.${t}.automation_id`;default:return null}}const kt=4,ee=({length:t=kt})=>Array.from({length:t},(s,n)=>e.jsx(Ke,{className:"mt-2 p-4 h-2 w-full"},n)),Nt=({index:t})=>{const s=_(),[n,r]=m.useState(""),{data:a,isLoading:o}=E(Ve({offset:0,block_types:{slug:{any_:["webhook"]}}})),l=m.useMemo(()=>a?.map(i=>i.slug)??[],[a]),{data:h,isLoading:p}=E(Oe({block_types:l.length>0?{slug:{any_:l}}:void 0,include_secrets:!1,sort:"BLOCK_TYPE_AND_NAME_ASC",offset:0},{enabled:l.length>0})),d=o||p,c=m.useMemo(()=>!a||!h?[]:a.map(i=>({blockType:i,documents:h.filter(f=>f.block_type_id===i.id)})).filter(i=>i.documents.length>0),[a,h]),x=m.useMemo(()=>{if(!n)return c;const i=n.toLowerCase();return c.map(f=>({...f,documents:f.documents.filter(j=>j.name?.toLowerCase().includes(i))})).filter(f=>f.documents.length>0)},[c,n]),u=m.useCallback(i=>{if(!(!i||!h))return h.find(f=>f.id===i)},[h]);return e.jsxs("div",{className:"space-y-4",children:[e.jsx(w,{control:s.control,name:`actions.${t}.block_document_id`,render:({field:i})=>{const f=u(i.value);return e.jsxs(b,{className:"flex flex-col",children:[e.jsx(S,{children:"Block"}),e.jsxs(R,{children:[e.jsx(M,{selected:!!f,"aria-label":"Select webhook block",children:f?f.name:"Select a webhook block"}),e.jsxs(V,{children:[e.jsx(O,{value:n,onValueChange:r,placeholder:"Search for a block..."}),e.jsx(W,{children:"No webhook blocks found"}),e.jsx(I,{children:d?e.jsx(ee,{}):x.map(j=>e.jsx(F,{heading:j.blockType.name,children:j.documents.map(A=>e.jsx(k,{value:A.id,selected:i.value===A.id,onSelect:i.onChange,children:A.name},A.id))},j.blockType.id))})]})]}),e.jsx(C,{})]})}}),e.jsx(_t,{index:t}),e.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-blue-200 bg-blue-50 p-3 text-sm text-blue-800 dark:border-blue-800 dark:bg-blue-950 dark:text-blue-200",children:[e.jsx(Y,{id:"Info",className:"mt-0.5 size-4 shrink-0"}),e.jsxs("p",{children:["In addition to any fields present on the triggering event, the following objects can be used in webhook payload templates:"," ",e.jsx("code",{className:"rounded bg-blue-100 px-1 py-0.5 font-mono text-xs dark:bg-blue-900",children:"flow"}),","," ",e.jsx("code",{className:"rounded bg-blue-100 px-1 py-0.5 font-mono text-xs dark:bg-blue-900",children:"deployment"}),","," ",e.jsx("code",{className:"rounded bg-blue-100 px-1 py-0.5 font-mono text-xs dark:bg-blue-900",children:"flow_run"}),","," ",e.jsx("code",{className:"rounded bg-blue-100 px-1 py-0.5 font-mono text-xs dark:bg-blue-900",children:"work_pool"}),", and"," ",e.jsx("code",{className:"rounded bg-blue-100 px-1 py-0.5 font-mono text-xs dark:bg-blue-900",children:"work_queue"}),"."]})]})]})},_t=({index:t})=>{const s=_(),{validateTemplate:n}=We(),[r,a]=m.useState(null),[o,l]=m.useState(!1),h=s.watch(`actions.${t}.payload`),p=me(h,1e3);return m.useEffect(()=>{(async()=>{if(!p||p.trim()===""){a(null);return}l(!0);try{const c=await n(p);c.valid?a(null):a(c.error)}catch{a(null)}finally{l(!1)}})()},[p,n]),e.jsx(w,{control:s.control,name:`actions.${t}.payload`,render:({field:d})=>e.jsxs(b,{children:[e.jsxs(S,{className:"flex items-center gap-2",children:["Payload",o&&e.jsx(Y,{id:"Loader2",className:"size-3 animate-spin"})]}),e.jsx(y,{children:e.jsx(fe,{...d,value:d.value??"",placeholder:"Enter webhook payload...",className:r?"border-destructive":"",rows:5})}),r&&e.jsx("p",{className:"text-sm text-destructive",children:r}),e.jsx(C,{})]})})},Tt=({index:t})=>{const s=_(),n=s.watch(`actions.${t}.state`);return e.jsxs(e.Fragment,{children:[e.jsx(w,{control:s.control,name:`actions.${t}.state`,render:({field:r})=>e.jsxs(b,{children:[e.jsx(S,{children:"State"}),e.jsx(y,{children:e.jsx(mt,{value:r.value,onValueChange:r.onChange})}),e.jsx(C,{})]})}),e.jsx(w,{control:s.control,name:`actions.${t}.name`,render:({field:r})=>e.jsxs(b,{children:[e.jsx(S,{children:"Name"}),e.jsx(y,{children:e.jsx(Z,{type:"text",...r,value:r.value??"",placeholder:n?pt[n]:void 0})}),e.jsx(C,{})]})}),e.jsx(w,{control:s.control,name:`actions.${t}.message`,render:({field:r})=>e.jsxs(b,{children:[e.jsx(S,{children:"Message"}),e.jsx(y,{children:e.jsx(fe,{...r,placeholder:"State changed by Automation <id>"})}),e.jsx(C,{})]})})]})},ae=({action:t})=>{const s=t==="Resume"?"Resume a flow run inferred from the triggering event":`${t} flow run inferred from the triggering event`;return e.jsx(re,{variant:"bodySmall",className:"text-muted-foreground",children:s})},H={value:te,name:"Infer Automation"},At=(t,s)=>{if(s===H.value)return H.name;const n=t?.find(r=>r.id===s);if(n)return n.name},ke=({action:t,index:s})=>{const[n,r]=m.useState(""),a=_(),{data:o,isSuccess:l}=E(Xe()),h=m.useDeferredValue(n),p=m.useMemo(()=>o?o.filter(c=>c.name.toLowerCase().includes(h.toLowerCase())):[],[o,h]),d=H.name.toLowerCase().includes(h.toLowerCase());return e.jsx(w,{control:a.control,name:`actions.${s}.automation_id`,render:({field:c})=>{const x=At(o,c.value);return e.jsxs(b,{className:"flex flex-col",children:[e.jsxs(S,{children:["Automation To ",t]}),e.jsxs(R,{children:[e.jsx(M,{selected:!!x,"aria-label":`Select Automation to ${t}`,children:x??"Select automation"}),e.jsxs(V,{children:[e.jsx(O,{value:n,onValueChange:r,placeholder:"Search for an automation..."}),e.jsx(W,{children:"No automation found"}),e.jsx(I,{children:e.jsxs(F,{children:[d&&e.jsx(k,{selected:c.value===H.value,onSelect:u=>{c.onChange(u),r("")},value:H.value,children:H.name}),l?p.map(u=>e.jsx(k,{selected:c.value===u.id,onSelect:i=>{c.onChange(i),r("")},value:u.id,children:u.name},u.id)):e.jsx(ee,{})]})})]})]}),e.jsx(C,{})]})}})},Et=(t={page:1,limit:100,sort:"NAME_ASC"})=>{const{data:s,status:n}=E(Ze(t)),r=new Set(s?.results.map(l=>l.flow_id)),{data:a,status:o}=E(ie({flows:{operator:"or_",id:{any_:Array.from(r)}},sort:"NAME_DESC",offset:0},{enabled:r.size>0}));return m.useMemo(()=>{if(a&&s){const l=new Map(a.map(i=>[i.id,i])),h=s.results.map(i=>({...i,flow:l.get(i.flow_id)})),{count:p,limit:d,pages:c,page:x}=s;return{data:{count:p,limit:d,pages:c,page:x,results:h},status:"success"}}return o==="error"||n==="error"?{data:void 0,status:"error"}:{data:void 0,status:"pending"}},[s,n,a,o])},q={value:te,name:"Infer Deployment"},Lt=(t,s)=>{if(s===q.value)return q.name;const n=t?.find(r=>r.id===s);if(n)return e.jsx(qe,{deploymentWithFlow:n})},le=({action:t,index:s})=>{const[n,r]=m.useState(""),a=_(),o=a.watch(`actions.${s}.type`),l=D({name:`actions.${s}.deployment_id`}),h=me(n,500),{data:p}=Et({page:1,sort:"NAME_ASC",deployments:{operator:"or_",flow_or_deployment_name:{like_:h}}}),d=q.name.toLowerCase().includes(n.toLowerCase()),c=p?.results;return e.jsxs(e.Fragment,{children:[e.jsx(w,{control:a.control,name:`actions.${s}.deployment_id`,render:({field:x})=>{const u=Lt(c,x.value);return e.jsxs(b,{className:"flex flex-col",children:[e.jsxs(S,{children:["Deployment To ",t]}),e.jsxs(R,{children:[e.jsx(M,{selected:!!u,"aria-label":`Select Deployment to ${t}`,children:u??"Select deployment"}),e.jsxs(V,{children:[e.jsx(O,{value:n,onValueChange:r,placeholder:"Search for an deployment..."}),e.jsx(W,{children:"No deployment found"}),e.jsx(I,{children:e.jsxs(F,{children:[d&&e.jsx(k,{selected:x.value===q.value,onSelect:x.onChange,value:q.value,children:q.name}),c?c.map(i=>e.jsx(k,{"aria-label":i.name,selected:x.value===i.id,onSelect:x.onChange,value:i.id,children:e.jsx(qe,{deploymentWithFlow:i})},i.id)):e.jsx(ee,{})]})})]})]}),e.jsx(C,{})]})}}),l!==q.value&&o==="run-deployment"&&e.jsx("div",{children:"TODO: Additional fields"})]})},qe=({deploymentWithFlow:t})=>t.flow?e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx("div",{children:t.flow.name}),e.jsx(Y,{className:"size-4",id:"ChevronRight"}),e.jsx("div",{children:t.name})]}):t.name,K={value:te,name:"Infer Work Pool"},Dt=(t,s)=>{if(s===K.value)return K.name;const n=t?.find(r=>r.id===s);if(n)return n.name},Ne=({action:t,index:s})=>{const[n,r]=m.useState(""),a=_(),{data:o,isSuccess:l}=E(pe()),h=m.useDeferredValue(n),p=m.useMemo(()=>o?o.filter(c=>c.name.toLowerCase().includes(h.toLowerCase())):[],[o,h]),d=K.name.toLowerCase().includes(h.toLowerCase());return e.jsx(w,{control:a.control,name:`actions.${s}.work_pool_id`,render:({field:c})=>{const x=Dt(o,c.value);return e.jsxs(b,{className:"flex flex-col",children:[e.jsxs(S,{children:["Work Pool To ",t]}),e.jsxs(R,{children:[e.jsx(M,{selected:!!x,"aria-label":`Select Work Pool to ${t}`,children:x??"Select Work Pool"}),e.jsxs(V,{children:[e.jsx(O,{value:n,onValueChange:r,placeholder:"Search for a work pool..."}),e.jsx(W,{children:"No work pool found"}),e.jsx(I,{children:e.jsxs(F,{children:[d&&e.jsx(k,{selected:c.value===K.value,onSelect:u=>{c.onChange(u),r("")},value:K.value,children:K.name}),l?p.map(u=>e.jsx(k,{selected:c.value===u.id,onSelect:i=>{c.onChange(i),r("")},value:u.id,children:u.name},u.id)):e.jsx(ee,{})]})})]})]}),e.jsx(C,{})]})}})},X={value:te,name:"Infer Work Queue"},Ft=(t,s)=>{if(s===X.value)return X.name;const n=t?.find(r=>r.id===s);if(n)return n.name},_e=({action:t,index:s})=>{const[n,r]=m.useState(""),a=_(),{data:o}=E(Ie()),l=m.useDeferredValue(n),h=m.useMemo(()=>{if(!o)return;const d=new Map,c=o.filter(x=>x.name.toLowerCase().includes(l.toLowerCase()));for(const x of c){const{work_pool_name:u}=x;if(!u)throw new Error("'work_pool_name expected");d.set(u,[...d.get(u)??[],x])}return d},[o,l]),p=X.name.toLowerCase().includes(l.toLowerCase());return e.jsx(w,{control:a.control,name:`actions.${s}.work_queue_id`,render:({field:d})=>{const c=Ft(o,d.value);return e.jsxs(b,{className:"flex flex-col",children:[e.jsxs(S,{children:["Work Queue To ",t]}),e.jsxs(R,{children:[e.jsx(M,{selected:!!c,"aria-label":`Select Work Queue to ${t}`,children:c??"Select Work Queue"}),e.jsxs(V,{children:[e.jsx(O,{value:n,onValueChange:r,placeholder:"Search for a work queue..."}),e.jsx(W,{children:"No work queue found"}),e.jsx(I,{children:e.jsxs(F,{children:[p&&e.jsx(k,{selected:d.value===X.value,onSelect:x=>{d.onChange(x),r("")},value:X.value,children:X.name}),h?Array.from(h).map(([x,u])=>e.jsxs("div",{className:"border-b",children:[e.jsx(k,{disabled:!0,children:x}),u.map(i=>e.jsx(k,{selected:d.value===i.id,onSelect:f=>{d.onChange(f),r("")},value:i.id,children:i.name},i.id))]},x)):e.jsx(ee,{})]})})]})]}),e.jsx(C,{})]})}})},Rt=({index:t})=>{const s=_(),[n,r]=m.useState(""),{data:a,isLoading:o}=E(Ve({offset:0,block_schemas:{operator:"and_",block_capabilities:{all_:["notify"]}}})),l=m.useMemo(()=>a?.map(i=>i.slug)??[],[a]),{data:h,isLoading:p}=E(Oe({block_types:l.length>0?{slug:{any_:l}}:void 0,include_secrets:!1,sort:"BLOCK_TYPE_AND_NAME_ASC",offset:0},{enabled:l.length>0})),d=o||p,c=m.useMemo(()=>!a||!h?[]:a.map(i=>({blockType:i,documents:h.filter(f=>f.block_type_id===i.id)})).filter(i=>i.documents.length>0),[a,h]),x=m.useMemo(()=>{if(!n)return c;const i=n.toLowerCase();return c.map(f=>({...f,documents:f.documents.filter(j=>j.name?.toLowerCase().includes(i))})).filter(f=>f.documents.length>0)},[c,n]),u=m.useCallback(i=>{if(!(!i||!h))return h.find(f=>f.id===i)},[h]);return e.jsxs("div",{className:"space-y-4",children:[e.jsx(w,{control:s.control,name:`actions.${t}.block_document_id`,render:({field:i})=>{const f=u(i.value);return e.jsxs(b,{className:"flex flex-col",children:[e.jsx(S,{children:"Block"}),e.jsxs(R,{children:[e.jsx(M,{selected:!!f,"aria-label":"Select notification block",children:f?f.name:"Select a notification block"}),e.jsxs(V,{children:[e.jsx(O,{value:n,onValueChange:r,placeholder:"Search for a block..."}),e.jsx(W,{children:"No notification blocks found"}),e.jsx(I,{children:d?e.jsx(ee,{}):x.map(j=>e.jsx(F,{heading:j.blockType.name,children:j.documents.map(A=>e.jsx(k,{value:A.id,selected:i.value===A.id,onSelect:i.onChange,children:A.name},A.id))},j.blockType.id))})]})]}),e.jsx(C,{})]})}}),e.jsx(Te,{index:t,name:"subject",label:"Subject",placeholder:"Enter notification subject..."}),e.jsx(Te,{index:t,name:"body",label:"Body",placeholder:"Enter notification body...",multiline:!0}),e.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-blue-200 bg-blue-50 p-3 text-sm text-blue-800 dark:border-blue-800 dark:bg-blue-950 dark:text-blue-200",children:[e.jsx(Y,{id:"Info",className:"mt-0.5 size-4 shrink-0"}),e.jsxs("p",{children:["In addition to any fields present on the triggering event, the following objects can be used in notification templates:"," ",e.jsx("code",{className:"rounded bg-blue-100 px-1 py-0.5 font-mono text-xs dark:bg-blue-900",children:"flow"}),","," ",e.jsx("code",{className:"rounded bg-blue-100 px-1 py-0.5 font-mono text-xs dark:bg-blue-900",children:"deployment"}),","," ",e.jsx("code",{className:"rounded bg-blue-100 px-1 py-0.5 font-mono text-xs dark:bg-blue-900",children:"flow_run"}),","," ",e.jsx("code",{className:"rounded bg-blue-100 px-1 py-0.5 font-mono text-xs dark:bg-blue-900",children:"work_pool"}),","," ",e.jsx("code",{className:"rounded bg-blue-100 px-1 py-0.5 font-mono text-xs dark:bg-blue-900",children:"work_queue"}),", and"," ",e.jsx("code",{className:"rounded bg-blue-100 px-1 py-0.5 font-mono text-xs dark:bg-blue-900",children:"metric"}),"."]})]})]})},Te=({index:t,name:s,label:n,placeholder:r,multiline:a=!1})=>{const o=_(),{validateTemplate:l}=We(),[h,p]=m.useState(null),[d,c]=m.useState(!1),x=o.watch(`actions.${t}.${s}`),u=me(x,1e3);m.useEffect(()=>{(async()=>{if(!u||u.trim()===""){p(null);return}c(!0);try{const j=await l(u);j.valid?p(null):p(j.error)}catch{p(null)}finally{c(!1)}})()},[u,l]);const i=a?fe:Z;return e.jsx(w,{control:o.control,name:`actions.${t}.${s}`,render:({field:f})=>e.jsxs(b,{children:[e.jsxs(S,{className:"flex items-center gap-2",children:[n,d&&e.jsx(Y,{id:"Loader2",className:"size-3 animate-spin"})]}),e.jsx(y,{children:e.jsx(i,{...f,value:f.value??"",placeholder:r,className:h?"border-destructive":""})}),h&&e.jsx("p",{className:"text-sm text-destructive",children:h}),e.jsx(C,{})]})})},Mt=({index:t,onRemove:s})=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs(re,{variant:"body",className:"font-semibold",children:["Action ",t+1]}),e.jsx(U,{size:"icon","aria-label":`remove action ${t+1}`,onClick:s,variant:"outline",children:e.jsx(Y,{id:"Trash2",className:"size-4"})})]}),e.jsx(yt,{index:t}),e.jsx(Vt,{index:t}),e.jsx("hr",{className:"my-8"})]},t),Vt=({index:t})=>{switch(D({name:`actions.${t}.type`})){case"change-flow-run-state":return e.jsx(Tt,{index:t});case"run-deployment":return e.jsx(le,{action:"Run",index:t});case"pause-deployment":return e.jsx(le,{action:"Pause",index:t});case"resume-deployment":return e.jsx(le,{action:"Resume",index:t});case"pause-work-queue":return e.jsx(_e,{action:"Pause",index:t});case"resume-work-queue":return e.jsx(_e,{action:"Resume",index:t});case"pause-work-pool":return e.jsx(Ne,{action:"Pause",index:t});case"resume-work-pool":return e.jsx(Ne,{action:"Resume",index:t});case"pause-automation":return e.jsx(ke,{action:"Pause",index:t});case"resume-automation":return e.jsx(ke,{action:"Resume",index:t});case"send-notification":return e.jsx(Rt,{index:t});case"call-webhook":return e.jsx(Nt,{index:t});case"cancel-flow-run":return e.jsx(ae,{action:"Cancel"});case"suspend-flow-run":return e.jsx(ae,{action:"Suspend"});case"resume-flow-run":return e.jsx(ae,{action:"Resume"});default:return null}},Ot=()=>{const t=_(),{fields:s,append:n,remove:r}=Ge({control:t.control,name:"actions",shouldUnregister:!1,rules:{minLength:1}});return e.jsxs("div",{children:[s.map(({id:a},o)=>e.jsx(Mt,{index:o,onRemove:()=>r(o)},a)),e.jsxs(U,{type:"button",variant:"outline",onClick:()=>n({type:"cancel-flow-run"}),children:[e.jsx(Y,{id:"Plus",className:"mr-2 size-4"})," Add Action"]})]})},Wt=()=>{const t=_();return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(w,{control:t.control,name:"name",render:({field:s})=>e.jsxs(b,{children:[e.jsx(S,{children:"Automation Name"}),e.jsx(y,{children:e.jsx(Z,{type:"text",...s,value:s.value??""})}),e.jsx(C,{})]})}),e.jsx(w,{control:t.control,name:"description",render:({field:s})=>e.jsxs(b,{children:[e.jsx(S,{children:"Description (Optional)"}),e.jsx(y,{children:e.jsx(Z,{type:"text",...s,value:s.value??""})}),e.jsx(C,{})]})})]})},It=[{value:"Reactive",label:"Observe"},{value:"Proactive",label:"Don't observe"}],Pt=30,$t=()=>{const t=_(),s=n=>{const r=t.getValues("trigger.posture");if(t.setValue("trigger.posture",n),r==="Reactive"&&n==="Proactive"){const a=t.getValues("trigger.expect")??[];t.setValue("trigger.after",a),t.setValue("trigger.expect",[]),t.getValues("trigger.within")===0&&t.setValue("trigger.within",Pt)}else if(r==="Proactive"&&n==="Reactive"){const a=t.getValues("trigger.after")??[];t.setValue("trigger.expect",a),t.setValue("trigger.after",[])}};return e.jsx(w,{control:t.control,name:"trigger.posture",render:({field:n})=>e.jsxs(b,{children:[e.jsx(S,{children:"When I"}),e.jsx(y,{children:e.jsx(ft,{value:n.value,onValueChange:s,className:"flex gap-4",children:It.map(r=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(gt,{value:r.value,id:`custom-${r.value}`}),e.jsx(xe,{htmlFor:`custom-${r.value}`,children:r.label})]},r.value))})})]})})},ue=60,de=3600,he=86400,qt=[{label:"Seconds",value:1},{label:"Minutes",value:ue},{label:"Hours",value:de},{label:"Days",value:he}];function Ut(t){return t>0&&t%he===0?he:t>0&&t%de===0?de:t>0&&t%ue===0?ue:1}function se({value:t,onChange:s,min:n=0,max:r,className:a,disabled:o=!1}){const[l,h]=m.useState(()=>Ut(t)),p=m.useMemo(()=>qt.filter(u=>u.value>=n),[n]),d=m.useMemo(()=>t/l,[t,l]),c=m.useCallback(u=>{let i=u*l;r!==void 0&&i>r&&(i=r),s(i)},[s,l,r]),x=m.useCallback(u=>{const i=Number(u),f=l;h(i);let j=t/f*i;r!==void 0&&j>r&&(j=r),s(j)},[s,l,t,r]);return m.useEffect(()=>{if(!p.some(u=>u.value===l)){const u=p[0];u&&h(u.value)}},[p,l]),e.jsxs("div",{className:et("grid grid-cols-[1fr_7rem] gap-2 w-full",a),children:[e.jsx(Z,{type:"number",min:0,value:d,onChange:u=>c(Number(u.target.value)),disabled:o,"aria-label":"Duration quantity"}),e.jsxs(B,{value:String(l),onValueChange:x,disabled:o,children:[e.jsx(z,{"aria-label":"Duration unit",children:e.jsx(Q,{})}),e.jsx(J,{children:p.map(u=>e.jsx(G,{value:String(u.value),children:u.label},u.value))})]})]})}const Bt=2,zt=40;function Ae({selectedResourceIds:t,onToggleResource:s,emptyMessage:n="All resources"}){const[r,a]=m.useState(""),o=m.useDeferredValue(r),[l,h]=m.useState(0),p=m.useRef(null),d=m.useRef(null);m.useEffect(()=>{const g=p.current;if(!g)return;const v=new ResizeObserver(N=>{for(const T of N)h(T.contentRect.width)});return v.observe(g),()=>v.disconnect()},[]);const{resourceOptions:c}=jt(),x=m.useMemo(()=>{const g=[{label:"Automations",options:[]},{label:"Blocks",options:[]},{label:"Deployments",options:[]},{label:"Flows",options:[]},{label:"Work Pools",options:[]},{label:"Work Queues",options:[]}];for(const v of c){const N={label:v.name,value:v.resourceId};switch(v.type){case"automation":g[0].options.push(N);break;case"block":g[1].options.push(N);break;case"deployment":g[2].options.push(N);break;case"flow":g[3].options.push(N);break;case"work-pool":g[4].options.push(N);break;case"work-queue":g[5].options.push(N);break}}return g.map(v=>({...v,options:v.options.sort((N,T)=>N.label.localeCompare(T.label))})).filter(v=>v.options.length>0)},[c]),u=m.useMemo(()=>{if(!o)return x;const g=o.toLowerCase();return x.map(v=>({...v,options:v.options.filter(N=>N.label.toLowerCase().includes(g)||N.value.toLowerCase().includes(g))})).filter(v=>v.options.length>0)},[x,o]),i=m.useMemo(()=>{if(!o.trim()||!o.includes("."))return!1;const g=o.toLowerCase();return!c.some(v=>v.resourceId.toLowerCase()===g)},[o,c]),f=m.useCallback(g=>{const v=d.current;if(!v||l===0||g.length===0)return Math.min(g.length,Bt);const N=g.length>1?l-zt:l;let T=0;for(let L=0;L<g.length&&(v.textContent=g.slice(0,L+1).join(", "),v.offsetWidth<=N);L++)T=L+1;return T===g.length?g.length:Math.max(1,T)},[l]),j=()=>{if(t.length===0)return e.jsx("span",{className:"text-muted-foreground",children:n});const g=t.map(L=>c.find(ze=>ze.resourceId===L)?.name??L),v=f(g),N=g.slice(0,v),T=g.length-v;return e.jsxs("div",{ref:p,className:"flex flex-1 min-w-0 items-center gap-2",children:[e.jsx("div",{className:"flex flex-1 min-w-0 items-center gap-2 overflow-hidden",children:e.jsx("span",{className:"truncate",children:N.join(", ")})}),T>0&&e.jsxs(re,{variant:"bodySmall",className:"shrink-0",children:["+ ",T]}),e.jsx("div",{ref:d,className:"absolute invisible whitespace-nowrap","aria-hidden":"true"})]})},A=g=>{s(g),a("")};return e.jsxs(R,{children:[e.jsx(M,{selected:t.length>0,children:j()}),e.jsxs(V,{children:[e.jsx(O,{value:r,onValueChange:a,placeholder:"Search resources..."}),e.jsxs(I,{children:[e.jsx(W,{children:"No resources found"}),i&&e.jsx(F,{children:e.jsxs(k,{selected:t.includes(o),onSelect:()=>A(o),closeOnSelect:!1,value:o,children:['Add "',o,'"']},"__custom__")}),u.map(g=>e.jsx(F,{heading:g.label,children:g.options.map(v=>e.jsx(k,{selected:t.includes(v.value),onSelect:()=>A(v.value),closeOnSelect:!1,value:v.value,children:v.label},v.value))},g.label))]})]})]})}function Qt(t){const s=new Map;for(const n of t){const r=n.split(".");for(let a=1;a<r.length;a++){const o=r.slice(0,a).join(".");s.set(o,(s.get(o)??0)+1)}}return Array.from(s.entries()).filter(([,n])=>n>1&&n<t.length).map(([n])=>`${n}.*`)}function Ee({selectedEvents:t,onToggleEvent:s,emptyMessage:n="All events"}){const[r,a]=m.useState(""),o=m.useDeferredValue(r),[l]=m.useState(()=>({since:new Date(Date.now()-10080*60*1e3).toISOString(),until:new Date().toISOString()})),{data:h=[]}=E(tt("event",{filter:{occurred:l,order:"DESC"},time_unit:"day",time_interval:1})),p=m.useMemo(()=>{const i=h.map(j=>j.label),f=Qt(i);return[...i,...f].sort((j,A)=>j.localeCompare(A))},[h]),d=m.useMemo(()=>{if(!o)return p;const i=o.toLowerCase();return p.filter(f=>f.toLowerCase().includes(i))},[p,o]),c=m.useMemo(()=>{if(!o.trim())return!1;const i=o.toLowerCase();return!p.some(f=>f.toLowerCase()===i)},[o,p]),x=()=>{if(t.length===0)return e.jsx("span",{className:"text-muted-foreground",children:n});const i=t.slice(0,2),f=t.length-i.length;return e.jsxs("div",{className:"flex min-w-0 items-center justify-start gap-1",children:[e.jsx("span",{className:"truncate min-w-0 text-left",children:i.join(", ")}),f>0&&e.jsxs("span",{className:"shrink-0 text-muted-foreground",children:["+",f]})]})},u=i=>{s(i),a("")};return e.jsxs(R,{children:[e.jsx(M,{selected:t.length>0,children:x()}),e.jsxs(V,{children:[e.jsx(O,{value:r,onValueChange:a,placeholder:"Search events..."}),e.jsxs(I,{children:[e.jsx(W,{children:"No events found"}),e.jsxs(F,{children:[c&&e.jsxs(k,{selected:t.includes(o),onSelect:()=>u(o),closeOnSelect:!1,value:o,children:['Add "',o,'"']},"__custom__"),d.map(i=>e.jsx(k,{selected:t.includes(i),onSelect:()=>u(i),closeOnSelect:!1,value:i,children:i},i))]})]})]})]})}const Jt=()=>{const t=_(),s=D({name:"trigger.posture"});return e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex items-end gap-4",children:e.jsx($t,{})}),e.jsx(w,{control:t.control,name:"trigger.expect",render:({field:n})=>{const r=n.value??[];return e.jsxs(b,{children:[e.jsx(S,{children:"Any event matching"}),e.jsx(y,{children:e.jsx(Ee,{selectedEvents:r,onToggleEvent:a=>{const o=r.includes(a)?r.filter(l=>l!==a):[...r,a];n.onChange(o)}})}),e.jsx(C,{})]})}}),e.jsx(w,{control:t.control,name:"trigger.match",render:({field:n})=>{const r=n.value?.["prefect.resource.id"]??[],a=Array.isArray(r)?r:[r];return e.jsxs(b,{children:[e.jsx(S,{children:"From the following resources"}),e.jsx(y,{children:e.jsx(Ae,{selectedResourceIds:a,onToggleResource:o=>{const l=a.includes(o)?a.filter(h=>h!==o):[...a,o];l.length>0?n.onChange({"prefect.resource.id":l}):n.onChange({})}})}),e.jsx(C,{})]})}}),e.jsxs("div",{className:"flex items-end gap-2",children:[e.jsx(w,{control:t.control,name:"trigger.threshold",render:({field:n})=>e.jsxs(b,{className:"w-20",children:[e.jsx(y,{children:e.jsx(Z,{type:"number",min:1,...n,onChange:r=>n.onChange(Number(r.target.value))})}),e.jsx(C,{})]})}),e.jsx("span",{className:"pb-2 text-sm text-muted-foreground",children:"times within"}),e.jsx(w,{control:t.control,name:"trigger.within",render:({field:n})=>e.jsxs(b,{children:[e.jsx(y,{children:e.jsx(se,{value:n.value??0,onChange:n.onChange,min:s==="Proactive"?10:0})}),e.jsx(C,{})]})})]}),e.jsxs(vt,{children:[e.jsxs(bt,{className:"flex items-center gap-2 text-sm font-medium",children:[e.jsx(st,{className:"h-4 w-4 transition-transform data-[state=open]:rotate-90"}),"Evaluation Options"]}),e.jsxs(St,{className:"mt-4 space-y-4 pl-6",children:[e.jsx(w,{control:t.control,name:"trigger.after",render:({field:n})=>{const r=n.value??[];return e.jsxs(b,{children:[e.jsx(S,{children:"Evaluate trigger only after observing an event matching"}),e.jsx(y,{children:e.jsx(Ee,{selectedEvents:r,onToggleEvent:a=>{const o=r.includes(a)?r.filter(l=>l!==a):[...r,a];n.onChange(o)}})}),e.jsx(C,{})]})}}),e.jsx(w,{control:t.control,name:"trigger.match_related",render:({field:n})=>{const r=n.value?.["prefect.resource.id"]??[],a=Array.isArray(r)?r:[r];return e.jsxs(b,{children:[e.jsx(S,{children:"Filter for events related to"}),e.jsx(y,{children:e.jsx(Ae,{selectedResourceIds:a,onToggleResource:o=>{const l=a.includes(o)?a.filter(h=>h!==o):[...a,o];l.length>0?n.onChange({"prefect.resource.id":l}):n.onChange({})}})}),e.jsx(C,{})]})}})]})]})]})},Gt=2,Yt=40,Ht=({selectedDeploymentIds:t,onSelectDeploymentIds:s})=>{const[n,r]=m.useState(""),a=m.useDeferredValue(n),[o,l]=m.useState(0),h=m.useRef(null),p=m.useRef(null),d=m.useMemo(()=>new Set(t),[t]);m.useEffect(()=>{const g=h.current;if(!g)return;const v=new ResizeObserver(N=>{for(const T of N)l(T.contentRect.width)});return v.observe(g),()=>v.disconnect()},[]);const{data:c=[]}=E(je({deployments:a?{operator:"and_",name:{like_:a}}:void 0,limit:100,offset:0,sort:"NAME_ASC"})),{data:x=[]}=E(je({deployments:d.size>0?{operator:"and_",id:{any_:t}}:void 0,limit:d.size||1,offset:0,sort:"NAME_ASC"},{enabled:d.size>0})),u=g=>{const v=new Set(d);d.has(g)?v.delete(g):v.add(g),s(Array.from(v))},i=()=>{s([])},f=m.useCallback(g=>{const v=p.current;if(!v||o===0||g.length===0)return Math.min(g.length,Gt);const N=g.length>1?o-Yt:o;let T=0;for(let L=0;L<g.length&&(v.textContent=g.slice(0,L+1).join(", "),v.offsetWidth<=N);L++)T=L+1;return T===g.length?g.length:Math.max(1,T)},[o]),j=()=>{if(d.size===0)return"All deployments";const g=x.filter(L=>d.has(L.id)).map(L=>L.name),v=f(g),N=g.slice(0,v),T=g.length-v;return e.jsxs("div",{ref:h,className:"flex flex-1 min-w-0 items-center gap-2",children:[e.jsx("div",{className:"flex flex-1 min-w-0 items-center gap-2 overflow-hidden",children:e.jsx("span",{className:"truncate",children:N.join(", ")})}),T>0&&e.jsxs(re,{variant:"bodySmall",className:"shrink-0",children:["+ ",T]}),e.jsx("div",{ref:p,className:"absolute invisible whitespace-nowrap","aria-hidden":"true"})]})},A=m.useMemo(()=>c.filter(g=>!a||g.name.toLowerCase().includes(a.toLowerCase())),[c,a]);return e.jsxs(R,{children:[e.jsx(M,{"aria-label":"Select deployments",selected:d.size===0,children:j()}),e.jsxs(V,{children:[e.jsx(O,{value:n,onValueChange:r,placeholder:"Search deployments..."}),e.jsxs(I,{children:[e.jsx(W,{children:"No deployments found"}),e.jsxs(F,{children:[e.jsxs(k,{"aria-label":"All deployments",onSelect:i,closeOnSelect:!1,value:"__all__",children:[e.jsx(ve,{checked:d.size===0}),"All deployments"]}),A.map(g=>e.jsxs(k,{"aria-label":g.name,onSelect:()=>u(g.id),closeOnSelect:!1,value:g.id,children:[e.jsx(ve,{checked:d.has(g.id)}),g.name]},g.id))]})]})]})]})},Kt=[{value:"Reactive",label:"Enters"},{value:"Proactive",label:"Stays in"}],Xt=30,ne=()=>{const t=_();return e.jsx(w,{control:t.control,name:"trigger.posture",render:({field:s})=>e.jsx(b,{children:e.jsx(y,{children:e.jsxs(B,{value:s.value,onValueChange:n=>{const r=s.value;if(s.onChange(n),r==="Reactive"&&n==="Proactive"){const a=t.getValues("trigger.expect")??[];t.setValue("trigger.after",a),t.setValue("trigger.expect",[]),t.getValues("trigger.within")===0&&t.setValue("trigger.within",Xt)}else if(r==="Proactive"&&n==="Reactive"){const a=t.getValues("trigger.after")??[];t.setValue("trigger.expect",a),t.setValue("trigger.after",[])}},children:[e.jsx(z,{"aria-label":"select posture",className:"w-[160px]",children:e.jsx(Q,{placeholder:"Select posture"})}),e.jsx(J,{children:Kt.map(n=>e.jsx(G,{value:n.value,children:n.label},n.value))})]})})})})},Zt=86400,es=30*Zt,ts=[{value:"prefect.deployment.ready",label:"Ready"},{value:"prefect.deployment.not-ready",label:"Not Ready"},{value:"prefect.deployment.disabled",label:"Disabled"}],Ue="prefect.deployment.",Be="prefect.deployment.*",ss=t=>t?(Array.isArray(t)?t:[t]).filter(n=>n!==Be).map(n=>n.replace(Ue,"")):[],rs=t=>t.length===0?Be:t.map(s=>`${Ue}${s}`),ns=()=>{const t=_(),s=D({name:"trigger.posture"}),n=D({name:"trigger.match"}),r=m.useMemo(()=>{const l=n?.["prefect.resource.id"];return ss(l)},[n]),a=m.useCallback(o=>{const l=t.getValues("trigger.match")??{};t.setValue("trigger.match",{...l,"prefect.resource.id":rs(o)})},[t]);return e.jsxs("div",{className:"space-y-4",children:[e.jsxs(b,{children:[e.jsx(S,{children:"Deployments"}),e.jsx(y,{children:e.jsx(Ht,{selectedDeploymentIds:r,onSelectDeploymentIds:a})})]}),e.jsxs(b,{children:[e.jsx(S,{children:"Deployment"}),e.jsxs("div",{className:"grid gap-2",style:{gridTemplateColumns:"10rem 1fr"},children:[e.jsx(ne,{}),e.jsx(w,{control:t.control,name:"trigger.expect",render:({field:o})=>{const l=o.value?.[0];return e.jsxs(B,{value:l??"",onValueChange:h=>o.onChange([h]),children:[e.jsx(z,{className:"w-full",children:e.jsx(Q,{placeholder:"Select status"})}),e.jsx(J,{children:ts.map(h=>e.jsx(G,{value:h.value,children:h.label},h.value))})]})}})]})]}),s==="Proactive"&&e.jsx(w,{control:t.control,name:"trigger.within",render:({field:o})=>e.jsxs(b,{children:[e.jsx(S,{children:"Within"}),e.jsx(y,{children:e.jsx(se,{value:o.value??0,onChange:o.onChange,min:10,max:es})}),e.jsx(C,{})]})})]})},os=2;function as({selectedFlowIds:t,onToggleFlow:s,emptyMessage:n="Any flow"}){const[r,a]=m.useState(""),o=m.useDeferredValue(r),{data:l=[]}=E(ie({flows:o?{operator:"and_",name:{like_:o}}:void 0,limit:100,offset:0,sort:"NAME_ASC"})),{data:h=[]}=E(ie({flows:t.length>0?{operator:"and_",id:{any_:t}}:void 0,limit:t.length||1,offset:0,sort:"NAME_ASC"},{enabled:t.length>0})),p=m.useMemo(()=>l.filter(c=>!o||c.name.toLowerCase().includes(o.toLowerCase())),[l,o]),d=()=>{if(t.length===0)return e.jsx("span",{className:"text-muted-foreground",children:n});const x=h.filter(i=>t.includes(i.id)).map(i=>i.name).slice(0,os),u=t.length-x.length;return e.jsxs("div",{className:"flex min-w-0 items-center justify-start gap-1",children:[e.jsx("span",{className:"truncate min-w-0 text-left",children:x.join(", ")}),u>0&&e.jsxs("span",{className:"shrink-0 text-muted-foreground",children:["+",u]})]})};return e.jsxs(R,{children:[e.jsx(M,{selected:t.length>0,children:d()}),e.jsxs(V,{children:[e.jsx(O,{value:r,onValueChange:a,placeholder:"Search flows..."}),e.jsxs(I,{children:[e.jsx(W,{children:"No flows found"}),e.jsx(F,{children:p.map(c=>e.jsx(k,{selected:t.includes(c.id),onSelect:()=>{s(c.id),a("")},closeOnSelect:!1,value:c.id,children:c.name},c.id))})]})]})]})}const P="All run states",$="All except scheduled";function ls(t){return t.length!==$e.length-1?!1:!t.includes("Scheduled")}function cs({selectedStates:t,onStateChange:s,emptyMessage:n="Any state"}){const[r,a]=m.useState(""),o=m.useDeferredValue(r),l=m.useMemo(()=>t.length===0?P:ls(t)?$:t,[t]),h=m.useMemo(()=>{const u=o.toLowerCase();return $e.filter(i=>i.toLowerCase().includes(u))},[o]),p=m.useMemo(()=>{const u=o.toLowerCase();return P.toLowerCase().includes(u)||$.toLowerCase().includes(u)},[o]),d=u=>{u===P?s([]):u===$&&s([...xt]),a("")},c=u=>{t.includes(u)?s(t.filter(i=>i!==u)):s([...t,u]),a("")},x=()=>l===P?e.jsx("span",{className:"text-muted-foreground",children:n}):l===$?e.jsx("span",{children:"All except scheduled"}):e.jsx("div",{className:"flex flex-wrap gap-1",children:t.map(u=>e.jsx(be,{type:ye[u],name:u,className:"cursor-pointer"},u))});return e.jsxs(R,{children:[e.jsx(M,{selected:t.length>0,children:x()}),e.jsxs(V,{children:[e.jsx(O,{value:r,onValueChange:a,placeholder:"Search states..."}),e.jsx(W,{children:"No state found"}),e.jsx(I,{children:e.jsxs(F,{children:[p&&e.jsxs(e.Fragment,{children:[e.jsx(k,{selected:l===P,onSelect:()=>d(P),value:P,closeOnSelect:!1,children:"All run states"},P),e.jsx(k,{selected:l===$,onSelect:()=>d($),value:$,closeOnSelect:!1,children:"All except scheduled"},$)]}),h.map(u=>e.jsx(k,{selected:t.includes(u),onSelect:()=>c(u),value:u,closeOnSelect:!1,children:e.jsx(be,{type:ye[u],name:u})},u))]})})]})]})}function is(t){return t.length===0?["prefect.flow-run.*"]:t.map(s=>`prefect.flow-run.${s}`)}function us(t){return!t||t.length===0?[]:t.includes("prefect.flow-run.*")?[]:t.filter(s=>s.startsWith("prefect.flow-run.")).map(s=>s.replace("prefect.flow-run.",""))}function ds(t){if(!t)return[];const s=t["prefect.resource.id"];return s?(Array.isArray(s)?s:[s]).filter(r=>r.startsWith("prefect.flow.")).map(r=>r.replace("prefect.flow.","")):[]}function hs(t){if(!t)return[];const s=t["prefect.resource.id"];return s?(Array.isArray(s)?s:[s]).filter(r=>r.startsWith("prefect.tag.")).map(r=>r.replace("prefect.tag.","")):[]}function Le(t,s){const n=t.map(l=>`prefect.flow.${l}`),r=s.map(l=>`prefect.tag.${l}`);if(n.length===0&&r.length===0)return{};const a=n.length>0?"flow":"tag",o=[...n,...r];return{"prefect.resource.role":a,"prefect.resource.id":o}}const ms=()=>{const t=_(),s=D({name:"trigger.posture"}),n=s==="Proactive"?"trigger.after":"trigger.expect",r=D({name:"trigger.match_related"}),a=ds(r),o=hs(r),l=d=>{const c=a,x=c.includes(d)?c.filter(i=>i!==d):[...c,d],u=x.length>0?[]:o;t.setValue("trigger.match_related",Le(x,u))},h=d=>{t.setValue("trigger.match_related",Le(a,d))},p=a.length===0;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs(b,{children:[e.jsx(S,{children:"Flows"}),e.jsx(y,{children:e.jsx(as,{selectedFlowIds:a,onToggleFlow:l,emptyMessage:"All flows"})})]}),p&&e.jsxs(b,{children:[e.jsx(S,{children:"Flow Run Tags"}),e.jsx(y,{children:e.jsx(wt,{value:o,onChange:h,placeholder:"All tags"})})]}),e.jsxs(b,{children:[e.jsx(S,{children:"Flow Run"}),e.jsxs("div",{className:"grid grid-cols-[10rem_1fr] gap-2",children:[e.jsx(ne,{}),e.jsx(w,{control:t.control,name:n,render:({field:d})=>{const c=d.value??[],x=us(c);return e.jsx(y,{children:e.jsx(cs,{selectedStates:x,onStateChange:u=>{d.onChange(is(u))},emptyMessage:"Any state"})})}})]})]}),s==="Proactive"&&e.jsx(w,{control:t.control,name:"trigger.within",render:({field:d})=>e.jsxs(b,{children:[e.jsx(S,{children:"For"}),e.jsx(y,{children:e.jsx(se,{value:d.value??0,onChange:d.onChange,min:0})}),e.jsx(C,{})]})})]})},ps=({defaultValue:t="Form",value:s,onValueChange:n,formContent:r,jsonContent:a})=>{const o=s!==void 0?{value:s,onValueChange:n}:{defaultValue:t};return e.jsxs(rt,{...o,children:[e.jsx("div",{className:"flex justify-center",children:e.jsxs(nt,{children:[e.jsx(Se,{value:"Form",children:"Form"}),e.jsx(Se,{value:"JSON",children:"JSON"})]})}),e.jsx(we,{value:"Form",children:r}),e.jsx(we,{value:"JSON",children:a})]})},xs=({value:t,onChange:s,error:n})=>{const[r,a]=m.useState(null),o=()=>{try{const h=JSON.parse(t);s(JSON.stringify(h,null,2))}catch{}},l=h=>{try{const p=JSON.parse(h);return Pe.parse(p),a(null),!0}catch(p){return p instanceof SyntaxError?a("Invalid JSON syntax"):p instanceof Re&&a(p.errors[0]?.message??"Invalid trigger configuration"),!1}};return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(xe,{children:"Trigger Configuration"}),e.jsx(U,{variant:"ghost",size:"sm",onClick:o,children:"Format"})]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Edit the trigger configuration as JSON."," ",e.jsx("a",{href:"https://docs.prefect.io/v3/automate/events/automations-triggers",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-foreground",children:"View documentation"})]}),e.jsx(ot,{value:t,onChange:s,onBlur:()=>l(t)}),(r||n)&&e.jsx("p",{className:"text-sm text-destructive",children:r||n})]})},De={"deployment-status":"Deployment status","flow-run-state":"Flow run state","work-pool-status":"Work pool status","work-queue-status":"Work queue status",custom:"Custom"},fs=({onValueChange:t,value:s})=>e.jsxs("div",{className:"space-y-2",children:[e.jsx(xe,{htmlFor:"automations-trigger-template-select",children:"Trigger Template"}),e.jsxs(B,{value:s,onValueChange:t,children:[e.jsx(z,{id:"automations-trigger-template-select",className:"w-full",children:e.jsx(Q,{placeholder:"Select template"})}),e.jsx(J,{children:e.jsx(Me,{children:Object.keys(De).map(n=>e.jsx(G,{value:n,children:De[n]},n))})})]})]}),gs=({onTemplateChange:t})=>{const s=_();return e.jsx(w,{control:s.control,name:"triggerTemplate",render:({field:n})=>e.jsx(b,{children:e.jsx(y,{children:e.jsx(fs,{value:n.value,onValueChange:r=>{n.onChange(r),t?.(r)}})})})})},js={type:"event",posture:"Reactive",threshold:1,within:0},vs=t=>{switch(t){case"flow-run-state":return{type:"event",match:{"prefect.resource.id":"prefect.flow-run.*"},match_related:{},after:[],expect:["prefect.flow-run.*"],for_each:["prefect.resource.id"],posture:"Reactive",threshold:1,within:0};case"deployment-status":return{type:"event",match:{"prefect.resource.id":"prefect.deployment.*"},match_related:{},after:[],expect:["prefect.deployment.not-ready"],for_each:["prefect.resource.id"],posture:"Reactive",threshold:1,within:0};case"work-pool-status":return{type:"event",match:{"prefect.resource.id":"prefect.work-pool.*"},match_related:{},after:[],expect:["prefect.work-pool.not-ready","prefect.work-pool.not_ready"],for_each:["prefect.resource.id"],posture:"Reactive",threshold:1,within:0};case"work-queue-status":return{type:"event",match:{"prefect.resource.id":"prefect.work-queue.*"},match_related:{},after:[],expect:["prefect.work-queue.not-ready"],for_each:["prefect.resource.id"],posture:"Reactive",threshold:1,within:0};case"custom":return{type:"event",match:{"prefect.resource.id":["prefect.flow-run.*"]},match_related:{},after:[],expect:["prefect.flow-run.Failed"],for_each:[],posture:"Reactive",threshold:5,within:60};default:return js}};function bs({selectedWorkPoolIds:t,onToggleWorkPool:s,emptyMessage:n="All work pools"}){const[r,a]=m.useState(""),o=m.useDeferredValue(r),{data:l=[]}=E(pe()),h=m.useMemo(()=>l.filter(c=>c.status!==null).filter(c=>!o||c.name.toLowerCase().includes(o.toLowerCase())),[l,o]),p=m.useMemo(()=>l.filter(c=>t.includes(c.id)),[l,t]),d=()=>{if(t.length===0)return e.jsx("span",{className:"text-muted-foreground",children:n});const c=p.map(x=>x.name);return e.jsx("span",{className:"truncate min-w-0 text-left",children:c.join(", ")})};return e.jsxs(R,{children:[e.jsx(M,{selected:t.length>0,children:d()}),e.jsxs(V,{children:[e.jsx(O,{value:r,onValueChange:a,placeholder:"Search work pools..."}),e.jsxs(I,{children:[e.jsx(W,{children:"No work pools found"}),e.jsx(F,{children:h.map(c=>e.jsx(k,{selected:t.includes(c.id),onSelect:()=>{s(c.id),a("")},closeOnSelect:!1,value:c.id,children:c.name},c.id))})]})]})]})}const oe=[{value:"ready",label:"Ready",events:["prefect.work-pool.ready"]},{value:"not_ready",label:"Not Ready",events:["prefect.work-pool.not-ready","prefect.work-pool.not_ready"]},{value:"paused",label:"Paused",events:["prefect.work-pool.paused"]}];function Fe(t){if(!t||t.length===0)return"not_ready";for(const s of oe)if(s.events.some(n=>t.includes(n)))return s.value;return"not_ready"}function Ss(t){const s=oe.find(n=>n.value===t);return s?[...s.events]:[]}function ws(t){return oe.filter(s=>s.value!==t).flatMap(s=>[...s.events])}function ys(t){if(!t)return[];const s=t["prefect.resource.id"];return s?s==="prefect.work-pool.*"?[]:(Array.isArray(s)?s:[s]).filter(r=>r.startsWith("prefect.work-pool.")&&r!=="prefect.work-pool.*").map(r=>r.replace("prefect.work-pool.","")):[]}function Cs(t){return t.length===0?{"prefect.resource.id":"prefect.work-pool.*"}:{"prefect.resource.id":t.map(s=>`prefect.work-pool.${s}`)}}const ks=()=>{const t=_(),s=D({name:"trigger.posture"}),n=D({name:"trigger.expect"}),r=D({name:"trigger.after"}),a=Fe(s==="Proactive"?r:n),o=l=>{const h=Ss(l),p=ws(l);s==="Proactive"?(t.setValue("trigger.after",h),t.setValue("trigger.expect",p)):(t.setValue("trigger.expect",h),t.setValue("trigger.after",[]))};return e.jsxs(B,{value:a,onValueChange:o,children:[e.jsx(z,{"aria-label":"select status",className:"min-w-0 flex-1",children:e.jsx(Q,{placeholder:"Select status"})}),e.jsx(J,{children:oe.map(l=>e.jsx(G,{value:l.value,children:l.label},l.value))})]})},Ns=()=>{const t=_(),s=D({name:"trigger.posture"}),n=D({name:"trigger.match"}),r=ys(n),a=o=>{const l=r,h=l.includes(o)?l.filter(p=>p!==o):[...l,o];t.setValue("trigger.match",Cs(h))};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs(b,{children:[e.jsx(S,{children:"Work Pools"}),e.jsx(y,{children:e.jsx(bs,{selectedWorkPoolIds:r,onToggleWorkPool:a,emptyMessage:"All work pools"})})]}),e.jsxs(b,{children:[e.jsx(S,{children:"Work Pool"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{}),e.jsx(ks,{})]})]}),s==="Proactive"&&e.jsx(w,{control:t.control,name:"trigger.within",render:({field:o})=>e.jsxs(b,{children:[e.jsx(S,{children:"For"}),e.jsx(y,{children:e.jsx(se,{value:o.value??30,onChange:o.onChange,min:0})}),e.jsx(C,{})]})})]})};function _s({selectedWorkPoolIds:t,onToggleWorkPool:s,emptyMessage:n="All work pools"}){const[r,a]=m.useState(""),o=m.useDeferredValue(r),{data:l=[]}=E(pe({limit:100,offset:0})),h=m.useMemo(()=>l.filter(d=>d.status?o?d.name.toLowerCase().includes(o.toLowerCase()):!0:!1),[l,o]),p=()=>{if(t.length===0)return e.jsx("span",{className:"text-muted-foreground",children:n});const d=l.filter(c=>t.includes(c.id)).map(c=>c.name);return e.jsx("span",{className:"truncate min-w-0 text-left",children:d.join(", ")})};return e.jsxs(R,{children:[e.jsx(M,{selected:t.length>0,children:p()}),e.jsxs(V,{children:[e.jsx(O,{value:r,onValueChange:a,placeholder:"Search work pools..."}),e.jsxs(I,{children:[e.jsx(W,{children:"No work pools found"}),e.jsx(F,{children:h.map(d=>e.jsx(k,{selected:t.includes(d.id),onSelect:()=>{s(d.id),a("")},closeOnSelect:!1,value:d.id,children:d.name},d.id))})]})]})]})}function Ts({selectedWorkQueueIds:t,onToggleWorkQueue:s,workPoolIds:n=[],emptyMessage:r="All work queues"}){const[a,o]=m.useState(""),l=m.useDeferredValue(a),{data:h=[]}=E(Ie({limit:100,offset:0})),p=m.useMemo(()=>h.filter(x=>n.length>0&&(!x.work_pool_id||!n.includes(x.work_pool_id))?!1:l?x.name.toLowerCase().includes(l.toLowerCase()):!0),[h,n,l]),d=m.useMemo(()=>{const x={};for(const i of p){const f=i.work_pool_name??"Unknown";x[f]||(x[f]=[]),x[f].push(i)}return Object.keys(x).sort((i,f)=>i.localeCompare(f)).map(i=>({poolName:i,queues:x[i].sort((f,j)=>f.name.localeCompare(j.name))}))},[p]),c=()=>{if(t.length===0)return e.jsx("span",{className:"text-muted-foreground",children:r});const x=h.filter(u=>t.includes(u.id)).map(u=>u.name);return e.jsx("span",{className:"truncate min-w-0 text-left",children:x.join(", ")})};return e.jsxs(R,{children:[e.jsx(M,{selected:t.length>0,children:c()}),e.jsxs(V,{children:[e.jsx(O,{value:a,onValueChange:o,placeholder:"Search work queues..."}),e.jsxs(I,{children:[e.jsx(W,{children:"No work queues found"}),d.map(x=>e.jsx(F,{heading:x.poolName,children:x.queues.map(u=>e.jsx(k,{selected:t.includes(u.id),onSelect:()=>{s(u.id),o("")},closeOnSelect:!1,value:u.id,children:u.name},u.id))},x.poolName))]})]})]})}const As=[{value:"prefect.work-queue.ready",label:"Ready"},{value:"prefect.work-queue.not-ready",label:"Not Ready"},{value:"prefect.work-queue.paused",label:"Paused"}];function Es(t){if(!t)return[];const s=t["prefect.resource.id"];return s?(Array.isArray(s)?s:[s]).filter(r=>r.startsWith("prefect.work-pool.")).map(r=>r.replace("prefect.work-pool.","")):[]}function Ls(t){if(!t)return[];const s=t["prefect.resource.id"];if(!s)return[];const n=Array.isArray(s)?s:[s];return n.includes("prefect.work-queue.*")?[]:n.filter(r=>r.startsWith("prefect.work-queue.")).map(r=>r.replace("prefect.work-queue.",""))}function Ds(t){return t.length===0?{}:{"prefect.resource.role":"work-pool","prefect.resource.id":t.map(n=>`prefect.work-pool.${n}`)}}function Fs(t){return t.length===0?{"prefect.resource.id":"prefect.work-queue.*"}:{"prefect.resource.id":t.map(n=>`prefect.work-queue.${n}`)}}const Rs=()=>{const t=_(),s=D({name:"trigger.posture"}),n=D({name:"trigger.match_related"}),r=D({name:"trigger.match"}),a=Es(n),o=Ls(r),l=p=>{const d=a,c=d.includes(p)?d.filter(x=>x!==p):[...d,p];t.setValue("trigger.match_related",Ds(c))},h=p=>{const d=o,c=d.includes(p)?d.filter(x=>x!==p):[...d,p];t.setValue("trigger.match",Fs(c))};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs(b,{children:[e.jsx(S,{children:"Work Pools"}),e.jsx(y,{children:e.jsx(_s,{selectedWorkPoolIds:a,onToggleWorkPool:l,emptyMessage:"All work pools"})})]}),e.jsxs(b,{children:[e.jsx(S,{children:"Work Queues"}),e.jsx(y,{children:e.jsx(Ts,{selectedWorkQueueIds:o,onToggleWorkQueue:h,workPoolIds:a,emptyMessage:"All work queues"})})]}),e.jsxs(b,{children:[e.jsx(S,{children:"Work Queue"}),e.jsxs("div",{className:"grid grid-cols-[10rem_1fr] gap-2",children:[e.jsx(ne,{}),e.jsx(w,{control:t.control,name:"trigger.expect",render:({field:p})=>{const d=p.value?.[0];return e.jsx(y,{children:e.jsxs(B,{value:d??"",onValueChange:c=>p.onChange([c]),children:[e.jsx(z,{className:"w-full",children:e.jsx(Q,{placeholder:"Select status"})}),e.jsx(J,{children:As.map(c=>e.jsx(G,{value:c.value,children:c.label},c.value))})]})})}})]})]}),s==="Proactive"&&e.jsx(w,{control:t.control,name:"trigger.within",render:({field:p})=>e.jsxs(b,{children:[e.jsx(S,{children:"For"}),e.jsx(y,{children:e.jsx(se,{value:p.value??0,onChange:p.onChange,min:0})}),e.jsx(C,{})]})})]})},Ms=()=>{const t=_(),s=t.watch("triggerTemplate"),n=t.watch("trigger"),[r,a]=m.useState("Form"),[o,l]=m.useState(""),[h,p]=m.useState(void 0),d=m.useCallback(()=>JSON.stringify(n,null,2),[n]);m.useEffect(()=>{r==="Form"&&l(d())},[r,d]);const c=m.useCallback(f=>{try{const j=JSON.parse(f);return{valid:!0,trigger:Pe.parse(j)}}catch(j){return j instanceof SyntaxError?{valid:!1,error:"Invalid JSON syntax"}:j instanceof Re?{valid:!1,error:j.errors[0]?.message??"Invalid trigger configuration"}:{valid:!1,error:"Unknown error"}}},[]),x=m.useCallback(f=>{if(r!==f){if(f==="Form"){const j=c(o);if(!j.valid){p(j.error);return}j.trigger&&t.setValue("trigger",j.trigger),p(void 0)}else l(d()),p(void 0);a(f)}},[r,o,c,t,d]),u=m.useCallback(f=>{l(f);const j=c(f);j.valid&&j.trigger&&(t.setValue("trigger",j.trigger),p(void 0))},[c,t]),i=f=>{const j=vs(f);t.setValue("trigger",j),l(JSON.stringify(j,null,2)),p(void 0)};return e.jsxs("div",{className:"space-y-6",children:[e.jsx(gs,{onTemplateChange:i}),s&&e.jsx(ps,{value:r,onValueChange:x,formContent:e.jsx(Vs,{template:s}),jsonContent:e.jsx(xs,{value:o,onChange:u,error:h})})]})},Vs=({template:t})=>{switch(t){case"flow-run-state":return e.jsx(ms,{});case"deployment-status":return e.jsx(ns,{});case"work-pool-status":return e.jsx(Ns,{});case"work-queue-status":return e.jsx(Rs,{});case"custom":return e.jsx(Jt,{});default:return null}},ce=["Trigger","Actions","Details"],Os={actions:[{type:void 0}],trigger:{type:"event",posture:"Reactive",threshold:1,within:0}},Hs=({defaultValues:t={},onSubmit:s,submitLabel:n="Save",isSubmitting:r=!1})=>{const o=!!(t&&Object.keys(t).length>0)?new Set([0,1,2]):new Set([0]),l=ut(ce.length,0,o),h=Ye({resolver:Je(ht),defaultValues:{...Os,...t}}),p=ce[l.currentStep],d={Trigger:{render:()=>e.jsx(Ms,{}),trigger:()=>h.trigger("trigger")},Actions:{render:()=>e.jsx(Ot,{}),trigger:()=>h.trigger("actions")},Details:{render:()=>e.jsx(Wt,{}),trigger:()=>h.trigger(["description","name"])}},c=async x=>{await d[x].trigger()&&l.incrementStep()};return e.jsx(it,{...h,children:e.jsx("form",{onSubmit:x=>{h.handleSubmit(s)(x)},children:e.jsxs("div",{className:"flex flex-col gap-8",children:[e.jsx(dt,{steps:ce,currentStepNum:l.currentStep,onClick:x=>l.changeStep(x.stepNum),completedSteps:l.completedStepsSet,visitedSteps:l.visitedStepsSet}),e.jsxs(at,{className:"p-4 pt-8",children:[e.jsxs(lt,{children:[d[p].render(),e.jsx(C,{children:h.formState.errors.root?.message})]}),e.jsxs(ct,{className:"mt-6 flex gap-2 justify-end",children:[e.jsx(U,{type:"button",variant:"outline",children:e.jsx(Qe,{to:"/automations",children:"Cancel"})}),e.jsx(U,{disabled:l.isStartingStep,type:"button",variant:"outline",onClick:l.decrementStep,children:"Previous"}),l.isFinalStep?e.jsx(U,{type:"submit",loading:r,children:n},"save"):e.jsx(U,{type:"button",onClick:()=>{c(p)},children:"Next"},"next")]})]})]})})})};export{Hs as A};
|
|
2
|
+
//# sourceMappingURL=automation-wizard-D7nVgckT.js.map
|