Verified Commit 60b69dc3 authored by Andrey Vertiprahov's avatar Andrey Vertiprahov
Browse files

Set workflow_event_model to Sensor.

parent ee285b76
Pipeline #36346 passed with stages
in 18 minutes and 12 seconds
# ----------------------------------------------------------------------
# Sensor loader
# ----------------------------------------------------------------------
# Copyright (C) 2007-2016 The NOC Project
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
......@@ -22,7 +22,7 @@ class SensorLoader(BaseLoader):
data_model = Sensor
discard_deferred = True
workflow_event_model = False
workflow_event_model = True
def find_object(self, v):
"""
......
......@@ -10,14 +10,16 @@ from typing import Optional, List
# NOC modules
from .base import BaseModel, Reference
from .object import Object
from .managedobject import ManagedObject
class Sensor(BaseModel):
id: str
local_id: str
units: str
object: Optional[Reference]
managed_object: Optional[Reference]
units: Optional[str]
object: Optional[Reference["Object"]]
managed_object: Reference["ManagedObject"]
# Workflow state
state: Optional[str]
labels: List[str] = []
......@@ -63,7 +63,9 @@ class Sensor(Document):
)
local_id = StringField()
state = PlainReferenceField(State)
units = PlainReferenceField(MeasurementUnits)
units = PlainReferenceField(
MeasurementUnits, default=MeasurementUnits.get_default_measurement_units
)
label = StringField()
dashboard_label = StringField()
# Sources that find sensor
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment