Get processor models from system info

This commit gets the information about available processor
models from system information, rather than making unneeded
extra API calls to view the details on each processor.

Change-Id: I6c856795765f730a2f34a096504e9f0a1cfb37c9
Closes-bug: #1634302
This commit is contained in:
Nate Potter 2016-10-17 16:33:07 -07:00
parent 3d6b09f2f3
commit 44b034953b
3 changed files with 14 additions and 39 deletions

View File

@ -17,7 +17,6 @@ const Layout = React.createClass({
racks: [],
systems: [],
storage: [],
processors: [],
nodes: []
};
},
@ -26,7 +25,6 @@ const Layout = React.createClass({
this.getPods();
this.getRacks();
this.getSystems();
this.getProcessors();
this.getStorage();
this.getNodes();
},
@ -50,7 +48,6 @@ const Layout = React.createClass({
},
displayCompose: function() {
this.getProcessors();
this.getStorage();
this.fillComposeForms();
this.setState({
@ -78,17 +75,18 @@ const Layout = React.createClass({
fillComposeForms: function() {
// Fill processor dropdown menu
var processorNames = []
for (var i = 0; i < this.state.processors.length; i++) {
if (this.state.processors[i]['Model'] &&
processorNames.indexOf(this.state.processors[i]['Model']) >= 0) {
processorsNames.push(this.state.processors[i]['Model']);
var processorModels = [];
var model;
for (var i = 0; i < this.state.systems.length; i++) {
model = this.state.systems[i]['ProcessorSummary']['Model'];
if (model && processorModels.indexOf(model) >= 0) {
processorModels.push(model);
}
}
this.fillDropdownMenu('procModels', processorNames, processorNames);
this.fillDropdownMenu('processorModels', processorModels, processorModels);
// Fill storage dropdown menu
var driveNames = [];
var driveValues = []
var driveValues = [];
for (var i = 0; i < this.state.storage.length; i++) {
if (this.state.storage[i]['Mode'] == 'LV') {
driveNames.push(this.state.storage[i]['Name']);
@ -122,14 +120,6 @@ const Layout = React.createClass({
this.setState({systems: systems});
},
getProcessors: function() {
util.getProcessors(this.state.systems, this.setProcessors);
},
setProcessors: function(processors) {
this.setState({processors: processors});
},
getStorage: function() {
util.getStorage(this.setStorage);
},

View File

@ -42,7 +42,7 @@ const ComposeDisplay = React.createClass({
var storageCapacity = document.getElementById('storageCapacity').value;
var iqn = document.getElementById('iqn').value;
var masterDrive = document.getElementById('remoteDrives').value;
var procModel = document.getElementById('procModels').value;
var processorModel = document.getElementById('processorModels').value;
var data = {
"Name": name,
"Description": description,
@ -51,7 +51,7 @@ const ComposeDisplay = React.createClass({
}]
}
if (procModel != 'null') {
data["Processors"] = [{"Model": procModel}];
data["Processors"] = [{"Model": processorModel}];
}
if (iqn != 'null' && masterDrive != 'null') {
data["RemoteDrives"] = [{
@ -90,6 +90,10 @@ const ComposeDisplay = React.createClass({
<td align="right">System Memory GB:</td>
<td align="left"><input type="number" min="0" id="totalMem" /></td>
</tr>
<tr>
<td align="right">Processor Model:</td>
<td align="left"><select id="processorModels" /></td>
</tr>
<tr>
<td align="right">Remote Storage Capacity GB:</td>
<td align="left"><input type="number" min="0" id="storageCapacity" /></td>
@ -102,10 +106,6 @@ const ComposeDisplay = React.createClass({
<td align="right">Remote storage master drive:</td>
<td align="left"><select id="remoteDrives" /></td>
</tr>
<tr>
<td align="right">Processor Model:</td>
<td align="left"><select id="procModels" /></td>
</tr>
</tbody>
</table>
</form>

View File

@ -110,21 +110,6 @@ exports.getLogicalDrives = function(services, callback) {
callback(logicalDrives);
};
exports.getProcessors = function(systems, callback) {
var processors = [];
var systemProcessorIds;
var systemProcessors;
for (var i = 0; i < systems.length; i++) {
systemProcessorIds = util.readAndReturn(systems[i]['Processors']['@odata.id']);
systemProcessorIds = JSON.parse(systemProcessorIds);
systemProcessors = util.listItems(systemProcessorIds['Members']);
for (var j = 0; j < systemProcessors.length; j++) {
processors.push(systemProcessors[j]);
}
}
callback(processors);
};
exports.listItems = function(items) {
var returnItems = [];
var count = items.length;