github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/ui/app/templates/components/job-diff.hbs (about)

     1  {{! Job heading }}
     2  {{! template-lint-disable simple-unless }}
     3  <div
     4    data-test-diff-section-label="job"
     5    data-test-diff-field="{{lowercase this.diff.Type}}"
     6    class="{{if
     7        this.diff.Type
     8        (concat 'diff-section-label is-' (lowercase this.diff.Type))
     9      }}"
    10  >
    11    <span class="marker {{concat 'is-' (lowercase this.diff.Type)}}">
    12      {{#if (eq (lowercase this.diff.Type) "added")}}
    13        +
    14      {{else if (eq (lowercase this.diff.Type) "deleted")}}
    15        -
    16      {{else if (eq (lowercase this.diff.Type) "edited")}}
    17        +/-
    18      {{/if}}
    19    </span>
    20    <span class="diff-section-bold">Job: "{{this.diff.ID}}"</span>
    21  </div>
    22  
    23  {{! Show job field and object diffs if the job is edited }}
    24  {{#if (or this.verbose (eq (lowercase this.diff.Type) "edited"))}}
    25    <div data-test-diff-section-label="job-diff" class="diff-section-label">
    26      <JobDiffFieldsAndObjects
    27        @fields={{this.diff.Fields}}
    28        @objects={{this.diff.Objects}}
    29      />
    30    </div>
    31  {{/if}}
    32  
    33  {{! Each task group }}
    34  {{#each this.diff.TaskGroups as |group|}}
    35    <div
    36      data-test-diff-section-label="task-group"
    37      class="{{if
    38          group.Type
    39          (concat 'diff-section-label is-' (lowercase group.Type))
    40        }}"
    41    >
    42      <span class="marker {{concat 'is-' (lowercase group.Type)}}">
    43        {{#if (eq (lowercase group.Type) "added")}}
    44          +
    45        {{else if (eq (lowercase group.Type) "deleted")}}
    46          -
    47        {{else if (eq (lowercase group.Type) "edited")}}
    48          +/-
    49        {{/if}}
    50      </span>
    51      <span class="diff-section-bold">Task Group: "{{group.Name}}"</span>
    52      {{#if group.Updates}}
    53        ({{#each-in group.Updates as |updateType count|}}
    54          <span class="job-diff-update-count {{css-class updateType}}">{{count}}
    55            {{updateType}}</span>
    56        {{/each-in}})
    57      {{/if}}
    58  
    59      {{! Show task group field and object diffs if the task group is edited }}
    60      {{#if (or (eq (lowercase group.Type) "edited") this.verbose)}}
    61        <div
    62          data-test-diff-section-label="task-group-diff"
    63          class="diff-section-label"
    64        >
    65          <JobDiffFieldsAndObjects
    66            @fields={{group.Fields}}
    67            @objects={{group.Objects}}
    68          />
    69        </div>
    70      {{/if}}
    71  
    72      {{! Each task }}
    73      {{#each group.Tasks as |task|}}
    74        <div
    75          data-test-diff-section-label="task"
    76          data-test-diff-field="{{lowercase task.Type}}"
    77          class="{{if
    78              task.Type
    79              (concat 'diff-section-label is-' (lowercase task.Type))
    80            }}"
    81        >
    82          <span class="marker {{concat 'is-' (lowercase task.Type)}}">
    83            {{#if (eq (lowercase task.Type) "added")}}
    84              +
    85            {{else if (eq (lowercase task.Type) "deleted")}}
    86              -
    87            {{else if (eq (lowercase task.Type) "edited")}}
    88              +/-
    89            {{/if}}
    90          </span>
    91          Task: "{{task.Name}}"
    92          {{#if task.Annotations}}
    93            ({{~#each task.Annotations as |annotation index|}}
    94              <span class="{{css-class annotation}}">{{annotation}}</span>
    95              {{#unless (eq index (dec task.Annotations.length))}},{{/unless}}
    96            {{/each~}})
    97          {{/if}}
    98          {{#if (or this.verbose (eq (lowercase task.Type) "edited"))}}
    99            <JobDiffFieldsAndObjects
   100              @fields={{task.Fields}}
   101              @objects={{task.Objects}}
   102            />
   103          {{/if}}
   104        </div>
   105      {{/each}}
   106    </div>
   107  {{/each}}