<ng-form ng-if="service.EnvironmentVariables" id="service-env-variables" name="serviceEnvForm" class="form-horizontal">
  <rd-widget>
    <rd-widget-header icon="list" title-text="Environment variables">
      <div class="nopadding" authorization="DockerServiceUpdate">
        <a class="btn btn-secondary btn-sm pull-right" ng-click="isUpdating || addEnvironmentVariable(service)" ng-disabled="isUpdating">
          <pr-icon icon="'plus'"></pr-icon> environment variable
        </a>
      </div>
    </rd-widget-header>
    <rd-widget-body ng-if="service.EnvironmentVariables.length === 0">
      <p>There are no environment variables for this service.</p>
    </rd-widget-body>
    <rd-widget-body ng-if="service.EnvironmentVariables.length > 0">
      <environment-variables-fieldset values="service.EnvironmentVariables" on-change="(onChangeEnvVars)"></environment-variables-fieldset>
    </rd-widget-body>
    <rd-widget-footer authorization="DockerServiceUpdate">
      <div class="btn-toolbar" role="toolbar">
        <div class="btn-group" role="group">
          <button
            type="button"
            class="btn btn-primary btn-sm"
            ng-disabled="!hasChanges(service, ['EnvironmentVariables']) || serviceEnvForm.$invalid"
            ng-click="updateService(service)"
          >
            Apply changes
          </button>
          <button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
            <pr-icon icon="'chevron-down'"></pr-icon>
          </button>
          <ul class="dropdown-menu">
            <li><a ng-click="cancelChanges(service, ['EnvironmentVariables'])">Reset changes</a></li>
            <li><a ng-click="cancelChanges(service)">Reset all changes</a></li>
          </ul>
        </div>
      </div>
    </rd-widget-footer>
  </rd-widget>
</ng-form>
