1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-01 04:38:12 +00:00

Send updated event when you update the node

This commit is contained in:
Julien Duponchelle 2016-05-18 11:00:35 +02:00
parent 7ebbdcd47c
commit 82f82f8cf9
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8
10 changed files with 16 additions and 0 deletions

View File

@ -105,6 +105,12 @@ class BaseNode:
def status(self, status):
self._node_status = status
self.updated()
def updated(self):
"""
Send a updated event
"""
self.project.emit("node.updated", self)
@property

View File

@ -255,6 +255,7 @@ class DockerHandler:
container.environment = request.json.get("environment", container.environment)
container.adapters = request.json.get("adapters", container.adapters)
yield from container.update()
container.updated()
response.json(container)
@Route.post(

View File

@ -106,6 +106,7 @@ class DynamipsDeviceHandler:
for port in request.json["ports"]:
yield from device.set_port_settings(port["port"], port)
device.updated()
response.json(device)
@Route.delete(

View File

@ -122,6 +122,7 @@ class DynamipsVMHandler:
dynamips_manager = Dynamips.instance()
vm = dynamips_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
yield from dynamips_manager.update_vm_settings(vm, request.json)
vm.updated()
response.json(vm)
@Route.delete(

View File

@ -112,6 +112,7 @@ class EthernetHubHandler:
# builtin_manager = Builtin.instance()
# node = builtin_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
node.updated()
response.json(node)
@Route.delete(

View File

@ -123,6 +123,7 @@ class IOUHandler:
vm.startup_config = request.json.get("startup_config_content")
if "private_config_content" in request.json:
vm.private_config = request.json.get("private_config_content")
vm.updated()
response.json(vm)
@Route.delete(

View File

@ -119,6 +119,7 @@ class QEMUHandler:
if hasattr(vm, name) and getattr(vm, name) != value:
setattr(vm, name, value)
vm.updated()
response.json(vm)
@Route.delete(

View File

@ -30,6 +30,7 @@ from gns3server.schemas.virtualbox import (
VBOX_OBJECT_SCHEMA
)
class VirtualBoxHandler:
"""
@ -137,6 +138,7 @@ class VirtualBoxHandler:
if hasattr(vm, name) and getattr(vm, name) != value:
setattr(vm, name, value)
vm.updated()
response.json(vm)
@Route.delete(

View File

@ -111,6 +111,7 @@ class VMwareHandler:
if hasattr(vm, name) and getattr(vm, name) != value:
setattr(vm, name, value)
vm.updated()
response.json(vm)
@Route.delete(

View File

@ -98,6 +98,7 @@ class VPCSHandler:
vm.name = request.json.get("name", vm.name)
vm.console = request.json.get("console", vm.console)
vm.startup_script = request.json.get("startup_script", vm.startup_script)
vm.updated()
response.json(vm)
@Route.delete(