mirror of
https://github.com/hansjone/netxops.git
synced 2026-10-16 19:00:50 +08:00
Add optional IM sink for key alarms (0.1.17).
Settings choose DSH session and/or WhatsApp via botId+targetId; onAlarm soft-calls ctx.dshIm.send when im is installed. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
e8b7d7331f
commit
83c3796fbb
12 changed files with 482 additions and 23 deletions
|
|
@ -80,6 +80,27 @@ export function booleanField(field: string): CardFieldSpec {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Boolean that persists `false` explicitly (use when schema default is `true`).
|
||||
* Clearing would restore the default and make "off" impossible.
|
||||
*/
|
||||
export function booleanFieldPersistFalse(field: string): CardFieldSpec {
|
||||
return {
|
||||
field,
|
||||
format: value => (value === true ? 'true' : 'false'),
|
||||
parse: (text) => {
|
||||
const normalized = text.trim().toLowerCase()
|
||||
if (normalized === 'true' || normalized === '1' || normalized === 'yes') {
|
||||
return { kind: 'set', value: true }
|
||||
}
|
||||
if (normalized === 'false' || normalized === '0' || normalized === 'no' || normalized === '') {
|
||||
return { kind: 'set', value: false }
|
||||
}
|
||||
return undefined
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
export class CardForm<T> {
|
||||
private readonly specs: Map<string, CardFieldSpec>
|
||||
private readonly secretSpecs: Map<string, CardSecretSpec>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue