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