1 define(['common/general/common.general.module'], function(general) {
3 general.factory('GeneralRestangular', function(Restangular, ENV) {
4 return Restangular.withConfig(function(RestangularConfig) {
5 RestangularConfig.setBaseUrl(ENV.baseURL);
10 general.factory('SwitchSvc', function (GeneralRestangular) {
12 base: function (container) {
13 container = container || 'default';
14 return GeneralRestangular.one('controller/nb/v2').one('switchmanager', container);
19 svc.delete = function(node) {
21 return svc.nodeUrl('default', node.node.type, node.node.id).remove();*/
25 svc.nodesUrl = function (container) {
26 return svc.base(container).all('nodes');
30 svc.nodeUrl = function (container, type, id) {
31 return svc.base(container).one('node', type).one(id);
34 svc.getAll = function (container) {
35 return svc.nodesUrl(container).getList();
38 svc.getConnectorProperties = function (container, type, id) {
39 return svc.nodeUrl(container, type, id).get();
42 svc.itemData = function (i) {
45 name: i.properties.description.value !== 'None' ? i.properties.description.value : i.node.type + '/' + i.node.id,
46 params: {nodeId: i.node.id, nodeType: i.node.type}
50 svc.itemsData = function (data_) {
53 angular.forEach(data_.nodeProperties, function (value, key) {
54 data.push(svc.itemData(value));