mirror of
https://github.com/urbit/shrub.git
synced 2024-12-01 06:35:32 +03:00
graph-view: refine threads
This commit is contained in:
parent
4008fb34b1
commit
574e6de984
@ -6,8 +6,9 @@
|
||||
|%
|
||||
++ app-to-mark
|
||||
|= app=app-name
|
||||
?+ app !!
|
||||
?+ app ~|("nonexistent app" !!)
|
||||
%chat %graph-validator-chat
|
||||
%publish %graph-validator-publish
|
||||
==
|
||||
++ dejs
|
||||
=, dejs:format
|
||||
@ -37,7 +38,10 @@
|
||||
|= jon=json
|
||||
^- app-name
|
||||
?> ?=(%s -.jon)
|
||||
%chat
|
||||
?+ p.jon !!
|
||||
%chat %chat
|
||||
%publish %publish
|
||||
==
|
||||
::
|
||||
++ leave
|
||||
%- ot
|
||||
@ -53,6 +57,7 @@
|
||||
%- ot
|
||||
:~ resource+dejs:resource
|
||||
ship+(su ;~(pfix sig fed:ag))
|
||||
app+app
|
||||
==
|
||||
::
|
||||
++ groupify !!
|
||||
|
@ -39,7 +39,7 @@
|
||||
==
|
||||
[%delete rid=resource]
|
||||
[%leave rid=resource]
|
||||
[%join rid=resource =ship]
|
||||
[%join rid=resource =ship app=app-name]
|
||||
::[%invite rid=resource ships=(set ship)]
|
||||
:: [%groupify rid=resource title=@t description=@t]
|
||||
==
|
||||
|
@ -9,34 +9,37 @@
|
||||
++ scry-metadata
|
||||
|= rid=resource
|
||||
=/ m (strand ,(unit resource))
|
||||
;< pax=(unit path) bind:m
|
||||
%+ scry:strandio ,(unit path)
|
||||
;< paxs=(unit (set path)) bind:m
|
||||
%+ scry:strandio ,(unit (set path))
|
||||
;: weld
|
||||
/gx/metadata-store/resource/graph
|
||||
/gx/metadata-store/resource/publish
|
||||
(en-path:resource rid)
|
||||
/noun
|
||||
==
|
||||
(pure:m (bind pax de-path:resource))
|
||||
?~ paxs (pure:m ~)
|
||||
?~ u.paxs (pure:m ~)
|
||||
(pure:m `(de-path:resource n.u.paxs))
|
||||
::
|
||||
++ scry-group
|
||||
|= rid=resource
|
||||
=/ m (strand ,(unit resource))
|
||||
=/ m (strand ,group)
|
||||
;< ugroup=(unit group) bind:m
|
||||
%+ scry:strandio ,(unit group)
|
||||
;: weld
|
||||
/gx/group-store/resource/graph
|
||||
/gx/group-store/groups
|
||||
(en-path:resource rid)
|
||||
/noun
|
||||
==
|
||||
(pure:m (need ugroup))
|
||||
::
|
||||
++ delete-graph
|
||||
|= rid=resource
|
||||
|= [group=resource rid=resource app=app-name:graph-view]
|
||||
=/ m (strand ,~)
|
||||
::;< ~ bind:m
|
||||
:: (poke-our %graph-push-hook %push-hook-action [%remove rid.action])
|
||||
;< =bowl:spider bind:m get-bowl:strandio
|
||||
;< ~ bind:m
|
||||
(poke-our %graph-push-hook %push-hook-action [%remove rid.action])
|
||||
;< ~ bind:m
|
||||
(poke-our %graph-store %graph-update [%archive-graph rid.action])
|
||||
(poke-our %graph-store %graph-update !>([%0 now.bowl %archive-graph rid]))
|
||||
(pure:m ~)
|
||||
--
|
||||
::
|
||||
@ -44,21 +47,22 @@
|
||||
|= arg=vase
|
||||
=/ m (strand ,vase)
|
||||
^- form:m
|
||||
=+ !<([=action:graph-view ~] arg)
|
||||
=+ !<(=action:graph-view arg)
|
||||
?> ?=(%delete -.action)
|
||||
;< =bowl:spider bind:m get-bowl:strandio
|
||||
?> =(our.bowl entity.rid.action)
|
||||
;< ugroup-rid=(unit resource) bind:m
|
||||
(scry-metadata rid.action)
|
||||
?~ ugroup-rid (fail:m %nonexistent)
|
||||
;< ugroup=(unit group)
|
||||
?~ ugroup-rid !!
|
||||
;< =group bind:m
|
||||
(scry-group u.ugroup-rid)
|
||||
?~ ugroup (fail:m %nonexistent)
|
||||
?. hidden.u.ugroup
|
||||
(delete-graph rid.action)
|
||||
?. hidden.group
|
||||
;< ~ bind:m
|
||||
(delete-graph rid.action)
|
||||
(pure:m !>(~))
|
||||
;< ~ bind:m
|
||||
(poke-our %group-push-hook %push-hook-action [%remove rid.action])
|
||||
(poke-our %group-push-hook %push-hook-action !>([%remove rid.action]))
|
||||
;< ~ bind:m
|
||||
(poke-our %group-store %group-action !>([%remove-group rid.action])
|
||||
(poke-our %group-store %group-action !>([%remove-group rid.action]))
|
||||
;< ~ bind:m (delete-graph rid.action)
|
||||
(pure:m !>(~))
|
||||
|
@ -16,13 +16,13 @@
|
||||
(pure:m ~)
|
||||
::
|
||||
++ scry-metadata
|
||||
|= rid=resource
|
||||
|= [app=app-name:graph-view rid=resource]
|
||||
=/ m (strand ,(unit resource))
|
||||
^- form:m
|
||||
;< pax=(unit (set path)) bind:m
|
||||
%+ scry:strandio ,(unit (set path))
|
||||
;: weld
|
||||
/gx/metadata-store/resource/chat
|
||||
/gx/metadata-store/resource/[app]
|
||||
(en-path:resource rid)
|
||||
/noun
|
||||
==
|
||||
@ -62,7 +62,8 @@
|
||||
;< ~ bind:m
|
||||
%+ poke-our %metadata-hook
|
||||
metadata-hook-action+!>([%add-synced ship.action rid.action])
|
||||
::
|
||||
;< ~ bind:m
|
||||
%+ poke-our %graph-pull-hook
|
||||
pull-hook-action+!>([%add ship.action rid.action]))
|
||||
pull-hook-action+!>([%add ship.action rid.action])
|
||||
(pure:m !>(~))
|
||||
|
@ -50,14 +50,14 @@
|
||||
?< =(our.bowl entity.rid.action)
|
||||
;< ugroup-rid=(unit resource) bind:m
|
||||
(scry-metadata rid.action)
|
||||
?~ ugroup-rid (fail:m %nonexistent)
|
||||
?~ ugroup-rid !!
|
||||
;< ugroup=(unit group)
|
||||
(scry-group u.ugroup-rid)
|
||||
?~ ugroup (fail:m %nonexistent)
|
||||
?. hidden.u.ugroup
|
||||
(delete-graph rid.action)
|
||||
;< ~ bind:m
|
||||
(poke-our %group-push-hook %pull-hook-action [%remove rid.action])
|
||||
(poke-our %group-push-hook %pull-hook-action !>([%remove rid.action]))
|
||||
;< ~ bind:m
|
||||
(poke-our %group-store %group-action !>([%remove-group rid.action])
|
||||
;< ~ bind:m (delete-graph rid.action)
|
||||
|
@ -3,7 +3,7 @@ import { StoreState } from '../store/type';
|
||||
import { Patp, Path, PatpNoSig } from '~/types/noun';
|
||||
import _ from 'lodash';
|
||||
import {makeResource, resourceFromPath} from '../lib/group';
|
||||
import {GroupPolicy, Enc} from '~/types';
|
||||
import {GroupPolicy, Enc, Post} from '~/types';
|
||||
|
||||
export const createPost = (contents: Object[], parentIndex: string = '') => {
|
||||
return {
|
||||
@ -55,12 +55,13 @@ export default class GraphApi extends BaseApi<StoreState> {
|
||||
});
|
||||
}
|
||||
|
||||
joinGraph(ship: Patp, name: string) {
|
||||
joinGraph(ship: Patp, name: string, app: string) {
|
||||
const resource = makeResource(ship, name);
|
||||
return this.viewAction('graph-join', {
|
||||
join: {
|
||||
resource,
|
||||
ship
|
||||
ship,
|
||||
app
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -92,7 +93,7 @@ export default class GraphApi extends BaseApi<StoreState> {
|
||||
});
|
||||
}
|
||||
|
||||
addPost(ship: Patp, name: string, post: Object) {
|
||||
addPost(ship: Patp, name: string, post: Post) {
|
||||
let nodes = {};
|
||||
const resource = { ship, name };
|
||||
nodes[post.index] = {
|
||||
@ -162,7 +163,7 @@ export default class GraphApi extends BaseApi<StoreState> {
|
||||
});
|
||||
}
|
||||
|
||||
getGraphSubset(ship: string, resource: string, start: string, end: start) {
|
||||
getGraphSubset(ship: string, resource: string, start: string, end: string) {
|
||||
this.scry<any>(
|
||||
'graph-store',
|
||||
`/graph-subset/${ship}/${resource}/${end}/${start}`
|
||||
|
30
pkg/interface/src/types/graph-update.ts
Normal file
30
pkg/interface/src/types/graph-update.ts
Normal file
@ -0,0 +1,30 @@
|
||||
import {Patp} from "./noun";
|
||||
|
||||
|
||||
export interface TextContent { text: string; };
|
||||
export interface UrlContent { url: string; }
|
||||
export interface CodeContent { expresssion: string; output: string; };
|
||||
export interface ReferenceContent { uid: string; }
|
||||
export type Content = TextContent | UrlContent | CodeContent | ReferenceContent;
|
||||
|
||||
export interface Post {
|
||||
author: Patp;
|
||||
contents: Content[];
|
||||
hash?: string;
|
||||
index: string;
|
||||
pending?: boolean;
|
||||
signatures: string[];
|
||||
'time-sent': number;
|
||||
}
|
||||
|
||||
|
||||
export interface GraphNode {
|
||||
children: Graph;
|
||||
post: Post;
|
||||
}
|
||||
|
||||
export type Graph = Map<number, GraphNode>;
|
||||
|
||||
export type Graphs = { [rid: string]: Graph };
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user