Show More
@@ -422,6 +422,10 b' def make_map(config):' | |||||
422 | controller='summary', |
|
422 | controller='summary', | |
423 | conditions=dict(function=check_repo)) |
|
423 | conditions=dict(function=check_repo)) | |
424 |
|
424 | |||
|
425 | rmap.connect('repo_size', '/{repo_name:.*?}/repo_size', | |||
|
426 | controller='summary', action='repo_size', | |||
|
427 | conditions=dict(function=check_repo)) | |||
|
428 | ||||
425 | rmap.connect('repos_group_home', '/{group_name:.*}', |
|
429 | rmap.connect('repos_group_home', '/{group_name:.*}', | |
426 | controller='admin/repos_groups', action="show_by_name", |
|
430 | controller='admin/repos_groups', action="show_by_name", | |
427 | conditions=dict(function=check_group)) |
|
431 | conditions=dict(function=check_group)) |
@@ -30,20 +30,22 b' import urllib' | |||||
30 | from time import mktime |
|
30 | from time import mktime | |
31 | from datetime import timedelta, date |
|
31 | from datetime import timedelta, date | |
32 | from urlparse import urlparse |
|
32 | from urlparse import urlparse | |
33 | from rhodecode.lib.compat import product |
|
|||
34 |
|
||||
35 | from rhodecode.lib.vcs.exceptions import ChangesetError, EmptyRepositoryError, \ |
|
|||
36 | NodeDoesNotExistError |
|
|||
37 |
|
33 | |||
38 | from pylons import tmpl_context as c, request, url, config |
|
34 | from pylons import tmpl_context as c, request, url, config | |
39 | from pylons.i18n.translation import _ |
|
35 | from pylons.i18n.translation import _ | |
|
36 | from webob.exc import HTTPBadRequest | |||
40 |
|
37 | |||
41 | from beaker.cache import cache_region, region_invalidate |
|
38 | from beaker.cache import cache_region, region_invalidate | |
42 |
|
39 | |||
|
40 | from rhodecode.lib.compat import product | |||
|
41 | from rhodecode.lib.vcs.exceptions import ChangesetError, EmptyRepositoryError, \ | |||
|
42 | NodeDoesNotExistError | |||
43 | from rhodecode.config.conf import ALL_READMES, ALL_EXTS, LANGUAGES_EXTENSIONS_MAP |
|
43 | from rhodecode.config.conf import ALL_READMES, ALL_EXTS, LANGUAGES_EXTENSIONS_MAP | |
44 | from rhodecode.model.db import Statistics, CacheInvalidation |
|
44 | from rhodecode.model.db import Statistics, CacheInvalidation | |
|
45 | from rhodecode.lib.utils import jsonify | |||
45 | from rhodecode.lib.utils2 import safe_unicode |
|
46 | from rhodecode.lib.utils2 import safe_unicode | |
46 | from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator |
|
47 | from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator,\ | |
|
48 | NotAnonymous | |||
47 | from rhodecode.lib.base import BaseRepoController, render |
|
49 | from rhodecode.lib.base import BaseRepoController, render | |
48 | from rhodecode.lib.vcs.backends.base import EmptyChangeset |
|
50 | from rhodecode.lib.vcs.backends.base import EmptyChangeset | |
49 | from rhodecode.lib.markup_renderer import MarkupRenderer |
|
51 | from rhodecode.lib.markup_renderer import MarkupRenderer | |
@@ -186,6 +188,14 b' class SummaryController(BaseRepoControll' | |||||
186 | self.__get_readme_data(c.rhodecode_db_repo) |
|
188 | self.__get_readme_data(c.rhodecode_db_repo) | |
187 | return render('summary/summary.html') |
|
189 | return render('summary/summary.html') | |
188 |
|
190 | |||
|
191 | @NotAnonymous() | |||
|
192 | @jsonify | |||
|
193 | def repo_size(self, repo_name): | |||
|
194 | if request.is_xhr: | |||
|
195 | return _('repository size: %s') % c.rhodecode_db_repo._repo_size() | |||
|
196 | else: | |||
|
197 | raise HTTPBadRequest() | |||
|
198 | ||||
189 | def __get_readme_data(self, db_repo): |
|
199 | def __get_readme_data(self, db_repo): | |
190 | repo_name = db_repo.repo_name |
|
200 | repo_name = db_repo.repo_name | |
191 |
|
201 |
@@ -1076,6 +1076,11 b' class Repository(Base, BaseModel):' | |||||
1076 | pr_id, pr_repo] |
|
1076 | pr_id, pr_repo] | |
1077 | return grouped |
|
1077 | return grouped | |
1078 |
|
1078 | |||
|
1079 | def _repo_size(self): | |||
|
1080 | from rhodecode.lib import helpers as h | |||
|
1081 | log.debug('calculating repository size...') | |||
|
1082 | return h.format_byte_size(self.scm_instance.size) | |||
|
1083 | ||||
1079 | #========================================================================== |
|
1084 | #========================================================================== | |
1080 | # SCM CACHE INSTANCE |
|
1085 | # SCM CACHE INSTANCE | |
1081 | #========================================================================== |
|
1086 | #========================================================================== |
@@ -3202,6 +3202,23 b' table.code-browser .submodule-dir {' | |||||
3202 | margin-top: 2px; |
|
3202 | margin-top: 2px; | |
3203 | } |
|
3203 | } | |
3204 |
|
3204 | |||
|
3205 | .reposize { | |||
|
3206 | background: url("../images/icons/server.png") no-repeat scroll 3px; | |||
|
3207 | height: 16px; | |||
|
3208 | width: 20px; | |||
|
3209 | cursor: pointer; | |||
|
3210 | display: block; | |||
|
3211 | float: right; | |||
|
3212 | margin-top: 2px; | |||
|
3213 | } | |||
|
3214 | ||||
|
3215 | #repo_size{ | |||
|
3216 | display: block; | |||
|
3217 | margin-top: 4px; | |||
|
3218 | color: #666; | |||
|
3219 | float:right; | |||
|
3220 | } | |||
|
3221 | ||||
3205 | .locking_locked{ |
|
3222 | .locking_locked{ | |
3206 | background: #FFF url("../images/icons/block_16.png") no-repeat scroll 3px; |
|
3223 | background: #FFF url("../images/icons/block_16.png") no-repeat scroll 3px; | |
3207 | height: 16px; |
|
3224 | height: 16px; |
@@ -391,6 +391,19 b' var toggleFollowingRepo = function(targe' | |||||
391 | return false; |
|
391 | return false; | |
392 | } |
|
392 | } | |
393 |
|
393 | |||
|
394 | var showRepoSize = function(target, repo_name, token){ | |||
|
395 | var args= 'auth_token='+token; | |||
|
396 | ||||
|
397 | // start loading | |||
|
398 | YUD.get(target).innerHTML = _TM['loading...']; | |||
|
399 | var url = REPO_SIZE_URL.replace('__NAME__', repo_name); | |||
|
400 | YUC.asyncRequest('POST',url,{ | |||
|
401 | success:function(o){ | |||
|
402 | YUD.get(target).innerHTML = JSON.parse(o.responseText); | |||
|
403 | } | |||
|
404 | },args); | |||
|
405 | return false; | |||
|
406 | } | |||
394 |
|
407 | |||
395 | /** |
|
408 | /** | |
396 | * TOOLTIP IMPL. |
|
409 | * TOOLTIP IMPL. |
@@ -54,7 +54,9 b'' | |||||
54 | }; |
|
54 | }; | |
55 | var _TM = TRANSLATION_MAP; |
|
55 | var _TM = TRANSLATION_MAP; | |
56 | var TOGGLE_FOLLOW_URL = "${h.url('toggle_following')}"; |
|
56 | var TOGGLE_FOLLOW_URL = "${h.url('toggle_following')}"; | |
57 | var LAZY_CS_URL = "${h.url('changeset_info', repo_name='__NAME__', revision='__REV__')}" |
|
57 | var LAZY_CS_URL = "${h.url('changeset_info', repo_name='__NAME__', revision='__REV__')}"; | |
|
58 | var REPO_SIZE_URL = "${h.url('repo_size', repo_name='__NAME__')}"; | |||
|
59 | ||||
58 | </script> |
|
60 | </script> | |
59 | <script type="text/javascript" src="${h.url('/js/yui.2.9.js', ver=c.rhodecode_version)}"></script> |
|
61 | <script type="text/javascript" src="${h.url('/js/yui.2.9.js', ver=c.rhodecode_version)}"></script> | |
60 | <!--[if lt IE 9]> |
|
62 | <!--[if lt IE 9]> |
@@ -62,6 +62,12 b'' | |||||
62 | onclick="javascript:toggleFollowingRepo(this,${c.dbrepo.repo_id},'${str(h.get_token())}')"> |
|
62 | onclick="javascript:toggleFollowingRepo(this,${c.dbrepo.repo_id},'${str(h.get_token())}')"> | |
63 | </span> |
|
63 | </span> | |
64 | %endif |
|
64 | %endif | |
|
65 | <div style="float:right;padding:0px 0px 0px 0px"> | |||
|
66 | <span class="reposize tooltip" title="${_('Click to show size of repository')}" | |||
|
67 | onclick="javascript:showRepoSize('repo_size','${c.dbrepo.repo_name}','${str(h.get_token())}')"> | |||
|
68 | </span> | |||
|
69 | <span id="repo_size"></span> | |||
|
70 | </div> | |||
65 | %endif: |
|
71 | %endif: | |
66 |
|
72 | |||
67 | ## locking icon |
|
73 | ## locking icon |
General Comments 0
You need to be logged in to leave comments.
Login now