1 from manifold.core.query import Query, AnalyzedQuery
3 from django.views.generic.base import TemplateView
5 from unfold.loginrequired import LoginRequiredView
6 from django.http import HttpResponse
8 from manifold.core.query import Query, AnalyzedQuery
9 from manifoldapi.manifoldapi import execute_query
13 def platform(request, platform_name):
15 platform_query = Query().get('local:platform').filter_by('disabled', '==', '0').select('platform', 'platform_longname', 'platform_url', 'platform_description','gateway_type')
16 response = execute_query(request,platform_query)
19 response_data['columns'] = [ 'platform', 'platform_longname', 'platform_url', 'platform_description','gateway_type' ]
20 response_data['labels'] = [ 'Platform', 'Name', 'Url', 'Description','Gateway Type' ]
21 response_data['data'] = []
23 response_data['data'].append([ r['platform'], r['platform_longname'], r['platform_url'], r['platform_description'], r['gateway_type'] ])
25 return HttpResponse(json.dumps(response_data), content_type="application/json")
27 def slice(request, slice_name):
29 platform_query = Query().get('local:platform').filter_by('disabled', '==', '0').select('platform', 'platform_longname', 'platform_url', 'platform_description','gateway_type')
30 response = execute_query(request,platform_query)
35 response_data['columns'] = [ 'platform', 'platform_longname', 'platform_url', 'platform_description','gateway_type' ]
36 response_data['labels'] = [ 'Platform', 'Name', 'Url', 'Description','Gateway Type' ]
37 response_data['data'] = []
39 response_data['data'].append([ r['platform'], r['platform_longname'], r['platform_url'], r['platform_description'], r['gateway_type'] ])
41 return HttpResponse(json.dumps(response_data), content_type="application/json")
43 # slicename = 'ple.upmc.myslicedemo'
44 # main_query = Query.get('slice').filter_by('slice_hrn', '=', slicename)
47 # 'resource.hrn', 'resource.urn',
48 # 'resource.hostname', 'resource.type',
49 # 'resource.network_hrn',
52 # #'application.measurement_point.counter'
55 # res = execute_query(self.request,main_query)
59 # return render(request, self.template_name, {"resources": res[0]['resource']})
62 # def get (self, request, name='default'):
63 # return HttpResponse()