watch-tail 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +158 -0
- package/build/client/_app/immutable/assets/0.Dfts6BC4.css +2 -0
- package/build/client/_app/immutable/assets/0.Dfts6BC4.css.br +0 -0
- package/build/client/_app/immutable/assets/0.Dfts6BC4.css.gz +0 -0
- package/build/client/_app/immutable/assets/BrushContext.2tkUc39H.css +1 -0
- package/build/client/_app/immutable/assets/BrushContext.2tkUc39H.css.br +0 -0
- package/build/client/_app/immutable/assets/BrushContext.2tkUc39H.css.gz +0 -0
- package/build/client/_app/immutable/assets/ChartAnnotations.Bw8CGteN.css +1 -0
- package/build/client/_app/immutable/assets/ChartAnnotations.Bw8CGteN.css.br +0 -0
- package/build/client/_app/immutable/assets/ChartAnnotations.Bw8CGteN.css.gz +0 -0
- package/build/client/_app/immutable/assets/Circle.C5MKzgk2.css +1 -0
- package/build/client/_app/immutable/assets/Circle.C5MKzgk2.css.br +1 -0
- package/build/client/_app/immutable/assets/Circle.C5MKzgk2.css.gz +0 -0
- package/build/client/_app/immutable/assets/DefaultTooltip.CGOVIm3D.css +1 -0
- package/build/client/_app/immutable/assets/DefaultTooltip.CGOVIm3D.css.br +0 -0
- package/build/client/_app/immutable/assets/DefaultTooltip.CGOVIm3D.css.gz +0 -0
- package/build/client/_app/immutable/assets/EventScatter.DA5sZ1c0.css +1 -0
- package/build/client/_app/immutable/assets/EventScatter.DA5sZ1c0.css.br +0 -0
- package/build/client/_app/immutable/assets/EventScatter.DA5sZ1c0.css.gz +0 -0
- package/build/client/_app/immutable/assets/Labels.sEaJtb97.css +1 -0
- package/build/client/_app/immutable/assets/Labels.sEaJtb97.css.br +0 -0
- package/build/client/_app/immutable/assets/Labels.sEaJtb97.css.gz +0 -0
- package/build/client/_app/immutable/assets/Legend.DnhxhJ2I.css +1 -0
- package/build/client/_app/immutable/assets/Legend.DnhxhJ2I.css.br +0 -0
- package/build/client/_app/immutable/assets/Legend.DnhxhJ2I.css.gz +0 -0
- package/build/client/_app/immutable/assets/Path.B0wDzTrn.css +1 -0
- package/build/client/_app/immutable/assets/Path.B0wDzTrn.css.br +0 -0
- package/build/client/_app/immutable/assets/Path.B0wDzTrn.css.gz +0 -0
- package/build/client/_app/immutable/assets/TransformContext.1cjyViIk.css +1 -0
- package/build/client/_app/immutable/assets/TransformContext.1cjyViIk.css.br +0 -0
- package/build/client/_app/immutable/assets/TransformContext.1cjyViIk.css.gz +0 -0
- package/build/client/_app/immutable/assets/Voronoi.ce7atosu.css +1 -0
- package/build/client/_app/immutable/assets/Voronoi.ce7atosu.css.br +0 -0
- package/build/client/_app/immutable/assets/Voronoi.ce7atosu.css.gz +0 -0
- package/build/client/_app/immutable/chunks/Amq8zxdJ.js +1 -0
- package/build/client/_app/immutable/chunks/Amq8zxdJ.js.br +0 -0
- package/build/client/_app/immutable/chunks/Amq8zxdJ.js.gz +0 -0
- package/build/client/_app/immutable/chunks/B3p3umIY.js +1 -0
- package/build/client/_app/immutable/chunks/B3p3umIY.js.br +0 -0
- package/build/client/_app/immutable/chunks/B3p3umIY.js.gz +0 -0
- package/build/client/_app/immutable/chunks/B43Eeyih.js +1 -0
- package/build/client/_app/immutable/chunks/B43Eeyih.js.br +0 -0
- package/build/client/_app/immutable/chunks/B43Eeyih.js.gz +0 -0
- package/build/client/_app/immutable/chunks/B5q6rkQ-.js +1 -0
- package/build/client/_app/immutable/chunks/B5q6rkQ-.js.br +0 -0
- package/build/client/_app/immutable/chunks/B5q6rkQ-.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BAynhd7i.js +1 -0
- package/build/client/_app/immutable/chunks/BAynhd7i.js.br +0 -0
- package/build/client/_app/immutable/chunks/BAynhd7i.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BDlvDAqe.js +1 -0
- package/build/client/_app/immutable/chunks/BDlvDAqe.js.br +0 -0
- package/build/client/_app/immutable/chunks/BDlvDAqe.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BGmgUZMc.js +10 -0
- package/build/client/_app/immutable/chunks/BGmgUZMc.js.br +0 -0
- package/build/client/_app/immutable/chunks/BGmgUZMc.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BJpWBbAS.js +1 -0
- package/build/client/_app/immutable/chunks/BJpWBbAS.js.br +0 -0
- package/build/client/_app/immutable/chunks/BJpWBbAS.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BOT2hFMn.js +1 -0
- package/build/client/_app/immutable/chunks/BOT2hFMn.js.br +0 -0
- package/build/client/_app/immutable/chunks/BOT2hFMn.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BR2LaRms.js +1 -0
- package/build/client/_app/immutable/chunks/BR2LaRms.js.br +1 -0
- package/build/client/_app/immutable/chunks/BR2LaRms.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BZFYtRPj.js +1 -0
- package/build/client/_app/immutable/chunks/BZFYtRPj.js.br +0 -0
- package/build/client/_app/immutable/chunks/BZFYtRPj.js.gz +0 -0
- package/build/client/_app/immutable/chunks/BjxZ_neZ.js +5 -0
- package/build/client/_app/immutable/chunks/BjxZ_neZ.js.br +0 -0
- package/build/client/_app/immutable/chunks/BjxZ_neZ.js.gz +0 -0
- package/build/client/_app/immutable/chunks/Bl052uUt.js +1 -0
- package/build/client/_app/immutable/chunks/Bl052uUt.js.br +0 -0
- package/build/client/_app/immutable/chunks/Bl052uUt.js.gz +0 -0
- package/build/client/_app/immutable/chunks/{Bw_9uNRP.js → BsH4MNzX.js} +1 -1
- package/build/client/_app/immutable/chunks/BsH4MNzX.js.br +0 -0
- package/build/client/_app/immutable/chunks/BsH4MNzX.js.gz +0 -0
- package/build/client/_app/immutable/chunks/ByhwhtiG.js +1 -0
- package/build/client/_app/immutable/chunks/ByhwhtiG.js.br +0 -0
- package/build/client/_app/immutable/chunks/ByhwhtiG.js.gz +0 -0
- package/build/client/_app/immutable/chunks/C1lycbEF.js +1 -0
- package/build/client/_app/immutable/chunks/C1lycbEF.js.br +0 -0
- package/build/client/_app/immutable/chunks/C1lycbEF.js.gz +0 -0
- package/build/client/_app/immutable/chunks/C58PZtCD.js +4 -0
- package/build/client/_app/immutable/chunks/C58PZtCD.js.br +0 -0
- package/build/client/_app/immutable/chunks/C58PZtCD.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CCch3uox.js +1 -0
- package/build/client/_app/immutable/chunks/CCch3uox.js.br +0 -0
- package/build/client/_app/immutable/chunks/CCch3uox.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CEU4ihsz.js +1 -0
- package/build/client/_app/immutable/chunks/CEU4ihsz.js.br +0 -0
- package/build/client/_app/immutable/chunks/CEU4ihsz.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CG6rRxUy.js +2 -0
- package/build/client/_app/immutable/chunks/CG6rRxUy.js.br +0 -0
- package/build/client/_app/immutable/chunks/CG6rRxUy.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CM5sQDq_.js +1 -0
- package/build/client/_app/immutable/chunks/CM5sQDq_.js.br +0 -0
- package/build/client/_app/immutable/chunks/CM5sQDq_.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CT_NYh_-.js +1 -0
- package/build/client/_app/immutable/chunks/CT_NYh_-.js.br +0 -0
- package/build/client/_app/immutable/chunks/CT_NYh_-.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CZIk93qi.js +1 -0
- package/build/client/_app/immutable/chunks/CZIk93qi.js.br +0 -0
- package/build/client/_app/immutable/chunks/CZIk93qi.js.gz +0 -0
- package/build/client/_app/immutable/chunks/C_aXFBl3.js +1 -0
- package/build/client/_app/immutable/chunks/C_aXFBl3.js.br +0 -0
- package/build/client/_app/immutable/chunks/C_aXFBl3.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CqWPu3PG.js +1 -0
- package/build/client/_app/immutable/chunks/CqWPu3PG.js.br +1 -0
- package/build/client/_app/immutable/chunks/CqWPu3PG.js.gz +0 -0
- package/build/client/_app/immutable/chunks/CyncJW0D.js +1 -0
- package/build/client/_app/immutable/chunks/CyncJW0D.js.br +0 -0
- package/build/client/_app/immutable/chunks/CyncJW0D.js.gz +0 -0
- package/build/client/_app/immutable/chunks/D4sC5v3c.js +1 -0
- package/build/client/_app/immutable/chunks/D4sC5v3c.js.br +0 -0
- package/build/client/_app/immutable/chunks/D4sC5v3c.js.gz +0 -0
- package/build/client/_app/immutable/chunks/D76YLq-2.js +1 -0
- package/build/client/_app/immutable/chunks/D76YLq-2.js.br +0 -0
- package/build/client/_app/immutable/chunks/D76YLq-2.js.gz +0 -0
- package/build/client/_app/immutable/chunks/D8H_ivbb.js +1 -0
- package/build/client/_app/immutable/chunks/D8H_ivbb.js.br +0 -0
- package/build/client/_app/immutable/chunks/D8H_ivbb.js.gz +0 -0
- package/build/client/_app/immutable/chunks/DU0OQtdJ.js +1 -0
- package/build/client/_app/immutable/chunks/DU0OQtdJ.js.br +0 -0
- package/build/client/_app/immutable/chunks/DU0OQtdJ.js.gz +0 -0
- package/build/client/_app/immutable/chunks/Db0q5_zr.js +1 -0
- package/build/client/_app/immutable/chunks/Db0q5_zr.js.br +0 -0
- package/build/client/_app/immutable/chunks/Db0q5_zr.js.gz +0 -0
- package/build/client/_app/immutable/chunks/Dfvzj6n2.js +1 -0
- package/build/client/_app/immutable/chunks/Dfvzj6n2.js.br +0 -0
- package/build/client/_app/immutable/chunks/Dfvzj6n2.js.gz +0 -0
- package/build/client/_app/immutable/chunks/HclGiUj8.js +1 -0
- package/build/client/_app/immutable/chunks/HclGiUj8.js.br +0 -0
- package/build/client/_app/immutable/chunks/HclGiUj8.js.gz +0 -0
- package/build/client/_app/immutable/chunks/RobXhXPM.js +1 -0
- package/build/client/_app/immutable/chunks/RobXhXPM.js.br +1 -0
- package/build/client/_app/immutable/chunks/RobXhXPM.js.gz +0 -0
- package/build/client/_app/immutable/chunks/Y5urAfNy.js +1 -0
- package/build/client/_app/immutable/chunks/Y5urAfNy.js.br +0 -0
- package/build/client/_app/immutable/chunks/Y5urAfNy.js.gz +0 -0
- package/build/client/_app/immutable/chunks/Yk6ZJZnu.js +1 -0
- package/build/client/_app/immutable/chunks/Yk6ZJZnu.js.br +0 -0
- package/build/client/_app/immutable/chunks/Yk6ZJZnu.js.gz +0 -0
- package/build/client/_app/immutable/chunks/jO4fmY1N.js +1 -0
- package/build/client/_app/immutable/chunks/jO4fmY1N.js.br +0 -0
- package/build/client/_app/immutable/chunks/jO4fmY1N.js.gz +0 -0
- package/build/client/_app/immutable/chunks/pqiPC7Y8.js +3 -0
- package/build/client/_app/immutable/chunks/pqiPC7Y8.js.br +0 -0
- package/build/client/_app/immutable/chunks/pqiPC7Y8.js.gz +0 -0
- package/build/client/_app/immutable/chunks/snfmbqby.js +1 -0
- package/build/client/_app/immutable/chunks/snfmbqby.js.br +0 -0
- package/build/client/_app/immutable/chunks/snfmbqby.js.gz +0 -0
- package/build/client/_app/immutable/chunks/wx-wtMGx.js +15 -0
- package/build/client/_app/immutable/chunks/wx-wtMGx.js.br +0 -0
- package/build/client/_app/immutable/chunks/wx-wtMGx.js.gz +0 -0
- package/build/client/_app/immutable/chunks/yCfI4PCa.js +1 -0
- package/build/client/_app/immutable/chunks/yCfI4PCa.js.br +0 -0
- package/build/client/_app/immutable/chunks/yCfI4PCa.js.gz +0 -0
- package/build/client/_app/immutable/chunks/zHL7lw4G.js +1 -0
- package/build/client/_app/immutable/chunks/zHL7lw4G.js.br +0 -0
- package/build/client/_app/immutable/chunks/zHL7lw4G.js.gz +0 -0
- package/build/client/_app/immutable/entry/app.DFSifnlU.js +2 -0
- package/build/client/_app/immutable/entry/app.DFSifnlU.js.br +0 -0
- package/build/client/_app/immutable/entry/app.DFSifnlU.js.gz +0 -0
- package/build/client/_app/immutable/entry/start.2H5s3Lol.js +1 -0
- package/build/client/_app/immutable/entry/start.2H5s3Lol.js.br +1 -0
- package/build/client/_app/immutable/entry/start.2H5s3Lol.js.gz +0 -0
- package/build/client/_app/immutable/nodes/0.BN3NguWs.js +1 -0
- package/build/client/_app/immutable/nodes/0.BN3NguWs.js.br +0 -0
- package/build/client/_app/immutable/nodes/0.BN3NguWs.js.gz +0 -0
- package/build/client/_app/immutable/nodes/1.Djdw1GzA.js +1 -0
- package/build/client/_app/immutable/nodes/1.Djdw1GzA.js.br +0 -0
- package/build/client/_app/immutable/nodes/1.Djdw1GzA.js.gz +0 -0
- package/build/client/_app/immutable/nodes/2.CjvaJDQJ.js +4 -0
- package/build/client/_app/immutable/nodes/2.CjvaJDQJ.js.br +0 -0
- package/build/client/_app/immutable/nodes/2.CjvaJDQJ.js.gz +0 -0
- package/build/client/_app/version.json +1 -1
- package/build/client/_app/version.json.br +0 -0
- package/build/client/_app/version.json.gz +0 -0
- package/build/handler.js +9 -7
- package/build/handler.js.map +1 -1
- package/build/index.js +9 -7
- package/build/index.js.map +1 -1
- package/build/server/chunks/chunks/Arc.canvas.js-D6g58nSp.js +701 -0
- package/build/server/chunks/chunks/Arc.canvas.js-D6g58nSp.js.map +1 -0
- package/build/server/chunks/chunks/Arc.js-D78Cf_4M.js +31 -0
- package/build/server/chunks/chunks/Arc.js-D78Cf_4M.js.map +1 -0
- package/build/server/chunks/chunks/Bar.js-Cv73T8_D.js +448 -0
- package/build/server/chunks/chunks/Bar.js-Cv73T8_D.js.map +1 -0
- package/build/server/chunks/chunks/ChartAnnotations.js-Ci22VB_6.js +983 -0
- package/build/server/chunks/chunks/ChartAnnotations.js-Ci22VB_6.js.map +1 -0
- package/build/server/chunks/chunks/Circle.html.js-BjwyNRG3.js +355 -0
- package/build/server/chunks/chunks/Circle.html.js-BjwyNRG3.js.map +1 -0
- package/build/server/chunks/chunks/ClipPath.canvas.js-CFTBDWVU.js +170 -0
- package/build/server/chunks/chunks/ClipPath.canvas.js-CFTBDWVU.js.map +1 -0
- package/build/server/chunks/chunks/DefaultTooltip.js-0r5rbE-1.js +352 -0
- package/build/server/chunks/chunks/DefaultTooltip.js-0r5rbE-1.js.map +1 -0
- package/build/server/chunks/chunks/EventScatter.js-D3Jaw_Cw.js +7308 -0
- package/build/server/chunks/chunks/EventScatter.js-D3Jaw_Cw.js.map +1 -0
- package/build/server/chunks/chunks/Labels.js-DpagpV6d.js +497 -0
- package/build/server/chunks/chunks/Labels.js-DpagpV6d.js.map +1 -0
- package/build/server/chunks/chunks/Legend.js-BOpwpe5s.js +343 -0
- package/build/server/chunks/chunks/Legend.js-BOpwpe5s.js.map +1 -0
- package/build/server/chunks/chunks/Line.html.js-BM5tR11G.js +423 -0
- package/build/server/chunks/chunks/Line.html.js-BM5tR11G.js.map +1 -0
- package/build/server/chunks/chunks/Link.canvas.js-P8ySzEAw.js +756 -0
- package/build/server/chunks/chunks/Link.canvas.js-P8ySzEAw.js.map +1 -0
- package/build/server/chunks/chunks/Path.canvas.js-DNAtnEBt.js +1259 -0
- package/build/server/chunks/chunks/Path.canvas.js-DNAtnEBt.js.map +1 -0
- package/build/server/chunks/chunks/Points.html.js-CLbHD6OP.js +228 -0
- package/build/server/chunks/chunks/Points.html.js-CLbHD6OP.js.map +1 -0
- package/build/server/chunks/chunks/Points.js-e6g0Re6H.js +14 -0
- package/build/server/chunks/chunks/Points.js-e6g0Re6H.js.map +1 -0
- package/build/server/chunks/chunks/Points2.js-BMGdkzTE.js +25 -0
- package/build/server/chunks/chunks/Points2.js-BMGdkzTE.js.map +1 -0
- package/build/server/chunks/chunks/Rect.html.js-Q3UvRwNn.js +547 -0
- package/build/server/chunks/chunks/Rect.html.js-Q3UvRwNn.js.map +1 -0
- package/build/server/chunks/chunks/Spline.js-BuZPz2PJ.js +516 -0
- package/build/server/chunks/chunks/Spline.js-BuZPz2PJ.js.map +1 -0
- package/build/server/chunks/chunks/Text.html.js-C8xO5Nz6.js +847 -0
- package/build/server/chunks/chunks/Text.html.js-C8xO5Nz6.js.map +1 -0
- package/build/server/chunks/chunks/TooltipItem.js-T0cKLjLu.js +314 -0
- package/build/server/chunks/chunks/TooltipItem.js-T0cKLjLu.js.map +1 -0
- package/build/server/chunks/chunks/Voronoi.js-DevTsXQE.js +2052 -0
- package/build/server/chunks/chunks/Voronoi.js-DevTsXQE.js.map +1 -0
- package/build/server/chunks/chunks/archive.js-C2D-5edp.js +823 -0
- package/build/server/chunks/chunks/archive.js-C2D-5edp.js.map +1 -0
- package/build/server/chunks/chunks/array.js-CBp0H4t3.js +8 -0
- package/build/server/chunks/chunks/array.js-CBp0H4t3.js.map +1 -0
- package/build/server/chunks/chunks/attributes.js-BVWo7wbg.js +25 -0
- package/build/server/chunks/chunks/attributes.js-BVWo7wbg.js.map +1 -0
- package/build/server/chunks/chunks/{env2.js-DXveJt1Y.js → aws.js-DkPqAybc.js} +2 -59
- package/build/server/chunks/chunks/aws.js-DkPqAybc.js.map +1 -0
- package/build/server/chunks/chunks/band.js-C7izXphE.js +155 -0
- package/build/server/chunks/chunks/band.js-C7izXphE.js.map +1 -0
- package/build/server/chunks/chunks/centroid.js-BnGN3LH0.js +1356 -0
- package/build/server/chunks/chunks/centroid.js-BnGN3LH0.js.map +1 -0
- package/build/server/chunks/chunks/common.js-BWQB8Die.js +5760 -0
- package/build/server/chunks/chunks/common.js-BWQB8Die.js.map +1 -0
- package/build/server/chunks/chunks/env2.js-CcIskxOZ.js +60 -0
- package/build/server/chunks/chunks/env2.js-CcIskxOZ.js.map +1 -0
- package/build/server/chunks/chunks/{exports.js-CvFPPbaH.js → exports.js-ClPPfcHj.js} +6 -1
- package/build/server/chunks/chunks/exports.js-ClPPfcHj.js.map +1 -0
- package/build/server/chunks/chunks/group.js-DBFzWAox.js +30 -0
- package/build/server/chunks/chunks/group.js-DBFzWAox.js.map +1 -0
- package/build/server/chunks/chunks/index-server.js-DNLOKvM0.js +248 -0
- package/build/server/chunks/chunks/index-server.js-DNLOKvM0.js.map +1 -0
- package/build/server/chunks/chunks/index-server2.js-l0sNRNKZ.js +2 -0
- package/build/server/chunks/chunks/index-server2.js-l0sNRNKZ.js.map +1 -0
- package/build/server/chunks/chunks/{internal2.js-DZ8ZzzjN.js → internal.js-DZ8ZzzjN.js} +1 -1
- package/build/server/chunks/chunks/internal.js-DZ8ZzzjN.js.map +1 -0
- package/build/server/chunks/chunks/internal2.js-BPo5dcDi.js +188 -0
- package/build/server/chunks/chunks/internal2.js-BPo5dcDi.js.map +1 -0
- package/build/server/chunks/chunks/key.svelte.js-CWIvXc6L.js +695 -0
- package/build/server/chunks/chunks/key.svelte.js-CWIvXc6L.js.map +1 -0
- package/build/server/chunks/chunks/{internal.js-Cc3oBhL-.js → legacy-client.js-DJmDw3Zx.js} +13 -439
- package/build/server/chunks/chunks/legacy-client.js-DJmDw3Zx.js.map +1 -0
- package/build/server/chunks/chunks/level-filter.js-B3o2hyWD.js +313 -0
- package/build/server/chunks/chunks/level-filter.js-B3o2hyWD.js.map +1 -0
- package/build/server/chunks/chunks/lineRadial.js-Dm0GMqo3.js +126 -0
- package/build/server/chunks/chunks/lineRadial.js-Dm0GMqo3.js.map +1 -0
- package/build/server/chunks/chunks/linear.js-CTOKrHn9.js +1046 -0
- package/build/server/chunks/chunks/linear.js-CTOKrHn9.js.map +1 -0
- package/build/server/chunks/chunks/log-buffer.js-BI_gQOls.js +587 -0
- package/build/server/chunks/chunks/log-buffer.js-BI_gQOls.js.map +1 -0
- package/build/server/chunks/chunks/math.js-BqujbaBs.js +50 -0
- package/build/server/chunks/chunks/math.js-BqujbaBs.js.map +1 -0
- package/build/server/chunks/chunks/max.js-CuS0BpRI.js +11 -0
- package/build/server/chunks/chunks/max.js-CuS0BpRI.js.map +1 -0
- package/build/server/chunks/chunks/min.js-DZWt5tPl.js +11 -0
- package/build/server/chunks/chunks/min.js-DZWt5tPl.js.map +1 -0
- package/build/server/chunks/chunks/motion.svelte.js-DCHSFMu-.js +677 -0
- package/build/server/chunks/chunks/motion.svelte.js-DCHSFMu-.js.map +1 -0
- package/build/server/chunks/chunks/occlusion.js-DJ-AdK9u.js +33 -0
- package/build/server/chunks/chunks/occlusion.js-DJ-AdK9u.js.map +1 -0
- package/build/server/chunks/chunks/path.js-BizMrlzb.js +488 -0
- package/build/server/chunks/chunks/path.js-BizMrlzb.js.map +1 -0
- package/build/server/chunks/chunks/path2.js-pquT2Kg6.js +27 -0
- package/build/server/chunks/chunks/path2.js-pquT2Kg6.js.map +1 -0
- package/build/server/chunks/chunks/pointRadial.js-Deeu1LXx.js +7 -0
- package/build/server/chunks/chunks/pointRadial.js-Deeu1LXx.js.map +1 -0
- package/build/server/chunks/chunks/rect.svelte.js-zeS7FWjB.js +187 -0
- package/build/server/chunks/chunks/rect.svelte.js-zeS7FWjB.js.map +1 -0
- package/build/server/chunks/chunks/scales.svelte.js-D_1popPi.js +276 -0
- package/build/server/chunks/chunks/scales.svelte.js-D_1popPi.js.map +1 -0
- package/build/server/chunks/chunks/series-buckets.js-BjigySff.js +290 -0
- package/build/server/chunks/chunks/series-buckets.js-BjigySff.js.map +1 -0
- package/build/server/chunks/chunks/{server.js-ByNB8uti.js → server.js-CAEBuMIH.js} +167 -2
- package/build/server/chunks/chunks/server.js-CAEBuMIH.js.map +1 -0
- package/build/server/chunks/chunks/source.js-DZEVvuho.js +21 -0
- package/build/server/chunks/chunks/source.js-DZEVvuho.js.map +1 -0
- package/build/server/chunks/chunks/{state.js-9DxsWxU-.js → state.js-DgkwfYFo.js} +5 -4
- package/build/server/chunks/chunks/state.js-DgkwfYFo.js.map +1 -0
- package/build/server/chunks/chunks/types.js-x3GyGPOz.js +11 -0
- package/build/server/chunks/chunks/types.js-x3GyGPOz.js.map +1 -0
- package/build/server/chunks/entries/endpoints/api/archive/_server.ts.js-83Ch7djd.js +39 -0
- package/build/server/chunks/entries/endpoints/api/archive/_server.ts.js-83Ch7djd.js.map +1 -0
- package/build/server/chunks/entries/endpoints/api/health/{_server.ts.js-BOjix7GN.js → _server.ts.js-VctnBhIJ.js} +5 -4
- package/build/server/chunks/entries/endpoints/api/health/_server.ts.js-VctnBhIJ.js.map +1 -0
- package/build/server/chunks/entries/endpoints/api/identity/{_server.ts.js-g13uvmrX.js → _server.ts.js-Dt540Sio.js} +4 -3
- package/build/server/chunks/entries/endpoints/api/identity/_server.ts.js-Dt540Sio.js.map +1 -0
- package/build/server/chunks/entries/endpoints/api/log-groups/{_server.ts.js-CmHRxdZK.js → _server.ts.js-drLgUdvB.js} +57 -8
- package/build/server/chunks/entries/endpoints/api/log-groups/_server.ts.js-drLgUdvB.js.map +1 -0
- package/build/server/chunks/entries/endpoints/api/regions/{_server.ts.js-BgUwioxp.js → _server.ts.js-CBqfN6Pg.js} +5 -4
- package/build/server/chunks/entries/endpoints/api/regions/_server.ts.js-CBqfN6Pg.js.map +1 -0
- package/build/server/chunks/entries/endpoints/api/series/_server.ts.js-DOvBhEDU.js +225 -0
- package/build/server/chunks/entries/endpoints/api/series/_server.ts.js-DOvBhEDU.js.map +1 -0
- package/build/server/chunks/entries/endpoints/api/stream/{_server.ts.js-CIYo4C-0.js → _server.ts.js-BWRHawY8.js} +324 -223
- package/build/server/chunks/entries/endpoints/api/stream/_server.ts.js-BWRHawY8.js.map +1 -0
- package/build/server/chunks/entries/fallbacks/{error.svelte.js-CFonuZkV.js → error.svelte.js-CsCL5PMW.js} +7 -5
- package/build/server/chunks/entries/fallbacks/{error.svelte.js-CFonuZkV.js.map → error.svelte.js-CsCL5PMW.js.map} +1 -1
- package/build/server/chunks/entries/pages/{_layout.svelte.js-Dzluuq12.js → _layout.svelte.js-CBQpEToy.js} +2 -2
- package/build/server/chunks/entries/pages/{_layout.svelte.js-Dzluuq12.js.map → _layout.svelte.js-CBQpEToy.js.map} +1 -1
- package/build/server/chunks/entries/pages/_page.svelte.js-qqtU0apo.js +1641 -0
- package/build/server/chunks/entries/pages/_page.svelte.js-qqtU0apo.js.map +1 -0
- package/build/server/chunks/{handler-DS32NMsJ.js → handler-DlfTB05m.js} +3 -3
- package/build/server/chunks/{handler-DS32NMsJ.js.map → handler-DlfTB05m.js.map} +1 -1
- package/build/server/chunks/{index.js-HHu-yOEK.js → index.js-BMrd9hfO.js} +6 -5
- package/build/server/chunks/index.js-BMrd9hfO.js.map +1 -0
- package/build/server/chunks/{manifest.js-BUrA7Zyr.js → manifest.js-D1kCuVe5.js} +24 -10
- package/build/server/chunks/manifest.js-D1kCuVe5.js.map +1 -0
- package/build/server/chunks/nodes/0.js-CNFDDPj5.js +9 -0
- package/build/server/chunks/nodes/{0.js-gSRmrAt_.js.map → 0.js-CNFDDPj5.js.map} +1 -1
- package/build/server/chunks/nodes/1.js-B5FPLYnf.js +9 -0
- package/build/server/chunks/nodes/{1.js-D68K7Ad_.js.map → 1.js-B5FPLYnf.js.map} +1 -1
- package/build/server/chunks/nodes/2.js-BEuxzw6b.js +9 -0
- package/build/server/chunks/nodes/2.js-BEuxzw6b.js.map +1 -0
- package/dist/cli/completions.js +6 -0
- package/dist/cli/index.js +131 -88
- package/dist/cli/options.js +28 -2
- package/dist/cli/preflight.js +30 -0
- package/dist/cli/ui.js +18 -3
- package/dist/lib/cli/aws.js +12 -4
- package/dist/lib/log-buffer.js +443 -0
- package/dist/lib/log-format.js +185 -0
- package/dist/lib/types.js +0 -4
- package/package.json +6 -2
- package/build/client/_app/immutable/assets/0.BPmQoXaO.css +0 -2
- package/build/client/_app/immutable/assets/0.BPmQoXaO.css.br +0 -0
- package/build/client/_app/immutable/assets/0.BPmQoXaO.css.gz +0 -0
- package/build/client/_app/immutable/chunks/Bw_9uNRP.js.br +0 -0
- package/build/client/_app/immutable/chunks/Bw_9uNRP.js.gz +0 -0
- package/build/client/_app/immutable/chunks/De_x7GQi.js +0 -1
- package/build/client/_app/immutable/chunks/De_x7GQi.js.br +0 -0
- package/build/client/_app/immutable/chunks/De_x7GQi.js.gz +0 -0
- package/build/client/_app/immutable/chunks/ZAD2y5xJ.js +0 -3
- package/build/client/_app/immutable/chunks/ZAD2y5xJ.js.br +0 -0
- package/build/client/_app/immutable/chunks/ZAD2y5xJ.js.gz +0 -0
- package/build/client/_app/immutable/entry/app.Be166AxG.js +0 -2
- package/build/client/_app/immutable/entry/app.Be166AxG.js.br +0 -0
- package/build/client/_app/immutable/entry/app.Be166AxG.js.gz +0 -0
- package/build/client/_app/immutable/entry/start.clEDpQL9.js +0 -1
- package/build/client/_app/immutable/entry/start.clEDpQL9.js.br +0 -0
- package/build/client/_app/immutable/entry/start.clEDpQL9.js.gz +0 -0
- package/build/client/_app/immutable/nodes/0.BJ6Zdc8H.js +0 -1
- package/build/client/_app/immutable/nodes/0.BJ6Zdc8H.js.br +0 -4
- package/build/client/_app/immutable/nodes/0.BJ6Zdc8H.js.gz +0 -0
- package/build/client/_app/immutable/nodes/1.xMNWuLLz.js +0 -1
- package/build/client/_app/immutable/nodes/1.xMNWuLLz.js.br +0 -0
- package/build/client/_app/immutable/nodes/1.xMNWuLLz.js.gz +0 -0
- package/build/client/_app/immutable/nodes/2.CaxDXwmh.js +0 -5
- package/build/client/_app/immutable/nodes/2.CaxDXwmh.js.br +0 -0
- package/build/client/_app/immutable/nodes/2.CaxDXwmh.js.gz +0 -0
- package/build/server/chunks/chunks/env2.js-DXveJt1Y.js.map +0 -1
- package/build/server/chunks/chunks/exports.js-CvFPPbaH.js.map +0 -1
- package/build/server/chunks/chunks/internal.js-Cc3oBhL-.js.map +0 -1
- package/build/server/chunks/chunks/internal2.js-DZ8ZzzjN.js.map +0 -1
- package/build/server/chunks/chunks/server.js-ByNB8uti.js.map +0 -1
- package/build/server/chunks/chunks/state.js-9DxsWxU-.js.map +0 -1
- package/build/server/chunks/entries/endpoints/api/health/_server.ts.js-BOjix7GN.js.map +0 -1
- package/build/server/chunks/entries/endpoints/api/identity/_server.ts.js-g13uvmrX.js.map +0 -1
- package/build/server/chunks/entries/endpoints/api/log-groups/_server.ts.js-CmHRxdZK.js.map +0 -1
- package/build/server/chunks/entries/endpoints/api/regions/_server.ts.js-BgUwioxp.js.map +0 -1
- package/build/server/chunks/entries/endpoints/api/stream/_server.ts.js-CIYo4C-0.js.map +0 -1
- package/build/server/chunks/entries/pages/_page.svelte.js-CpwYbxbM.js +0 -1291
- package/build/server/chunks/entries/pages/_page.svelte.js-CpwYbxbM.js.map +0 -1
- package/build/server/chunks/index.js-HHu-yOEK.js.map +0 -1
- package/build/server/chunks/manifest.js-BUrA7Zyr.js.map +0 -1
- package/build/server/chunks/nodes/0.js-gSRmrAt_.js +0 -9
- package/build/server/chunks/nodes/1.js-D68K7Ad_.js +0 -9
- package/build/server/chunks/nodes/2.js-ChYsaaoC.js +0 -9
- package/build/server/chunks/nodes/2.js-ChYsaaoC.js.map +0 -1
|
@@ -0,0 +1,1641 @@
|
|
|
1
|
+
import { ah as escape_html, ag as attr, ai as attr_style, ac as derived, aj as attr_class, ak as ensure_array_like, al as stringify, am as bind_props, an as clsx } from '../../chunks/server.js-CAEBuMIH.js';
|
|
2
|
+
import { c as LogStore, f as filterByLevel, g as filterEvents, e as effectiveLevel, t as tokenizeJson, b as detectLevel, h as formatLogMessage, j as eventKey, l as levelColorClass } from '../../chunks/log-buffer.js-BI_gQOls.js';
|
|
3
|
+
import { R as REGION_CODES } from '../../chunks/regions.js-IQPMyP5C.js';
|
|
4
|
+
import { P as PRESET_LABELS, a as presetLabel, H as HISTORIC_PRESETS, t as toDateTimeLocal, d as describeWindow } from '../../chunks/time-range.js-BLMT8aU3.js';
|
|
5
|
+
import { p as page, r as replaceState } from '../../chunks/state.js-DgkwfYFo.js';
|
|
6
|
+
import { S as SERIES_LEVEL_COLOR, g as groupByLevel, r as requestRows, L as LEVEL_LABELS, i as isMeaningfulBrush, b as bucketEvents } from '../../chunks/series-buckets.js-BjigySff.js';
|
|
7
|
+
import '../../chunks/uneval.js-DaakSYFQ.js';
|
|
8
|
+
import '../../chunks/index-server.js-DNLOKvM0.js';
|
|
9
|
+
import '../../chunks/shared.js-CgjUIvRK.js';
|
|
10
|
+
import '../../chunks/exports.js-ClPPfcHj.js';
|
|
11
|
+
import '../../chunks/internal2.js-BPo5dcDi.js';
|
|
12
|
+
import '../../chunks/legacy-client.js-DJmDw3Zx.js';
|
|
13
|
+
import '../../chunks/utils.js-BIlHjgGW.js';
|
|
14
|
+
|
|
15
|
+
//#region src/lib/format.ts
|
|
16
|
+
/**
|
|
17
|
+
* Formatting helpers for the watch-stream UI. Every function here is pure so it can be unit
|
|
18
|
+
* tested without a DOM.
|
|
19
|
+
*/
|
|
20
|
+
/** Placeholder shown when a timestamp is missing or not a number. */
|
|
21
|
+
var EMPTY_TIME = "--:--:--.---";
|
|
22
|
+
/** Left-pads a non-negative integer with zeros. */
|
|
23
|
+
function pad(value, size = 2) {
|
|
24
|
+
return String(Math.trunc(Math.abs(value))).padStart(size, "0");
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Formats an epoch-millisecond timestamp as `HH:MM:SS.mmm` in UTC.
|
|
28
|
+
* UTC keeps rendering stable no matter where the browser runs.
|
|
29
|
+
*/
|
|
30
|
+
function formatTime(timestamp) {
|
|
31
|
+
if (typeof timestamp !== "number" || !Number.isFinite(timestamp)) return EMPTY_TIME;
|
|
32
|
+
const date = new Date(timestamp);
|
|
33
|
+
if (Number.isNaN(date.getTime())) return EMPTY_TIME;
|
|
34
|
+
return `${`${pad(date.getUTCHours())}:${pad(date.getUTCMinutes())}:${pad(date.getUTCSeconds())}`}.${pad(date.getUTCMilliseconds(), 3)}`;
|
|
35
|
+
}
|
|
36
|
+
/** Formats an epoch-millisecond timestamp as an ISO 8601 string, for tooltips. */
|
|
37
|
+
function formatTimestamp(timestamp) {
|
|
38
|
+
if (typeof timestamp !== "number" || !Number.isFinite(timestamp)) return "—";
|
|
39
|
+
const date = new Date(timestamp);
|
|
40
|
+
if (Number.isNaN(date.getTime())) return "—";
|
|
41
|
+
return date.toISOString();
|
|
42
|
+
}
|
|
43
|
+
/** Formats a number with at most one decimal, dropping a trailing `.0`. */
|
|
44
|
+
function trimZero(value) {
|
|
45
|
+
const fixed = value >= 100 ? value.toFixed(0) : value.toFixed(1);
|
|
46
|
+
return fixed.endsWith(".0") ? fixed.slice(0, -2) : fixed;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Formats a duration as `250ms`, `1.2s`, `2m 5s` or `1h 2m`, for a request's span.
|
|
50
|
+
* Sub-second spans keep a millisecond value, because that is what a slow request
|
|
51
|
+
* is measured in; longer spans stop at the first two units a reader needs.
|
|
52
|
+
*/
|
|
53
|
+
function formatSpan(ms) {
|
|
54
|
+
if (typeof ms !== "number" || !Number.isFinite(ms) || ms < 0) return "—";
|
|
55
|
+
const total = Math.round(ms);
|
|
56
|
+
if (total < 1e3) return `${total}ms`;
|
|
57
|
+
const seconds = total / 1e3;
|
|
58
|
+
if (seconds < 60) return `${trimZero(seconds)}s`;
|
|
59
|
+
const wholeSeconds = Math.floor(seconds);
|
|
60
|
+
const minutes = Math.floor(wholeSeconds / 60);
|
|
61
|
+
const restSeconds = wholeSeconds % 60;
|
|
62
|
+
if (minutes < 60) return restSeconds === 0 ? `${minutes}m` : `${minutes}m ${restSeconds}s`;
|
|
63
|
+
const hours = Math.floor(minutes / 60);
|
|
64
|
+
const restMinutes = minutes % 60;
|
|
65
|
+
return restMinutes === 0 ? `${hours}h` : `${hours}h ${restMinutes}m`;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Formats a byte count as `B`, `KiB`, `MiB` or `GiB`, with at most one decimal for scaled units.
|
|
69
|
+
* Returns {@link EMPTY_VALUE} for a missing or negative value.
|
|
70
|
+
*/
|
|
71
|
+
function formatBytes(bytes) {
|
|
72
|
+
if (typeof bytes !== "number" || !Number.isFinite(bytes) || bytes < 0) return "—";
|
|
73
|
+
if (bytes < 1024) return `${Math.trunc(bytes)} B`;
|
|
74
|
+
const units = [
|
|
75
|
+
"KiB",
|
|
76
|
+
"MiB",
|
|
77
|
+
"GiB",
|
|
78
|
+
"TiB"
|
|
79
|
+
];
|
|
80
|
+
let value = bytes / 1024;
|
|
81
|
+
let unit = units[0];
|
|
82
|
+
for (let index = 1; index < units.length && value >= 1024; index += 1) {
|
|
83
|
+
value /= 1024;
|
|
84
|
+
unit = units[index];
|
|
85
|
+
}
|
|
86
|
+
return `${trimZero(value)} ${unit}`;
|
|
87
|
+
}
|
|
88
|
+
/** Formats an integer count with thousands separators, for example `1,234`. */
|
|
89
|
+
function formatCount(value) {
|
|
90
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return "0";
|
|
91
|
+
const rounded = Math.trunc(value);
|
|
92
|
+
return (rounded < 0 ? "-" : "") + String(Math.abs(rounded)).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Names the emulator behind a CloudWatch Logs endpoint override.
|
|
96
|
+
* Returns `null` when the endpoint is empty, which means real AWS.
|
|
97
|
+
*/
|
|
98
|
+
function emulatorLabel(endpoint) {
|
|
99
|
+
const trimmed = typeof endpoint === "string" ? endpoint.trim() : "";
|
|
100
|
+
if (trimmed === "") return null;
|
|
101
|
+
const lower = trimmed.toLowerCase();
|
|
102
|
+
if (lower.includes("floci")) return "floci";
|
|
103
|
+
if (lower.includes("localstack")) return "localstack";
|
|
104
|
+
if (endpointPort(trimmed) === "4566") return "floci";
|
|
105
|
+
return "local emulator";
|
|
106
|
+
}
|
|
107
|
+
/** Reads the port of an endpoint URL, or `null` when it cannot be parsed. */
|
|
108
|
+
function endpointPort(endpoint) {
|
|
109
|
+
return parseEndpoint(endpoint)?.port || null;
|
|
110
|
+
}
|
|
111
|
+
/** Parses an endpoint URL, returning `null` when it is not a URL. */
|
|
112
|
+
function parseEndpoint(endpoint) {
|
|
113
|
+
try {
|
|
114
|
+
return new URL(endpoint);
|
|
115
|
+
} catch {
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Builds the header badge text for an endpoint, for example `floci http://localhost:4566`.
|
|
121
|
+
* Returns `null` when the app talks to real AWS.
|
|
122
|
+
*/
|
|
123
|
+
function describeEndpoint(endpoint) {
|
|
124
|
+
const trimmed = typeof endpoint === "string" ? endpoint.trim() : "";
|
|
125
|
+
if (trimmed === "") return null;
|
|
126
|
+
const label = emulatorLabel(trimmed);
|
|
127
|
+
if (label === null) return null;
|
|
128
|
+
return (parseEndpoint(trimmed)?.hostname.toLowerCase() ?? trimmed.toLowerCase()).startsWith(label) ? trimmed : `${label} ${trimmed}`;
|
|
129
|
+
}
|
|
130
|
+
//#endregion
|
|
131
|
+
//#region src/lib/components/EndpointBadge.svelte
|
|
132
|
+
function EndpointBadge($$renderer, $$props) {
|
|
133
|
+
$$renderer.component(($$renderer) => {
|
|
134
|
+
/** Resolved CloudWatch Logs endpoint, or `null` when talking to real AWS. */
|
|
135
|
+
/** Credential mode from `GET /api/health`, or `null` when it is unknown. */
|
|
136
|
+
let { endpoint = null, credentials = null } = $$props;
|
|
137
|
+
/** Badge text, for example `floci http://localhost:4566`; `null` hides the badge. */
|
|
138
|
+
let label = derived(() => describeEndpoint(endpoint));
|
|
139
|
+
/** True when the server fell back to the emulator's throwaway credentials. */
|
|
140
|
+
let emulatorDefault = derived(() => credentials === "emulator-default");
|
|
141
|
+
let hint = derived(() => emulatorDefault() ? "Local emulator endpoint - using floci's throwaway credentials (no ambient AWS credentials found)" : "Local emulator endpoint");
|
|
142
|
+
if (label() !== null) {
|
|
143
|
+
$$renderer.push(`<!--[0--><span class="inline-flex items-center gap-1.5"${attr("title", hint())}><span data-testid="endpoint-badge"${attr("title", hint())} class="rounded-full border border-violet-900 bg-violet-950/60 px-2.5 py-1 text-xs font-medium text-violet-300">${escape_html(label())}</span> `);
|
|
144
|
+
if (emulatorDefault()) $$renderer.push(`<!--[0--><span data-testid="credentials-hint" class="text-[0.6875rem] text-neutral-500">dev creds</span>`);
|
|
145
|
+
else $$renderer.push("<!--[-1-->");
|
|
146
|
+
$$renderer.push(`<!--]--></span>`);
|
|
147
|
+
} else $$renderer.push("<!--[-1-->");
|
|
148
|
+
$$renderer.push(`<!--]-->`);
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
//#endregion
|
|
152
|
+
//#region src/lib/resize.ts
|
|
153
|
+
/**
|
|
154
|
+
* Pure helpers for the drag-resizable columns in the UI.
|
|
155
|
+
*
|
|
156
|
+
* The components own the pointer events and the persistence; everything that can
|
|
157
|
+
* be reasoned about without a DOM lives here so it can be unit tested.
|
|
158
|
+
*/
|
|
159
|
+
/** `localStorage` keys, prefixed so they are easy to spot in a browser. */
|
|
160
|
+
var STORAGE_KEYS = {
|
|
161
|
+
sidebarWidth: "watch-stream:sidebar-width",
|
|
162
|
+
prefixWidth: "watch-stream:prefix-width",
|
|
163
|
+
wrap: "watch-stream:wrap",
|
|
164
|
+
jsonView: "watch-stream:json-view",
|
|
165
|
+
chartOpen: "watch-stream:chart-open",
|
|
166
|
+
groupRequests: "watch-stream:group-requests"
|
|
167
|
+
};
|
|
168
|
+
/** Default width of the group-list pane, in rem (matches the original layout). */
|
|
169
|
+
var SIDEBAR_WIDTH = {
|
|
170
|
+
defaultRem: 22,
|
|
171
|
+
minRem: 16,
|
|
172
|
+
maxVw: 44
|
|
173
|
+
};
|
|
174
|
+
/** Width constraints for the log line prefix (timestamp + stream name). */
|
|
175
|
+
var PREFIX_WIDTH = {
|
|
176
|
+
defaultRem: 14,
|
|
177
|
+
minRem: 4,
|
|
178
|
+
maxRem: 40
|
|
179
|
+
};
|
|
180
|
+
/** Converts a CSS pixel width to `rem` for use in a Tailwind `style` attribute. */
|
|
181
|
+
function pxToRem(px, rootFontSize = 16) {
|
|
182
|
+
const rem = px / rootFontSize;
|
|
183
|
+
return `${Number.isInteger(rem) ? rem : Number(rem.toFixed(3))}rem`;
|
|
184
|
+
}
|
|
185
|
+
/** Parses a `rem` value into CSS pixels. */
|
|
186
|
+
function remToPx(rem, rootFontSize = 16) {
|
|
187
|
+
return rem * rootFontSize;
|
|
188
|
+
}
|
|
189
|
+
//#endregion
|
|
190
|
+
//#region src/lib/components/EventScatterPanel.svelte
|
|
191
|
+
function EventScatterPanel($$renderer, $$props) {
|
|
192
|
+
$$renderer.component(($$renderer) => {
|
|
193
|
+
/**
|
|
194
|
+
* The chart panel above the log view: a header that is always cheap to render
|
|
195
|
+
* (title, totals, per-level legend) and the chart below it, loaded on demand.
|
|
196
|
+
*
|
|
197
|
+
* The charting library is imported dynamically and only once the panel is open,
|
|
198
|
+
* so layerchart never delays the first paint of the log view. The header stays
|
|
199
|
+
* available while the chart chunk is still loading, and the whole panel
|
|
200
|
+
* collapses to that header so a user who does not want the chart can reclaim
|
|
201
|
+
* the space - the choice is remembered.
|
|
202
|
+
*/
|
|
203
|
+
/** Props the lazily loaded chart takes. */
|
|
204
|
+
/** The chart component, as its module exports it. */
|
|
205
|
+
/** Fetches the chart module; injectable so tests need no chunk fetch. */
|
|
206
|
+
/**
|
|
207
|
+
* The real loader: a dynamic import, which is what keeps layerchart out of the
|
|
208
|
+
* initial bundle. It only runs in the browser, and only once the panel is open.
|
|
209
|
+
*/
|
|
210
|
+
const loadChartModule = () => import('../../chunks/EventScatter.js-D3Jaw_Cw.js');
|
|
211
|
+
/** Bucketed counts for the window. */
|
|
212
|
+
/** Inclusive start of the window, epoch ms. */
|
|
213
|
+
/** Inclusive end of the window, epoch ms. */
|
|
214
|
+
/** Bucket width in ms, shown in the summary. */
|
|
215
|
+
/** Log groups the points cover, for the summary. */
|
|
216
|
+
/** True when one mark stands for one request rather than one line. */
|
|
217
|
+
/** True while the counts are being fetched. */
|
|
218
|
+
/** Called with the brushed range when the drag ends, or `null` on clear. */
|
|
219
|
+
/** Chart height in px. */
|
|
220
|
+
/** Start open, which is also what the first visit uses. */
|
|
221
|
+
/** Chart module loader; defaults to the dynamic import. */
|
|
222
|
+
let { points = [], from = 0, to = 0, bucketMs = 0, groups = [], loading = false, byRequest = true, onBrush, height = 200, open = true, loadChart = loadChartModule } = $$props;
|
|
223
|
+
let expanded = derived(() => open);
|
|
224
|
+
/** Totals and labels per level, in severity order. */
|
|
225
|
+
let levelGroups = derived(() => groupByLevel(points));
|
|
226
|
+
/** Total events drawn. */
|
|
227
|
+
let totalEvents = derived(() => levelGroups().reduce((sum, entry) => sum + entry.events, 0));
|
|
228
|
+
/** Buckets drawn. */
|
|
229
|
+
let bucketCount = derived(() => new Set(points.map((point) => point.t)).size);
|
|
230
|
+
/** True when there is something to draw. */
|
|
231
|
+
let hasPoints = derived(() => points.length > 0);
|
|
232
|
+
/** What one mark stands for, which is what the totals count. */
|
|
233
|
+
let unit = derived(() => byRequest ? "requests" : "events");
|
|
234
|
+
/** Clears the brush, for the host's Reset zoom control. */
|
|
235
|
+
function reset() {
|
|
236
|
+
onBrush?.(null);
|
|
237
|
+
}
|
|
238
|
+
$$renderer.push(`<section class="flex min-w-0 flex-col gap-1 rounded-lg border border-neutral-800 bg-neutral-950/60 p-2" data-testid="event-scatter" aria-label="Events over time"><div class="flex flex-wrap items-center gap-x-3 gap-y-1 px-1 text-[0.6875rem]"><button type="button"${attr("aria-expanded", expanded())}${attr("title", expanded() ? "Hide the chart" : "Show the chart")} data-testid="scatter-toggle" class="flex items-center gap-1 rounded-md border border-neutral-800 bg-neutral-900 px-2 py-0.5 font-semibold uppercase tracking-wider text-neutral-400 transition-colors hover:border-neutral-700 hover:text-neutral-200"><span aria-hidden="true">${escape_html(expanded() ? "▾" : "▸")}</span> Events over time</button> <span class="text-neutral-400" data-testid="scatter-summary">${escape_html(formatCount(totalEvents()))}
|
|
239
|
+
${escape_html(unit())} in ${escape_html(formatCount(bucketCount()))} buckets</span> `);
|
|
240
|
+
if (groups.length > 1) $$renderer.push(`<!--[0--><span class="text-neutral-500" data-testid="scatter-groups">across ${escape_html(groups.length)} groups</span>`);
|
|
241
|
+
else $$renderer.push("<!--[-1-->");
|
|
242
|
+
$$renderer.push(`<!--]--> <!--[-->`);
|
|
243
|
+
const each_array = ensure_array_like(levelGroups());
|
|
244
|
+
for (let $$index = 0, $$length = each_array.length; $$index < $$length; $$index++) {
|
|
245
|
+
let entry = each_array[$$index];
|
|
246
|
+
$$renderer.push(`<span class="flex items-center gap-1 text-neutral-400"${attr("data-testid", `scatter-legend-${stringify(entry.level)}`)}><span class="inline-block h-2 w-2 rounded-full"${attr_style(`background-color: ${stringify(SERIES_LEVEL_COLOR[entry.level])}`)}></span> ${escape_html(entry.label)} <span class="text-neutral-500">${escape_html(formatCount(entry.events))}</span></span>`);
|
|
247
|
+
}
|
|
248
|
+
$$renderer.push(`<!--]--> `);
|
|
249
|
+
if (loading && expanded()) $$renderer.push(`<!--[0--><span class="text-amber-300" data-testid="scatter-loading">counting…</span>`);
|
|
250
|
+
else $$renderer.push("<!--[-1-->");
|
|
251
|
+
$$renderer.push(`<!--]--> `);
|
|
252
|
+
if (expanded()) {
|
|
253
|
+
$$renderer.push("<!--[0-->");
|
|
254
|
+
$$renderer.push(`<!--[-1--><span class="ml-auto text-neutral-500" data-testid="scatter-hint">drag to zoom · click to clear</span>`);
|
|
255
|
+
$$renderer.push(`<!--]-->`);
|
|
256
|
+
} else $$renderer.push("<!--[-1-->");
|
|
257
|
+
$$renderer.push(`<!--]--></div> `);
|
|
258
|
+
if (expanded()) {
|
|
259
|
+
$$renderer.push("<!--[0-->");
|
|
260
|
+
if (hasPoints()) {
|
|
261
|
+
$$renderer.push("<!--[1-->");
|
|
262
|
+
$$renderer.push(`<!--[-1--><div class="w-full animate-pulse rounded bg-neutral-900/60"${attr_style(`height: ${stringify(height)}px`)}></div>`);
|
|
263
|
+
$$renderer.push(`<!--]-->`);
|
|
264
|
+
} else if (!loading) $$renderer.push(`<!--[2--><p class="px-1 py-6 text-xs text-neutral-500" data-testid="scatter-empty">No events in this window yet.</p>`);
|
|
265
|
+
else $$renderer.push("<!--[-1-->");
|
|
266
|
+
$$renderer.push(`<!--]-->`);
|
|
267
|
+
} else $$renderer.push("<!--[-1-->");
|
|
268
|
+
$$renderer.push(`<!--]--></section>`);
|
|
269
|
+
bind_props($$props, { reset });
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
//#endregion
|
|
273
|
+
//#region src/lib/components/ColumnResizer.svelte
|
|
274
|
+
function ColumnResizer($$renderer, $$props) {
|
|
275
|
+
$$renderer.component(($$renderer) => {
|
|
276
|
+
/** Accessible name, for example "Resize group list". */
|
|
277
|
+
/** Current width in CSS pixels. */
|
|
278
|
+
/** Lower bound in CSS pixels. */
|
|
279
|
+
/** Upper bound in CSS pixels. */
|
|
280
|
+
/** `data-testid` value. */
|
|
281
|
+
/** Called on every pointer move and arrow key with the clamped width. */
|
|
282
|
+
/** Called when a drag ends or an arrow key is handled, for persistence. */
|
|
283
|
+
/** Extra classes, used for positioning. */
|
|
284
|
+
/** Extra inline style, for example `left: 120px`. */
|
|
285
|
+
let { label, width, min, max, testId, onChange, onCommit, class: className = "", style = "" } = $$props;
|
|
286
|
+
$$renderer.push(`<div role="separator" aria-orientation="vertical"${attr("aria-label", label)}${attr("aria-valuemin", min)}${attr("aria-valuemax", max)}${attr("aria-valuenow", Math.round(width))} tabindex="0"${attr("title", `${stringify(label)} (drag or use the arrow keys)`)}${attr("data-testid", testId)}${attr_class(`cursor-col-resize touch-none bg-transparent hover:bg-sky-500/30 focus:bg-sky-500/50 focus:outline-none ${stringify(className)}`)}${attr_style(style)}></div>`);
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
//#endregion
|
|
290
|
+
//#region src/lib/components/RangeControls.svelte
|
|
291
|
+
function RangeControls($$renderer, $$props) {
|
|
292
|
+
$$renderer.component(($$renderer) => {
|
|
293
|
+
/** Preset name when a preset is active, otherwise an empty string. */
|
|
294
|
+
/** Custom bounds as epoch ms, or `null` when a preset/live window is active. */
|
|
295
|
+
/** Active mode, owned by the page. */
|
|
296
|
+
/** Active preset, owned by the page. */
|
|
297
|
+
/** Active custom bounds as epoch ms, owned by the page. */
|
|
298
|
+
/** True when no group is selected, so there is nothing to scope. */
|
|
299
|
+
/** True while a historic window is being fetched. */
|
|
300
|
+
/** True when the source cannot follow live events, such as the local archive. */
|
|
301
|
+
/** Called when the user switches mode or applies a range. */
|
|
302
|
+
let { mode = "live", range = "15m", from = null, to = null, disabled = false, loading = false, liveDisabled = false} = $$props;
|
|
303
|
+
/** Label shown on the custom chip. */
|
|
304
|
+
let customLabel = derived(() => mode === "historic" && range === "" && from !== null && to !== null ? `${toDateTimeLocal(from).replace("T", " ")} → ${toDateTimeLocal(to).replace("T", " ")}` : "Custom…");
|
|
305
|
+
$$renderer.push(`<div class="flex flex-wrap items-center gap-2" data-testid="range-controls"><div class="flex items-center gap-1 rounded-lg border border-neutral-800 bg-neutral-900 p-0.5" role="group" aria-label="Tail mode"><button type="button"${attr("aria-pressed", mode === "live")}${attr("disabled", liveDisabled, true)}${attr("title", liveDisabled ? "There is nothing to tail: the local archive holds historic windows" : void 0)} data-testid="mode-live"${attr_class(`rounded-md border px-2 py-1 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50 ${mode === "live" ? "border-sky-700 bg-sky-950/60 text-sky-300" : "border-transparent text-neutral-400 hover:text-neutral-200"} disabled:opacity-40`)}>Live</button> <button type="button"${attr("aria-pressed", mode === "historic")} data-testid="mode-historic"${attr_class(`rounded-md border px-2 py-1 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50 ${mode === "historic" ? "border-amber-700 bg-amber-950/50 text-amber-300" : "border-transparent text-neutral-400 hover:text-neutral-200"}`)}>Historic</button></div> `);
|
|
306
|
+
if (mode === "historic") {
|
|
307
|
+
$$renderer.push(`<!--[0--><div class="flex flex-wrap items-center gap-1" role="group" aria-label="Historic range"><!--[-->`);
|
|
308
|
+
const each_array = ensure_array_like(HISTORIC_PRESETS);
|
|
309
|
+
for (let $$index = 0, $$length = each_array.length; $$index < $$length; $$index++) {
|
|
310
|
+
let preset = each_array[$$index];
|
|
311
|
+
$$renderer.push(`<button type="button"${attr("aria-pressed", range === preset)}${attr("data-testid", `preset-${stringify(preset)}`)}${attr("disabled", disabled, true)}${attr_class(`rounded-md border px-2 py-1 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50 ${range === preset ? "border-amber-700 bg-amber-950/50 text-amber-200" : "border-neutral-800 bg-neutral-900 text-neutral-300 hover:border-neutral-700"} disabled:opacity-40`)}>${escape_html(PRESET_LABELS[preset])}</button>`);
|
|
312
|
+
}
|
|
313
|
+
$$renderer.push(`<!--]--> <button type="button"${attr("aria-pressed", range === "")} data-testid="preset-custom"${attr("disabled", disabled, true)}${attr_class(`rounded-md border px-2 py-1 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50 ${range === "" ? "border-amber-700 bg-amber-950/50 text-amber-200" : "border-neutral-800 bg-neutral-900 text-neutral-300 hover:border-neutral-700"}`)}>${escape_html(customLabel())}</button></div>`);
|
|
314
|
+
} else $$renderer.push("<!--[-1-->");
|
|
315
|
+
$$renderer.push(`<!--]--> `);
|
|
316
|
+
if (loading) $$renderer.push(`<!--[0--><span class="text-xs text-amber-300" data-testid="range-loading">loading window…</span>`);
|
|
317
|
+
else if (mode === "historic" && range !== "") $$renderer.push(`<!--[1--><span class="text-xs text-neutral-500">last ${escape_html(presetLabel(range))}</span>`);
|
|
318
|
+
else $$renderer.push("<!--[-1-->");
|
|
319
|
+
$$renderer.push(`<!--]--> `);
|
|
320
|
+
$$renderer.push("<!--[-1-->");
|
|
321
|
+
$$renderer.push(`<!--]--></div>`);
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
//#endregion
|
|
325
|
+
//#region src/lib/groups-client.ts
|
|
326
|
+
/**
|
|
327
|
+
* Browser-side fetch helpers for the watch-stream JSON API (`/api/health`, `/api/regions`,
|
|
328
|
+
* `/api/log-groups`, `/api/archive`). Every helper throws {@link ApiError} on a non-2xx response so
|
|
329
|
+
* the UI can show the API `error` message instead of an opaque failure.
|
|
330
|
+
*/
|
|
331
|
+
/** Region list used by the picker before (or instead of) `/api/regions`. */
|
|
332
|
+
var DEFAULT_REGIONS = REGION_CODES;
|
|
333
|
+
/** Error carrying the parsed `ApiErrorBody` returned by the API. */
|
|
334
|
+
var ApiError = class extends Error {
|
|
335
|
+
/** HTTP status, or `0` when the request never reached the server. */
|
|
336
|
+
status;
|
|
337
|
+
/** Optional machine-readable code from the API. */
|
|
338
|
+
code;
|
|
339
|
+
/** Optional extra detail from the API. */
|
|
340
|
+
details;
|
|
341
|
+
constructor(message, options = {}) {
|
|
342
|
+
super(message, { cause: options.cause });
|
|
343
|
+
this.name = "ApiError";
|
|
344
|
+
this.status = options.status ?? 0;
|
|
345
|
+
this.code = options.code;
|
|
346
|
+
this.details = options.details;
|
|
347
|
+
}
|
|
348
|
+
};
|
|
349
|
+
/** Reads a string field from an unknown JSON value. */
|
|
350
|
+
function readField(value, key) {
|
|
351
|
+
if (typeof value !== "object" || value === null) return void 0;
|
|
352
|
+
const field = value[key];
|
|
353
|
+
return typeof field === "string" ? field : void 0;
|
|
354
|
+
}
|
|
355
|
+
/** Extracts the API `error` message, falling back when the body has none. */
|
|
356
|
+
function apiErrorMessage(value, fallback = "Unexpected API error") {
|
|
357
|
+
return readField(value, "error") ?? fallback;
|
|
358
|
+
}
|
|
359
|
+
/** Builds the `/api/log-groups` URL, including only the parameters that are set. */
|
|
360
|
+
function buildLogGroupsUrl(query) {
|
|
361
|
+
const search = new URLSearchParams();
|
|
362
|
+
if (query.region) search.set("region", query.region);
|
|
363
|
+
if (query.source) search.set("source", query.source);
|
|
364
|
+
if (query.prefix) search.set("prefix", query.prefix);
|
|
365
|
+
if (typeof query.limit === "number" && Number.isFinite(query.limit)) search.set("limit", String(query.limit));
|
|
366
|
+
const suffix = search.toString();
|
|
367
|
+
return suffix === "" ? "/api/log-groups" : `/api/log-groups?${suffix}`;
|
|
368
|
+
}
|
|
369
|
+
/** Builds the `/api/series` URL for a query. */
|
|
370
|
+
function buildSeriesUrl(query) {
|
|
371
|
+
const search = new URLSearchParams();
|
|
372
|
+
if (query.region) search.set("region", query.region);
|
|
373
|
+
search.set("source", "archive");
|
|
374
|
+
const groups = (query.groups ?? []).filter((name) => name.length > 0);
|
|
375
|
+
if (groups.length > 0) search.set("groups", groups.join(","));
|
|
376
|
+
if (typeof query.from === "number" && Number.isFinite(query.from)) search.set("from", String(Math.round(query.from)));
|
|
377
|
+
if (typeof query.to === "number" && Number.isFinite(query.to)) search.set("to", String(Math.round(query.to)));
|
|
378
|
+
const levels = (query.levels ?? []).filter((level) => level.length > 0);
|
|
379
|
+
if (levels.length > 0) search.set("level", levels.join(","));
|
|
380
|
+
if (query.by === "request" || query.by === "event") search.set("by", query.by);
|
|
381
|
+
if (typeof query.bucketMs === "number" && Number.isFinite(query.bucketMs) && query.bucketMs > 0) search.set("bucket", String(Math.round(query.bucketMs)));
|
|
382
|
+
return `/api/series?${search.toString()}`;
|
|
383
|
+
}
|
|
384
|
+
/** `GET /api/series` - bucketed event counts for the chart. */
|
|
385
|
+
function fetchSeries(query) {
|
|
386
|
+
return getJson(buildSeriesUrl(query), query);
|
|
387
|
+
}
|
|
388
|
+
/** True for an abort, which is a normal way to cancel a request. */
|
|
389
|
+
function isAbort(error) {
|
|
390
|
+
return error instanceof Error && error.name === "AbortError";
|
|
391
|
+
}
|
|
392
|
+
/** Performs a JSON request and maps failures onto {@link ApiError}. */
|
|
393
|
+
async function getJson(url, options) {
|
|
394
|
+
const fetchImpl = options.fetchImpl ?? fetch;
|
|
395
|
+
let response;
|
|
396
|
+
try {
|
|
397
|
+
response = await fetchImpl(url, {
|
|
398
|
+
headers: { accept: "application/json" },
|
|
399
|
+
signal: options.signal
|
|
400
|
+
});
|
|
401
|
+
} catch (cause) {
|
|
402
|
+
if (isAbort(cause)) throw cause;
|
|
403
|
+
throw new ApiError(`Could not reach ${url}.`, { cause });
|
|
404
|
+
}
|
|
405
|
+
const text = await response.text();
|
|
406
|
+
let body = null;
|
|
407
|
+
if (text.trim() !== "") try {
|
|
408
|
+
body = JSON.parse(text);
|
|
409
|
+
} catch {
|
|
410
|
+
body = null;
|
|
411
|
+
}
|
|
412
|
+
if (!response.ok) throw new ApiError(apiErrorMessage(body, `Request to ${url} failed with ${response.status}.`), {
|
|
413
|
+
status: response.status,
|
|
414
|
+
code: readField(body, "code"),
|
|
415
|
+
details: readField(body, "details")
|
|
416
|
+
});
|
|
417
|
+
return body;
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* `GET /api/log-groups` - log groups for a region, from CloudWatch or the local archive.
|
|
421
|
+
*
|
|
422
|
+
* The archive list needs no credentials and never reaches AWS.
|
|
423
|
+
*/
|
|
424
|
+
function fetchLogGroups(query) {
|
|
425
|
+
return getJson(buildLogGroupsUrl(query), query);
|
|
426
|
+
}
|
|
427
|
+
/** Message shown when a region has no log groups at all. */
|
|
428
|
+
function noGroupsMessage(region) {
|
|
429
|
+
return `No log groups found in ${region}. Start floci and run \`pnpm seed\` to create sample groups.`;
|
|
430
|
+
}
|
|
431
|
+
/** Plain statement of what the archive source shows, used next to the toggle. */
|
|
432
|
+
var ARCHIVE_NOTE = "Locally archived events - read from the local DuckDB file, no CloudWatch credentials, historic windows only.";
|
|
433
|
+
/** Tooltip for the archive indicator: what it shows and which file backs it. */
|
|
434
|
+
function describeArchive(path) {
|
|
435
|
+
const trimmed = typeof path === "string" ? path.trim() : "";
|
|
436
|
+
const head = "Locally archived events instead of live CloudWatch data";
|
|
437
|
+
return trimmed === "" ? head : `${head} (${trimmed})`;
|
|
438
|
+
}
|
|
439
|
+
/** Message shown when the archive holds nothing for a region. */
|
|
440
|
+
function noArchivedGroupsMessage(region) {
|
|
441
|
+
return `Nothing archived for ${region === "" ? "this region" : region} yet - stream a group from CloudWatch once and it will appear here.`;
|
|
442
|
+
}
|
|
443
|
+
/** Drops a trailing period so an appended sentence does not double up. */
|
|
444
|
+
function trimSentence(text) {
|
|
445
|
+
return text.trim().replace(/\.+$/, "");
|
|
446
|
+
}
|
|
447
|
+
/** Adds region context to a failed group list request. */
|
|
448
|
+
function describeGroupsError(region, error) {
|
|
449
|
+
if (error instanceof ApiError) {
|
|
450
|
+
const details = error.details ? ` ${error.details}` : "";
|
|
451
|
+
return `Could not list log groups in ${region}: ${trimSentence(error.message)}.${details}`;
|
|
452
|
+
}
|
|
453
|
+
return `Could not reach the watch-stream API for ${region}. ${error instanceof Error && error.message !== "" ? error.message : String(error)}`;
|
|
454
|
+
}
|
|
455
|
+
/** Adds group and region context to a stream error payload. */
|
|
456
|
+
function describeStreamError(region, group, message) {
|
|
457
|
+
return `${message} (${group === null || group === "" ? region : `${group} in ${region}`})`;
|
|
458
|
+
}
|
|
459
|
+
//#endregion
|
|
460
|
+
//#region src/lib/components/LogGroupList.svelte
|
|
461
|
+
function LogGroupList($$renderer, $$props) {
|
|
462
|
+
$$renderer.component(($$renderer) => {
|
|
463
|
+
/** Groups returned for the active region. */
|
|
464
|
+
/** Where the list came from; the archive list shows local counts instead of sizes. */
|
|
465
|
+
/** Active region, used for context in the empty state. */
|
|
466
|
+
/** Names of the groups currently being tailed; empty when none are selected. */
|
|
467
|
+
/** API error message, shown instead of the list. */
|
|
468
|
+
/** Row cap; defaults to {@link MAX_GROUP_ROWS}. */
|
|
469
|
+
/** Called with the group name when a row is clicked, replacing the selection. */
|
|
470
|
+
/** Called with the group name when its checkbox is toggled in or out of the selection. */
|
|
471
|
+
/** Called when the refresh button is clicked. */
|
|
472
|
+
let { groups = [], source = "cloudwatch", region = "", selected = [], loading = false, error = null, maxRows = 500} = $$props;
|
|
473
|
+
let search = "";
|
|
474
|
+
/** True when the list holds archived groups rather than live CloudWatch ones. */
|
|
475
|
+
let archived = derived(() => source === "archive");
|
|
476
|
+
/** Badge text for a group: how many events the archive holds for it. */
|
|
477
|
+
function archivedCount(group) {
|
|
478
|
+
return group.archivedEvents === void 0 ? null : `${formatCount(group.archivedEvents)} archived`;
|
|
479
|
+
}
|
|
480
|
+
/** `oldest -> newest` span of a group's archived events, or `null` when unknown. */
|
|
481
|
+
function archivedSpan(group) {
|
|
482
|
+
if (group.archivedOldest === void 0 || group.archivedNewest === void 0) return null;
|
|
483
|
+
return `${formatTimestamp(group.archivedOldest)} \u2192 ${formatTimestamp(group.archivedNewest)}`;
|
|
484
|
+
}
|
|
485
|
+
/** Groups matching the search box, case-insensitively. */
|
|
486
|
+
let filtered = derived(() => groups.filter((group) => group.name.toLowerCase().includes(search.trim().toLowerCase())));
|
|
487
|
+
/** Rows actually rendered, capped at `maxRows`. */
|
|
488
|
+
let visible = derived(() => filtered().slice(0, maxRows));
|
|
489
|
+
let truncated = derived(() => filtered().length > visible().length);
|
|
490
|
+
let query = derived(() => search.trim());
|
|
491
|
+
/**
|
|
492
|
+
* Selection as a flat list of names. `selected` is typed as a list, but callers that have not
|
|
493
|
+
* migrated yet may still pass a single name (or `null`), so those are normalised here.
|
|
494
|
+
*/
|
|
495
|
+
function selectionList(value) {
|
|
496
|
+
if (value === null || value === void 0) return [];
|
|
497
|
+
return Array.isArray(value) ? value : [value];
|
|
498
|
+
}
|
|
499
|
+
let activeSelection = derived(() => selectionList(selected));
|
|
500
|
+
/** True when `name` is part of the current (possibly multi-group) selection. */
|
|
501
|
+
function isSelected(name) {
|
|
502
|
+
return activeSelection().includes(name);
|
|
503
|
+
}
|
|
504
|
+
/** Row styling, highlighting every group that is currently being tailed. */
|
|
505
|
+
function rowTone(name) {
|
|
506
|
+
return isSelected(name) ? "border-sky-800 bg-sky-950/50 text-sky-200" : "border-transparent bg-neutral-900/60 text-neutral-300 hover:border-neutral-800 hover:text-neutral-100";
|
|
507
|
+
}
|
|
508
|
+
$$renderer.push(`<section class="flex min-h-0 flex-1 flex-col gap-3"><div class="flex items-center justify-between gap-2"><div class="flex items-baseline gap-2"><h2 class="text-sm font-semibold text-neutral-200">${escape_html(archived() ? "Archived groups" : "Log groups")}</h2> <span class="text-xs text-neutral-500" data-testid="group-count">${escape_html(formatCount(filtered().length))} of ${escape_html(formatCount(groups.length))}</span> `);
|
|
509
|
+
if (activeSelection().length > 1) $$renderer.push(`<!--[0--><span class="text-xs font-medium text-sky-400" data-testid="selected-count">${escape_html(formatCount(activeSelection().length))} selected</span>`);
|
|
510
|
+
else $$renderer.push("<!--[-1-->");
|
|
511
|
+
$$renderer.push(`<!--]--> `);
|
|
512
|
+
if (archived()) $$renderer.push(`<!--[0--><span class="rounded-full border border-teal-900 bg-teal-950/50 px-1.5 py-0.5 text-[0.625rem] font-medium text-teal-300" data-testid="group-source-badge">local</span>`);
|
|
513
|
+
else $$renderer.push("<!--[-1-->");
|
|
514
|
+
$$renderer.push(`<!--]--></div> <button type="button"${attr("disabled", loading, true)} class="rounded-md border border-neutral-800 bg-neutral-900 px-2 py-1 text-xs font-medium text-neutral-300 transition-colors hover:border-neutral-700 hover:text-neutral-100 disabled:cursor-not-allowed disabled:opacity-50">${escape_html(loading ? "Refreshing…" : "Refresh")}</button></div> <div class="flex flex-col gap-1.5"><label class="sr-only" for="group-search">Search log groups</label> <input id="group-search" type="search" placeholder="Search log groups"${attr("value", search)} class="w-full rounded-md border border-neutral-800 bg-neutral-900 px-2.5 py-1.5 text-sm text-neutral-100 outline-none transition-colors placeholder:text-neutral-600 hover:border-neutral-700 focus:border-sky-600"/></div> `);
|
|
515
|
+
if (error !== null && error !== "") $$renderer.push(`<!--[0--><p role="alert" data-testid="group-error" class="rounded-md border border-red-900 bg-red-950/50 px-3 py-2 text-xs leading-5 text-red-300">${escape_html(error)}</p>`);
|
|
516
|
+
else if (loading && groups.length === 0) {
|
|
517
|
+
$$renderer.push(`<!--[1--><div class="flex flex-col gap-2" data-testid="group-loading" aria-busy="true"><!--[-->`);
|
|
518
|
+
const each_array = ensure_array_like(Array.from({ length: 5 }));
|
|
519
|
+
for (let index = 0, $$length = each_array.length; index < $$length; index++) {
|
|
520
|
+
each_array[index];
|
|
521
|
+
$$renderer.push(`<div class="h-5 animate-pulse rounded bg-neutral-800/80"></div>`);
|
|
522
|
+
}
|
|
523
|
+
$$renderer.push(`<!--]--> <p class="text-xs text-neutral-500">Loading log groups…</p></div>`);
|
|
524
|
+
} else if (groups.length === 0) $$renderer.push(`<!--[2--><p data-testid="group-empty" class="rounded-md border border-neutral-800 bg-neutral-900/60 px-3 py-2 text-xs leading-5 text-neutral-400">${escape_html(archived() ? noArchivedGroupsMessage(region) : noGroupsMessage(region))}</p>`);
|
|
525
|
+
else if (visible().length === 0) $$renderer.push(`<!--[3--><p data-testid="group-no-match" class="px-1 py-2 text-xs text-neutral-500">No log groups match “${escape_html(query())}”.</p>`);
|
|
526
|
+
else {
|
|
527
|
+
$$renderer.push(`<!--[-1--><ul class="flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto pr-1"><!--[-->`);
|
|
528
|
+
const each_array_1 = ensure_array_like(visible());
|
|
529
|
+
for (let $$index_1 = 0, $$length = each_array_1.length; $$index_1 < $$length; $$index_1++) {
|
|
530
|
+
let group = each_array_1[$$index_1];
|
|
531
|
+
$$renderer.push(`<li class="flex items-center gap-1.5"><input type="checkbox"${attr("data-testid", `group-check-${stringify(group.name)}`)}${attr("aria-label", `Include ${group.name} in the selection`)}${attr("checked", isSelected(group.name), true)} class="size-3.5 shrink-0 cursor-pointer accent-sky-500"/> <button type="button" data-testid="group-row"${attr("aria-current", isSelected(group.name) ? "true" : void 0)}${attr_class(`flex min-w-0 flex-1 items-center justify-between gap-2 rounded-md border px-2.5 py-1.5 text-left text-xs transition-colors ${stringify(rowTone(group.name))}`)}><span class="truncate font-mono">${escape_html(group.name)}</span> `);
|
|
532
|
+
if (archived()) {
|
|
533
|
+
$$renderer.push(`<!--[0--><span class="flex shrink-0 items-center gap-1.5">`);
|
|
534
|
+
if (archivedCount(group) !== null) $$renderer.push(`<!--[0--><span data-testid="group-archived-count"${attr("title", archivedSpan(group) ?? "Events held in the local DuckDB archive")} class="rounded-full border border-teal-900 bg-teal-950/50 px-1.5 py-0.5 text-[0.625rem] font-medium text-teal-300">${escape_html(archivedCount(group))}</span>`);
|
|
535
|
+
else $$renderer.push("<!--[-1-->");
|
|
536
|
+
$$renderer.push(`<!--]--> `);
|
|
537
|
+
if (archivedSpan(group) !== null) $$renderer.push(`<!--[0--><span class="hidden text-[0.6875rem] text-neutral-500 xl:inline" data-testid="group-archived-span">${escape_html(archivedSpan(group))}</span>`);
|
|
538
|
+
else $$renderer.push("<!--[-1-->");
|
|
539
|
+
$$renderer.push(`<!--]--></span>`);
|
|
540
|
+
} else if (group.storedBytes !== void 0) $$renderer.push(`<!--[1--><span class="shrink-0 text-[0.6875rem] text-neutral-500">${escape_html(formatBytes(group.storedBytes))}</span>`);
|
|
541
|
+
else $$renderer.push("<!--[-1-->");
|
|
542
|
+
$$renderer.push(`<!--]--></button></li>`);
|
|
543
|
+
}
|
|
544
|
+
$$renderer.push(`<!--]--></ul> `);
|
|
545
|
+
if (truncated()) $$renderer.push(`<!--[0--><p class="text-[0.6875rem] text-neutral-500" data-testid="group-truncated">Showing first ${escape_html(formatCount(maxRows))} of ${escape_html(formatCount(filtered().length))} groups.</p>`);
|
|
546
|
+
else $$renderer.push("<!--[-1-->");
|
|
547
|
+
$$renderer.push(`<!--]-->`);
|
|
548
|
+
}
|
|
549
|
+
$$renderer.push(`<!--]--></section>`);
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
//#endregion
|
|
553
|
+
//#region src/lib/components/StatusBadge.svelte
|
|
554
|
+
function StatusBadge($$renderer, $$props) {
|
|
555
|
+
/** Connection status reported by the log stream. */
|
|
556
|
+
let { status } = $$props;
|
|
557
|
+
/** Pill text per status. */
|
|
558
|
+
const LABELS = {
|
|
559
|
+
idle: "idle",
|
|
560
|
+
connecting: "connecting",
|
|
561
|
+
live: "live",
|
|
562
|
+
reconnecting: "reconnecting",
|
|
563
|
+
error: "error",
|
|
564
|
+
ended: "ended"
|
|
565
|
+
};
|
|
566
|
+
/** Pill colours per status. */
|
|
567
|
+
const TONES = {
|
|
568
|
+
idle: "border-neutral-700 bg-neutral-800/60 text-neutral-400",
|
|
569
|
+
connecting: "border-sky-900 bg-sky-950/70 text-sky-300",
|
|
570
|
+
live: "border-emerald-900 bg-emerald-950/70 text-emerald-300",
|
|
571
|
+
reconnecting: "border-amber-900 bg-amber-950/70 text-amber-300",
|
|
572
|
+
error: "border-red-900 bg-red-950/70 text-red-300",
|
|
573
|
+
ended: "border-neutral-700 bg-neutral-800/60 text-neutral-400"
|
|
574
|
+
};
|
|
575
|
+
/** Dot colours per status. */
|
|
576
|
+
const DOTS = {
|
|
577
|
+
idle: "bg-neutral-500",
|
|
578
|
+
connecting: "bg-sky-400 animate-pulse",
|
|
579
|
+
live: "bg-emerald-400",
|
|
580
|
+
reconnecting: "bg-amber-400 animate-pulse",
|
|
581
|
+
error: "bg-red-400",
|
|
582
|
+
ended: "bg-neutral-500"
|
|
583
|
+
};
|
|
584
|
+
let tone = derived(() => TONES[status]);
|
|
585
|
+
let dot = derived(() => DOTS[status]);
|
|
586
|
+
let text = derived(() => LABELS[status]);
|
|
587
|
+
$$renderer.push(`<span data-testid="status-badge"${attr("data-status", status)}${attr_class(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium ${stringify(tone())}`)}><span${attr_class(`size-1.5 rounded-full ${stringify(dot())}`)} aria-hidden="true"></span> ${escape_html(text())}</span>`);
|
|
588
|
+
}
|
|
589
|
+
//#endregion
|
|
590
|
+
//#region src/lib/components/LogViewer.svelte
|
|
591
|
+
function LogViewer($$renderer, $$props) {
|
|
592
|
+
$$renderer.component(($$renderer) => {
|
|
593
|
+
/** Lines held by the client buffer, oldest first. */
|
|
594
|
+
/** Connection status. */
|
|
595
|
+
/** Last stream error, or `null`. */
|
|
596
|
+
/** Active region, used for error and empty-state context. */
|
|
597
|
+
/** Group being tailed, or `null` when nothing is selected. */
|
|
598
|
+
/** Client-side text filter, controlled by the parent. */
|
|
599
|
+
/** True while the visible buffer is frozen. */
|
|
600
|
+
/** True when new lines scroll the view. */
|
|
601
|
+
/** Lines held back while paused. */
|
|
602
|
+
/** Lines dropped by the cap. */
|
|
603
|
+
/** Total events received since the last reset. */
|
|
604
|
+
/** Active tail mode, used for the window chip. */
|
|
605
|
+
/** Last `ready` payload, which describes the window the server is scanning. */
|
|
606
|
+
/** Reason the server ended the stream, for example `window-complete`. */
|
|
607
|
+
/** Database file behind the local archive, shown in the archive tooltip. */
|
|
608
|
+
/** Log groups in the view; more than one adds a group column. */
|
|
609
|
+
/**
|
|
610
|
+
* Active level filter. Leave it undefined to let the viewer own the filter;
|
|
611
|
+
* pass a value (including `null`) to control it from outside, which is how
|
|
612
|
+
* the chart above stays in step with the chips.
|
|
613
|
+
*/
|
|
614
|
+
/** Called when the level filter changes while it is controlled. */
|
|
615
|
+
/**
|
|
616
|
+
* Group lines that share a request id into one row, opened on demand. On by
|
|
617
|
+
* default, and owned by the page so the chart counts the same requests.
|
|
618
|
+
*/
|
|
619
|
+
/** Called when the grouping toggle is pressed. */
|
|
620
|
+
let { lines = [], status = "idle", error = null, region = "", group = null, filter = "", paused = false, autoScroll = true, pendingCount = 0, droppedCount = 0, receivedCount = 0, mode = "live", ready = null, endReason = null, archivePath = null, groups = [], level = void 0, onLevelChange, groupRequests = true, onGroupToggle, onFilterChange, onPauseToggle, onClear, onAutoScrollToggle } = $$props;
|
|
621
|
+
const TIMESTAMP_COLUMN_PX = remToPx(7.5);
|
|
622
|
+
const ROW_PADDING_PX = remToPx(.75);
|
|
623
|
+
const ROW_GAP_PX = remToPx(.5);
|
|
624
|
+
const PREFIX_MIN_PX = remToPx(PREFIX_WIDTH.minRem);
|
|
625
|
+
const PREFIX_MAX_PX = remToPx(PREFIX_WIDTH.maxRem);
|
|
626
|
+
const PREFIX_DEFAULT_PX = remToPx(PREFIX_WIDTH.defaultRem);
|
|
627
|
+
/** Persists a preference; failures are ignored (private mode, quota). */
|
|
628
|
+
function writePref(key, value) {
|
|
629
|
+
try {
|
|
630
|
+
if (typeof localStorage === "undefined") return;
|
|
631
|
+
localStorage.setItem(key, value);
|
|
632
|
+
} catch {}
|
|
633
|
+
}
|
|
634
|
+
/** View preferences, restored in `onMount` so SSR output stays deterministic. */
|
|
635
|
+
let wrapLines = false;
|
|
636
|
+
let jsonView = true;
|
|
637
|
+
let prefixPx = PREFIX_DEFAULT_PX;
|
|
638
|
+
/** One rendered row, pre-formatted so the template stays declarative. */
|
|
639
|
+
/**
|
|
640
|
+
* Payload found inside the raw line, used when pretty-printing is off and
|
|
641
|
+
* the row is expanded. `null` when the line carries no JSON.
|
|
642
|
+
*/
|
|
643
|
+
/** Log group the line came from, when the payload carries one. */
|
|
644
|
+
/** Detected level, or `null` when the line carried no signal. */
|
|
645
|
+
/** Level the viewer owns when the parent does not control it. */
|
|
646
|
+
let ownLevelFilter = null;
|
|
647
|
+
/** Active level filter: the parent's when given, otherwise the viewer's. */
|
|
648
|
+
let levelFilter = derived(() => level === void 0 ? ownLevelFilter : level);
|
|
649
|
+
/** The four levels offered as filter chips, in severity order. */
|
|
650
|
+
const LEVEL_CHIPS = [
|
|
651
|
+
{
|
|
652
|
+
level: "error",
|
|
653
|
+
label: "Error",
|
|
654
|
+
activeClass: "border-red-800 bg-red-950/50 text-red-300"
|
|
655
|
+
},
|
|
656
|
+
{
|
|
657
|
+
level: "warn",
|
|
658
|
+
label: "Warn",
|
|
659
|
+
activeClass: "border-amber-800 bg-amber-950/40 text-amber-300"
|
|
660
|
+
},
|
|
661
|
+
{
|
|
662
|
+
level: "info",
|
|
663
|
+
label: "Info",
|
|
664
|
+
activeClass: "border-neutral-700 bg-neutral-800 text-neutral-100"
|
|
665
|
+
},
|
|
666
|
+
{
|
|
667
|
+
level: "debug",
|
|
668
|
+
label: "Debug",
|
|
669
|
+
activeClass: "border-neutral-700 bg-neutral-800 text-neutral-400"
|
|
670
|
+
}
|
|
671
|
+
];
|
|
672
|
+
/** Lines matching the text filter and the level filter. */
|
|
673
|
+
let visible = derived(() => filterByLevel(filterEvents(lines, filter), levelFilter()));
|
|
674
|
+
/** How many lines of each level are loaded, including `unknown`. */
|
|
675
|
+
let levelCounts = derived(() => {
|
|
676
|
+
const counts = {
|
|
677
|
+
error: 0,
|
|
678
|
+
warn: 0,
|
|
679
|
+
info: 0,
|
|
680
|
+
debug: 0,
|
|
681
|
+
unknown: 0
|
|
682
|
+
};
|
|
683
|
+
for (const event of lines) {
|
|
684
|
+
const rowLevel = effectiveLevel(event);
|
|
685
|
+
counts[rowLevel ?? "unknown"] = (counts[rowLevel ?? "unknown"] ?? 0) + 1;
|
|
686
|
+
}
|
|
687
|
+
return counts;
|
|
688
|
+
});
|
|
689
|
+
/** Presentation rows for the visible lines, one per line in buffer order. */
|
|
690
|
+
let lineRows = derived(() => visible().map((event, index) => {
|
|
691
|
+
const rowLevel = event.level !== void 0 ? event.level : detectLevel(event.message);
|
|
692
|
+
const formatted = formatLogMessage(event.message, { prettyJson: jsonView });
|
|
693
|
+
const levelClass = levelColorClass(rowLevel);
|
|
694
|
+
return {
|
|
695
|
+
key: eventKey(event, index),
|
|
696
|
+
time: formatTime(event.timestamp),
|
|
697
|
+
timestamp: formatTimestamp(event.timestamp),
|
|
698
|
+
streamName: event.streamName,
|
|
699
|
+
group: event.group ?? null,
|
|
700
|
+
message: formatted.text,
|
|
701
|
+
tokens: formatted.isJson ? tokenizeJson(formatted.text) : null,
|
|
702
|
+
expandable: null,
|
|
703
|
+
level: rowLevel,
|
|
704
|
+
levelClass
|
|
705
|
+
};
|
|
706
|
+
}));
|
|
707
|
+
/**
|
|
708
|
+
* One row of the list: a line, or a request that holds its lines.
|
|
709
|
+
*
|
|
710
|
+
* A request row carries everything the header shows, so the template stays
|
|
711
|
+
* declarative and the list never re-formats a line it already formatted.
|
|
712
|
+
*/
|
|
713
|
+
/** Request id every line in the group carries. */
|
|
714
|
+
/** Clock time of the first line, and its full timestamp for the tooltip. */
|
|
715
|
+
/** Number of lines in the group. */
|
|
716
|
+
/** First to last line, as `1.2s`. */
|
|
717
|
+
/** Most critical level in the group. */
|
|
718
|
+
/** Log group and stream, when every line in the request shares them. */
|
|
719
|
+
/** Worst line, trimmed to one short line for the collapsed row. */
|
|
720
|
+
/** Longest preview kept for a collapsed request, in characters. */
|
|
721
|
+
const PREVIEW_LENGTH = 160;
|
|
722
|
+
/** Prefixes a formatted line row with its kind. */
|
|
723
|
+
function asLine(row) {
|
|
724
|
+
return {
|
|
725
|
+
kind: "line",
|
|
726
|
+
...row
|
|
727
|
+
};
|
|
728
|
+
}
|
|
729
|
+
/** Builds the request header row from the lines it holds. */
|
|
730
|
+
function requestDisplayRow(row) {
|
|
731
|
+
const children = row.request.events.map((entry) => lineRows()[entry.index]).filter((child) => child !== void 0);
|
|
732
|
+
const worstLevel = row.request.level;
|
|
733
|
+
const first = children[0];
|
|
734
|
+
return {
|
|
735
|
+
kind: "request",
|
|
736
|
+
key: row.key,
|
|
737
|
+
id: row.request.id,
|
|
738
|
+
time: first?.time ?? "",
|
|
739
|
+
timestamp: first?.timestamp ?? "",
|
|
740
|
+
count: children.length,
|
|
741
|
+
span: formatSpan(row.request.last - row.request.first),
|
|
742
|
+
level: worstLevel,
|
|
743
|
+
levelLabel: LEVEL_LABELS[worstLevel],
|
|
744
|
+
levelClass: levelColorClass(worstLevel === "unknown" ? null : worstLevel),
|
|
745
|
+
group: sharedField(children.map((child) => child.group)),
|
|
746
|
+
streamName: sharedField(children.map((child) => child.streamName)),
|
|
747
|
+
preview: requestPreview(row.request),
|
|
748
|
+
children
|
|
749
|
+
};
|
|
750
|
+
}
|
|
751
|
+
/** The value every entry shares, or `null` when they differ. */
|
|
752
|
+
function sharedField(values) {
|
|
753
|
+
const first = values[0];
|
|
754
|
+
if (first === null || first === void 0) return null;
|
|
755
|
+
return values.every((value) => value === first) ? first : null;
|
|
756
|
+
}
|
|
757
|
+
/**
|
|
758
|
+
* One short line for a collapsed request: its most critical line, because that
|
|
759
|
+
* is the line that explains why the request is coloured the way it is.
|
|
760
|
+
*/
|
|
761
|
+
function requestPreview(request) {
|
|
762
|
+
const worst = request.events.find((entry) => effectiveLevel(visible()[entry.index] ?? { message: "" }) === request.level) ?? request.events[0];
|
|
763
|
+
const [firstLine = ""] = (visible()[worst?.index ?? -1]?.message ?? "").split("\n");
|
|
764
|
+
return firstLine.replace(/\s+/g, " ").trim().slice(0, PREVIEW_LENGTH);
|
|
765
|
+
}
|
|
766
|
+
/** Rows the list renders: grouped by request when the preference is on. */
|
|
767
|
+
let displayRows = derived(() => {
|
|
768
|
+
if (!groupRequests) return lineRows().map(asLine);
|
|
769
|
+
const rows = [];
|
|
770
|
+
for (const row of requestRows(visible())) {
|
|
771
|
+
if (row.kind === "line") {
|
|
772
|
+
rows.push(asLine(lineRows()[row.index]));
|
|
773
|
+
continue;
|
|
774
|
+
}
|
|
775
|
+
if (row.request.events.length === 1) {
|
|
776
|
+
const only = lineRows()[row.request.events[0]?.index ?? -1];
|
|
777
|
+
if (only !== void 0) rows.push(asLine(only));
|
|
778
|
+
continue;
|
|
779
|
+
}
|
|
780
|
+
rows.push(requestDisplayRow(row));
|
|
781
|
+
}
|
|
782
|
+
return rows;
|
|
783
|
+
});
|
|
784
|
+
/** True when the list is showing request rows. */
|
|
785
|
+
let grouped = derived(() => displayRows().some((row) => row.kind === "request"));
|
|
786
|
+
/** Requests in view, shown next to the line count while grouping. */
|
|
787
|
+
let requestCount = derived(() => displayRows().filter((row) => row.kind === "request").length);
|
|
788
|
+
/** Keeps the newest line in view while auto-scroll is on (vertical only). */
|
|
789
|
+
/** Error text with the group and region context. */
|
|
790
|
+
let errorText = derived(() => error === null ? null : describeStreamError(region, group, error.message));
|
|
791
|
+
/** True when the ready frame says the events come from the local archive. */
|
|
792
|
+
let archived = derived(() => ready?.source === "archive");
|
|
793
|
+
/**
|
|
794
|
+
* Status the badge shows. The archive has no live tail: it replays a fixed window and ends by
|
|
795
|
+
* itself, so its connecting/live/reconnecting states would all be misleading.
|
|
796
|
+
*/
|
|
797
|
+
let displayStatus = derived(() => archived() && (status === "connecting" || status === "live" || status === "reconnecting") ? "idle" : status);
|
|
798
|
+
/** Tooltip of the archive indicator, naming the database file it reads. */
|
|
799
|
+
let archiveTitle = derived(() => describeArchive(archivePath));
|
|
800
|
+
/** Body text when there is nothing to render. */
|
|
801
|
+
let emptyText = derived(() => group === null || group === "" ? "Select a log group to start tailing." : filter.trim() !== "" ? "No lines match the filter." : archived() ? `No archived events for ${group} in this window.` : `Waiting for events from ${group}\u2026`);
|
|
802
|
+
/** Auto-scroll button colour. */
|
|
803
|
+
let autoScrollTone = derived(() => autoScroll ? "text-sky-300" : "text-neutral-400");
|
|
804
|
+
/** Chip describing the active window. */
|
|
805
|
+
let windowSummary = derived(() => describeWindow(ready, Date.now()));
|
|
806
|
+
/** True when a historic scan finished on its own. */
|
|
807
|
+
let windowComplete = derived(() => mode === "historic" && endReason === "window-complete");
|
|
808
|
+
/** Wrap toggle colour. */
|
|
809
|
+
let wrapTone = derived(() => "text-neutral-400");
|
|
810
|
+
/** JSON toggle colour. */
|
|
811
|
+
let jsonTone = derived(() => "text-sky-300");
|
|
812
|
+
/** Grouping toggle colour. */
|
|
813
|
+
let groupTone = derived(() => groupRequests ? "text-sky-300" : "text-neutral-400");
|
|
814
|
+
/** Rows fill the window when wrapping, and grow to their content otherwise. */
|
|
815
|
+
let listClass = derived(() => "w-max min-w-full");
|
|
816
|
+
/** Message cell: wrapped text or a single long line that scrolls sideways. */
|
|
817
|
+
let messageClass = derived(() => "whitespace-pre");
|
|
818
|
+
/** Left edge of the prefix resize handle, in pixels from the scrolled content edge. */
|
|
819
|
+
let handleLeft = derived(() => ROW_PADDING_PX + TIMESTAMP_COLUMN_PX + ROW_GAP_PX + prefixPx);
|
|
820
|
+
/** Prefix column width as a CSS length. */
|
|
821
|
+
let prefixStyle = derived(() => `max-width: ${pxToRem(prefixPx)}`);
|
|
822
|
+
/** Rows the user has opened, keyed by row key. */
|
|
823
|
+
let expandedRows = {};
|
|
824
|
+
/** True when a row is open. */
|
|
825
|
+
function isExpanded(key) {
|
|
826
|
+
return expandedRows[key] === true;
|
|
827
|
+
}
|
|
828
|
+
/** Colour for a JSON token, keeping punctuation and whitespace quiet. */
|
|
829
|
+
function tokenClass(type) {
|
|
830
|
+
switch (type) {
|
|
831
|
+
case "key": return "text-sky-300";
|
|
832
|
+
case "string": return "text-emerald-300";
|
|
833
|
+
case "number": return "text-amber-300";
|
|
834
|
+
case "boolean": return "text-fuchsia-300";
|
|
835
|
+
case "null": return "text-neutral-500";
|
|
836
|
+
case "punctuation": return "text-neutral-600";
|
|
837
|
+
default: return "";
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
/** Persists the current prefix width. */
|
|
841
|
+
function savePrefixWidth() {
|
|
842
|
+
writePref(STORAGE_KEYS.prefixWidth, String(Math.round(prefixPx)));
|
|
843
|
+
}
|
|
844
|
+
$$renderer.push(`<section class="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-lg border border-neutral-800 bg-neutral-950"><div class="flex flex-wrap items-center gap-x-3 gap-y-2 border-b border-neutral-800 bg-neutral-900/40 px-3 py-2">`);
|
|
845
|
+
StatusBadge($$renderer, { status: displayStatus() });
|
|
846
|
+
$$renderer.push(`<!----> `);
|
|
847
|
+
if (archived()) $$renderer.push(`<!--[0--><span data-testid="archive-badge"${attr("title", archiveTitle())} class="rounded-full border border-teal-900 bg-teal-950/60 px-2 py-0.5 text-[0.6875rem] font-medium text-teal-300">local archive</span>`);
|
|
848
|
+
else $$renderer.push("<!--[-1-->");
|
|
849
|
+
$$renderer.push(`<!--]--> <span class="text-xs text-neutral-400" data-testid="visible-count">${escape_html(formatCount(visible().length))} shown</span> `);
|
|
850
|
+
if (grouped()) $$renderer.push(`<!--[0--><span class="text-xs text-neutral-400" data-testid="request-count">${escape_html(formatCount(requestCount()))} requests</span>`);
|
|
851
|
+
else $$renderer.push("<!--[-1-->");
|
|
852
|
+
$$renderer.push(`<!--]--> <span class="text-xs text-neutral-500" data-testid="received-count">${escape_html(formatCount(receivedCount))} received</span> `);
|
|
853
|
+
if (pendingCount > 0) $$renderer.push(`<!--[0--><span class="text-xs text-amber-300" data-testid="pending-count">${escape_html(formatCount(pendingCount))} buffered</span>`);
|
|
854
|
+
else $$renderer.push("<!--[-1-->");
|
|
855
|
+
$$renderer.push(`<!--]--> `);
|
|
856
|
+
if (droppedCount > 0) $$renderer.push(`<!--[0--><span class="text-xs text-amber-300/80" data-testid="dropped-count">${escape_html(formatCount(droppedCount))} dropped</span>`);
|
|
857
|
+
else $$renderer.push("<!--[-1-->");
|
|
858
|
+
$$renderer.push(`<!--]--> <span${attr_class(`rounded-full border px-2 py-0.5 text-[0.6875rem] font-medium ${windowSummary().mode === "historic" ? "border-amber-900 bg-amber-950/40 text-amber-300" : "border-neutral-800 bg-neutral-900 text-neutral-400"}`)}${attr("title", windowSummary().title)} data-testid="window-chip">${escape_html(windowSummary().label)}</span> `);
|
|
859
|
+
if (windowSummary().clamped) $$renderer.push(`<!--[0--><span class="text-[0.6875rem] text-amber-400/80" data-testid="window-clamped">14-day limit</span>`);
|
|
860
|
+
else $$renderer.push("<!--[-1-->");
|
|
861
|
+
$$renderer.push(`<!--]--> `);
|
|
862
|
+
if (windowComplete()) $$renderer.push(`<!--[0--><span class="text-[0.6875rem] text-emerald-400/80" data-testid="window-complete">window complete</span>`);
|
|
863
|
+
else $$renderer.push("<!--[-1-->");
|
|
864
|
+
$$renderer.push(`<!--]--> <div class="ml-auto flex flex-wrap items-center gap-2"><div class="flex items-center gap-1" role="group" aria-label="Filter by level"><button type="button"${attr("aria-pressed", levelFilter() === null)} title="Show every level, including lines with no level" data-testid="level-all"${attr_class(`rounded-md border px-2 py-1 text-xs font-medium transition-colors hover:border-neutral-700 ${levelFilter() === null ? "border-sky-700 bg-sky-950/60 text-sky-200" : "border-neutral-800 bg-neutral-900 text-neutral-400 hover:border-neutral-700"}`)}>All</button> <!--[-->`);
|
|
865
|
+
const each_array = ensure_array_like(LEVEL_CHIPS);
|
|
866
|
+
for (let $$index = 0, $$length = each_array.length; $$index < $$length; $$index++) {
|
|
867
|
+
let chip = each_array[$$index];
|
|
868
|
+
$$renderer.push(`<button type="button"${attr("aria-pressed", levelFilter() === chip.level)}${attr("title", `Show only ${stringify(chip.label)} lines (${stringify(levelCounts()[chip.level] ?? 0)} loaded)`)}${attr("data-testid", `level-${stringify(chip.level)}`)}${attr_class(`rounded-md border px-2 py-1 text-xs font-medium transition-colors hover:border-neutral-700 ${stringify(levelFilter() === chip.level ? chip.activeClass : "border-neutral-800 bg-neutral-900 text-neutral-400 hover:border-neutral-700")}`)}>${escape_html(chip.label)} `);
|
|
869
|
+
if ((levelCounts()[chip.level] ?? 0) > 0) $$renderer.push(`<!--[0--><span class="ml-1 opacity-70">${escape_html(formatCount(levelCounts()[chip.level] ?? 0))}</span>`);
|
|
870
|
+
else $$renderer.push("<!--[-1-->");
|
|
871
|
+
$$renderer.push(`<!--]--></button>`);
|
|
872
|
+
}
|
|
873
|
+
$$renderer.push(`<!--]--></div> <input type="search" aria-label="Filter log lines" placeholder="Filter lines"${attr("value", filter)} class="w-40 rounded-md border border-neutral-800 bg-neutral-900 px-2 py-1 text-xs text-neutral-100 outline-none transition-colors placeholder:text-neutral-600 hover:border-neutral-700 focus:border-sky-600"/> <button type="button"${attr("aria-pressed", wrapLines)} title="Wrap long lines instead of scrolling sideways" data-testid="wrap-toggle"${attr_class(`rounded-md border border-neutral-800 bg-neutral-900 px-2 py-1 text-xs font-medium transition-colors hover:border-neutral-700 ${wrapTone()}`)}>Wrap</button> <button type="button"${attr("aria-pressed", jsonView)} title="Pretty-print JSON log entries (off: click a line to open its JSON)" data-testid="json-toggle"${attr_class(`rounded-md border border-neutral-800 bg-neutral-900 px-2 py-1 text-xs font-medium transition-colors hover:border-neutral-700 ${jsonTone()}`)}>JSON</button> <button type="button"${attr("aria-pressed", groupRequests)} title="Group the lines of one request into a single row, coloured by its most critical line (off: one row per line)" data-testid="group-toggle"${attr_class(`rounded-md border border-neutral-800 bg-neutral-900 px-2 py-1 text-xs font-medium transition-colors hover:border-neutral-700 ${groupTone()}`)}>By request</button> <button type="button"${attr("aria-pressed", paused)} class="rounded-md border border-neutral-800 bg-neutral-900 px-2 py-1 text-xs font-medium text-neutral-300 transition-colors hover:border-neutral-700 hover:text-neutral-100">${escape_html(paused ? "Resume" : "Pause")}</button> <button type="button" class="rounded-md border border-neutral-800 bg-neutral-900 px-2 py-1 text-xs font-medium text-neutral-300 transition-colors hover:border-neutral-700 hover:text-neutral-100">Clear</button> <button type="button"${attr("aria-pressed", autoScroll)}${attr_class(`rounded-md border border-neutral-800 bg-neutral-900 px-2 py-1 text-xs font-medium transition-colors hover:border-neutral-700 ${autoScrollTone()}`)}>Auto-scroll</button></div></div> `);
|
|
874
|
+
if (errorText() !== null) $$renderer.push(`<!--[0--><p role="alert" data-testid="stream-error" class="border-b border-red-900 bg-red-950/50 px-3 py-2 text-xs leading-5 text-red-300">${escape_html(errorText())}</p>`);
|
|
875
|
+
else $$renderer.push("<!--[-1-->");
|
|
876
|
+
$$renderer.push(`<!--]--> <div class="min-h-0 min-w-0 flex-1 overflow-auto bg-neutral-950" data-testid="log-scroller">`);
|
|
877
|
+
if (group === null || group === "") $$renderer.push(`<!--[0--><p class="px-3 py-6 text-sm text-neutral-500" data-testid="viewer-idle">Select a log group to start tailing.</p>`);
|
|
878
|
+
else if (displayRows().length === 0) $$renderer.push(`<!--[1--><p class="px-3 py-6 text-sm text-neutral-500" data-testid="viewer-empty">${escape_html(emptyText())}</p>`);
|
|
879
|
+
else {
|
|
880
|
+
$$renderer.push("<!--[-1-->");
|
|
881
|
+
function logLine($$renderer, row, child) {
|
|
882
|
+
const expandable = row.expandable !== null;
|
|
883
|
+
const open = expandable && isExpanded(row.key);
|
|
884
|
+
$$renderer.push(`<li${attr_class(`flex flex-wrap items-baseline gap-2 ${child ? "pl-8" : "px-3"} py-0.5 hover:bg-neutral-900/60 ${listClass()} ${expandable ? "cursor-pointer" : ""}`)} data-testid="log-line"${attr("data-request-child", child ? "true" : void 0)}${attr("data-level", row.level ?? "unknown")}${attr("data-expandable", expandable ? "true" : void 0)}${attr("data-expanded", open ? "true" : void 0)}${attr("role", expandable ? "button" : void 0)}${attr("tabindex", expandable ? 0 : void 0)}${attr("aria-expanded", expandable ? open : void 0)}${attr("title", expandable ? open ? "Hide the JSON in this line" : "Show this line as JSON" : void 0)}><span class="w-[7.5rem] shrink-0 text-neutral-500"${attr("title", row.timestamp)}>${escape_html(row.time)}</span> `);
|
|
885
|
+
if (groups.length > 1) $$renderer.push(`<!--[0--><span class="w-[9rem] shrink-0 truncate text-teal-400/80"${attr("title", row.group ?? "")} data-testid="log-group">${escape_html(row.group ?? "")}</span>`);
|
|
886
|
+
else $$renderer.push("<!--[-1-->");
|
|
887
|
+
$$renderer.push(`<!--]--> <span class="shrink-0 truncate text-sky-400/80"${attr_style(prefixStyle())}${attr("title", row.streamName ?? "")} data-testid="log-stream">${escape_html(row.streamName ?? "")}</span> `);
|
|
888
|
+
if (expandable) $$renderer.push(`<!--[0--><span class="shrink-0 text-neutral-600" aria-hidden="true">${escape_html(open ? "▾" : "▸")}</span>`);
|
|
889
|
+
else $$renderer.push("<!--[-1-->");
|
|
890
|
+
$$renderer.push(`<!--]--> <span${attr_class(`${messageClass()} ${stringify(row.levelClass)}`)} data-testid="log-message">`);
|
|
891
|
+
if (row.tokens !== null) {
|
|
892
|
+
$$renderer.push(`<!--[0--><!--[-->`);
|
|
893
|
+
const each_array_1 = ensure_array_like(row.tokens);
|
|
894
|
+
for (let tokenIndex = 0, $$length = each_array_1.length; tokenIndex < $$length; tokenIndex++) {
|
|
895
|
+
let token = each_array_1[tokenIndex];
|
|
896
|
+
$$renderer.push(`<span${attr_class(clsx(tokenClass(token.type)))}>${escape_html(token.text)}</span>`);
|
|
897
|
+
}
|
|
898
|
+
$$renderer.push(`<!--]-->`);
|
|
899
|
+
} else $$renderer.push(`<!--[-1-->${escape_html(row.message)}`);
|
|
900
|
+
$$renderer.push(`<!--]--></span> `);
|
|
901
|
+
if (open && row.expandable !== null) {
|
|
902
|
+
$$renderer.push(`<!--[0--><span class="w-full whitespace-pre text-xs text-neutral-300" data-testid="log-json-expanded"><!--[-->`);
|
|
903
|
+
const each_array_2 = ensure_array_like(tokenizeJson(row.expandable));
|
|
904
|
+
for (let tokenIndex = 0, $$length = each_array_2.length; tokenIndex < $$length; tokenIndex++) {
|
|
905
|
+
let token = each_array_2[tokenIndex];
|
|
906
|
+
$$renderer.push(`<span${attr_class(clsx(tokenClass(token.type)))}>${escape_html(token.text)}</span>`);
|
|
907
|
+
}
|
|
908
|
+
$$renderer.push(`<!--]--></span>`);
|
|
909
|
+
} else $$renderer.push("<!--[-1-->");
|
|
910
|
+
$$renderer.push(`<!--]--></li>`);
|
|
911
|
+
}
|
|
912
|
+
$$renderer.push(`<div${attr_class(`relative min-h-full ${listClass()}`)} data-testid="log-canvas"><ol class="font-mono text-xs leading-5" data-testid="log-lines"><!--[-->`);
|
|
913
|
+
const each_array_3 = ensure_array_like(displayRows());
|
|
914
|
+
for (let $$index_4 = 0, $$length = each_array_3.length; $$index_4 < $$length; $$index_4++) {
|
|
915
|
+
let row = each_array_3[$$index_4];
|
|
916
|
+
if (row.kind === "request") {
|
|
917
|
+
$$renderer.push("<!--[0-->");
|
|
918
|
+
const open = isExpanded(row.key);
|
|
919
|
+
$$renderer.push(`<li${attr_class(clsx(listClass()))} data-testid="log-request-group"${attr("data-request-id", row.id)}${attr("data-level", row.level)}${attr("data-expanded", open ? "true" : void 0)}${attr("data-lines", row.count)}><button type="button" class="flex w-full flex-wrap items-baseline gap-2 px-3 py-0.5 text-left hover:bg-neutral-900/60"${attr("aria-expanded", open)}${attr("title", open ? "Hide the lines of this request" : "Show every line of this request")} data-testid="request-group-summary"><span class="w-[7.5rem] shrink-0 text-neutral-500"${attr("title", row.timestamp)}>${escape_html(row.time)}</span> `);
|
|
920
|
+
if (groups.length > 1) $$renderer.push(`<!--[0--><span class="w-[9rem] shrink-0 truncate text-teal-400/80"${attr("title", row.group ?? "")} data-testid="log-group">${escape_html(row.group ?? "")}</span>`);
|
|
921
|
+
else $$renderer.push("<!--[-1-->");
|
|
922
|
+
$$renderer.push(`<!--]--> <span class="shrink-0 truncate text-sky-400/80"${attr_style(prefixStyle())}${attr("title", row.streamName ?? "")} data-testid="log-stream">${escape_html(row.streamName ?? "")}</span> <span class="shrink-0 text-neutral-600" aria-hidden="true">${escape_html(open ? "▾" : "▸")}</span> <span class="shrink-0 rounded border border-neutral-700 bg-neutral-900 px-1.5 font-mono text-[0.6875rem] text-sky-200" data-testid="request-group-id" title="Request id shared by these lines">${escape_html(row.id)}</span> <span class="shrink-0 text-neutral-400" data-testid="request-group-count">${escape_html(formatCount(row.count))} lines</span> <span class="shrink-0 text-neutral-500" data-testid="request-group-span">${escape_html(row.span)}</span> <span${attr_class(`shrink-0 font-medium ${stringify(row.levelClass)}`)} data-testid="request-group-level">${escape_html(row.levelLabel)}</span> `);
|
|
923
|
+
if (!open) $$renderer.push(`<!--[0--><span class="min-w-0 truncate text-neutral-500" data-testid="request-group-preview">${escape_html(row.preview)}</span>`);
|
|
924
|
+
else $$renderer.push("<!--[-1-->");
|
|
925
|
+
$$renderer.push(`<!--]--></button> `);
|
|
926
|
+
if (open) {
|
|
927
|
+
$$renderer.push(`<!--[0--><ul class="contents"><!--[-->`);
|
|
928
|
+
const each_array_4 = ensure_array_like(row.children);
|
|
929
|
+
for (let $$index_3 = 0, $$length = each_array_4.length; $$index_3 < $$length; $$index_3++) {
|
|
930
|
+
let child = each_array_4[$$index_3];
|
|
931
|
+
logLine($$renderer, child, true);
|
|
932
|
+
}
|
|
933
|
+
$$renderer.push(`<!--]--></ul>`);
|
|
934
|
+
} else $$renderer.push("<!--[-1-->");
|
|
935
|
+
$$renderer.push(`<!--]--></li>`);
|
|
936
|
+
} else {
|
|
937
|
+
$$renderer.push("<!--[-1-->");
|
|
938
|
+
logLine($$renderer, row, false);
|
|
939
|
+
}
|
|
940
|
+
$$renderer.push(`<!--]-->`);
|
|
941
|
+
}
|
|
942
|
+
$$renderer.push(`<!--]--></ol> `);
|
|
943
|
+
ColumnResizer($$renderer, {
|
|
944
|
+
label: "Resize prefix column",
|
|
945
|
+
width: prefixPx,
|
|
946
|
+
min: PREFIX_MIN_PX,
|
|
947
|
+
max: PREFIX_MAX_PX,
|
|
948
|
+
testId: "prefix-resizer",
|
|
949
|
+
onChange: (next) => prefixPx = next,
|
|
950
|
+
onCommit: () => savePrefixWidth(),
|
|
951
|
+
class: "absolute inset-y-0 w-2",
|
|
952
|
+
style: `left: ${stringify(handleLeft() - 4)}px`
|
|
953
|
+
});
|
|
954
|
+
$$renderer.push(`<!----></div>`);
|
|
955
|
+
}
|
|
956
|
+
$$renderer.push(`<!--]--></div></section>`);
|
|
957
|
+
});
|
|
958
|
+
}
|
|
959
|
+
//#endregion
|
|
960
|
+
//#region src/lib/components/RegionSelect.svelte
|
|
961
|
+
function RegionSelect($$renderer, $$props) {
|
|
962
|
+
$$renderer.component(($$renderer) => {
|
|
963
|
+
/** Regions offered by the picker; defaults to {@link DEFAULT_REGIONS}. */
|
|
964
|
+
/** Currently selected region. */
|
|
965
|
+
/** Called with the newly selected region. */
|
|
966
|
+
let { regions = DEFAULT_REGIONS, value = "", disabled = false, label = "Region", id = "region-select", onchange } = $$props;
|
|
967
|
+
/** Offered regions, plus the current value when the server does not list it. */
|
|
968
|
+
let options = derived(() => value !== "" && !regions.includes(value) ? [value, ...regions] : [...regions]);
|
|
969
|
+
$$renderer.push(`<div class="flex flex-col gap-1.5"><label${attr("for", id)} class="text-[0.6875rem] font-semibold uppercase tracking-wider text-neutral-500">${escape_html(label)}</label> `);
|
|
970
|
+
$$renderer.select({
|
|
971
|
+
id,
|
|
972
|
+
disabled,
|
|
973
|
+
value,
|
|
974
|
+
onchange: (event) => onchange?.(event.currentTarget.value),
|
|
975
|
+
class: "w-full rounded-md border border-neutral-800 bg-neutral-900 px-2.5 py-1.5 text-sm text-neutral-100 outline-none transition-colors hover:border-neutral-700 focus:border-sky-600 disabled:cursor-not-allowed disabled:opacity-50"
|
|
976
|
+
}, ($$renderer) => {
|
|
977
|
+
$$renderer.push(`<!--[-->`);
|
|
978
|
+
const each_array = ensure_array_like(options());
|
|
979
|
+
for (let $$index = 0, $$length = each_array.length; $$index < $$length; $$index++) {
|
|
980
|
+
let option = each_array[$$index];
|
|
981
|
+
$$renderer.option({ value: option }, ($$renderer) => {
|
|
982
|
+
$$renderer.push(`${escape_html(option)}`);
|
|
983
|
+
});
|
|
984
|
+
}
|
|
985
|
+
$$renderer.push(`<!--]-->`);
|
|
986
|
+
});
|
|
987
|
+
$$renderer.push(`</div>`);
|
|
988
|
+
});
|
|
989
|
+
}
|
|
990
|
+
//#endregion
|
|
991
|
+
//#region src/lib/components/SourceControls.svelte
|
|
992
|
+
function SourceControls($$renderer, $$props) {
|
|
993
|
+
$$renderer.component(($$renderer) => {
|
|
994
|
+
/** Active source, owned by the page. */
|
|
995
|
+
/**
|
|
996
|
+
* True only when `GET /api/archive` reported `available: true`.
|
|
997
|
+
* The toggle is hidden otherwise, so the app keeps its CloudWatch-only look.
|
|
998
|
+
*/
|
|
999
|
+
/** Database file behind the archive, shown in the tooltip. */
|
|
1000
|
+
/** Called with the newly chosen source. */
|
|
1001
|
+
let { source = "cloudwatch", archiveAvailable = false, archivePath = null} = $$props;
|
|
1002
|
+
/** Tooltip of the archive button: what it reads and which file backs it. */
|
|
1003
|
+
let archiveTitle = derived(() => describeArchive(archivePath));
|
|
1004
|
+
if (archiveAvailable) {
|
|
1005
|
+
$$renderer.push(`<!--[0--><div class="flex flex-col gap-1.5"><div class="flex items-center gap-1 rounded-lg border border-neutral-800 bg-neutral-900 p-0.5" role="group" aria-label="Log source"><button type="button"${attr("aria-pressed", source === "cloudwatch")} title="Stream from CloudWatch Logs with your AWS credentials" data-testid="source-cloudwatch"${attr_class(`rounded-md border px-2 py-1 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50 ${source === "cloudwatch" ? "border-sky-700 bg-sky-950/60 text-sky-300" : "border-transparent text-neutral-400 hover:text-neutral-200"}`)}>CloudWatch</button> <button type="button"${attr("aria-pressed", source === "archive")}${attr("title", archiveTitle())} data-testid="source-archive"${attr_class(`rounded-md border px-2 py-1 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50 ${source === "archive" ? "border-teal-700 bg-teal-950/60 text-teal-300" : "border-transparent text-neutral-400 hover:text-neutral-200"}`)}>Local archive</button></div> `);
|
|
1006
|
+
if (source === "archive") $$renderer.push(`<!--[0--><p class="text-[0.6875rem] leading-4 text-teal-300/80"${attr("title", archiveTitle())} data-testid="archive-note">${escape_html(ARCHIVE_NOTE)}</p>`);
|
|
1007
|
+
else $$renderer.push("<!--[-1-->");
|
|
1008
|
+
$$renderer.push(`<!--]--></div>`);
|
|
1009
|
+
} else $$renderer.push("<!--[-1-->");
|
|
1010
|
+
$$renderer.push(`<!--]-->`);
|
|
1011
|
+
});
|
|
1012
|
+
}
|
|
1013
|
+
function createBrowserEventSource(url) {
|
|
1014
|
+
return new EventSource(url);
|
|
1015
|
+
}
|
|
1016
|
+
/** Builds the `/api/stream` SSE URL for a target. `base` allows an absolute URL in tests. */
|
|
1017
|
+
function buildStreamUrl(target, base = "") {
|
|
1018
|
+
const search = new URLSearchParams();
|
|
1019
|
+
search.set("region", target.region);
|
|
1020
|
+
const groups = (target.groups ?? []).filter((name) => name.length > 0);
|
|
1021
|
+
if (groups.length > 1) search.set("groups", groups.join(","));
|
|
1022
|
+
else search.set("group", groups[0] ?? target.group);
|
|
1023
|
+
if (target.source === "archive") search.set("source", "archive");
|
|
1024
|
+
if (target.filterPattern) search.set("filterPattern", target.filterPattern);
|
|
1025
|
+
if (target.mode === "historic") {
|
|
1026
|
+
search.set("mode", "historic");
|
|
1027
|
+
if (target.range) search.set("range", target.range);
|
|
1028
|
+
if (target.from !== void 0 && target.from !== "") search.set("from", String(target.from));
|
|
1029
|
+
if (target.to !== void 0 && target.to !== "") search.set("to", String(target.to));
|
|
1030
|
+
} else if (target.mode === "live") search.set("mode", "live");
|
|
1031
|
+
if (target.startTime !== void 0 && target.startTime !== "") search.set("startTime", String(target.startTime));
|
|
1032
|
+
if (target.lookback) search.set("lookback", target.lookback);
|
|
1033
|
+
if (typeof target.poll === "number" && Number.isFinite(target.poll)) search.set("poll", String(target.poll));
|
|
1034
|
+
return `${base}/api/stream?${search.toString()}`;
|
|
1035
|
+
}
|
|
1036
|
+
/** Parses an SSE payload, returning `null` instead of throwing on malformed JSON. */
|
|
1037
|
+
function parsePayload(data) {
|
|
1038
|
+
try {
|
|
1039
|
+
return JSON.parse(data);
|
|
1040
|
+
} catch {
|
|
1041
|
+
return null;
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
/**
|
|
1045
|
+
* View over one log group: the live CloudWatch stream, or the local archive replay.
|
|
1046
|
+
*
|
|
1047
|
+
* Pause policy: pausing keeps the connection open and keeps receiving events; those events are
|
|
1048
|
+
* held in a pending buffer and flushed into the visible buffer on resume.
|
|
1049
|
+
*/
|
|
1050
|
+
var LogStream = class {
|
|
1051
|
+
/** Connection status shown by the status badge. */
|
|
1052
|
+
status = "idle";
|
|
1053
|
+
/** Last server-side or transport error, or `null`. */
|
|
1054
|
+
lastError = null;
|
|
1055
|
+
/** Payload of the last `ready` event. */
|
|
1056
|
+
ready = null;
|
|
1057
|
+
/** Current target, or `null` after `stop()`. */
|
|
1058
|
+
target = null;
|
|
1059
|
+
/** Visible log lines, oldest first, capped by the buffer capacity. */
|
|
1060
|
+
lines = [];
|
|
1061
|
+
/** Total number of events received since the last reset. */
|
|
1062
|
+
receivedCount = 0;
|
|
1063
|
+
/** Lines dropped because the visible buffer was full. */
|
|
1064
|
+
droppedCount = 0;
|
|
1065
|
+
/** Lines held back while paused. */
|
|
1066
|
+
pendingCount = 0;
|
|
1067
|
+
/** True when the visible buffer is frozen and events are buffered. */
|
|
1068
|
+
paused = false;
|
|
1069
|
+
/** Timestamp of the last `ping` or `log` event. */
|
|
1070
|
+
lastEventAt = null;
|
|
1071
|
+
/** Reason given by the last `end` event. */
|
|
1072
|
+
endReason = null;
|
|
1073
|
+
#store;
|
|
1074
|
+
#source = null;
|
|
1075
|
+
#listeners = [];
|
|
1076
|
+
#reconnectTimer = null;
|
|
1077
|
+
#createEventSource;
|
|
1078
|
+
#reconnectDelayMs;
|
|
1079
|
+
#url;
|
|
1080
|
+
#schedule;
|
|
1081
|
+
#cancel;
|
|
1082
|
+
constructor(options = {}) {
|
|
1083
|
+
this.#store = new LogStore(options.capacity ?? 5e3);
|
|
1084
|
+
this.#createEventSource = options.createEventSource ?? createBrowserEventSource;
|
|
1085
|
+
this.#reconnectDelayMs = options.reconnectDelayMs ?? 1e3;
|
|
1086
|
+
this.#url = options.url ?? ((target) => buildStreamUrl(target));
|
|
1087
|
+
this.#schedule = options.schedule ?? ((callback, delayMs) => setTimeout(callback, delayMs));
|
|
1088
|
+
this.#cancel = options.cancel ?? ((handle) => clearTimeout(handle));
|
|
1089
|
+
}
|
|
1090
|
+
/** Starts tailing a target, replacing any previous stream and clearing the buffer. */
|
|
1091
|
+
start(target) {
|
|
1092
|
+
this.#closeSource();
|
|
1093
|
+
this.#clearReconnect();
|
|
1094
|
+
this.clear();
|
|
1095
|
+
this.status = "connecting";
|
|
1096
|
+
this.lastError = null;
|
|
1097
|
+
this.ready = null;
|
|
1098
|
+
this.endReason = null;
|
|
1099
|
+
this.target = { ...target };
|
|
1100
|
+
this.#connect(false);
|
|
1101
|
+
}
|
|
1102
|
+
/** Stops tailing and forgets the target; the buffered lines stay visible. */
|
|
1103
|
+
stop() {
|
|
1104
|
+
this.#clearReconnect();
|
|
1105
|
+
this.#closeSource();
|
|
1106
|
+
this.target = null;
|
|
1107
|
+
this.status = "idle";
|
|
1108
|
+
}
|
|
1109
|
+
/** Freezes the visible buffer; incoming events are held until {@link resume}. */
|
|
1110
|
+
pause() {
|
|
1111
|
+
this.#store.pause();
|
|
1112
|
+
this.paused = true;
|
|
1113
|
+
}
|
|
1114
|
+
/** Thaws the visible buffer and flushes the events held while paused. */
|
|
1115
|
+
resume() {
|
|
1116
|
+
this.#store.resume();
|
|
1117
|
+
this.paused = false;
|
|
1118
|
+
this.#syncStore();
|
|
1119
|
+
}
|
|
1120
|
+
/** Pauses or resumes, depending on the current state. */
|
|
1121
|
+
togglePause() {
|
|
1122
|
+
if (this.paused) this.resume();
|
|
1123
|
+
else this.pause();
|
|
1124
|
+
}
|
|
1125
|
+
/** Empties the visible buffer, the pending buffer and the counters. */
|
|
1126
|
+
clear() {
|
|
1127
|
+
this.#store.clear();
|
|
1128
|
+
this.paused = false;
|
|
1129
|
+
this.lines = [];
|
|
1130
|
+
this.receivedCount = 0;
|
|
1131
|
+
this.droppedCount = 0;
|
|
1132
|
+
this.pendingCount = 0;
|
|
1133
|
+
}
|
|
1134
|
+
/** Number of visible lines. */
|
|
1135
|
+
get size() {
|
|
1136
|
+
return this.#store.size;
|
|
1137
|
+
}
|
|
1138
|
+
/** Opens a connection for the current target. */
|
|
1139
|
+
#connect(retry) {
|
|
1140
|
+
const target = this.target;
|
|
1141
|
+
if (target === null) return;
|
|
1142
|
+
this.#closeSource();
|
|
1143
|
+
this.status = retry ? "reconnecting" : "connecting";
|
|
1144
|
+
let source;
|
|
1145
|
+
try {
|
|
1146
|
+
source = this.#createEventSource(this.#url(target));
|
|
1147
|
+
} catch (error) {
|
|
1148
|
+
this.status = "error";
|
|
1149
|
+
this.lastError = { message: error instanceof Error ? error.message : String(error) };
|
|
1150
|
+
return;
|
|
1151
|
+
}
|
|
1152
|
+
this.#source = source;
|
|
1153
|
+
this.#listen(source, "open", () => {
|
|
1154
|
+
this.status = "live";
|
|
1155
|
+
this.lastError = null;
|
|
1156
|
+
});
|
|
1157
|
+
this.#listen(source, "error", (event) => this.#handleErrorEvent(event));
|
|
1158
|
+
this.#listen(source, "ready", (event) => this.#handleReady(event));
|
|
1159
|
+
this.#listen(source, "log", (event) => this.#handleLog(event));
|
|
1160
|
+
this.#listen(source, "ping", (event) => this.#handlePing(event));
|
|
1161
|
+
this.#listen(source, "end", (event) => this.#handleEnd(event));
|
|
1162
|
+
}
|
|
1163
|
+
/** Registers a named-event listener and remembers it for cleanup. */
|
|
1164
|
+
#listen(source, type, handler) {
|
|
1165
|
+
source.addEventListener(type, handler);
|
|
1166
|
+
this.#listeners.push({
|
|
1167
|
+
source,
|
|
1168
|
+
type,
|
|
1169
|
+
handler
|
|
1170
|
+
});
|
|
1171
|
+
}
|
|
1172
|
+
/** Detaches listeners and closes the current connection. */
|
|
1173
|
+
#closeSource() {
|
|
1174
|
+
for (const listener of this.#listeners) listener.source.removeEventListener(listener.type, listener.handler);
|
|
1175
|
+
this.#listeners = [];
|
|
1176
|
+
this.#source?.close();
|
|
1177
|
+
this.#source = null;
|
|
1178
|
+
}
|
|
1179
|
+
/**
|
|
1180
|
+
* Handles every `error` event. A payload means the server reported a problem; an empty payload
|
|
1181
|
+
* means the connection dropped, which {@link #handleTransportError} deals with.
|
|
1182
|
+
*/
|
|
1183
|
+
#handleErrorEvent(event) {
|
|
1184
|
+
const data = typeof event.data === "string" ? event.data.trim() : "";
|
|
1185
|
+
if (data === "") {
|
|
1186
|
+
this.#handleTransportError();
|
|
1187
|
+
return;
|
|
1188
|
+
}
|
|
1189
|
+
this.lastError = parsePayload(data) ?? { message: data };
|
|
1190
|
+
this.status = "error";
|
|
1191
|
+
}
|
|
1192
|
+
/**
|
|
1193
|
+
* Handles a transport failure. While the source is still `CONNECTING` the browser keeps retrying
|
|
1194
|
+
* on its own; a `CLOSED` source is rebuilt after {@link LogStreamOptions.reconnectDelayMs}.
|
|
1195
|
+
*/
|
|
1196
|
+
#handleTransportError() {
|
|
1197
|
+
const source = this.#source;
|
|
1198
|
+
if (source === null) return;
|
|
1199
|
+
this.status = "reconnecting";
|
|
1200
|
+
if (source.readyState === 2) this.#scheduleReconnect();
|
|
1201
|
+
}
|
|
1202
|
+
/** Schedules one reconnect attempt, unless one is already pending. */
|
|
1203
|
+
#scheduleReconnect() {
|
|
1204
|
+
if (this.#reconnectTimer !== null) return;
|
|
1205
|
+
this.#reconnectTimer = this.#schedule(() => {
|
|
1206
|
+
this.#reconnectTimer = null;
|
|
1207
|
+
if (this.target !== null) this.#connect(true);
|
|
1208
|
+
}, this.#reconnectDelayMs);
|
|
1209
|
+
}
|
|
1210
|
+
/** Drops a pending reconnect attempt. */
|
|
1211
|
+
#clearReconnect() {
|
|
1212
|
+
if (this.#reconnectTimer === null) return;
|
|
1213
|
+
this.#cancel(this.#reconnectTimer);
|
|
1214
|
+
this.#reconnectTimer = null;
|
|
1215
|
+
}
|
|
1216
|
+
/** Marks the stream as live after receiving data. */
|
|
1217
|
+
#markLive() {
|
|
1218
|
+
this.lastEventAt = Date.now();
|
|
1219
|
+
if (this.status !== "ended") this.status = "live";
|
|
1220
|
+
}
|
|
1221
|
+
/** Copies buffer state onto the reactive fields. */
|
|
1222
|
+
#syncStore() {
|
|
1223
|
+
this.lines = this.#store.toArray();
|
|
1224
|
+
this.pendingCount = this.#store.pendingCount;
|
|
1225
|
+
this.droppedCount = this.#store.droppedCount;
|
|
1226
|
+
}
|
|
1227
|
+
#handleReady(event) {
|
|
1228
|
+
const payload = parsePayload(event.data);
|
|
1229
|
+
if (payload !== null) this.ready = payload;
|
|
1230
|
+
this.#markLive();
|
|
1231
|
+
}
|
|
1232
|
+
#handleLog(event) {
|
|
1233
|
+
const payload = parsePayload(event.data);
|
|
1234
|
+
const events = payload !== null && Array.isArray(payload.events) ? payload.events : [];
|
|
1235
|
+
if (events.length === 0) return;
|
|
1236
|
+
this.#store.push(events);
|
|
1237
|
+
this.#syncStore();
|
|
1238
|
+
this.receivedCount += events.length;
|
|
1239
|
+
this.#markLive();
|
|
1240
|
+
}
|
|
1241
|
+
#handlePing(event) {
|
|
1242
|
+
const payload = parsePayload(event.data);
|
|
1243
|
+
this.lastEventAt = payload?.at ?? Date.now();
|
|
1244
|
+
if (this.status !== "ended") this.status = "live";
|
|
1245
|
+
}
|
|
1246
|
+
#handleEnd(event) {
|
|
1247
|
+
const payload = parsePayload(event.data);
|
|
1248
|
+
this.endReason = payload?.reason ?? null;
|
|
1249
|
+
this.status = "ended";
|
|
1250
|
+
this.#clearReconnect();
|
|
1251
|
+
this.#closeSource();
|
|
1252
|
+
}
|
|
1253
|
+
};
|
|
1254
|
+
//#endregion
|
|
1255
|
+
//#region src/routes/+page.svelte
|
|
1256
|
+
function _page($$renderer, $$props) {
|
|
1257
|
+
$$renderer.component(($$renderer) => {
|
|
1258
|
+
/** Owns the SSE connection; the page only wires it to the UI. */
|
|
1259
|
+
const stream = new LogStream();
|
|
1260
|
+
/** Region picker state. Seeded from the URL so a shared link restores the view. */
|
|
1261
|
+
let region = page.url.searchParams.get("region") ?? "";
|
|
1262
|
+
/**
|
|
1263
|
+
* Where the view reads from, seeded from the URL. `archive` is only offered while the local
|
|
1264
|
+
* DuckDB archive reports `available: true`, so the fallback below is applied during bootstrap.
|
|
1265
|
+
*/
|
|
1266
|
+
let source = page.url.searchParams.get("source") === "archive" ? "archive" : "cloudwatch";
|
|
1267
|
+
/** Tail mode and historic window, seeded from the URL; bootstrap forces historic for the archive. */
|
|
1268
|
+
let mode = page.url.searchParams.get("mode") === "historic" ? "historic" : "live";
|
|
1269
|
+
let range = page.url.searchParams.get("range") ?? "15m";
|
|
1270
|
+
let windowFrom = parseUrlEpoch(page.url.searchParams.get("from"));
|
|
1271
|
+
let windowTo = parseUrlEpoch(page.url.searchParams.get("to"));
|
|
1272
|
+
let rangeLoading = false;
|
|
1273
|
+
let regions = [...DEFAULT_REGIONS];
|
|
1274
|
+
let groups = [];
|
|
1275
|
+
let groupsLoading = false;
|
|
1276
|
+
let groupsError = null;
|
|
1277
|
+
let endpoint = null;
|
|
1278
|
+
let filter = "";
|
|
1279
|
+
let autoScroll = true;
|
|
1280
|
+
/**
|
|
1281
|
+
* Log groups in the view, seeded from the URL. One entry is the normal case;
|
|
1282
|
+
* more than one tails them together and adds a group column.
|
|
1283
|
+
*/
|
|
1284
|
+
let selectedGroups = parseUrlGroups(page.url.searchParams);
|
|
1285
|
+
/** Primary group: the one the viewer names the view after. */
|
|
1286
|
+
let selectedGroup = derived(() => selectedGroups[0] ?? null);
|
|
1287
|
+
/** Level filter shared by the log view and the chart. */
|
|
1288
|
+
let levelFilter = null;
|
|
1289
|
+
/**
|
|
1290
|
+
* Group lines by request id, in the log view and in the chart.
|
|
1291
|
+
*
|
|
1292
|
+
* On by default: an incident is read as requests, not as the lines they wrote.
|
|
1293
|
+
* A stored preference wins, so a reader who wants every line keeps every line.
|
|
1294
|
+
*/
|
|
1295
|
+
let groupRequests = true;
|
|
1296
|
+
/** Bucketed counts behind the chart. */
|
|
1297
|
+
let seriesPoints = [];
|
|
1298
|
+
/** True while the archive counts are being fetched. */
|
|
1299
|
+
let seriesLoading = false;
|
|
1300
|
+
/** True only when the local archive reports that it can be read. */
|
|
1301
|
+
let archiveAvailable = derived(() => false);
|
|
1302
|
+
/** Database file behind the archive, or `null` when it is unknown. */
|
|
1303
|
+
let archivePath = derived(() => null);
|
|
1304
|
+
/** Tooltip of the archive badge in the header. */
|
|
1305
|
+
let archiveTitle = derived(() => describeArchive(archivePath()));
|
|
1306
|
+
/** Sidebar width in pixels; the layout default is 22rem. */
|
|
1307
|
+
let sidebarPx = remToPx(SIDEBAR_WIDTH.defaultRem);
|
|
1308
|
+
/** Largest sidebar width allowed: 44vw, but never below the minimum. */
|
|
1309
|
+
let sidebarMaxPx = derived(() => remToPx(SIDEBAR_WIDTH.defaultRem));
|
|
1310
|
+
let sidebarMinPx = remToPx(SIDEBAR_WIDTH.minRem);
|
|
1311
|
+
let sidebarStyle = derived(() => `width: min(${sidebarPx}px, ${SIDEBAR_WIDTH.maxVw}vw)`);
|
|
1312
|
+
/** Persists the sidebar width; failures are ignored (private mode, quota). */
|
|
1313
|
+
function saveSidebarWidth() {
|
|
1314
|
+
try {
|
|
1315
|
+
if (typeof localStorage === "undefined") return;
|
|
1316
|
+
localStorage.setItem(STORAGE_KEYS.sidebarWidth, String(Math.round(sidebarPx)));
|
|
1317
|
+
} catch {}
|
|
1318
|
+
}
|
|
1319
|
+
/**
|
|
1320
|
+
* Loads the log groups of a region from the active source; a newer region or source change wins
|
|
1321
|
+
* the race. The CloudWatch URL is left exactly as it was, so only the archive names its source.
|
|
1322
|
+
*/
|
|
1323
|
+
async function loadGroups(target) {
|
|
1324
|
+
groupsLoading = true;
|
|
1325
|
+
groupsError = null;
|
|
1326
|
+
const requestedSource = source;
|
|
1327
|
+
const query = requestedSource === "archive" ? {
|
|
1328
|
+
region: target,
|
|
1329
|
+
source: requestedSource
|
|
1330
|
+
} : { region: target };
|
|
1331
|
+
try {
|
|
1332
|
+
const response = await fetchLogGroups(query);
|
|
1333
|
+
if (target !== region || requestedSource !== source) return;
|
|
1334
|
+
if (response.endpoint !== null) endpoint = response.endpoint;
|
|
1335
|
+
groups = response.groups;
|
|
1336
|
+
} catch (error) {
|
|
1337
|
+
if (target !== region || requestedSource !== source) return;
|
|
1338
|
+
groups = [];
|
|
1339
|
+
groupsError = describeGroupsError(target, error);
|
|
1340
|
+
} finally {
|
|
1341
|
+
if (target === region && requestedSource === source) groupsLoading = false;
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
/** Parses an epoch-millisecond URL parameter, or `null`. */
|
|
1345
|
+
function parseUrlEpoch(value) {
|
|
1346
|
+
if (value === null || value.trim() === "") return null;
|
|
1347
|
+
const parsed = Number(value);
|
|
1348
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
1349
|
+
}
|
|
1350
|
+
/** The window the current mode asks for. The archive is always a historic window. */
|
|
1351
|
+
function windowParams() {
|
|
1352
|
+
if (mode === "live" && source !== "archive") return { mode: "live" };
|
|
1353
|
+
if (range === "" && windowFrom !== null && windowTo !== null) return {
|
|
1354
|
+
mode: "historic",
|
|
1355
|
+
from: windowFrom,
|
|
1356
|
+
to: windowTo
|
|
1357
|
+
};
|
|
1358
|
+
return {
|
|
1359
|
+
mode: "historic",
|
|
1360
|
+
range: range === "" ? "15m" : range
|
|
1361
|
+
};
|
|
1362
|
+
}
|
|
1363
|
+
/** Stream target for the active source, region, groups and window. */
|
|
1364
|
+
function streamTarget() {
|
|
1365
|
+
const window = windowParams();
|
|
1366
|
+
const [primary, ...rest] = selectedGroups;
|
|
1367
|
+
const target = {
|
|
1368
|
+
region,
|
|
1369
|
+
group: primary ?? "",
|
|
1370
|
+
groups: [...selectedGroups],
|
|
1371
|
+
...window
|
|
1372
|
+
};
|
|
1373
|
+
if (source === "archive") target.source = "archive";
|
|
1374
|
+
return target;
|
|
1375
|
+
}
|
|
1376
|
+
/** Applies a mode or range change: restarts the stream and mirrors it into the URL. */
|
|
1377
|
+
function applyRange(payload) {
|
|
1378
|
+
if (source === "archive" && payload.mode === "live") return;
|
|
1379
|
+
mode = payload.mode;
|
|
1380
|
+
range = payload.range;
|
|
1381
|
+
windowFrom = payload.from;
|
|
1382
|
+
windowTo = payload.to;
|
|
1383
|
+
syncUrl(region, selectedGroups);
|
|
1384
|
+
if (selectedGroups.length === 0) return;
|
|
1385
|
+
rangeLoading = payload.mode === "historic";
|
|
1386
|
+
stream.start(streamTarget());
|
|
1387
|
+
loadSeries();
|
|
1388
|
+
}
|
|
1389
|
+
/**
|
|
1390
|
+
* Applies a brushed range from the chart as the new historic window, which
|
|
1391
|
+
* re-scopes the log view to exactly what was brushed.
|
|
1392
|
+
*/
|
|
1393
|
+
function applyBrush(selection) {
|
|
1394
|
+
if (selection === null) return;
|
|
1395
|
+
const window = chartWindow();
|
|
1396
|
+
if (!isMeaningfulBrush(selection, window, chartBucketMs(window.from, window.to))) return;
|
|
1397
|
+
applyRange({
|
|
1398
|
+
mode: "historic",
|
|
1399
|
+
range: "",
|
|
1400
|
+
from: selection.from,
|
|
1401
|
+
to: selection.to
|
|
1402
|
+
});
|
|
1403
|
+
}
|
|
1404
|
+
/** Turns request grouping on or off, and remembers the choice. */
|
|
1405
|
+
function toggleGroupRequests() {
|
|
1406
|
+
groupRequests = !groupRequests;
|
|
1407
|
+
try {
|
|
1408
|
+
localStorage?.setItem(STORAGE_KEYS.groupRequests, groupRequests ? "true" : "false");
|
|
1409
|
+
} catch {}
|
|
1410
|
+
}
|
|
1411
|
+
/** Switches region: stops the stream, clears the list and reloads the groups. */
|
|
1412
|
+
function changeRegion(next) {
|
|
1413
|
+
if (next === "" || next === region) return;
|
|
1414
|
+
region = next;
|
|
1415
|
+
stream.stop();
|
|
1416
|
+
groups = [];
|
|
1417
|
+
selectedGroups = [];
|
|
1418
|
+
seriesPoints = [];
|
|
1419
|
+
syncUrl(next, []);
|
|
1420
|
+
loadGroups(next);
|
|
1421
|
+
}
|
|
1422
|
+
/** Replaces the view parameters in the address bar. */
|
|
1423
|
+
function syncUrl(nextRegion, nextGroups) {
|
|
1424
|
+
const url = new URL(page.url);
|
|
1425
|
+
if (nextRegion === "") url.searchParams.delete("region");
|
|
1426
|
+
else url.searchParams.set("region", nextRegion);
|
|
1427
|
+
if (source === "archive") url.searchParams.set("source", "archive");
|
|
1428
|
+
else url.searchParams.delete("source");
|
|
1429
|
+
url.searchParams.delete("group");
|
|
1430
|
+
url.searchParams.delete("groups");
|
|
1431
|
+
const names = nextGroups.filter((name) => name.length > 0);
|
|
1432
|
+
if (names.length === 1) url.searchParams.set("group", names[0]);
|
|
1433
|
+
else if (names.length > 1) url.searchParams.set("groups", names.join(","));
|
|
1434
|
+
if (mode === "live") {
|
|
1435
|
+
url.searchParams.delete("mode");
|
|
1436
|
+
url.searchParams.delete("range");
|
|
1437
|
+
url.searchParams.delete("from");
|
|
1438
|
+
url.searchParams.delete("to");
|
|
1439
|
+
} else {
|
|
1440
|
+
url.searchParams.set("mode", "historic");
|
|
1441
|
+
url.searchParams.delete("from");
|
|
1442
|
+
url.searchParams.delete("to");
|
|
1443
|
+
url.searchParams.delete("range");
|
|
1444
|
+
if (range === "" && windowFrom !== null && windowTo !== null) {
|
|
1445
|
+
url.searchParams.set("from", String(windowFrom));
|
|
1446
|
+
url.searchParams.set("to", String(windowTo));
|
|
1447
|
+
} else url.searchParams.set("range", range === "" ? "15m" : range);
|
|
1448
|
+
}
|
|
1449
|
+
if (url.href !== page.url.href) replaceState();
|
|
1450
|
+
}
|
|
1451
|
+
/** Clears the loading hint once the server reports its window. */
|
|
1452
|
+
/**
|
|
1453
|
+
* Keeps the chart in step with the view: a new window, selection, source, level
|
|
1454
|
+
* or a new batch of lines all re-load the counts.
|
|
1455
|
+
*/
|
|
1456
|
+
/**
|
|
1457
|
+
* Reacts to `archive-unavailable` from the stream (the file was locked or removed after boot) by
|
|
1458
|
+
* re-checking the archive, so the toggle hides itself instead of offering a source that fails.
|
|
1459
|
+
*/
|
|
1460
|
+
/** Parses the group selection from the URL, accepting both parameter shapes. */
|
|
1461
|
+
function parseUrlGroups(params) {
|
|
1462
|
+
const names = (params.get("groups") ?? "").split(",").map((name) => name.trim()).filter((name) => name.length > 0);
|
|
1463
|
+
if (names.length > 0) return [...new Set(names)];
|
|
1464
|
+
const single = params.get("group")?.trim() ?? "";
|
|
1465
|
+
return single.length > 0 ? [single] : [];
|
|
1466
|
+
}
|
|
1467
|
+
/** Bucket width for the chart of one window, mirroring the server's choice. */
|
|
1468
|
+
function chartBucketMs(from, to) {
|
|
1469
|
+
const span = Math.max(1, to - from);
|
|
1470
|
+
return [
|
|
1471
|
+
1e3,
|
|
1472
|
+
5e3,
|
|
1473
|
+
1e4,
|
|
1474
|
+
3e4,
|
|
1475
|
+
6e4,
|
|
1476
|
+
3e5,
|
|
1477
|
+
9e5,
|
|
1478
|
+
18e5
|
|
1479
|
+
].find((step) => span / step <= 90) ?? 36e5;
|
|
1480
|
+
}
|
|
1481
|
+
/** Window the chart describes: the active historic window, or a rolling quarter hour. */
|
|
1482
|
+
function chartWindow() {
|
|
1483
|
+
if (mode === "historic") {
|
|
1484
|
+
const to = windowTo ?? stream.ready?.endTime ?? Date.now();
|
|
1485
|
+
const from = windowFrom ?? stream.ready?.startTime ?? to - 9e5;
|
|
1486
|
+
return {
|
|
1487
|
+
from: Math.min(from, to - 1e3),
|
|
1488
|
+
to
|
|
1489
|
+
};
|
|
1490
|
+
}
|
|
1491
|
+
const to = Date.now();
|
|
1492
|
+
return {
|
|
1493
|
+
from: to - 9e5,
|
|
1494
|
+
to
|
|
1495
|
+
};
|
|
1496
|
+
}
|
|
1497
|
+
/**
|
|
1498
|
+
* Loads the counts behind the chart.
|
|
1499
|
+
*
|
|
1500
|
+
* The archive can count a whole window in one statement, so it is asked for
|
|
1501
|
+
* them; a CloudWatch view has no aggregate endpoint, so the events already
|
|
1502
|
+
* streamed are bucketed here. Both end up as the same points.
|
|
1503
|
+
*/
|
|
1504
|
+
async function loadSeries() {
|
|
1505
|
+
if (selectedGroups.length === 0 || region === "") {
|
|
1506
|
+
seriesPoints = [];
|
|
1507
|
+
return;
|
|
1508
|
+
}
|
|
1509
|
+
const { from, to } = chartWindow();
|
|
1510
|
+
if (source !== "archive") {
|
|
1511
|
+
seriesPoints = bucketEvents(stream.lines, {
|
|
1512
|
+
from,
|
|
1513
|
+
to,
|
|
1514
|
+
bucketMs: chartBucketMs(from, to),
|
|
1515
|
+
level: levelFilter,
|
|
1516
|
+
fallbackGroup: selectedGroup() ?? "",
|
|
1517
|
+
byRequest: groupRequests
|
|
1518
|
+
});
|
|
1519
|
+
return;
|
|
1520
|
+
}
|
|
1521
|
+
seriesLoading = true;
|
|
1522
|
+
try {
|
|
1523
|
+
seriesPoints = (await fetchSeries({
|
|
1524
|
+
region,
|
|
1525
|
+
groups: selectedGroups,
|
|
1526
|
+
from,
|
|
1527
|
+
to,
|
|
1528
|
+
levels: levelFilter === null ? [] : [levelFilter],
|
|
1529
|
+
by: groupRequests ? "request" : "event"
|
|
1530
|
+
})).points;
|
|
1531
|
+
} catch {
|
|
1532
|
+
seriesPoints = [];
|
|
1533
|
+
} finally {
|
|
1534
|
+
seriesLoading = false;
|
|
1535
|
+
}
|
|
1536
|
+
}
|
|
1537
|
+
$$renderer.push(`<div class="flex flex-wrap items-center gap-x-3 gap-y-2"><span class="text-[0.6875rem] font-semibold uppercase tracking-wider text-neutral-500">Watching</span> <span class="max-w-[22rem] truncate rounded-md border border-neutral-800 bg-neutral-900 px-2 py-1 font-mono text-xs text-neutral-200">${escape_html(selectedGroup() ?? "no group selected")}</span> <span class="text-xs text-neutral-500">in</span> <span class="font-mono text-xs text-neutral-300">${escape_html(region === "" ? "resolving region…" : region)}</span> `);
|
|
1538
|
+
if (source === "archive") {
|
|
1539
|
+
$$renderer.push("<!--[0-->");
|
|
1540
|
+
EndpointBadge($$renderer, {
|
|
1541
|
+
endpoint: null,
|
|
1542
|
+
credentials: null
|
|
1543
|
+
});
|
|
1544
|
+
$$renderer.push(`<!----> <span data-testid="archive-source-badge"${attr("title", archiveTitle())} class="rounded-full border border-teal-900 bg-teal-950/60 px-2.5 py-1 text-xs font-medium text-teal-300">local archive</span>`);
|
|
1545
|
+
} else {
|
|
1546
|
+
$$renderer.push("<!--[-1-->");
|
|
1547
|
+
EndpointBadge($$renderer, {
|
|
1548
|
+
endpoint,
|
|
1549
|
+
credentials: null
|
|
1550
|
+
});
|
|
1551
|
+
}
|
|
1552
|
+
$$renderer.push(`<!--]--> `);
|
|
1553
|
+
$$renderer.push("<!--[-1-->");
|
|
1554
|
+
$$renderer.push(`<!--]--></div> `);
|
|
1555
|
+
$$renderer.push("<!--[-1-->");
|
|
1556
|
+
$$renderer.push(`<!--]--> `);
|
|
1557
|
+
RangeControls($$renderer, {
|
|
1558
|
+
mode,
|
|
1559
|
+
range,
|
|
1560
|
+
from: windowFrom,
|
|
1561
|
+
to: windowTo,
|
|
1562
|
+
loading: rangeLoading,
|
|
1563
|
+
disabled: selectedGroup() === null,
|
|
1564
|
+
liveDisabled: source === "archive"});
|
|
1565
|
+
$$renderer.push(`<!----> <div class="flex min-h-0 min-w-0 flex-1 flex-col gap-3 lg:flex-row"><div class="flex min-h-0 w-full flex-col gap-3 rounded-lg border border-neutral-800 bg-neutral-950/60 p-3 lg:shrink-0"${attr_style(sidebarStyle())} data-testid="sidebar">`);
|
|
1566
|
+
SourceControls($$renderer, {
|
|
1567
|
+
source,
|
|
1568
|
+
archiveAvailable: archiveAvailable(),
|
|
1569
|
+
archivePath: archivePath()});
|
|
1570
|
+
$$renderer.push(`<!----> `);
|
|
1571
|
+
RegionSelect($$renderer, {
|
|
1572
|
+
regions,
|
|
1573
|
+
value: region,
|
|
1574
|
+
onchange: changeRegion
|
|
1575
|
+
});
|
|
1576
|
+
$$renderer.push(`<!----> `);
|
|
1577
|
+
LogGroupList($$renderer, {
|
|
1578
|
+
groups,
|
|
1579
|
+
source,
|
|
1580
|
+
region,
|
|
1581
|
+
selected: selectedGroups,
|
|
1582
|
+
loading: groupsLoading,
|
|
1583
|
+
error: groupsError});
|
|
1584
|
+
$$renderer.push(`<!----></div> `);
|
|
1585
|
+
ColumnResizer($$renderer, {
|
|
1586
|
+
label: "Resize group list",
|
|
1587
|
+
width: sidebarPx,
|
|
1588
|
+
min: sidebarMinPx,
|
|
1589
|
+
max: sidebarMaxPx(),
|
|
1590
|
+
testId: "sidebar-resizer",
|
|
1591
|
+
onChange: (next) => sidebarPx = next,
|
|
1592
|
+
onCommit: () => saveSidebarWidth(),
|
|
1593
|
+
class: "hidden lg:block lg:w-2"
|
|
1594
|
+
});
|
|
1595
|
+
$$renderer.push(`<!----> <div class="flex min-h-0 min-w-0 flex-1 flex-col">`);
|
|
1596
|
+
EventScatterPanel($$renderer, {
|
|
1597
|
+
points: seriesPoints,
|
|
1598
|
+
from: chartWindow().from,
|
|
1599
|
+
to: chartWindow().to,
|
|
1600
|
+
bucketMs: chartBucketMs(chartWindow().from, chartWindow().to),
|
|
1601
|
+
groups: selectedGroups,
|
|
1602
|
+
byRequest: groupRequests,
|
|
1603
|
+
loading: seriesLoading,
|
|
1604
|
+
onBrush: applyBrush
|
|
1605
|
+
});
|
|
1606
|
+
$$renderer.push(`<!----> `);
|
|
1607
|
+
if (windowFrom !== null && windowTo !== null && mode === "historic") $$renderer.push(`<!--[0--><div class="flex flex-wrap items-center gap-2 text-[0.6875rem] text-neutral-500"><span data-testid="brush-window">zoomed to ${escape_html(new Date(windowFrom).toLocaleTimeString())} – ${escape_html(new Date(windowTo).toLocaleTimeString())}</span> <button type="button" data-testid="brush-clear" class="rounded-md border border-neutral-800 bg-neutral-900 px-2 py-0.5 font-medium text-neutral-300 transition-colors hover:border-neutral-700 hover:text-neutral-100">Reset zoom</button></div>`);
|
|
1608
|
+
else $$renderer.push("<!--[-1-->");
|
|
1609
|
+
$$renderer.push(`<!--]--> `);
|
|
1610
|
+
LogViewer($$renderer, {
|
|
1611
|
+
lines: stream.lines,
|
|
1612
|
+
status: stream.status,
|
|
1613
|
+
error: stream.lastError,
|
|
1614
|
+
mode,
|
|
1615
|
+
ready: stream.ready,
|
|
1616
|
+
endReason: stream.endReason,
|
|
1617
|
+
archivePath: archivePath(),
|
|
1618
|
+
region,
|
|
1619
|
+
group: selectedGroup(),
|
|
1620
|
+
groups: selectedGroups,
|
|
1621
|
+
level: levelFilter,
|
|
1622
|
+
onLevelChange: (next) => levelFilter = next,
|
|
1623
|
+
groupRequests,
|
|
1624
|
+
onGroupToggle: toggleGroupRequests,
|
|
1625
|
+
filter,
|
|
1626
|
+
paused: stream.paused,
|
|
1627
|
+
autoScroll,
|
|
1628
|
+
pendingCount: stream.pendingCount,
|
|
1629
|
+
droppedCount: stream.droppedCount,
|
|
1630
|
+
receivedCount: stream.receivedCount,
|
|
1631
|
+
onFilterChange: (value) => filter = value,
|
|
1632
|
+
onPauseToggle: () => stream.togglePause(),
|
|
1633
|
+
onClear: () => stream.clear(),
|
|
1634
|
+
onAutoScrollToggle: () => autoScroll = !autoScroll
|
|
1635
|
+
});
|
|
1636
|
+
$$renderer.push(`<!----></div></div>`);
|
|
1637
|
+
});
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
export { _page as default };
|
|
1641
|
+
//# sourceMappingURL=_page.svelte.js-qqtU0apo.js.map
|