Commit c3422577 by Őry Máté

dashboard: add OpenSearch description

fixes #317
can't test because
https://code.google.com/p/chromium/issues/detail?id=245988
parent a146d824
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
<link rel="stylesheet" href="{{ STATIC_URL }}dashboard/loopj-jquery-simple-slider/css/simple-slider.css"/> <link rel="stylesheet" href="{{ STATIC_URL }}dashboard/loopj-jquery-simple-slider/css/simple-slider.css"/>
<link rel="stylesheet" href="{{ STATIC_URL }}dashboard/introjs/introjs.min.css"> <link rel="stylesheet" href="{{ STATIC_URL }}dashboard/introjs/introjs.min.css">
<link href="{{ STATIC_URL }}dashboard/dashboard.css" rel="stylesheet"> <link href="{{ STATIC_URL }}dashboard/dashboard.css" rel="stylesheet">
{% block extra_link_2 %}{% endblock %}
{% endblock %} {% endblock %}
......
...@@ -3,6 +3,13 @@ ...@@ -3,6 +3,13 @@
{% block title-page %}{% trans "Index" %}{% endblock %} {% block title-page %}{% trans "Index" %}{% endblock %}
{% block extra_link_2 %}
<link rel="search"
type="application/opensearchdescription+xml"
href="{% url "dashboard.views.vm-opensearch" %}"
title="{% trans "VM search" %}" />
{% endblock %}
{% block content %} {% block content %}
<div class="body-content dashboard-index"> <div class="body-content dashboard-index">
<div class="row"> <div class="row">
......
{% load i18n %}
<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>{% blocktrans with name=COMPANY_NAME %}{{name}} virtual machines{% endblocktrans %}</ShortName>
<Url type="text/html"
template="{{ url }}?s={searchTerms}&amp;stype=shared" />
</OpenSearchDescription>
...@@ -50,6 +50,7 @@ from .views import ( ...@@ -50,6 +50,7 @@ from .views import (
VmGraphView, NodeGraphView, NodeListGraphView, VmGraphView, NodeGraphView, NodeListGraphView,
TransferInstanceOwnershipView, TransferInstanceOwnershipConfirmView, TransferInstanceOwnershipView, TransferInstanceOwnershipConfirmView,
TransferTemplateOwnershipView, TransferTemplateOwnershipConfirmView, TransferTemplateOwnershipView, TransferTemplateOwnershipConfirmView,
OpenSearchDescriptionView,
) )
from .views.vm import vm_ops, vm_mass_ops from .views.vm import vm_ops, vm_mass_ops
from .views.node import node_ops from .views.node import node_ops
...@@ -221,6 +222,8 @@ urlpatterns = patterns( ...@@ -221,6 +222,8 @@ urlpatterns = patterns(
name="dashboard.views.client-check"), name="dashboard.views.client-check"),
url(r'^token-login/(?P<token>.*)/$', TokenLogin.as_view(), url(r'^token-login/(?P<token>.*)/$', TokenLogin.as_view(),
name="dashboard.views.token-login"), name="dashboard.views.token-login"),
url(r'^vm/opensearch.xml$', OpenSearchDescriptionView.as_view(),
name="dashboard.views.vm-opensearch"),
) )
urlpatterns += patterns( urlpatterns += patterns(
......
...@@ -19,6 +19,7 @@ from __future__ import unicode_literals, absolute_import ...@@ -19,6 +19,7 @@ from __future__ import unicode_literals, absolute_import
import logging import logging
from django.core.cache import get_cache from django.core.cache import get_cache
from django.core.urlresolvers import reverse
from django.conf import settings from django.conf import settings
from django.contrib.auth.models import Group from django.contrib.auth.models import Group
from django.views.generic import TemplateView from django.views.generic import TemplateView
...@@ -121,3 +122,15 @@ class HelpView(TemplateView): ...@@ -121,3 +122,15 @@ class HelpView(TemplateView):
ctx.update({"saml": hasattr(settings, "SAML_CONFIG"), ctx.update({"saml": hasattr(settings, "SAML_CONFIG"),
"store": settings.STORE_URL}) "store": settings.STORE_URL})
return ctx return ctx
class OpenSearchDescriptionView(TemplateView):
template_name = "dashboard/vm-opensearch.xml"
content_type = "application/opensearchdescription+xml"
def get_context_data(self, **kwargs):
context = super(OpenSearchDescriptionView, self).get_context_data(
**kwargs)
context['url'] = self.request.build_absolute_uri(
reverse("dashboard.views.vm-list"))
return context
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment