mirror of https://github.com/portainer/portainer
feat: add setting to change DNS servers (#3511)
* feat: add setting to change DNS servers
* style: fixing codeclimate warning
Looks like conditional was excessive, it works as expected even without
it.
* style: rename 'DNS Server 1/2' to 'Primary/Secondary DNS Server'
Signed-off-by: Kirill K <kovalev.kirill.a@gmail.com>
* style: rename variables in code to match UI naming
* feat: add tooltips on DNS servers input fields
Signed-off-by: Kirill K <kovalev.kirill.a@gmail.com>
* Revert "feat: add tooltips on DNS servers input fields"
This reverts commit b83ef50825
.
* style: secondary DNS placeholder
Signed-off-by: Kirill K <kovalev.kirill.a@gmail.com>
pull/3528/head
parent
fa5bb9b1be
commit
1ef29f2671
|
@ -21,6 +21,8 @@ function ($q, $scope, $async, $state, $timeout, $transition$, $filter, Container
|
||||||
MacAddress: '',
|
MacAddress: '',
|
||||||
IPv4: '',
|
IPv4: '',
|
||||||
IPv6: '',
|
IPv6: '',
|
||||||
|
DnsPrimary: '',
|
||||||
|
DnsSecondary: '',
|
||||||
AccessControlData: new AccessControlFormData(),
|
AccessControlData: new AccessControlFormData(),
|
||||||
CpuLimit: 0,
|
CpuLimit: 0,
|
||||||
MemoryLimit: 0,
|
MemoryLimit: 0,
|
||||||
|
@ -215,6 +217,15 @@ function ($q, $scope, $async, $state, $timeout, $transition$, $filter, Container
|
||||||
config.NetworkingConfig.EndpointsConfig[networkMode].Aliases = _.filter(aliases, (o) => { return !_.startsWith($scope.fromContainer.Id,o)});
|
config.NetworkingConfig.EndpointsConfig[networkMode].Aliases = _.filter(aliases, (o) => { return !_.startsWith($scope.fromContainer.Id,o)});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var dnsServers = [];
|
||||||
|
if ($scope.formValues.DnsPrimary) {
|
||||||
|
dnsServers.push($scope.formValues.DnsPrimary);
|
||||||
|
}
|
||||||
|
if ($scope.formValues.DnsSecondary) {
|
||||||
|
dnsServers.push($scope.formValues.DnsSecondary);
|
||||||
|
}
|
||||||
|
config.HostConfig.Dns = dnsServers;
|
||||||
|
|
||||||
$scope.formValues.ExtraHosts.forEach(function (v) {
|
$scope.formValues.ExtraHosts.forEach(function (v) {
|
||||||
if (v.value) {
|
if (v.value) {
|
||||||
config.HostConfig.ExtraHosts.push(v.value);
|
config.HostConfig.ExtraHosts.push(v.value);
|
||||||
|
@ -387,6 +398,9 @@ function ($q, $scope, $async, $state, $timeout, $transition$, $filter, Container
|
||||||
}
|
}
|
||||||
$scope.formValues.MacAddress = d.Config.MacAddress;
|
$scope.formValues.MacAddress = d.Config.MacAddress;
|
||||||
|
|
||||||
|
$scope.formValues.DnsPrimary = d.HostConfig.Dns[0];
|
||||||
|
$scope.formValues.DnsSecondary = d.HostConfig.Dns[1];
|
||||||
|
|
||||||
// ExtraHosts
|
// ExtraHosts
|
||||||
if ($scope.config.HostConfig.ExtraHosts) {
|
if ($scope.config.HostConfig.ExtraHosts) {
|
||||||
var extraHosts = $scope.config.HostConfig.ExtraHosts;
|
var extraHosts = $scope.config.HostConfig.ExtraHosts;
|
||||||
|
|
|
@ -435,6 +435,22 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- !ipv6-input -->
|
<!-- !ipv6-input -->
|
||||||
|
<!-- dns-primary-input -->
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="container_dns_primary" class="col-sm-2 col-lg-1 control-label text-left">Primary DNS Server</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<input type="text" class="form-control" ng-model="formValues.DnsPrimary" id="container_dns_primary" placeholder="e.g. 1.1.1.1">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- !dns-primary-input -->
|
||||||
|
<!-- dns-secondary-input -->
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="container_dns_secondary" class="col-sm-2 col-lg-1 control-label text-left">Secondary DNS Server</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<input type="text" class="form-control" ng-model="formValues.DnsSecondary" id="container_dns_secondary" placeholder="e.g. 1.0.0.1">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- !dns-secondary-input -->
|
||||||
<!-- extra-hosts-variables -->
|
<!-- extra-hosts-variables -->
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-sm-12" style="margin-top: 5px;">
|
<div class="col-sm-12" style="margin-top: 5px;">
|
||||||
|
|
Loading…
Reference in New Issue