nsr['console-urls'] = nsr['console-urls'] ? nsr['console-urls'] : [];
vnfr && vnfr['vdur'] && vnfr['vdur'].map(function(vdur) {
- vdur['console-url'] && nsr['console-urls'].push({
+ // This console-url is what front-end will hit to generate a real console-url
+ vdur['console-url'] = 'api/vnfr/' + vnfr.id + '/vdur/' + vdur.id + '/console-url';
+ nsr['console-urls'].push({
id: vdur.id,
name: vdur.name,
'console-url': vdur['console-url']
vnfr['nfvi-metrics'] = buildNfviGraphs(vnfr.vdur);
vnfr['epa-params'] = epa_aggregator(vnfr.vdur);
vnfr['service-primitives-present'] = (vnfr['vnf-configuration'] && vnfr['vnf-configuration']['service-primitive'] && vnfr['vnf-configuration']['service-primitive'].length > 0) ? true : false;
- })
+ vnfr['vdur'] && vnfr['vdur'].map(function(vdur, vdurIndex) {
+ // This console-url is what front-end will hit to generate a real console-url
+ vdur['console-url'] = 'api/vnfr/' + vnfr.id + '/vdur/' + vdur.id + '/console-url';
+ });
+ });
return resolve(returnData);
};
});
})
}
+VDUR.consoleUrl = {};
+VDUR.consoleUrl.get = function(req) {
+ var api_server = req.query["api_server"];
+ var vnfrID = req.params.vnfr_id;
+ var vdurID = req.params.vdur_id;
+ var uri = utils.confdPort(api_server);
+ uri += APIVersion + '/api/operational/vnfr-console/vnfr/' + vnfrID + '/vdur/' + vdurID + '/console-url' + '?deep';
+ var headers = _.extend({}, constants.HTTP_HEADERS.accept.data, {
+ 'Authorization': req.get('Authorization')
+ });
+ return new Promise(function(resolve, reject) {
+ request({
+ url: uri,
+ method: 'GET',
+ headers: headers,
+ forever: constants.FOREVER_ON,
+ rejectUnauthorized: false,
+ }, function(error, response, body) {
+ if (utils.validateResponse('VDUR.consoleUrl.get', error, response, body, resolve, reject)) {
+ var data = JSON.parse(response.body);
+ var returnData = data;
+ return resolve({
+ data: returnData,
+ statusCode: response.statusCode
+ });
+ };
+ });
+ })
+}
+
CloudAccount.get = function(req) {
var api_server = req.query["api_server"];
var uri = utils.confdPort(api_server);
module.exports.nsr = NSR;
module.exports.vnfr = VNFR;
module.exports.vlr = VLR;
+module.exports.vdur = VDUR;
module.exports.rift = RIFT;
module.exports.computeTopology = ComputeTopology;
module.exports.networkTopology = NetworkTopology;
utils.sendErrorResponse(error, res);
})
});
+ app.get('/api/vnfr/:vnfr_id/vdur/:vdur_id/console-url', function(req, res) {
+ launchpadAPI['vdur']['consoleUrl'].get(req).then(function(data) {
+ utils.sendSuccessResponse(data, res);
+ }, function(error) {
+ utils.sendErrorResponse(error, res);
+ });
+ })
app.get('/api/catalog', cors(), function(req, res) {
launchpadAPI['catalog'].get(req).then(function(data) {
utils.sendSuccessResponse(data, res);
'closeNsrCard',
'instantiateNetworkService',
'setNsListPanelVisible',
+ 'getVDUConsoleLinkSuccess',
+ 'getVDUConsoleLinkError'
);
success: FleetActions.getNsrInstancesSuccess,
error: FleetActions.getNsrInstancesError
},
+ getVDUConsoleLink: {
+ remote: function(state, url) {
+ return new Promise(function(resolve, reject) {
+ $.ajax({
+ url: url + '?api_server=' + API_SERVER,
+ type: 'GET',
+ beforeSend: Utils.addAuthorizationStub,
+ success: function(data) {
+ resolve(data);
+ },
+ error: function(error) {
+ console.log('There was an error getting the VDU link', error);
+ return reject(error);
+ }
+ });
+ });
+ },
+ success: FleetActions.getVDUConsoleLinkSuccess,
+ error: FleetActions.getVDUConsoleLinkError
+ },
deleteNsrInstance: {
remote: function(d, id) {
console.log(id)
closeNsrCard: FleetActions.closeNsrCard,
instantiateNetworkService: FleetActions.instantiateNetworkService,
setNsListPanelVisible: FleetActions.setNsListPanelVisible,
+ getVDUConsoleLinkSuccess: FleetActions.getVDUConsoleLinkSuccess
});
this.bindAction(LaunchNetworkServiceActions.launchNSRSuccess, responseData => {
})
}
+FleetStoreConstructor.prototype.getVDUConsoleLinkSuccess = function(data) {
+ data['console-url'] && window.open(data['console-url']);
+}
+
FleetStore = Alt.createStore(FleetStoreConstructor);
module.exports = FleetStore;
import React from 'react';
import Loader from 'widgets/loading-indicator/loadingIndicator.jsx';
+import LaunchpadFleetStore from '../launchpadFleetStore.js';
+
export default class managementInterfaces extends React.Component {
constructor(props) {
componentWillReceiveProps(nextProps) {
}
+
+ openConsole = (url, event) => {
+ event.preventDefault();
+ LaunchpadFleetStore.getVDUConsoleLink(url);
+ }
render() {
+ let self = this;
let dashboard_html;
let console_html;
let isDisplayed = this.props.display;
let status;
+ let notice;
let applicationDashboards = this.props.interfaces.sort(function(a,b) {
try {
if ((a["short-name"] + '-' + a.id.substr(0,4)) > (b["short-name"] + '-' + b.id.substr(0,4))) {
if(consoleLinks && consoleLinks.length > 0){
status = consoleLinks.map(function(i, index) {
- let consoleLink = i["console-url"] ? 'Open VM Console' : 'None';
+ let consoleLink = i["console-url"] ? 'Obtain Token And Open VM Console' : 'None';
return (
- <li key={index}><h3>{i["name"] + '-' + i.id.substr(0,4)}</h3><a href={i["console-url"]} target="_blank">{consoleLink}</a></li>
+ <li key={index}><h3>{i["name"] + '-' + i.id.substr(0,4)}</h3><span className='consoleLink' onClick={self.openConsole.bind(self, i["console-url"])}>{consoleLink} *</span></li>
)
});
+ notice = <li className='notice'>* If a separate browser window does not open, please check if the popup was blocked and allow it.</li>
} else {
status = <li>No VDU Console Links have been specified.</li>
}
console_html = (
<ul>
{status}
+ {notice}
</ul>
);
justify-content: center;
align-content: center;
color:black;
+
+ .notice {
+ padding-top: 0.5rem;
+ font-size: 0.75rem;
+ color: $gray-darker;
+ }
+
+ span {
+ cursor: pointer;
+ text-decoration: underline;
+ }
+
a {
cursor: pointer;
margin-left: 0.5rem;
import PlacementGroupsInfo from './placementGroupsInfo.jsx';
import JobListCard from '../launchpad_card/jobListCard.jsx';
import NSVirtualLinks from '../virtual_links/nsVirtualLinks.jsx';
+import LaunchpadFleetStore from '../launchpadFleetStore.js';
+
export default class RecordCard extends React.Component {
constructor(props) {
super(props)
// console.log('Selected tab is', index, 'last index is', last);
}
+ openConsole = (url, event) => {
+ event.preventDefault();
+ LaunchpadFleetStore.getVDUConsoleLink(url);
+ }
+
render(){
+ let self = this;
let html;
let content;
let card;
let tabList = [];
let tabPanels = [];
+ let notice = null;
+
switch(this.props.type) {
case 'vnfr' :
cardData = this.props.data[0];
if (cardData['vdur']) {
cardData['vdur'].map((vdur, index) => {
- let consoleLink = vdur['console-url'] ? 'Open VM Console' : 'None';
+ let consoleLink = vdur['console-url'] ? 'Obtain Token And Open VM Console' : 'None';
consoleUrlsList.push(
<li key={index}>
<h3>
{vdur['name'] + '-' + vdur.id.substr(0,4)}
</h3>
- <a href={vdur['console-url']} target='_blank'>
- {consoleLink}
- </a>
+ <span className='consoleLink' onClick={self.openConsole.bind(self, vdur["console-url"])}>
+ {consoleLink} *
+ </span>
</li>
)
+ notice = <li className='notice'>* If a separate browser window does not open, please check if the popup was blocked and allow it.</li>
});
consoleUrlsComponent = (
<div className="consoleUrlsComponent">
<ul className="consoleUrlsList">
{consoleUrlsList}
+ {notice}
</ul>
</div>
);
'getConfigSocketJobError',
'createVirtualLinkLoading', 'createVirtualLinkSuccess', 'createVirtualLinkError',
'editVirtualLinkLoading', 'editVirtualLinkSuccess', 'editVirtualLinkError',
- 'deleteVirtualLinkLoading', 'deleteVirtualLinkSuccess', 'deleteVirtualLinkError',
+ 'deleteVirtualLinkLoading', 'deleteVirtualLinkSuccess', 'deleteVirtualLinkError'
);
error: RecordViewActions.editVirtualLinkError
}
}
-
}
triggerEditVirtualLink(params) {
this.editVirtualLink(params);
}
-
}
.consoleUrlsList {
display: flex;
flex: 1 1 auto;
+ flex-direction: column;
li {
display: flex;
flex: 1 1 auto;
+ &.notice {
+ padding-top: 0.5rem;
+ font-size: 0.75rem;
+ color: $gray-darker;
+ }
+ .consoleLink {
+ cursor: pointer;
+ text-decoration: underline;
+ }
h3 {
align-self: flex-start;
flex: 1 1 auto;