##// END OF EJS Templates
integrations: don't use code-review type icons for enabled/disable state.
ergo -
r3753:7d5ebbbb new-ui
parent child Browse files
Show More
@@ -1,222 +1,220 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 ${_('Repository Group Integrations: {}').format(c.repo_group.group_name)}</h3>
46 ${_('Repository Group Integrations: {}').format(c.repo_group.group_name)}</h3>
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
53
54 <%
54 <%
55 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 ''
56
56
57 if c.repo:
57 if c.repo:
58 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)
59 elif c.repo_group:
59 elif c.repo_group:
60 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)
61 else:
61 else:
62 create_url = h.route_path('global_integrations_new')
62 create_url = h.route_path('global_integrations_new')
63 %>
63 %>
64 <p class="pull-right">
64 <p class="pull-right">
65 <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>
66 </p>
66 </p>
67
67
68 <table class="rctable integrations">
68 <table class="rctable integrations">
69 <thead>
69 <thead>
70 <tr>
70 <tr>
71 <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>
72 <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>
73 <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>
74 <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>
75 <th>${_('Actions')}</th>
75 <th>${_('Actions')}</th>
76 <th></th>
76 <th></th>
77 </tr>
77 </tr>
78 </thead>
78 </thead>
79 <tbody>
79 <tbody>
80 %if not c.integrations_list:
80 %if not c.integrations_list:
81 <tr>
81 <tr>
82 <td colspan="7">
82 <td colspan="7">
83
83
84 %if c.repo:
84 %if c.repo:
85 ${_('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)}
86 %elif c.repo_group:
86 %elif c.repo_group:
87 ${_('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)}
88 %else:
88 %else:
89 ${_('No {type} integrations exist yet.').format(type=integration_type)}
89 ${_('No {type} integrations exist yet.').format(type=integration_type)}
90 %endif
90 %endif
91
91
92 %if c.current_IntegrationType:
92 %if c.current_IntegrationType:
93 <%
93 <%
94 if c.repo:
94 if c.repo:
95 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)
96 elif c.repo_group:
96 elif c.repo_group:
97 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)
98 else:
98 else:
99 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)
100 %>
100 %>
101 %endif
101 %endif
102
102
103 <a href="${create_url}">${_(u'Create one')}</a>
103 <a href="${create_url}">${_(u'Create one')}</a>
104 </td>
104 </td>
105 </tr>
105 </tr>
106 %endif
106 %endif
107 %for IntegrationType, integration in c.integrations_list:
107 %for IntegrationType, integration in c.integrations_list:
108 <tr id="integration_${integration.integration_id}">
108 <tr id="integration_${integration.integration_id}">
109 <td class="td-enabled">
109 <td class="td-enabled">
110 %if integration.enabled:
110 <div class="pull-left">
111 <div class="flag_status approved pull-left"></div>
111 ${h.bool2icon(integration.enabled)}
112 %else:
112 </div>
113 <div class="flag_status rejected pull-left"></div>
114 %endif
115 </td>
113 </td>
116 <td class="td-description">
114 <td class="td-description">
117 ${integration.name}
115 ${integration.name}
118 </td>
116 </td>
119 <td class="td-icon">
117 <td class="td-icon">
120 %if integration.integration_type in c.available_integrations:
118 %if integration.integration_type in c.available_integrations:
121 <div class="integration-icon">
119 <div class="integration-icon">
122 ${c.available_integrations[integration.integration_type].icon()|n}
120 ${c.available_integrations[integration.integration_type].icon()|n}
123 </div>
121 </div>
124 %else:
122 %else:
125 ?
123 ?
126 %endif
124 %endif
127 </td>
125 </td>
128 <td class="td-type">
126 <td class="td-type">
129 ${integration.integration_type}
127 ${integration.integration_type}
130 </td>
128 </td>
131 <td class="td-scope">
129 <td class="td-scope">
132 %if integration.repo:
130 %if integration.repo:
133 <a href="${h.route_path('repo_summary', repo_name=integration.repo.repo_name)}">
131 <a href="${h.route_path('repo_summary', repo_name=integration.repo.repo_name)}">
134 ${_('repo')}:${integration.repo.repo_name}
132 ${_('repo')}:${integration.repo.repo_name}
135 </a>
133 </a>
136 %elif integration.repo_group:
134 %elif integration.repo_group:
137 <a href="${h.route_path('repo_group_home', repo_group_name=integration.repo_group.group_name)}">
135 <a href="${h.route_path('repo_group_home', repo_group_name=integration.repo_group.group_name)}">
138 ${_('repogroup')}:${integration.repo_group.group_name}
136 ${_('repogroup')}:${integration.repo_group.group_name}
139 %if integration.child_repos_only:
137 %if integration.child_repos_only:
140 ${_('child repos only')}
138 ${_('child repos only')}
141 %else:
139 %else:
142 ${_('cascade to all')}
140 ${_('cascade to all')}
143 %endif
141 %endif
144 </a>
142 </a>
145 %else:
143 %else:
146 %if integration.child_repos_only:
144 %if integration.child_repos_only:
147 ${_('top level repos only')}
145 ${_('top level repos only')}
148 %else:
146 %else:
149 ${_('global')}
147 ${_('global')}
150 %endif
148 %endif
151 </td>
149 </td>
152 %endif
150 %endif
153 <td class="td-action">
151 <td class="td-action">
154 %if not IntegrationType:
152 %if not IntegrationType:
155 ${_('unknown integration')}
153 ${_('unknown integration')}
156 %else:
154 %else:
157 <%
155 <%
158 if c.repo:
156 if c.repo:
159 edit_url = request.route_path('repo_integrations_edit',
157 edit_url = request.route_path('repo_integrations_edit',
160 repo_name=c.repo.repo_name,
158 repo_name=c.repo.repo_name,
161 integration=integration.integration_type,
159 integration=integration.integration_type,
162 integration_id=integration.integration_id)
160 integration_id=integration.integration_id)
163 elif c.repo_group:
161 elif c.repo_group:
164 edit_url = request.route_path('repo_group_integrations_edit',
162 edit_url = request.route_path('repo_group_integrations_edit',
165 repo_group_name=c.repo_group.group_name,
163 repo_group_name=c.repo_group.group_name,
166 integration=integration.integration_type,
164 integration=integration.integration_type,
167 integration_id=integration.integration_id)
165 integration_id=integration.integration_id)
168 else:
166 else:
169 edit_url = request.route_path('global_integrations_edit',
167 edit_url = request.route_path('global_integrations_edit',
170 integration=integration.integration_type,
168 integration=integration.integration_type,
171 integration_id=integration.integration_id)
169 integration_id=integration.integration_id)
172 %>
170 %>
173 <div class="grid_edit">
171 <div class="grid_edit">
174 <a href="${edit_url}">${_('Edit')}</a>
172 <a href="${edit_url}">${_('Edit')}</a>
175 </div>
173 </div>
176 <div class="grid_delete">
174 <div class="grid_delete">
177 <a href="${edit_url}"
175 <a href="${edit_url}"
178 class="btn btn-link btn-danger delete_integration_entry"
176 class="btn btn-link btn-danger delete_integration_entry"
179 data-desc="${integration.name}"
177 data-desc="${integration.name}"
180 data-uid="${integration.integration_id}">
178 data-uid="${integration.integration_id}">
181 ${_('Delete')}
179 ${_('Delete')}
182 </a>
180 </a>
183 </div>
181 </div>
184 %endif
182 %endif
185 </td>
183 </td>
186 </tr>
184 </tr>
187 %endfor
185 %endfor
188 <tr id="last-row"></tr>
186 <tr id="last-row"></tr>
189 </tbody>
187 </tbody>
190 </table>
188 </table>
191 <div class="integrations-paginator">
189 <div class="integrations-paginator">
192 <div class="pagination-wh pagination-left">
190 <div class="pagination-wh pagination-left">
193 ${c.integrations_list.pager('$link_previous ~2~ $link_next')}
191 ${c.integrations_list.pager('$link_previous ~2~ $link_next')}
194 </div>
192 </div>
195 </div>
193 </div>
196 </div>
194 </div>
197 </div>
195 </div>
198 <script type="text/javascript">
196 <script type="text/javascript">
199 var delete_integration = function(entry) {
197 var delete_integration = function(entry) {
200 if (confirm("Confirm to remove this integration: "+$(entry).data('desc'))) {
198 if (confirm("Confirm to remove this integration: "+$(entry).data('desc'))) {
201 var request = $.ajax({
199 var request = $.ajax({
202 type: "POST",
200 type: "POST",
203 url: $(entry).attr('href'),
201 url: $(entry).attr('href'),
204 data: {
202 data: {
205 'delete': 'delete',
203 'delete': 'delete',
206 'csrf_token': CSRF_TOKEN
204 'csrf_token': CSRF_TOKEN
207 },
205 },
208 success: function(){
206 success: function(){
209 location.reload();
207 location.reload();
210 },
208 },
211 error: function(data, textStatus, errorThrown){
209 error: function(data, textStatus, errorThrown){
212 alert("Error while deleting entry.\nError code {0} ({1}). URL: {2}".format(data.status,data.statusText,$(entry)[0].url));
210 alert("Error while deleting entry.\nError code {0} ({1}). URL: {2}".format(data.status,data.statusText,$(entry)[0].url));
213 }
211 }
214 });
212 });
215 };
213 };
216 };
214 };
217
215
218 $('.delete_integration_entry').on('click', function(e){
216 $('.delete_integration_entry').on('click', function(e){
219 e.preventDefault();
217 e.preventDefault();
220 delete_integration(this);
218 delete_integration(this);
221 });
219 });
222 </script> No newline at end of file
220 </script>
General Comments 0
You need to be logged in to leave comments. Login now