group-view: add hidden field

This commit is contained in:
Liam Fitzgerald 2021-03-04 12:54:37 +10:00
parent 7d451a37b8
commit b8d1dbd8c6
No known key found for this signature in database
GPG Key ID: D390E12C61D1CFFB
3 changed files with 74 additions and 22 deletions

View File

@ -4,23 +4,30 @@
|% |%
++ card card:agent:gall ++ card card:agent:gall
:: ::
+$ base-state +$ base-state-0
joining=(map rid=resource [=ship =progress:view]) joining=(map rid=resource [=ship =progress:view])
:: ::
+$ base-state-1
joining=(map rid=resource request:view)
::
+$ state-zero +$ state-zero
[%0 base-state] [%0 base-state-0]
:: ::
+$ state-one +$ state-one
[%1 base-state] [%1 base-state-0]
::
+$ state-two
[%2 base-state-1]
:: ::
+$ versioned-state +$ versioned-state
$% state-zero $% state-zero
state-one state-one
state-two
== ==
:: ::
++ view view-sur ++ view view-sur
-- --
=| state-one =| state-two
=* state - =* state -
:: ::
%- agent:dbug %- agent:dbug
@ -41,10 +48,29 @@
|= =vase |= =vase
=+ !<(old=versioned-state vase) =+ !<(old=versioned-state vase)
=| cards=(list card) =| cards=(list card)
|- |^
?: ?=(%1 -.old) ?- -.old
`this(state old) %2 [cards this(state old)]
$(-.old %1, cards :_(cards (poke-self:pass:io noun+!>(%cleanup)))) %1 $(-.old %2, +.old (base-state-to-1 +.old))
%0 $(-.old %1, cards :_(cards (poke-self:pass:io noun+!>(%cleanup))))
==
::
++ base-state-to-1
|= base-state-0
%- ~(gas by *(map resource request:view))
(turn ~(tap by joining) request-to-1)
::
++ request-to-1
|= [rid=resource =ship =progress:view]
^- [resource request:view]
:- rid
%* . *request:view
started now.bowl
hidden %.n
ship ship
progress progress
==
--
:: ::
++ on-poke ++ on-poke
|= [=mark =vase] |= [=mark =vase]
@ -56,9 +82,11 @@
?. ?=(%group-view-action mark) ?. ?=(%group-view-action mark)
(on-poke:def mark vase) (on-poke:def mark vase)
=+ !<(=action:view vase) =+ !<(=action:view vase)
?> ?=(%join -.action)
=^ cards state =^ cards state
jn-abet:(jn-start:join:gc +.action) ?+ -.action !!
%join jn-abet:(jn-start:join:gc +.action)
%hide (hide:gc +.action)
==
[cards this] [cards this]
:: ::
++ on-watch ++ on-watch
@ -69,8 +97,7 @@
:_ ~ :_ ~
%+ fact:io %+ fact:io
:- %group-view-update :- %group-view-update
!> ^- update:view !>(`update:view`[%initial joining])
[%initial (~(run by joining) |=([=ship =progress:view] progress))]
~ ~
== ==
:: ::
@ -97,6 +124,11 @@
++ grp ~(. grpl bowl) ++ grp ~(. grpl bowl)
++ io ~(. agentio bowl) ++ io ~(. agentio bowl)
++ con ~(. conl bowl) ++ con ~(. conl bowl)
++ hide
|= rid=resource
^- (quip card _state)
:- (fact:io group-view-update+!>([%hide rid]) /all ~)^~
state(joining (~(jab by joining) rid |=(request:view +<(hidden %.y))))
:: ::
++ has-joined ++ has-joined
|= rid=resource |= rid=resource
@ -107,10 +139,10 @@
:: ::
++ poke-noun ++ poke-noun
^- (quip card _state) ^- (quip card _state)
=; new-joining=(map resource [ship progress:view]) =; new-joining=(map resource request:view)
`state(joining new-joining) `state(joining new-joining)
%+ roll ~(tap by joining) %+ roll ~(tap by joining)
|= [[rid=resource =ship =progress:view] out=_joining] |= [[rid=resource =request:view] out=_joining]
?. (has-joined rid) out ?. (has-joined rid) out
(~(del by out) rid) (~(del by out) rid)
:: ::
@ -128,7 +160,7 @@
++ tx-progress ++ tx-progress
|= =progress:view |= =progress:view
=. joining =. joining
(~(put by joining) rid [ship progress]) (~(jab by joining) rid |=(request:view +<(progress progress)))
=; =cage =; =cage
(emit (fact:io cage /all tx+(en-path:resource rid) ~)) (emit (fact:io cage /all tx+(en-path:resource rid) ~))
group-view-update+!>([%progress rid progress]) group-view-update+!>([%progress rid progress])
@ -145,9 +177,9 @@
:: ::
++ jn-abed ++ jn-abed
|= r=resource |= r=resource
=/ [s=^ship =progress:view] =/ =request:view
(~(got by joining) r) (~(got by joining) r)
jn-core(rid r, ship s) jn-core(rid r, ship ship.request)
:: ::
++ jn-abet ++ jn-abet
^- (quip card _state) ^- (quip card _state)
@ -158,7 +190,7 @@
^+ jn-core ^+ jn-core
?< (~(has by joining) rid) ?< (~(has by joining) rid)
=. joining =. joining
(~(put by joining) rid [ship %start]) (~(put by joining) rid [%.n now.bowl ship %start])
=. jn-core =. jn-core
(jn-abed rid) (jn-abed rid)
?< ~|("already joined {<rid>}" (has-joined rid)) ?< ~|("already joined {<rid>}" (has-joined rid))

View File

@ -15,6 +15,7 @@
join+join join+join
leave+leave leave+leave
invite+invite invite+invite
hide+dejs-path:resource
== ==
:: ::
++ create ++ create
@ -53,6 +54,7 @@
?- -.upd ?- -.upd
%initial (initial +.upd) %initial (initial +.upd)
%progress (progress +.upd) %progress (progress +.upd)
%hide s+(enjs-path:resource +.upd)
== ==
:: ::
++ progress ++ progress
@ -61,13 +63,21 @@
:~ resource+s+(enjs-path:resource rid) :~ resource+s+(enjs-path:resource rid)
progress+s+prog progress+s+prog
== ==
++ request
|= req=^request
%- pairs
:~ hidden+b+hidden.req
started+(time started.req)
ship+(ship ship.req)
progress+s+progress.req
==
:: ::
++ initial ++ initial
|= init=(map resource ^progress) |= init=(map resource ^request)
%- pairs %- pairs
%+ turn ~(tap by init) %+ turn ~(tap by init)
|= [rid=resource prog=^progress] |= [rid=resource req=^request]
:_ s+prog :_ (request req)
(enjs-path:resource rid) (enjs-path:resource rid)
-- --
++ cleanup-md ++ cleanup-md

View File

@ -2,6 +2,13 @@
^? ^?
|% |%
:: ::
+$ request
$: hidden=?
started=time
=ship
=progress
==
::
+$ action +$ action
$% :: host side $% :: host side
[%create name=term =policy title=@t description=@t] [%create name=term =policy title=@t description=@t]
@ -11,6 +18,8 @@
[%leave =resource] [%leave =resource]
:: ::
[%invite =resource ships=(set ship) description=@t] [%invite =resource ships=(set ship) description=@t]
:: pending ops
[%hide =resource]
== ==
:: ::
@ -21,7 +30,8 @@
?(%no-perms %strange %done) ?(%no-perms %strange %done)
:: ::
+$ update +$ update
$% [%initial initial=(map resource progress)] $% [%initial initial=(map resource request)]
[%progress =resource =progress] [%progress =resource =progress]
[%hide =resource]
== ==
-- --