Prevent unwanted events transmitted to UI (while T2 under development).
Change-Id: Ib96e01bd0992684429e048421c18a24bd11e4a92
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/UiWebSocket.java b/web/gui/src/main/java/org/onosproject/ui/impl/UiWebSocket.java
index 0290857..328207d 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/UiWebSocket.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/UiWebSocket.java
@@ -95,7 +95,12 @@
Topo2Jsonifier t2json = new Topo2Jsonifier(directory);
UiSharedTopologyModel sharedModel = directory.get(UiSharedTopologyModel.class);
UiTopoLayoutService layoutService = directory.get(UiTopoLayoutService.class);
- this.topoSession = new UiTopoSession(this, t2json, sharedModel, layoutService);
+
+ topoSession = new UiTopoSession(this, t2json, sharedModel, layoutService);
+
+ // FIXME: this is temporary to prevent unhandled events being set to GUI...
+ // while Topo2 is still under development
+ topoSession.enableEvent(false);
}
@Override
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/topo/UiTopoSession.java b/web/gui/src/main/java/org/onosproject/ui/impl/topo/UiTopoSession.java
index f13ebc5..288a343 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/topo/UiTopoSession.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/topo/UiTopoSession.java
@@ -66,7 +66,7 @@
private UiTopoLayoutService layoutService;
private UiTopoLayout currentLayout;
- private boolean messagesEnabled;
+ private boolean messagesEnabled = true;
/**
* Creates a new topology session for the specified web socket connection,
@@ -130,16 +130,22 @@
@Override
public void event(UiModelEvent event) {
- log.debug("Event received: {}", event);
- ObjectNode payload = t2json.jsonEvent(event);
+ String msg = messagesEnabled
+ ? "Event received: {}"
+ : "Event received: {}, but not transmitted";
+ log.debug(msg, event);
- // TODO: add filtering for relevant objects only...
- // TO Decide: Since the session holds the state of what is being
- // displayed on the client, we should filter out any model events
- // that are not relevant, and only send up events for objects that
- // are currently being viewed by the user.
+ if (messagesEnabled) {
+ ObjectNode payload = t2json.jsonEvent(event);
- webSocket.sendMessage(TOPO2_UI_MODEL_EVENT, payload);
+ // TODO: add filtering for relevant objects only...
+ // TO Decide: Since the session holds the state of what is being
+ // displayed on the client, we should filter out any model events
+ // that are not relevant, and only send up events for objects that
+ // are currently being viewed by the user.
+
+ webSocket.sendMessage(TOPO2_UI_MODEL_EVENT, payload);
+ }
}
/**