mirror of
https://github.com/hansjone/netxops.git
synced 2026-10-09 15:33:11 +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
|
|
@ -7,7 +7,7 @@ import type {} from '@deepseek-ai/dsh-api-remotes/client'
|
|||
import type { SettingsScope, SettingsScopeSnapshot } from '@deepseek-ai/dsh-client-ui-settings/client'
|
||||
import type { SnapshotStore } from './snapshot-store.ts'
|
||||
import {
|
||||
CardForm, textField, booleanField,
|
||||
CardForm, textField, booleanField, booleanFieldPersistFalse,
|
||||
type CardActions, type CardFieldState, type CardShell,
|
||||
} from './card-form.ts'
|
||||
import {
|
||||
|
|
@ -26,6 +26,10 @@ export interface NetxopsSettings {
|
|||
lang?: string
|
||||
tokenCredentialRef?: string
|
||||
alarmPushEnabled?: boolean
|
||||
alarmDeliverDsh?: boolean
|
||||
alarmDeliverIm?: boolean
|
||||
imBotId?: string
|
||||
imTargetId?: string
|
||||
}
|
||||
|
||||
interface CredentialState {
|
||||
|
|
@ -39,6 +43,10 @@ export interface NetxopsCardState extends CardShell {
|
|||
apiUrl: CardFieldState
|
||||
lang: CardFieldState
|
||||
alarmPushEnabled: CardFieldState
|
||||
alarmDeliverDsh: CardFieldState
|
||||
alarmDeliverIm: CardFieldState
|
||||
imBotId: CardFieldState
|
||||
imTargetId: CardFieldState
|
||||
apiToken: CardFieldState
|
||||
apiTokenConfigured: boolean
|
||||
apiTokenWritable: boolean
|
||||
|
|
@ -78,7 +86,15 @@ export class NetxopsCardController {
|
|||
) {
|
||||
this.form = new CardForm(
|
||||
scope,
|
||||
[textField('apiUrl'), textField('lang'), booleanField('alarmPushEnabled')],
|
||||
[
|
||||
textField('apiUrl'),
|
||||
textField('lang'),
|
||||
booleanField('alarmPushEnabled'),
|
||||
booleanFieldPersistFalse('alarmDeliverDsh'),
|
||||
booleanField('alarmDeliverIm'),
|
||||
textField('imBotId'),
|
||||
textField('imTargetId'),
|
||||
],
|
||||
[{ field: API_TOKEN_FIELD, write: text => this.writeToken(text) }],
|
||||
)
|
||||
this.store = this.form.bind(() => this.projection())
|
||||
|
|
@ -158,6 +174,10 @@ export class NetxopsCardController {
|
|||
apiUrl: this.form.field('apiUrl'),
|
||||
lang: this.form.field('lang'),
|
||||
alarmPushEnabled: this.form.field('alarmPushEnabled'),
|
||||
alarmDeliverDsh: this.form.field('alarmDeliverDsh'),
|
||||
alarmDeliverIm: this.form.field('alarmDeliverIm'),
|
||||
imBotId: this.form.field('imBotId'),
|
||||
imTargetId: this.form.field('imTargetId'),
|
||||
apiToken: this.form.field(API_TOKEN_FIELD),
|
||||
apiTokenConfigured: this.credential.configured,
|
||||
apiTokenWritable: this.credential.remoteReady && this.credential.writable,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue