repo_creating.mako
79 lines
| 2.5 KiB
| application/x-mako
|
MakoHtmlLexer
r1282 | <%inherit file="/base/base.mako"/> | |||
<%def name="title()"> | ||||
r1985 | ${_('{} Creating repository').format(c.repo_name)} | |||
r1282 | %if c.rhodecode_name: | |||
· ${h.branding(c.rhodecode_name)} | ||||
%endif | ||||
</%def> | ||||
<%def name="breadcrumbs_links()"> | ||||
r1985 | ${_('Creating repository')} ${c.repo_name} | |||
r1282 | </%def> | |||
<%def name="menu_bar_nav()"> | ||||
${self.menu_items(active='repositories')} | ||||
</%def> | ||||
<%def name="main()"> | ||||
<div class="box"> | ||||
<!-- box / title --> | ||||
<div class="title"> | ||||
${self.breadcrumbs()} | ||||
</div> | ||||
<div id="progress-message"> | ||||
${_('Repository "%(repo_name)s" is being created, you will be redirected when this process is finished.' % {'repo_name':c.repo_name})} | ||||
</div> | ||||
<div id="progress"> | ||||
<div class="progress progress-striped active"> | ||||
<div class="progress-bar progress-bar" role="progressbar" | ||||
aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"> | ||||
</div> | ||||
</div> | ||||
</div> | ||||
</div> | ||||
<script> | ||||
(function worker() { | ||||
var skipCheck = false; | ||||
r1985 | var url = "${h.route_path('repo_creating_check', repo_name=c.repo_name, _query=dict(task_id=c.task_id))}"; | |||
r1282 | $.ajax({ | |||
url: url, | ||||
r2387 | timeout: 60*1000, // sets timeout to 60 seconds | |||
r1282 | complete: function(resp) { | |||
r2387 | if (resp.status === 200) { | |||
r1282 | var jsonResponse = resp.responseJSON; | |||
if (jsonResponse === undefined) { | ||||
setTimeout(function () { | ||||
// we might have a backend problem, try dashboard again | ||||
r1985 | window.location = "${h.route_path('repo_summary', repo_name = c.repo_name)}"; | |||
r1282 | }, 3000); | |||
} else { | ||||
if (skipCheck || jsonResponse.result === true) { | ||||
// success, means go to dashboard | ||||
r1985 | window.location = "${h.route_path('repo_summary', repo_name = c.repo_name)}"; | |||
r1282 | } else { | |||
// Schedule the next request when the current one's complete | ||||
setTimeout(worker, 1000); | ||||
} | ||||
} | ||||
} | ||||
else { | ||||
r2414 | var currentUrl = "${h.current_route_path(request)}"; | |||
r2407 | 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); | |||
r1985 | var payload = { | |||
message: { | ||||
r2387 | message: message, | |||
r1985 | level: 'error', | |||
force: true | ||||
} | ||||
}; | ||||
$.Topic('/notifications').publish(payload); | ||||
r1282 | } | |||
} | ||||
}); | ||||
})(); | ||||
</script> | ||||
r1985 | </%def> | |||