<rd-header>
  <rd-header-title title-text="Storidge profiles">
    <a data-toggle="tooltip" title="Refresh" ui-sref="storidge.profiles" ui-sref-opts="{reload: true}">
      <i class="fa fa-sync" aria-hidden="true"></i>
    </a>
  </rd-header-title>
  <rd-header-content> <a ui-sref="storidge.cluster">Storidge</a> &gt; <a ui-sref="storidge.profiles">Profiles</a> </rd-header-content>
</rd-header>

<div class="row">
  <div class="col-md-12">
    <rd-widget>
      <rd-widget-header icon="fa-plus" title-text="Add a profile"> </rd-widget-header>
      <rd-widget-body>
        <form class="form-horizontal">
          <!-- name-input -->
          <div class="form-group">
            <label for="profile_name" class="col-sm-1 control-label text-left">Name</label>
            <div class="col-sm-11">
              <input type="text" class="form-control" ng-model="formValues.Name" id="profile_name" placeholder="e.g. myProfile" />
            </div>
          </div>
          <!-- !name-input -->
          <!-- tag-note -->
          <div class="form-group">
            <div class="col-sm-12">
              <span class="small text-muted">Note: The profile will be created using the default properties.</span>
            </div>
          </div>
          <!-- !tag-note -->
          <div class="form-group">
            <div class="col-sm-12">
              <button
                type="button"
                class="btn btn-primary btn-sm"
                ng-click="create()"
                ng-disabled="state.actionInProgress || !formValues.Name"
                button-spinner="state.actionInProgress"
              >
                <span ng-hide="state.actionInProgress">Create the profile</span>
                <span ng-show="state.actionInProgress">Creating profile...</span>
              </button>
              <button type="button" class="btn btn-primary btn-sm" ng-disabled="!formValues.Name" ui-sref="storidge.profiles.new({ profileName: formValues.Name })"
                >Modify defaults...</button
              >
            </div>
          </div>
        </form>
      </rd-widget-body>
    </rd-widget>
  </div>
</div>

<div class="row">
  <div class="col-sm-12">
    <storidge-profiles-datatable
      title-text="Profiles"
      title-icon="fa-sticky-note"
      dataset="profiles"
      table-key="storidge_profiles"
      order-by="Name"
      remove-action="removeAction"
    ></storidge-profiles-datatable>
  </div>
</div>

<!-- <div class="row">
  <div class="col-md-12">
    <rd-widget>
      <rd-widget-header icon="fa-sticky-note" title-text="Profiles">
        <div class="pull-right">
          Items per page:
          <select ng-model="state.pagination_count" ng-change="changePaginationCount()">
            <option value="0">All</option>
            <option value="10">10</option>
            <option value="25">25</option>
            <option value="50">50</option>
            <option value="100">100</option>
          </select>
        </div>
      </rd-widget-header>
      <rd-widget-taskbar classes="col-md-12">
        <div class="pull-left">
          <button type="button" class="btn btn-danger" ng-click="removeProfiles()" ng-disabled="!state.selectedItemCount"><i class="fa fa-trash-alt space-right" aria-hidden="true"></i>Remove</button>
        </div>
        <div class="pull-right">
          <input type="text" id="filter" ng-model="state.filter" placeholder="Filter..." class="form-control input-sm" />
        </div>
      </rd-widget-taskbar>
      <rd-widget-body classes="no-padding">
        <div class="table-responsive">
          <table class="table table-hover">
            <thead>
              <tr>
                <th>
                  <input type="checkbox" ng-model="allSelected" ng-change="selectItems(allSelected)" />
                </th>
                <th>
                  <a ng-click="order('Name')">
                    Name
                    <span ng-show="sortType == 'Name' && !sortReverse" class="glyphicon glyphicon-chevron-down"></span>
                    <span ng-show="sortType == 'Name' && sortReverse" class="glyphicon glyphicon-chevron-up"></span>
                  </a>
                </th>
              </tr>
            </thead>
            <tbody>
              <tr dir-paginate="profile in (state.filteredProfiles = (profiles | filter:state.filter | orderBy:sortType:sortReverse | itemsPerPage: state.pagination_count))">
                <td><input type="checkbox" ng-model="profile.Checked" ng-change="selectItem(profile)" /></td>
                <td>
                  <a ui-sref="storidge.profiles.profile({id: profile.Name})">{{ profile.Name }}</a>
                </td>
              </tr>
              <tr ng-if="!profiles">
                <td colspan="3" class="text-center text-muted">Loading...</td>
              </tr>
              <tr ng-if="state.filteredProfiles.length == 0">
                <td colspan="3" class="text-center text-muted">No profiles available.</td>
              </tr>
            </tbody>
          </table>
          <div ng-if="profiles" class="pull-left pagination-controls">
            <dir-pagination-controls></dir-pagination-controls>
          </div>
        </div>
      </rd-widget-body>
    </rd-widget>
  </div>
</div> -->
