diff --git a/ui/src/js/components/home/ComposeDisplay.js b/ui/src/js/components/home/ComposeDisplay.js
index d5bac72..9a9e150 100644
--- a/ui/src/js/components/home/ComposeDisplay.js
+++ b/ui/src/js/components/home/ComposeDisplay.js
@@ -18,8 +18,34 @@ import React from "react";
var config = require('../../config.js');
var util = require('../../util.js');
+const VlanItem = React.createClass({
+
+ render: function() {
+ return (
+
+ );
+ }
+});
+
const ComposeDisplay = React.createClass({
+ getInitialState: function() {
+ return {
+ vlans: []
+ };
+ },
+
compose: function() {
var data = this.prepareRequest();
var url = config.url + '/Nodes/Actions/Allocate';
@@ -59,6 +85,10 @@ const ComposeDisplay = React.createClass({
var iqn = document.getElementById('iqn').value;
var masterDrive = document.getElementById('remoteDrives').value;
var processorModel = document.getElementById('processorModels').value;
+ var vlans = this.state.vlans.map(function(obj) {
+ return {"VLANId": obj[0],
+ "Tagged": (obj[1] == "Untagged") ? "false": "true"}
+ })
var data = {
"Name": name,
"Description": description,
@@ -81,11 +111,38 @@ const ComposeDisplay = React.createClass({
}
}];
}
+ if (vlans.length > 0) {
+ data["EthernetInterfaces"] = [{"VLANs": vlans}];
+ }
return JSON.stringify(data);
},
clearInputs: function() {
document.getElementById("inputForm").reset();
+ this.setState({vlans: []});
+ },
+
+ addVlan: function() {
+ var vlanId = document.getElementById('vlanId').value;
+ var vlanTag = $(".btn-primary.vlan.active input:first").val();
+ document.getElementById('vlanId').value = '';
+ this.setState({
+ vlans: this.state.vlans.concat([[vlanId, vlanTag]])
+ });
+ },
+
+ removeVlan: function(vlan) {
+ var index = -1;
+ for (var i = 0; i < this.state.vlans.length; i++) {
+ if (vlan[0] == this.state.vlans[i][0] &&
+ vlan[1] == this.state.vlans[i][1]) {
+ index = i;
+ break;
+ }
+ }
+ var newData = this.state.vlans.slice();
+ newData.splice(index, 1);
+ this.setState({vlans: newData});
},
render: function() {
@@ -128,6 +185,33 @@ const ComposeDisplay = React.createClass({
Remote storage master drive: |
|
+
+ Ethernet interface: |
+
+ {this.state.vlans.map(function(obj) {
+ return
+ }.bind(this))}
+
+
+ |
+