##// END OF EJS Templates
archiving: make it explicit archiving a repo is irreversible.
super-admin -
r4689:fb78c106 stable
parent child Browse files
Show More
@@ -1,304 +1,307 b''
1 <%namespace name="base" file="/base/base.mako"/>
1 <%namespace name="base" file="/base/base.mako"/>
2
2
3 <%
3 <%
4 elems = [
4 elems = [
5 (_('Repository ID'), c.rhodecode_db_repo.repo_id, '', ''),
5 (_('Repository ID'), c.rhodecode_db_repo.repo_id, '', ''),
6 (_('Owner'), lambda:base.gravatar_with_user(c.rhodecode_db_repo.user.email, tooltip=True), '', ''),
6 (_('Owner'), lambda:base.gravatar_with_user(c.rhodecode_db_repo.user.email, tooltip=True), '', ''),
7 (_('Created on'), h.format_date(c.rhodecode_db_repo.created_on), '', ''),
7 (_('Created on'), h.format_date(c.rhodecode_db_repo.created_on), '', ''),
8 (_('Updated on'), h.format_date(c.rhodecode_db_repo.updated_on), '', ''),
8 (_('Updated on'), h.format_date(c.rhodecode_db_repo.updated_on), '', ''),
9 (_('Cached Commit id'), lambda: h.link_to(c.rhodecode_db_repo.changeset_cache.get('short_id'), h.route_path('repo_commit',repo_name=c.repo_name,commit_id=c.rhodecode_db_repo.changeset_cache.get('raw_id'))), '', ''),
9 (_('Cached Commit id'), lambda: h.link_to(c.rhodecode_db_repo.changeset_cache.get('short_id'), h.route_path('repo_commit',repo_name=c.repo_name,commit_id=c.rhodecode_db_repo.changeset_cache.get('raw_id'))), '', ''),
10 (_('Cached Commit date'), c.rhodecode_db_repo.changeset_cache.get('date'), '', ''),
10 (_('Cached Commit date'), c.rhodecode_db_repo.changeset_cache.get('date'), '', ''),
11 (_('Cached Commit data'), lambda: h.link_to('refresh now', h.current_route_path(request, update_commit_cache=1)), '', ''),
11 (_('Cached Commit data'), lambda: h.link_to('refresh now', h.current_route_path(request, update_commit_cache=1)), '', ''),
12 (_('Attached scoped tokens'), len(c.rhodecode_db_repo.scoped_tokens), '', [x.user for x in c.rhodecode_db_repo.scoped_tokens]),
12 (_('Attached scoped tokens'), len(c.rhodecode_db_repo.scoped_tokens), '', [x.user for x in c.rhodecode_db_repo.scoped_tokens]),
13 (_('Pull requests source'), len(c.rhodecode_db_repo.pull_requests_source), '', ['pr_id:{}, repo:{}'.format(x.pull_request_id,x.source_repo.repo_name) for x in c.rhodecode_db_repo.pull_requests_source]),
13 (_('Pull requests source'), len(c.rhodecode_db_repo.pull_requests_source), '', ['pr_id:{}, repo:{}'.format(x.pull_request_id,x.source_repo.repo_name) for x in c.rhodecode_db_repo.pull_requests_source]),
14 (_('Pull requests target'), len(c.rhodecode_db_repo.pull_requests_target), '', ['pr_id:{}, repo:{}'.format(x.pull_request_id,x.target_repo.repo_name) for x in c.rhodecode_db_repo.pull_requests_target]),
14 (_('Pull requests target'), len(c.rhodecode_db_repo.pull_requests_target), '', ['pr_id:{}, repo:{}'.format(x.pull_request_id,x.target_repo.repo_name) for x in c.rhodecode_db_repo.pull_requests_target]),
15 (_('Attached Artifacts'), len(c.rhodecode_db_repo.artifacts), '', ''),
15 (_('Attached Artifacts'), len(c.rhodecode_db_repo.artifacts), '', ''),
16 ]
16 ]
17 %>
17 %>
18
18
19 <div class="panel panel-default">
19 <div class="panel panel-default">
20 <div class="panel-heading" id="advanced-info" >
20 <div class="panel-heading" id="advanced-info" >
21 <h3 class="panel-title">${_('Repository: %s') % c.rhodecode_db_repo.repo_name} <a class="permalink" href="#advanced-info"> ΒΆ</a></h3>
21 <h3 class="panel-title">${_('Repository: %s') % c.rhodecode_db_repo.repo_name} <a class="permalink" href="#advanced-info"> ΒΆ</a></h3>
22 </div>
22 </div>
23 <div class="panel-body">
23 <div class="panel-body">
24 ${base.dt_info_panel(elems)}
24 ${base.dt_info_panel(elems)}
25 </div>
25 </div>
26 </div>
26 </div>
27
27
28
28
29 <div class="panel panel-default">
29 <div class="panel panel-default">
30 <div class="panel-heading" id="advanced-fork">
30 <div class="panel-heading" id="advanced-fork">
31 <h3 class="panel-title">${_('Fork Reference')} <a class="permalink" href="#advanced-fork"> ΒΆ</a></h3>
31 <h3 class="panel-title">${_('Fork Reference')} <a class="permalink" href="#advanced-fork"> ΒΆ</a></h3>
32 </div>
32 </div>
33 <div class="panel-body">
33 <div class="panel-body">
34 ${h.secure_form(h.route_path('edit_repo_advanced_fork', repo_name=c.rhodecode_db_repo.repo_name), request=request)}
34 ${h.secure_form(h.route_path('edit_repo_advanced_fork', repo_name=c.rhodecode_db_repo.repo_name), request=request)}
35
35
36 % if c.rhodecode_db_repo.fork:
36 % if c.rhodecode_db_repo.fork:
37 <div class="panel-body-title-text">${h.literal(_('This repository is a fork of %(repo_link)s') % {'repo_link': h.link_to_if(c.has_origin_repo_read_perm,c.rhodecode_db_repo.fork.repo_name, h.route_path('repo_summary', repo_name=c.rhodecode_db_repo.fork.repo_name))})}
37 <div class="panel-body-title-text">${h.literal(_('This repository is a fork of %(repo_link)s') % {'repo_link': h.link_to_if(c.has_origin_repo_read_perm,c.rhodecode_db_repo.fork.repo_name, h.route_path('repo_summary', repo_name=c.rhodecode_db_repo.fork.repo_name))})}
38 | <button class="btn btn-link btn-danger" type="submit">Remove fork reference</button></div>
38 | <button class="btn btn-link btn-danger" type="submit">Remove fork reference</button></div>
39 % endif
39 % endif
40
40
41 <div class="field">
41 <div class="field">
42 ${h.hidden('id_fork_of')}
42 ${h.hidden('id_fork_of')}
43 ${h.submit('set_as_fork_%s' % c.rhodecode_db_repo.repo_name,_('Set'),class_="btn btn-small",)}
43 ${h.submit('set_as_fork_%s' % c.rhodecode_db_repo.repo_name,_('Set'),class_="btn btn-small",)}
44 </div>
44 </div>
45 <div class="field">
45 <div class="field">
46 <span class="help-block">${_('Manually set this repository as a fork of another from the list')}</span>
46 <span class="help-block">${_('Manually set this repository as a fork of another from the list')}</span>
47 </div>
47 </div>
48 ${h.end_form()}
48 ${h.end_form()}
49 </div>
49 </div>
50 </div>
50 </div>
51
51
52
52
53 <div class="panel panel-default">
53 <div class="panel panel-default">
54 <div class="panel-heading" id="advanced-journal">
54 <div class="panel-heading" id="advanced-journal">
55 <h3 class="panel-title">${_('Public Journal Visibility')} <a class="permalink" href="#advanced-journal"> ΒΆ</a></h3>
55 <h3 class="panel-title">${_('Public Journal Visibility')} <a class="permalink" href="#advanced-journal"> ΒΆ</a></h3>
56 </div>
56 </div>
57 <div class="panel-body">
57 <div class="panel-body">
58 ${h.secure_form(h.route_path('edit_repo_advanced_journal', repo_name=c.rhodecode_db_repo.repo_name), request=request)}
58 ${h.secure_form(h.route_path('edit_repo_advanced_journal', repo_name=c.rhodecode_db_repo.repo_name), request=request)}
59 <div class="field">
59 <div class="field">
60 %if c.in_public_journal:
60 %if c.in_public_journal:
61 <button class="btn btn-small" type="submit">
61 <button class="btn btn-small" type="submit">
62 ${_('Remove from Public Journal')}
62 ${_('Remove from Public Journal')}
63 </button>
63 </button>
64 %else:
64 %else:
65 <button class="btn btn-small" type="submit">
65 <button class="btn btn-small" type="submit">
66 ${_('Add to Public Journal')}
66 ${_('Add to Public Journal')}
67 </button>
67 </button>
68 %endif
68 %endif
69 </div>
69 </div>
70 <div class="field" >
70 <div class="field" >
71 <span class="help-block">${_('All actions made on this repository will be visible to everyone following the public journal.')}</span>
71 <span class="help-block">${_('All actions made on this repository will be visible to everyone following the public journal.')}</span>
72 </div>
72 </div>
73 ${h.end_form()}
73 ${h.end_form()}
74 </div>
74 </div>
75 </div>
75 </div>
76
76
77
77
78 <div class="panel panel-default">
78 <div class="panel panel-default">
79 <div class="panel-heading" id="advanced-locking">
79 <div class="panel-heading" id="advanced-locking">
80 <h3 class="panel-title">${_('Locking state')} <a class="permalink" href="#advanced-locking"> ΒΆ</a></h3>
80 <h3 class="panel-title">${_('Locking state')} <a class="permalink" href="#advanced-locking"> ΒΆ</a></h3>
81 </div>
81 </div>
82 <div class="panel-body">
82 <div class="panel-body">
83 ${h.secure_form(h.route_path('edit_repo_advanced_locking', repo_name=c.rhodecode_db_repo.repo_name), request=request)}
83 ${h.secure_form(h.route_path('edit_repo_advanced_locking', repo_name=c.rhodecode_db_repo.repo_name), request=request)}
84
84
85 %if c.rhodecode_db_repo.locked[0]:
85 %if c.rhodecode_db_repo.locked[0]:
86 <div class="panel-body-title-text">${'Locked by %s on %s. Lock reason: %s' % (h.person_by_id(c.rhodecode_db_repo.locked[0]),
86 <div class="panel-body-title-text">${'Locked by %s on %s. Lock reason: %s' % (h.person_by_id(c.rhodecode_db_repo.locked[0]),
87 h.format_date(h. time_to_datetime(c.rhodecode_db_repo.locked[1])), c.rhodecode_db_repo.locked[2])}</div>
87 h.format_date(h. time_to_datetime(c.rhodecode_db_repo.locked[1])), c.rhodecode_db_repo.locked[2])}</div>
88 %else:
88 %else:
89 <div class="panel-body-title-text">${_('This Repository is not currently locked.')}</div>
89 <div class="panel-body-title-text">${_('This Repository is not currently locked.')}</div>
90 %endif
90 %endif
91
91
92 <div class="field" >
92 <div class="field" >
93 %if c.rhodecode_db_repo.locked[0]:
93 %if c.rhodecode_db_repo.locked[0]:
94 ${h.hidden('set_unlock', '1')}
94 ${h.hidden('set_unlock', '1')}
95 <button class="btn btn-small" type="submit"
95 <button class="btn btn-small" type="submit"
96 onclick="submitConfirm(event, this, _gettext('Confirm to unlock this repository'), _gettext('Unlock'), '${c.rhodecode_db_repo.repo_name}')"
96 onclick="submitConfirm(event, this, _gettext('Confirm to unlock this repository'), _gettext('Unlock'), '${c.rhodecode_db_repo.repo_name}')"
97 >
97 >
98 <i class="icon-unlock"></i>
98 <i class="icon-unlock"></i>
99 ${_('Unlock repository')}
99 ${_('Unlock repository')}
100 </button>
100 </button>
101 %else:
101 %else:
102 ${h.hidden('set_lock', '1')}
102 ${h.hidden('set_lock', '1')}
103 <button class="btn btn-small" type="submit"
103 <button class="btn btn-small" type="submit"
104 onclick="submitConfirm(event, this, _gettext('Confirm to lock this repository'), _gettext('lock'), '${c.rhodecode_db_repo.repo_name}')"
104 onclick="submitConfirm(event, this, _gettext('Confirm to lock this repository'), _gettext('lock'), '${c.rhodecode_db_repo.repo_name}')"
105 >
105 >
106 <i class="icon-lock"></i>
106 <i class="icon-lock"></i>
107 ${_('Lock repository')}
107 ${_('Lock repository')}
108 </button>
108 </button>
109 %endif
109 %endif
110 </div>
110 </div>
111 <div class="field" >
111 <div class="field" >
112 <span class="help-block">
112 <span class="help-block">
113 ${_('Force repository locking. This only works when anonymous access is disabled. Pulling from the repository locks the repository to that user until the same user pushes to that repository again.')}
113 ${_('Force repository locking. This only works when anonymous access is disabled. Pulling from the repository locks the repository to that user until the same user pushes to that repository again.')}
114 </span>
114 </span>
115 </div>
115 </div>
116 ${h.end_form()}
116 ${h.end_form()}
117 </div>
117 </div>
118 </div>
118 </div>
119
119
120
120
121 <div class="panel panel-default">
121 <div class="panel panel-default">
122 <div class="panel-heading" id="advanced-hooks">
122 <div class="panel-heading" id="advanced-hooks">
123 <h3 class="panel-title">${_('Hooks')} <a class="permalink" href="#advanced-hooks"> ΒΆ</a></h3>
123 <h3 class="panel-title">${_('Hooks')} <a class="permalink" href="#advanced-hooks"> ΒΆ</a></h3>
124 </div>
124 </div>
125 <div class="panel-body">
125 <div class="panel-body">
126 <table class="rctable">
126 <table class="rctable">
127 <th>${_('Hook type')}</th>
127 <th>${_('Hook type')}</th>
128 <th>${_('Hook version')}</th>
128 <th>${_('Hook version')}</th>
129 <th>${_('Current version')}</th>
129 <th>${_('Current version')}</th>
130 % if c.ver_info_dict:
130 % if c.ver_info_dict:
131 <tr>
131 <tr>
132 <td>${_('PRE HOOK')}</td>
132 <td>${_('PRE HOOK')}</td>
133 <td>${c.ver_info_dict['pre_version']}</td>
133 <td>${c.ver_info_dict['pre_version']}</td>
134 <td>${c.rhodecode_version}</td>
134 <td>${c.rhodecode_version}</td>
135 </tr>
135 </tr>
136 <tr>
136 <tr>
137 <td>${_('POST HOOK')}</td>
137 <td>${_('POST HOOK')}</td>
138 <td>${c.ver_info_dict['post_version']}</td>
138 <td>${c.ver_info_dict['post_version']}</td>
139 <td>${c.rhodecode_version}</td>
139 <td>${c.rhodecode_version}</td>
140 </tr>
140 </tr>
141 % else:
141 % else:
142 <tr>
142 <tr>
143 <td>${_('Unable to read hook information from VCS Server')}</td>
143 <td>${_('Unable to read hook information from VCS Server')}</td>
144 </tr>
144 </tr>
145 % endif
145 % endif
146 </table>
146 </table>
147
147
148 <a class="btn btn-primary" href="${h.route_path('edit_repo_advanced_hooks', repo_name=c.repo_name)}"
148 <a class="btn btn-primary" href="${h.route_path('edit_repo_advanced_hooks', repo_name=c.repo_name)}"
149 onclick="return confirm('${_('Confirm to reinstall hooks for this repository.')}');">
149 onclick="return confirm('${_('Confirm to reinstall hooks for this repository.')}');">
150 ${_('Update Hooks')}
150 ${_('Update Hooks')}
151 </a>
151 </a>
152 % if c.hooks_outdated:
152 % if c.hooks_outdated:
153 <span class="alert-error" style="padding: 10px">
153 <span class="alert-error" style="padding: 10px">
154 ${_('Outdated hooks detected, please update hooks using `Update Hooks` action.')}
154 ${_('Outdated hooks detected, please update hooks using `Update Hooks` action.')}
155 </span>
155 </span>
156 % endif
156 % endif
157 </div>
157 </div>
158 </div>
158 </div>
159
159
160 <div class="panel panel-warning">
160 <div class="panel panel-warning">
161 <div class="panel-heading" id="advanced-archive">
161 <div class="panel-heading" id="advanced-archive">
162 <h3 class="panel-title">${_('Archive repository')} <a class="permalink" href="#advanced-archive"> ΒΆ</a></h3>
162 <h3 class="panel-title">${_('Archive repository')} <a class="permalink" href="#advanced-archive"> ΒΆ</a></h3>
163 </div>
163 </div>
164 <div class="panel-body">
164 <div class="panel-body">
165 ${h.secure_form(h.route_path('edit_repo_advanced_archive', repo_name=c.repo_name), request=request)}
165 ${h.secure_form(h.route_path('edit_repo_advanced_archive', repo_name=c.repo_name), request=request)}
166
166
167 <div style="margin: 0 0 20px 0" class="fake-space"></div>
167 <div style="margin: 0 0 20px 0" class="fake-space"></div>
168
168
169 <div class="field">
169 <div class="field">
170 % if c.rhodecode_db_repo.archived:
170 % if c.rhodecode_db_repo.archived:
171 This repository is already archived. Only super-admin users can un-archive this repository.
171 This repository is already archived. Only super-admin users can un-archive this repository.
172 % else:
172 % else:
173 <button class="btn btn-small btn-warning" type="submit"
173 <button class="btn btn-small btn-warning" type="submit"
174 onclick="submitConfirm(event, this, _gettext('Confirm to archive this repository'), _gettext('Archive'), '${c.rhodecode_db_repo.repo_name}')"
174 onclick="submitConfirm(event, this, _gettext('Confirm to archive this repository. <br/>This action is irreversible !'), _gettext('Archive'), '${c.rhodecode_db_repo.repo_name}')"
175 >
175 >
176 ${_('Archive this repository')}
176 ${_('Archive this repository')}
177 </button>
177 </button>
178 % endif
178 % endif
179
179
180 </div>
180 </div>
181 <div class="field">
181 <div class="field">
182 <span class="help-block">
182 <span class="help-block">
183 <strong>
184 ${_('This action is irreversible')} !
185 </strong><br/>
183 ${_('Archiving the repository will make it entirely read-only. The repository cannot be committed to.'
186 ${_('Archiving the repository will make it entirely read-only. The repository cannot be committed to.'
184 'It is hidden from the search results and dashboard. ')}
187 'It is hidden from the search results and dashboard. ')}
185 </span>
188 </span>
186 </div>
189 </div>
187
190
188 ${h.end_form()}
191 ${h.end_form()}
189 </div>
192 </div>
190 </div>
193 </div>
191
194
192
195
193 <div class="panel panel-danger">
196 <div class="panel panel-danger">
194 <div class="panel-heading" id="advanced-delete">
197 <div class="panel-heading" id="advanced-delete">
195 <h3 class="panel-title">${_('Delete repository')} <a class="permalink" href="#advanced-delete"> ΒΆ</a></h3>
198 <h3 class="panel-title">${_('Delete repository')} <a class="permalink" href="#advanced-delete"> ΒΆ</a></h3>
196 </div>
199 </div>
197 <div class="panel-body">
200 <div class="panel-body">
198 ${h.secure_form(h.route_path('edit_repo_advanced_delete', repo_name=c.repo_name), request=request)}
201 ${h.secure_form(h.route_path('edit_repo_advanced_delete', repo_name=c.repo_name), request=request)}
199 <table class="display">
202 <table class="display">
200 <tr>
203 <tr>
201 <td>
204 <td>
202 ${_ungettext('This repository has %s fork.', 'This repository has %s forks.', c.rhodecode_db_repo.forks.count()) % c.rhodecode_db_repo.forks.count()}
205 ${_ungettext('This repository has %s fork.', 'This repository has %s forks.', c.rhodecode_db_repo.forks.count()) % c.rhodecode_db_repo.forks.count()}
203 </td>
206 </td>
204 <td>
207 <td>
205 %if c.rhodecode_db_repo.forks.count():
208 %if c.rhodecode_db_repo.forks.count():
206 <input type="radio" name="forks" value="detach_forks" checked="checked"/> <label for="forks">${_('Detach forks')}</label>
209 <input type="radio" name="forks" value="detach_forks" checked="checked"/> <label for="forks">${_('Detach forks')}</label>
207 %endif
210 %endif
208 </td>
211 </td>
209 <td>
212 <td>
210 %if c.rhodecode_db_repo.forks.count():
213 %if c.rhodecode_db_repo.forks.count():
211 <input type="radio" name="forks" value="delete_forks"/> <label for="forks">${_('Delete forks')}</label>
214 <input type="radio" name="forks" value="delete_forks"/> <label for="forks">${_('Delete forks')}</label>
212 %endif
215 %endif
213 </td>
216 </td>
214 </tr>
217 </tr>
215 <% attached_prs = len(c.rhodecode_db_repo.pull_requests_source + c.rhodecode_db_repo.pull_requests_target) %>
218 <% attached_prs = len(c.rhodecode_db_repo.pull_requests_source + c.rhodecode_db_repo.pull_requests_target) %>
216 % if c.rhodecode_db_repo.pull_requests_source or c.rhodecode_db_repo.pull_requests_target:
219 % if c.rhodecode_db_repo.pull_requests_source or c.rhodecode_db_repo.pull_requests_target:
217 <tr>
220 <tr>
218 <td>
221 <td>
219 ${_ungettext('This repository has %s attached pull request.', 'This repository has %s attached pull requests.', attached_prs) % attached_prs}
222 ${_ungettext('This repository has %s attached pull request.', 'This repository has %s attached pull requests.', attached_prs) % attached_prs}
220 <br/>
223 <br/>
221 ${_('Consider to archive this repository instead.')}
224 ${_('Consider to archive this repository instead.')}
222 </td>
225 </td>
223 <td></td>
226 <td></td>
224 <td></td>
227 <td></td>
225 </tr>
228 </tr>
226 % endif
229 % endif
227 </table>
230 </table>
228 <div style="margin: 0 0 20px 0" class="fake-space"></div>
231 <div style="margin: 0 0 20px 0" class="fake-space"></div>
229
232
230 <div class="field">
233 <div class="field">
231 <button class="btn btn-small btn-danger" type="submit"
234 <button class="btn btn-small btn-danger" type="submit"
232 onclick="submitConfirm(event, this, _gettext('Confirm to delete this repository'), _gettext('Delete'), '${c.rhodecode_db_repo.repo_name}')"
235 onclick="submitConfirm(event, this, _gettext('Confirm to delete this repository'), _gettext('Delete'), '${c.rhodecode_db_repo.repo_name}')"
233 >
236 >
234 ${_('Delete this repository')}
237 ${_('Delete this repository')}
235 </button>
238 </button>
236 </div>
239 </div>
237 <div class="field">
240 <div class="field">
238 <span class="help-block">
241 <span class="help-block">
239 ${_('This repository will be renamed in a special way in order to make it inaccessible to RhodeCode Enterprise and its VCS systems. If you need to fully delete it from the file system, please do it manually, or with rhodecode-cleanup-repos command available in rhodecode-tools.')}
242 ${_('This repository will be renamed in a special way in order to make it inaccessible to RhodeCode Enterprise and its VCS systems. If you need to fully delete it from the file system, please do it manually, or with rhodecode-cleanup-repos command available in rhodecode-tools.')}
240 </span>
243 </span>
241 </div>
244 </div>
242
245
243 ${h.end_form()}
246 ${h.end_form()}
244 </div>
247 </div>
245 </div>
248 </div>
246
249
247
250
248 <script>
251 <script>
249
252
250 var currentRepoId = ${c.rhodecode_db_repo.repo_id};
253 var currentRepoId = ${c.rhodecode_db_repo.repo_id};
251
254
252 var repoTypeFilter = function(data) {
255 var repoTypeFilter = function(data) {
253 var results = [];
256 var results = [];
254
257
255 if (!data.results[0]) {
258 if (!data.results[0]) {
256 return data
259 return data
257 }
260 }
258
261
259 $.each(data.results[0].children, function() {
262 $.each(data.results[0].children, function() {
260 // filter out the SAME repo, it cannot be used as fork of itself
263 // filter out the SAME repo, it cannot be used as fork of itself
261 if (this.repo_id != currentRepoId) {
264 if (this.repo_id != currentRepoId) {
262 this.id = this.repo_id;
265 this.id = this.repo_id;
263 results.push(this)
266 results.push(this)
264 }
267 }
265 });
268 });
266 data.results[0].children = results;
269 data.results[0].children = results;
267 return data;
270 return data;
268 };
271 };
269
272
270 $("#id_fork_of").select2({
273 $("#id_fork_of").select2({
271 cachedDataSource: {},
274 cachedDataSource: {},
272 minimumInputLength: 2,
275 minimumInputLength: 2,
273 placeholder: "${_('Change repository') if c.rhodecode_db_repo.fork else _('Pick repository')}",
276 placeholder: "${_('Change repository') if c.rhodecode_db_repo.fork else _('Pick repository')}",
274 dropdownAutoWidth: true,
277 dropdownAutoWidth: true,
275 containerCssClass: "drop-menu",
278 containerCssClass: "drop-menu",
276 dropdownCssClass: "drop-menu-dropdown",
279 dropdownCssClass: "drop-menu-dropdown",
277 formatResult: formatRepoResult,
280 formatResult: formatRepoResult,
278 query: $.debounce(250, function(query){
281 query: $.debounce(250, function(query){
279 self = this;
282 self = this;
280 var cacheKey = query.term;
283 var cacheKey = query.term;
281 var cachedData = self.cachedDataSource[cacheKey];
284 var cachedData = self.cachedDataSource[cacheKey];
282
285
283 if (cachedData) {
286 if (cachedData) {
284 query.callback({results: cachedData.results});
287 query.callback({results: cachedData.results});
285 } else {
288 } else {
286 $.ajax({
289 $.ajax({
287 url: pyroutes.url('repo_list_data'),
290 url: pyroutes.url('repo_list_data'),
288 data: {'query': query.term, repo_type: '${c.rhodecode_db_repo.repo_type}'},
291 data: {'query': query.term, repo_type: '${c.rhodecode_db_repo.repo_type}'},
289 dataType: 'json',
292 dataType: 'json',
290 type: 'GET',
293 type: 'GET',
291 success: function(data) {
294 success: function(data) {
292 data = repoTypeFilter(data);
295 data = repoTypeFilter(data);
293 self.cachedDataSource[cacheKey] = data;
296 self.cachedDataSource[cacheKey] = data;
294 query.callback({results: data.results});
297 query.callback({results: data.results});
295 },
298 },
296 error: function(data, textStatus, errorThrown) {
299 error: function(data, textStatus, errorThrown) {
297 alert("Error while fetching entries.\nError code {0} ({1}).".format(data.status, data.statusText));
300 alert("Error while fetching entries.\nError code {0} ({1}).".format(data.status, data.statusText));
298 }
301 }
299 })
302 })
300 }
303 }
301 })
304 })
302 });
305 });
303 </script>
306 </script>
304
307
General Comments 1
Under Review
author

Auto status change to "Under Review"

You need to be logged in to leave comments. Login now