You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sr...@apache.org on 2014/10/17 20:01:10 UTC
git commit: AMBARI-7839. Slider View: java_home config value should
be populated from API property (Max Shepel via srimanth)
Repository: ambari
Updated Branches:
refs/heads/trunk 8162fd399 -> 0ab58755d
AMBARI-7839. Slider View: java_home config value should be populated from API property (Max Shepel via srimanth)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0ab58755
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0ab58755
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0ab58755
Branch: refs/heads/trunk
Commit: 0ab58755d53ab2f599194aef7aa4054326aa9cfa
Parents: 8162fd3
Author: Srimanth Gunturi <sg...@hortonworks.com>
Authored: Fri Oct 17 10:54:13 2014 -0700
Committer: Srimanth Gunturi <sg...@hortonworks.com>
Committed: Fri Oct 17 10:59:02 2014 -0700
----------------------------------------------------------------------
.../createAppWizard/step3_controller.js | 4 ++
.../ui/app/controllers/slider_controller.js | 1 +
.../src/main/resources/ui/app/initialize.js | 8 ++-
.../app/templates/components/configSection.hbs | 2 +-
.../createAppWizard/step3_controller_test.js | 59 ++++++++++++++++++++
.../unit/controllers/slider_controller_test.js | 6 +-
6 files changed, 77 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/0ab58755/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step3_controller.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step3_controller.js b/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step3_controller.js
index 308378d..81552b5 100644
--- a/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step3_controller.js
+++ b/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step3_controller.js
@@ -136,6 +136,10 @@ App.CreateAppWizardStep3Controller = Ember.ObjectController.extend({
$.extend({name: key, value: newAppConfigs[key], label: label}, configSettings[key]) :
{name: key, value: newAppConfigs[key], label: label};
+ if (key === 'java_home' && !!setDefaults && App.get('javaHome')) {
+ configSetting.value = App.get('javaHome');
+ }
+
if (key === "site.global.ganglia_server_host" && !!setDefaults && App.get('gangliaHost')) {
configSetting.value = App.get('gangliaHost');
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/0ab58755/contrib/views/slider/src/main/resources/ui/app/controllers/slider_controller.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/controllers/slider_controller.js b/contrib/views/slider/src/main/resources/ui/app/controllers/slider_controller.js
index 303e361..e4476fd 100644
--- a/contrib/views/slider/src/main/resources/ui/app/controllers/slider_controller.js
+++ b/contrib/views/slider/src/main/resources/ui/app/controllers/slider_controller.js
@@ -52,6 +52,7 @@ App.SliderController = Ember.Controller.extend(App.RunPeriodically, {
getViewDisplayParametersSuccessCallback: function(data) {
App.set('description', Em.get(data, 'ViewInstanceInfo.description'));
App.set('label', Em.get(data, 'ViewInstanceInfo.label'));
+ App.set('javaHome', Em.get(data, 'ViewInstanceInfo.instance_data') && Em.get(data, 'ViewInstanceInfo.instance_data')['java.home']);
},
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/0ab58755/contrib/views/slider/src/main/resources/ui/app/initialize.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/initialize.js b/contrib/views/slider/src/main/resources/ui/app/initialize.js
index 090c894..42bfb3f 100755
--- a/contrib/views/slider/src/main/resources/ui/app/initialize.js
+++ b/contrib/views/slider/src/main/resources/ui/app/initialize.js
@@ -112,7 +112,13 @@ App.initializer({
* Last time when mapper ran
* @type {null|number}
*/
- mapperTime: null
+ mapperTime: null,
+
+ /**
+ * Default java_home value for Slider View instance
+ * @type {string|null}
+ */
+ javaHome: null
});
if(!window.QUnit) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/0ab58755/contrib/views/slider/src/main/resources/ui/app/templates/components/configSection.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/templates/components/configSection.hbs b/contrib/views/slider/src/main/resources/ui/app/templates/components/configSection.hbs
index 8eb22f1..3d6aa20 100644
--- a/contrib/views/slider/src/main/resources/ui/app/templates/components/configSection.hbs
+++ b/contrib/views/slider/src/main/resources/ui/app/templates/components/configSection.hbs
@@ -16,7 +16,7 @@
* limitations under the License.
}}
-{{#bs-panel heading=sectionLabel collapsible=true dismiss=false open=isGeneral }}
+{{#bs-panel heading=sectionLabel collapsible=true dismiss=false open=false }}
<form class="form-horizontal" role="form">
{{#each config in sectionConfigs}}
{{#if config.isSet}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/0ab58755/contrib/views/slider/src/main/resources/ui/test/unit/controllers/createAppWizard/step3_controller_test.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/test/unit/controllers/createAppWizard/step3_controller_test.js b/contrib/views/slider/src/main/resources/ui/test/unit/controllers/createAppWizard/step3_controller_test.js
new file mode 100644
index 0000000..56346b2
--- /dev/null
+++ b/contrib/views/slider/src/main/resources/ui/test/unit/controllers/createAppWizard/step3_controller_test.js
@@ -0,0 +1,59 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+moduleFor('controller:createAppWizardStep3', 'App.CreateAppWizardStep3Controller', {
+
+ needs: [
+ 'controller:createAppWizard',
+ 'controller:slider'
+ ]
+
+});
+
+test('initConfigs', function () {
+
+ var controller = this.subject(),
+ wizardController = controller.get('controllers.createAppWizard');
+
+ Em.run(function () {
+ wizardController.setProperties({
+ content: {},
+ newApp: {
+ appType: {
+ configs: []
+ },
+ configs: {
+ java_home: '/usr/jdk64/jdk1.7.0_40'
+ }
+ }
+ });
+ App.__container__.lookup('controller:slider').getViewDisplayParametersSuccessCallback({
+ "ViewInstanceInfo" : {
+ "instance_data": {
+ "java.home": "/usr/jdk64/jdk1.7.0_45"
+ }
+ }
+ });
+ Em.run(function () {
+ controller.initConfigs(true);
+ });
+ });
+
+ equal(controller.get('configs').findBy('label', 'java_home').get('value'), '/usr/jdk64/jdk1.7.0_45', 'should set default java_home property value');
+
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/0ab58755/contrib/views/slider/src/main/resources/ui/test/unit/controllers/slider_controller_test.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/test/unit/controllers/slider_controller_test.js b/contrib/views/slider/src/main/resources/ui/test/unit/controllers/slider_controller_test.js
index 774c0f1..0faec95 100644
--- a/contrib/views/slider/src/main/resources/ui/test/unit/controllers/slider_controller_test.js
+++ b/contrib/views/slider/src/main/resources/ui/test/unit/controllers/slider_controller_test.js
@@ -25,11 +25,15 @@ test('getViewDisplayParametersSuccessCallback', function () {
sliderController.getViewDisplayParametersSuccessCallback({
"ViewInstanceInfo" : {
"description" : "description s1",
- "label" : "display s1"
+ "label" : "display s1",
+ "instance_data": {
+ "java.home": "/usr/jdk64/jdk1.7.0_45"
+ }
}
})
});
equal(App.get('label'), 'display s1', 'valid label is set');
equal(App.get('description'), 'description s1', 'valid description is set');
+ equal(App.get('javaHome'), '/usr/jdk64/jdk1.7.0_45', 'valid default java_home property is set');
});
\ No newline at end of file