Add the typeahead library and a typeahead input for filtering
This commit is contained in:
parent
0311371037
commit
8145b468ae
37
web_service/css/tls-dashboard/styles.css
Normal file
37
web_service/css/tls-dashboard/styles.css
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
/** Typeahead stylings **/
|
||||||
|
#hostnames, .input-parent, .twitter-typeahead {
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
}
|
||||||
|
.twitter-typeahead {
|
||||||
|
}
|
||||||
|
.tt-menu {
|
||||||
|
max-height : 150px;
|
||||||
|
min-width: 325px;
|
||||||
|
border-width : 1px;
|
||||||
|
border-color : #66afe9;
|
||||||
|
border-style : solid;
|
||||||
|
background-color : #fff;
|
||||||
|
font-size : 1.25rem;
|
||||||
|
overflow-y : scroll;
|
||||||
|
}
|
||||||
|
.tt-suggestion {
|
||||||
|
padding : .5rem .5rem;
|
||||||
|
text-align: left;
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
.tt-suggestion:hover {
|
||||||
|
background-color: #1D44C8;
|
||||||
|
color: #eee;
|
||||||
|
}
|
||||||
|
.tt-cursor {
|
||||||
|
background-color: #1D44C8;
|
||||||
|
color: #eee;
|
||||||
|
}
|
||||||
|
.form-inline > .form-group {
|
||||||
|
margin-right: 25px;
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
.form-inline > .form-group > label {
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
@ -8,9 +8,11 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
<link rel="stylesheet" href="./css/bootstrap/bootstrap.min.css" type="text/css" />
|
<link rel="stylesheet" href="./css/bootstrap/bootstrap.min.css" type="text/css" />
|
||||||
|
<link rel="stylesheet" href="./css/tls-dashboard/styles.css" type="text/css" />
|
||||||
|
|
||||||
<script src="./js/jquery/jquery-2.2.2.min.js"></script>
|
<script src="./js/jquery/jquery-2.2.2.min.js"></script>
|
||||||
<script src="./js/handlebars/handlebars-v4.0.5.min.js"></script>
|
<script src="./js/handlebars/handlebars-v4.0.5.min.js"></script>
|
||||||
|
<script src="./js/typeahead/typeahead-v0.11.1.min.js"></script>
|
||||||
<script src="./js/tls-dashboard/certificates.js"></script>
|
<script src="./js/tls-dashboard/certificates.js"></script>
|
||||||
<script src="./js/tls-dashboard/scripts.js"></script>
|
<script src="./js/tls-dashboard/scripts.js"></script>
|
||||||
</head>
|
</head>
|
||||||
@ -48,6 +50,17 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-xs-12 col-md-6">
|
||||||
|
<p class="lead">By hostname:</p>
|
||||||
|
<div class="form-group input-parent">
|
||||||
|
<input type="text" id="hostnames"
|
||||||
|
name="hostnames"
|
||||||
|
class="form-control typeahead"
|
||||||
|
placeholder="www.example.com"
|
||||||
|
autocomplete="off"
|
||||||
|
tabindex="2">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row" style="margin-top: 1rem;">
|
<div class="row" style="margin-top: 1rem;">
|
||||||
<div class="col-xs-12">
|
<div class="col-xs-12">
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
$(function () {
|
$(function () {
|
||||||
|
// Local vars
|
||||||
|
var typeahead_hostnames = [];
|
||||||
$('#created_date').html(run_date);
|
$('#created_date').html(run_date);
|
||||||
|
|
||||||
var sorted_certificates = Object.keys(cert_info)
|
var sorted_certificates = Object.keys(cert_info)
|
||||||
@ -9,7 +11,7 @@ $(function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
var card_html = String()
|
var card_html = String()
|
||||||
+'<div class="col-xs-12 col-md-6 col-lg-4 col-xl-3" data-category="{{category}}">'
|
+'<div class="col-xs-12 col-md-6 col-lg-4 col-xl-3 cert_card" data-category="{{category}}" data-hostname="{{server}}" data-visible="true">'
|
||||||
+' <div class="card text-xs-center" style="border-color:#333;">'
|
+' <div class="card text-xs-center" style="border-color:#333;">'
|
||||||
+' <div class="card-header" style="">'
|
+' <div class="card-header" style="">'
|
||||||
+' <h4 class="text-muted" style="margin-bottom:0;padding-bottom:.25rem;;overflow:hidden;text-overflow:ellipsis;">{{server}}</h4>'
|
+' <h4 class="text-muted" style="margin-bottom:0;padding-bottom:.25rem;;overflow:hidden;text-overflow:ellipsis;">{{server}}</h4>'
|
||||||
@ -67,11 +69,35 @@ $(function () {
|
|||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
insert_card(json);
|
insert_card(json);
|
||||||
|
typeahead_hostnames.push(json.server);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function update_visible_certs() {
|
function update_visible_certs() {
|
||||||
$('[data-category="'+$(this).val()+'"]').toggle();
|
$('[data-category="'+$(this).val()+'"]').toggle();
|
||||||
|
/**
|
||||||
|
* Initilizes the hostname typeahead
|
||||||
|
*/
|
||||||
|
function create_typeahead() {
|
||||||
|
var monitored_hosts = new Bloodhound({
|
||||||
|
datumTokenizer: Bloodhound.tokenizers.nonword,
|
||||||
|
queryTokenizer: Bloodhound.tokenizers.nonword,
|
||||||
|
local: typeahead_hostnames
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.typeahead').typeahead({
|
||||||
|
hint: true,
|
||||||
|
minLength: 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'hostnames',
|
||||||
|
source: monitored_hosts
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
create_typeahead();
|
||||||
}
|
}
|
||||||
$('input[type=checkbox]').change(update_visible_certs);
|
$('input[type=checkbox]').change(update_visible_certs);
|
||||||
});
|
});
|
||||||
|
8
web_service/js/typeahead/typeahead-v0.11.1.min.js
vendored
Normal file
8
web_service/js/typeahead/typeahead-v0.11.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user