1 {% extends 'menu_base.html' %}
25 .result_title .highlight{
31 {# If there was a query... #}
34 <script type=
"text/javascript">
36 // Grab the actual search query
39 // Highlight the matched terms in the results
41 $('.result_title').each(function(){
42 var ORIG_TEXT
= $(this).text();
43 var INDEX_OF_TERM
= ORIG_TEXT
.indexOf(TERM
);
44 var BEFORE_TERM
= ORIG_TEXT
.substring(0, INDEX_OF_TERM
);
45 var AFTER_TERM
= ORIG_TEXT
.substring(
46 INDEX_OF_TERM
+TERM
.length
, ORIG_TEXT
.length
);
49 "<span class='highlight'>" + TERM
+ "</span>" +
56 <h1 id='search_result_title'
>Search results
</h1>
58 {# If there were results, list them #}
59 {% if page.object_list %}
60 <ul id='search_results'
>
61 {% for result in page.object_list %}
63 {# If the result was a VirtualMachine #}
64 {% if result.model_name == 'virtualmachine' %}
65 {% with result.object as vm %}
66 <a href='{% url instance-detail vm.cluster.slug result.object.hostname %}'
>
67 <div class='result_title'
>{{vm.hostname}}
</div>
70 <b>Virtual Machine
</b> on cluster
71 <a href='{% url cluster-detail vm.cluster.slug %}'
>
72 {{ vm.cluster|abbreviate_fqdn }}
74 {{vm.operating_system|render_os}} |
75 {{vm.virtual_cpus}} CPUs |
76 {{vm.ram|render_storage}} RAM |
77 {{vm.disk_size|render_storage}} disk
81 {# Otherwise, if the result is a Cluster #}
82 {% else %}{% if result.model_name == 'cluster' %}
83 {% with result.object as cluster %}
84 <a href='{% url cluster-detail cluster.slug %}'
>
85 <div class='result_title'
>{{cluster.hostname}}
</div>
89 {% if cluster.info.master %}
91 <a href='{% url node-detail cluster.slug cluster.info.master %}'
>
92 {{cluster.info.master|abbreviate_fqdn}}
95 {% if cluster.description %}
96 {{cluster.description}} |
99 v{{cluster.info.software_version}} |
100 {{cluster.info.default_hypervisor}} hypervisor |
102 {% if cluster.nodes.count ==
1 %}
105 {{cluster.nodes.count}} nodes
108 {% if cluster.virtual_machines.count ==
1 %}
111 {{cluster.virtual_machines.count}} virtual machines
116 {# Otherwise, if the result is a Node #}
117 {% else %}{% if result.model_name == 'node' %}
118 {% with result.object as node %}
119 <a href='{% url node-detail node.cluster.slug node.hostname %}'
>
120 <div class='result_title'
>{{ node.hostname }}
</div>
123 {% node_memory node %} GiB RAM |
124 {% node_disk node %} GiB disk |
125 {{ node.info.pinst_cnt }} / {{ node.info.sinst_cnt }} instances (P/S)
127 {% endif %}{% endif %}{% endif %}
132 {# Otherwise, no results were found #}
133 {% else %}{% if query|length <
2 %}
134 <h2>Search query too short!
</h2>
135 <p>Please make your search query at least two characters long.
</p>
138 <p>No results matching
"{{query}}".
</p>
139 {% endif %}{% endif %}
142 {% if page.has_previous or page.has_next %}
144 {% if page.has_previous %}
<a href=
"?q={{ query }}&page={{ page.previous_page_number }}">{% endif %}
« Previous{% if page.has_previous %}
</a>{% endif %}
146 {% if page.has_next %}
<a href=
"?q={{ query }}&page={{ page.next_page_number }}">{% endif %}Next
»{% if page.has_next %}
</a>{% endif %}
150 {# If no query was entered... #}
152 <h1>Not sure which
<del>droids
</del> virtual machines you're looking for...
</h1>
154 Please enter a query in the search box in the sidebar.