##// END OF EJS Templates
Add ini option to controll custom advanced hooks settings
marcink -
r4045:9b4ba12e default
parent child Browse files
Show More
@@ -171,7 +171,7 b' default_encoding = utf8'
171
171
172 #clone_uri = {scheme}://{user}{pass}{netloc}{path}
172 #clone_uri = {scheme}://{user}{pass}{netloc}{path}
173
173
174 ## issue tracker RhodeCode (leave blank to disable, absent for default)
174 ## issue tracker for RhodeCode (leave blank to disable, absent for default)
175 #bugtracker = http://bitbucket.org/marcinkuzminski/rhodecode/issues
175 #bugtracker = http://bitbucket.org/marcinkuzminski/rhodecode/issues
176
176
177 ## issue tracking mapping for commits messages
177 ## issue tracking mapping for commits messages
@@ -219,8 +219,13 b' auth_ret_code ='
219 ## codes don't break the transactions while 4XX codes do
219 ## codes don't break the transactions while 4XX codes do
220 lock_ret_code = 423
220 lock_ret_code = 423
221
221
222 ## allows to change the repository location in settings page
222 allow_repo_location_change = True
223 allow_repo_location_change = True
223
224
225 ## allows to setup custom hooks in settings page
226 allow_custom_hooks_settings = True
227
228
224 ####################################
229 ####################################
225 ### CELERY CONFIG ####
230 ### CELERY CONFIG ####
226 ####################################
231 ####################################
@@ -219,8 +219,13 b' auth_ret_code ='
219 ## codes don't break the transactions while 4XX codes do
219 ## codes don't break the transactions while 4XX codes do
220 lock_ret_code = 423
220 lock_ret_code = 423
221
221
222 ## allows to change the repository location in settings page
222 allow_repo_location_change = True
223 allow_repo_location_change = True
223
224
225 ## allows to setup custom hooks in settings page
226 allow_custom_hooks_settings = True
227
228
224 ####################################
229 ####################################
225 ### CELERY CONFIG ####
230 ### CELERY CONFIG ####
226 ####################################
231 ####################################
@@ -227,9 +227,12 b' auth_ret_code ='
227 <%text>## codes don't break the transactions while 4XX codes do</%text>
227 <%text>## codes don't break the transactions while 4XX codes do</%text>
228 lock_ret_code = 423
228 lock_ret_code = 423
229
229
230 <%text>## allow chaning the repository store location from web interface</%text>
230 <%text>## allows to change the repository location in settings page</%text>
231 allow_repo_location_change = True
231 allow_repo_location_change = True
232
232
233 <%text>## allows to setup custom hooks in settings page</%text>
234 allow_custom_hooks_settings = True
235
233 <%text>
236 <%text>
234 ####################################
237 ####################################
235 ### CELERY CONFIG ####
238 ### CELERY CONFIG ####
@@ -219,8 +219,13 b' auth_ret_code ='
219 ## codes don't break the transactions while 4XX codes do
219 ## codes don't break the transactions while 4XX codes do
220 lock_ret_code = 423
220 lock_ret_code = 423
221
221
222 ## allows to change the repository location in settings page
222 allow_repo_location_change = True
223 allow_repo_location_change = True
223
224
225 ## allows to setup custom hooks in settings page
226 allow_custom_hooks_settings = True
227
228
224 ####################################
229 ####################################
225 ### CELERY CONFIG ####
230 ### CELERY CONFIG ####
226 ####################################
231 ####################################
@@ -309,30 +309,31 b' class SettingsController(BaseController)'
309 'application settings'), category='error')
309 'application settings'), category='error')
310
310
311 if setting_id == 'hooks':
311 if setting_id == 'hooks':
312 ui_key = request.POST.get('new_hook_ui_key')
312 if c.visual.allow_custom_hooks_settings:
313 ui_value = request.POST.get('new_hook_ui_value')
313 ui_key = request.POST.get('new_hook_ui_key')
314 try:
314 ui_value = request.POST.get('new_hook_ui_value')
315 try:
315
316
316 if ui_value and ui_key:
317 if ui_value and ui_key:
317 RhodeCodeUi.create_or_update_hook(ui_key, ui_value)
318 RhodeCodeUi.create_or_update_hook(ui_key, ui_value)
318 h.flash(_('Added new hook'),
319 h.flash(_('Added new hook'),
319 category='success')
320 category='success')
320
321
321 # check for edits
322 # check for edits
322 update = False
323 update = False
323 _d = request.POST.dict_of_lists()
324 _d = request.POST.dict_of_lists()
324 for k, v in zip(_d.get('hook_ui_key', []),
325 for k, v in zip(_d.get('hook_ui_key', []),
325 _d.get('hook_ui_value_new', [])):
326 _d.get('hook_ui_value_new', [])):
326 RhodeCodeUi.create_or_update_hook(k, v)
327 RhodeCodeUi.create_or_update_hook(k, v)
327 update = True
328 update = True
328
329
329 if update:
330 if update:
330 h.flash(_('Updated hooks'), category='success')
331 h.flash(_('Updated hooks'), category='success')
331 Session().commit()
332 Session().commit()
332 except Exception:
333 except Exception:
333 log.error(traceback.format_exc())
334 log.error(traceback.format_exc())
334 h.flash(_('Error occurred during hook creation'),
335 h.flash(_('Error occurred during hook creation'),
335 category='error')
336 category='error')
336
337
337 return redirect(url('admin_edit_setting', setting_id='hooks'))
338 return redirect(url('admin_edit_setting', setting_id='hooks'))
338
339
@@ -279,6 +279,7 b' class BaseController(WSGIController):'
279 ## INI stored
279 ## INI stored
280 self.cut_off_limit = int(config.get('cut_off_limit'))
280 self.cut_off_limit = int(config.get('cut_off_limit'))
281 c.visual.allow_repo_location_change = str2bool(config.get('allow_repo_location_change', True))
281 c.visual.allow_repo_location_change = str2bool(config.get('allow_repo_location_change', True))
282 c.visual.allow_custom_hooks_settings = str2bool(config.get('allow_custom_hooks_settings', True))
282
283
283 c.repo_name = get_repo_slug(request) # can be empty
284 c.repo_name = get_repo_slug(request) # can be empty
284 c.backends = BACKENDS.keys()
285 c.backends = BACKENDS.keys()
@@ -36,7 +36,7 b''
36 % endfor
36 % endfor
37 </div>
37 </div>
38 </div>
38 </div>
39
39 % if c.visual.allow_custom_hooks_settings:
40 <h3>${_('Custom hooks')}</h3>
40 <h3>${_('Custom hooks')}</h3>
41 ${h.form(url('admin_setting', setting_id='hooks'),method='put')}
41 ${h.form(url('admin_setting', setting_id='hooks'),method='put')}
42 <div class="form">
42 <div class="form">
@@ -75,6 +75,7 b''
75 </div>
75 </div>
76 </div>
76 </div>
77 ${h.end_form()}
77 ${h.end_form()}
78 % endif
78 </div>
79 </div>
79 <script type="text/javascript">
80 <script type="text/javascript">
80 function ajaxActionHook(hook_id,field_id) {
81 function ajaxActionHook(hook_id,field_id) {
General Comments 0
You need to be logged in to leave comments. Login now