[% WRAPPER config_detail.tt
   dataTitle = 'Services'
%]

<table class='mainTable striped sticky-2d' id="configtable">
  <thead>
    <tr>
      <th class="!shadow-as-border-bottom"></th>
      <th class="left-8 !shadow-as-border z-[11]">Host</th>
      <th class="left-8 sticky !shadow-as-border z-[12] border-l-0">Service</th>
      [% IF backends.size > 1 %]
        <th class="border-l-0">Backend</th>
      [% END %]
      <th [% IF backends.size < 2 %]class="border-l-0"[% END %]>Contacts</th>
      <th>Contact Groups</th>
      <th class="text-center">Max. Check Attempts</th>
      <th class="text-center">Normal Check Interval</th>
      <th class="text-center">Retry Check Interval</th>
      <th>Check Command</th>
      <th class="text-center">Check Period</th>
      <th class="text-center">Obsess Over</th>
      <th class="text-center">Enable Active Checks</th>
      <th class="text-center">Enable Passive Checks</th>
      <th class="text-center">Enable Notifications</th>
      <th class="text-center">Notification Interval</th>
      <th class="text-center">First Notification Delay</th>
      <th class="text-center">Notification Period</th>
      <th class="text-center">Event Handler</th>
      <th class="text-center">Enable Event Handler</th>
      <th class="text-center">Enable Flap Detection</th>
      <th class="text-center">Low Flap Threshold</th>
      <th class="text-center">High Flap Threshold</th>
      <th class="text-center">Process Performance Data</th>
      <th>Notes</th>
      <th>Notes URL</th>
      <th>Action URL</th>
      <th>Logo Image</th>
      <th>Image Alt</th>
      [% IF enable_shinken_features %]
          <th>Poller Tag</th>
      [% END %]
    </tr>
  </thead>

  <tbody>
    [% FOREACH d = data %]
      [% SET pd = d.peer_key.list.0 %]
      [% SET class = '' %]
      [% SET class = 'tableRowSelected' IF jump == d.host_name _ "_" _ d.description %]
      <tr class='[% class %]' id="[% name2id(d.host_name _ "_" _ d.description, 'service') %]">
        <td class='[% class %] shadow-none'>
          [% IF use_feature_configtool && c.check_user_roles('authorized_for_system_commands') %]
            <a href="conf.cgi?sub=objects&amp;type=service&amp;data.name=[% d.description | uri %]&amp;data.name2=ho:[% d.host_name |uri %]&amp;backend=[% d.peer_key.join(",") %]">
              <i class="fa-solid fa-pencil text-sm" title="configure this service"></i>
            </a>
          [% ELSE %]
            <i class="fa-solid fa-pencil text-sm disabled" title="no permissions or configtool disabled"></i>
          [% END %]
        </td>
        <td class='[% class %] sticky left-8 z-[9] bg-inherit shadow-as-border-right'><a href="config.cgi?type=hosts&amp;jump=[% d.host_name | uri %]#[% d.host_name | uri %]">[% d.host_name | html %]</a></td>
        <td class='[% class %] left-8 sticky !shadow-as-border-right z-[10] bg-inherit border-l-0'>[% d.description | html %]</td>
        [% IF backends.size > 1 %]
          <td class='[% class %] border-l-0'>
            [% IF d.peer_key.size < backends.size %]
              [% peer_name(d).join(', ') %]
            [% ELSE %]
            <i>all</i>
            [% END %]
          </td>
        [% END %]
        <td class="[% class %][% IF backends.size < 2 %] border-l-0[% END %]">[% FOREACH contact = d.contacts.sort %][% IF !loop.first() %] , [% END %]<a href="config.cgi?type=contacts&amp;jump=[% contact | uri %]#[% contact | uri %]">[% contact | html %]</a>[% END %]</td>
        <td class='[% class %]'>[% FOREACH contact_group = d.contact_groups.sort %][% IF !loop.first() %] , [% END %]<a href="config.cgi?type=contactgroups&amp;jump=[% contact_group | uri %]#[% contact_group | uri %]">[% contact_group | html %]</a>[% END %]</td>
        <td class='[% class %] text-center'>[% d.max_check_attempts %]</td>
        <td class='[% class %] text-center'>[% duration(d.check_interval * pi_detail.$pd.interval_length, 0 ) %]</td>
        <td class='[% class %] text-center'>[% duration(d.retry_interval * pi_detail.$pd.interval_length, 0 ) %]</td>
        <td class='[% class %]'><a href="config.cgi?type=commands&amp;jump=[% d._check_command.line | strip_command_args | uri %]#[% d._check_command.line | strip_command_args | uri %]">[% d._check_command.line | html %]</a></td>
        <td class='[% class %] text-center'>[% d.check_period %]</td>
        <td class='[% class %] text-center'>[% IF d.obsess_over_service %]Yes[% ELSE %]No[% END %]</td>
        <td class='[% class %] text-center'>[% IF d.active_checks_enabled %]Yes[% ELSE %]No[% END %]</td>
        <td class='[% class %] text-center'>[% IF d.accept_passive_checks %]Yes[% ELSE %]No[% END %]</td>
        <td class='[% class %] text-center'>[% IF d.notifications_enabled %]Yes[% ELSE %]No[% END %]</td>
        <td class='[% class %] text-center'>[% IF d.notification_interval %][% duration(d.notification_interval * pi_detail.$pd.interval_length, 0 ) %][% ELSE %]<i>No Re-notification</i>[% END %]</td>
        <td class='[% class %] text-center'>[% duration(d.first_notification_delay * pi_detail.$pd.interval_length, 0 ) %]</td>
        <td class='[% class %] text-center'><a href="config.cgi?type=timeperiods&amp;jump=[% d.notification_period | uri %]#[% d.notification_period | uri %]">[% d.notification_period | html %]</a></td>
        <td class='[% class %] text-center'><a href="config.cgi?type=commands&amp;jump=[% d.event_handler | strip_command_args | uri %]#[% d.event_handler | strip_command_args | uri %]">[% d.event_handler | html %]</a></td>
        <td class='[% class %] text-center'>[% IF d.event_handler_enabled %]Yes[% ELSE %]No[% END %]</td>
        <td class='[% class %] text-center'>[% IF d.flap_detection_enabled %]Yes[% ELSE %]No[% END %]</td>
        <td class='[% class %] text-center'>[% IF d.low_flap_threshold %][% d.low_flap_threshold %]%[% ELSE %]Program-wide value[% END %]</td>
        <td class='[% class %] text-center'>[% IF d.high_flap_threshold %][% d.high_flap_threshold %]%[% ELSE %]Program-wide value[% END %]</td>
        <td class='[% class %] text-center'>[% IF d.process_performance_data %]Yes[% ELSE %]No[% END %]</td>
        <td class='[% class %]'>[% d.notes %]</td>
        <td class='[% class %]'>[% d.notes_url %]</td>
        <td class='[% class %]'>[% d.action_url %]</td>
        <td class='[% class %]'>[% IF d.icon_image %]<div class="flex min-w-max"><img src="[% logo_path_prefix %][% d.icon_image_expanded %]" height="20" width="20" alt="service icon"><span>[% d.icon_image %]</span></div>[% END %]</td>
        <td class='[% class %]'>[% d.icon_image_alt %]</td>
        [% IF enable_shinken_features %]
            <td class='[% class %]'>[% d.poller_tag %]</td>
        [% END %]
      </tr>
    [% END %]
  </tbody>
</table>

[% END %]
