From 3e7fdba162ed028d1bcfd591ff992482957af632 Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Thu, 20 Aug 2015 12:20:14 -0700 Subject: [PATCH 1/4] fixed marks --- mar/work/command.hoon | 58 ++++++++++++++----- mar/work/task.hoon | 13 +++-- pub/work/src/js/actions/WorkActions.coffee | 9 +-- pub/work/src/js/main.js | 13 +++-- .../src/js/persistence/Persistence.coffee | 2 +- pub/work/src/js/stores/WorkStore.coffee | 1 - 6 files changed, 64 insertions(+), 32 deletions(-) diff --git a/mar/work/command.hoon b/mar/work/command.hoon index 09e175a96..c6b0b4cd0 100644 --- a/mar/work/command.hoon +++ b/mar/work/command.hoon @@ -17,22 +17,50 @@ |* a=fist %- cu :_ (ar a) ~(gas in *(set ,_(need *a))) + ++ ot + |* a=(pole ,[@tas fist]) + |= b=json + %. ((^ot a) b) + %+ slog 0 + ?+ b ~ + [%o *] + %+ murn `(list ,[@tas fist])`a + |= [c=term d=fist] ^- (unit tank) + =+ (~(get by p.b) c) + ?~ - (some >[c (turn (~(tap by p.b)) head)]<) + =+ (d u) + ?~ - (some >[c u]<) + ~ + == + ++ of + |* a=(pole ,[@tas fist]) + |= b=json + %. ((of:jo a) b) + %+ slog 0 + ?+ b ~ + [%o *] + %+ murn `(list ,[@tas fist])`a + |= [c=term d=fist] ^- (unit tank) + =+ (~(get by p.b) c) + ?~ - ~ + =+ (d u) + ?~ - (some >[c u]<) + ~ + == ++ id (ci (slat %uv) so) ++ ship (su fed:ag) - ++ coma (of new/task old/(ot id/id dif/uppd ~) sort/(ar id) ~) + ++ coma (of new/new old/(ot id/id dif/uppd ~) sort/(ar id) ~) + ++ new (ot task/task audience/audi ~) ++ task - %^ ot - :- %task - %- ot :~ - id/id date-created/di - version/ni date-modified/di - owner/ship status/(ci (soft status) so) - tags/(as so) date-due/(mu di) - done/(mu di) title/so - description/so discussion/(ar (ot date/di ship/ship body/so ~)) - == - audience/(as (ot ship/ship span/so ~)) - ~ + %- ot :~ + id/id date-created/di + version/ni date-modified/di + owner/ship status/(ci (soft status) so) + tags/(as so) date-due/(mu di) + done/(mu di) title/so + description/so discussion/(ar (ot date/di ship/ship body/so ~)) + == + ++ audi (as (ot ship/ship span/so ~)) ++ uppd %- of :~ own/(of announce/ul claim/ul ~) @@ -44,7 +72,7 @@ description/so tags/(as so) done/bo - audience/(as (ot ship/ship span/so ~)) + audience/audi == == -- @@ -63,7 +91,7 @@ :: status:'gave', :: tags:['tag'], :: date-due:null, -:: done:XX +:: done:false, :: title:'Test task', :: description:'The converter owrks right?', :: discussion:[{date:1440011611215,ship:'sondel',body:'hi'}] diff --git a/mar/work/task.hoon b/mar/work/task.hoon index 4490c89e2..eff8ecb8a 100644 --- a/mar/work/task.hoon +++ b/mar/work/task.hoon @@ -49,15 +49,15 @@ |= a=wain ^+ taz =+ ~[id=%uv "_" date-created=%da " " version=%ud date-modified=%da] =^ b a (advance a ;~(plug (parse -) (punt (parse " " %da ~)))) - =+ [-.b `due-date=(unit ,@da)`+.b] + =+ [-.b `date-due=(unit ,@da)`+.b] =^ tags a (undent a ~(gas in *(set cord))) =^ title a ?~(a !! a) =^ b a (advance a (parse owner=%p "." status=%tas ~)) ?> ?=(status.task status.b) =+ b =^ description a (undent a role) - :* id date-created version date-modified - owner status tags due-date title description + :* id date-created version date-modified owner + status tags date-due ~ title description :: XX done |- ^- (list comment) ?: =(~ a) ~ =^ b a (advance a (parse ship=%p " " date=%da ~)) @@ -72,7 +72,7 @@ ++ mime [/text/x-task (taco (role txt))] ++ txt =+ taz - =+ due=?~(due-date ~ ~[' ' da/u.due-date]) + =+ due=?~(date-due ~ ~[' ' da/u.date-due]) :- (rend uv/id '_' da/date-created ' ' ud/version da/date-modified due) %+ welp (indent (sort (~(tap in tags)) aor)) :- title @@ -95,12 +95,13 @@ description/[%s description] =< discussion/[%a (turn discussion .)] |=(comment (jobe date/(jode date) ship/(jape ) body/[%s body] ~)) - due-date/?~(due-date ~ (jode u.due-date)) + date-due/?~(date-due ~ (jode u.date-due)) + done/?~(done ~ (jode u.done)) == -- ++ grad %txt -- -:: {id}_{date-created} {version}{date-modified}{|(" {due-date}" ~)} +:: {id}_{date-created} {version}{date-modified}{|(" {date-due}" ~)} :: {tag1} :: {tag2} :: ... diff --git a/pub/work/src/js/actions/WorkActions.coffee b/pub/work/src/js/actions/WorkActions.coffee index b62291f8f..93e01238f 100644 --- a/pub/work/src/js/actions/WorkActions.coffee +++ b/pub/work/src/js/actions/WorkActions.coffee @@ -9,14 +9,15 @@ module.exports = version:0 "date-created":Date.now() "date-modified":Date.now() - "due-date":null + "date-due":null + done:null owner:window.urb.ship - status:'gave' + status:'announced' tags:[] title:'' description:'' discussion:[] - Persistence.put "new":item + Persistence.put "new": task:item, audience:[] Dispatcher.handleViewAction {type:'newItem', index, item} setFilter: (key,val) -> @@ -29,7 +30,7 @@ module.exports = Dispatcher.handleViewAction type:'setSort' key:key - val:val + val:val swapItems: (to,from) -> Dispatcher.handleViewAction diff --git a/pub/work/src/js/main.js b/pub/work/src/js/main.js index acfdaaae1..583b49225 100644 --- a/pub/work/src/js/main.js +++ b/pub/work/src/js/main.js @@ -15,16 +15,20 @@ module.exports = { version: 0, "date-created": Date.now(), "date-modified": Date.now(), - "due-date": null, + "date-due": null, + done: null, owner: window.urb.ship, - status: 'gave', + status: 'announced', tags: [], title: '', description: '', discussion: [] }; Persistence.put({ - "new": item + "new": { + task: item, + audience: [] + } }); return Dispatcher.handleViewAction({ type: 'newItem', @@ -982,7 +986,7 @@ module.exports = Object.assign || function (target, source) { }; },{}],14:[function(require,module,exports){ -urb.appl = 'hood'; +urb.appl = 'work'; module.exports = { put: function(update, cb) { @@ -1132,7 +1136,6 @@ WorkStore = assign({}, EventEmitter.prototype, { }, item); _item["date-created"] = new Date(item["date-created"]); _item["date-modified"] = new Date(item["date-modified"]); - _item["date-due"] = item["due-date"]; return _list.splice(index, 0, _item); }, swapItem: function(arg) { diff --git a/pub/work/src/js/persistence/Persistence.coffee b/pub/work/src/js/persistence/Persistence.coffee index 38029a3fa..e71a2e682 100644 --- a/pub/work/src/js/persistence/Persistence.coffee +++ b/pub/work/src/js/persistence/Persistence.coffee @@ -1,4 +1,4 @@ -urb.appl = 'hood' # XX +urb.appl = 'work' module.exports = put: (update,cb) -> urb.send(update,{mark:'work-command'},cb) get: (id,cb) -> diff --git a/pub/work/src/js/stores/WorkStore.coffee b/pub/work/src/js/stores/WorkStore.coffee index b39b86f61..e0001e799 100644 --- a/pub/work/src/js/stores/WorkStore.coffee +++ b/pub/work/src/js/stores/WorkStore.coffee @@ -90,7 +90,6 @@ WorkStore = assign {},EventEmitter.prototype,{ _item = _.extend {sort:index,audience:[]}, item _item["date-created"]=new Date item["date-created"] _item["date-modified"]=new Date item["date-modified"] - _item["date-due"]=item["due-date"] _list.splice index,0,_item swapItem: ({to,from}) -> From 86d01d99030598f4d1a15a8161b3e0e7b3f3d3ae Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Thu, 20 Aug 2015 12:30:56 -0700 Subject: [PATCH 2/4] more informative gall error reporting --- arvo/gall.hoon | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/arvo/gall.hoon b/arvo/gall.hoon index 4b64d248a..89e607e71 100644 --- a/arvo/gall.hoon +++ b/arvo/gall.hoon @@ -761,7 +761,7 @@ ++ ap-move-quit :: give quit move |= [sto=bone vax=vase] ^- (each cove tang) - ?^ q.vax [%| (ap-suck "move: improper quit")] + ?^ q.vax [%| (ap-suck "quit: improper give")] [%& `cove`[sto %give `cuft`[%quit ~]]] :: ++ ap-move-diff :: give diff move @@ -769,20 +769,20 @@ =. vax (spec vax) ^- (each cove tang) ?. &(?=(^ q.vax) ?=(@ -.q.vax) ((sane %tas) -.q.vax)) - [%| (ap-suck "move: improper diff")] + [%| (ap-suck "diff: improper give")] [%& sto %give %diff `cage`[-.q.vax (slot 3 (spec vax))]] :: ++ ap-move-hiss :: pass %hiss |= [sto=bone vax=vase] ^- (each cove tang) ?. &(?=([p=* q=@ q=^] q.vax) ((sane %tas) q.q.vax)) - [%| (ap-suck "move: malformed hiss ask.[%hiss path mark cage]")] + [%| (ap-suck "hiss: malformed hiss ask.[%hiss wire mark cage]")] =+ gaw=(slot 7 vax) ?. &(?=([p=@ q=^] q.gaw) ((sane %tas) p.q.gaw)) - [%| (ap-suck "move: malformed cage")] + [%| (ap-suck "hiss: malformed cage")] =+ pux=((soft path) p.q.vax) ?. &(?=(^ pux) (levy u.pux (sane %ta))) - [%| (ap-suck "move: malformed path")] + [%| (ap-suck "hiss: malformed path")] :^ %& sto %pass :- [(scot %p q.q.pry) %cay u.pux] [%hiss q.q.vax [p.q.gaw (slot 3 (spec gaw))]] @@ -793,20 +793,20 @@ ?. ?& ?=([p=* [q=@ r=@] s=*] q.vax) (gte 1 (met 7 q.q.vax)) == - [%| (ap-suck "move: malformed target")] + [%| (ap-suck "mess: malformed target")] =+ pux=((soft path) p.q.vax) ?. &(?=(^ pux) (levy u.pux (sane %ta))) - [%| (ap-suck "move: malformed path")] + [%| (ap-suck "mess: malformed path")] [%& [(scot %p q.q.vax) %out r.q.vax u.pux] q.q.vax r.q.vax] :: ++ ap-move-pass :: pass general move |= [sto=bone wut=* vax=vase] ^- (each cove tang) ?. &(?=(@ wut) ((sane %tas) wut)) - [%| (ap-suck "move: malformed card")] + [%| (ap-suck "pass: malformed card")] =+ pux=((soft path) -.q.vax) ?. &(?=(^ pux) (levy u.pux (sane %ta))) - [%| (ap-suck "move: malformed path")] + [%| (ap-suck "pass: malformed path")] =+ huj=(ap-vain wut) ?~ huj [%| (ap-suck "move: unknown note {(trip wut)}")] :^ %& sto %pass @@ -855,17 +855,17 @@ (gte 1 (met 7 q.q.vax)) ((sane %tas) r.q.vax) == - [%| (ap-suck "move: malformed send")] + [%| (ap-suck "send: improper ask.[%send wire gill club]")] =+ pux=((soft path) p.q.vax) ?. &(?=(^ pux) (levy u.pux (sane %ta))) - [%| (ap-suck "move: malformed path")] + [%| (ap-suck "send: malformed path")] ?: ?=(%poke s.q.vax) =+ gav=(spec (slot 7 vax)) ?> =(%poke -.q.gav) ?. ?& ?=([p=@ q=*] t.q.vax) ((sane %tas) p.t.q.vax) == - [%| (ap-suck "move: malformed poke")] + [%| (ap-suck "send: malformed poke")] :^ %& sto %pass :- [(scot %p q.q.vax) %out r.q.vax u.pux] ^- cote @@ -873,7 +873,7 @@ [%send q.q.vax r.q.vax %poke p.t.q.vax (slot 3 (spec (slot 3 gav)))] =+ cob=((soft club) [s t]:q.vax) ?~ cob - [%| (ap-suck "move: malformed club")] + [%| (ap-suck "send: malformed club")] :^ %& sto %pass :- [(scot %p q.q.vax) %out r.q.vax u.pux] :: ~& [%ap-move-send `path`[(scot %p q.q.vax) %out r.q.vax u.pux]] From c97ad75ace986742779db5aeb0e1174c8bc4b0af Mon Sep 17 00:00:00 2001 From: Philip C Monk Date: Thu, 20 Aug 2015 15:51:17 -0400 Subject: [PATCH 3/4] Revert "uw -> uv" This reverts commit f5fb5983360e91601289cf28d28da2245479a65d. --- ape/work.hoon | 30 +++++++----------------------- sur/talk.hoon | 2 +- 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/ape/work.hoon b/ape/work.hoon index 45818f9ee..a403cea8f 100644 --- a/ape/work.hoon +++ b/ape/work.hoon @@ -40,7 +40,7 @@ :_ ~ ^- move :* ost %poke - /sending/(scot %uv id)/(scot %ud version) + /sending/(scot %uw id)/(scot %ud version) [our %talk] %talk-command ^- command:talk @@ -61,7 +61,7 @@ :_ ~ ^- move :* ost %poke - /claiming/(scot %uv id) + /claiming/(scot %uw id) [our %talk] %talk-command ^- command:talk @@ -121,40 +121,24 @@ ^- [mos=(list move) con=_+>.$] ?- -.action %create :: XX should verify ownership - =+ existing-task=(~(get by tasks) id.tax.action) + =+ existing-task=(~(get by tasks) id.p.action) ~? ?& ?=(^ existing-task) - !=(tax.action task.u.existing-task) + !=(p.action task.u.existing-task) == :* %new-task-with-old-id her=her from=from - new-task=tax.action + new-task=p.action existing-task=u.existing-task == - ?. |(=(her owner.tax.action) =(%released status.tax.action)) - ~& :* %created-with-bad-owner - her=her - from=from - new-task=tax.action - existing-task=u.existing-task - == - [~ +>.$] =. tasks - %^ ~(put by tasks) id.tax.action tax.action + %^ ~(put by tasks) id.p.action p.action ?~ existing-task from (~(uni in audience.u.existing-task) from) - =. sort ?~(existing-task sort [id.action sort]) + =. sort ?~(existing-task sort [id.p.action sort]) [~ +>.$] :: %claim - =+ tax=(~(got by tasks) id.action) - ?. &(=(our owner.tax) =(%announced status.tax)) - ~& :* %bad-claim - her=her - from=from - task=tax - == - [~ +>.$] abet:(release:(at (~(got by tasks) id.action)) her) :: %update diff --git a/sur/talk.hoon b/sur/talk.hoon index cd63463b1..32d825b24 100644 --- a/sur/talk.hoon +++ b/sur/talk.hoon @@ -81,7 +81,7 @@ ++ work-stuff :: |% :: ++ duty :: - $% [%create tax=task] :: create new task + $% [%create p=task] :: create new task [%claim id=@uvH] :: claim task $: %update :: operate on task id=@uvH :: which task From 12aca7f7c0424d5d91aa04935a5a70b6e6553872 Mon Sep 17 00:00:00 2001 From: Philip C Monk Date: Thu, 20 Aug 2015 15:51:41 -0400 Subject: [PATCH 4/4] uw -> uv for realz --- ape/work.hoon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ape/work.hoon b/ape/work.hoon index a403cea8f..45b1d7e3f 100644 --- a/ape/work.hoon +++ b/ape/work.hoon @@ -40,7 +40,7 @@ :_ ~ ^- move :* ost %poke - /sending/(scot %uw id)/(scot %ud version) + /sending/(scot %uv id)/(scot %ud version) [our %talk] %talk-command ^- command:talk @@ -61,7 +61,7 @@ :_ ~ ^- move :* ost %poke - /claiming/(scot %uw id) + /claiming/(scot %uv id) [our %talk] %talk-command ^- command:talk