Revision 666c7490

b/snf-astakos-app/astakos/im/api/__init__.py
185 185
            append(item(
186 186
                   url=absolute(request, reverse('group_list')),
187 187
                   name="Projects",
188
                   submenu=(item(
189
                            url=absolute(request,
190
                                         reverse('group_list')),
191
                            name="Overview"),
192
                            item(
193
                                url=absolute(request,
194
                                             reverse('group_create_list')),
195
                                name="Create"),
196
                            item(
197
                                url=absolute(request,
198
                                             reverse('group_search')),
199
                                name="Join"),)))
188
#                    submenu=(item(
189
#                             url=absolute(request,
190
#                                          reverse('group_list')),
191
#                             name="Overview"),
192
#                             item(
193
#                                 url=absolute(request,
194
#                                              reverse('group_create_list')),
195
#                                 name="Create"),
196
#                             item(
197
#                                 url=absolute(request,
198
#                                              reverse('group_search')),
199
#                                 name="Join"),
200
#                     )
201
                )
202
            )
200 203
            append(item(
201
                   url=absolute(request, reverse('resource_list')),
202
                   name="Report"))
204
                   url=absolute(request, reverse('resource_usage')),
205
                   name="Usage"))
203 206
            append(item(
204 207
                   url=absolute(request, reverse('feedback')),
205 208
                   name="Feedback"))
b/snf-astakos-app/astakos/im/api/callpoint.py
110 110
        b = get_backend()
111 111
        return b.list_users(filter)
112 112

  
113
    def get_user_status(self, user_id):
113
    def get_user_usage(self, user_id):
114 114
        b = get_backend()
115 115
        return b.get_resource_usage(user_id)
116 116

  
b/snf-astakos-app/astakos/im/api/spec.py
200 200
            )
201 201
        )
202 202

  
203
    def get_user_status(
203
    def get_user_usage(
204 204
        self,
205 205
        user_id=Nonnegative
206 206
    ):
/dev/null
1
{% extends "im/account_base.html" %}
2

  
3
{% load filters %}
4

  
5
{% block page.body %}
6
<div class="maincol {% block innerpage.class %}{% endblock %}">
7
	<div class="stats clearfix">
8
		<ul>
9
			{% for rname, rdata in resource_catalog.resources.items %}
10
		 		<li class="clearfix  {{ rdata.load_class }} {{ rdata.verbose_name}}">
11
		 			<div class="img-wrap">&nbsp;</div>
12
		 			<div class="info">
13
						<h3>{{ rdata.report_desc }}</h3>
14
						<p>
15
						{{ rdata.ratio|floatformat }}% Used<br>
16
						You are using 
17
						{% if rdata.unit == 'bytes' %}
18
							{{ rdata.currValue|sizeof_fmt  }} out of your {{ rdata.maxValue|sizeof_fmt }}
19
						{% else %}
20
							{{ rdata.currValue }} {{ rdata.unit }} out of your {{ rdata.maxValue }} {{ rdata.unit }}
21
						{% endif %}		
22
						{% if rdata.is_abbreviation %}{{ rdata.verbose_name|upper }}{% else %}{{ rdata.verbose_name }}{% endif %}{% if rdata.maxValue|floatformat:"0" != "1" and not rdata.unit %}s {% endif  %}
23
						</p>
24
					</div>
25
					<div class="bar">
26
						<div><span style="width:{{ rdata.ratio|floatformat }}%;">{{ rdata.ratio|floatformat }}% &nbsp;&nbsp;</span></div>
27
					</div>
28
		 		</li>
29
		 	{% endfor%}
30
		</ul>
31
			 
32
	</div>    
33
</div>
34
{% endblock %}
b/snf-astakos-app/astakos/im/templates/im/resource_usage.html
1
{% extends "im/account_base.html" %}
2

  
3
{% load filters %}
4

  
5
{% block page.body %}
6
<div class="maincol {% block innerpage.class %}{% endblock %}">
7
	<div class="stats clearfix">
8
		<ul>
9
			{% for rname, rdata in resource_catalog.resources.items %}
10
		 		<li class="clearfix  {{ rdata.load_class }} {{ rdata.verbose_name}}">
11
		 			<div class="img-wrap">&nbsp;</div>
12
		 			<div class="info">
13
						<h3>{{ rdata.report_desc }}</h3>
14
						<p>
15
						{{ rdata.ratio|floatformat }}% Used<br>
16
						You are using 
17
						{% if rdata.unit == 'bytes' %}
18
							{{ rdata.currValue|sizeof_fmt  }} out of your {{ rdata.maxValue|sizeof_fmt }}
19
						{% else %}
20
							{{ rdata.currValue }} {{ rdata.unit }} out of your {{ rdata.maxValue }} {{ rdata.unit }}
21
						{% endif %}		
22
						{% if rdata.is_abbreviation %}{{ rdata.verbose_name|upper }}{% else %}{{ rdata.verbose_name }}{% endif %}{% if rdata.maxValue|floatformat:"0" != "1" and not rdata.unit %}s {% endif  %}
23
						</p>
24
					</div>
25
					<div class="bar">
26
						<div><span style="width:{{ rdata.ratio|floatformat }}%;">{{ rdata.ratio|floatformat }}% &nbsp;&nbsp;</span></div>
27
					</div>
28
		 		</li>
29
		 	{% endfor%}
30
		</ul>
31
			 
32
	</div>    
33
</div>
34
{% endblock %}
b/snf-astakos-app/astakos/im/urls.py
49 49
    url(r'^approval_terms/?$', 'approval_terms', {}, name='latest_terms'),
50 50
    url(r'^approval_terms/(?P<term_id>\d+)/?$', 'approval_terms'),
51 51
    url(r'^send/activation/(?P<user_id>\d+)/?$', 'send_activation', {}, name='send_activation'),
52
    url(r'^resources/?$', 'resource_list', {}, name='resource_list'),
52
    url(r'^resources/?$', 'resource_usage', {}, name='resource_usage'),
53 53
#    url(r'^billing/?$', 'billing', {}, name='billing'),
54 54
    url(r'^timeline/?$', 'timeline', {}, name='timeline'),
55 55
    url(r'^group/add/complete/?$', 'group_add_complete', {}, name='group_add_complete'),
b/snf-astakos-app/astakos/im/views.py
1274 1274
@require_http_methods(["POST", "GET"])
1275 1275
@signed_terms_required
1276 1276
@login_required
1277
def resource_list(request):
1277
def resource_usage(request):
1278 1278
    def with_class(entry):
1279 1279
        entry['load_class'] = 'red'
1280 1280
        max_value = float(entry['maxValue'])
......
1293 1293
        entry['plural'] = engine.plural(entry.get('name'))
1294 1294
        return entry
1295 1295

  
1296
    result = callpoint.get_user_status(request.user.id)
1296
    result = callpoint.get_user_usage(request.user.id)
1297 1297
    if result.is_success:
1298 1298
        backenddata = map(with_class, result.data)
1299 1299
        data = map(pluralize, result.data)
......
1302 1302
        messages.error(request, result.reason)
1303 1303
    resource_catalog = ResourcePresentation(RESOURCES_PRESENTATION_DATA)
1304 1304
    resource_catalog.update_from_result_report(result)
1305

  
1306

  
1307

  
1308
    return render_response('im/resource_list.html',
1305
    return render_response('im/resource_usage.html',
1309 1306
                           data=data,
1310 1307
                           context_instance=get_context(request),
1311 1308
                           resource_catalog=resource_catalog,

Also available in: Unified diff