settings-pages: replaced hardcoded api calls examples with introduced

helper.
This commit is contained in:
Marcin Kuzminski 2017-05-11 12:20:13 +02:00
parent ee7bfb3a87
commit 74042e1c35
2 changed files with 16 additions and 15 deletions

View file

@ -7,10 +7,10 @@
<h4>${_('Manually invalidate the repository cache. On the next access a repository cache will be recreated.')}</h4>
<p>
${_('Cache purge can be automated by such api call called periodically (in crontab etc)')}
${_('Cache purge can be automated by such api call. Can be called periodically in crontab etc.')}
<br/>
<code>
curl ${h.route_url('apiv2')} -X POST -H 'content-type:text/plain' --data-binary '{"id":1, "auth_token":"SECRET", "method":"invalidate_cache", "args":{"repoid":"${c.repo_info.repo_name}"}}'
${h.api_call_example(method='invalidate_cache', args={"repoid": c.repo_info.repo_name})}
</code>
</p>
@ -51,5 +51,3 @@
</div>
</div>
</div>

View file

@ -4,17 +4,20 @@
</div>
<div class="panel-body">
<h4>${_('Manually pull changes from external repository.')}</h4>
%if c.repo_info.clone_uri:
<div class="panel-body-title-text">${_('Remote mirror url')}:
<a href="${c.repo_info.clone_uri}">${c.repo_info.clone_uri_hidden}</a>
<p>
${_('Pull can be automated by such api call called periodically (in crontab etc)')}
</p>
${_('Remote mirror url')}:
<a href="${c.repo_info.clone_uri}">${c.repo_info.clone_uri_hidden}</a>
<p>
${_('Pull can be automated by such api call. Can be called periodically in crontab etc.')}
<br/>
<code>
curl ${h.route_url('apiv2')} -X POST -H 'content-type:text/plain' --data-binary '{"id":1, "auth_token":"SECRET","method":"pull", "args":{"repoid":"${c.repo_info.repo_name}"}}'
${h.api_call_example(method='pull', args={"repoid": c.repo_info.repo_name})}
</code>
</div>
</p>
${h.secure_form(url('edit_repo_remote', repo_name=c.repo_name), method='put')}
<div class="form">
@ -24,14 +27,14 @@
</div>
${h.end_form()}
%else:
<div class="panel-body-title-text">${_('This repository does not have any remote mirror url set.')}</div>
${_('This repository does not have any remote mirror url set.')}
<a href="${h.route_path('edit_repo', repo_name=c.repo_info.repo_name)}">${_('Set remote url.')}</a>
<br/>
<br/>
<button class="btn disabled" type="submit" disabled="disabled">
${_('Pull changes from remote location')}
</button>
%endif
</div>
</div>