mirror of
https://github.com/urbit/shrub.git
synced 2024-11-28 22:33:06 +03:00
graph-view: revived groupify
This commit is contained in:
parent
574e6de984
commit
af77d47e73
@ -1,44 +0,0 @@
|
||||
/- *resource
|
||||
/+ store=graph-store, graph, default-agent, verb, dbug, pull-hook
|
||||
~% %graph-pull-hook-top ..is ~
|
||||
|%
|
||||
+$ card card:agent:gall
|
||||
++ config
|
||||
^- config:pull-hook
|
||||
:* %graph-store
|
||||
update:store
|
||||
%graph-update
|
||||
%graph-push-hook
|
||||
==
|
||||
--
|
||||
::
|
||||
%- agent:dbug
|
||||
^- agent:gall
|
||||
%- (agent:pull-hook config)
|
||||
^- (pull-hook:pull-hook config)
|
||||
|_ =bowl:gall
|
||||
+* this .
|
||||
def ~(. (default-agent this %|) bowl)
|
||||
dep ~(. (default:pull-hook this config) bowl)
|
||||
::
|
||||
++ on-init on-init:def
|
||||
++ on-save !>(~)
|
||||
++ on-load on-load:def
|
||||
++ on-poke on-poke:def
|
||||
++ on-peek on-peek:def
|
||||
++ on-arvo on-arvo:def
|
||||
++ on-fail on-fail:def
|
||||
++ on-agent on-agent:def
|
||||
++ on-watch on-watch:def
|
||||
++ on-leave on-leave:def
|
||||
++ on-pull-nack
|
||||
:: TODO: archive the graph
|
||||
on-pull-nack:dep
|
||||
::
|
||||
++ on-pull-kick
|
||||
|= =resource
|
||||
^- (unit path)
|
||||
=/ maybe-time (peek-log:graph resource)
|
||||
?~ maybe-time `/
|
||||
`/(scot %da u.maybe-time)
|
||||
--
|
@ -1,115 +0,0 @@
|
||||
/+ store=graph-store
|
||||
/+ res=resource
|
||||
/+ graph
|
||||
/+ group
|
||||
/+ default-agent
|
||||
/+ dbug
|
||||
/+ push-hook
|
||||
~% %graph-push-hook-top ..is ~
|
||||
|%
|
||||
+$ card card:agent:gall
|
||||
++ config
|
||||
^- config:push-hook
|
||||
:* %graph-store
|
||||
/updates
|
||||
update:store
|
||||
%graph-update
|
||||
%graph-pull-hook
|
||||
==
|
||||
::
|
||||
+$ agent (push-hook:push-hook config)
|
||||
--
|
||||
::
|
||||
%- agent:dbug
|
||||
^- agent:gall
|
||||
%- (agent:push-hook config)
|
||||
^- agent
|
||||
|_ =bowl:gall
|
||||
+* this .
|
||||
def ~(. (default-agent this %|) bowl)
|
||||
grp ~(. group bowl)
|
||||
gra ~(. graph bowl)
|
||||
::
|
||||
++ on-init on-init:def
|
||||
++ on-save !>(~)
|
||||
++ on-load on-load:def
|
||||
++ on-poke on-poke:def
|
||||
++ on-agent on-agent:def
|
||||
++ on-watch on-watch:def
|
||||
++ on-leave on-leave:def
|
||||
++ on-peek on-peek:def
|
||||
++ on-arvo on-arvo:def
|
||||
++ on-fail on-fail:def
|
||||
::
|
||||
++ should-proxy-update
|
||||
|= =vase
|
||||
^- ?
|
||||
=/ =update:store !<(update:store vase)
|
||||
?- -.q.update
|
||||
%add-graph %.y
|
||||
%remove-graph %.y
|
||||
%add-nodes %.y
|
||||
%remove-nodes %.y
|
||||
%add-signatures %.y
|
||||
%remove-signatures %.y
|
||||
%archive-graph %.y
|
||||
%unarchive-graph %.n
|
||||
%add-tag %.n
|
||||
%remove-tag %.n
|
||||
%keys %.n
|
||||
%tags %.n
|
||||
%tag-queries %.n
|
||||
%run-updates %.y
|
||||
==
|
||||
::
|
||||
++ resource-for-update
|
||||
|= =vase
|
||||
^- (unit resource:res)
|
||||
=/ =update:store !<(update:store vase)
|
||||
?- -.q.update
|
||||
%add-graph `resource.q.update
|
||||
%remove-graph `resource.q.update
|
||||
%add-nodes `resource.q.update
|
||||
%remove-nodes `resource.q.update
|
||||
%add-signatures `resource.uid.q.update
|
||||
%remove-signatures `resource.uid.q.update
|
||||
%archive-graph `resource.q.update
|
||||
%unarchive-graph ~
|
||||
%add-tag ~
|
||||
%remove-tag ~
|
||||
%run-updates `resource.q.update
|
||||
%keys ~
|
||||
%tags ~
|
||||
%tag-queries ~
|
||||
==
|
||||
::
|
||||
++ initial-watch
|
||||
|= [=path =resource:res]
|
||||
^- vase
|
||||
?> (can-join:grp resource src.bowl)
|
||||
?~ path
|
||||
:: new subscribe
|
||||
=/ [=graph:store mark=(unit mark:store)]
|
||||
(get-graph:gra resource)
|
||||
!> ^- update:store
|
||||
[%0 now.bowl [%add-graph resource graph mark]]
|
||||
:: resubscribe
|
||||
::
|
||||
:: TODO: use action-log
|
||||
::
|
||||
!!
|
||||
::
|
||||
++ take-update
|
||||
|= =vase
|
||||
^- [(list card) agent]
|
||||
=/ =update:store !<(update:store vase)
|
||||
?+ -.q.update [~ this]
|
||||
%remove-graph
|
||||
:_ this
|
||||
[%give %kick ~[resource+(en-path:res resource.q.update)] ~]~
|
||||
::
|
||||
%archive-graph
|
||||
:_ this
|
||||
[%give %kick ~[resource+(en-path:res resource.q.update)] ~]~
|
||||
==
|
||||
--
|
@ -21,7 +21,7 @@
|
||||
delete+delete
|
||||
join+join
|
||||
leave+leave
|
||||
::groupify+groupify
|
||||
groupify+groupify
|
||||
::invite+invite
|
||||
==
|
||||
::
|
||||
@ -60,7 +60,12 @@
|
||||
app+app
|
||||
==
|
||||
::
|
||||
++ groupify !!
|
||||
++ groupify
|
||||
%- ou
|
||||
:~ resource+(un dejs:resource)
|
||||
app+(un app)
|
||||
to+(uf ~ (mu dejs:resource))
|
||||
==
|
||||
++ invite !!
|
||||
::
|
||||
++ associated
|
||||
|
@ -41,7 +41,7 @@
|
||||
[%leave rid=resource]
|
||||
[%join rid=resource =ship app=app-name]
|
||||
::[%invite rid=resource ships=(set ship)]
|
||||
:: [%groupify rid=resource title=@t description=@t]
|
||||
[%groupify rid=resource app=app-name to=(unit resource)]
|
||||
==
|
||||
--
|
||||
|
||||
|
72
pkg/arvo/ted/graph/groupify.hoon
Normal file
72
pkg/arvo/ted/graph/groupify.hoon
Normal file
@ -0,0 +1,72 @@
|
||||
/- spider, graph-view, graph=graph-store, *metadata-store, *group, *metadata-store
|
||||
/+ strandio, resource
|
||||
=>
|
||||
|%
|
||||
++ strand strand:spider
|
||||
++ poke poke:strandio
|
||||
++ poke-our poke-our:strandio
|
||||
::
|
||||
++ check-live
|
||||
|= who=ship
|
||||
=/ m (strand ,~)
|
||||
^- form:m
|
||||
%+ (set-timeout:strandio ,~) ~s20
|
||||
;< ~ bind:m
|
||||
(poke [who %hood] %helm-hi !>(~))
|
||||
(pure:m ~)
|
||||
::
|
||||
++ scry-group
|
||||
|= rid=resource
|
||||
=/ m (strand ,group)
|
||||
^- form:m
|
||||
;< ugroup=(unit group) bind:m
|
||||
%+ scry:strandio (unit group)
|
||||
%+ weld /gx/group-store/groups
|
||||
(snoc (en-path:resource rid) %noun)
|
||||
?> ?=(^ ugroup)
|
||||
(pure:m u.ugroup)
|
||||
::
|
||||
++ scry-metadatum
|
||||
|= [app=app-name:graph-view rid=resource]
|
||||
=/ m (strand ,metadata)
|
||||
^- form:m
|
||||
=/ enc-path=@t
|
||||
(scot %t (spat (en-path:resource rid)))
|
||||
;< umeta=(unit metadata) bind:m
|
||||
%+ scry:strandio (unit metadata)
|
||||
%+ weld /gx/metadata-store/metadata
|
||||
/[enc-path]/[app]/[enc-path]/noun
|
||||
?> ?=(^ umeta)
|
||||
(pure:m u.umeta)
|
||||
--
|
||||
::
|
||||
^- thread:spider
|
||||
|= arg=vase
|
||||
=/ m (strand ,vase)
|
||||
^- form:m
|
||||
=+ !<(=action:graph-view arg)
|
||||
?> ?=(%groupify -.action)
|
||||
;< =group bind:m (scry-group rid.action)
|
||||
?> hidden.group
|
||||
;< =metadata bind:m
|
||||
(scry-metadatum app.action rid.action)
|
||||
?~ to.action
|
||||
;< ~ bind:m
|
||||
%+ poke-our %contact-view
|
||||
contact-view-action+!>([%groupify rid.action title.metadata description.metadata])
|
||||
(pure:m !>(~))
|
||||
;< new=^group bind:m (scry-group u.to.action)
|
||||
?< hidden.new
|
||||
=/ new-path
|
||||
(en-path:resource u.to.action)
|
||||
=/ app-path
|
||||
(en-path:resource rid.action)
|
||||
=/ add-md=metadata-action
|
||||
[%add new-path [app.action app-path] metadata]
|
||||
;< ~ bind:m
|
||||
(poke-our %metadata-store metadata-action+!>(add-md))
|
||||
;< ~ bind:m
|
||||
(poke-our %metadata-store metadata-action+!>([%remove app-path [app.action app-path]]))
|
||||
;< ~ bind:m
|
||||
(poke-our %group-store %group-update !>([%remove-group rid.action]))
|
||||
(pure:m !>(~))
|
@ -75,6 +75,19 @@ export default class GraphApi extends BaseApi<StoreState> {
|
||||
});
|
||||
}
|
||||
|
||||
groupifyGraph(ship: Patp, name: string, app: string, toPath?: string) {
|
||||
const resource = makeResource(ship, name);
|
||||
const to = toPath && resourceFromPath(toPath);
|
||||
|
||||
return this.viewAction('graph-groupify', {
|
||||
groupify: {
|
||||
resource,
|
||||
app,
|
||||
to
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
addGraph(ship: Patp, name: string, graph: any, mark: any) {
|
||||
this.storeAction({
|
||||
'add-graph': {
|
||||
|
Loading…
Reference in New Issue
Block a user