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

     1  {{!
     2    Copyright (c) HashiCorp, Inc.
     3    SPDX-License-Identifier: MPL-2.0
     4  ~}}
     5  
     6  {{page-title "Task " this.model.name}}
     7  <TaskSubnav @task={{this.model}} />
     8  <section class="section">
     9    {{#if this.error}}
    10      <div data-test-inline-error class="notification is-danger">
    11        <div class="columns">
    12          <div class="column">
    13            <h3 data-test-inline-error-title class="title is-4">
    14              {{this.error.title}}
    15            </h3>
    16            <p data-test-inline-error-body>
    17              {{this.error.description}}
    18            </p>
    19          </div>
    20          <div class="column is-centered is-minimum">
    21            <button
    22              data-test-inline-error-close
    23              class="button is-danger"
    24              onclick={{action this.onDismiss}}
    25              type="button"
    26            >
    27              Okay
    28            </button>
    29          </div>
    30        </div>
    31      </div>
    32    {{/if}}
    33    <h1 class="title with-flex" data-test-title>
    34      <div>
    35        {{this.model.name}}
    36        {{#if this.model.isConnectProxy}}
    37          <ProxyTag @class="bumper-left" />
    38        {{/if}}
    39        <span
    40          class="{{unless this.model.isConnectProxy "bumper-left"}}
    41             tag
    42            {{this.model.stateClass}}"
    43          data-test-state
    44        >
    45          {{this.model.state}}
    46        </span>
    47      </div>
    48      <div>
    49        {{#if this.model.isRunning}}
    50          <div class="two-step-button">
    51            <Exec::OpenButton
    52              @job={{this.model.task.taskGroup.job}}
    53              @taskGroup={{this.model.task.taskGroup}}
    54              @allocation={{this.model.allocation}}
    55              @task={{this.model.task}}
    56            />
    57          </div>
    58          <TwoStepButton
    59            data-test-restart
    60            @alignRight={{true}}
    61            @idleText="Restart Task"
    62            @cancelText="Cancel"
    63            @confirmText="Yes, Restart Task"
    64            @confirmationMessage="Are you sure? This will restart the task in-place."
    65            @awaitingConfirmation={{this.restartTask.isRunning}}
    66            @disabled={{this.restartTask.isRunning}}
    67            @onConfirm={{perform this.restartTask}}
    68          />
    69        {{/if}}
    70      </div>
    71    </h1>
    72    <div class="boxed-section is-small">
    73      <div class="boxed-section-body inline-definitions">
    74        <span class="label">
    75          Task Details
    76        </span>
    77        <span class="pair" data-test-started-at>
    78          <span class="term">
    79            Started At
    80          </span>
    81          {{format-ts this.model.startedAt}}
    82        </span>
    83        {{#if this.model.finishedAt}}
    84          <span class="pair">
    85            <span class="term">
    86              Finished At
    87            </span>
    88            {{format-ts this.model.finishedAt}}
    89          </span>
    90        {{/if}}
    91        <span class="pair">
    92          <span class="term">
    93            Driver
    94          </span>
    95          {{this.model.task.driver}}
    96        </span>
    97        <span class="pair">
    98          <span class="term">
    99            Lifecycle
   100          </span>
   101          <span data-test-lifecycle>
   102            {{this.model.task.lifecycleName}}
   103          </span>
   104        </span>
   105        <span class="pair">
   106          <span class="term">
   107            Namespace
   108          </span>
   109          <span>
   110            {{this.model.allocation.job.namespace.name}}
   111          </span>
   112        </span>
   113  
   114        {{#if (and (can "list variables") this.model.task.pathLinkedVariable)}}
   115          <span class="pair" data-test-task-stat="variables">
   116            <LinkTo @route="variables.variable" @model={{this.model.task.pathLinkedVariable.id}}>Variables</LinkTo>
   117          </span>
   118        {{/if}}
   119  
   120      </div>
   121    </div>
   122    <div class="boxed-section">
   123      <div class="boxed-section-head is-hollow">
   124        Resource Utilization
   125      </div>
   126      <div class="boxed-section-body">
   127        {{#if this.model.isRunning}}
   128          <div class="columns">
   129            <div class="column">
   130              <PrimaryMetric::Task @taskState={{this.model}} @metric="cpu" />
   131            </div>
   132            <div class="column">
   133              <PrimaryMetric::Task @taskState={{this.model}} @metric="memory" />
   134            </div>
   135          </div>
   136        {{else}}
   137          <div data-test-resource-error class="empty-message">
   138            <h3 data-test-resource-error-headline class="empty-message-headline">
   139              Task isn't running
   140            </h3>
   141            <p class="empty-message-body">
   142              Only running tasks utilize resources.
   143            </p>
   144          </div>
   145        {{/if}}
   146      </div>
   147    </div>
   148    {{#if this.model.task.volumeMounts.length}}
   149      <div data-test-volumes class="boxed-section">
   150        <div class="boxed-section-head">
   151          Volumes
   152        </div>
   153        <div class="boxed-section-body is-full-bleed">
   154          <ListTable @source={{this.model.task.volumeMounts}} as |t|>
   155            <t.head>
   156              <th>
   157                Name
   158              </th>
   159              <th>
   160                Destination
   161              </th>
   162              <th>
   163                Permissions
   164              </th>
   165              <th>
   166                Client Source
   167              </th>
   168            </t.head>
   169            <t.body as |row|>
   170              <tr data-test-volume>
   171                <td data-test-volume-name>
   172                  {{row.model.volume}}
   173                </td>
   174                <td data-test-volume-destination>
   175                  <code>
   176                    {{row.model.destination}}
   177                  </code>
   178                </td>
   179                <td data-test-volume-permissions>
   180                  {{if row.model.readOnly "Read" "Read/Write"}}
   181                </td>
   182                <td data-test-volume-client-source>
   183                  {{#if row.model.isCSI}}
   184                    <LinkTo
   185                      @route="csi.volumes.volume"
   186                      @model={{concat
   187                      (format-volume-name
   188                        source=row.model.source
   189                        isPerAlloc=row.model.volumeDeclaration.perAlloc
   190                        volumeExtension=this.model.allocation.volumeExtension)
   191                      "@"
   192                      row.model.namespace.id
   193                      }}
   194                    >
   195                    {{format-volume-name
   196                      source=row.model.source
   197                      isPerAlloc=row.model.volumeDeclaration.perAlloc
   198                      volumeExtension=this.model.allocation.volumeExtension}}
   199                    </LinkTo>
   200                  {{else}}
   201                    {{row.model.source}}
   202                  {{/if}}
   203                </td>
   204              </tr>
   205            </t.body>
   206          </ListTable>
   207        </div>
   208      </div>
   209    {{/if}}
   210    <div class="boxed-section">
   211      <div class="boxed-section-head">
   212        Recent Events
   213      </div>
   214      <div class="boxed-section-body is-full-bleed">
   215        <ListTable
   216          @source={{reverse this.model.events}}
   217          @class="is-striped" as |t|
   218        >
   219          <t.head>
   220            <th class="is-3">
   221              Time
   222            </th>
   223            <th class="is-1">
   224              Type
   225            </th>
   226            <th>
   227              Description
   228            </th>
   229          </t.head>
   230          <t.body as |row|>
   231            <tr data-test-task-event>
   232              <td data-test-task-event-time>
   233                {{format-ts row.model.time}}
   234              </td>
   235              <td data-test-task-event-type>
   236                {{row.model.type}}
   237              </td>
   238              <td data-test-task-event-message>
   239                {{#if row.model.message}}
   240                  {{row.model.message}}
   241                {{else}}
   242                  <em>
   243                    No message
   244                  </em>
   245                {{/if}}
   246              </td>
   247            </tr>
   248          </t.body>
   249        </ListTable>
   250      </div>
   251    </div>
   252  </section>