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