mirror of
https://github.com/urbit/shrub.git
synced 2024-11-28 05:22:27 +03:00
working on tomb shrub from tree, added POST req handling, pokes and altered tasks to recognise %del gift
This commit is contained in:
parent
87dbb1d4c0
commit
69719575f1
@ -1564,9 +1564,9 @@
|
|||||||
=. run
|
=. run
|
||||||
(emit (do-card #/[p/our.bowl]/srv/sky %make %sky-eyre ~ ~))
|
(emit (do-card #/[p/our.bowl]/srv/sky %make %sky-eyre ~ ~))
|
||||||
=. run
|
=. run
|
||||||
(emit (do-card #/[p/our.bowl]/srv/sky %make %tree ~ ~))
|
(emit (do-card #/[p/our.bowl]/tree %make %tree ~ ~))
|
||||||
=. run
|
=. run
|
||||||
(emit (do-card #/[p/our.bowl]/srv/sky %make %tree-eyre ~ ~))
|
(emit (do-card #/[p/our.bowl]/srv/tree %make %tree-eyre ~ ~))
|
||||||
run
|
run
|
||||||
++ pess |=(=post:neo (~(pith press post) %out))
|
++ pess |=(=post:neo (~(pith press post) %out))
|
||||||
++ clay-beak ^- path
|
++ clay-beak ^- path
|
||||||
|
17
pkg/arvo/neo/cod/std/src/con/http-request-tree-diff.hoon
Normal file
17
pkg/arvo/neo/cod/std/src/con/http-request-tree-diff.hoon
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
/@ http-request
|
||||||
|
/@ tree-diff
|
||||||
|
/- serv=sky-server
|
||||||
|
:- [%http-request %$ %tree-diff]
|
||||||
|
|= =http-request
|
||||||
|
^- tree-diff
|
||||||
|
=/ pam (~(uni by pam:(parse-url:serv http-request)) (parse-form-body:serv http-request))
|
||||||
|
=/ bod ~(. by pam)
|
||||||
|
=/ head (@tas (got:bod 'head'))
|
||||||
|
?+ head ~| [%unknown-head head] !!
|
||||||
|
%send-tomb
|
||||||
|
~& >>> pith/(got:bod 'pith')
|
||||||
|
=/ path (stab (got:bod 'pith'))
|
||||||
|
[head (pave:neo path)]
|
||||||
|
%send-poke
|
||||||
|
[head *pith:neo *@tas *]
|
||||||
|
==
|
@ -25,7 +25,6 @@
|
|||||||
%eyre-task
|
%eyre-task
|
||||||
=+ !<(=task:eyre:neo vax)
|
=+ !<(=task:eyre:neo vax)
|
||||||
=/ [eyre-id=@ta req=inbound-request:eyre] task
|
=/ [eyre-id=@ta req=inbound-request:eyre] task
|
||||||
?. =(['neo' 'sky' ~] (scag 2 (stab url.request.req))) ~|(not-a-sky-task/url.request.req !!)
|
|
||||||
?. authenticated.req
|
?. authenticated.req
|
||||||
=/ eyre=pith:neo #/[p/our.bowl]/$/eyre
|
=/ eyre=pith:neo #/[p/our.bowl]/$/eyre
|
||||||
:_ pail
|
:_ pail
|
||||||
|
@ -58,6 +58,15 @@
|
|||||||
=/ this !<(task state-vase)
|
=/ this !<(task state-vase)
|
||||||
?+ stud !!
|
?+ stud !!
|
||||||
%gift
|
%gift
|
||||||
|
::check if %del case from tree view
|
||||||
|
=/ =gift:neo !<(gift:neo vax)
|
||||||
|
=/ gift-card=[=pith:neo =loot:neo]
|
||||||
|
%+ snag 0
|
||||||
|
~(tap of:neo gift)
|
||||||
|
?: =(mode.loot.gift-card %del)
|
||||||
|
=/ i (find [pith.gift-card ~] order.this)
|
||||||
|
?~ i [~ task/!>(this)]
|
||||||
|
[~ task/!>(this(order (oust [(need i) 1] order.this)))]
|
||||||
::check if all kid tasks are done
|
::check if all kid tasks are done
|
||||||
=/ dun (check-kids bowl)
|
=/ dun (check-kids bowl)
|
||||||
[~ task/!>(this(done dun, kids-done dun))]
|
[~ task/!>(this(done dun, kids-done dun))]
|
||||||
@ -94,6 +103,7 @@
|
|||||||
?~ i `task/!>(this)
|
?~ i `task/!>(this)
|
||||||
:_ task/!>(this(order (oust [(need i) 1] order.this)))
|
:_ task/!>(this(order (oust [(need i) 1] order.this)))
|
||||||
:~ [(welp here.bowl pith.diff) [%tomb ~]]
|
:~ [(welp here.bowl pith.diff) [%tomb ~]]
|
||||||
|
[(welp here.bowl pith.diff) [%cull ~]]
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
%reorder
|
%reorder
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
/@ htmx-type=htmx
|
/@ htmx-type=htmx
|
||||||
|
/@ tree-diff
|
||||||
|
/- serv=sky-server
|
||||||
/* jquery
|
/* jquery
|
||||||
/* htmx-js
|
/* htmx-js
|
||||||
/* htmx-response-targets
|
/* htmx-response-targets
|
||||||
@ -13,17 +15,18 @@
|
|||||||
++ poke *(set stud:neo)
|
++ poke *(set stud:neo)
|
||||||
++ kids *kids:neo
|
++ kids *kids:neo
|
||||||
++ deps
|
++ deps
|
||||||
|
:: static dep to imp folder to create new shrub
|
||||||
%- ~(gas by *band:neo)
|
%- ~(gas by *band:neo)
|
||||||
:~ :- %src
|
:~ :- %src
|
||||||
^- fief:neo
|
^- fief:neo
|
||||||
:- req=|
|
:- req=|
|
||||||
^- quay:neo
|
^- quay:neo
|
||||||
:- [pro/%htmx ~]
|
:- [[%or pro/%htmx any/~ ~] ~]
|
||||||
^- (unit port:neo)
|
^- (unit port:neo)
|
||||||
:+ ~ %z
|
:+ ~ %z
|
||||||
%- ~(gas by *lads:neo)
|
%- ~(gas by *lads:neo)
|
||||||
:~ :- &
|
:~ :- &
|
||||||
`lash:neo`[any/~ ~]
|
`lash:neo`[[%or pro/%htmx any/~ ~] ~]
|
||||||
==
|
==
|
||||||
==
|
==
|
||||||
++ form
|
++ form
|
||||||
@ -39,6 +42,28 @@
|
|||||||
=+ !<([eyre-id=@ta req=inbound-request:eyre] vase)
|
=+ !<([eyre-id=@ta req=inbound-request:eyre] vase)
|
||||||
~& > req/req
|
~& > req/req
|
||||||
:_ [stud vase]
|
:_ [stud vase]
|
||||||
|
:: deps = band
|
||||||
|
:: band = (map term fief)
|
||||||
|
:: fief = [=deed =quay]
|
||||||
|
:: quay = (pair lash (unit port))
|
||||||
|
:: port = (pair dare lads)
|
||||||
|
:: lads = (map pish lash)
|
||||||
|
:: lash = [state=curb poke=(set stud)]
|
||||||
|
::
|
||||||
|
:: lore = (axal idea)
|
||||||
|
:: idea = [saga=(pair aeon pail) thru=(unit stud) pail]
|
||||||
|
:: saga = (pair aeon pail)
|
||||||
|
:: aeon = (pair ever oath)
|
||||||
|
:: ever - total shrub version
|
||||||
|
:: oath = (pair hash=@uvH seal=@uvH)
|
||||||
|
:: pail = (pair stud vase)
|
||||||
|
::
|
||||||
|
:: src - (unit (pair pith lore))
|
||||||
|
:: p.u.src - pith
|
||||||
|
:: q.u.src - lore
|
||||||
|
:: q.saga.idea.q.u.src - pail
|
||||||
|
:: ~(tap by q.u.q.quay.u.src)
|
||||||
|
:: q.q.pail
|
||||||
?~ src=(~(get by deps.bowl) %src)
|
?~ src=(~(get by deps.bowl) %src)
|
||||||
=/ stub=manx
|
=/ stub=manx
|
||||||
;div
|
;div
|
||||||
@ -51,7 +76,8 @@
|
|||||||
['content-type' 'text/html']~
|
['content-type' 'text/html']~
|
||||||
stub
|
stub
|
||||||
==
|
==
|
||||||
~& > src/p.u.src
|
:: ~& > src/p.u.src
|
||||||
|
:: ~& > all-deps/~(tap by deps)
|
||||||
=/ here p.u.src
|
=/ here p.u.src
|
||||||
^- (list card:neo)
|
^- (list card:neo)
|
||||||
?+ method.request.req ~|(%unsupported-http-method !!)
|
?+ method.request.req ~|(%unsupported-http-method !!)
|
||||||
@ -70,12 +96,19 @@
|
|||||||
['content-type' 'text/html']~
|
['content-type' 'text/html']~
|
||||||
stub
|
stub
|
||||||
==
|
==
|
||||||
|
:: get lash from dep and pass pokes to poke-form
|
||||||
|
:: from src
|
||||||
|
:: ~& >>>
|
||||||
|
:: %+ turn ~(tap of:neo q.u.src)
|
||||||
|
:: |= [=pith:neo =idea:neo]
|
||||||
|
:: pail/(sell q.pail.idea)
|
||||||
=/ bol *bowl:neo
|
=/ bol *bowl:neo
|
||||||
=. here.bol here
|
=. here.bol here
|
||||||
=. our.bol our.bowl
|
=. our.bol our.bowl
|
||||||
=. now.bol now.bowl
|
=. now.bol now.bowl
|
||||||
=. eny.bol eny.bowl
|
=. eny.bol eny.bowl
|
||||||
=. kids.bol q.u.src
|
=. kids.bol q.u.src
|
||||||
|
~& > pail/q.saga.u.reet
|
||||||
=/ stub=manx
|
=/ stub=manx
|
||||||
;div
|
;div
|
||||||
;+ (view bol)
|
;+ (view bol)
|
||||||
@ -87,6 +120,46 @@
|
|||||||
['content-type' 'text/html']~
|
['content-type' 'text/html']~
|
||||||
stub
|
stub
|
||||||
==
|
==
|
||||||
|
%'POST'
|
||||||
|
=/ purl (parse-url:serv request.req)
|
||||||
|
=/ content-type (~(gut by pam.purl) 'content-type' 'text/html')
|
||||||
|
=/ body (parse-body:serv request.req)
|
||||||
|
=/ poke-stud
|
||||||
|
^- stud:neo
|
||||||
|
~| %no-stud-specified
|
||||||
|
(~(got by pam.purl) 'stud')
|
||||||
|
~& >> poke-stud/poke-stud
|
||||||
|
=/ diff-vase
|
||||||
|
(http-request [poke-stud `request:http`request.req])
|
||||||
|
~& >>> diff-vase/diff-vase
|
||||||
|
=/ diff-type -:!<(tree-diff diff-vase)
|
||||||
|
=/ bol *bowl:neo
|
||||||
|
=. here.bol here
|
||||||
|
=. our.bol our.bowl
|
||||||
|
=. now.bol now.bowl
|
||||||
|
=. eny.bol eny.bowl
|
||||||
|
=/ stub=manx
|
||||||
|
:: ?+ diff-type
|
||||||
|
;div
|
||||||
|
;p: error
|
||||||
|
==
|
||||||
|
:: %send-poke
|
||||||
|
:: ;div
|
||||||
|
:: ;p: sent
|
||||||
|
:: ==
|
||||||
|
:: %send-tomb
|
||||||
|
:: ;div
|
||||||
|
:: ;p: deleted
|
||||||
|
:: ==
|
||||||
|
:: ==
|
||||||
|
:- [#/[p/our.bowl]/tree %poke %tree-diff diff-vase]
|
||||||
|
%: eyre-cards
|
||||||
|
eyre-id
|
||||||
|
bol
|
||||||
|
200
|
||||||
|
['content-type' 'text/html']~
|
||||||
|
stub
|
||||||
|
==
|
||||||
==
|
==
|
||||||
--
|
--
|
||||||
--
|
--
|
||||||
@ -151,10 +224,12 @@
|
|||||||
::only short paths
|
::only short paths
|
||||||
%+ sort
|
%+ sort
|
||||||
%+ skim ~(tap of:neo kids.bowl)
|
%+ skim ~(tap of:neo kids.bowl)
|
||||||
|=([=pith:neo *] =(1 (lent pith)))
|
|= [=pith:neo *]
|
||||||
|
=(1 (lent pith))
|
||||||
aor
|
aor
|
||||||
|= [=pith:neo *]
|
|= [=pith:neo *]
|
||||||
%- crip "[{(en-tape:pith:neo pith)}]"
|
%- crip
|
||||||
|
"[{(en-tape:pith:neo pith)}]"
|
||||||
=/ row-template=tape (join ' 1fr ' (weld "[first-row]" `tape`first-kids))
|
=/ row-template=tape (join ' 1fr ' (weld "[first-row]" `tape`first-kids))
|
||||||
;div
|
;div
|
||||||
=style "display: grid; grid-template-rows: {row-template}; grid-template-columns: auto; padding: 12px;"
|
=style "display: grid; grid-template-rows: {row-template}; grid-template-columns: auto; padding: 12px;"
|
||||||
@ -163,7 +238,17 @@
|
|||||||
;div.p2: none
|
;div.p2: none
|
||||||
=/ =pail:neo q.saga.u.node
|
=/ =pail:neo q.saga.u.node
|
||||||
;div
|
;div
|
||||||
=style "grid-column-start: 1; grid-column-end: 2; grid-row-start: first-row; grid-row-end: first-row; padding: 8px; border: 2px solid black;border-radius: 6px; margin-top: 1rem;"
|
=style
|
||||||
|
"""
|
||||||
|
grid-column-start: 1;
|
||||||
|
grid-column-end: 2;
|
||||||
|
grid-row-start: first-row;
|
||||||
|
grid-row-end: first-row;
|
||||||
|
padding: 8px;
|
||||||
|
border: 2px solid black;
|
||||||
|
border-radius: 6px;
|
||||||
|
margin-top: 1rem;
|
||||||
|
"""
|
||||||
;p: {<p.pail>}
|
;p: {<p.pail>}
|
||||||
;+ (state-print pail)
|
;+ (state-print pail)
|
||||||
==
|
==
|
||||||
@ -178,15 +263,31 @@
|
|||||||
=style "visibility: hidden"
|
=style "visibility: hidden"
|
||||||
nothing
|
nothing
|
||||||
==
|
==
|
||||||
~& > pith/pith
|
|
||||||
;div
|
;div
|
||||||
=style "grid-column-start: {(scow %ud +((lent pith)))}; grid-column-end: {(scow %ud (add 2 (lent pith)))}; grid-row-start: {(en-tape:pith:neo [-.pith ~])};grid-row-end: {(en-tape:pith:neo [-.pith ~])}; padding: 8px; border: 2px solid black;border-radius: 6px;margin-top: 1rem;"
|
=style "grid-column-start: {(scow %ud +((lent pith)))}; grid-column-end: {(scow %ud (add 2 (lent pith)))}; grid-row-start: {(en-tape:pith:neo [-.pith ~])};grid-row-end: {(en-tape:pith:neo [-.pith ~])}; padding: 8px; border: 2px solid black;border-radius: 6px;margin-top: 1rem;"
|
||||||
;h3: {(en-tape:pith:neo pith)}
|
;h3: {(en-tape:pith:neo pith)}
|
||||||
;+
|
;+ (tomb-button bowl pith)
|
||||||
=/ pal=pail:neo q.saga.idea
|
|
||||||
;div
|
;div
|
||||||
;h3: state
|
;h3: state
|
||||||
;+ (state-print pal)
|
;+ (state-print q.saga.idea)
|
||||||
|
;+ (poke-form pith)
|
||||||
|
==
|
||||||
|
==
|
||||||
|
==
|
||||||
|
::
|
||||||
|
++ state-print
|
||||||
|
|= =pail:neo
|
||||||
|
^- manx
|
||||||
|
;div.pre.mono.scroll-x.p2
|
||||||
|
;+ ;/
|
||||||
|
=/ size (met 3 (jam q.q.pail))
|
||||||
|
?: (gth size 750) "vase too large to print: {<size>}"
|
||||||
|
(of-wall:format (~(win re (sell q.pail)) 0 80))
|
||||||
|
==
|
||||||
|
::
|
||||||
|
++ poke-form
|
||||||
|
|= =pith:neo
|
||||||
|
^- manx
|
||||||
;form
|
;form
|
||||||
=hx-post "/neo/tree{(en-tape:pith:neo pith)}?stud=type-diff"
|
=hx-post "/neo/tree{(en-tape:pith:neo pith)}?stud=type-diff"
|
||||||
=hx-target "find .loading"
|
=hx-target "find .loading"
|
||||||
@ -219,18 +320,20 @@
|
|||||||
;span.loading: loading
|
;span.loading: loading
|
||||||
==
|
==
|
||||||
==
|
==
|
||||||
==
|
|
||||||
==
|
|
||||||
==
|
|
||||||
::
|
::
|
||||||
++ state-print
|
++ tomb-button
|
||||||
|= =pail:neo
|
|= [=bowl:neo =pith:neo]
|
||||||
^- manx
|
^- manx
|
||||||
;div.pre.mono.scroll-x.p2
|
;form
|
||||||
;+ ;/
|
=hx-post "/neo/tree{(en-tape:pith:neo here.bowl)}?stud=tree-diff&head=send-tomb"
|
||||||
=/ size (met 3 (jam q.q.pail))
|
=hx-swap "outerHTML"
|
||||||
?: (gth size 750) "vase too large to print: {<size>}"
|
=hx-target "find .loading"
|
||||||
(of-wall:format (~(win re (sell q.pail)) 0 80))
|
;button.loader
|
||||||
|
=name "pith"
|
||||||
|
=value (en-tape:pith:neo (welp here.bowl pith))
|
||||||
|
;span.loaded: tomb
|
||||||
|
;span.loading: loading
|
||||||
|
==
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
--
|
--
|
@ -16,7 +16,8 @@
|
|||||||
%eyre-task
|
%eyre-task
|
||||||
=+ !<(=task:eyre:neo vase)
|
=+ !<(=task:eyre:neo vase)
|
||||||
=/ [eyre-id=@ta req=inbound-request:eyre] task
|
=/ [eyre-id=@ta req=inbound-request:eyre] task
|
||||||
?. =(['neo' 'tree' ~] (scag 2 (stab url.request.req))) ~|(not-a-tree-task/url.request.req !!)
|
::~& >> path-req/req
|
||||||
|
:: ?. =(['neo' 'tree' ~] (scag 2 (stab url.request.req))) ~|(not-a-tree-task/url.request.req !!)
|
||||||
~& >>> 'in tree!'
|
~& >>> 'in tree!'
|
||||||
?. authenticated.req
|
?. authenticated.req
|
||||||
=/ eyre=pith:neo #/[p/our.bowl]/$/eyre
|
=/ eyre=pith:neo #/[p/our.bowl]/$/eyre
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
/@ tree
|
/@ tree
|
||||||
|
/@ tree-diff
|
||||||
^- kook:neo
|
^- kook:neo
|
||||||
|%
|
|%
|
||||||
++ state pro/%tree
|
++ state pro/%tree
|
||||||
++ poke (sy %tree ~)
|
++ poke (sy %tree-diff ~)
|
||||||
++ kids *kids:neo
|
++ kids *kids:neo
|
||||||
++ deps *deps:neo
|
++ deps *deps:neo
|
||||||
++ form
|
++ form
|
||||||
@ -19,7 +20,22 @@
|
|||||||
~& > stud/stud
|
~& > stud/stud
|
||||||
=/ this !<(=tree q.pail)
|
=/ this !<(=tree q.pail)
|
||||||
?+ stud !!
|
?+ stud !!
|
||||||
%tree [~ tree/vase]
|
:: %tree
|
||||||
|
:: [~ tree/vase]
|
||||||
|
::
|
||||||
|
%tree-diff
|
||||||
|
=/ diff !<(tree-diff vase)
|
||||||
|
~& >>> diff-tree-imp/diff
|
||||||
|
?+ -.diff !!
|
||||||
|
%send-tomb
|
||||||
|
=/ =pith:neo +.diff
|
||||||
|
~& >>> pith-tomb/pith
|
||||||
|
:_ tree/!>(~)
|
||||||
|
:~
|
||||||
|
[pith %tomb ~]
|
||||||
|
[pith %cull ~]
|
||||||
|
==
|
||||||
|
==
|
||||||
==
|
==
|
||||||
--
|
--
|
||||||
--
|
--
|
@ -1,3 +1,4 @@
|
|||||||
$%
|
$%
|
||||||
[%send-diff =pith:neo type-diff=@tas val=*]
|
[%send-poke =pith:neo type-diff=@tas val=*]
|
||||||
|
[%send-tomb =pith:neo]
|
||||||
==
|
==
|
Loading…
Reference in New Issue
Block a user