mirror of https://github.com/portainer/portainer
				
				
				
			feat(container-creation): add the ability to add entries in the container host file
							parent
							
								
									38244312c5
								
							
						
					
					
						commit
						f1c458b147
					
				| 
						 | 
				
			
			@ -8,7 +8,8 @@ function ($scope, $state, $stateParams, $filter, Config, Info, Container, Contai
 | 
			
		|||
    Volumes: [],
 | 
			
		||||
    Registry: '',
 | 
			
		||||
    NetworkContainer: '',
 | 
			
		||||
    Labels: []
 | 
			
		||||
    Labels: [],
 | 
			
		||||
    ExtraHosts: []
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  $scope.imageConfig = {};
 | 
			
		||||
| 
						 | 
				
			
			@ -26,7 +27,8 @@ function ($scope, $state, $stateParams, $filter, Config, Info, Container, Contai
 | 
			
		|||
      PublishAllPorts: false,
 | 
			
		||||
      Binds: [],
 | 
			
		||||
      NetworkMode: 'bridge',
 | 
			
		||||
      Privileged: false
 | 
			
		||||
      Privileged: false,
 | 
			
		||||
      ExtraHosts: []
 | 
			
		||||
    },
 | 
			
		||||
    Labels: {}
 | 
			
		||||
  };
 | 
			
		||||
| 
						 | 
				
			
			@ -63,6 +65,15 @@ function ($scope, $state, $stateParams, $filter, Config, Info, Container, Contai
 | 
			
		|||
    $scope.formValues.Labels.splice(index, 1);
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  $scope.addExtraHost = function() {
 | 
			
		||||
    $scope.formValues.ExtraHosts.push({ value: '' });
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  $scope.removeExtraHost = function(index) {
 | 
			
		||||
    $scope.formValues.ExtraHosts.splice(index, 1);
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  Config.$promise.then(function (c) {
 | 
			
		||||
    var containersToHideLabels = c.hiddenLabels;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -231,6 +242,12 @@ function ($scope, $state, $stateParams, $filter, Config, Info, Container, Contai
 | 
			
		|||
      networkMode += ':' + containerName;
 | 
			
		||||
    }
 | 
			
		||||
    config.HostConfig.NetworkMode = networkMode;
 | 
			
		||||
    
 | 
			
		||||
    $scope.formValues.ExtraHosts.forEach(function (v) {
 | 
			
		||||
    if (v.value) {
 | 
			
		||||
        config.HostConfig.ExtraHosts.push(v.value);
 | 
			
		||||
      }
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  function prepareLabels(config) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -309,6 +309,31 @@
 | 
			
		|||
                </div>
 | 
			
		||||
              </div>
 | 
			
		||||
              <!-- !domainname -->
 | 
			
		||||
              <!-- extra-hosts-variables -->
 | 
			
		||||
              <div class="form-group">
 | 
			
		||||
                <label for="container_extrahosts" class="col-sm-1 control-label text-left">Extra Hosts</label>
 | 
			
		||||
                <div class="col-sm-11">
 | 
			
		||||
                  <span class="label label-default interactive" ng-click="addExtraHost()">
 | 
			
		||||
                    <i class="fa fa-plus-circle" aria-hidden="true"></i> extra host
 | 
			
		||||
                  </span>
 | 
			
		||||
                </div>
 | 
			
		||||
                <!-- extra-hosts-input-list -->
 | 
			
		||||
                <div class="col-sm-offset-1 col-sm-11 form-inline" style="margin-top: 10px;">
 | 
			
		||||
                  <div ng-repeat="variable in formValues.ExtraHosts" style="margin-top: 2px;">
 | 
			
		||||
                    <div class="input-group col-sm-5 input-group-sm">
 | 
			
		||||
                      <span class="input-group-addon">value</span>
 | 
			
		||||
                      <input type="text" class="form-control" ng-model="variable.value" placeholder="e.g. host:IP">
 | 
			
		||||
                      <span class="input-group-btn">
 | 
			
		||||
                        <button class="btn btn-default" type="button" ng-click="removeExtraHost($index)">
 | 
			
		||||
                          <i class="fa fa-minus" aria-hidden="true"></i>
 | 
			
		||||
                        </button>
 | 
			
		||||
                      </span>
 | 
			
		||||
                    </div>
 | 
			
		||||
                  </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <!-- !extra-hosts-input-list -->
 | 
			
		||||
              </div>
 | 
			
		||||
              <!-- !extra-hosts-variables -->              
 | 
			
		||||
            </form>
 | 
			
		||||
          </div>
 | 
			
		||||
          <!-- !tab-network -->
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue