@@ -17,6 +17,7 @@ angular.module('select-version', ['ngStorage'])
17
17
$scope . componentsReadyForNext = true ;
18
18
$scope . componentsProcessed = false ;
19
19
$scope . componentsProcessError = false ;
20
+ $scope . showUnstable = false ;
20
21
21
22
$scope . tryAgainEnabled = function ( ) {
22
23
return ( $scope . upgradeProcessed || $scope . upgradeProcessError )
@@ -28,31 +29,23 @@ angular.module('select-version', ['ngStorage'])
28
29
$http . get ( 'index.php/select-version/systemPackage' , { 'responseType' : 'json' } )
29
30
. success ( function ( data ) {
30
31
if ( data . responseType != 'error' ) {
31
- if ( data . packages . length == 1 && data . packages [ 0 ] . versions . length <= 1 ) {
32
+ if ( data . packages . length == 1 ) {
32
33
$scope . upgradeProcessError = true ;
33
34
$scope . upgradeProcessErrorMessage = "You're already using the latest version, there's nothing for us to do." ;
34
35
} else {
35
36
$scope . selectedOption = [ ] ;
36
37
$scope . versions = [ ] ;
37
- for ( var i = 0 ; i < data . packages . length ; i ++ ) {
38
- angular . forEach ( data . packages [ i ] . versions , function ( value , key ) {
38
+ $scope . data = data ;
39
+ angular . forEach ( data . packages , function ( value , key ) {
40
+ if ( value . stable ) {
39
41
$scope . versions . push ( {
40
42
'versionInfo' : angular . toJson ( {
41
- 'package' : data . packages [ i ] . package ,
42
- 'version' : value
43
- } ) , 'version' : value
43
+ 'package' : value . package ,
44
+ 'version' : value . id
45
+ } ) ,
46
+ 'version' : value
44
47
} ) ;
45
- } ) ;
46
- }
47
-
48
- $scope . versions = $scope . versions . sort ( function ( a , b ) {
49
- if ( a . version . id < b . version . id ) {
50
- return 1 ;
51
- }
52
- if ( a . version . id > b . version . id ) {
53
- return - 1 ;
54
48
}
55
- return 0 ;
56
49
} ) ;
57
50
$scope . selectedOption = $scope . versions [ 0 ] . versionInfo ;
58
51
$scope . upgradeReadyForNext = true ;
@@ -160,10 +153,29 @@ angular.module('select-version', ['ngStorage'])
160
153
return false ;
161
154
} ;
162
155
156
+ $scope . showUnstableClick = function ( ) {
157
+ $scope . upgradeReadyForNext = false ;
158
+ $scope . selectedOption = [ ] ;
159
+ $scope . versions = [ ] ;
160
+ angular . forEach ( $scope . data . packages , function ( value , key ) {
161
+ if ( value . stable || $scope . showUnstable ) {
162
+ $scope . versions . push ( {
163
+ 'versionInfo' : angular . toJson ( {
164
+ 'package' : value . package ,
165
+ 'version' : value . id
166
+ } ) ,
167
+ 'version' : value
168
+ } ) ;
169
+ }
170
+ } ) ;
171
+ $scope . selectedOption = $scope . versions [ 0 ] . versionInfo ;
172
+ $scope . upgradeReadyForNext = true ;
173
+ }
174
+
163
175
$scope . update = function ( ) {
164
176
var selectedVersionInfo = angular . fromJson ( $scope . selectedOption ) ;
165
177
$scope . packages [ 0 ] [ 'name' ] = selectedVersionInfo . package ;
166
- $scope . packages [ 0 ] . version = selectedVersionInfo . version . id ;
178
+ $scope . packages [ 0 ] . version = selectedVersionInfo . version ;
167
179
if ( angular . equals ( $scope . updateComponents . no , true ) ) {
168
180
if ( $scope . totalForGrid > 0 ) {
169
181
$scope . packages . splice ( 1 , $scope . totalForGrid ) ;
0 commit comments