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/05/23 18:30:11 UTC
git commit: AMBARI-5872. Provide 'Create App' Wizard Step4
functionallity. (akovalenko)
Repository: ambari
Updated Branches:
refs/heads/trunk 82a2b9bcb -> 24ee41cc9
AMBARI-5872. Provide 'Create App' Wizard Step4 functionallity. (akovalenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/24ee41cc
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/24ee41cc
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/24ee41cc
Branch: refs/heads/trunk
Commit: 24ee41cc9c8f758f1af8be5797ffec1b54009812
Parents: 82a2b9b
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Fri May 23 19:25:35 2014 +0300
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Fri May 23 19:28:14 2014 +0300
----------------------------------------------------------------------
.../createAppWizard/step2_controller.js | 3 +-
.../createAppWizard/step4_controller.js | 113 +++++++++++++++++++
.../controllers/create_app_wizard_controller.js | 5 +
.../resources/ui/app/styles/application.less | 3 +
.../ui/app/templates/createAppWizard/step2.hbs | 2 +-
.../ui/app/templates/createAppWizard/step4.hbs | 24 ++--
.../src/main/resources/ui/app/translations.js | 9 +-
.../ui/app/views/createAppWizard/step4_view.js | 24 ++++
8 files changed, 165 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/24ee41cc/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step2_controller.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step2_controller.js b/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step2_controller.js
index 54aa156..201dafb 100644
--- a/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step2_controller.js
+++ b/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step2_controller.js
@@ -54,7 +54,8 @@ App.CreateAppWizardStep2Controller = Ember.ArrayController.extend({
if (allTypeComponents && allTypeComponents.get('length')) {
allTypeComponents.forEach(function (typeComponent) {
content.push(Ember.Object.create({
- name: typeComponent.get('displayName'),
+ displayName: typeComponent.get('displayName'),
+ name: typeComponent.get('name'),
numInstances: typeComponent.get('defaultNumInstances').toString(),
yarnMemory: typeComponent.get('defaultYARNMemory').toString(),
yarnCPU: typeComponent.get('defaultYARNCPU').toString()
http://git-wip-us.apache.org/repos/asf/ambari/blob/24ee41cc/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step4_controller.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step4_controller.js b/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step4_controller.js
new file mode 100644
index 0000000..3fc5e7d
--- /dev/null
+++ b/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step4_controller.js
@@ -0,0 +1,113 @@
+/**
+ * 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.
+ */
+
+App.CreateAppWizardStep4Controller = Ember.ObjectController.extend({
+
+ needs: "createAppWizard",
+
+ appWizardController: Ember.computed.alias("controllers.createAppWizard"),
+
+ /**
+ * New App object
+ * @type {App.SliderApp}
+ */
+ newApp: null,
+
+ /**
+ * Load all required data for step
+ */
+ loadStep: function () {
+ this.initializeNewApp();
+ },
+
+ /**
+ * Initialize new App to use it scope of controller
+ */
+ initializeNewApp: function () {
+ var newApp = this.get('appWizardController.newApp');
+ this.set('newApp', newApp);
+ },
+
+ /**
+ * Return formatted configs to show them on preview page
+ * @return {String}
+ */
+ configsFormatted: function () {
+ var result = '';
+ var configs = this.get('newApp.configs');
+ if (configs) {
+ result = JSON.stringify(configs);
+ result = result.substring(1, result.length - 1);
+ result = result.replace(/,/g, ',\n');
+ }
+ return result;
+ }.property('newApp.configs'),
+
+ /**
+ * Return formatted object to send it in request to server
+ * @type {Object}
+ */
+ componentsFormatted: function () {
+ var result = {};
+ this.get('newApp.components').forEach(function (component) {
+ result[component.get('name')] = {
+ 'num_instances': component.get('numInstances'),
+ 'yarn_memory': component.get('yarnMemory'),
+ 'yarn_cpu': component.get('yarnCPU')
+ };
+ });
+ return result;
+ }.property('newApp.components.@each'),
+
+ /**
+ * Send request to server to deploy new App
+ * @return {$.ajax}
+ */
+ sendAppDataToServer: function () {
+ if (!App.get('testMode')) {
+ var self = this;
+ var app = this.get('newApp');
+ var componentsFormatted = this.get('componentsFormatted');
+ return $.ajax({
+ url: App.get('urlPrefix') + 'apps/',
+ method: 'POST',
+ data: JSON.stringify({
+ type: app.get('appType.index'),
+ name: app.get('name'),
+ components: componentsFormatted,
+ configs: app.get('configs')
+ }),
+ complete: function () {
+ self.get('appWizardController').hidePopup();
+ }
+ });
+ } else {
+ this.get('appWizardController').hidePopup();
+ return true;
+ }
+ },
+
+ actions: {
+ /**
+ * Onclick handler for finish button
+ */
+ finish: function () {
+ this.sendAppDataToServer();
+ }
+ }
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/24ee41cc/contrib/views/slider/src/main/resources/ui/app/controllers/create_app_wizard_controller.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/controllers/create_app_wizard_controller.js b/contrib/views/slider/src/main/resources/ui/app/controllers/create_app_wizard_controller.js
index 6fbeed9..fbe0e17 100644
--- a/contrib/views/slider/src/main/resources/ui/app/controllers/create_app_wizard_controller.js
+++ b/contrib/views/slider/src/main/resources/ui/app/controllers/create_app_wizard_controller.js
@@ -45,6 +45,11 @@ App.CreateAppWizardController = Ember.ObjectController.extend({
this.gotoStep(this.get('currentStep') - 1);
},
+ hidePopup: function () {
+ $('#createAppWizard').hide();
+ this.transitionToRoute('slider_apps');
+ },
+
actions: {
gotoStep: function (step) {
this.gotoStep(step);
http://git-wip-us.apache.org/repos/asf/ambari/blob/24ee41cc/contrib/views/slider/src/main/resources/ui/app/styles/application.less
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/styles/application.less b/contrib/views/slider/src/main/resources/ui/app/styles/application.less
index 8125927..bca41f9 100644
--- a/contrib/views/slider/src/main/resources/ui/app/styles/application.less
+++ b/contrib/views/slider/src/main/resources/ui/app/styles/application.less
@@ -345,6 +345,9 @@ a {
ul {
list-style: none;
}
+ pre {
+ margin-left: 30px;
+ }
}
#step2 {
.table-container {
http://git-wip-us.apache.org/repos/asf/ambari/blob/24ee41cc/contrib/views/slider/src/main/resources/ui/app/templates/createAppWizard/step2.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/templates/createAppWizard/step2.hbs b/contrib/views/slider/src/main/resources/ui/app/templates/createAppWizard/step2.hbs
index 3140fdf..de436d6 100644
--- a/contrib/views/slider/src/main/resources/ui/app/templates/createAppWizard/step2.hbs
+++ b/contrib/views/slider/src/main/resources/ui/app/templates/createAppWizard/step2.hbs
@@ -38,7 +38,7 @@
<tbody>
{{#each}}
<tr>
- <td>{{name}}</td>
+ <td>{{displayName}}</td>
<td>{{input valueBinding="numInstances"}}</td>
<td>{{input valueBinding="yarnMemory"}}</td>
<td>{{input valueBinding="yarnCPU"}}</td>
http://git-wip-us.apache.org/repos/asf/ambari/blob/24ee41cc/contrib/views/slider/src/main/resources/ui/app/templates/createAppWizard/step4.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/templates/createAppWizard/step4.hbs b/contrib/views/slider/src/main/resources/ui/app/templates/createAppWizard/step4.hbs
index 7fd39cb..9e9fe14 100644
--- a/contrib/views/slider/src/main/resources/ui/app/templates/createAppWizard/step4.hbs
+++ b/contrib/views/slider/src/main/resources/ui/app/templates/createAppWizard/step4.hbs
@@ -17,23 +17,19 @@
}}
<div id="step4">
-<h5>Summary</h5>
+<h5>{{t common.summary}}</h5>
<ul>
- <li>App Name: HBase Cluster 1</li>
- <li>App Type: HBase</li>
+ <li>{{t wizard.step4.appName}}: {{controller.newApp.name}}</li>
+ <li>{{t wizard.step4.appType}}: {{controller.newApp.appType.displayName}}</li>
</ul>
-<h5>Components</h5>
+<h5>{{t common.components}}</h5>
<ul>
- <li>HBASE_MASTER: 1</li>
- <li>HBASE_REGION_SERVER: 5</li>
-</ul>
-<h5>Configuration</h5>
-<ul>
- <li>"site.global.app_user": "yarn",</li>
- <li>"site.global.app_log_dir": "${AGENT_LOG_ROOT}/app/log",</li>
- <li>"site.global.app_pid_dir": "${AGENT_WORK_ROOT}/app/run”,</li>
- <li>"site.hbase-site.hbase.hstore.flush.retries.number": "120",</li>
+ {{#each component in controller.newApp.components}}
+ <li>{{component.displayName}}: {{component.numInstances}}</li>
+ {{/each}}
</ul>
+<h5>{{t common.configuration}}</h5>
+<pre>{{controller.configsFormatted}}</pre>
-<button class="btn btn-success pull-right" {{action finish target="view"}}>Finish</button>
+<button class="btn btn-success pull-right" {{action finish target="controller"}}>{{t common.finish}}</button>
</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/24ee41cc/contrib/views/slider/src/main/resources/ui/app/translations.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/translations.js b/contrib/views/slider/src/main/resources/ui/app/translations.js
index 782adbd..de9a5b7 100644
--- a/contrib/views/slider/src/main/resources/ui/app/translations.js
+++ b/contrib/views/slider/src/main/resources/ui/app/translations.js
@@ -35,7 +35,10 @@ Em.I18n.translations = {
'summary': 'Summary',
'configs': 'Configs',
'metrics': 'Metrics',
- 'confirmation': 'Confirmation'
+ 'confirmation': 'Confirmation',
+ 'configuration': 'Configuration',
+ 'finish': 'Finish',
+ 'components': 'Components'
},
'popup.confirmation.commonHeader': 'Confirmation',
@@ -70,5 +73,7 @@ Em.I18n.translations = {
'wizard.step3.name': 'Configuration',
'wizard.step3.header': 'Provide configuration details for HBase application',
'wizard.step3.error': 'Only \"key\":\"value\" format allowed.',
- 'wizard.step4.name': 'Deploy'
+ 'wizard.step4.name': 'Deploy',
+ 'wizard.step4.appName': 'App Name',
+ 'wizard.step4.appType': 'App Type'
};
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/24ee41cc/contrib/views/slider/src/main/resources/ui/app/views/createAppWizard/step4_view.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/views/createAppWizard/step4_view.js b/contrib/views/slider/src/main/resources/ui/app/views/createAppWizard/step4_view.js
new file mode 100644
index 0000000..9034001
--- /dev/null
+++ b/contrib/views/slider/src/main/resources/ui/app/views/createAppWizard/step4_view.js
@@ -0,0 +1,24 @@
+/**
+ * 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.
+ */
+
+App.CreateAppWizardStep4View = Ember.View.extend({
+
+ didInsertElement: function () {
+ this.get('controller').loadStep();
+ }
+});