| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Handles requests to the findit config page.""" | 5 """Handles requests to the findit config page.""" |
| 6 | 6 |
| 7 import json | 7 import json |
| 8 | 8 |
| 9 from common.base_handler import BaseHandler | 9 from common.base_handler import BaseHandler |
| 10 from common.base_handler import Permission | 10 from common.base_handler import Permission |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 latest_version = settings.GetLatestVersionNumber() | 261 latest_version = settings.GetLatestVersionNumber() |
| 262 | 262 |
| 263 data = { | 263 data = { |
| 264 'masters': waterfall_config.GetStepsForMastersRules(settings), | 264 'masters': waterfall_config.GetStepsForMastersRules(settings), |
| 265 'builders': settings.builders_to_trybots, | 265 'builders': settings.builders_to_trybots, |
| 266 'try_job_settings': settings.try_job_settings, | 266 'try_job_settings': settings.try_job_settings, |
| 267 'swarming_settings': settings.swarming_settings, | 267 'swarming_settings': settings.swarming_settings, |
| 268 'download_build_data_settings': settings.download_build_data_settings, | 268 'download_build_data_settings': settings.download_build_data_settings, |
| 269 'action_settings': settings.action_settings, | 269 'action_settings': settings.action_settings, |
| 270 'check_flake_settings': settings.check_flake_settings, | 270 'check_flake_settings': settings.check_flake_settings, |
| 271 'version': settings.version, | 271 'version': settings.version_number, |
| 272 'latest_version': latest_version, | 272 'latest_version': latest_version, |
| 273 'updated_by': settings.updated_by, | 273 'updated_by': settings.updated_by, |
| 274 'updated_ts': _FormatTimestamp(settings.updated_ts) | 274 'updated_ts': _FormatTimestamp(settings.updated_ts) |
| 275 } | 275 } |
| 276 | 276 |
| 277 return {'template': 'config.html', 'data': data} | 277 return {'template': 'config.html', 'data': data} |
| 278 | 278 |
| 279 def HandlePost(self): | 279 def HandlePost(self): |
| 280 data = self.request.params.get('data') | 280 data = self.request.params.get('data') |
| 281 new_config_dict = json.loads(data) | 281 new_config_dict = json.loads(data) |
| 282 if not _ConfigurationDictIsValid(new_config_dict): # pragma: no cover | 282 if not _ConfigurationDictIsValid(new_config_dict): # pragma: no cover |
| 283 return self.CreateError( | 283 return self.CreateError( |
| 284 'New configuration settings is not properly formatted.', 400) | 284 'New configuration settings is not properly formatted.', 400) |
| 285 | 285 |
| 286 wf_config.FinditConfig.Get().Update(users.get_current_user(), | 286 wf_config.FinditConfig.Get().Update(users.get_current_user(), |
| 287 users.IsCurrentUserAdmin(), | 287 users.IsCurrentUserAdmin(), |
| 288 **new_config_dict) | 288 **new_config_dict) |
| 289 | 289 |
| 290 return self.HandleGet() | 290 return self.HandleGet() |
| OLD | NEW |