Added button to reset subscriber
diff --git a/views/ngXosViews/diagnostic/src/css/diagnostic.css b/views/ngXosViews/diagnostic/src/css/diagnostic.css
index 4492faf..19d64a7 100644
--- a/views/ngXosViews/diagnostic/src/css/diagnostic.css
+++ b/views/ngXosViews/diagnostic/src/css/diagnostic.css
@@ -39,6 +39,14 @@
padding: 10px;
}
+diagnostic-container .onethird-height .well.pull-right{
+ position: absolute;
+ right: 0px;
+ top: -15px;
+ cursor: pointer;
+ z-index: 200;
+}
+
/* subscriber-status-modal */
subscriber-status-modal .row + .row {
diff --git a/views/ngXosViews/diagnostic/src/js/chart_data_service.js b/views/ngXosViews/diagnostic/src/js/chart_data_service.js
index c74e289..6f57ef0 100644
--- a/views/ngXosViews/diagnostic/src/js/chart_data_service.js
+++ b/views/ngXosViews/diagnostic/src/js/chart_data_service.js
@@ -70,6 +70,21 @@
return this.logicTopologyData;
};
+ /**
+ * Remove a subscriber from the tree
+ */
+
+ this.removeSubscriber = () => {
+ this.logicTopologyData.children[0].children[0].children[0].children[0].humanReadableName = 'Subscriber';
+ this.currentSubscriber = null;
+ if(serviceTopologyConfig.elWidths[serviceTopologyConfig.elWidths.length - 1] === 160){
+ serviceTopologyConfig.elWidths.pop();
+ }
+
+ this.highlightInstances([]);
+ delete this.logicTopologyData.children[0].children[0].children[0].children[0].children;
+ }
+
this.getSubscriberTag = (subscriber) => {
const tags = {
cTag: subscriber.c_tag,
diff --git a/views/ngXosViews/diagnostic/src/js/diagnostic.js b/views/ngXosViews/diagnostic/src/js/diagnostic.js
index 419dd7c..7d97fdb 100644
--- a/views/ngXosViews/diagnostic/src/js/diagnostic.js
+++ b/views/ngXosViews/diagnostic/src/js/diagnostic.js
@@ -10,23 +10,33 @@
this.loader = true;
this.error = false;
- Subscribers.query().$promise
- .then((subscribers) => {
- this.subscribers = subscribers;
- return ServiceRelation.get();
- })
- .then((serviceChain) => {
- this.serviceChain = serviceChain;
- // debug helper
- loadSubscriber(this.subscribers[0]);
- })
- .catch(e => {
- throw new Error(e);
- this.error = e;
- })
- .finally(() => {
- this.loader = false;
- });
+
+ const loadGlobalScope = () => {
+ Subscribers.query().$promise
+ .then((subscribers) => {
+ this.subscribers = subscribers;
+ return ServiceRelation.get();
+ })
+ .then((serviceChain) => {
+ this.serviceChain = serviceChain;
+ // debug helper
+ // loadSubscriber(this.subscribers[0]);
+ })
+ .catch(e => {
+ throw new Error(e);
+ this.error = e;
+ })
+ .finally(() => {
+ this.loader = false;
+ });
+ };
+
+ loadGlobalScope();
+
+ this.reloadGlobalScope = () => {
+ this.selectedSubscriber = null;
+ loadGlobalScope();
+ }
const loadSubscriber = (subscriber) => {
ServiceRelation.getBySubscriber(subscriber)
diff --git a/views/ngXosViews/diagnostic/src/js/logicTopology.js b/views/ngXosViews/diagnostic/src/js/logicTopology.js
index edd64ea..722328d 100644
--- a/views/ngXosViews/diagnostic/src/js/logicTopology.js
+++ b/views/ngXosViews/diagnostic/src/js/logicTopology.js
@@ -26,16 +26,23 @@
.style('height', `${el.clientHeight}px`);
}
- ChartData.getLogicTree()
- .then((tree) => {
- LogicTopologyHelper.updateTree(svg);
- });
+ const loadGlobalScope = () => {
+ ChartData.getLogicTree()
+ .then((tree) => {
+ LogicTopologyHelper.updateTree(svg);
+ });
+ }
+ loadGlobalScope();
$scope.$watch(() => this.selected, (selected) => {
if(selected){
ChartData.selectSubscriber(selected);
LogicTopologyHelper.updateTree(svg);
}
+ else{
+ ChartData.removeSubscriber();
+ LogicTopologyHelper.updateTree(svg);
+ }
});
$rootScope.$on('instance.detail.hide', () => {
diff --git a/views/ngXosViews/diagnostic/src/js/nodeDrawer.js b/views/ngXosViews/diagnostic/src/js/nodeDrawer.js
index dcd7f4e..229b629 100644
--- a/views/ngXosViews/diagnostic/src/js/nodeDrawer.js
+++ b/views/ngXosViews/diagnostic/src/js/nodeDrawer.js
@@ -478,6 +478,10 @@
};
this.addPhisical = (nodes) => {
+
+ nodes.select('rect').remove();
+ nodes.select('text').remove();
+
nodes.append('rect')
.attr(serviceTopologyConfig.square);
diff --git a/views/ngXosViews/diagnostic/src/js/subscriber-modal.js b/views/ngXosViews/diagnostic/src/js/subscriber-modal.js
index 2911733..47b6a8d 100644
--- a/views/ngXosViews/diagnostic/src/js/subscriber-modal.js
+++ b/views/ngXosViews/diagnostic/src/js/subscriber-modal.js
@@ -42,6 +42,9 @@
});
$scope.$watch(() => this.subscriber, () => {
+ if(!this.subscriber){
+ return;
+ }
this.subscriber.uplink_speed = parseInt(this.subscriber.uplink_speed, 10);
this.subscriber.downlink_speed = parseInt(this.subscriber.downlink_speed, 10);
});
diff --git a/views/ngXosViews/diagnostic/src/templates/diagnostic.tpl.html b/views/ngXosViews/diagnostic/src/templates/diagnostic.tpl.html
index 6ae3407..ffd5564 100644
--- a/views/ngXosViews/diagnostic/src/templates/diagnostic.tpl.html
+++ b/views/ngXosViews/diagnostic/src/templates/diagnostic.tpl.html
@@ -4,6 +4,9 @@
<div class="well">
Services Graph
</div>
+ <div class="well pull-right" ng-click="vm.reloadGlobalScope()">
+ Reset subscriber
+ </div>
<service-topology service-chain="vm.serviceChain"></service-topology>
</div>
<div class="twothird-height">