4 * Copyright 2016 RIFT.IO Inc
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
19 var alt
= require('./alt');
20 var Utils
= require('utils/utils.js');
21 var API_SERVER
= require('utils/rw.js').getSearchParams(window
.location
).api_server
;
22 var NODE_PORT
= require('utils/rw.js').getSearchParams(window
.location
).api_port
|| ((window
.location
.protocol
== 'https:') ? 8443 : 8000);
23 var createActions
= require('./createActions.js');
24 import $ from 'jquery';
27 getNetworkServices: function() {
30 return new Promise(function(resolve
, reject
) {
32 url
: '//' + window
.location
.hostname
+ ':' + window
.location
.port
+ '/api/launchpad/network-service?api_server=' + API_SERVER
,
34 beforeSend
: Utils
.addAuthorizationStub
,
35 success: function(data
) {
41 success
: createActions
.getNetworkServicesSuccess
,
42 error
: createActions
.getNetworkServicesError
45 createEnvironment: function() {
47 remote: function(state
, environment
) {
49 url
: '//' + window
.location
.hostname
+ ':' + window
.location
.port
+ '/api/launchpad/environment?api_server=' + API_SERVER
,
51 beforeSend
: Utils
.addAuthorizationStub
,
53 data
: JSON
.stringify(environment
),
54 contentType
: 'application/json',
55 accept
: 'application/json'
59 success
: createActions
.createEnvironmentSuccess
,
60 error
: createActions
.createEnvironmentsError
63 getPools: function() {
66 return new Promise(function(resolve
, reject
) {
68 url
: '//' + window
.location
.hostname
+ ':' + window
.location
.port
+ '/api/launchpad/pools?api_server=' + API_SERVER
,
70 beforeSend
: Utils
.addAuthorizationStub
,
71 success: function(data
) {
77 success
: createActions
.getPoolsSuccess
,
78 error
: createActions
.getPoolsError
81 getSlaParams: function() {
84 return new Promise(function(resolve
, reject
) {
86 url
: '//' + window
.location
.hostname
+ ':' + window
.location
.port
+ '/api/launchpad/sla-params?api_server=' + API_SERVER
,
88 beforeSend
: Utils
.addAuthorizationStub
,
89 success: function(data
) {
95 success
: createActions
.getSlaParamsSuccess
,
96 error
: createActions
.getSlaParamsError