service button and view
diff --git a/xos/core/admin.py b/xos/core/admin.py
index 9d473da..70df867 100644
--- a/xos/core/admin.py
+++ b/xos/core/admin.py
@@ -684,7 +684,7 @@
class ServiceAdmin(XOSBaseAdmin):
list_display = ("backend_status_icon","name","description","versionNumber","enabled","published")
list_display_links = ('backend_status_icon', 'name', )
- fieldList = ["backend_status_text","name","description","versionNumber","enabled","published"]
+ fieldList = ["backend_status_text","name","description","versionNumber","enabled","published","view_url","icon_url"]
fieldsets = [(None, {'fields': fieldList, 'classes':['suit-tab suit-tab-general']})]
inlines = [ServiceAttrAsTabInline,SliceInline]
readonly_fields = ('backend_status_text', )
diff --git a/xos/core/models/service.py b/xos/core/models/service.py
index 289c7ff..f26bf06 100644
--- a/xos/core/models/service.py
+++ b/xos/core/models/service.py
@@ -7,6 +7,8 @@
name = models.CharField(max_length=30, help_text="Service Name")
versionNumber = models.CharField(max_length=30, help_text="Version of Service Definition")
published = models.BooleanField(default=True)
+ view_url = models.CharField(blank=True, null=True, max_length=1024)
+ icon_url = models.CharField(blank=True, null=True, max_length=1024)
def __unicode__(self): return u'%s' % (self.name)
diff --git a/xos/core/static/primarycons_blue/License.txt b/xos/core/static/primarycons_blue/License.txt
new file mode 100644
index 0000000..da57598
--- /dev/null
+++ b/xos/core/static/primarycons_blue/License.txt
@@ -0,0 +1,21 @@
+Thank you for downloading these graphics from MouseRunner.com.
+
+While I want you to enjoy these free graphics (free as in free of monetary charge, not entirely free usage), I ask that you please abide by the terms that they are licensed under.
+
+-------------------------------------------------------------------------
+
+The graphics contained in these files are being released under a Creative Commons
+Attribution-NonCommercial-ShareAlike 3.0 Unported license.
+
+Furthermore;
+You may not claim the works as your own.
+You must provide a link back to www.MouseRunner.com when using on a website, blog, etc.
+You may not redistribute these as a package as-is.
+You must seek approval for commercial purposes, and for applications.
+
+Visit the address below to learn more about the Creative Commons license.
+http://creativecommons.org/licenses/by-nc-sa/3.0/
+
+-------------------------------------------------------------------------
+Questions? Contact:
+KenSaunders@MouseRunner.com
diff --git a/xos/core/static/primarycons_blue/folder_1.png b/xos/core/static/primarycons_blue/folder_1.png
new file mode 100644
index 0000000..2c7dc1f
--- /dev/null
+++ b/xos/core/static/primarycons_blue/folder_1.png
Binary files differ
diff --git a/xos/core/static/primarycons_blue/gear_2.png b/xos/core/static/primarycons_blue/gear_2.png
new file mode 100644
index 0000000..4a9e9d0
--- /dev/null
+++ b/xos/core/static/primarycons_blue/gear_2.png
Binary files differ
diff --git a/xos/core/static/primarycons_blue/internet.png b/xos/core/static/primarycons_blue/internet.png
new file mode 100644
index 0000000..89e0de4
--- /dev/null
+++ b/xos/core/static/primarycons_blue/internet.png
Binary files differ
diff --git a/xos/core/static/primarycons_blue/network.png b/xos/core/static/primarycons_blue/network.png
new file mode 100644
index 0000000..37d2241
--- /dev/null
+++ b/xos/core/static/primarycons_blue/network.png
Binary files differ
diff --git a/xos/core/views/services.py b/xos/core/views/services.py
new file mode 100644
index 0000000..76180e7
--- /dev/null
+++ b/xos/core/views/services.py
@@ -0,0 +1,53 @@
+from django.http import HttpResponse
+from django.views.generic import TemplateView, View
+from django import template
+from monitor import driver
+from core.models import *
+import json
+import os
+import time
+
+class ServiceGridView(TemplateView):
+ head_template = r"""{% extends "admin/dashboard/dashboard_base.html" %}
+ {% load admin_static %}
+ {% block content %}
+ """
+
+ tail_template = r"{% endblock %}"
+
+ def get(self, request, name="root", *args, **kwargs):
+ head_template = self.head_template
+ tail_template = self.tail_template
+
+ html = '<table><tr>'
+
+ i=0
+ for service in Service.objects.all():
+ if (i%4) == 0:
+ html = html + '</tr><tr>'
+
+ view_url = service.view_url
+ if (not view_url):
+ view_url = "/admin/core/service/$id$/"
+ view_url = view_url.replace("$id$", str(service.id))
+
+ image_url = service.icon_url
+ if (not image_url):
+ image_url = "/static/primarycons_blue/gear_2.png"
+
+ html = html + '<td width=96 height=128 valign=top align=center><a href="%s"><img src="%s" height=64 width=64></img></a>' % (view_url, image_url)
+ html = html + '<p><a href="%s">%s</a></p></td>' % (view_url, service.name)
+ i=i+1
+
+ html = html + '</tr></table>'
+
+ t = template.Template(head_template + html + self.tail_template)
+
+ response_kwargs = {}
+ response_kwargs.setdefault('content_type', self.content_type)
+ return self.response_class(
+ request = request,
+ template = t,
+ **response_kwargs)
+
+
diff --git a/xos/xos/settings.py b/xos/xos/settings.py
index f1f4885..5dffb7e 100644
--- a/xos/xos/settings.py
+++ b/xos/xos/settings.py
@@ -208,9 +208,10 @@
{'label': 'Sites', 'icon':'icon-site', 'url': '/admin/core/site/'},
{'label': 'Slices', 'icon':'icon-slice', 'url': '/admin/core/slice/'},
{'label': 'Users', 'icon':'icon-user', 'url': '/admin/core/user/'},
- {'label': 'RequestRouter', 'icon':'icon-cog', 'app': 'requestrouter'},
- {'label': 'HyperCache', 'icon':'icon-cog', 'app': 'hpc'},
- {'label': 'Syndicate', 'icon':'icon-cog', 'app': 'syndicate_storage'},
+ {'label': 'Services', 'icon':'icon-cog', 'url': '/serviceGrid/'},
+# {'label': 'RequestRouter', 'icon':'icon-cog', 'app': 'requestrouter'},
+# {'label': 'HyperCache', 'icon':'icon-cog', 'app': 'hpc'},
+# {'label': 'Syndicate', 'icon':'icon-cog', 'app': 'syndicate_storage'},
# {'label': 'URL Filter', 'icon': 'icon-cog', 'app': 'urlfilter'},
# {'label': 'Service Comp', 'icon': 'icon-cog', 'app': 'servcomp'},
diff --git a/xos/xos/urls.py b/xos/xos/urls.py
index 10d1fe8..f5b1e78 100644
--- a/xos/xos/urls.py
+++ b/xos/xos/urls.py
@@ -7,6 +7,7 @@
from xosapi import *
from core.views.legacyapi import LegacyXMLRPC
+from core.views.services import ServiceGridView
#from core.views.analytics import AnalyticsAjaxView
from core.models import *
from rest_framework import generics
@@ -26,6 +27,7 @@
# Examples:
url(r'^stats', 'core.views.stats.Stats', name='stats'),
url(r'^observer', 'core.views.observer.Observer', name='observer'),
+ url(r'^serviceGrid', ServiceGridView.as_view(), name='serviceGrid'),
url(r'^docs/', include('rest_framework_swagger.urls')),