Skip to content

Commit

Permalink
add alarm types and config
Browse files Browse the repository at this point in the history
  • Loading branch information
P4l0m4 committed Jul 26, 2024
1 parent 2400476 commit 7abdf65
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
17 changes: 17 additions & 0 deletions @xen-orchestra/web/src/types/alarm.type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export type XenApiAlarmType =
| 'cpu_usage'
| 'network_usage'
| 'disk_usage'
| 'fs_usage'
| 'log_fs_usage'
| 'mem_usage'
| 'physical_utilisation'
| 'sr_io_throughput_total_per_host'
| 'memory_free_kib'
| 'unknown'

export interface Alarm {
level: number
triggerLevel: number
type: XenApiAlarmType
}
3 changes: 2 additions & 1 deletion @xen-orchestra/web/src/types/xo-object.type.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { Alarm } from '@/types/alarm.type'
import type { Host } from '@/types/host.type'
import type { Pool } from '@/types/pool.type'
import type { Task } from '@/types/task.type'
Expand All @@ -9,7 +10,7 @@ declare const __brand: unique symbol
// eslint-disable-next-line no-use-before-define
export type RecordId<Type extends XoObjectType> = string & { [__brand]: `${Type}Id` }

export type XoObject = Vm | Host | Pool | Task
export type XoObject = Vm | Host | Pool | Task | Alarm

export type XoObjectType = XoObject['type']

Expand Down
4 changes: 4 additions & 0 deletions @xen-orchestra/web/src/utils/rest-api-config.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@ export const restApiConfig: Record<XoObjectType, { path: string; fields: string
path: 'tasks',
fields: 'id,start,end,properties,status,progress,tasks',
},
alarm: {
path: 'alarms',
fields: 'id,level,triggerLevel,type',
},
}

0 comments on commit 7abdf65

Please sign in to comment.