mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Send node.updated notif only if object changed
This commit is contained in:
3 files changed
+24
-11
No files matched your search
@@ -214,6 +214,8 @@ class Node:
|
||||
# When updating properties used only on controller we don't need to call the compute
|
||||
update_compute = False
|
||||
|
||||
old_json = self.__json__()
|
||||
|
||||
compute_properties = None
|
||||
# Update node properties with additional elements
|
||||
for prop in kwargs:
|
||||
@@ -227,7 +229,9 @@ class Node:
|
||||
else:
|
||||
setattr(self, prop, kwargs[prop])
|
||||
|
||||
self.project.controller.notification.emit("node.updated", self.__json__())
|
||||
# We send notif only if object has changed
|
||||
if old_json != self.__json__():
|
||||
self.project.controller.notification.emit("node.updated", self.__json__())
|
||||
if update_compute:
|
||||
data = self._node_data(properties=compute_properties)
|
||||
response = yield from self.put(None, data=data)
|
||||
@@ -392,9 +396,9 @@ class Node:
|
||||
"console_type": self._console_type,
|
||||
"properties": self._properties,
|
||||
"label": self._label,
|
||||
"x": self._x,
|
||||
"y": self._y,
|
||||
"z": self._z,
|
||||
"x": int(self._x),
|
||||
"y": int(self._y),
|
||||
"z": int(self._z),
|
||||
"symbol": self._symbol
|
||||
}
|
||||
return {
|
||||
@@ -411,8 +415,8 @@ class Node:
|
||||
"properties": self._properties,
|
||||
"status": self._status,
|
||||
"label": self._label,
|
||||
"x": self._x,
|
||||
"y": self._y,
|
||||
"z": self._z,
|
||||
"x": int(self._x),
|
||||
"y": int(self._y),
|
||||
"z": int(self._z),
|
||||
"symbol": self._symbol
|
||||
}
|
||||
@@ -146,15 +146,15 @@ NODE_OBJECT_SCHEMA = {
|
||||
},
|
||||
"x": {
|
||||
"description": "X position of the node",
|
||||
"type": "number"
|
||||
"type": "integer"
|
||||
},
|
||||
"y": {
|
||||
"description": "Y position of the node",
|
||||
"type": "number"
|
||||
"type": "integer"
|
||||
},
|
||||
"z": {
|
||||
"description": "Z position of the node",
|
||||
"type": "number"
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"additionalProperties": False,
|
||||
|
||||
Reference in new issue
Block a user