github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/ui/app/templates/jobs/index.hbs (about)

     1  {{page-title "Jobs"}}
     2  <section class="section">
     3    <div class="toolbar">
     4      <div class="toolbar-item">
     5        {{#if this.visibleJobs.length}}
     6          <SearchBox
     7            data-test-jobs-search
     8            @searchTerm={{mut this.searchTerm}}
     9            @onChange={{action this.resetPagination}}
    10            @placeholder="Search jobs..."
    11          />
    12        {{/if}}
    13      </div>
    14      {{#if (media "isMobile")}}
    15        <div class="toolbar-item is-right-aligned">
    16          {{#if (can "run job" namespace=this.qpNamespace)}}
    17            <LinkTo
    18              @route="jobs.run"
    19              @query={{hash namespace=this.qpNamespace}}
    20              data-test-run-job
    21              class="button is-primary"
    22            >
    23              Run Job
    24            </LinkTo>
    25          {{else}}
    26            <button
    27              data-test-run-job
    28              class="button is-primary is-disabled tooltip is-right-aligned"
    29              aria-label="You don’t have permission to run jobs"
    30              disabled
    31              type="button"
    32            >
    33              Run Job
    34            </button>
    35          {{/if}}
    36        </div>
    37      {{/if}}
    38      <div class="toolbar-item is-right-aligned is-mobile-full-width">
    39        <div class="button-bar">
    40          {{#if this.system.shouldShowNamespaces}}
    41            <SingleSelectDropdown
    42              data-test-namespace-facet
    43              @label="Namespace"
    44              @options={{this.optionsNamespaces}}
    45              @selection={{this.qpNamespace}}
    46              @onSelect={{action this.setFacetQueryParam "qpNamespace"}}
    47            />
    48          {{/if}}
    49          <MultiSelectDropdown
    50            data-test-type-facet
    51            @label="Type"
    52            @options={{this.optionsType}}
    53            @selection={{this.selectionType}}
    54            @onSelect={{action this.setFacetQueryParam "qpType"}}
    55          />
    56          <MultiSelectDropdown
    57            data-test-status-facet
    58            @label="Status"
    59            @options={{this.optionsStatus}}
    60            @selection={{this.selectionStatus}}
    61            @onSelect={{action this.setFacetQueryParam "qpStatus"}}
    62          />
    63          <MultiSelectDropdown
    64            data-test-datacenter-facet
    65            @label="Datacenter"
    66            @options={{this.optionsDatacenter}}
    67            @selection={{this.selectionDatacenter}}
    68            @onSelect={{action this.setFacetQueryParam "qpDatacenter"}}
    69          />
    70          <MultiSelectDropdown
    71            data-test-prefix-facet
    72            @label="Prefix"
    73            @options={{this.optionsPrefix}}
    74            @selection={{this.selectionPrefix}}
    75            @onSelect={{action this.setFacetQueryParam "qpPrefix"}}
    76          />
    77        </div>
    78      </div>
    79      {{#if (not (media "isMobile"))}}
    80        <div class="toolbar-item is-right-aligned">
    81          {{#if (can "run job" namespace=this.qpNamespace)}}
    82            <LinkTo
    83              @route="jobs.run"
    84              @query={{hash namespace=this.qpNamespace}}
    85              data-test-run-job
    86              class="button is-primary"
    87            >
    88              Run Job
    89            </LinkTo>
    90          {{else}}
    91            <button
    92              data-test-run-job
    93              class="button is-primary is-disabled tooltip is-right-aligned"
    94              aria-label="You don’t have permission to run jobs"
    95              disabled
    96              type="button"
    97            >
    98              Run Job
    99            </button>
   100          {{/if}}
   101        </div>
   102      {{/if}}
   103    </div>
   104    {{#if this.isForbidden}}
   105      <ForbiddenMessage />
   106    {{else if this.sortedJobs}}
   107      <ListPagination
   108        @source={{this.sortedJobs}}
   109        @size={{this.pageSize}}
   110        @page={{this.currentPage}}
   111        as |p|
   112      >
   113        <ListTable
   114          @source={{p.list}}
   115          @sortProperty={{this.sortProperty}}
   116          @sortDescending={{this.sortDescending}}
   117          @class="with-foot"
   118          as |t|
   119        >
   120          <t.head>
   121            <t.sort-by @prop="name">
   122              Name
   123            </t.sort-by>
   124            {{#if this.system.shouldShowNamespaces}}
   125              <t.sort-by @prop="namespace.name">
   126                Namespace
   127              </t.sort-by>
   128            {{/if}}
   129            <t.sort-by @prop="status">
   130              Status
   131            </t.sort-by>
   132            <t.sort-by @prop="type">
   133              Type
   134            </t.sort-by>
   135            <t.sort-by @prop="priority">
   136              Priority
   137            </t.sort-by>
   138            <th>
   139              Groups
   140            </th>
   141            <th class="is-3">
   142              Summary
   143            </th>
   144          </t.head>
   145          <t.body @key="model.id" as |row|>
   146            <JobRow @data-test-job-row={{row.model.plainId}} @job={{row.model}} />
   147          </t.body>
   148        </ListTable>
   149        <div class="table-foot">
   150          <PageSizeSelect @onChange={{action this.resetPagination}} />
   151          <nav class="pagination">
   152            <div class="pagination-numbers">
   153              {{p.startsAt}}
   154              –
   155              {{p.endsAt}}
   156              of
   157              {{this.sortedJobs.length}}
   158              {{#if this.searchTerm}}
   159                <em>
   160                  (
   161                  {{dec this.sortedJobs.length this.filteredJobs.length}}
   162                  hidden by search term)
   163                </em>
   164              {{/if}}
   165            </div>
   166            <p.prev @class="pagination-previous">
   167              {{x-icon "chevron-left"}}
   168            </p.prev>
   169            <p.next @class="pagination-next">
   170              {{x-icon "chevron-right"}}
   171            </p.next>
   172            <ul class="pagination-list"></ul>
   173          </nav>
   174        </div>
   175      </ListPagination>
   176    {{else}}
   177      <div data-test-empty-jobs-list class="empty-message">
   178        {{#if (eq this.visibleJobs.length 0)}}
   179          <h3 data-test-empty-jobs-list-headline class="empty-message-headline">
   180            No Jobs
   181          </h3>
   182          <p class="empty-message-body">
   183            The cluster is currently empty.
   184          </p>
   185        {{else if (eq this.filteredJobs.length 0)}}
   186          <h3 data-test-empty-jobs-list-headline class="empty-message-headline">
   187            No Matches
   188          </h3>
   189          <p class="empty-message-body">
   190            No jobs match your current filter selection.
   191          </p>
   192        {{else if this.searchTerm}}
   193          <h3 data-test-empty-jobs-list-headline class="empty-message-headline">
   194            No Matches
   195          </h3>
   196          <p class="empty-message-body">
   197            No jobs match the term
   198            <strong>
   199              {{this.searchTerm}}
   200            </strong>
   201          </p>
   202        {{/if}}
   203      </div>
   204    {{/if}}
   205  </section>