ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject ignite git commit: IGNITE-843 Reworked page load: load data first, and load page descriptor after data loaded.
Date Wed, 16 Sep 2015 10:43:48 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-843 e656a737f -> 55fd3f37b


IGNITE-843 Reworked page load: load data first, and load page descriptor after data loaded.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/55fd3f37
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/55fd3f37
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/55fd3f37

Branch: refs/heads/ignite-843
Commit: 55fd3f37b9bec7502e2063dc28034aa1aa246553
Parents: e656a73
Author: Alexey Kuznetsov <akuznetsov@apache.org>
Authored: Wed Sep 16 17:43:41 2015 +0700
Committer: Alexey Kuznetsov <akuznetsov@apache.org>
Committed: Wed Sep 16 17:43:41 2015 +0700

----------------------------------------------------------------------
 .../main/js/controllers/caches-controller.js    | 155 +++++++++----------
 .../main/js/controllers/clusters-controller.js  | 148 +++++++++---------
 .../main/js/controllers/metadata-controller.js  |  88 +++++------
 3 files changed, 196 insertions(+), 195 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/55fd3f37/modules/control-center-web/src/main/js/controllers/caches-controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/caches-controller.js b/modules/control-center-web/src/main/js/controllers/caches-controller.js
index 325bc1f..35adc23 100644
--- a/modules/control-center-web/src/main/js/controllers/caches-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/caches-controller.js
@@ -108,17 +108,6 @@ controlCenterModule.controller('cachesController', [
 
             $scope.general = [];
             $scope.advanced = [];
-
-            $http.get('/models/caches.json')
-                .success(function (data) {
-                    $scope.screenTip = data.screenTip;
-                    $scope.general = data.general;
-                    $scope.advanced = data.advanced;
-                })
-                .error(function (errMsg) {
-                    $common.showError(errMsg);
-                });
-
             $scope.caches = [];
             $scope.metadatas = [];
 
@@ -243,97 +232,107 @@ controlCenterModule.controller('cachesController', [
                     $scope.spaces = data.spaces;
                     $scope.caches = data.caches;
                     $scope.clusters = data.clusters;
-
                     $scope.metadatas = _.map(data.metadatas, function (meta) {
                         return {value: meta._id, label: meta.valueType, kind: meta.kind,
meta: meta}
                     });
 
-                    var lastSelectedCache = angular.fromJson(sessionStorage.lastSelectedCache);
+                    // Load page descriptor.
+                    $http.get('/models/caches.json')
+                        .success(function (data) {
+                            $scope.screenTip = data.screenTip;
+                            $scope.general = data.general;
+                            $scope.advanced = data.advanced;
 
-                    if (lastSelectedCache) {
-                        var idx = _.findIndex($scope.caches, function (cache) {
-                            return cache._id == lastSelectedCache;
-                        });
+                            var lastSelectedCache = angular.fromJson(sessionStorage.lastSelectedCache);
 
-                        if (idx >= 0)
-                            $scope.selectItem($scope.caches[idx]);
-                        else {
-                            sessionStorage.removeItem('lastSelectedCache');
+                            if (lastSelectedCache) {
+                                var idx = _.findIndex($scope.caches, function (cache) {
+                                    return cache._id == lastSelectedCache;
+                                });
 
-                            selectFirstItem();
-                        }
+                                if (idx >= 0)
+                                    $scope.selectItem($scope.caches[idx]);
+                                else {
+                                    sessionStorage.removeItem('lastSelectedCache');
 
-                    }
-                    else
-                        selectFirstItem();
+                                    selectFirstItem();
+                                }
 
-                    $timeout(function() {
-                        $scope.ui.markPristineHard();
-                    });
+                            }
+                            else
+                                selectFirstItem();
 
-                    $scope.$watch('backupItem', function (val) {
-                        if (val) {
-                            var metas = cacheMetadatas(val);
-                            var varName = $commonUtils.toJavaName('cache', val.name);
+                            $timeout(function() {
+                                $scope.ui.markPristineHard();
+                            });
 
-                            $scope.preview.general.xml = $generatorXml.cacheMetadatas(metas,
$generatorXml.cacheGeneral(val)).asString();
-                            $scope.preview.general.java = $generatorJava.cacheMetadatas(metas,
varName, $generatorJava.cacheGeneral(val, varName)).asString();
-                            $scope.preview.general.allDefaults = $common.isEmptyString($scope.preview.general.xml);
+                            $scope.$watch('backupItem', function (val) {
+                                if (val) {
+                                    var metas = cacheMetadatas(val);
+                                    var varName = $commonUtils.toJavaName('cache', val.name);
 
-                            $scope.preview.memory.xml = $generatorXml.cacheMemory(val).asString();
-                            $scope.preview.memory.java = $generatorJava.cacheMemory(val,
varName).asString();
-                            $scope.preview.memory.allDefaults = $common.isEmptyString($scope.preview.memory.xml);
+                                    $scope.preview.general.xml = $generatorXml.cacheMetadatas(metas,
$generatorXml.cacheGeneral(val)).asString();
+                                    $scope.preview.general.java = $generatorJava.cacheMetadatas(metas,
varName, $generatorJava.cacheGeneral(val, varName)).asString();
+                                    $scope.preview.general.allDefaults = $common.isEmptyString($scope.preview.general.xml);
 
-                            $scope.preview.query.xml = $generatorXml.cacheQuery(val).asString();
-                            $scope.preview.query.java = $generatorJava.cacheQuery(val, varName).asString();
-                            $scope.preview.query.allDefaults = $common.isEmptyString($scope.preview.query.xml);
+                                    $scope.preview.memory.xml = $generatorXml.cacheMemory(val).asString();
+                                    $scope.preview.memory.java = $generatorJava.cacheMemory(val,
varName).asString();
+                                    $scope.preview.memory.allDefaults = $common.isEmptyString($scope.preview.memory.xml);
 
-                            $scope.preview.store.xml = $generatorXml.cacheStore(val).asString();
-                            $scope.preview.store.java = $generatorJava.cacheStore(val, varName).asString();
-                            $scope.preview.store.allDefaults = $common.isEmptyString($scope.preview.store.xml);
+                                    $scope.preview.query.xml = $generatorXml.cacheQuery(val).asString();
+                                    $scope.preview.query.java = $generatorJava.cacheQuery(val,
varName).asString();
+                                    $scope.preview.query.allDefaults = $common.isEmptyString($scope.preview.query.xml);
 
-                            $scope.preview.concurrency.xml = $generatorXml.cacheConcurrency(val).asString();
-                            $scope.preview.concurrency.java = $generatorJava.cacheConcurrency(val,
varName).asString();
-                            $scope.preview.concurrency.allDefaults = $common.isEmptyString($scope.preview.concurrency.xml);
+                                    $scope.preview.store.xml = $generatorXml.cacheStore(val).asString();
+                                    $scope.preview.store.java = $generatorJava.cacheStore(val,
varName).asString();
+                                    $scope.preview.store.allDefaults = $common.isEmptyString($scope.preview.store.xml);
 
-                            $scope.preview.rebalance.xml = $generatorXml.cacheRebalance(val).asString();
-                            $scope.preview.rebalance.java = $generatorJava.cacheRebalance(val,
varName).asString();
-                            $scope.preview.rebalance.allDefaults = $common.isEmptyString($scope.preview.rebalance.xml);
+                                    $scope.preview.concurrency.xml = $generatorXml.cacheConcurrency(val).asString();
+                                    $scope.preview.concurrency.java = $generatorJava.cacheConcurrency(val,
varName).asString();
+                                    $scope.preview.concurrency.allDefaults = $common.isEmptyString($scope.preview.concurrency.xml);
 
-                            $scope.preview.serverNearCache.xml = $generatorXml.cacheServerNearCache(val).asString();
-                            $scope.preview.serverNearCache.java = $generatorJava.cacheServerNearCache(val,
varName).asString();
-                            $scope.preview.serverNearCache.allDefaults = $common.isEmptyString($scope.preview.serverNearCache.xml);
+                                    $scope.preview.rebalance.xml = $generatorXml.cacheRebalance(val).asString();
+                                    $scope.preview.rebalance.java = $generatorJava.cacheRebalance(val,
varName).asString();
+                                    $scope.preview.rebalance.allDefaults = $common.isEmptyString($scope.preview.rebalance.xml);
 
-                            $scope.preview.statistics.xml = $generatorXml.cacheStatistics(val).asString();
-                            $scope.preview.statistics.java = $generatorJava.cacheStatistics(val,
varName).asString();
-                            $scope.preview.statistics.allDefaults = $common.isEmptyString($scope.preview.statistics.xml);
+                                    $scope.preview.serverNearCache.xml = $generatorXml.cacheServerNearCache(val).asString();
+                                    $scope.preview.serverNearCache.java = $generatorJava.cacheServerNearCache(val,
varName).asString();
+                                    $scope.preview.serverNearCache.allDefaults = $common.isEmptyString($scope.preview.serverNearCache.xml);
 
-                            $scope.ui.markDirty();
-                        }
-                    }, true);
+                                    $scope.preview.statistics.xml = $generatorXml.cacheStatistics(val).asString();
+                                    $scope.preview.statistics.java = $generatorJava.cacheStatistics(val,
varName).asString();
+                                    $scope.preview.statistics.allDefaults = $common.isEmptyString($scope.preview.statistics.xml);
+
+                                    $scope.ui.markDirty();
+                                }
+                            }, true);
 
-                    $scope.$watch('backupItem.metadatas', function (val) {
-                        var item = $scope.backupItem;
+                            $scope.$watch('backupItem.metadatas', function (val) {
+                                var item = $scope.backupItem;
 
-                        var cacheStoreFactory = $common.isDefined(item) &&
-                            $common.isDefined(item.cacheStoreFactory) &&
-                            $common.isDefined(item.cacheStoreFactory.kind);
+                                var cacheStoreFactory = $common.isDefined(item) &&
+                                    $common.isDefined(item.cacheStoreFactory) &&
+                                    $common.isDefined(item.cacheStoreFactory.kind);
 
-                        if (val && !cacheStoreFactory) {
-                            if (_.findIndex(cacheMetadatas(item), $common.metadataForStoreConfigured)
>= 0) {
-                                item.cacheStoreFactory.kind = 'CacheJdbcPojoStoreFactory';
+                                if (val && !cacheStoreFactory) {
+                                    if (_.findIndex(cacheMetadatas(item), $common.metadataForStoreConfigured)
>= 0) {
+                                        item.cacheStoreFactory.kind = 'CacheJdbcPojoStoreFactory';
 
-                                if (!item.readThrough && !item.writeThrough) {
-                                    item.readThrough = true;
-                                    item.writeThrough = true;
-                                }
+                                        if (!item.readThrough && !item.writeThrough)
{
+                                            item.readThrough = true;
+                                            item.writeThrough = true;
+                                        }
 
-                                $timeout(function () {
-                                    $common.ensureActivePanel($scope.panels, 'store');
-                                });
-                            }
-                        }
-                    }, true);
+                                        $timeout(function () {
+                                            $common.ensureActivePanel($scope.panels, 'store');
+                                        });
+                                    }
+                                }
+                            }, true);
+                        })
+                        .error(function (errMsg) {
+                            $common.showError(errMsg);
+                        });
                })
                 .error(function (errMsg) {
                     $common.showError(errMsg);

http://git-wip-us.apache.org/repos/asf/ignite/blob/55fd3f37/modules/control-center-web/src/main/js/controllers/clusters-controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/clusters-controller.js b/modules/control-center-web/src/main/js/controllers/clusters-controller.js
index 4f5a46d..f051210 100644
--- a/modules/control-center-web/src/main/js/controllers/clusters-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/clusters-controller.js
@@ -147,16 +147,6 @@ controlCenterModule.controller('clustersController', ['$scope', '$controller',
'
 
         $scope.clusters = [];
 
-        $http.get('/models/clusters.json')
-            .success(function (data) {
-                $scope.screenTip = data.screenTip;
-                $scope.general = data.general;
-                $scope.advanced = data.advanced;
-            })
-            .error(function (errMsg) {
-                $common.showError(errMsg);
-            });
-
         function selectFirstItem() {
             if ($scope.clusters.length > 0)
                 $scope.selectItem($scope.clusters[0]);
@@ -171,89 +161,101 @@ controlCenterModule.controller('clustersController', ['$scope', '$controller',
'
                     return {value: cache._id, label: cache.name, cache: cache};
                 });
 
-                var lastSelectedCluster = angular.fromJson(sessionStorage.lastSelectedCluster);
+                // Load page descriptor.
+                $http.get('/models/clusters.json')
+                    .success(function (data) {
+                        $scope.screenTip = data.screenTip;
+                        $scope.general = data.general;
+                        $scope.advanced = data.advanced;
 
-                if (lastSelectedCluster) {
-                    var idx = _.findIndex($scope.clusters, function (cluster) {
-                        return cluster._id == lastSelectedCluster;
-                    });
 
-                    if (idx >= 0)
-                        $scope.selectItem($scope.clusters[idx]);
-                    else {
-                        sessionStorage.removeItem('lastSelectedCluster');
+                        var lastSelectedCluster = angular.fromJson(sessionStorage.lastSelectedCluster);
 
-                        selectFirstItem();
-                    }
-                }
-                else
-                    selectFirstItem();
+                        if (lastSelectedCluster) {
+                            var idx = _.findIndex($scope.clusters, function (cluster) {
+                                return cluster._id == lastSelectedCluster;
+                            });
 
-                $timeout(function() {
-                    $scope.ui.markPristineHard();
-                });
+                            if (idx >= 0)
+                                $scope.selectItem($scope.clusters[idx]);
+                            else {
+                                sessionStorage.removeItem('lastSelectedCluster');
 
-                $scope.$watch('backupItem', function (val) {
-                    if (val) {
-                        var clusterCaches = _.reduce($scope.caches, function(caches, cache){
-                            if (_.contains(val.caches, cache.value)) {
-                                caches.push(cache.cache);
+                                selectFirstItem();
                             }
+                        }
+                        else
+                            selectFirstItem();
 
-                            return caches;
-                        }, []);
+                        $timeout(function() {
+                            $scope.ui.markPristineHard();
+                        });
 
-                        $scope.preview.general.xml = $generatorXml.clusterCaches(clusterCaches,
$generatorXml.clusterGeneral(val)).asString();
-                        $scope.preview.general.java = $generatorJava.clusterCaches(clusterCaches,
$generatorJava.clusterGeneral(val)).asString();
-                        $scope.preview.general.allDefaults = $common.isEmptyString($scope.preview.general.xml);
+                        $scope.$watch('backupItem', function (val) {
+                            if (val) {
+                                var clusterCaches = _.reduce($scope.caches, function(caches,
cache){
+                                    if (_.contains(val.caches, cache.value)) {
+                                        caches.push(cache.cache);
+                                    }
 
-                        $scope.preview.atomics.xml = $generatorXml.clusterAtomics(val).asString();
-                        $scope.preview.atomics.java = $generatorJava.clusterAtomics(val).asString();
-                        $scope.preview.atomics.allDefaults = $common.isEmptyString($scope.preview.atomics.xml);
+                                    return caches;
+                                }, []);
 
-                        $scope.preview.communication.xml = $generatorXml.clusterCommunication(val).asString();
-                        $scope.preview.communication.java = $generatorJava.clusterCommunication(val).asString();
-                        $scope.preview.communication.allDefaults = $common.isEmptyString($scope.preview.communication.xml);
+                                $scope.preview.general.xml = $generatorXml.clusterCaches(clusterCaches,
$generatorXml.clusterGeneral(val)).asString();
+                                $scope.preview.general.java = $generatorJava.clusterCaches(clusterCaches,
$generatorJava.clusterGeneral(val)).asString();
+                                $scope.preview.general.allDefaults = $common.isEmptyString($scope.preview.general.xml);
 
-                        $scope.preview.deployment.xml = $generatorXml.clusterDeployment(val).asString();
-                        $scope.preview.deployment.java = $generatorJava.clusterDeployment(val).asString();
-                        $scope.preview.deployment.allDefaults = $common.isEmptyString($scope.preview.deployment.xml);
+                                $scope.preview.atomics.xml = $generatorXml.clusterAtomics(val).asString();
+                                $scope.preview.atomics.java = $generatorJava.clusterAtomics(val).asString();
+                                $scope.preview.atomics.allDefaults = $common.isEmptyString($scope.preview.atomics.xml);
 
-                        $scope.preview.events.xml = $generatorXml.clusterEvents(val).asString();
-                        $scope.preview.events.java = $generatorJava.clusterEvents(val).asString();
-                        $scope.preview.events.allDefaults = $common.isEmptyString($scope.preview.events.xml);
+                                $scope.preview.communication.xml = $generatorXml.clusterCommunication(val).asString();
+                                $scope.preview.communication.java = $generatorJava.clusterCommunication(val).asString();
+                                $scope.preview.communication.allDefaults = $common.isEmptyString($scope.preview.communication.xml);
 
-                        $scope.preview.marshaller.xml = $generatorXml.clusterMarshaller(val).asString();
-                        $scope.preview.marshaller.java = $generatorJava.clusterMarshaller(val).asString();
-                        $scope.preview.marshaller.allDefaults = $common.isEmptyString($scope.preview.marshaller.xml);
+                                $scope.preview.deployment.xml = $generatorXml.clusterDeployment(val).asString();
+                                $scope.preview.deployment.java = $generatorJava.clusterDeployment(val).asString();
+                                $scope.preview.deployment.allDefaults = $common.isEmptyString($scope.preview.deployment.xml);
 
-                        $scope.preview.metrics.xml = $generatorXml.clusterMetrics(val).asString();
-                        $scope.preview.metrics.java = $generatorJava.clusterMetrics(val).asString();
-                        $scope.preview.metrics.allDefaults = $common.isEmptyString($scope.preview.metrics.xml);
+                                $scope.preview.events.xml = $generatorXml.clusterEvents(val).asString();
+                                $scope.preview.events.java = $generatorJava.clusterEvents(val).asString();
+                                $scope.preview.events.allDefaults = $common.isEmptyString($scope.preview.events.xml);
 
-                        $scope.preview.p2p.xml = $generatorXml.clusterP2p(val).asString();
-                        $scope.preview.p2p.java = $generatorJava.clusterP2p(val).asString();
-                        $scope.preview.p2p.allDefaults = $common.isEmptyString($scope.preview.p2p.xml);
+                                $scope.preview.marshaller.xml = $generatorXml.clusterMarshaller(val).asString();
+                                $scope.preview.marshaller.java = $generatorJava.clusterMarshaller(val).asString();
+                                $scope.preview.marshaller.allDefaults = $common.isEmptyString($scope.preview.marshaller.xml);
 
-                        $scope.preview.swap.xml = $generatorXml.clusterSwap(val).asString();
-                        $scope.preview.swap.java = $generatorJava.clusterSwap(val).asString();
-                        $scope.preview.swap.allDefaults = $common.isEmptyString($scope.preview.swap.xml);
+                                $scope.preview.metrics.xml = $generatorXml.clusterMetrics(val).asString();
+                                $scope.preview.metrics.java = $generatorJava.clusterMetrics(val).asString();
+                                $scope.preview.metrics.allDefaults = $common.isEmptyString($scope.preview.metrics.xml);
 
-                        $scope.preview.time.xml = $generatorXml.clusterTime(val).asString();
-                        $scope.preview.time.java = $generatorJava.clusterTime(val).asString();
-                        $scope.preview.time.allDefaults = $common.isEmptyString($scope.preview.time.xml);
+                                $scope.preview.p2p.xml = $generatorXml.clusterP2p(val).asString();
+                                $scope.preview.p2p.java = $generatorJava.clusterP2p(val).asString();
+                                $scope.preview.p2p.allDefaults = $common.isEmptyString($scope.preview.p2p.xml);
 
-                        $scope.preview.pools.xml = $generatorXml.clusterPools(val).asString();
-                        $scope.preview.pools.java = $generatorJava.clusterPools(val).asString();
-                        $scope.preview.pools.allDefaults = $common.isEmptyString($scope.preview.pools.xml);
+                                $scope.preview.swap.xml = $generatorXml.clusterSwap(val).asString();
+                                $scope.preview.swap.java = $generatorJava.clusterSwap(val).asString();
+                                $scope.preview.swap.allDefaults = $common.isEmptyString($scope.preview.swap.xml);
 
-                        $scope.preview.transactions.xml = $generatorXml.clusterTransactions(val).asString();
-                        $scope.preview.transactions.java = $generatorJava.clusterTransactions(val).asString();
-                        $scope.preview.transactions.allDefaults = $common.isEmptyString($scope.preview.transactions.xml);
+                                $scope.preview.time.xml = $generatorXml.clusterTime(val).asString();
+                                $scope.preview.time.java = $generatorJava.clusterTime(val).asString();
+                                $scope.preview.time.allDefaults = $common.isEmptyString($scope.preview.time.xml);
 
-                        $scope.ui.markDirty();
-                    }
-                }, true);
+                                $scope.preview.pools.xml = $generatorXml.clusterPools(val).asString();
+                                $scope.preview.pools.java = $generatorJava.clusterPools(val).asString();
+                                $scope.preview.pools.allDefaults = $common.isEmptyString($scope.preview.pools.xml);
+
+                                $scope.preview.transactions.xml = $generatorXml.clusterTransactions(val).asString();
+                                $scope.preview.transactions.java = $generatorJava.clusterTransactions(val).asString();
+                                $scope.preview.transactions.allDefaults = $common.isEmptyString($scope.preview.transactions.xml);
+
+                                $scope.ui.markDirty();
+                            }
+                        }, true);
+                    })
+                    .error(function (errMsg) {
+                        $common.showError(errMsg);
+                    });
             })
             .error(function (errMsg) {
                 $common.showError(errMsg);

http://git-wip-us.apache.org/repos/asf/ignite/blob/55fd3f37/modules/control-center-web/src/main/js/controllers/metadata-controller.js
----------------------------------------------------------------------
diff --git a/modules/control-center-web/src/main/js/controllers/metadata-controller.js b/modules/control-center-web/src/main/js/controllers/metadata-controller.js
index 6bd5197..3bd4037 100644
--- a/modules/control-center-web/src/main/js/controllers/metadata-controller.js
+++ b/modules/control-center-web/src/main/js/controllers/metadata-controller.js
@@ -189,17 +189,6 @@ controlCenterModule.controller('metadataController', [
                 return false;
             };
 
-            // Load page descriptor.
-            $http.get('/models/metadata.json')
-                .success(function (data) {
-                    $scope.screenTip = data.screenTip;
-                    $scope.metadata = data.metadata;
-                    $scope.metadataDb = data.metadataDb;
-                })
-                .error(function (errMsg) {
-                    $common.showError(errMsg);
-                });
-
             $scope.selectAllSchemas = function () {
                 var allSelected = $scope.loadMeta.allSchemasSelected;
 
@@ -592,47 +581,58 @@ controlCenterModule.controller('metadataController', [
                     $scope.caches = data.caches;
                     $scope.metadatas = data.metadatas;
 
-                    var lastSelectedMetadata = angular.fromJson(sessionStorage.lastSelectedMetadata);
+                    // Load page descriptor.
+                    $http.get('/models/metadata.json')
+                        .success(function (data) {
+                            $scope.screenTip = data.screenTip;
+                            $scope.metadata = data.metadata;
+                            $scope.metadataDb = data.metadataDb;
 
-                    if (lastSelectedMetadata) {
-                        var idx = _.findIndex($scope.metadatas, function (metadata) {
-                            return metadata._id == lastSelectedMetadata;
-                        });
+                            var lastSelectedMetadata = angular.fromJson(sessionStorage.lastSelectedMetadata);
 
-                        if (idx >= 0)
-                            $scope.selectItem($scope.metadatas[idx]);
-                        else {
-                            sessionStorage.removeItem('lastSelectedMetadata');
+                            if (lastSelectedMetadata) {
+                                var idx = _.findIndex($scope.metadatas, function (metadata)
{
+                                    return metadata._id == lastSelectedMetadata;
+                                });
 
-                            selectFirstItem();
-                        }
-                    }
-                    else
-                        selectFirstItem();
+                                if (idx >= 0)
+                                    $scope.selectItem($scope.metadatas[idx]);
+                                else {
+                                    sessionStorage.removeItem('lastSelectedMetadata');
 
-                    $timeout(function () {
-                        $scope.$apply();
-                        
-                        $scope.ui.markPristineHard();
-                    });
+                                    selectFirstItem();
+                                }
+                            }
+                            else
+                                selectFirstItem();
+
+                            $timeout(function () {
+                                $scope.$apply();
 
-                    $scope.$watch('backupItem', function (val) {
-                        if (val) {
-                            $scope.preview.general.xml = $generatorXml.metadataGeneral(val).asString();
-                            $scope.preview.general.java = $generatorJava.metadataGeneral(val).asString();
-                            $scope.preview.general.allDefaults = $common.isEmptyString($scope.preview.general.xml);
+                                $scope.ui.markPristineHard();
+                            });
 
-                            $scope.preview.query.xml = $generatorXml.metadataQuery(val).asString();
-                            $scope.preview.query.java = $generatorJava.metadataQuery(val).asString();
-                            $scope.preview.query.allDefaults = $common.isEmptyString($scope.preview.query.xml);
+                            $scope.$watch('backupItem', function (val) {
+                                if (val) {
+                                    $scope.preview.general.xml = $generatorXml.metadataGeneral(val).asString();
+                                    $scope.preview.general.java = $generatorJava.metadataGeneral(val).asString();
+                                    $scope.preview.general.allDefaults = $common.isEmptyString($scope.preview.general.xml);
 
-                            $scope.preview.store.xml = $generatorXml.metadataStore(val).asString();
-                            $scope.preview.store.java = $generatorJava.metadataStore(val).asString();
-                            $scope.preview.store.allDefaults = $common.isEmptyString($scope.preview.store.xml);
+                                    $scope.preview.query.xml = $generatorXml.metadataQuery(val).asString();
+                                    $scope.preview.query.java = $generatorJava.metadataQuery(val).asString();
+                                    $scope.preview.query.allDefaults = $common.isEmptyString($scope.preview.query.xml);
 
-                            $scope.ui.markDirty();
-                        }
-                    }, true);
+                                    $scope.preview.store.xml = $generatorXml.metadataStore(val).asString();
+                                    $scope.preview.store.java = $generatorJava.metadataStore(val).asString();
+                                    $scope.preview.store.allDefaults = $common.isEmptyString($scope.preview.store.xml);
+
+                                    $scope.ui.markDirty();
+                                }
+                            }, true);
+                        })
+                        .error(function (errMsg) {
+                            $common.showError(errMsg);
+                        });
                 })
                 .error(function (errMsg) {
                     $common.showError(errMsg);


Mime
View raw message