settings-store: query by desk

This commit is contained in:
Liam Fitzgerald 2021-09-09 11:35:57 +10:00
parent 061416dccd
commit 3ed00eda9d
6 changed files with 32 additions and 5 deletions

View File

@ -66,6 +66,11 @@
?+ pax (on-watch:def pax) ?+ pax (on-watch:def pax)
[%all ~] [%all ~]
[~ this] [~ this]
::
[%desk @ ~]
=* desk i.t.pax
?> (~(has by settings) desk)
[~ this]
:: ::
[%bucket @ @ ~] [%bucket @ @ ~]
=* desk i.t.pax =* desk i.t.pax
@ -88,6 +93,11 @@
?+ pax (on-peek:def pax) ?+ pax (on-peek:def pax)
[%x %all ~] [%x %all ~]
``settings-data+!>(`data`all+settings) ``settings-data+!>(`data`all+settings)
::
[%x %desk @ ~]
=* desk i.t.t.pax
?~ desk-settings=(~(get by settings) desk) [~ ~]
``settings-data+!>(desk+u.desk-settings)
:: ::
[%x %bucket @ @ ~] [%x %bucket @ @ ~]
=* desk i.t.t.pax =* desk i.t.t.pax
@ -136,6 +146,7 @@
^- (quip card _state) ^- (quip card _state)
=/ pas=(list path) =/ pas=(list path)
:~ /all :~ /all
/desk/[desk]
/bucket/[desk]/[key] /bucket/[desk]/[key]
== ==
:- [(give-event pas %put-bucket desk key bucket)]~ :- [(give-event pas %put-bucket desk key bucket)]~
@ -148,6 +159,7 @@
^- (quip card _state) ^- (quip card _state)
=/ pas=(list path) =/ pas=(list path)
:~ /all :~ /all
/desk/[desk]
/bucket/[key] /bucket/[key]
== ==
:- [(give-event pas %del-bucket desk key)]~ :- [(give-event pas %del-bucket desk key)]~
@ -161,6 +173,7 @@
^- (quip card _state) ^- (quip card _state)
=/ pas=(list path) =/ pas=(list path)
:~ /all :~ /all
/desk/[desk]
/bucket/[desk]/[buc] /bucket/[desk]/[buc]
/entry/[desk]/[buc]/[key] /entry/[desk]/[buc]/[key]
== ==
@ -176,6 +189,7 @@
^- (quip card _state) ^- (quip card _state)
=/ pas=(list path) =/ pas=(list path)
:~ /all :~ /all
/desk/[desk]
/bucket/[desk]/[buc] /bucket/[desk]/[buc]
/entry/[desk]/[buc]/[key] /entry/[desk]/[buc]/[key]
== ==

View File

@ -1,8 +1,8 @@
:~ title+'Garden' :~ title+'Garden'
info+'An app launcher for Urbit.' info+'An app launcher for Urbit.'
color+0xee.5432 color+0xee.5432
::glob-http+'https://bootstrap.urbit.org/glob-0v6.t43bu.cpl0b.bsisc.sqr4d.dckpn.glob' glob-http+'https://bootstrap.urbit.org/glob-0v6.t43bu.cpl0b.bsisc.sqr4d.dckpn.glob'
glob-ames+~zod ::glob-ames+~zod
base+'grid' base+'grid'
version+[0 0 1] version+[0 0 1]
website+'https://tlon.io' website+'https://tlon.io'

View File

@ -11,6 +11,7 @@
%all (settings +.dat) %all (settings +.dat)
%bucket (bucket +.dat) %bucket (bucket +.dat)
%entry (value +.dat) %entry (value +.dat)
%desk (desk-settings +.dat)
== ==
:: ::
++ settings ++ settings

View File

@ -38,6 +38,7 @@
+$ data +$ data
$% [%all =settings] $% [%all =settings]
[%bucket =bucket] [%bucket =bucket]
[%desk desk=(map key bucket)]
[%entry =val] [%entry =val]
== ==
-- --

View File

@ -70,4 +70,9 @@ export const getEntry = (desk: string, bucket: string, entry: string) => ({
path: `/entry/${desk}/${bucket}/${entry}` path: `/entry/${desk}/${bucket}/${entry}`
}); });
export const getDeskSettings = (desk: string) => ({
app: 'settings-store',
path: `/desk/${desk}`
});
export * from './types'; export * from './types';

View File

@ -1,7 +1,8 @@
export type Key = string; export type Key = string;
export type Value = string | string[] | boolean | number; export type Value = string | string[] | boolean | number;
export type Bucket = Map<string, Value>; export type Bucket = { [key: string]: Value; };
export type Settings = Map<string, Bucket>; export type DeskSettings = { [bucket: string]: Bucket; };
export type Settings = { [desk: string]: Settings; }
export interface PutBucket { export interface PutBucket {
'put-bucket': { 'put-bucket': {
@ -38,6 +39,10 @@ export interface AllData {
'all': Settings; 'all': Settings;
} }
export interface DeskData {
desk: DeskSettings;
}
export interface BucketData { export interface BucketData {
'bucket': Bucket; 'bucket': Bucket;
} }
@ -55,4 +60,5 @@ export type SettingsUpdate =
export type SettingsData = export type SettingsData =
| AllData | AllData
| BucketData | BucketData
| EntryData; | EntryData
| DeskData;