Reading subscriber detail from cordsubscriber
diff --git a/views/ngXosViews/diagnostic/mocks/data/cordsubscriber.json b/views/ngXosViews/diagnostic/mocks/data/cordsubscriber.json
new file mode 100644
index 0000000..15d1385
--- /dev/null
+++ b/views/ngXosViews/diagnostic/mocks/data/cordsubscriber.json
@@ -0,0 +1,31 @@
+[
+ {
+ "humanReadableName": "cordSubscriber-1",
+ "id": 1,
+ "service_specific_id": "123",
+ "vlan_id": "432",
+ "s_tag": "222",
+ "c_tag": "432",
+ "vcpe_id": 4,
+ "instance": 1,
+ "instance_name": "mysite_vsg",
+ "image": 1,
+ "image_name": "trusty-server-multi-nic",
+ "firewall_enable": false,
+ "firewall_rules": "accept all anywhere anywhere",
+ "url_filter_enable": false,
+ "url_filter_rules": "allow all",
+ "url_filter_level": "R",
+ "bbs_account": null,
+ "ssh_command": null,
+ "vcpe_synced": false,
+ "cdn_enable": false,
+ "vbng_id": 5,
+ "routeable_subnet": "",
+ "nat_ip": null,
+ "lan_ip": null,
+ "wan_ip": null,
+ "private_ip": null,
+ "wan_mac": null
+ }
+]
\ No newline at end of file
diff --git a/views/ngXosViews/diagnostic/mocks/data/subscribers.json b/views/ngXosViews/diagnostic/mocks/data/subscribers.json
deleted file mode 100644
index e84673d..0000000
--- a/views/ngXosViews/diagnostic/mocks/data/subscribers.json
+++ /dev/null
@@ -1,38 +0,0 @@
-[
- {
- "humanReadableName":"Marc Twain",
- "id":1,
- "created":"2016-02-17T19:36:04.167Z",
- "updated":"2016-02-17T19:36:05.413Z",
- "enacted":null,
- "policed":null,
- "backend_register":"{}",
- "backend_status":"0 - Provisioning in progress",
- "deleted":false,
- "write_protect":false,
- "lazy_blocked":false,
- "no_sync":false,
- "kind":"CordSubscriberRoot",
- "name":"Marc Twain",
- "service_specific_attribute":"{\"url_filter_enable\": false, \"cdn_enable\": false, \"url_filter_level\": \"R\", \"users\": [{\"mac\": \"01:02:03:04:05:06\", \"level\": \"PG_13\", \"id\": 0, \"name\": \"Mom's PC\"}, {\"mac\": \"34:36:3B:C9:B6:A6\", \"id\": 1, \"name\": \"Jill's Laptop\", \"level\": \"PG_13\"}, {\"mac\": \"68:5B:35:9D:91:D5\", \"level\": \"PG_13\", \"id\": 2, \"name\": \"Jack's Laptop\"}, {\"id\": 3, \"mac\": \"90:E2:BA:82:F9:75\", \"name\": \"Dad's PC\", \"level\": \"PG_13\"}], \"firewall_enable\": false}",
- "service_specific_id":"123"
- },
- {
- "humanReadableName":"Jack London",
- "id":2,
- "created":"2016-02-17T19:36:04.167Z",
- "updated":"2016-02-17T19:36:05.413Z",
- "enacted":null,
- "policed":null,
- "backend_register":"{}",
- "backend_status":"0 - Provisioning in progress",
- "deleted":false,
- "write_protect":false,
- "lazy_blocked":false,
- "no_sync":false,
- "kind":"CordSubscriberRoot",
- "name":"My House",
- "service_specific_attribute":"{\"url_filter_enable\": false, \"cdn_enable\": false, \"url_filter_level\": \"R\", \"users\": [{\"mac\": \"01:02:03:04:05:06\", \"level\": \"PG_13\", \"id\": 0, \"name\": \"Mom's PC\"}, {\"mac\": \"34:36:3B:C9:B6:A6\", \"id\": 1, \"name\": \"Jill's Laptop\", \"level\": \"PG_13\"}, {\"mac\": \"68:5B:35:9D:91:D5\", \"level\": \"PG_13\", \"id\": 2, \"name\": \"Jack's Laptop\"}, {\"id\": 3, \"mac\": \"90:E2:BA:82:F9:75\", \"name\": \"Dad's PC\", \"level\": \"PG_13\"}], \"firewall_enable\": false}",
- "service_specific_id":"123"
- }
-]
\ No newline at end of file
diff --git a/views/ngXosViews/diagnostic/mocks/diagnostic.conf.json b/views/ngXosViews/diagnostic/mocks/diagnostic.conf.json
index 660c9f8..e677249 100644
--- a/views/ngXosViews/diagnostic/mocks/diagnostic.conf.json
+++ b/views/ngXosViews/diagnostic/mocks/diagnostic.conf.json
@@ -1,7 +1,7 @@
[
{
- "url": "subscribers",
- "base": "xos/",
+ "url": "cordsubscriber",
+ "base": "xoslib/",
"methods": ["GET"],
"param": "id"
},
diff --git a/views/ngXosViews/diagnostic/src/css/diagnostic.css b/views/ngXosViews/diagnostic/src/css/diagnostic.css
index 2fe3993..de76060 100644
--- a/views/ngXosViews/diagnostic/src/css/diagnostic.css
+++ b/views/ngXosViews/diagnostic/src/css/diagnostic.css
@@ -1,6 +1,7 @@
/* CONTAINER */
#xosDiagnostic, [ui-view] {
- height: 700px;
+ min-height: 700px;
+ position: relative;
}
diagnostic-container .half-height {
diff --git a/views/ngXosViews/diagnostic/src/js/chart_data_service.js b/views/ngXosViews/diagnostic/src/js/chart_data_service.js
index 609b27b..7326ac8 100644
--- a/views/ngXosViews/diagnostic/src/js/chart_data_service.js
+++ b/views/ngXosViews/diagnostic/src/js/chart_data_service.js
@@ -52,8 +52,8 @@
*/
this.addSubscriberTag = (tags) => {
this.logicTopologyData.children[0].children[0].children[0].subscriberTag = {
- cTag: tags.c_tag,
- sTag: tags.s_tag
+ cTag: tags.cTag,
+ sTag: tags.sTag
};
};
@@ -68,16 +68,15 @@
return this.logicTopologyData;
};
- this.getSubscriberTag = () => {
- const tags = JSON.parse(this.currentServiceChain.children[0].tenant.service_specific_attribute);
- delete tags.creator_id;
+ this.getSubscriberTag = (subscriber) => {
+ const tags = {
+ cTag: subscriber.c_tag,
+ sTag: subscriber.s_tag
+ };
this.addSubscriberTag(tags);
// add tags info to current subscriber
- this.currentSubscriber.tags = {
- cTag: tags.c_tag,
- sTag: tags.s_tag
- };
+ this.currentSubscriber.tags = tags;
};
@@ -88,7 +87,6 @@
};
this.selectSubscriber = (subscriber) => {
-
// append the device with to config settings
serviceTopologyConfig.elWidths.push(160);
@@ -97,7 +95,7 @@
//clean selected instances
this.highlightInstances([]);
- this.getSubscriberTag();
+ this.getSubscriberTag(subscriber);
this.getSubscriberIP();
};
diff --git a/views/ngXosViews/diagnostic/src/js/logicTopology.js b/views/ngXosViews/diagnostic/src/js/logicTopology.js
index ce81bec..b12bfb5 100644
--- a/views/ngXosViews/diagnostic/src/js/logicTopology.js
+++ b/views/ngXosViews/diagnostic/src/js/logicTopology.js
@@ -50,17 +50,6 @@
$rootScope.$on('instance.detail', (evt, service) => {
ChartData.getInstanceStatus(service)
.then((instances) => {
- // this.hideInstanceStats = false;
- // // HACK if array is empty wait for animation
- // if(instances.length === 0){
- // this.hideInstanceStats = true;
- // $timeout(() => {
- // this.selectedInstances = instances;
- // }, 500);
- // }
- // else{
- // this.selectedInstances = instances;
- // }
LogicTopologyHelper.updateTree(svg);
})
})
diff --git a/views/ngXosViews/diagnostic/src/js/nodeDrawer.js b/views/ngXosViews/diagnostic/src/js/nodeDrawer.js
index e875426..4bb6c98 100644
--- a/views/ngXosViews/diagnostic/src/js/nodeDrawer.js
+++ b/views/ngXosViews/diagnostic/src/js/nodeDrawer.js
@@ -475,7 +475,9 @@
'text-anchor': 'middle',
y: serviceTopologyConfig.square.y - 10
})
- .text(d => d.name);
+ .text(d => {
+ return d.name || d.humanReadableName
+ });
}
this.addDevice = (nodes) => {
diff --git a/views/ngXosViews/diagnostic/src/js/rest_services.js b/views/ngXosViews/diagnostic/src/js/rest_services.js
index f49df1c..e88f098 100644
--- a/views/ngXosViews/diagnostic/src/js/rest_services.js
+++ b/views/ngXosViews/diagnostic/src/js/rest_services.js
@@ -164,7 +164,7 @@
});
})
.service('Subscribers', function($resource, $q, SubscriberDevice){
- return $resource('/xos/subscribers/:id', {id: '@id'}, {
+ return $resource('/xoslib/cordsubscriber/:id', {id: '@id'}, {
queryWithDevices: {
method: 'GET',
isArray: true,
@@ -336,7 +336,7 @@
const serviceTree = buildLevel(tenants, services, rootService, rootTenant);
return {
- name: subscriber.name,
+ name: subscriber.name || subscriber.humanReadableName,
parent: null,
type: 'subscriber',
children: [serviceTree]
diff --git a/views/ngXosViews/diagnostic/src/js/serviceTopology.js b/views/ngXosViews/diagnostic/src/js/serviceTopology.js
index 49e5d71..2755620 100644
--- a/views/ngXosViews/diagnostic/src/js/serviceTopology.js
+++ b/views/ngXosViews/diagnostic/src/js/serviceTopology.js
@@ -55,21 +55,8 @@
// ServiceTopologyHelper.drawLegend(svg);
ServiceTopologyHelper.updateTree(treeContainer, treeLayout, root);
};
-
- this.getInstances = (slice) => {
- Instances.query({slice: slice.id}).$promise
- .then((instances) => {
- this.selectedSlice = slice;
- this.instances = instances;
- })
- .catch(e => {
- this.errors = e;
- throw new Error(e);
- })
- };
$scope.$watch(() => this.serviceChain, (chain) => {
- console.log(chain);
if(angular.isDefined(chain)){
draw(chain);
}
diff --git a/views/ngXosViews/diagnostic/src/js/serviceTopologyHelper.js b/views/ngXosViews/diagnostic/src/js/serviceTopologyHelper.js
index 1d53d72..28794c2 100644
--- a/views/ngXosViews/diagnostic/src/js/serviceTopologyHelper.js
+++ b/views/ngXosViews/diagnostic/src/js/serviceTopologyHelper.js
@@ -4,87 +4,6 @@
angular.module('xos.diagnostic')
.service('ServiceTopologyHelper', function($rootScope, $window, $log, lodash, ServiceRelation, serviceTopologyConfig, d3){
- // NOTE not used anymore
- const drawLegend = (svg) => {
- const legendContainer = svg.append('g')
- .attr({
- class: 'legend'
- });
-
- legendContainer.append('rect')
- .attr({
- transform: d => `translate(10, 80)`,
- width: 100,
- height: 100
- });
-
- // service
- const service = legendContainer.append('g')
- .attr({
- class: 'node service'
- });
-
- service.append('circle')
- .attr({
- r: serviceTopologyConfig.circle.radius,
- transform: d => `translate(30, 100)`
- });
-
- service.append('text')
- .attr({
- transform: d => `translate(45, 100)`,
- dy: '.35em'
- })
- .text('Service')
- .style('fill-opacity', 1);
-
- // slice
- const slice = legendContainer.append('g')
- .attr({
- class: 'node slice'
- });
-
- slice.append('rect')
- .attr({
- width: 20,
- height: 20,
- x: -10,
- y: -10,
- transform: d => `translate(30, 130)`
- });
-
- slice.append('text')
- .attr({
- transform: d => `translate(45, 130)`,
- dy: '.35em'
- })
- .text('Slices')
- .style('fill-opacity', 1);
-
- // instance
- const instance = legendContainer.append('g')
- .attr({
- class: 'node instance'
- });
-
- instance.append('rect')
- .attr({
- width: 20,
- height: 20,
- x: -10,
- y: -10,
- transform: d => `translate(30, 160)`
- });
-
- instance.append('text')
- .attr({
- transform: d => `translate(45, 160)`,
- dy: '.35em'
- })
- .text('Instances')
- .style('fill-opacity', 1);
- };
-
var _svg, _layout, _source;
var i = 0;
@@ -240,7 +159,6 @@
};
this.updateTree = updateTree;
- this.drawLegend = drawLegend;
});
}());
\ No newline at end of file