From b2523cde3b67ff2970de847d115b743b5d17cd57 Mon Sep 17 00:00:00 2001 From: SuperCoolYun Date: Thu, 11 Jul 2024 10:32:44 -0400 Subject: [PATCH] tree-poke err handling started --- .../std/src/con/http-request-tree-diff.hoon | 6 +- .../cod/std/src/imp/tree-eyre-handler.hoon | 78 +++++++++++++------ pkg/arvo/neo/cod/std/src/imp/tree.hoon | 15 +++- pkg/arvo/neo/cod/std/src/pro/tree-diff.hoon | 2 +- 4 files changed, 74 insertions(+), 27 deletions(-) diff --git a/pkg/arvo/neo/cod/std/src/con/http-request-tree-diff.hoon b/pkg/arvo/neo/cod/std/src/con/http-request-tree-diff.hoon index a069fdb857..df6f3cd40a 100644 --- a/pkg/arvo/neo/cod/std/src/con/http-request-tree-diff.hoon +++ b/pkg/arvo/neo/cod/std/src/con/http-request-tree-diff.hoon @@ -10,8 +10,10 @@ ?+ head ~| [%unknown-head head] !! %send-poke =/ =path (stab (got:bod 'pith')) - =/ =stud:neo `@tas`(got:bod 'stud') + =/ =stud:neo !<(@tas (slap !>(~) (ream (got:bod 'stud')))) ~& > got-bod-vase/(got:bod 'vase') + ?~ (rush (got:bod 'vase') vest) + [head (pave:neo path) %vase-error !>(~)] =/ vax=vase (slap !>(.) (ream (got:bod 'vase'))) [head (pave:neo path) stud vax] :: @@ -19,4 +21,4 @@ ~& >>> pith/(got:bod 'pith') =/ path (stab (got:bod 'pith')) [head (pave:neo path)] -== \ No newline at end of file +== \ No newline at end of file diff --git a/pkg/arvo/neo/cod/std/src/imp/tree-eyre-handler.hoon b/pkg/arvo/neo/cod/std/src/imp/tree-eyre-handler.hoon index a4a1a346b1..8f9ee359cf 100644 --- a/pkg/arvo/neo/cod/std/src/imp/tree-eyre-handler.hoon +++ b/pkg/arvo/neo/cod/std/src/imp/tree-eyre-handler.hoon @@ -58,6 +58,7 @@ =/ here p.u.src ^- (list card:neo) ?+ method.request.req ~|(%unsupported-http-method !!) + :: %'GET' ?~ reet=(~(get of:neo q.u.src) /) =/ bol *bowl:neo @@ -92,6 +93,7 @@ ['content-type' 'text/html']~ stub == + :: %'POST' =/ purl (parse-url:serv request.req) =/ content-type (~(gut by pam.purl) 'content-type' 'text/html') @@ -104,29 +106,54 @@ (http-request [poke-stud `request:http`request.req]) =/ diff-type !<(tree-diff diff-vase) ~& >> diff-type/diff-type - =/ cards=(list card:neo) - ?- -.diff-type - %send-poke - ~[(poke-tree-card our.bowl diff-vase)] - %send-tomb - =/ pax=pith:neo (tail (tail +.diff-type)) - =/ poke-card=(list card:neo) ~[(poke-tree-card our.bowl diff-vase)] - =/ kids (kids-to-card pax q.u.src our.bowl here) - ?~ kids poke-card - %+ welp (flop kids) poke-card - == =/ bol *bowl:neo =. here.bol here =. our.bol our.bowl =. now.bol now.bowl =. eny.bol eny.bowl - %+ welp cards - %: eyre-cards - eyre-id - bol - 200 - ['content-type' 'text/html']~ - del-stub + ?- -.diff-type + %send-poke + ?: =(stud.diff-type %vase-error) + =/ error-stub=manx + ;div.p2 + =style "color: red;" + ;span: failed to parse entered value to hoon + == + %: eyre-cards + eyre-id + bol + 200 + ['content-type' 'text/html']~ + error-stub + == + =/ poke-stub=manx + ;div.p2 + ;span: poking + == + %+ welp ~[(poke-tree-card our.bowl diff-vase)] + %: eyre-cards + eyre-id + bol + 200 + ['content-type' 'text/html']~ + poke-stub + == + %send-tomb + =/ pax=pith:neo (tail (tail +.diff-type)) + =/ poke-card=(list card:neo) ~[(poke-tree-card our.bowl diff-vase)] + =/ kids (kids-to-card pax q.u.src our.bowl here) + ?~ kids poke-card + ;: welp + (flop kids) + poke-card + %: eyre-cards + eyre-id + bol + 200 + ['content-type' 'text/html']~ + del-stub + == + == == == -- @@ -309,7 +336,14 @@ ; {(en-tape:pith:neo pith)} == ;div.loader.p2.hover.pointer - =style "grid-column: 3 ; grid-row: 1; justify-self: end; border: 2px solid black; border-radius: 6px;" + =style + """ + grid-column: 3; + grid-row: 1; + justify-self: end; + border: 2px solid black; + border-radius: 6px; + """ =onclick "$(this).next().toggleClass('hidden');" ;span.loaded: tomb ;span.loading: loading @@ -373,14 +407,14 @@ ^- manx ;form =hx-post "/neo/tree{(en-tape:pith:neo here.bowl)}?stud=tree-diff&head=send-poke" - =hx-target "find .loading" - =hx-swap "outerHTML" + :: =hx-target "find .loader" + =hx-swap "beforeend" ;input =type "text" =name "stud" =oninput "this.setAttribute('value', this.value);" =autocomplete "off" - =placeholder "diff-type" + =placeholder "%diff-type" =required "" ; == diff --git a/pkg/arvo/neo/cod/std/src/imp/tree.hoon b/pkg/arvo/neo/cod/std/src/imp/tree.hoon index 84d512c8f2..cbfb632c07 100644 --- a/pkg/arvo/neo/cod/std/src/imp/tree.hoon +++ b/pkg/arvo/neo/cod/std/src/imp/tree.hoon @@ -23,8 +23,19 @@ :: %ack :: ~& >> ack-vase-type/+.vase - :: ~& >> ack/!<((unit quit:neo) vase) - [~ tree/!>(~)] + :: ~& >> ack/!<((unit quit:neo) vase) + =/ =quit:neo (need !<((unit quit:neo) vase)) + ?+ -.quit [~ tree/!>(~)] + %goof + =/ =tang +.quit + :: send error trace back to eyre-handler + =/ trace + %+ turn tang + |= =tank + ~& > ~(ram re tank) + tank + [~ tree/!>(~)] + == :: %tree-diff =/ diff !<(tree-diff vase) diff --git a/pkg/arvo/neo/cod/std/src/pro/tree-diff.hoon b/pkg/arvo/neo/cod/std/src/pro/tree-diff.hoon index 457a53a44c..0097ea6ad8 100644 --- a/pkg/arvo/neo/cod/std/src/pro/tree-diff.hoon +++ b/pkg/arvo/neo/cod/std/src/pro/tree-diff.hoon @@ -1,4 +1,4 @@ $% - [%send-poke pith=pith:neo stud=stud:neo vase=vase] + [%send-poke =pith:neo =stud:neo =vase] [%send-tomb =pith:neo] == \ No newline at end of file