From f10b035a0b8e43fb54d76cdf373aaa7775476416 Mon Sep 17 00:00:00 2001 From: KIRAN KASHALKAR Date: Tue, 18 Apr 2017 14:19:13 -0400 Subject: [PATCH] NOTICKET: Removing obsolete files Signed-off-by: KIRAN KASHALKAR --- .../src/src/libraries/PackageManagerApi.js | 113 ------ .../plugins/launchpad/src/launchpad-create.js | 132 ------- .../src/launchpad_card/launchpad-card.js | 370 ------------------ 3 files changed, 615 deletions(-) delete mode 100644 skyquake/plugins/composer/src/src/libraries/PackageManagerApi.js delete mode 100644 skyquake/plugins/launchpad/src/launchpad-create.js delete mode 100644 skyquake/plugins/launchpad/src/launchpad_card/launchpad-card.js diff --git a/skyquake/plugins/composer/src/src/libraries/PackageManagerApi.js b/skyquake/plugins/composer/src/src/libraries/PackageManagerApi.js deleted file mode 100644 index 69fa4d66e..000000000 --- a/skyquake/plugins/composer/src/src/libraries/PackageManagerApi.js +++ /dev/null @@ -1,113 +0,0 @@ -/* - * - * Copyright 2016 RIFT.IO Inc - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -import guid from '../libraries/guid' -import DropZone from 'dropzone' -import Utils from '../libraries/utils' -import CatalogPackageManagerActions from '../actions/CatalogPackageManagerActions' -import ReactDOM from 'react-dom' -import $ from 'jquery' - -const API_SERVER = Utils.getSearchParams(window.location).api_server; - - - - -export default class PackageManager { - constructor(element, button, action) { - this.stagingArea = { - packages: { - ids: [] - } - } - this.stagingAreaMonitor = null; - } - createStagingArea(type, name) { - return $.ajax({ - url: Utils.getSearchParams(window.location).api_server + ':8008/api/operations/create-staging-area', - type: 'POST', - data: { - "input" : { - // Package type not important for package upload. - "package-type": type || "NSD", - "name": name || "Package Staging Area" - } - }, - error: function() { - console.log('Something went wrong creating the staging area: ', arguments) - } - }).then(function(data) { - /* - { - "output": { - "endpoint": "api/upload/85f8e2dc-638b-46e7-89cb-ee8de322066f", - "port": "4568" - } - } - */ - const id = data.output.endpoint.split('/')[2]; - const port = data.output.port; - this.stagingArea.packages.ids.push(id); - this.stagingArea.packages[id] = { - port: port - }; - return data - }) - } - monitoringStagingAreaSocket() { - let self = this; - if(self.stagingAreaMonitor) { - return self.stagingAreaMonitor; - } - new Promise(function(resolve, reject) { - $.ajax({ - url: '/socket-polling', - type: 'POST', - beforeSend: Utils.addAuthorizationStub, - data: { - url: 'launchpad/api/nsr?api_server=' + API_SERVER - }, - success: function(data, textStatus, jqXHR) { - Utils.checkAndResolveSocketRequest(data, resolve, reject, self.monitoringStagingAreaSocketHandler); - } - }) - }) - - return undefined; - } - monitoringStagingAreaSocketHandler(connection) { - let self = this; - let ws = window.multiplexer.channel(connection); - if (!connection) return; - self.stagingAreaMonitor = connection; - ws.onmessage = function(socket) { - try { - Utils.checkAuthentication(data.statusCode, function() { - ws.close(); - }); - - } catch(e) { - console.log('An exception occurred in monitoringStagingAreaSocketHandler', e) - } - } - } - -} - - - diff --git a/skyquake/plugins/launchpad/src/launchpad-create.js b/skyquake/plugins/launchpad/src/launchpad-create.js deleted file mode 100644 index cbe6d4b60..000000000 --- a/skyquake/plugins/launchpad/src/launchpad-create.js +++ /dev/null @@ -1,132 +0,0 @@ - -/* - * - * Copyright 2016 RIFT.IO Inc - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -require('../components/form-controls.js'); -require('./launchpad-launch-fleet.html'); -var createStore = require('./createStore.js'); -var createActions = require('./createActions.js'); - - -angular.module('launchpad') - .controller('launchpadCreateCtrl', function($timeout, $stateParams, $state) { - var self = this; - self.createStore = - // var createChannel = $rw.radio.channel('createFleet'); - var apiServer = self.isOnline = require('utils/rw.js').getSearchParams(window.location).api_server; - // var federationChannel = $rw.radio.channel('federationChannel'); - self.fleet = { - template_id: null, - pool_id: null, - description: '', - epa_attributes: {}, - status: "active", - name: 'NEW FLEET' - }; - self.slaParams = []; - self.federation = $stateParams.id; - createStore.getNetworkServices(); - createStore.getSlaParams(); - createStore.getPools(); - createStore.listen(function(state) { - $timeout(function() { - self.networkServices = state.networkServices; - self.slaParams = state.slaParams; - self.fleet.pool = state.pools[0]; - self.pools = state.pools; - angular.forEach(self.slaParams, function(v) { - if (!v.hasOwnProperty('value')) { - v.value = v.options.second; - }; - return v; - }); - }) - }) - // federationChannel.request("federation:services").then(function(data) { - // $timeout(function() { - // // self.fleet.service = 'cag'; - // self.networkServices = data; - // createChannel.request('vnfParams', 'cag').then(function(data) { - // $timeout(function() { - // self.vnfParams = data; - // }); - // }); - // }); - // }); - // federationChannel.request('federation:pools', apiServer).then(function(data) { - // $timeout(function() { - // console.log('pools:', data) - // self.fleet.pool = data[0]; - // self.pools = data; - // }) - // }); - - // federationChannel.request('federation:sla-params').then(function(data) { - // $timeout(function() { - // self.slaParams = data; - // angular.forEach(self.slaParams, function(v) { - // if (!v.hasOwnProperty('value')) { - // v.value = v.options.second; - // }; - // return v; - // }); - // } - // ); - // }); - - // federationChannel.on("launchpadCreate", function() { - // $state.go('launchpad', null, {reload: false}); - - // }); - - self.generateServiceImage = function(service) { - return ('assets/img/svg/' + service.src + (self.isSelectedService(service.id) ? '-active' : '-inactive') + '.svg'); - }; - self.generatePoolImage = function(pool) { - return ('assets/img/svg/' + self.refsDB.resources.openstackCloud.pools[pool.ref].src + (self.isSelectedPool(pool) ? '-active' : '-inactive') + '.svg'); - }; - self.isSelectedPool = function(id) { - return id == self.fleet.pool_id; - }; - self.isSelectedService = function(id) { - return id == self.fleet.template_id; - }; - self.launch = function(launch) { - if (self.fleet.name == "") { - createActions.validateError('Plase Name the Service') - } - createActions.validateReset(); - self.slaParams.forEach(function(v) { - if (v.value.indexOf("RRC") > -1) { - v.value = "RRC"; - } - self.fleet.epa_attributes[v.ref] = v.value; - }); - delete self.fleet.pool; - self.fleet.status = launch ? 'active' : 'inactive'; - createStore.createEnvironment(self.fleet) - }; - self.selectPool = function(id) { - self.fleet.pool_id = id; - // createChannel.command("pool:select", id); - }; - self.selectService = function(id) { - - self.fleet.template_id = id; - // createChannel.command("service:select", id); - }; - }); diff --git a/skyquake/plugins/launchpad/src/launchpad_card/launchpad-card.js b/skyquake/plugins/launchpad/src/launchpad_card/launchpad-card.js deleted file mode 100644 index de276383a..000000000 --- a/skyquake/plugins/launchpad/src/launchpad_card/launchpad-card.js +++ /dev/null @@ -1,370 +0,0 @@ - -/* - * - * Copyright 2016 RIFT.IO Inc - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -require('./launchpad-fleet-card-params.html'); -var React = require('react'); -var LaunchpadCard = require('./launchpadCard.jsx'); -// var LaunchpadCard = require('../../components/dashboard_card/dashboard_card.jsx'); -angular.module('launchpad') - .directive('fleetCard', function($state, $stateParams) { - return { - restrict: 'AE', - replace: true, - template: '
', - scope: { - fleet: '=data', - $index: '=', - metric: '=?', - slaParam: '=?', - nfviMetric: '=?' - }, - - bindToController: true, - controllerAs: 'card', - link: function(scope, element, attributes) { - - }, - controller: function($timeout, $interval, $scope, $rootScope, $element) { - var self = this; - - console.log(self.fleet) - $scope.$watch(function() { - return self.fleet}, reactRender) - function reactRender() { - console.log('rendering', self.fleet) - React.render( - React.createElement(LaunchpadCard, {className:'launchpadCard'} - ), - $element[0] - ); - } - //FOR WAG ONLY - // self.isOn = false; - - // //END WAG ONLY - // //Remove for testing only - // $scope.$watch(function() { - // return self.fleet; - // }, function() {}); - - // // var fleetChannel = $rw.radio.channel('fleetChannel'); - // var FleetStore = require('../launchpadFleetStore.js'); - // self.valueFormat = { - // "int": 1, - // "dec": 0 - // }; - // self.federationID = $stateParams.id; - // //if this is true, set gauges to start - // if (require('utils/rw.js').getSearchParams(window.location).api_server) { - // self.fleet.started = true; - // } - // self.apiServer = require('utils/rw.js').getSearchParams(window.location).api_server; - // self.isNoisy = false; - // var rateChanged = function(rate) { - // self.rate = rate; - // fleetChannel.command('fleet:change:rate', rate) - // } - // var packetSizeChanged = function(packetSize) { - // self.packetSize = packetSize - // fleetChannel.command('fleet:change:packetSize', packetSize) - // }; - // self.openFleet = function(index) { - // var params = require('utils/rw.js').getSearchParams(window.location); - // if (params.api_server) { - // if (params.api_server == "http://10.0.201.25:5000") { - // var newLoc = window.location.origin + window.location.pathname + '?config=' + params.config + '&api_server=' + 'http://10.0.201.25:5050' + '#/wag'; - // window.open(newLoc); - // return; - // } - // if (self.fleet.api == "10.0.117.22") self.fleet.api = "10.0.117.17"; - // var newLoc = window.location.origin + window.location.pathname + '?config=' + params.config + '&api_server=' + 'http://' + self.fleet.api + ':5050' + '&name=' + self.fleet.name + '&env_id=' + self.fleet.id + '#/dashboard/' + $stateParams.id + '/' + index;; - // console.log('Opening new window at: %s', newLoc) - // window.open(newLoc); - // } else { - // if (self.fleet.id == 'wag-fleet') { - // var newLoc = window.location.origin + window.location.pathname + '?config=' + params.config + '#/wag'; - // window.open(newLoc); - // } - // window.open('#/dashboard/' + $stateParams.id + '/' + index); - // } - // }; - // self.openConsole = function(index) { - // console.log(self); - // var params = require('utils/rw.js').getSearchParams(window.location); - // if (params.api_server) { - // if (self.fleet.api == "10.0.117.22") self.fleet.api = "10.0.117.17"; - // var newLoc = self.apiServer + '/api/environments/' + self.fleet.id + '/console'; - // window.open(newLoc); - // } else { - // window.open('#/dashboard/' + $stateParams.id + '/' + index); - // } - // }; - - - // self.noisyToggle = function() { - // var action; - // if (self.isNoisy) { - // action = 'stop'; - // self.isNoisy = false; - // } else { - // action = 'start'; - // self.isNoisy = true; - // } - // $.ajax({ - // url: "http://" + self.fleet.api + ':5050/api/operations/' + action + '-stream', - // type: "POST", - // headers: { - // "Content-Type": "application/vnd.yang.operation+json" - // }, - // dataType: "json", - // data: JSON.stringify({ - // "input": { - // "now": "" - // } - // }) - // }); - // }; - - // self.toggleStatus = function() { - // var state; - // var status = self.fleet.status; - // console.log(self.fleet) - // if (status == "starting" || status == "stopping") { - // return; - // } - // if (status == "active") { - // state = "inactive"; - // } else { - // state = "active"; - // } - // self.fleet.status = state; - // FleetStore.setFleetState(self.fleet.id, state); - // }; - // //CAT + NOISY NEIGHBOR ONLY - - // self.catStarted = false; - // self.catToggle = function() { - // var action; - // if (self.catStarted) { - // action = 'stop'; - // self.catStarted = false; - // } else { - // action = 'start'; - // self.catStarted = true; - // } - // $.ajax({ - // url: "http://" + self.fleet.api + ':5050/api/operations/' + action + '-cat', - // type: "POST", - // headers: { - // "Content-Type": "application/vnd.yang.operation+json" - // }, - // dataType: "json", - // data: JSON.stringify({ - // "input": { - // "now": "" - // } - // }) - // }); - // }; - - // self.deleteFleet = function() { - // if (confirm("Do you really want to delete this fleet?")) { - // // if (confirm("Seriously, you REALLY want to delete this?")) { - // // fleetChannel.request('fleet:delete', self.fleet); - // FleetStore.deleteFleet(self.fleet.id) - // // } - // } - // }; - - - // /** - // * WAG Code Start - // **/ - // // var wagChannel = $rw.radio.channel('wag'); - - // //If Wag page Offline - // if (!self.apiServer && self.fleet.id == 'wag-fleet') { - // self.offline = setInterval(function() { - // if (self.fleet.started) { - // self.fleet.wagpage.clientsim['traffic-gen']['rx-pps'] = 100 * (Math.random() - .5) + 200; - // self.fleet.wagpage.clientsim['traffic-gen']['tx-pps'] = 100 * (Math.random() - .5) + 200; - // } - // }, 2000); - // } - - // // If Wag page Online - // if (self.fleet.template_name == 'Wireless Access Gateway') { - // wagChannel.command('wag-poll'); - // wagChannel.on('wag-update', function(data) { - // $timeout(function() { - // self.fleet.wagpage = {}; - // self.fleet.wagpage.clientsim = data.clientsim - // // self.data.clientsim['traffic-sink']['rx-pps'] / 1000000; - // self.isOn = data.clientsim['traffic-gen-status'].running; - // }); - // }); - // } - - // $rootScope.$on('$stateChangeStart', function() { - // wagChannel.command('wag-poll:kill'); - // }); - - // /** - // * WAG Code End - // **/ - - - } - }; - }) - -.directive('launchpadFleetCardParams', function() { - return { - restrict: 'AE', - replace: true, - templateUrl: '/modules/launchpad/launchpad_card/launchpad-fleet-card-params.html', - controllerAs: 'params', - scope: { - $index: "=", - cardData: '=', - slaParam: '=?', - nfviMetric: '=?' - }, - bindToController: true, - controller: function($scope, $stateParams, $timeout, $interval, $rootScope) { - //remove watch - $scope.$watch(function() { - return self.cardData; - }, function() {}) - var self = this; - var apiServer = require('utils/rw.js').getSearchParams(window.location).api_server; - self.apiServer = apiServer; - // self.refs = refsDB; - - - // var LaunchpadFleetActions = require('../launchpadFleetActions.js'); - // var LaunchpadFleetStore = require('../launchpadFleetStore.js'); - //var LaunchpadFleetActions = require('./launchpadFleetActions.js'); - - self.rate = 40; - self.packetSize = 256; - self.refParam = $rw.refParams; - var currentNFVIRef; - - this.visible = 'default'; - if (self.cardData.id == "wag-fleet") { - self.cardData.started = self.cardData.wagpage.clientsim['traffic-gen-status'].running; - } - - - self.selectedNFVI = 0; - self.selectedSLAParam = {}; - self.refPools = $rw.refPools; - - // Event Listeners - // View Actions - self.load = function(panel) { - self.visible = panel; - }; - self.filterSLA = function(ref) { - // fleetChannel.command('filter:SLAParams', ref); - FleetActions.filterSLAParams(ref); - }; - self.filterNFVI = function(ref) { - FleetActions.filterNfviMetrics(ref) - // fleetChannel.command('filter:NFVIMetrics', ref); - }; - self.serviceToggle = function(fleet, control) { - if (apiServer) { - var vnfrChannel = $rw.radio.channel('vnfr'); - switch (control.ref) { - case "trafgen": - var action = (control.started) ? 'stop' : 'start'; - vnfrChannel.command("vnf:command", action, control.data.api, "http://" + fleet.api + ':5050'); - break; - case "iot_army": - var action = (control.started) ? 'stop' : 'start'; - vnfrChannel.command("vnf:command", action, control.data.api, "http://" + fleet.api + ':5050'); - break; - } - } else { - fleetChannel.command('fleet:start', $stateParams.id, self.$index); - if ($stateParams.id == 'wag-federation') { - if (!self.cardData.wagpage.clientsim['traffic-gen-status']) { - self.cardData.wagpage.clientsim['traffic-gen-status'] = {}; - } - self.cardData.wagpage.clientsim['traffic-gen-status'].running = !self.cardData.wagpage.clientsim['traffic-gen-status'].running; - } - } - - }; - // Init Params - - - //WAG ONLY - if (self.apiServer == "http://10.0.201.25:5000") { - self.isWag = true; - } - self.toggleOn = function(e) { - // self.setPacket(e, self.packetSize); - // self.setRate(e, self.rate); - // self.setSubscribers(e, self.subscribers); - // self.setAP(e, self.ap); - var wagServer = "" - if (self.apiServer) { - if (self.isOn) { - $.ajax({ - type: "POST", - url: "http://10.0.201.25:5050/api/running/stop-device-group/", - success: (function() { - console.log('stahp post sent') - }) - }); - $.ajax({ - type: "POST", - url: "http://10.0.201.25:5050/api/running/stop-sink-server/", - success: (function() { - console.log('stahp post sent') - }) - }); - } else { - $.ajax({ - type: "POST", - url: "http://10.0.201.25:5050/api/running/start-sink-server/", - success: (function() { - console.log('start post sent') - }) - }); - $.ajax({ - type: "POST", - url: "http://10.0.201.25:5050/api/running/start-device-group/", - success: (function() { - console.log('start post sent') - }) - }); - } - } - self.isOn = !self.isOn; - } - - //END WAG ONLY - - }, - link: function(s, e, a) {} - } -}); -- 2.25.1