##// END OF EJS Templates
repository: fixed a bug when scoped token was attached to repository, admins were unable to remove that repository.
ergo -
r2482:1a1126ca default
parent child Browse files
Show More

The requested changes are too big and content was truncated. Show full diff

1 NO CONTENT: modified file
NO CONTENT: modified file
The requested commit or file is too big and content was truncated. Show full diff
@@ -1,210 +1,211 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 (_('Owner'), lambda:base.gravatar_with_user(c.rhodecode_db_repo.user.email), '', ''),
5 (_('Owner'), lambda:base.gravatar_with_user(c.rhodecode_db_repo.user.email), '', ''),
6 (_('Created on'), h.format_date(c.rhodecode_db_repo.created_on), '', ''),
6 (_('Created on'), h.format_date(c.rhodecode_db_repo.created_on), '', ''),
7 (_('Updated on'), h.format_date(c.rhodecode_db_repo.updated_on), '', ''),
7 (_('Updated on'), h.format_date(c.rhodecode_db_repo.updated_on), '', ''),
8 (_('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'))), '', ''),
8 (_('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 (_('Attached scoped tokens'), len(c.rhodecode_db_repo.scoped_tokens), '', [x.user for x in c.rhodecode_db_repo.scoped_tokens]),
9 ]
10 ]
10 %>
11 %>
11
12
12 <div class="panel panel-default">
13 <div class="panel panel-default">
13 <div class="panel-heading" id="advanced-info" >
14 <div class="panel-heading" id="advanced-info" >
14 <h3 class="panel-title">${_('Repository: %s') % c.rhodecode_db_repo.repo_name} <a class="permalink" href="#advanced-info"></a></h3>
15 <h3 class="panel-title">${_('Repository: %s') % c.rhodecode_db_repo.repo_name} <a class="permalink" href="#advanced-info"></a></h3>
15 </div>
16 </div>
16 <div class="panel-body">
17 <div class="panel-body">
17 ${base.dt_info_panel(elems)}
18 ${base.dt_info_panel(elems)}
18 </div>
19 </div>
19 </div>
20 </div>
20
21
21
22
22 <div class="panel panel-default">
23 <div class="panel panel-default">
23 <div class="panel-heading" id="advanced-fork">
24 <div class="panel-heading" id="advanced-fork">
24 <h3 class="panel-title">${_('Fork Reference')} <a class="permalink" href="#advanced-fork"></a></h3>
25 <h3 class="panel-title">${_('Fork Reference')} <a class="permalink" href="#advanced-fork"></a></h3>
25 </div>
26 </div>
26 <div class="panel-body">
27 <div class="panel-body">
27 ${h.secure_form(h.route_path('edit_repo_advanced_fork', repo_name=c.rhodecode_db_repo.repo_name), request=request)}
28 ${h.secure_form(h.route_path('edit_repo_advanced_fork', repo_name=c.rhodecode_db_repo.repo_name), request=request)}
28
29
29 % if c.rhodecode_db_repo.fork:
30 % if c.rhodecode_db_repo.fork:
30 <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))})}
31 <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))})}
31 | <button class="btn btn-link btn-danger" type="submit">Remove fork reference</button></div>
32 | <button class="btn btn-link btn-danger" type="submit">Remove fork reference</button></div>
32 % endif
33 % endif
33
34
34 <div class="field">
35 <div class="field">
35 ${h.hidden('id_fork_of')}
36 ${h.hidden('id_fork_of')}
36 ${h.submit('set_as_fork_%s' % c.rhodecode_db_repo.repo_name,_('Set'),class_="btn btn-small",)}
37 ${h.submit('set_as_fork_%s' % c.rhodecode_db_repo.repo_name,_('Set'),class_="btn btn-small",)}
37 </div>
38 </div>
38 <div class="field">
39 <div class="field">
39 <span class="help-block">${_('Manually set this repository as a fork of another from the list')}</span>
40 <span class="help-block">${_('Manually set this repository as a fork of another from the list')}</span>
40 </div>
41 </div>
41 ${h.end_form()}
42 ${h.end_form()}
42 </div>
43 </div>
43 </div>
44 </div>
44
45
45
46
46 <div class="panel panel-default">
47 <div class="panel panel-default">
47 <div class="panel-heading" id="advanced-journal">
48 <div class="panel-heading" id="advanced-journal">
48 <h3 class="panel-title">${_('Public Journal Visibility')} <a class="permalink" href="#advanced-journal"></a></h3>
49 <h3 class="panel-title">${_('Public Journal Visibility')} <a class="permalink" href="#advanced-journal"></a></h3>
49 </div>
50 </div>
50 <div class="panel-body">
51 <div class="panel-body">
51 ${h.secure_form(h.route_path('edit_repo_advanced_journal', repo_name=c.rhodecode_db_repo.repo_name), request=request)}
52 ${h.secure_form(h.route_path('edit_repo_advanced_journal', repo_name=c.rhodecode_db_repo.repo_name), request=request)}
52 <div class="field">
53 <div class="field">
53 %if c.in_public_journal:
54 %if c.in_public_journal:
54 <button class="btn btn-small" type="submit">
55 <button class="btn btn-small" type="submit">
55 ${_('Remove from Public Journal')}
56 ${_('Remove from Public Journal')}
56 </button>
57 </button>
57 %else:
58 %else:
58 <button class="btn btn-small" type="submit">
59 <button class="btn btn-small" type="submit">
59 ${_('Add to Public Journal')}
60 ${_('Add to Public Journal')}
60 </button>
61 </button>
61 %endif
62 %endif
62 </div>
63 </div>
63 <div class="field" >
64 <div class="field" >
64 <span class="help-block">${_('All actions made on this repository will be visible to everyone following the public journal.')}</span>
65 <span class="help-block">${_('All actions made on this repository will be visible to everyone following the public journal.')}</span>
65 </div>
66 </div>
66 ${h.end_form()}
67 ${h.end_form()}
67 </div>
68 </div>
68 </div>
69 </div>
69
70
70
71
71 <div class="panel panel-default">
72 <div class="panel panel-default">
72 <div class="panel-heading" id="advanced-locking">
73 <div class="panel-heading" id="advanced-locking">
73 <h3 class="panel-title">${_('Locking state')} <a class="permalink" href="#advanced-locking"></a></h3>
74 <h3 class="panel-title">${_('Locking state')} <a class="permalink" href="#advanced-locking"></a></h3>
74 </div>
75 </div>
75 <div class="panel-body">
76 <div class="panel-body">
76 ${h.secure_form(h.route_path('edit_repo_advanced_locking', repo_name=c.rhodecode_db_repo.repo_name), request=request)}
77 ${h.secure_form(h.route_path('edit_repo_advanced_locking', repo_name=c.rhodecode_db_repo.repo_name), request=request)}
77
78
78 %if c.rhodecode_db_repo.locked[0]:
79 %if c.rhodecode_db_repo.locked[0]:
79 <div class="panel-body-title-text">${'Locked by %s on %s. Lock reason: %s' % (h.person_by_id(c.rhodecode_db_repo.locked[0]),
80 <div class="panel-body-title-text">${'Locked by %s on %s. Lock reason: %s' % (h.person_by_id(c.rhodecode_db_repo.locked[0]),
80 h.format_date(h. time_to_datetime(c.rhodecode_db_repo.locked[1])), c.rhodecode_db_repo.locked[2])}</div>
81 h.format_date(h. time_to_datetime(c.rhodecode_db_repo.locked[1])), c.rhodecode_db_repo.locked[2])}</div>
81 %else:
82 %else:
82 <div class="panel-body-title-text">${_('This Repository is not currently locked.')}</div>
83 <div class="panel-body-title-text">${_('This Repository is not currently locked.')}</div>
83 %endif
84 %endif
84
85
85 <div class="field" >
86 <div class="field" >
86 %if c.rhodecode_db_repo.locked[0]:
87 %if c.rhodecode_db_repo.locked[0]:
87 ${h.hidden('set_unlock', '1')}
88 ${h.hidden('set_unlock', '1')}
88 <button class="btn btn-small" type="submit"
89 <button class="btn btn-small" type="submit"
89 onclick="return confirm('${_('Confirm to unlock repository.')}');">
90 onclick="return confirm('${_('Confirm to unlock repository.')}');">
90 <i class="icon-unlock"></i>
91 <i class="icon-unlock"></i>
91 ${_('Unlock repository')}
92 ${_('Unlock repository')}
92 </button>
93 </button>
93 %else:
94 %else:
94 ${h.hidden('set_lock', '1')}
95 ${h.hidden('set_lock', '1')}
95 <button class="btn btn-small" type="submit"
96 <button class="btn btn-small" type="submit"
96 onclick="return confirm('${_('Confirm to lock repository.')}');">
97 onclick="return confirm('${_('Confirm to lock repository.')}');">
97 <i class="icon-lock"></i>
98 <i class="icon-lock"></i>
98 ${_('Lock Repository')}
99 ${_('Lock Repository')}
99 </button>
100 </button>
100 %endif
101 %endif
101 </div>
102 </div>
102 <div class="field" >
103 <div class="field" >
103 <span class="help-block">
104 <span class="help-block">
104 ${_('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.')}
105 ${_('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.')}
105 </span>
106 </span>
106 </div>
107 </div>
107 ${h.end_form()}
108 ${h.end_form()}
108 </div>
109 </div>
109 </div>
110 </div>
110
111
111 <div class="panel panel-danger">
112 <div class="panel panel-danger">
112 <div class="panel-heading" id="advanced-delete">
113 <div class="panel-heading" id="advanced-delete">
113 <h3 class="panel-title">${_('Delete repository')} <a class="permalink" href="#advanced-delete"></a></h3>
114 <h3 class="panel-title">${_('Delete repository')} <a class="permalink" href="#advanced-delete"></a></h3>
114 </div>
115 </div>
115 <div class="panel-body">
116 <div class="panel-body">
116 ${h.secure_form(h.route_path('edit_repo_advanced_delete', repo_name=c.repo_name), request=request)}
117 ${h.secure_form(h.route_path('edit_repo_advanced_delete', repo_name=c.repo_name), request=request)}
117 <table class="display">
118 <table class="display">
118 <tr>
119 <tr>
119 <td>
120 <td>
120 ${_ungettext('This repository has %s fork.', 'This repository has %s forks.', c.rhodecode_db_repo.forks.count()) % c.rhodecode_db_repo.forks.count()}
121 ${_ungettext('This repository has %s fork.', 'This repository has %s forks.', c.rhodecode_db_repo.forks.count()) % c.rhodecode_db_repo.forks.count()}
121 </td>
122 </td>
122 <td>
123 <td>
123 %if c.rhodecode_db_repo.forks.count():
124 %if c.rhodecode_db_repo.forks.count():
124 <input type="radio" name="forks" value="detach_forks" checked="checked"/> <label for="forks">${_('Detach forks')}</label>
125 <input type="radio" name="forks" value="detach_forks" checked="checked"/> <label for="forks">${_('Detach forks')}</label>
125 %endif
126 %endif
126 </td>
127 </td>
127 <td>
128 <td>
128 %if c.rhodecode_db_repo.forks.count():
129 %if c.rhodecode_db_repo.forks.count():
129 <input type="radio" name="forks" value="delete_forks"/> <label for="forks">${_('Delete forks')}</label>
130 <input type="radio" name="forks" value="delete_forks"/> <label for="forks">${_('Delete forks')}</label>
130 %endif
131 %endif
131 </td>
132 </td>
132 </tr>
133 </tr>
133 </table>
134 </table>
134 <div style="margin: 0 0 20px 0" class="fake-space"></div>
135 <div style="margin: 0 0 20px 0" class="fake-space"></div>
135
136
136 <div class="field">
137 <div class="field">
137 <button class="btn btn-small btn-danger" type="submit"
138 <button class="btn btn-small btn-danger" type="submit"
138 onclick="return confirm('${_('Confirm to delete this repository: %s') % c.repo_name}');">
139 onclick="return confirm('${_('Confirm to delete this repository: %s') % c.repo_name}');">
139 <i class="icon-remove-sign"></i>
140 <i class="icon-remove-sign"></i>
140 ${_('Delete This Repository')}
141 ${_('Delete This Repository')}
141 </button>
142 </button>
142 </div>
143 </div>
143 <div class="field">
144 <div class="field">
144 <span class="help-block">
145 <span class="help-block">
145 ${_('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.')}
146 ${_('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.')}
146 </span>
147 </span>
147 </div>
148 </div>
148
149
149 ${h.end_form()}
150 ${h.end_form()}
150 </div>
151 </div>
151 </div>
152 </div>
152
153
153
154
154 <script>
155 <script>
155
156
156 var currentRepoId = ${c.rhodecode_db_repo.repo_id};
157 var currentRepoId = ${c.rhodecode_db_repo.repo_id};
157
158
158 var repoTypeFilter = function(data) {
159 var repoTypeFilter = function(data) {
159 var results = [];
160 var results = [];
160
161
161 if (!data.results[0]) {
162 if (!data.results[0]) {
162 return data
163 return data
163 }
164 }
164
165
165 $.each(data.results[0].children, function() {
166 $.each(data.results[0].children, function() {
166 // filter out the SAME repo, it cannot be used as fork of itself
167 // filter out the SAME repo, it cannot be used as fork of itself
167 if (this.obj.repo_id != currentRepoId) {
168 if (this.obj.repo_id != currentRepoId) {
168 this.id = this.obj.repo_id;
169 this.id = this.obj.repo_id;
169 results.push(this)
170 results.push(this)
170 }
171 }
171 });
172 });
172 data.results[0].children = results;
173 data.results[0].children = results;
173 return data;
174 return data;
174 };
175 };
175
176
176 $("#id_fork_of").select2({
177 $("#id_fork_of").select2({
177 cachedDataSource: {},
178 cachedDataSource: {},
178 minimumInputLength: 2,
179 minimumInputLength: 2,
179 placeholder: "${_('Change repository') if c.rhodecode_db_repo.fork else _('Pick repository')}",
180 placeholder: "${_('Change repository') if c.rhodecode_db_repo.fork else _('Pick repository')}",
180 dropdownAutoWidth: true,
181 dropdownAutoWidth: true,
181 containerCssClass: "drop-menu",
182 containerCssClass: "drop-menu",
182 dropdownCssClass: "drop-menu-dropdown",
183 dropdownCssClass: "drop-menu-dropdown",
183 formatResult: formatResult,
184 formatResult: formatResult,
184 query: $.debounce(250, function(query){
185 query: $.debounce(250, function(query){
185 self = this;
186 self = this;
186 var cacheKey = query.term;
187 var cacheKey = query.term;
187 var cachedData = self.cachedDataSource[cacheKey];
188 var cachedData = self.cachedDataSource[cacheKey];
188
189
189 if (cachedData) {
190 if (cachedData) {
190 query.callback({results: cachedData.results});
191 query.callback({results: cachedData.results});
191 } else {
192 } else {
192 $.ajax({
193 $.ajax({
193 url: pyroutes.url('repo_list_data'),
194 url: pyroutes.url('repo_list_data'),
194 data: {'query': query.term, repo_type: '${c.rhodecode_db_repo.repo_type}'},
195 data: {'query': query.term, repo_type: '${c.rhodecode_db_repo.repo_type}'},
195 dataType: 'json',
196 dataType: 'json',
196 type: 'GET',
197 type: 'GET',
197 success: function(data) {
198 success: function(data) {
198 data = repoTypeFilter(data);
199 data = repoTypeFilter(data);
199 self.cachedDataSource[cacheKey] = data;
200 self.cachedDataSource[cacheKey] = data;
200 query.callback({results: data.results});
201 query.callback({results: data.results});
201 },
202 },
202 error: function(data, textStatus, errorThrown) {
203 error: function(data, textStatus, errorThrown) {
203 alert("Error while fetching entries.\nError code {0} ({1}).".format(data.status, data.statusText));
204 alert("Error while fetching entries.\nError code {0} ({1}).".format(data.status, data.statusText));
204 }
205 }
205 })
206 })
206 }
207 }
207 })
208 })
208 });
209 });
209 </script>
210 </script>
210
211
General Comments 0
You need to be logged in to leave comments. Login now