##// END OF EJS Templates
repo-creating: fix reload url.
marcink -
r2407:bd3f17a5 default
parent child Browse files
Show More
@@ -1,79 +1,80 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%inherit file="/base/base.mako"/>
2 <%inherit file="/base/base.mako"/>
3
3
4 <%def name="title()">
4 <%def name="title()">
5 ${_('{} Creating repository').format(c.repo_name)}
5 ${_('{} Creating repository').format(c.repo_name)}
6 %if c.rhodecode_name:
6 %if c.rhodecode_name:
7 &middot; ${h.branding(c.rhodecode_name)}
7 &middot; ${h.branding(c.rhodecode_name)}
8 %endif
8 %endif
9 </%def>
9 </%def>
10
10
11 <%def name="breadcrumbs_links()">
11 <%def name="breadcrumbs_links()">
12 ${_('Creating repository')} ${c.repo_name}
12 ${_('Creating repository')} ${c.repo_name}
13 </%def>
13 </%def>
14
14
15 <%def name="menu_bar_nav()">
15 <%def name="menu_bar_nav()">
16 ${self.menu_items(active='repositories')}
16 ${self.menu_items(active='repositories')}
17 </%def>
17 </%def>
18 <%def name="main()">
18 <%def name="main()">
19 <div class="box">
19 <div class="box">
20 <!-- box / title -->
20 <!-- box / title -->
21 <div class="title">
21 <div class="title">
22 ${self.breadcrumbs()}
22 ${self.breadcrumbs()}
23 </div>
23 </div>
24
24
25 <div id="progress-message">
25 <div id="progress-message">
26 ${_('Repository "%(repo_name)s" is being created, you will be redirected when this process is finished.' % {'repo_name':c.repo_name})}
26 ${_('Repository "%(repo_name)s" is being created, you will be redirected when this process is finished.' % {'repo_name':c.repo_name})}
27 </div>
27 </div>
28
28
29 <div id="progress">
29 <div id="progress">
30 <div class="progress progress-striped active">
30 <div class="progress progress-striped active">
31 <div class="progress-bar progress-bar" role="progressbar"
31 <div class="progress-bar progress-bar" role="progressbar"
32 aria-valuenow="100" aria-valuemin="0" aria-valuemax="100">
32 aria-valuenow="100" aria-valuemin="0" aria-valuemax="100">
33 </div>
33 </div>
34 </div>
34 </div>
35 </div>
35 </div>
36 </div>
36 </div>
37
37
38 <script>
38 <script>
39 (function worker() {
39 (function worker() {
40 var skipCheck = false;
40 var skipCheck = false;
41 var url = "${h.route_path('repo_creating_check', repo_name=c.repo_name, _query=dict(task_id=c.task_id))}";
41 var url = "${h.route_path('repo_creating_check', repo_name=c.repo_name, _query=dict(task_id=c.task_id))}";
42 $.ajax({
42 $.ajax({
43 url: url,
43 url: url,
44 timeout: 60*1000, // sets timeout to 60 seconds
44 timeout: 60*1000, // sets timeout to 60 seconds
45 complete: function(resp) {
45 complete: function(resp) {
46 if (resp.status === 200) {
46 if (resp.status === 200) {
47 var jsonResponse = resp.responseJSON;
47 var jsonResponse = resp.responseJSON;
48
48
49 if (jsonResponse === undefined) {
49 if (jsonResponse === undefined) {
50 setTimeout(function () {
50 setTimeout(function () {
51 // we might have a backend problem, try dashboard again
51 // we might have a backend problem, try dashboard again
52 window.location = "${h.route_path('repo_summary', repo_name = c.repo_name)}";
52 window.location = "${h.route_path('repo_summary', repo_name = c.repo_name)}";
53 }, 3000);
53 }, 3000);
54 } else {
54 } else {
55 if (skipCheck || jsonResponse.result === true) {
55 if (skipCheck || jsonResponse.result === true) {
56 // success, means go to dashboard
56 // success, means go to dashboard
57 window.location = "${h.route_path('repo_summary', repo_name = c.repo_name)}";
57 window.location = "${h.route_path('repo_summary', repo_name = c.repo_name)}";
58 } else {
58 } else {
59 // Schedule the next request when the current one's complete
59 // Schedule the next request when the current one's complete
60 setTimeout(worker, 1000);
60 setTimeout(worker, 1000);
61 }
61 }
62 }
62 }
63 }
63 }
64 else {
64 else {
65 var message = _gettext('Fetching repository state failed. Error code: {0} {1}. Try <a href="{2}">refreshing</a> this page.').format(resp.status, resp.statusText, url);
65 var currentUrl = "${h.current_route_path()}";
66 var message = _gettext('Fetching repository state failed. Error code: {0} {1}. Try <a href="{2}">refreshing</a> this page.').format(resp.status, resp.statusText, currentUrl);
66 var payload = {
67 var payload = {
67 message: {
68 message: {
68 message: message,
69 message: message,
69 level: 'error',
70 level: 'error',
70 force: true
71 force: true
71 }
72 }
72 };
73 };
73 $.Topic('/notifications').publish(payload);
74 $.Topic('/notifications').publish(payload);
74 }
75 }
75 }
76 }
76 });
77 });
77 })();
78 })();
78 </script>
79 </script>
79 </%def>
80 </%def>
General Comments 0
You need to be logged in to leave comments. Login now