<html lang="en">
	<head>
		<script type="text/javascript">
			log_direction = false;
			global_token='<%=TOKEN%>';
		</script>

		<%=INCLUDE:HEAD_META%>

		<title>NSClient++ Console</title>

		<script type="text/javascript" src="/static/js/log.js" defer="defer"></script>
	</head>
	<body>
		<div class="container">

			<nav class="navbar navbar-default" role="navigation">
				<div class="container-fluid">
					<!-- Brand and toggle get grouped for better mobile display -->
					<div class="navbar-header">
						<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
							<span class="sr-only">Toggle navigation</span>
							<span class="icon-bar"/>
							<span class="icon-bar"/>
							<span class="icon-bar"/>
						</button>
						<a class="navbar-brand" href="/index.html<%=TOKEN_TAG%>">NSClient++</a>
					</div>

					<!-- Collect the nav links, forms, and other content for toggling -->
					<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
						<ul class="nav navbar-nav">
							<li>
								<a href="/modules.html<%=TOKEN_TAG%>">Modules</a>
							</li>
							<li>
								<a href="/settings.html<%=TOKEN_TAG%>"><span class="label label-danger" data-bind="visible: nscp_status().settings().has_changed"><span class="glyphicon glyphicon-warning-sign"></span></span> Settings</a>
							</li>
							<li>
								<a href="/queries.html<%=TOKEN_TAG%>">Queries</a>
							</li>
							<li>
								<a href="/log.html<%=TOKEN_TAG%>"><span class="label label-danger" data-bind="visible: nscp_status().has_issues"><span class="glyphicon glyphicon-warning-sign"></span></span> Log</a>
							</li>
							<li class="active">
								<a href="/console.html<%=TOKEN_TAG%>">Console</a>
							</li>
						</ul>
						<ul class="nav navbar-nav navbar-right">
							<li class="dropdown">
								<a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-globe"></span> Help</a>
								<ul class="dropdown-menu">
									<li>
										<a href="http://www.nsclient.org"><span class="glyphicon glyphicon-globe"></span> NSClient++ Website</a>
										<a href="http://docs.nsclient.org"><span class="glyphicon glyphicon-globe"></span> NSClient++ online Help</a>
									</li>
								</ul>
							</li>
							<li class="dropdown">
								<a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-repeat"></span> Restart <b class="caret"></b></a>
								<ul class="dropdown-menu">
									<li>
										<a data-bind="click: nscp_status().restart"><span class="glyphicon glyphicon-repeat"></span> Restart NSClient++</a>
									</li>
								</ul>
							</li>
							<li>
								<a class="glyphicon glyphicon-log-out" data-bind="click: $root.nscp_status().logout"></a>
							</li>
						</ul>
					</div>
				</div>
			</nav>
			
			<%=INCLUDE:DIALOGS%>
			
			<!-- console page -->

			<div class="panel panel-primary" data-bind="visible: nscp_status().is_loggedin()">
				<div class="panel-heading">
					<h3 class="panel-title pull-left">Log</h3>
					<div class="btn-group pull-right">
						<span data-bind="foreach: filters">
							<a class="label" href="#" data-bind="click: $parent.setActiveFilter, text: title, attr: {text: title}, css: { 'label-info': css()=='info', 'label-danger': css()=='error' || css() == 'critical', 'label-default': css()=='debug'||css()=='console', 'label-warning': css()=='warning', 'label-primary': css()=='inactive'}"></a>
						</span>
					</div>
					<div class="clearfix"></div>
				</div>
				<div class="panel-body">
					<div id="logScroll" style="height: calc(100vh - 300px); overflow-y: auto; overflow-x: auto;">
						<table class="table table-condensed log-table-striped ">
							<thead>
								<tr>
									<th>Type</th>
									<th>Date</th>
									<th>Message</th>
								</tr>
							</thead>   
							<tbody data-bind="foreach: filteredLog">
								<tr data-bind="click: $data.showMore">
									<td><span class="label" data-bind="text: type, css: { 'label-info': type=='info', 'label-danger': type=='error' || type == 'critical', 'label-default': type=='debug'||type=='out', 'label-warning': type=='warning'}"></span></td>
									<td style="white-space: nowrap;" data-bind="text: date"></td>
									<td data-bind="text: message" class="pre">
									</td>
								</tr>
								<tr data-bind="visible: showDetails">
									<td>&nbsp;</td>
									<td colspan="2">
										<a href="#" data-bind="attr: { href: link }, if: link != ''">
										<span data-bind="text: file"></span>:<span data-bind="text: line"></span>
										</a data-bind="if: link != ''">
									</td>
								</tr>
							</tbody>
						</table>
					</div>
					<form class="form-horizontal" role="form" data-bind="submit: $root.exec">
						<div class="input-group">
							<input id="command" type="text" data-bind="value: command, valueUpdate: 'keyup', actionKey: action, keys: [38, 40]" class="form-control">
							<span class="input-group-btn">
								<button class="btn btn-default" type="submit">Run</button>
							</span>
						</div>
					</form>
				</div>
			</div>
		</div>
	</body>
</html>