chore: Update tags field schema to use DeviceConfig, enhance isDevice type check, and adjust IntelliJ workspace

This commit is contained in:
Andreas Hilbig 2026-01-16 20:24:08 +01:00
parent 8e5fbc3f57
commit 0c1f585909
6 changed files with 54 additions and 17 deletions

30
.idea/workspace.xml generated
View file

@ -4,10 +4,13 @@
<option name="autoReloadType" value="SELECTIVE" /> <option name="autoReloadType" value="SELECTIVE" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="d7a71994-2699-4ae4-9fd2-ee13b7f33d35" name="Changes" comment="chore: Add `copy-schema` script, update Dockerfile schema path, and adjust npm prod workflow"> <list default="true" id="d7a71994-2699-4ae4-9fd2-ee13b7f33d35" name="Changes" comment="chore: Update Dockerfile CMD for schema path, log schema loading path in `schema.ts`, and adjust IntelliJ workspace">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Dockerfile" beforeDir="false" afterPath="$PROJECT_DIR$/Dockerfile" afterDir="false" /> <change beforePath="$PROJECT_DIR$/schema/devices.graphql" beforeDir="false" afterPath="$PROJECT_DIR$/schema/devices.graphql" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/api/schema.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/api/schema.ts" afterDir="false" /> <change beforePath="$PROJECT_DIR$/schema/extensions/display_devices.graphql" beforeDir="false" afterPath="$PROJECT_DIR$/schema/extensions/display_devices.graphql" afterDir="false" />
<change beforePath="$PROJECT_DIR$/schema/extensions/location_tracker_devices.graphql" beforeDir="false" afterPath="$PROJECT_DIR$/schema/extensions/location_tracker_devices.graphql" afterDir="false" />
<change beforePath="$PROJECT_DIR$/schema/zabbix.graphql" beforeDir="false" afterPath="$PROJECT_DIR$/schema/zabbix.graphql" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/api/resolver_helpers.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/api/resolver_helpers.ts" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -54,9 +57,11 @@
"RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager.252": "true", "RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager.252": "true",
"RunOnceActivity.git.unshallow": "true", "RunOnceActivity.git.unshallow": "true",
"RunOnceActivity.typescript.service.memoryLimit.init": "true", "RunOnceActivity.typescript.service.memoryLimit.init": "true",
"com.intellij.ml.llm.matterhorn.ej.ui.settings.DefaultModelSelectionForGA.v1": "true",
"git-widget-placeholder": "main", "git-widget-placeholder": "main",
"go.import.settings.migrated": "true", "go.import.settings.migrated": "true",
"javascript.preferred.runtime.type.id": "node", "javascript.preferred.runtime.type.id": "node",
"junie.onboarding.icon.badge.shown": "true",
"last_opened_file_path": "//wsl.localhost/Ubuntu/home/ahilbig/git/vcr/zabbix-graphql-api/src/test", "last_opened_file_path": "//wsl.localhost/Ubuntu/home/ahilbig/git/vcr/zabbix-graphql-api/src/test",
"node.js.detected.package.eslint": "true", "node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true", "node.js.detected.package.tslint": "true",
@ -68,6 +73,7 @@
"npm.copy-schema.executor": "Run", "npm.copy-schema.executor": "Run",
"npm.prod.executor": "Run", "npm.prod.executor": "Run",
"settings.editor.selected.configurable": "preferences.sourceCode.TypeScript", "settings.editor.selected.configurable": "preferences.sourceCode.TypeScript",
"to.speed.mode.migration.done": "true",
"ts.external.directory.path": "\\\\wsl.localhost\\Ubuntu\\home\\ahilbig\\git\\vcr\\zabbix-graphql-api\\node_modules\\typescript\\lib", "ts.external.directory.path": "\\\\wsl.localhost\\Ubuntu\\home\\ahilbig\\git\\vcr\\zabbix-graphql-api\\node_modules\\typescript\\lib",
"vue.rearranger.settings.migration": "true" "vue.rearranger.settings.migration": "true"
} }
@ -89,7 +95,7 @@
<recent name="\\wsl.localhost\Ubuntu\home\ahilbig\git\vcr\zabbix-graphql-api\schema" /> <recent name="\\wsl.localhost\Ubuntu\home\ahilbig\git\vcr\zabbix-graphql-api\schema" />
</key> </key>
</component> </component>
<component name="RunManager" selected="npm.prod"> <component name="RunManager" selected="Node.js.index.ts">
<configuration name="copy-schema" type="js.build_tools.npm" temporary="true" nameIsGenerated="true"> <configuration name="copy-schema" type="js.build_tools.npm" temporary="true" nameIsGenerated="true">
<package-json value="$PROJECT_DIR$/package.json" /> <package-json value="$PROJECT_DIR$/package.json" />
<command value="run" /> <command value="run" />
@ -150,7 +156,8 @@
<option name="presentableId" value="Default" /> <option name="presentableId" value="Default" />
<updated>1768273021451</updated> <updated>1768273021451</updated>
<workItem from="1768273025985" duration="11343000" /> <workItem from="1768273025985" duration="11343000" />
<workItem from="1768380302361" duration="6025000" /> <workItem from="1768380302361" duration="9751000" />
<workItem from="1768551040782" duration="4856000" />
</task> </task>
<task id="LOCAL-00001" summary="chore: Update IntelliJ workspace settings and add GitHub Actions workflow for Docker deployment"> <task id="LOCAL-00001" summary="chore: Update IntelliJ workspace settings and add GitHub Actions workflow for Docker deployment">
<option name="closed" value="true" /> <option name="closed" value="true" />
@ -240,7 +247,15 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1768388782068</updated> <updated>1768388782068</updated>
</task> </task>
<option name="localTasksCounter" value="12" /> <task id="LOCAL-00012" summary="chore: Update Dockerfile CMD for schema path, log schema loading path in `schema.ts`, and adjust IntelliJ workspace">
<option name="closed" value="true" />
<created>1768396879810</created>
<option name="number" value="00012" />
<option name="presentableId" value="LOCAL-00012" />
<option name="project" value="LOCAL" />
<updated>1768396879810</updated>
</task>
<option name="localTasksCounter" value="13" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
@ -269,6 +284,7 @@
<MESSAGE value="chore: Replace copying of `schema.graphql` with `extensions` in Dockerfile" /> <MESSAGE value="chore: Replace copying of `schema.graphql` with `extensions` in Dockerfile" />
<MESSAGE value="chore: Move schema directory away from src; Migrate `extensions` to `schema` directory, update Dockerfile and configuration paths" /> <MESSAGE value="chore: Move schema directory away from src; Migrate `extensions` to `schema` directory, update Dockerfile and configuration paths" />
<MESSAGE value="chore: Add `copy-schema` script, update Dockerfile schema path, and adjust npm prod workflow" /> <MESSAGE value="chore: Add `copy-schema` script, update Dockerfile schema path, and adjust npm prod workflow" />
<option name="LAST_COMMIT_MESSAGE" value="chore: Add `copy-schema` script, update Dockerfile schema path, and adjust npm prod workflow" /> <MESSAGE value="chore: Update Dockerfile CMD for schema path, log schema loading path in `schema.ts`, and adjust IntelliJ workspace" />
<option name="LAST_COMMIT_MESSAGE" value="chore: Update Dockerfile CMD for schema path, log schema loading path in `schema.ts`, and adjust IntelliJ workspace" />
</component> </component>
</project> </project>

