<commit_before>{extends file="file:[Core]viewLayout.tpl"}

{block name="title"}{t}Event Logs{/t}{/block}

{block name="content"}
<div class="content-container">
  <div class="row search">
    <form role="form" id="filters">
      <div class="form-group col-md-4">
        <input type="text" name="period" class="form-control" placeholder="{t}Period{/t}">
      </div>
      <div class="form-group col-md-4">
        <select name="status" multiple style="width: 100%">
          <option value="0">{t}OK/Up{/t}</option>
          <option value="1">{t}Warning/Down{/t}</option>
          <option value="2">{t}Critical/Unreachable{/t}</option>
          <option value="3">{t}Unknown{/t}</option>
          <option value="4">{t}Pending{/t}</option>
          <option value="5">{t}Information{/t}</option>
        </select>
      </div>
      <div class="form-group col-md-4">
        <select name="msg_type" multiple style="width: 100%">
          <option value="0">{t}Service alert{/t}</option>
          <option value="1">{t}Host Alert{/t}</option>
          <option value="2">{t}Service Notification{/t}</option>
          <option value="3">{t}Host Notification{/t}</option>
          <option value="4">{t}Warning{/t}</option>
          <option value="5">{t}External command{/t}</option>
          <option value="6">{t}Current service state{/t}</option>
          <option value="7">{t}Current host state{/t}</option>
          <option value="8">{t}Initial service state{/t}</option>
          <option value="9">{t}Initial host state{/t}</option>
          <option value="10">{t}Aclknownledge service{/t}</option>
          <option value="11">{t}Aclknownledge host{/t}</option>
        </select>
      </div>
      <div class="form-group col-md-4">
        <!-- @TODO dynamic load -->
        <select name="instance_name" multiple style="width: 100%">
          <option>Central</option>
        </select>
      </div>
      <div class="form-group col-md-8">
        <input type="text" name="output" class="form-control" placeholder="{t}Filter message{/t}">
      </div>
    </form>
  </div>
  <div class="row facets" style="display: none">
  </div>
  <table class="table table-striped table-condensed" id="eventlogs">
  <thead>
    <tr>
      <th class="span-2">{t}Date{/t}</th>
      <th class="span-2">{t}Host{/t}</th>
      <th class="span-2">{t}Service{/t}</th>
      <th class="span-2">{t}Instance{/t}</th>
      <th class="span-1">{t}Status{/t}</th>
      <th class="span-3">{t}Message{/t}</th>
      <th class="badge-new-events" style="display: none;"><a href="#"><i class="fa fa-caret-up"></i> <span></span></a></th>
    </tr>
  </thead>
  <tbody>
  </tbody>
  </table>
</div>
{/block}

