Skip to content

Commit

Permalink
Setup Group Object
Browse files Browse the repository at this point in the history
  • Loading branch information
ingalls committed Oct 15, 2024
1 parent aef8a5d commit d678c65
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion api/lib/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ export const LayerAlert = pgTable('layer_alerts', {

export const Setting = pgTable('settings', {
key: text('key').primaryKey(),
value: text('value').notNull().default('')
value: json('value').notNull().default('')
});

export const Server = pgTable('server', {
Expand Down
4 changes: 3 additions & 1 deletion api/routes/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ export default async function router(schema: Schema, config: Config) {

'media::url': Type.Optional(Type.String()),
'media::username': Type.Optional(Type.String()),
'media::password': Type.Optional(Type.String())
'media::password': Type.Optional(Type.String()),

'group::names': Type.Optional(Type.Record(Type.String(), Type.String()))
}),
res: Type.Any()
}, async (req, res) => {
Expand Down
10 changes: 6 additions & 4 deletions api/web/src/components/Admin/AdminConfig.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@

<div v-if='opened.has("groups")' class='col-lg-12 py-2 border rounded'>
<div class='row'>
<div v-for='group in groups' :key='group' class='col-lg-12'>
<div v-for='group in Object.keys(config["group::names"])' :key='group' class='col-lg-12'>
<TablerInput
:label='group'
v-model='config[`group::${group}`]'
v-model='config["group::names"][group]'
:disabled='!edit'
/>
</div>
Expand Down Expand Up @@ -181,11 +181,13 @@ export default {
'media::url': '',
'media::username': '',
'media::password': ''
'media::password': '',
'group::names': {}
}
for (const group of groups) {
config[`group::${group}`] = '';
config['group::names'][group] = '';
}
return {
Expand Down

0 comments on commit d678c65

Please sign in to comment.