Sort entity names on Schema page
@@ -21,22 +21,23 @@ under the License.
*/
var QDR = (function (QDR) {
- QDR.module.controller("QDR.SchemaController", ['$scope', '$location', 'QDRService', function($scope, $location, QDRService) {
+ QDR.module.controller("QDR.SchemaController", ['$scope', '$location', '$timeout', 'QDRService', function($scope, $location, $timeout, QDRService) {
if (!QDRService.connected) {
QDRService.redirectWhenConnected("schema")
return;
}
+ var onDisconnect = function () {
+ $timeout( function () {QDRService.redirectWhenConnected("schema")})
+ }
// we are currently connected. setup a handler to get notified if we are ever disconnected
- QDRService.addDisconnectAction( function () {
- QDRService.redirectWhenConnected("schema")
- $scope.$apply();
- })
+ QDRService.addDisconnectAction( onDisconnect )
var keys2kids = function (tree, obj) {
-
if (obj === Object(obj)) {
tree.children = []
- for (var key in obj) {
+ var keys = Object.keys(obj).sort()
+ for (var i=0; i<keys.length; ++i) {
+ var key = keys[i];
var kid = {title: key}
if (obj[key] === Object(obj[key])) {
kid.isFolder = true
@@ -70,6 +71,9 @@ var QDR = (function (QDR) {
children: tree
})
+ $scope.$on("$destroy", function(event) {
+ QDRService.delDisconnectAction( onDisconnect )
+ });
}]);
