<commit_before>%helper = app.helper
%datamgr = app.datamgr

%rebase("layout", title='All problems', js=['problems/js/problems.js', 'problems/js/bookmarks.js'], css=['problems/css/problems.css'], refresh=True, user=user, navi=navi, app=app, page="/all", elts_per_page=elts_per_page)

<script type="text/javascript">
   var actions_enabled = {{'true' if app.can_action() else 'false'}};

   // List of the bookmarks
   var bookmarks = [];
   var bookmarksro = [];

   %for b in bookmarks:
    declare_bookmark("{{!b['name']}}","{{!b['uri']}}");
   %end
   %for b in bookmarksro:
    declare_bookmarksro("{{!b['name']}}","{{!b['uri']}}");
   %end

 // On page loaded ...
 $(function(){
    // We prevent the dropdown to close when we go on a form into it.
    $('.form_in_dropdown').on('click', function (e) {
       e.stopPropagation()
    });
 });
</script>

%if len(app.get_all_problems()) and app.play_sound:
 <EMBED src="/static/sound/alert.wav" autostart=true loop=false volume=100 hidden=true>
%end

<!-- Problems filtering and display -->
<div class="row">
   %if app.can_action():
   <!-- Left panel, toolbar and active filters -->
   <div id="toolbar" class="col-lg-3 col-md-4 col-sm-4" style="display:none;">

   %include("_panel_actions.tpl")
   </div>
   %end

 <!-- Right panel, with all problems -->
 <div id="problems" class="col-lg-12 col-md-12 col-sm-12">
   %if not pbs:
   <center>
     %if search_string:
     <h3>Bummer, we couldn't find anything.</h3>
     Use the filters or the bookmarks to find what you are looking for, or try a new search query.
     %else:
     <h3>No host or service.</h3>
     %end
   </center>
   %else:

   %include("_problems_synthesis.tpl", pbs=pbs)

   %from itertools import groupby
   %pbs = sorted(pbs, key=lambda x: x.business_impact, reverse=True)
   %for business_impact, bi_pbs in groupby(pbs, key=lambda x: x.business_impact):
      %# Sort problems, hosts first, then orders by state_id and by host
      %bi_pbs = sorted(sorted(sorted(bi_pbs, key=lambda x: x.host_name), key=lambda x: x.state_id, reverse=True), key=lambda x: x.__class__.my_type)
      %hosts = groupby(bi_pbs, key=lambda x: x.host_name)
 <div class="panel panel-default">
   <!--<div class="panel-heading">-->
   <!--</div>-->
   <div class="panel-body">
    <button type="button" class="btn btn-default btn-xs pull-left" data-type="business-impact" data-business-impact="{{business_impact}}" data-item="{{business_impact}}">Select all elements</button>

    <i class="pull-right small">{{len(list(bi_pbs))}} elements</i>
    <h3 class="text-center">Business impact: {{!helper.get_business_impact_text(business_impact, text=True)}}</h3>
    
    <table class="table table-condensed" style="table-layout:fixed;width:100%;">
      <thead><tr>
          <th width="20px"></th>
          <th width="40px"></th>
          <th class="host-column">Host</th>
          <th class="service-column">Service</th>
          <th width="90px">State</th>
          <th width="90px">Duration</th>
          <th class="hidden-sm hidden-xs" width="100%">Output</th>
      </tr></thead>

      <tbody>
      %for host_name, host_pbs in hosts:
      %for i, pb in enumerate(host_pbs):
          
       %# Host information ...
       <tr data-toggle="collapse" data-target="#details-{{helper.get_html_id(pb)}}" class="accordion-toggle">
          <td>
            <input type="checkbox" class="input-sm" value="" id="selector-{{helper.get_html_id(pb)}}" data-type="problem" data-business-impact="{{business_impact}}" data-item="{{pb.get_full_name()}}">
          </td>
          <td align="center">
            {{!helper.get_fa_icon_state(pb)}}
          </td>
          <td>
            %if i == 0:
            <a href="/host/{{pb.host_name}}">{{pb.host_name}}</a>
            %end
          </td>
          <td>
            %if pb.__class__.my_type == 'service':
            {{!helper.get_link(pb, short=True)}}
            %end
            %# Impacts
            %if len(pb.impacts) > 0:
            <button class="btn btn-danger btn-xs"><i class="fa fa-plus"></i> {{ len(pb.impacts) }} impacts</button>
            %end
          </td>
          <td align="center" class="font-{{pb.state.lower()}}"><strong>{{ pb.state }}</strong></td>
          <td align="center">{{!helper.print_duration(pb.last_state_change, just_duration=True, x_elts=2)}}</td>
          <td class="row hidden-sm hidden-xs">
            <div class="pull-right">
              %# Graphs
              %import time
              %now = time.time()
              %graphs = app.get_graph_uris(pb, now-4*3600, now)
              %if len(graphs) > 0:
                <a role="button" tabindex="0" data-toggle="popover" title="{{ pb.get_full_name() }}" data-html="true" data-content="<img src='{{ graphs[0]['img_src'] }}' width='600px' height='200px'>" data-trigger="hover" data-placement="left">{{!helper.get_perfometer(pb)}}</a>
              %end
            </div>
            <div class="ellipsis output">
             {{pb.output}}
             <div class="long-output">
               {{pb.long_output if pb.long_output else ''}}
             </div>
            </div>
          </td>
        </tr>
         <tr>
           <td colspan="8" class="hiddenRow">
             <div class="accordion-body collapse" id="details-{{helper.get_html_id(pb)}}">
               <table class="table table-condensed" style="margin:0;">
                 <tr>
                   <td align="center" class="visible-lg">Realm {{pb.get_realm()}}</td><commit_msg>Long output as multi line (#198)<commit_after>%helper = app.helper
%datamgr = app.datamgr

%rebase("layout", title='All problems', js=['problems/js/problems.js', 'problems/js/bookmarks.js'], css=['problems/css/problems.css'], refresh=True, user=user, navi=navi, app=app, page="/all", elts_per_page=elts_per_page)

<script type="text/javascript">
   var actions_enabled = {{'true' if app.can_action() else 'false'}};

   // List of the bookmarks
   var bookmarks = [];
   var bookmarksro = [];

   %for b in bookmarks:
    declare_bookmark("{{!b['name']}}","{{!b['uri']}}");
   %end
   %for b in bookmarksro:
    declare_bookmarksro("{{!b['name']}}","{{!b['uri']}}");
   %end

 // On page loaded ...
 $(function(){
    // We prevent the dropdown to close when we go on a form into it.
    $('.form_in_dropdown').on('click', function (e) {
       e.stopPropagation()
    });
 });
</script>

%if len(app.get_all_problems()) and app.play_sound:
 <EMBED src="/static/sound/alert.wav" autostart=true loop=false volume=100 hidden=true>
%end

<!-- Problems filtering and display -->
<div class="row">
   %if app.can_action():
   <!-- Left panel, toolbar and active filters -->
   <div id="toolbar" class="col-lg-3 col-md-4 col-sm-4" style="display:none;">

   %include("_panel_actions.tpl")
   </div>
   %end

 <!-- Right panel, with all problems -->
 <div id="problems" class="col-lg-12 col-md-12 col-sm-12">
   %if not pbs:
   <center>
     %if search_string:
     <h3>Bummer, we couldn't find anything.</h3>
     Use the filters or the bookmarks to find what you are looking for, or try a new search query.
     %else:
     <h3>No host or service.</h3>
     %end
   </center>
   %else:

   %include("_problems_synthesis.tpl", pbs=pbs)

   %from itertools import groupby
   %pbs = sorted(pbs, key=lambda x: x.business_impact, reverse=True)
   %for business_impact, bi_pbs in groupby(pbs, key=lambda x: x.business_impact):
      %# Sort problems, hosts first, then orders by state_id and by host
      %bi_pbs = sorted(sorted(sorted(bi_pbs, key=lambda x: x.host_name), key=lambda x: x.state_id, reverse=True), key=lambda x: x.__class__.my_type)
      %hosts = groupby(bi_pbs, key=lambda x: x.host_name)
 <div class="panel panel-default">
   <!--<div class="panel-heading">-->
   <!--</div>-->
   <div class="panel-body">
    <button type="button" class="btn btn-default btn-xs pull-left" data-type="business-impact" data-business-impact="{{business_impact}}" data-item="{{business_impact}}">Select all elements</button>

    <i class="pull-right small">{{len(list(bi_pbs))}} elements</i>
    <h3 class="text-center">Business impact: {{!helper.get_business_impact_text(business_impact, text=True)}}</h3>
    
    <table class="table table-condensed" style="table-layout:fixed;width:100%;">
      <thead><tr>
          <th width="20px"></th>
          <th width="40px"></th>
          <th class="host-column">Host</th>
          <th class="service-column">Service</th>
          <th width="90px">State</th>
          <th width="90px">Duration</th>
          <th class="hidden-sm hidden-xs" width="100%">Output</th>
      </tr></thead>

      <tbody>
      %for host_name, host_pbs in hosts:
      %for i, pb in enumerate(host_pbs):
          
       %# Host information ...
       <tr data-toggle="collapse" data-target="#details-{{helper.get_html_id(pb)}}" class="accordion-toggle">
          <td>
            <input type="checkbox" class="input-sm" value="" id="selector-{{helper.get_html_id(pb)}}" data-type="problem" data-business-impact="{{business_impact}}" data-item="{{pb.get_full_name()}}">
          </td>
          <td align="center">
            {{!helper.get_fa_icon_state(pb)}}
          </td>
          <td>
            %if i == 0:
            <a href="/host/{{pb.host_name}}">{{pb.host_name}}</a>
            %end
          </td>
          <td>
            %if pb.__class__.my_type == 'service':
            {{!helper.get_link(pb, short=True)}}
            %end
            %# Impacts
            %if len(pb.impacts) > 0:
            <button class="btn btn-danger btn-xs"><i class="fa fa-plus"></i> {{ len(pb.impacts) }} impacts</button>
            %end
          </td>
          <td align="center" class="font-{{pb.state.lower()}}"><strong>{{ pb.state }}</strong></td>
          <td align="center">{{!helper.print_duration(pb.last_state_change, just_duration=True, x_elts=2)}}</td>
          <td class="row hidden-sm hidden-xs">
            <div class="pull-right">
              %# Graphs
              %import time
              %now = time.time()
              %graphs = app.get_graph_uris(pb, now-4*3600, now)
              %if len(graphs) > 0:
                <a role="button" tabindex="0" data-toggle="popover" title="{{ pb.get_full_name() }}" data-html="true" data-content="<img src='{{ graphs[0]['img_src'] }}' width='600px' height='200px'>" data-trigger="hover" data-placement="left">{{!helper.get_perfometer(pb)}}</a>
              %end
            </div>
            <div class="ellipsis output">
             {{pb.output}}
             <div class="long-output">
               {{pb.long_output.replace('\n', '<br/>') if pb.long_output else ''}}
             </div>
            </div>
          </td>
        </tr>
         <tr>
           <td colspan="8" class="hiddenRow">
             <div class="accordion-body collapse" id="details-{{helper.get_html_id(pb)}}">
               <table class="table table-condensed" style="margin:0;">
                 <tr>
                   <td align="center" class="visible-lg">Realm {{pb.get_realm()}}</td>
{'fraction_non_alphanumeric': 0.18551587301587302, 'fraction_numerical': 0.00946969696969697, 'mean_word_length': 2.7211409395973156, 'pattern_counts': {'":': 0, '<': 182, '<?xml version=': 0, '>': 186, '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': '7546713', 'n_tokens_mistral': 3805, 'n_tokens_neox': 3669, 'n_words': 769}