{block name="javascript-bottom" append}
<script>
$(function() {
  $('#eventlogs').centreonTableInfiniteScroll({
    ajaxUrlGetScroll: "{url_for url="/realtime/eventlogs"}",
    ajaxUrlGetNew: "{url_for url="/realtime/eventlogs/refresh"}",
    formFilter: "#filters",{literal}
    templateRows: "<tr class='{{{border_color}}}'> \
      <td class='span-2'>{{{datetime}}}</td> \
      <td class='span-2'>{{{host_logo}}} {{{host}}}</td> \
      <td class='span-2'>{{{service_logo}}} {{{service}}}</td> \
      <td class='span-2'>{{{instance}}}</td> \
      <td class='span-1 centreon-status-{{{status}}}'>{{{status_text}}}</td> \
      <td class='span-3'>{{{output}}}</td> \
    </tr>"{/literal}
  });

  $("input[name='period']").daterangepicker({
    timePicker: true,
    timePickerIncrement: 5,
    timePicker12Hour: false,
    format: 'YYYY-MM-DD HH:mm'
  });
  $("input[name='period']").on( "apply.daterangepicker", function( e, $picker ) {
    $($picker.element[0]).trigger('change');
  });

  $("select[name='status']").select2({
    placeholder: "{t}Status{/t}"
  });

  $("select[name='msg_type']").select2({
    placeholder: "{t}Message type{/t}"
  });<commit_msg>improve eventlog page<commit_after>{extends file="file:[Core]viewLayout.tpl"}

{block name="title"}{t}Event Logs{/t}{/block}

{block name="content"}
<div class="content-container">
  <div class="panel panel-default">
    <div class="panel-header">
      <div class="row search">
        <form role="form" id="filters">
          <div class="form-group col-md-4">
            <input type="text" name="period" class="form-control" placeholder="{t}Period{/t}">
          </div>
          <div class="form-group col-md-4">
            <select name="status" multiple style="width: 100%">
              <option value="0">{t}OK / Up{/t}</option>
              <option value="1">{t}Warning / Down{/t}</option>
              <option value="2">{t}Critical / Unreachable{/t}</option>
              <option value="3">{t}Unknown{/t}</option>
              <option value="4">{t}Pending{/t}</option>
              <option value="5">{t}Information{/t}</option>
            </select>
          </div>
          <div class="form-group col-md-4">
            <select name="msg_type" multiple style="width: 100%">
              <option value="0">{t}Service alert{/t}</option>
              <option value="1">{t}Host Alert{/t}</option>
              <option value="2">{t}Service Notification{/t}</option>
              <option value="3">{t}Host Notification{/t}</option>
              <option value="4">{t}Warning{/t}</option>
              <option value="5">{t}External command{/t}</option>
              <option value="6">{t}Current service state{/t}</option>
              <option value="7">{t}Current host state{/t}</option>
              <option value="8">{t}Initial service state{/t}</option>
              <option value="9">{t}Initial host state{/t}</option>
              <option value="10">{t}Aclknownledge service{/t}</option>
              <option value="11">{t}Aclknownledge host{/t}</option>
            </select>
          </div>
          <div class="form-group col-md-4">
            <!-- @TODO dynamic load -->
            <select name="instance_name" multiple style="width: 100%">
              <option>Central</option>
            </select>
          </div>
          <div class="form-group col-md-8">
            <input type="text" name="output" class="form-control" placeholder="{t}Filter message{/t}">
          </div>
        </form>
      </div>
    </div>
  </div>
  <div class="row facets" style="display: none">
  </div>
  <table class="table table-striped table-condensed" id="eventlogs">
  <thead>
    <tr>
      <th class="span-1">{t}Date{/t}</th>
      <th class="span-2">{t}Host{/t}</th>
      <th class="span-2">{t}Service{/t}</th>
<!--  <th class="span-2">{t}Instance{/t}</th>-->
      <th class="span-1">{t}Status{/t}</th>
      <th class="span-6">{t}Message{/t}</th>
      <th class="badge-new-events" style="display: none;"><a href="#"><i class="fa fa-caret-up"></i> <span></span></a></th>
    </tr>
  </thead>
  <tbody>
  </tbody>
  </table>
</div>
{/block}

{block name="javascript-bottom" append}
<script>
$(function() {
  $('#eventlogs').centreonTableInfiniteScroll({
    ajaxUrlGetScroll: "{url_for url="/realtime/eventlogs"}",
    ajaxUrlGetNew: "{url_for url="/realtime/eventlogs/refresh"}",
    formFilter: "#filters",{literal}
    templateRows: "<tr class='{{{border_color}}}'> \
      <td class='span-1'>{{{datetime}}}</td> \
      <td class='span-2'>{{{host_logo}}} {{{host}}}</td> \
      <td class='span-2'>{{{service_logo}}} {{{service}}}</td> \
<!--  <td class='span-2'>{{{instance}}}</td>--> \
      <td class='span-1 centreon-status-{{{status}}}' style='text-align:center;'>{{{status_text}}}</td> \
      <td class='span-6'>{{{output}}}</td> \
    </tr>"{/literal}
  });

  $("input[name='period']").daterangepicker({
    timePicker: true,
    timePickerIncrement: 5,
    timePicker12Hour: false,
    format: 'YYYY-MM-DD HH:mm'
  });
  $("input[name='period']").on( "apply.daterangepicker", function( e, $picker ) {
    $($picker.element[0]).trigger('change');
  });

  $("select[name='status']").select2({
    placeholder: "{t}Status{/t}"
  });

  $("select[name='msg_type']").select2({
    placeholder: "{t}Message type{/t}"
  });
{'fraction_non_alphanumeric': 0.23218734429496762, 'fraction_numerical': 0.012954658694569009, 'mean_word_length': 3.0265797392176528, 'pattern_counts': {'":': 0, '<': 225, '<?xml version=': 0, '>': 225, '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': '254751', 'n_tokens_mistral': 2813, 'n_tokens_neox': 2751, 'n_words': 447}