From 1e1d7fadd8642e014deab5f981536b40ee56424e Mon Sep 17 00:00:00 2001 From: Nate Potter Date: Wed, 26 Oct 2016 13:29:36 -0700 Subject: [PATCH] Switch target API to Valence This commit moves the UI API calls from the pod manager to the Valence API, which will then forward requests to the pod manager. Currently it's just passing along direct requests, but as the API/controller service is fleshed out more functionality will be added to the UI using the Valence API. Change-Id: Idf352572a2df7e45b76548a9089ef61dea3d360f Closes-bug: #1636958 --- ui/src/js/components/home/ComposeDisplay.js | 2 +- ui/src/js/components/home/Home.js | 2 +- ui/src/js/components/home/NodeList.js | 8 ++++---- ui/src/js/config.js | 6 ++---- ui/src/js/util.js | 20 +++++++------------- 5 files changed, 15 insertions(+), 23 deletions(-) diff --git a/ui/src/js/components/home/ComposeDisplay.js b/ui/src/js/components/home/ComposeDisplay.js index 430bb9a..dce3f5f 100644 --- a/ui/src/js/components/home/ComposeDisplay.js +++ b/ui/src/js/components/home/ComposeDisplay.js @@ -7,7 +7,7 @@ const ComposeDisplay = React.createClass({ compose: function() { var data = this.prepareRequest(); - var url = config.url + '/redfish/v1/Nodes/Actions/Allocate'; + var url = config.url + '/Nodes/Actions/Allocate'; $.ajax({ url: url, type: 'POST', diff --git a/ui/src/js/components/home/Home.js b/ui/src/js/components/home/Home.js index 63814d1..0ec11cb 100644 --- a/ui/src/js/components/home/Home.js +++ b/ui/src/js/components/home/Home.js @@ -13,7 +13,7 @@ const Home = React.createClass({ * * TODO(ntpttr): Remove this once the compose menu is fully flushed out. */ - var url = config.url + '/redfish/v1/Nodes/Actions/Allocate'; + var url = config.url + '/Nodes/Actions/Allocate'; $.ajax({ url: url, type: 'POST', diff --git a/ui/src/js/components/home/NodeList.js b/ui/src/js/components/home/NodeList.js index 95af304..1abc5a2 100644 --- a/ui/src/js/components/home/NodeList.js +++ b/ui/src/js/components/home/NodeList.js @@ -6,7 +6,7 @@ var util = require('../../util.js'); const NodeList = React.createClass({ delete: function(nodeId) { - var url = config.url + '/redfish/v1/Nodes/' + nodeId; + var url = config.url + '/Nodes/' + nodeId; $.ajax({ url: url, type: 'DELETE', @@ -24,7 +24,7 @@ const NodeList = React.createClass({ }, setBoot: function(nodeId) { - var url = config.url + '/redfish/v1/Nodes/' + nodeId; + var url = config.url + '/Nodes/' + nodeId; $.ajax({ url: url, type: 'PATCH', @@ -47,7 +47,7 @@ const NodeList = React.createClass({ }, assemble: function(nodeId) { - var url = config.url + '/redfish/v1/Nodes/' + nodeId + '/Actions/ComposedNode.Assemble'; + var url = config.url + '/Nodes/' + nodeId + '/Actions/ComposedNode.Assemble'; $.ajax({ url: url, type: 'POST', @@ -61,7 +61,7 @@ const NodeList = React.createClass({ }, powerOn: function(nodeId) { - var url = config.url + '/redfish/v1/Nodes/' + nodeId + '/Actions/ComposedNode.Reset'; + var url = config.url + '/Nodes/' + nodeId + '/Actions/ComposedNode.Reset'; $.ajax({ url: url, type: 'POST', diff --git a/ui/src/js/config.js b/ui/src/js/config.js index cdbeaa0..8dc0a75 100644 --- a/ui/src/js/config.js +++ b/ui/src/js/config.js @@ -1,10 +1,8 @@ /* - * Configuration file for RSC UI. + * Configuration file for RSC UI. */ -exports.url = "http://127.0.0.1:6000" -exports.username = "admin" -exports.password = "admin" +exports.url = "http://127.0.0.1:8181" exports.nodeConfig = { diff --git a/ui/src/js/util.js b/ui/src/js/util.js index e8b433f..75242dd 100644 --- a/ui/src/js/util.js +++ b/ui/src/js/util.js @@ -1,16 +1,8 @@ var config = require('./config.js'); var util = require('./util.js'); -// Base64 username:password on client-side, and append into request header -$.ajaxSetup({ - beforeSend: function(xhr) { - xhr.setRequestHeader('Authorization', - 'Basic ' + btoa(config.username + ':' + config.password)); - } -}); - exports.getPods = function(callback) { - var url = config.url + '/redfish/v1/Chassis'; + var url = config.url + '/Chassis'; $.ajax({ url: url, type: 'GET', @@ -28,7 +20,7 @@ exports.getPods = function(callback) { }; exports.getRacks = function(callback) { - var url = config.url + '/redfish/v1/Chassis'; + var url = config.url + '/Chassis'; $.ajax({ url: url, type: 'GET', @@ -46,7 +38,7 @@ exports.getRacks = function(callback) { }; exports.getSystems = function(callback) { - var url = config.url + '/redfish/v1/Systems'; + var url = config.url + '/Systems'; $.ajax({ url: url, type: 'GET', @@ -63,7 +55,7 @@ exports.getSystems = function(callback) { }; exports.getNodes = function(callback) { - var url = config.url + '/redfish/v1/Nodes'; + var url = config.url + '/Nodes'; $.ajax({ url: url, type: 'GET', @@ -80,7 +72,7 @@ exports.getNodes = function(callback) { }; exports.getStorage = function(callback) { - var url = config.url + '/redfish/v1/Services'; + var url = config.url + '/Services'; $.ajax({ url: url, type: 'GET', @@ -139,6 +131,8 @@ exports.filterChassis = function(memberList, filter) { }; exports.readAndReturn = function(resource) { + // remove redfish from URL for passthrough + resource = resource.replace("/redfish/v1", ""); var url = config.url + resource; return $.ajax({ url: url,