3 * Copyright 2016 RIFT.IO Inc
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 import NSVirtualLinkCreateActions
from './nsVirtualLinkCreateActions.js';
19 import $ from 'jquery';
20 var Utils
= require('utils/utils.js');
21 let API_SERVER
= require('utils/rw.js').getSearchParams(window
.location
).api_server
;
22 let HOST
= API_SERVER
;
23 let NODE_PORT
= require('utils/rw.js').getSearchParams(window
.location
).api_port
|| ((window
.location
.protocol
== 'https:') ? 8443 : 8000);
24 let DEV_MODE
= require('utils/rw.js').getSearchParams(window
.location
).dev_mode
|| false;
27 HOST
= window
.location
.protocol
+ '//' + window
.location
.hostname
;
34 remote(state
, nsrId
, payload
) {
35 return new Promise(function(resolve
, reject
) {
37 url
: 'api/nsr/' + nsrId
+ '/vld' + '?api_server=' + API_SERVER
,
39 beforeSend
: Utils
.addAuthorizationStub
,
42 success: function(data
) {
45 error: function(error
) {
46 console
.log("There was an error creating the virtual link: ", error
);
52 loading
: NSVirtualLinkCreateActions
.createVirtualLinkLoading
,
53 success
: NSVirtualLinkCreateActions
.createVirtualLinkSuccess
,
54 error
: NSVirtualLinkCreateActions
.createVirtualLinkError
59 remote(state
, nsrId
, vldId
) {
60 return new Promise(function(resolve
, reject
) {
62 url
: 'api/nsr/' + nsrId
+ '/vld/' + vldId
+ '?api_server=' + API_SERVER
,
64 beforeSend
: Utils
.addAuthorizationStub
,
65 success: function(data
) {
68 error: function(error
) {
69 console
.log("There was an error deleting the virtual link: ", error
);
75 loading
: NSVirtualLinkCreateActions
.deleteVirtualLinkLoading
,
76 success
: NSVirtualLinkCreateActions
.deleteVirtualLinkSuccess
,
77 error
: NSVirtualLinkCreateActions
.deleteVirtualLinkError
82 remote(state
, nsrId
, vldId
, vld
) {
83 return new Promise(function(resolve
, reject
) {
85 url
: 'api/nsr/' + nsrId
+ '/vld/' + vldId
+ '?api_server=' + API_SERVER
,
87 beforeSend
: Utils
.addAuthorizationStub
,
90 success: function(data
) {
93 error: function(error
) {
94 console
.log("There was an error editing the virtual link: ", error
);
100 loading
: NSVirtualLinkCreateActions
.editVirtualLinkLoading
,
101 success
: NSVirtualLinkCreateActions
.editVirtualLinkSuccess
,
102 error
: NSVirtualLinkCreateActions
.editVirtualLinkError