github.com/hernad/nomad@v1.6.112/ui/app/templates/components/job-editor/read.hbs (about)

     1  {{!
     2    Copyright (c) HashiCorp, Inc.
     3    SPDX-License-Identifier: MPL-2.0
     4  ~}}
     5  
     6  <div class="boxed-section">
     7      <div class="boxed-section-head">
     8      Job Definition
     9      <div class="pull-right" style="display: flex">
    10          <span class="header-toggle">
    11            <Hds::Form::Toggle::Field
    12              {{keyboard-shortcut label="Toggle word wrap" action=(action @fns.onToggleWrap) pattern=(array "w" "w") menuLevel=true }}
    13              checked={{@data.shouldWrap}}
    14              {{on "change" @fns.onToggleWrap}}
    15            as |F|>
    16              <F.Label>Word Wrap</F.Label>
    17            </Hds::Form::Toggle::Field>
    18          </span>
    19  
    20          <Tooltip @condition={{unless @data.hasSpecification true false}} @isFullText={{true}} @text="A jobspec file was not submitted when this job was run. You can still view and edit the expanded JSON format.">
    21              <div class="job-definition-select {{unless @data.hasSpecification " disabled"}}" data-test-select={{@data.view}}>
    22                  <button 
    23                      class="button is-small is-borderless {{if (eq @data.view "job-spec") "is-active"}}"
    24                      type="button"
    25                      {{on "click" (fn @fns.onSelect "job-spec")}}
    26                  >
    27                      Job Spec
    28                  </button>
    29                  <button 
    30                      class="button is-small is-borderless {{if (eq @data.view "full-definition") "is-active"}}"
    31                      type="button"
    32                      {{on "click" (fn @fns.onSelect "full-definition")}}
    33                      data-test-select-full
    34                  >
    35                      Full Definition
    36                  </button>
    37              </div>        
    38          </Tooltip>
    39  
    40          <button
    41              class="button is-light is-compact"
    42              type="button"
    43              {{on "click" @fns.onEdit}}
    44              data-test-edit-job
    45          >
    46              Edit
    47          </button>
    48  
    49        </div>
    50      </div>
    51      <div class="boxed-section-body is-full-bleed">
    52      {{#if (eq @data.view "job-spec")}}
    53          <div 
    54              data-test-job-spec-view 
    55              {{code-mirror
    56              content=@data.definition
    57              mode=(if (eq @data.format "json") "javascript" "ruby")
    58              readOnly=true
    59              screenReaderLabel="Job specification"          
    60              theme="hashi-read-only"
    61              lineWrapping=@data.shouldWrap
    62              }} 
    63          />
    64      {{else}}
    65          <div
    66              data-test-json-viewer
    67              {{code-mirror
    68              content=@data.definition
    69              theme="hashi-read-only"
    70              readOnly=true
    71              screenReaderLabel="JSON Viewer"
    72              lineWrapping=@data.shouldWrap
    73              }}
    74          />
    75      {{/if}}
    76      </div>
    77      {{#if (and (eq @data.view "job-spec") @data.hasVariables)}}
    78      <div class="boxed-section" style="margin-top: 10px">
    79          <div class="boxed-section-head">
    80              HCL Variable Values
    81          </div>
    82          <div class="boxed-section-body is-full-bleed">
    83              <div
    84                  class="json-viewer is-variable-editor"
    85                  data-test-variable-editor
    86                  {{code-mirror
    87                      screenReaderLabel="HLC Variables for Job Spec"
    88                      content=@data.job._newDefinitionVariables
    89                      mode="ruby"
    90                      theme="hashi-read-only"
    91                      readOnly=true
    92                      lineWrapping=@data.shouldWrap
    93                  }}
    94              />
    95          </div>
    96      </div>
    97      {{/if}}
    98  </div>