View file

@ -12,9 +12,31 @@ interface Device implements Host {
deviceType: String deviceType: String
hostgroups: [HostGroup!] hostgroups: [HostGroup!]
name: String name: String
tags: JSONObject tags: DeviceConfig
state: DeviceState state: DeviceState
} }
type DeviceConfig {
deviceWidgetPreview: WidgetPreview
}
type WidgetPreview {
TOP_LEFT: DisplayFieldSpec
TOP_RIGHT: DisplayFieldSpec
BOTTOM_LEFT: DisplayFieldSpec
BOTTOM_RIGHT: DisplayFieldSpec
}
type DisplayFieldSpec {
key: String,
emptyValue: String
unit: String,
value_font_size: String
g_value_transform: String
unit_font_size: String
g_unit_transform: String
}
type OperationalDeviceData { type OperationalDeviceData {
temperature: Float temperature: Float
voltage: Float voltage: Float
@ -53,6 +75,6 @@ type GenericDevice implements Host & Device {
deviceType: String deviceType: String
hostgroups: [HostGroup!] hostgroups: [HostGroup!]
name: String name: String
tags: JSONObject tags: DeviceConfig
state: GenericDeviceState state: GenericDeviceState
} }

View file

@ -12,7 +12,7 @@ type SinglePanelDevice implements Host & Device {
deviceType: String deviceType: String
hostgroups: [HostGroup!] hostgroups: [HostGroup!]
name: String name: String
tags: JSONObject tags: DeviceConfig
state: PanelState state: PanelState
} }
@ -53,7 +53,7 @@ type FourPanelDevice implements Host & Device {
deviceType: String deviceType: String
hostgroups: [HostGroup!] hostgroups: [HostGroup!]
name: String name: String
tags: JSONObject tags: DeviceConfig
state: FourPanelState state: FourPanelState
} }
@ -72,3 +72,4 @@ type FourPanelValues {
BOTTOM_LEFT: PanelValues BOTTOM_LEFT: PanelValues
BOTTOM_RIGHT: PanelValues BOTTOM_RIGHT: PanelValues
} }

View file

@ -1,7 +1,7 @@
""" """
DistanceTracker represents a device which can detect other devices around itself and estimate DistanceTracker represents a device which can detect other devices around itself and estimate
the distances, e.g. by using Bluetooth scanning technology and estimating the distance by . the distances, e.g. by using Bluetooth scanning technology and estimating the distance.
Optionally the
""" """
type DistanceTrackerDevice implements Host & Device { type DistanceTrackerDevice implements Host & Device {
hostid: ID! hostid: ID!
@ -12,7 +12,7 @@ type DistanceTrackerDevice implements Host & Device {
deviceType: String deviceType: String
hostgroups: [HostGroup!] hostgroups: [HostGroup!]
name: String name: String
tags: JSONObject tags: DeviceConfig
state: DistanceTrackerState state: DistanceTrackerState
} }

View file

@ -15,7 +15,6 @@ interface Host {
host: String! host: String!
hostgroups: [HostGroup!] hostgroups: [HostGroup!]
name: String name: String
tags: JSONObject
""" """
Specifies the type or category of the device. Used to define the classification Specifies the type or category of the device. Used to define the classification
of a device in the system (capabilities, functionalities, or purpose). of a device in the system (capabilities, functionalities, or purpose).

View file

@ -2,8 +2,7 @@ import {isObjectType} from "graphql";
import {logger} from "../logging/logger.js"; import {logger} from "../logging/logger.js";
import {Device, Host} from "../schema/generated/graphql.js"; import {Device, Host} from "../schema/generated/graphql.js";
export const isDevice = (value: Host): value is Device => !!(value as Device).deviceType; export const isDevice = (value: Host | undefined): value is Device => !!(value as Device)?.deviceType;
/* /*
As a default all . - seperators within a key shall be replaced by a Capital letter of the following word As a default all . - seperators within a key shall be replaced by a Capital letter of the following word
*/ */