|
@@ -53,7 +53,7 @@ App.ServiceConfigTextField = Ember.TextField.extend(App.ServiceConfigPopoverSupp
|
|
|
classNameBindings: 'textFieldClassName',
|
|
|
placeholderBinding: 'serviceConfig.defaultValue',
|
|
|
|
|
|
- keyPress: function(event) {
|
|
|
+ keyPress: function (event) {
|
|
|
if (event.keyCode == 13) {
|
|
|
return false;
|
|
|
}
|
|
@@ -115,7 +115,7 @@ App.ServiceConfigPasswordField = Ember.TextField.extend({
|
|
|
|
|
|
template: Ember.Handlebars.compile('{{view view.retypePasswordView}}'),
|
|
|
|
|
|
- keyPress: function(event) {
|
|
|
+ keyPress: function (event) {
|
|
|
if (event.keyCode == 13) {
|
|
|
return false;
|
|
|
}
|
|
@@ -125,7 +125,7 @@ App.ServiceConfigPasswordField = Ember.TextField.extend({
|
|
|
placeholder: Em.I18n.t('form.passwordRetype'),
|
|
|
type: 'password',
|
|
|
classNames: [ 'span3', 'retyped-password' ],
|
|
|
- keyPress: function(event) {
|
|
|
+ keyPress: function (event) {
|
|
|
if (event.keyCode == 13) {
|
|
|
return false;
|
|
|
}
|
|
@@ -193,9 +193,99 @@ App.ServiceConfigRadioButtons = Ember.View.extend({
|
|
|
'{{/unless}}',
|
|
|
'{{/each}}'
|
|
|
].join('\n')),
|
|
|
+
|
|
|
+ didInsertElement: function () {
|
|
|
+ // on page render, automatically populate JDBC URLs only for default database settings
|
|
|
+ // so as to not lose the user's customizations on these fields
|
|
|
+ if (App.clusterStatus.clusterState == 'CLUSTER_NOT_CREATED_1' && ['New MySQL Database', 'New Derby Database'].contains(this.get('serviceConfig.value'))) {
|
|
|
+ this.onOptionsChange();
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ configs: function () {
|
|
|
+ return this.get('categoryConfigsAll').filterProperty('isObserved', true);
|
|
|
+ }.property('categoryConfigsAll'),
|
|
|
+
|
|
|
serviceConfig: null,
|
|
|
categoryConfigsAll: null,
|
|
|
+
|
|
|
+ onOptionsChange: function () {
|
|
|
+ var connectionUrl = this.get('connectionUrl');
|
|
|
+ if (this.get('serviceConfig.serviceName') === 'HIVE') {
|
|
|
+ if (this.get('hostName') && this.get('databaseName') && connectionUrl) {
|
|
|
+ switch (this.get('serviceConfig.value')) {
|
|
|
+ case 'New MySQL Database':
|
|
|
+ case 'Existing MySQL Database':
|
|
|
+ connectionUrl.set('value', "jdbc:mysql://" + this.get('hostName') + "/" + this.get('databaseName') + "?createDatabaseIfNotExist=true");
|
|
|
+ break;
|
|
|
+ case 'Existing Oracle Database':
|
|
|
+ connectionUrl.set('value', "jdbc:oracle:thin:@//" + this.get('hostName') + ":1521/" + this.get('databaseName'));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (this.get('serviceConfig.serviceName') === 'OOZIE') {
|
|
|
+ if (this.get('hostName') && this.get('databaseName') && connectionUrl) {
|
|
|
+ switch (this.get('serviceConfig.value')) {
|
|
|
+ case 'New Derby Database':
|
|
|
+ connectionUrl.set('value', "jdbc:derby:${oozie.data.dir}/${oozie.db.schema.name}-db;create=true");
|
|
|
+ break;
|
|
|
+ case 'Existing MySQL Database':
|
|
|
+ connectionUrl.set('value', "jdbc:mysql://" + this.get('hostName') + "/" + this.get('databaseName'));
|
|
|
+ break;
|
|
|
+ case 'Existing Oracle Database':
|
|
|
+ connectionUrl.set('value', "jdbc:oracle:thin:@//" + this.get('hostName') + ":1521/" + this.get('databaseName'));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }.observes('databaseName', 'hostName', 'connectionUrl'),
|
|
|
+
|
|
|
nameBinding: 'serviceConfig.radioName',
|
|
|
+
|
|
|
+ databaseName: function () {
|
|
|
+ switch (this.get('serviceConfig.serviceName')) {
|
|
|
+ case 'HIVE':
|
|
|
+ return this.get('categoryConfigsAll').findProperty('name', 'hive_database_name').get('value');
|
|
|
+ case 'OOZIE':
|
|
|
+ return this.get('categoryConfigsAll').findProperty('name', 'oozie_database_name').get('value');
|
|
|
+ default:
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }.property('configs.@each.value', 'serviceConfig.serviceName'),
|
|
|
+
|
|
|
+
|
|
|
+ hostName: function () {
|
|
|
+ var value = this.get('serviceConfig.value');
|
|
|
+
|
|
|
+ if (this.get('serviceConfig.serviceName') === 'HIVE') {
|
|
|
+ switch (value) {
|
|
|
+ case 'New MySQL Database':
|
|
|
+ return this.get('categoryConfigsAll').findProperty('name', 'hive_ambari_host').get('value');
|
|
|
+ case 'Existing MySQL Database':
|
|
|
+ return this.get('categoryConfigsAll').findProperty('name', 'hive_existing_mysql_host').get('value');
|
|
|
+ case 'Existing Oracle Database':
|
|
|
+ return this.get('categoryConfigsAll').findProperty('name', 'hive_existing_oracle_host').get('value');
|
|
|
+ }
|
|
|
+ } else if (this.get('serviceConfig.serviceName') === 'OOZIE') {
|
|
|
+ switch (value) {
|
|
|
+ case 'New Derby Database':
|
|
|
+ return this.get('categoryConfigsAll').findProperty('name', 'oozie_ambari_host').get('value');
|
|
|
+ case 'Existing MySQL Database':
|
|
|
+ return this.get('categoryConfigsAll').findProperty('name', 'oozie_existing_mysql_host').get('value');
|
|
|
+ case 'Existing Oracle Database':
|
|
|
+ return this.get('categoryConfigsAll').findProperty('name', 'oozie_existing_oracle_host').get('value');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }.property('serviceConfig.serviceName', 'serviceConfig.value', 'configs.@each.value'),
|
|
|
+
|
|
|
+ connectionUrl: function () {
|
|
|
+ if (this.get('serviceConfig.serviceName') === 'HIVE') {
|
|
|
+ return this.get('categoryConfigsAll').findProperty('name', 'hive_jdbc_connection_url');
|
|
|
+ } else {
|
|
|
+ return this.get('categoryConfigsAll').findProperty('name', 'oozie_jdbc_connection_url');
|
|
|
+ }
|
|
|
+ }.property('serviceConfig.serviceName'),
|
|
|
+
|
|
|
optionsBinding: 'serviceConfig.options',
|
|
|
disabled: function () {
|
|
|
return !this.get('serviceConfig.isEditable');
|
|
@@ -224,21 +314,22 @@ App.ServiceConfigRadioButton = Ember.Checkbox.extend({
|
|
|
onChecked: function () {
|
|
|
this.set('parentView.serviceConfig.value', this.get('value'));
|
|
|
var components = this.get('parentView.serviceConfig.options');
|
|
|
- components.forEach(function (_component) {
|
|
|
- if(_component.foreignKeys){
|
|
|
- _component.foreignKeys.forEach(function (_componentName) {
|
|
|
- if (this.get('parentView.categoryConfigsAll').someProperty('name', _componentName)) {
|
|
|
- var component = this.get('parentView.categoryConfigsAll').findProperty('name', _componentName);
|
|
|
- if (_component.displayName === this.get('value')) {
|
|
|
- component.set('isVisible', true);
|
|
|
- } else {
|
|
|
- component.set('isVisible', false);
|
|
|
+ components
|
|
|
+ .forEach(function (_component) {
|
|
|
+ if (_component.foreignKeys) {
|
|
|
+ _component.foreignKeys.forEach(function (_componentName) {
|
|
|
+ if (this.get('parentView.categoryConfigsAll').someProperty('name', _componentName)) {
|
|
|
+ var component = this.get('parentView.categoryConfigsAll').findProperty('name', _componentName);
|
|
|
+ if (_component.displayName === this.get('value')) {
|
|
|
+ component.set('isVisible', true);
|
|
|
+ } else {
|
|
|
+ component.set('isVisible', false);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- }, this);
|
|
|
- }
|
|
|
- }, this);
|
|
|
- }.observes('checked') ,
|
|
|
+ }, this);
|
|
|
+ }
|
|
|
+ }, this);
|
|
|
+ }.observes('checked'),
|
|
|
|
|
|
disabled: function () {
|
|
|
return !this.get('parentView.serviceConfig.isEditable');
|
|
@@ -299,7 +390,6 @@ App.ServiceConfigMultipleHostsDisplay = Ember.Mixin.create(App.ServiceConfigHost
|
|
|
console.log('view', this.get('viewName')); //to know which View cause errors
|
|
|
console.log('controller', this.get('controller').name); //should be slaveComponentGroupsController
|
|
|
if (!this.get('value')) {
|
|
|
- // debugger;
|
|
|
return true;
|
|
|
}
|
|
|
return this.get('value').length === 0;
|