From 7329ea91ca8fd74bf0a351f5ed3aa0fd369e98fd Mon Sep 17 00:00:00 2001 From: Chaim Lev-Ari Date: Thu, 20 Aug 2020 04:02:25 +0300 Subject: [PATCH] fix(app): set defaults for select boxes (#4235) * fix(container): select runtime by default * fix(network): set default network config * fix(container): set default network container placeholder * fix(services): default service mount --- .../network-macvlan-form/networkMacvlanFormModel.js | 2 +- .../views/containers/create/createContainerController.js | 5 ++--- app/docker/views/services/create/createServiceController.js | 2 +- app/docker/views/services/edit/serviceController.js | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/docker/components/network-macvlan-form/networkMacvlanFormModel.js b/app/docker/components/network-macvlan-form/networkMacvlanFormModel.js index d93d889c1..e790d80c7 100644 --- a/app/docker/components/network-macvlan-form/networkMacvlanFormModel.js +++ b/app/docker/components/network-macvlan-form/networkMacvlanFormModel.js @@ -1,6 +1,6 @@ export function MacvlanFormData() { this.Scope = 'local'; - this.SelectedNetworkConfig = ''; + this.SelectedNetworkConfig = null; this.DatatableState = { selectedItems: [], }; diff --git a/app/docker/views/containers/create/createContainerController.js b/app/docker/views/containers/create/createContainerController.js index 6d9f85ec6..a59371819 100644 --- a/app/docker/views/containers/create/createContainerController.js +++ b/app/docker/views/containers/create/createContainerController.js @@ -63,7 +63,7 @@ angular.module('portainer.docker').controller('CreateContainerController', [ alwaysPull: true, Console: 'none', Volumes: [], - NetworkContainer: '', + NetworkContainer: null, Labels: [], ExtraHosts: [], MacAddress: '', @@ -121,7 +121,7 @@ angular.module('portainer.docker').controller('CreateContainerController', [ NetworkMode: 'bridge', Privileged: false, Init: false, - Runtime: '', + Runtime: null, ExtraHosts: [], Devices: [], CapAdd: [], @@ -696,7 +696,6 @@ angular.module('portainer.docker').controller('CreateContainerController', [ SystemService.info() .then(function success(data) { $scope.availableRuntimes = data.Runtimes ? Object.keys(data.Runtimes) : []; - $scope.config.HostConfig.Runtime = ''; $scope.state.sliderMaxCpu = 32; if (data.NCPU) { $scope.state.sliderMaxCpu = data.NCPU; diff --git a/app/docker/views/services/create/createServiceController.js b/app/docker/views/services/create/createServiceController.js index f836a0b66..2edddb658 100644 --- a/app/docker/views/services/create/createServiceController.js +++ b/app/docker/views/services/create/createServiceController.js @@ -139,7 +139,7 @@ angular.module('portainer.docker').controller('CreateServiceController', [ }; $scope.addVolume = function () { - $scope.formValues.Volumes.push({ Source: '', Target: '', ReadOnly: false, Type: 'volume' }); + $scope.formValues.Volumes.push({ Source: null, Target: '', ReadOnly: false, Type: 'volume' }); }; $scope.removeVolume = function (index) { diff --git a/app/docker/views/services/edit/serviceController.js b/app/docker/views/services/edit/serviceController.js index ef6bd3f8f..f3cd5ae87 100644 --- a/app/docker/views/services/edit/serviceController.js +++ b/app/docker/views/services/edit/serviceController.js @@ -201,7 +201,7 @@ angular.module('portainer.docker').controller('ServiceController', [ } }; $scope.addMount = function addMount(service) { - service.ServiceMounts.push({ Type: 'volume', Source: '', Target: '', ReadOnly: false }); + service.ServiceMounts.push({ Type: 'volume', Source: null, Target: '', ReadOnly: false }); updateServiceArray(service, 'ServiceMounts', service.ServiceMounts); }; $scope.removeMount = function removeMount(service, index) {