<commit_before>import Icon from 'fa-icon';
import Status from '../status';
---hbs---

<div class="flex">
  <section class='flex flex-1 flex-col w-8/12'>
    <div class='bg-white p-4 mb-4 rounded-lg shadow-lg'>
      <div class='flex flex-col justify-center mb-4'>
        <div class='flex'>
          <Status class='flex text-3xl mr-2' @status={{@job.status}}/>

          <div class='flex flex-col'>
            {{@job.trigger.message}}

            <div class='text-gray-800 text-sm'>
              {{@job.ref.branch}}
              {{truncate @job.ref.id}}
            </div>

            <div class="mt-1 text-gray-800 text-sm">
              {{format-date @job.created}}
            </div>
          </div>
        </div>

        <div class='flex items-center mt-2'>
          <img src={{@job.trigger.author.image}} class="rounded-full w-8 mr-2" alt="Author avatar">
          {{@job.trigger.author.name}}
        </div>
      </div>

      <ul class='flex flex-wrap'>
        {{#each-in @job.phases as |key|}}
          <li>
            <button
              type='button'
              class="
                {{if
                  (eq this.selectedPhase key)
                  'bg-blue-800 border-blue-800 text-white'
                }}
                {{if (eq @job.phase key) 'border-pink-400'}}
                flex items-center border border-gray-300 rounded-full flex item-center text-center px-3 py-1 mr-2
                mb-2 md:mb-0
              "
              {{on 'click' (fn (mut this.selectedPhase) key)}}
            >
              {{#if (eq (get @job.phases (concat key ".exitCode")) key)}}
                <Icon class='text-gray-400 mr-2' @icon='circle-notch' @spin={{true}} @prefix='fas'/>
              {{else if (gt @job.phase.exitCode 0)}}
                <Icon class='text-red-500 mr-2' @icon='times-circle' @prefix='fas'/>
              {{else if (eq (get @job.phases (concat key ".exitCode")) 0)}}
                <Icon class='text-green-500 mr-2' @icon='check-circle' @prefix='fas'/>
              {{else if (eq (get @job.phases (concat key ".exitCode")) -1)}}
                <Icon class='text-gray-300 mr-2' @icon='lock' @prefix='fas'/>
              {{else}}
                <Icon class='text-orange-500 mr-2' @icon='exclamation-triangle' @prefix='fas'/>
              {{/if}}

              {{key}}
            </button>
          </li>
        {{/each-in}}
      </ul>
    </div>

    {{#if this.selectedPhase}}
      <div>
        {{#let (get @job.phases this.selectedPhase) as |phase|}}
          {{#each phase.commands as |command|}}
            <section class="mb-2">
              <header
                class='flex justify-between bg-gray-700 text-white text-sm rounded rounded-b-none p-2 block'<commit_msg>fix: don't use get, since each-in also sends the item<commit_after>import Icon from 'fa-icon';
import Status from '../status';
---hbs---

<div class="flex">
  <section class='flex flex-1 flex-col w-8/12'>
    <div class='bg-white p-4 mb-4 rounded-lg shadow-lg'>
      <div class='flex flex-col justify-center mb-4'>
        <div class='flex'>
          <Status class='flex text-3xl mr-2' @status={{@job.status}}/>

          <div class='flex flex-col'>
            {{@job.trigger.message}}

            <div class='text-gray-800 text-sm'>
              {{@job.ref.branch}}
              {{truncate @job.ref.id}}
            </div>

            <div class="mt-1 text-gray-800 text-sm">
              {{format-date @job.created}}
            </div>
          </div>
        </div>

        <div class='flex items-center mt-2'>
          <img src={{@job.trigger.author.image}} class="rounded-full w-8 mr-2" alt="Author avatar">
          {{@job.trigger.author.name}}
        </div>
      </div>

      <ul class='flex flex-wrap'>
        {{#each-in @job.phases as |key phase|}}
          <li>
            <button
              type='button'
              class="
                {{if
                  (eq this.selectedPhase key)
                  'bg-blue-800 border-blue-800 text-white'
                }}
                {{if (eq @job.phase key) 'border-pink-400'}}
                flex items-center border border-gray-300 rounded-full flex item-center text-center px-3 py-1 mr-2
                mb-2 md:mb-0
              "
              {{on 'click' (fn (mut this.selectedPhase) key)}}
            >
              {{#if (eq phase.exitCode key)}}
                <Icon class='text-gray-400 mr-2' @icon='circle-notch' @spin={{true}} @prefix='fas'/>
              {{else if (gt phase.exitCode 0)}}
                <Icon class='text-red-500 mr-2' @icon='times-circle' @prefix='fas'/>
              {{else if (eq phase.exitCode 0)}}
                <Icon class='text-green-500 mr-2' @icon='check-circle' @prefix='fas'/>
              {{else if (eq phase.exitCode -1)}}
                <Icon class='text-gray-300 mr-2' @icon='lock' @prefix='fas'/>
              {{else}}
                <Icon class='text-orange-500 mr-2' @icon='exclamation-triangle' @prefix='fas'/>
              {{/if}}

              {{key}}
            </button>
          </li>
        {{/each-in}}
      </ul>
    </div>

    {{#if this.selectedPhase}}
      <div>
        {{#let (get @job.phases this.selectedPhase) as |phase|}}
          {{#each phase.commands as |command|}}
            <section class="mb-2">
              <header
                class='flex justify-between bg-gray-700 text-white text-sm rounded rounded-b-none p-2 block'
{'fraction_non_alphanumeric': 0.17120907261752333, 'fraction_numerical': 0.02341320651179806, 'mean_word_length': 1.5939278937381405, 'pattern_counts': {'":': 0, '<': 67, '<?xml version=': 0, '>': 65, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6722545', 'n_tokens_mistral': 1780, 'n_tokens_neox': 1688, 'n_words': 397}