X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FUI.git;a=blobdiff_plain;f=skyquake%2Fplugins%2Fcomposer%2Fsrc%2Fsrc%2Flibraries%2FPackageManagerApi.js;fp=skyquake%2Fplugins%2Fcomposer%2Fsrc%2Fsrc%2Flibraries%2FPackageManagerApi.js;h=0000000000000000000000000000000000000000;hp=69fa4d66e86e8cebfcaa4bcee6e00c9be15d90a4;hb=03156e335275de1dafbc2a816e98006afdf249bf;hpb=f2dc2462571800e62cba969964de621dca09299c 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) - } - } - } - -} - - -