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

View File

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

View File

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

View File

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

View File

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

View File

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