You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ak...@apache.org on 2014/03/05 14:31:22 UTC
git commit: AMBARI-4951. Mirroring: ability to add Target Clusters
from Create Dataset popup. (akovalenko)
Repository: ambari
Updated Branches:
refs/heads/trunk 1dddef3bc -> bcc8aad56
AMBARI-4951. Mirroring: ability to add Target Clusters from Create Dataset popup. (akovalenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/bcc8aad5
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/bcc8aad5
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/bcc8aad5
Branch: refs/heads/trunk
Commit: bcc8aad56c775929398fe5ede0a5bd410163666e
Parents: 1dddef3
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Wed Mar 5 15:29:36 2014 +0200
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Wed Mar 5 15:29:36 2014 +0200
----------------------------------------------------------------------
.../main/mirroring/edit_dataset_controller.js | 18 ++++++++-------
.../templates/main/mirroring/edit_dataset.hbs | 10 +++++---
.../views/main/mirroring/edit_dataset_view.js | 24 +++++++++++++++++---
3 files changed, 38 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/bcc8aad5/ambari-web/app/controllers/main/mirroring/edit_dataset_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/mirroring/edit_dataset_controller.js b/ambari-web/app/controllers/main/mirroring/edit_dataset_controller.js
index 532323d..01d1942 100644
--- a/ambari-web/app/controllers/main/mirroring/edit_dataset_controller.js
+++ b/ambari-web/app/controllers/main/mirroring/edit_dataset_controller.js
@@ -47,7 +47,8 @@ App.MainMirroringEditDataSetController = Ember.Controller.extend({
targetDir: '',
startDate: '',
endDate: '',
- frequency: ''
+ frequency: '',
+ targetClusterName: ''
}),
errors: Ember.Object.create({
@@ -56,7 +57,8 @@ App.MainMirroringEditDataSetController = Ember.Controller.extend({
isTargetDirError: false,
isStartDateError: false,
isEndDateError: false,
- isFrequencyError: false
+ isFrequencyError: false,
+ isTargetClusterNameError: false
}),
clearStep: function () {
@@ -97,20 +99,20 @@ App.MainMirroringEditDataSetController = Ember.Controller.extend({
secondary: Em.I18n.t('common.cancel'),
showCloseButton: false,
saveDisabled: function () {
- return !self.get('saveDisabled');
+ return self.get('saveDisabled');
}.property('App.router.' + self.get('name') + '.saveDisabled'),
enablePrimary: function () {
- return this.get('saveDisabled');
+ return !this.get('saveDisabled');
}.property('saveDisabled'),
onPrimary: function () {
- if (!this.get('saveDisabled')) {
+ if (this.get('saveDisabled')) {
return false;
}
// Apply form validation for first click
if (!this.get('primaryWasClicked')) {
this.toggleProperty('primaryWasClicked');
self.applyValidation();
- if (!this.get('saveDisabled')) {
+ if (this.get('saveDisabled')) {
return false;
}
}
@@ -274,6 +276,6 @@ App.MainMirroringEditDataSetController = Ember.Controller.extend({
saveDisabled: function () {
var errors = this.get('errors');
- return errors.get('isNameError') || errors.get('isSourceDirError') || errors.get('isTargetDirError') || errors.get('isStartDateError') || errors.get('isEndDateError') || errors.get('isFrequencyError');
- }.property('errors.isNameError', 'errors.isSourceDirError', 'errors.isTargetDirError', 'errors.isStartDateError', 'errors.isEndDateError', 'errors.isFrequencyError')
+ return errors.get('isNameError') || errors.get('isSourceDirError') || errors.get('isTargetDirError') || errors.get('isStartDateError') || errors.get('isEndDateError') || errors.get('isFrequencyError') || errors.get('isTargetClusterNameError');
+ }.property('errors.isNameError', 'errors.isSourceDirError', 'errors.isTargetDirError', 'errors.isStartDateError', 'errors.isEndDateError', 'errors.isFrequencyError', 'errors.isTargetClusterNameError')
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/bcc8aad5/ambari-web/app/templates/main/mirroring/edit_dataset.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/mirroring/edit_dataset.hbs b/ambari-web/app/templates/main/mirroring/edit_dataset.hbs
index c984fc7..4e37467 100644
--- a/ambari-web/app/templates/main/mirroring/edit_dataset.hbs
+++ b/ambari-web/app/templates/main/mirroring/edit_dataset.hbs
@@ -69,13 +69,17 @@
<tr>
<td class="spacer" colspan="3"></td>
</tr>
- <tr {{bindAttr class="errors.isTargetClusterError:error"}}>
+ <tr {{bindAttr class="errors.isTargetClusterNameError:error"}}>
<td colspan="1">
{{t mirroring.dataset.targetCluster}}
</td>
<td colspan="2" style="text-align: left">
- {{view view.targetClusterSelect selectionBinding="formFields.datasetTargetClusterName"}}
- <span class="help-inline">{{errorMessages.targetCluster}}</span>
+ {{#if view.hasTargetClusters}}
+ {{view view.targetClusterSelect selectionBinding="formFields.datasetTargetClusterName"}}
+ {{else}}
+ <button class="btn" {{action manageClusters target="view"}}>{{t mirroring.dataset.addTargetCluster}}</button>
+ {{/if}}
+ <span class="help-inline">{{errorMessages.targetClusterName}}</span>
</td>
</tr>
<tr>
http://git-wip-us.apache.org/repos/asf/ambari/blob/bcc8aad5/ambari-web/app/views/main/mirroring/edit_dataset_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/mirroring/edit_dataset_view.js b/ambari-web/app/views/main/mirroring/edit_dataset_view.js
index fad84fd..c0c521d 100644
--- a/ambari-web/app/views/main/mirroring/edit_dataset_view.js
+++ b/ambari-web/app/views/main/mirroring/edit_dataset_view.js
@@ -25,25 +25,38 @@ App.MainMirroringEditDataSetView = Em.View.extend({
name: 'mainMirroringEditDataSetView',
templateName: require('templates/main/mirroring/edit_dataset'),
+ hasTargetClusters: false,
+
datasetTypeOptions: [Em.I18n.t('mirroring.dataset.type.HDFS'), Em.I18n.t('mirroring.dataset.type.Hive')],
+ targetClusters: App.TargetCluster.find(),
+
targetClusterSelect: Em.Select.extend({
classNames: ['target-cluster-select'],
content: function () {
if (!this.get('parentView.isLoaded')) return [];
- return App.TargetCluster.find().mapProperty('name').without(App.get('clusterName')).concat(Em.I18n.t('mirroring.dataset.addTargetCluster'));
- }.property('parentView.isLoaded'),
+ return this.get('parentView.targetClusters').mapProperty('name').without(App.get('clusterName')).concat(Em.I18n.t('mirroring.dataset.addTargetCluster'));
+ }.property('parentView.isLoaded', 'parentView.targetClusters.length'),
change: function () {
if (this.get('selection') === Em.I18n.t('mirroring.dataset.addTargetCluster')) {
this.set('selection', this.get('content')[0]);
- App.router.get('mainMirroringController').manageClusters();
+ this.get('parentView').manageClusters();
}
this.set('parentView.controller.formFields.datasetTargetClusterName', this.get('selection'))
}
}),
+ onTargetClustersChange: function () {
+ if (this.get('isLoaded') && this.get('targetClusters.length') > 1) {
+ this.set('hasTargetClusters', true);
+ } else {
+ this.set('hasTargetClusters', false);
+ this.set('controller.formFields.datasetTargetClusterName', null);
+ }
+ }.observes('isLoaded', 'targetClusters.length'),
+
repeatOptions: [Em.I18n.t('mirroring.dataset.repeat.minutes'), Em.I18n.t('mirroring.dataset.repeat.hours'), Em.I18n.t('mirroring.dataset.repeat.days'), Em.I18n.t('mirroring.dataset.repeat.months')],
middayPeriodOptions: [Em.I18n.t('mirroring.dataset.middayPeriod.am'), Em.I18n.t('mirroring.dataset.middayPeriod.pm')],
@@ -56,6 +69,10 @@ App.MainMirroringEditDataSetView = Em.View.extend({
return App.router.get('mainMirroringController.isLoaded');
}.property('App.router.mainMirroringController.isLoaded'),
+ manageClusters: function () {
+ App.router.get('mainMirroringController').manageClusters();
+ },
+
fillForm: function () {
var isEdit = this.get('controller.isEdit');
var selectedDataset = App.router.get('mainMirroringController.selectedDataset');
@@ -92,6 +109,7 @@ App.MainMirroringEditDataSetView = Em.View.extend({
format: 'mm/dd/yyyy'
});
this.fillForm();
+ this.onTargetClustersChange();
},
willDestroyElement: function () {