File tree Expand file tree Collapse file tree 3 files changed +13
-6
lines changed Expand file tree Collapse file tree 3 files changed +13
-6
lines changed Original file line number Diff line number Diff line change 9
9
</ option >
10
10
</ select >
11
11
</ p >
12
- < p ng-if ="config.repository "> < label for ="branch "> Branch</ label >
12
+
13
+ < p ng-if ="vm.branches "> < label for ="branch "> Branch</ label >
13
14
< select name ="branch " id ="branch " class ="form-control " ng-model ="config.branch ">
14
15
< option ng-repeat ="branch in vm.branches| orderBy: 'name' " value ="{{branch.id}} ">
15
16
{{branch.name}}
Original file line number Diff line number Diff line change @@ -8,7 +8,10 @@ angular.module('adf.widget.scm')
8
8
vm . getBranchesByRepositoryId = function ( repositoryId ) {
9
9
if ( repositoryId ) {
10
10
SCM . getBranchesByRepositoryId ( repositoryId ) . then ( function ( result ) {
11
- if ( result . branch ) {
11
+ // catch repositories without branch support
12
+ if ( result . status == 400 ) {
13
+ vm . branches = null ;
14
+ } else {
12
15
vm . branches = result . branch ;
13
16
}
14
17
} ) ;
Original file line number Diff line number Diff line change 26
26
27
27
angular . module ( 'adf.widget.scm' )
28
28
. factory ( 'SCM' , function ( scmEndpoint , $http ) {
29
- function data ( response ) {
30
- return response . data ;
31
- }
32
29
33
30
function request ( url ) {
34
- return $http . get ( scmEndpoint + url ) . then ( data ) ;
31
+ return $http . get ( scmEndpoint + url ) . then ( function ( response ) {
32
+ if ( response . status == 200 ) {
33
+ return response . data ;
34
+ }
35
+ } , function ( error ) {
36
+ return error ;
37
+ } ) ;
35
38
}
36
39
37
40
function getRepositories ( ) {
You can’t perform that action at this time.
0 commit comments