You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2014/01/10 19:09:34 UTC
git commit: AMBARI-4262. Mirroring: after refreshing popup "Create
New Dataset", no target clusters are shown in dropdown (alexantonenko)
Updated Branches:
refs/heads/trunk 727f082ac -> 5550a6452
AMBARI-4262. Mirroring: after refreshing popup "Create New Dataset", no target clusters are shown in dropdown (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5550a645
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5550a645
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5550a645
Branch: refs/heads/trunk
Commit: 5550a6452e091289c9a7eeb99ff733d0183ccf9e
Parents: 727f082
Author: Alex Antonenko <hi...@gmail.com>
Authored: Fri Jan 10 20:07:03 2014 +0200
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Fri Jan 10 20:07:03 2014 +0200
----------------------------------------------------------------------
.../main/mirroring/dataset_controller.js | 16 ++++
ambari-web/app/routes/main.js | 77 ++++++++++----------
2 files changed, 56 insertions(+), 37 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/5550a645/ambari-web/app/controllers/main/mirroring/dataset_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/mirroring/dataset_controller.js b/ambari-web/app/controllers/main/mirroring/dataset_controller.js
index 445c329..2bf22de 100644
--- a/ambari-web/app/controllers/main/mirroring/dataset_controller.js
+++ b/ambari-web/app/controllers/main/mirroring/dataset_controller.js
@@ -112,6 +112,22 @@ App.MainMirroringDataSetController = Ember.Controller.extend({
}
),
+ dataLoading: function () {
+ var dfd = $.Deferred();
+ this.connectOutlet('loading');
+ if (App.router.get('clusterController.isLoaded')) {
+ dfd.resolve();
+ } else {
+ var interval = setInterval(function () {
+ if (App.router.get('clusterController.isLoaded')) {
+ dfd.resolve();
+ clearInterval(interval);
+ }
+ }, 50);
+ }
+ return dfd.promise();
+ },
+
isSubmitted: null,
validate: function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/5550a645/ambari-web/app/routes/main.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js
index 85674dc..8062583 100644
--- a/ambari-web/app/routes/main.js
+++ b/ambari-web/app/routes/main.js
@@ -145,48 +145,51 @@ module.exports = Em.Route.extend({
controller.createNewDataSet();
},
enter: function (router) {
+ var self = this;
var controller = router.get('mainMirroringDataSetController');
- // if we are coming from closing AddCluster popup
- if (controller.isReturning) {
- controller.isReturning = false;
- return;
- }
+ controller.dataLoading().done(function () {
+ // if we are coming from closing AddCluster popup
+ if (controller.isReturning) {
+ controller.isReturning = false;
+ return;
+ }
- controller.set('isPopupForEdit', false);
- this.setupController(controller);
+ controller.set('isPopupForEdit', false);
+ self.setupController(controller);
- var self = this;
- controller.set('isSubmitted', false);
- App.ModalPopup.show({
- classNames: ['sixty-percent-width-modal', 'hideCloseLink'],
- header: Em.I18n.t('mirroring.dataset.newDataset'),
- primary: Em.I18n.t('mirroring.dataset.save'),
- secondary: Em.I18n.t('common.cancel'),
- onPrimary: function () {
- controller.set('isSubmitted', true);
- var isValid = controller.validate();
- if (!isValid) {
- return;
- }
- newDataSet = controller.getNewDataSet();
- var schedule = newDataSet.get('schedule');
- var targetCluster = newDataSet.get('targetCluster');
- var scheduleRecord = App.Dataset.Schedule.createRecord(schedule);
- var dataSetRecord = App.Dataset.createRecord(newDataSet);
- scheduleRecord.set('dataset', dataSetRecord);
- dataSetRecord.set('schedule', scheduleRecord);
+ controller.set('isSubmitted', false);
+ App.ModalPopup.show({
+ classNames: ['sixty-percent-width-modal', 'hideCloseLink'],
+ header: Em.I18n.t('mirroring.dataset.newDataset'),
+ primary: Em.I18n.t('mirroring.dataset.save'),
+ secondary: Em.I18n.t('common.cancel'),
+ onPrimary: function () {
+ controller.set('isSubmitted', true);
+ var isValid = controller.validate();
- this.hide();
- router.transitionTo('main.mirroring.index');
- },
- onSecondary: function () {
- this.hide();
- router.transitionTo('main.mirroring.index');
- },
- bodyClass: App.MainMirroringDataSetView.extend({
- controller: router.get('mainMirroringDataSetController')
- })
+ if (!isValid) {
+ return;
+ }
+ newDataSet = controller.getNewDataSet();
+ var schedule = newDataSet.get('schedule');
+ var targetCluster = newDataSet.get('targetCluster');
+ var scheduleRecord = App.Dataset.Schedule.createRecord(schedule);
+ var dataSetRecord = App.Dataset.createRecord(newDataSet);
+ scheduleRecord.set('dataset', dataSetRecord);
+ dataSetRecord.set('schedule', scheduleRecord);
+
+ this.hide();
+ router.transitionTo('main.mirroring.index');
+ },
+ onSecondary: function () {
+ this.hide();
+ router.transitionTo('main.mirroring.index');
+ },
+ bodyClass: App.MainMirroringDataSetView.extend({
+ controller: router.get('mainMirroringDataSetController')
+ })
+ });
});
}
}),