github.com/hernad/nomad@v1.6.112/ui/app/templates/jobs/index.hbs (about)

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