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