feat(container-creation): add support for mac assignments (#1546)

* feat(container-creation): add support for mac assignments (#1524)

* refactor(container-creation): code relocation to relevant function

* style(container-creation): fix typo in environment variables function
pull/1538/head
cbrherms 7 years ago committed by Anthony Lapenna
parent 00daedca30
commit f8c7ee7ae6

@ -11,6 +11,7 @@ function ($q, $scope, $state, $timeout, $transition$, $filter, Container, Contai
NetworkContainer: '', NetworkContainer: '',
Labels: [], Labels: [],
ExtraHosts: [], ExtraHosts: [],
MacAddress: '',
IPv4: '', IPv4: '',
IPv6: '', IPv6: '',
AccessControlData: new AccessControlFormData(), AccessControlData: new AccessControlFormData(),
@ -34,6 +35,7 @@ function ($q, $scope, $state, $timeout, $transition$, $filter, Container, Contai
Image: '', Image: '',
Env: [], Env: [],
Cmd: '', Cmd: '',
MacAddress: '',
ExposedPorts: {}, ExposedPorts: {},
HostConfig: { HostConfig: {
RestartPolicy: { RestartPolicy: {
@ -193,6 +195,7 @@ function ($q, $scope, $state, $timeout, $transition$, $filter, Container, Contai
config.Hostname = ''; config.Hostname = '';
} }
config.HostConfig.NetworkMode = networkMode; config.HostConfig.NetworkMode = networkMode;
config.MacAddress = $scope.formValues.MacAddress;
config.NetworkingConfig.EndpointsConfig[networkMode] = { config.NetworkingConfig.EndpointsConfig[networkMode] = {
IPAMConfig: { IPAMConfig: {
@ -387,6 +390,8 @@ function ($q, $scope, $state, $timeout, $transition$, $filter, Container, Contai
} }
} }
$scope.config.NetworkingConfig.EndpointsConfig[$scope.config.HostConfig.NetworkMode] = d.NetworkSettings.Networks[$scope.config.HostConfig.NetworkMode]; $scope.config.NetworkingConfig.EndpointsConfig[$scope.config.HostConfig.NetworkMode] = d.NetworkSettings.Networks[$scope.config.HostConfig.NetworkMode];
// Mac Address
$scope.formValues.MacAddress = d.NetworkSettings.Networks[$scope.config.HostConfig.NetworkMode].MacAddress;
// ExtraHosts // ExtraHosts
for (var h in $scope.config.HostConfig.ExtraHosts) { for (var h in $scope.config.HostConfig.ExtraHosts) {
if ({}.hasOwnProperty.call($scope.config.HostConfig.ExtraHosts, h)) { if ({}.hasOwnProperty.call($scope.config.HostConfig.ExtraHosts, h)) {
@ -396,7 +401,7 @@ function ($q, $scope, $state, $timeout, $transition$, $filter, Container, Contai
} }
} }
function loadFromContainerEnvrionmentVariables(d) { function loadFromContainerEnvironmentVariables(d) {
var envArr = []; var envArr = [];
for (var e in $scope.config.Env) { for (var e in $scope.config.Env) {
if ({}.hasOwnProperty.call($scope.config.Env, e)) { if ({}.hasOwnProperty.call($scope.config.Env, e)) {
@ -478,7 +483,7 @@ function ($q, $scope, $state, $timeout, $transition$, $filter, Container, Contai
loadFromContainerPortBindings(d); loadFromContainerPortBindings(d);
loadFromContainerVolumes(d); loadFromContainerVolumes(d);
loadFromContainerNetworkConfig(d); loadFromContainerNetworkConfig(d);
loadFromContainerEnvrionmentVariables(d); loadFromContainerEnvironmentVariables(d);
loadFromContainerLabels(d); loadFromContainerLabels(d);
loadFromContainerConsole(d); loadFromContainerConsole(d);
loadFromContainerDevices(d); loadFromContainerDevices(d);

@ -332,6 +332,14 @@
</div> </div>
</div> </div>
<!-- !domainname --> <!-- !domainname -->
<!-- mac-address-input -->
<div class="form-group">
<label for="container_macaddress" class="col-sm-2 col-lg-1 control-label text-left">Mac Address</label>
<div class="col-sm-9">
<input type="text" class="form-control" ng-model="formValues.MacAddress" id="container_macaddress" placeholder="e.g. 12-34-56-78-9a-bc">
</div>
</div>
<!-- !mac-address-input -->
<!-- ipv4-input --> <!-- ipv4-input -->
<div class="form-group"> <div class="form-group">
<label for="container_ipv4" class="col-sm-2 col-lg-1 control-label text-left">IPv4 Address</label> <label for="container_ipv4" class="col-sm-2 col-lg-1 control-label text-left">IPv4 Address</label>

Loading…
Cancel
Save