##// END OF EJS Templates
integrations: removed button list as this was confusing users, and it has little value.
marcink -
r2579:74b83714 default
parent child Browse files
Show More
@@ -1,256 +1,222 b''
1 1 ## -*- coding: utf-8 -*-
2 2 <%inherit file="base.mako"/>
3 3
4 4 <%def name="breadcrumbs_links()">
5 5 %if c.repo:
6 6 ${h.link_to('Settings',h.route_path('edit_repo', repo_name=c.repo.repo_name))}
7 7 %elif c.repo_group:
8 8 ${h.link_to(_('Admin'),h.route_path('admin_home'))}
9 9 &raquo;
10 10 ${h.link_to(_('Repository Groups'),h.route_path('repo_groups'))}
11 11 &raquo;
12 12 ${h.link_to(c.repo_group.group_name,h.route_path('edit_repo_group', repo_group_name=c.repo_group.group_name))}
13 13 %else:
14 14 ${h.link_to(_('Admin'),h.route_path('admin_home'))}
15 15 &raquo;
16 16 ${h.link_to(_('Settings'),h.route_path('admin_settings'))}
17 17 %endif
18 18 %if c.current_IntegrationType:
19 19 &raquo;
20 20 %if c.repo:
21 21 ${h.link_to(_('Integrations'),
22 22 request.route_path(route_name='repo_integrations_home',
23 23 repo_name=c.repo.repo_name))}
24 24 %elif c.repo_group:
25 25 ${h.link_to(_('Integrations'),
26 26 request.route_path(route_name='repo_group_integrations_home',
27 27 repo_group_name=c.repo_group.group_name))}
28 28 %else:
29 29 ${h.link_to(_('Integrations'),
30 30 request.route_path(route_name='global_integrations_home'))}
31 31 %endif
32 32 &raquo;
33 33 ${c.current_IntegrationType.display_name}
34 34 %else:
35 35 &raquo;
36 36 ${_('Integrations')}
37 37 %endif
38 38 </%def>
39 39
40 40 <div class="panel panel-default">
41 41 <div class="panel-heading">
42 42 <h3 class="panel-title">
43 43 %if c.repo:
44 44 ${_('Current Integrations for Repository: {repo_name}').format(repo_name=c.repo.repo_name)}
45 45 %elif c.repo_group:
46 46 ${_('Current Integrations for repository group: {repo_group_name}').format(repo_group_name=c.repo_group.group_name)}
47 47 %else:
48 48 ${_('Current Integrations')}
49 49 %endif
50 50 </h3>
51 51 </div>
52 52 <div class="panel-body">
53 <%
54 if c.repo:
55 home_url = request.route_path('repo_integrations_home',
56 repo_name=c.repo.repo_name)
57 elif c.repo_group:
58 home_url = request.route_path('repo_group_integrations_home',
59 repo_group_name=c.repo_group.group_name)
60 else:
61 home_url = request.route_path('global_integrations_home')
62 %>
63
64 <a href="${home_url}" class="btn ${not c.current_IntegrationType and 'btn-primary' or ''}">${_('All')}</a>
65
66 %for integration_key, IntegrationType in c.available_integrations.items():
67 % if not IntegrationType.is_dummy:
68 <%
69 if c.repo:
70 list_url = request.route_path('repo_integrations_list',
71 repo_name=c.repo.repo_name,
72 integration=integration_key)
73 elif c.repo_group:
74 list_url = request.route_path('repo_group_integrations_list',
75 repo_group_name=c.repo_group.group_name,
76 integration=integration_key)
77 else:
78 list_url = request.route_path('global_integrations_list',
79 integration=integration_key)
80 %>
81 <a href="${list_url}"
82 class="btn ${c.current_IntegrationType and integration_key == c.current_IntegrationType.key and 'btn-primary' or ''}">
83 ${IntegrationType.display_name}
84 </a>
85 % endif
86 %endfor
87 53
88 54 <%
89 55 integration_type = c.current_IntegrationType and c.current_IntegrationType.display_name or ''
90 56
91 57 if c.repo:
92 58 create_url = h.route_path('repo_integrations_new', repo_name=c.repo.repo_name)
93 59 elif c.repo_group:
94 60 create_url = h.route_path('repo_group_integrations_new', repo_group_name=c.repo_group.group_name)
95 61 else:
96 62 create_url = h.route_path('global_integrations_new')
97 63 %>
98 64 <p class="pull-right">
99 65 <a href="${create_url}" class="btn btn-small btn-success">${_(u'Create new integration')}</a>
100 66 </p>
101 67
102 68 <table class="rctable integrations">
103 69 <thead>
104 70 <tr>
105 71 <th><a href="?sort=enabled:${c.rev_sort_dir}">${_('Enabled')}</a></th>
106 72 <th><a href="?sort=name:${c.rev_sort_dir}">${_('Name')}</a></th>
107 73 <th colspan="2"><a href="?sort=integration_type:${c.rev_sort_dir}">${_('Type')}</a></th>
108 74 <th><a href="?sort=scope:${c.rev_sort_dir}">${_('Scope')}</a></th>
109 75 <th>${_('Actions')}</th>
110 76 <th></th>
111 77 </tr>
112 78 </thead>
113 79 <tbody>
114 80 %if not c.integrations_list:
115 81 <tr>
116 82 <td colspan="7">
117 83
118 84 %if c.repo:
119 85 ${_('No {type} integrations for repo {repo} exist yet.').format(type=integration_type, repo=c.repo.repo_name)}
120 86 %elif c.repo_group:
121 87 ${_('No {type} integrations for repogroup {repogroup} exist yet.').format(type=integration_type, repogroup=c.repo_group.group_name)}
122 88 %else:
123 89 ${_('No {type} integrations exist yet.').format(type=integration_type)}
124 90 %endif
125 91
126 92 %if c.current_IntegrationType:
127 93 <%
128 94 if c.repo:
129 95 create_url = h.route_path('repo_integrations_create', repo_name=c.repo.repo_name, integration=c.current_IntegrationType.key)
130 96 elif c.repo_group:
131 97 create_url = h.route_path('repo_group_integrations_create', repo_group_name=c.repo_group.group_name, integration=c.current_IntegrationType.key)
132 98 else:
133 99 create_url = h.route_path('global_integrations_create', integration=c.current_IntegrationType.key)
134 100 %>
135 101 %endif
136 102
137 103 <a href="${create_url}">${_(u'Create one')}</a>
138 104 </td>
139 105 </tr>
140 106 %endif
141 107 %for IntegrationType, integration in c.integrations_list:
142 108 <tr id="integration_${integration.integration_id}">
143 109 <td class="td-enabled">
144 110 %if integration.enabled:
145 111 <div class="flag_status approved pull-left"></div>
146 112 %else:
147 113 <div class="flag_status rejected pull-left"></div>
148 114 %endif
149 115 </td>
150 116 <td class="td-description">
151 117 ${integration.name}
152 118 </td>
153 119 <td class="td-icon">
154 120 %if integration.integration_type in c.available_integrations:
155 121 <div class="integration-icon">
156 122 ${c.available_integrations[integration.integration_type].icon()|n}
157 123 </div>
158 124 %else:
159 125 ?
160 126 %endif
161 127 </td>
162 128 <td class="td-type">
163 129 ${integration.integration_type}
164 130 </td>
165 131 <td class="td-scope">
166 132 %if integration.repo:
167 133 <a href="${h.route_path('repo_summary', repo_name=integration.repo.repo_name)}">
168 134 ${_('repo')}:${integration.repo.repo_name}
169 135 </a>
170 136 %elif integration.repo_group:
171 137 <a href="${h.route_path('repo_group_home', repo_group_name=integration.repo_group.group_name)}">
172 138 ${_('repogroup')}:${integration.repo_group.group_name}
173 139 %if integration.child_repos_only:
174 140 ${_('child repos only')}
175 141 %else:
176 142 ${_('cascade to all')}
177 143 %endif
178 144 </a>
179 145 %else:
180 146 %if integration.child_repos_only:
181 147 ${_('top level repos only')}
182 148 %else:
183 149 ${_('global')}
184 150 %endif
185 151 </td>
186 152 %endif
187 153 <td class="td-action">
188 154 %if not IntegrationType:
189 155 ${_('unknown integration')}
190 156 %else:
191 157 <%
192 158 if c.repo:
193 159 edit_url = request.route_path('repo_integrations_edit',
194 160 repo_name=c.repo.repo_name,
195 161 integration=integration.integration_type,
196 162 integration_id=integration.integration_id)
197 163 elif c.repo_group:
198 164 edit_url = request.route_path('repo_group_integrations_edit',
199 165 repo_group_name=c.repo_group.group_name,
200 166 integration=integration.integration_type,
201 167 integration_id=integration.integration_id)
202 168 else:
203 169 edit_url = request.route_path('global_integrations_edit',
204 170 integration=integration.integration_type,
205 171 integration_id=integration.integration_id)
206 172 %>
207 173 <div class="grid_edit">
208 174 <a href="${edit_url}">${_('Edit')}</a>
209 175 </div>
210 176 <div class="grid_delete">
211 177 <a href="${edit_url}"
212 178 class="btn btn-link btn-danger delete_integration_entry"
213 179 data-desc="${integration.name}"
214 180 data-uid="${integration.integration_id}">
215 181 ${_('Delete')}
216 182 </a>
217 183 </div>
218 184 %endif
219 185 </td>
220 186 </tr>
221 187 %endfor
222 188 <tr id="last-row"></tr>
223 189 </tbody>
224 190 </table>
225 191 <div class="integrations-paginator">
226 192 <div class="pagination-wh pagination-left">
227 193 ${c.integrations_list.pager('$link_previous ~2~ $link_next')}
228 194 </div>
229 195 </div>
230 196 </div>
231 197 </div>
232 198 <script type="text/javascript">
233 199 var delete_integration = function(entry) {
234 200 if (confirm("Confirm to remove this integration: "+$(entry).data('desc'))) {
235 201 var request = $.ajax({
236 202 type: "POST",
237 203 url: $(entry).attr('href'),
238 204 data: {
239 205 'delete': 'delete',
240 206 'csrf_token': CSRF_TOKEN
241 207 },
242 208 success: function(){
243 209 location.reload();
244 210 },
245 211 error: function(data, textStatus, errorThrown){
246 212 alert("Error while deleting entry.\nError code {0} ({1}). URL: {2}".format(data.status,data.statusText,$(entry)[0].url));
247 213 }
248 214 });
249 215 };
250 216 };
251 217
252 218 $('.delete_integration_entry').on('click', function(e){
253 219 e.preventDefault();
254 220 delete_integration(this);
255 221 });
256 222 </script> No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now