<!--
  This file is part of IVRE.
  Copyright 2011 - 2021 Pierre LALET <pierre@droids-corp.org>

  IVRE is free software: you can redistribute it and/or modify it
  under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  IVRE is distributed in the hope that it will be useful, but WITHOUT
  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
  License for more details.

  You should have received a copy of the GNU General Public License
  along with IVRE. If not, see <http://www.gnu.org/licenses/>.
-->

<dt>
  <a class="clickable"
     ng-repeat="link in ::host.addr_links"
     ng-click="setparam(link.net)"
     >{{::link.addrpart}}<span ng-if="!$last"><span ng-if="host.addr.indexOf(':') == -1">.</span><span ng-if="host.addr.indexOf(':') != -1">:</span></span></a>
  <span ng-if="::(host.hostnames_links && host.hostnames_links.length)">
    (<span ng-repeat="hostnames in ::host.hostnames_links"><!--
    --><a class="clickable"
	  ng-repeat="link in ::hostnames"
	  ng-click="setparam(link.param, link.value)"
	  >{{::link.name}}<!--
      --><span ng-if="!$last">.</span><!--
      --></a><span ng-if="!$last"> / </span><!--
  --></span>)
  </span>
  <span class="notebtn"
	ng-click="togglenotes(host.addr)"
	><i class="glyphicon glyphicon-pencil"></i></span>
</dt>
<dd>
  <span ng-repeat="category in ::host.categories"
	ng-if="::(! category.startsWith('_'))">
    <a class="category clickable"
       ng-click="setparam('category', category)"
       ng-class="{highlight: wanted_param('category', category)}">
      {{::category}}</a>
    <span ng-if="!$last">/</span>
  </span>
  <span ng-if="::(host.infos || host.source)">
    <span ng-if="::host.infos.country_code">
      /
      <a class="category clickable"
	 ng-click="setparam('country', host.infos.country_code)"
	 ng-class="{highlight: wanted_param('country', host.infos.country_code)}"
	 ng-attr-title="{{::host.infos.country_name}}">
	<span
	   class="flag-icon flag-icon-{{::host.infos.country_code | lowercase}}"
	   ></span>
	{{::host.infos.country_code}}
      </a>
      <span ng-if="::host.infos.city">
	(<a class="category clickable"
	    ng-click="setparam('country', host.infos.country_code, undefined, true); setparam('city', host.infos.city); "
	    ng-class="{highlight: wanted_param('city', host.infos.city)}"
	    >{{::host.infos.city}}</a>)
      </span>
    </span>
    <span ng-if="::host.infos.as_num">
      /
      <a class="category clickable"
	 ng-click="setparam('asnum', host.infos.as_num + '')"
	 ng-class="{highlight: wanted_param('asnum', host.infos.as_num + '')}"
	 ng-attr-title="{{::host.infos.as_name}}"
	 >AS{{::host.infos.as_num}}</a>
    </span>
    <span ng-if="::host.source.length > 0">from
      <span ng-repeat="src in ::host.source">
        <a class="category clickable"
       ng-click="setparam('source', src)"
       ng-class="{highlight: wanted_param('source', src)}"
       >{{::src}}</a>
        <span ng-if="!$last">, </span>
      </span>
    </span>
  </span>
</dd>
<dd ng-if="::host.state">
  <span class="label"
	ng-class="{'label-success': host.state == 'up', 'label-danger': host.state == 'down'}"
	>{{::host.state | uppercase}}</span>
  <span ng-if="::host.state_reason"> - {{host.state_reason}}</span>
  <span ng-if="::(host.starttime && host.endtime)">
    - {{::host.starttime | date:"yyyy-MM-dd HH:mm"}}
    - {{::host.endtime | date:"yyyy-MM-dd HH:mm"}}
  </span>
</dd>
