Add validation of github to the config tool

This commit is contained in:
Joseph Schorr 2015-01-08 13:26:24 -05:00
parent 7933bd44fd
commit 5e0ce4eea9
5 changed files with 80 additions and 24 deletions

View file

@ -369,11 +369,13 @@
<tr ng-show="mapped.GITHUB_LOGIN_KIND == 'enterprise'">
<td>Github Endpoint:</td>
<td>
<span class="config-string-field" binding="config.GITHUB_LOGIN_CONFIG.API_ENDPOINT"
placeholder="https://my.githubserver">
<span class="config-string-field"
binding="config.GITHUB_LOGIN_CONFIG.GITHUB_ENDPOINT"
placeholder="https://my.githubserver"
pattern="https?://([a-zA-Z0-9]+\.?\/?)+">
</span>
<div class="help-text">
The Github Enterprise endpoint.
The Github Enterprise endpoint. Must start with http:// or https://.
</div>
</td>
</tr>
@ -499,11 +501,13 @@
<tr ng-show="mapped.GITHUB_TRIGGER_KIND == 'enterprise'">
<td>Github Endpoint:</td>
<td>
<span class="config-string-field" binding="config.GITHUB_TRIGGER_CONFIG.API_ENDPOINT"
placeholder="https://my.githubserver">
<span class="config-string-field"
binding="config.GITHUB_TRIGGER_CONFIG.GITHUB_ENDPOINT"
placeholder="https://my.githubserver"
pattern="https?://([a-zA-Z0-9]+\.?\/?)+">
</span>
<div class="help-text">
The Github Enterprise endpoint.
The Github Enterprise endpoint. Must start with http:// or https://.
</div>
</td>
</tr>

View file

@ -29,6 +29,10 @@ angular.module("core-config-setup", ['angularFileUpload'])
{'id': 'github-login', 'title': 'Github (Enterprise) Authentication', 'condition': function(config) {
return config.FEATURE_GITHUB_LOGIN;
}},
{'id': 'github-trigger', 'title': 'Github (Enterprise) Build Triggers', 'condition': function(config) {
return config.FEATURE_GITHUB_BUILD;
}}
];
@ -151,8 +155,10 @@ angular.module("core-config-setup", ['angularFileUpload'])
}
if (value == 'enterprise') {
$scope.config[key]['GITHUB_ENDPOINT'] = '';
$scope.config[key]['API_ENDPOINT'] = '';
if ($scope.config[key]['GITHUB_ENDPOINT'] == 'https://github.com/') {
$scope.config[key]['GITHUB_ENDPOINT'] = '';
}
delete $scope.config[key]['API_ENDPOINT'];
} else if (value == 'hosted') {
$scope.config[key]['GITHUB_ENDPOINT'] = 'https://github.com/';
$scope.config[key]['API_ENDPOINT'] = 'https://api.github.com/';