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 12:50:16 UTC
git commit: AMBARI-5865. Provide 'Create App' Wizard Step2
functionallity. (akovalenko)
Repository: ambari
Updated Branches:
refs/heads/trunk f58782c74 -> 6d9f0d3db
AMBARI-5865. Provide 'Create App' Wizard Step2 functionallity. (akovalenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6d9f0d3d
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6d9f0d3d
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6d9f0d3d
Branch: refs/heads/trunk
Commit: 6d9f0d3dbc16a6951c581ff16e041ab63120e156
Parents: f58782c
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Fri May 23 13:48:03 2014 +0300
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Fri May 23 13:48:03 2014 +0300
----------------------------------------------------------------------
.../ui/app/controllers/createAppWizard.js | 51 -------
.../createAppWizard/createAppWizard.js | 21 ---
.../ui/app/controllers/createAppWizard/step1.js | 142 -------------------
.../createAppWizard/step1_controller.js | 141 ++++++++++++++++++
.../createAppWizard/step2_controller.js | 114 +++++++++++++++
.../controllers/create_app_wizard_controller.js | 53 +++++++
.../main/resources/ui/app/models/slider_app.js | 3 +-
.../resources/ui/app/routes/createAppWizard.js | 35 -----
.../ui/app/routes/create_app_wizard.js | 35 +++++
.../resources/ui/app/styles/application.less | 33 +++--
.../ui/app/templates/createAppWizard.hbs | 30 ++--
.../ui/app/templates/createAppWizard/step1.hbs | 4 +-
.../ui/app/templates/createAppWizard/step2.hbs | 75 +++++-----
.../src/main/resources/ui/app/translations.js | 6 +
.../resources/ui/app/views/createAppWizard.js | 70 ---------
.../ui/app/views/createAppWizard/step1.js | 43 ------
.../ui/app/views/createAppWizard/step1_view.js | 43 ++++++
.../ui/app/views/createAppWizard/step2_view.js | 24 ++++
.../ui/app/views/create_app_wizard_view.js | 70 +++++++++
19 files changed, 565 insertions(+), 428 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/6d9f0d3d/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard.js b/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard.js
deleted file mode 100644
index 664ff6a..0000000
--- a/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard.js
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * 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.CreateAppWizardController = Ember.ObjectController.extend({
-
- currentStep: 1,
-
- TOTAL_STEPS_NUMBER: 4,
-
- loadStep: function () {
- this.set('currentStep', 1);
- this.gotoStep(this.get('currentStep'));
- },
-
- gotoStep: function (step, fromNextButon) {
- if (step > this.get('TOTAL_STEPS_NUMBER') || step < 1 || (!fromNextButon && step > this.get('currentStep'))) {
- return false;
- }
- this.set('currentStep', step);
- this.transitionToRoute('createAppWizard.step' + step);
- },
-
- nextStep: function () {
- this.gotoStep(this.get('currentStep') + 1, true);
- },
-
- prevStep: function () {
- this.gotoStep(this.get('currentStep') - 1);
- },
-
- actions: {
- gotoStep: function (step) {
- this.gotoStep(step);
- }
- }
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/6d9f0d3d/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/createAppWizard.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/createAppWizard.js b/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/createAppWizard.js
deleted file mode 100644
index 2209646..0000000
--- a/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/createAppWizard.js
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- * 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.CreateAppWizardStep1Controller = Ember.ObjectController.extend({
- types: ['HBase', 'Pig']
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/6d9f0d3d/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step1.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step1.js b/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step1.js
deleted file mode 100644
index d162db5..0000000
--- a/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step1.js
+++ /dev/null
@@ -1,142 +0,0 @@
-/**
- * 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.CreateAppWizardStep1Controller = Ember.Controller.extend({
-
- needs: "createAppWizard",
-
- appWizardController: Ember.computed.alias("controllers.createAppWizard"),
-
- /**
- * New App object
- * @type {App.SliderApp}
- */
- newApp: null,
-
- /**
- * Name for new App
- * @type {String}
- */
- newAppName: '',
-
- /**
- * List of available types for App
- * @type {Array}
- */
- availableTypes: [],
-
- /**
- * Selected type for new App
- * @type {App.SliderAppType}
- */
- selectedType: null,
-
- /**
- * Define if <code>newAppName</code> pass validation
- * @type {Boolean}
- */
- isNameError: false,
-
- /**
- * Error message describing App name validation error
- * @type {String}
- */
- nameErrorMessage: '',
-
- /**
- * Load all required data for step
- */
- loadStep: function () {
- this.initializeNewApp();
- this.loadAvailableTypes();
- },
-
- /**
- * Initialize new App and set it to <code>newApp</code>
- */
- initializeNewApp: function () {
- // find early initialized app
- var newApp = this.store.all('sliderApp').findBy('status', App.SliderApp.Status.initialized);
- // if there is no one, than create new one
- if (!newApp) {
- newApp = this.store.push('sliderApp', {status: App.SliderApp.Status.initialized, id: 'app' + (new Date).getTime()});
- }
- this.set('newApp', newApp);
- },
-
- /**
- * Load all available types for App
- */
- loadAvailableTypes: function () {
- this.set('availableTypes', this.store.all('sliderAppType'));
- },
-
- /**
- * Validate <code>newAppName</code>
- * It should consist only of letters, numbers, '-', '_' and first character should be a letter
- * @return {Boolean}
- */
- nameValidator: function () {
- var newAppName = this.get('newAppName');
- if (newAppName) {
- // new App name should consist only of letters, numbers, '-', '_' and first character should be a letter
- if (!/^[A-Za-z][A-Za-z0-9_\-]*$/.test(newAppName)) {
- this.set('isNameError', true);
- this.set('nameErrorMessage', Em.I18n.t('wizard.step1.nameFormatError'));
- return false;
- }
- // new App name should be unique
- if (this.store.all('sliderApp').mapProperty('name').contains(newAppName)) {
- this.set('isNameError', true);
- this.set('nameErrorMessage', Em.I18n.t('wizard.step1.nameRepeatError'));
- return false;
- }
- }
- this.set('isNameError', false);
- return true;
- }.observes('newAppName'),
-
- /**
- * Define description depending on selected App type
- */
- typeDescription: function () {
- var selectedType = this.get('selectedType');
- return selectedType ? Em.I18n.t('wizard.step1.typeDescription').format(selectedType.get('displayName')) : '';
- }.property('selectedType'),
-
- /**
- * Define if submit button is disabled
- * <code>newAppName</code> should pass validation and be not empty
- */
- isSubmitDisabled: function () {
- return !this.get('newAppName') || this.get('isNameError');
- }.property('newAppName', 'isNameError'),
-
- saveApp: function () {
- var newApp = this.get('newApp');
- newApp.set('appType', this.get('selectedType'));
- newApp.set('name', this.get('newAppName'));
- },
-
- actions: {
- submit: function () {
- this.saveApp();
- this.get('appWizardController').nextStep();
- }
- }
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/6d9f0d3d/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step1_controller.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step1_controller.js b/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step1_controller.js
new file mode 100644
index 0000000..5017aa1
--- /dev/null
+++ b/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step1_controller.js
@@ -0,0 +1,141 @@
+/**
+ * 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.CreateAppWizardStep1Controller = Ember.Controller.extend({
+
+ needs: "createAppWizard",
+
+ appWizardController: Ember.computed.alias("controllers.createAppWizard"),
+
+ /**
+ * New App object
+ * @type {App.SliderApp}
+ */
+ newApp: null,
+
+ /**
+ * Name for new App
+ * @type {String}
+ */
+ newAppName: '',
+
+ /**
+ * List of available types for App
+ * @type {Array}
+ */
+ availableTypes: [],
+
+ /**
+ * Selected type for new App
+ * @type {App.SliderAppType}
+ */
+ selectedType: null,
+
+ /**
+ * Define if <code>newAppName</code> pass validation
+ * @type {Boolean}
+ */
+ isNameError: false,
+
+ /**
+ * Error message describing App name validation error
+ * @type {String}
+ */
+ nameErrorMessage: '',
+
+ /**
+ * Load all required data for step
+ */
+ loadStep: function () {
+ this.initializeNewApp();
+ this.loadAvailableTypes();
+ },
+
+ /**
+ * Initialize new App and set it to <code>newApp</code>
+ */
+ initializeNewApp: function () {
+ var newApp = Ember.Object.create({
+ name: '',
+ appType: null
+ });
+ this.set('newApp', newApp);
+ },
+
+ /**
+ * Load all available types for App
+ */
+ loadAvailableTypes: function () {
+ this.set('availableTypes', this.store.all('sliderAppType'));
+ },
+
+ /**
+ * Validate <code>newAppName</code>
+ * It should consist only of letters, numbers, '-', '_' and first character should be a letter
+ * @return {Boolean}
+ */
+ nameValidator: function () {
+ var newAppName = this.get('newAppName');
+ if (newAppName) {
+ // new App name should consist only of letters, numbers, '-', '_' and first character should be a letter
+ if (!/^[A-Za-z][A-Za-z0-9_\-]*$/.test(newAppName)) {
+ this.set('isNameError', true);
+ this.set('nameErrorMessage', Em.I18n.t('wizard.step1.nameFormatError'));
+ return false;
+ }
+ // new App name should be unique
+ if (this.store.all('sliderApp').mapProperty('name').contains(newAppName)) {
+ this.set('isNameError', true);
+ this.set('nameErrorMessage', Em.I18n.t('wizard.step1.nameRepeatError'));
+ return false;
+ }
+ }
+ this.set('isNameError', false);
+ return true;
+ }.observes('newAppName'),
+
+ /**
+ * Define description depending on selected App type
+ */
+ typeDescription: function () {
+ var selectedType = this.get('selectedType');
+ return selectedType ? Em.I18n.t('wizard.step1.typeDescription').format(selectedType.get('displayName')) : '';
+ }.property('selectedType'),
+
+ /**
+ * Define if submit button is disabled
+ * <code>newAppName</code> should pass validation and be not empty
+ */
+ isSubmitDisabled: function () {
+ return !this.get('newAppName') || this.get('isNameError');
+ }.property('newAppName', 'isNameError'),
+
+ saveApp: function () {
+ var newApp = this.get('newApp');
+ newApp.set('appType', this.get('selectedType'));
+ newApp.set('name', this.get('newAppName'));
+ this.set('appWizardController.newApp', newApp);
+ },
+
+ actions: {
+ submit: function () {
+ this.saveApp();
+ this.get('appWizardController').nextStep();
+ }
+ }
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/6d9f0d3d/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
new file mode 100644
index 0000000..01f947a
--- /dev/null
+++ b/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step2_controller.js
@@ -0,0 +1,114 @@
+/**
+ * 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.CreateAppWizardStep2Controller = Ember.ArrayController.extend({
+
+ needs: "createAppWizard",
+
+ appWizardController: Ember.computed.alias("controllers.createAppWizard"),
+
+ content: [],
+
+ /**
+ * 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);
+ },
+
+ /**
+ * Fill <code>content</code> with objects created from <code>App.SliderAppTypeComponent</code>
+ */
+ loadTypeComponents: function () {
+ var content = [];
+ var allTypeComponents = this.get('newApp.appType.components');
+ if (allTypeComponents && allTypeComponents.get('length')) {
+ allTypeComponents.forEach(function (typeComponent) {
+ content.push(Ember.Object.create({
+ name: typeComponent.get('displayName'),
+ numInstances: typeComponent.get('defaultNumInstances'),
+ yarnMemory: typeComponent.get('defaultYARNMemory'),
+ yarnCPU: typeComponent.get('defaultYARNCPU')
+ }));
+ });
+ this.set('content', content);
+ }
+ }.observes('newApp.appType.components.length'),
+
+ /**
+ * Validate all input fields are integer
+ * @return {Boolean}
+ */
+ isError: function () {
+ var result = false;
+ this.get('content').forEach(function (component) {
+ if (!result && (this.isNotInteger(component.get('numInstances')) || this.isNotInteger(component.get('yarnMemory')) || this.isNotInteger(component.get('yarnCPU')))) {
+ result = true;
+ }
+ }, this);
+ return result;
+ }.property('content.@each.numInstances', 'content.@each.yarnMemory', 'content.@each.yarnCPU'),
+
+ /**
+ * Check if param is integer
+ * @param value value to check
+ * @return {Boolean}
+ */
+ isNotInteger: function (value) {
+ return !value || !(value % 1 == 0);
+ },
+
+ /**
+ * Define if submit button is disabled
+ * <code>isError</code> should be true
+ */
+ isSubmitDisabled: function () {
+ return this.get('isError');
+ }.property('isError'),
+
+ /**
+ * Save all data about components to <code>appWizardController.newApp.components</code>
+ */
+ saveComponents: function () {
+ this.set('appWizardController.newApp.components', this.get('content'));
+ },
+
+ actions: {
+ /**
+ * Save data and proceed to the next step
+ */
+ submit: function () {
+ this.saveComponents();
+ this.get('appWizardController').nextStep();
+ }
+ }
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/6d9f0d3d/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
new file mode 100644
index 0000000..6fbeed9
--- /dev/null
+++ b/contrib/views/slider/src/main/resources/ui/app/controllers/create_app_wizard_controller.js
@@ -0,0 +1,53 @@
+/**
+ * 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.CreateAppWizardController = Ember.ObjectController.extend({
+
+ newApp: null,
+
+ currentStep: 1,
+
+ TOTAL_STEPS_NUMBER: 4,
+
+ loadStep: function () {
+ this.set('currentStep', 1);
+ this.gotoStep(this.get('currentStep'));
+ },
+
+ gotoStep: function (step, fromNextButon) {
+ if (step > this.get('TOTAL_STEPS_NUMBER') || step < 1 || (!fromNextButon && step > this.get('currentStep'))) {
+ return false;
+ }
+ this.set('currentStep', step);
+ this.transitionToRoute('createAppWizard.step' + step);
+ },
+
+ nextStep: function () {
+ this.gotoStep(this.get('currentStep') + 1, true);
+ },
+
+ prevStep: function () {
+ this.gotoStep(this.get('currentStep') - 1);
+ },
+
+ actions: {
+ gotoStep: function (step) {
+ this.gotoStep(step);
+ }
+ }
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/6d9f0d3d/contrib/views/slider/src/main/resources/ui/app/models/slider_app.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/models/slider_app.js b/contrib/views/slider/src/main/resources/ui/app/models/slider_app.js
index 0f3fef5..133df38 100644
--- a/contrib/views/slider/src/main/resources/ui/app/models/slider_app.js
+++ b/contrib/views/slider/src/main/resources/ui/app/models/slider_app.js
@@ -253,6 +253,5 @@ App.SliderApp.FIXTURES = [
App.SliderApp.Status = {
running: "Running",
frozen: "Frozen",
- destroyed: "Destroyed",
- initialized: "Initialized"
+ destroyed: "Destroyed"
};
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/6d9f0d3d/contrib/views/slider/src/main/resources/ui/app/routes/createAppWizard.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/routes/createAppWizard.js b/contrib/views/slider/src/main/resources/ui/app/routes/createAppWizard.js
deleted file mode 100644
index 1392067..0000000
--- a/contrib/views/slider/src/main/resources/ui/app/routes/createAppWizard.js
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * 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.CreateAppWizardRoute = Ember.Route.extend({
-
- controller: null,
-
- setupController: function (controller) {
- this.set('controller', controller);
- },
-
- actions: {
- nextStep: function () {
- this.get('controller').nextStep();
- },
-
- prevStep: function () {
- this.get('controller').prevStep();
- }
- }
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/6d9f0d3d/contrib/views/slider/src/main/resources/ui/app/routes/create_app_wizard.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/routes/create_app_wizard.js b/contrib/views/slider/src/main/resources/ui/app/routes/create_app_wizard.js
new file mode 100644
index 0000000..1392067
--- /dev/null
+++ b/contrib/views/slider/src/main/resources/ui/app/routes/create_app_wizard.js
@@ -0,0 +1,35 @@
+/**
+ * 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.CreateAppWizardRoute = Ember.Route.extend({
+
+ controller: null,
+
+ setupController: function (controller) {
+ this.set('controller', controller);
+ },
+
+ actions: {
+ nextStep: function () {
+ this.get('controller').nextStep();
+ },
+
+ prevStep: function () {
+ this.get('controller').prevStep();
+ }
+ }
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/6d9f0d3d/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 ba7f38c..ab7ed4c 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
@@ -318,7 +318,15 @@ a {
width: 60%;
margin: -250px 0 auto;
left: 20%;
-
+ .wizard-nav {
+ padding-left: 0px;
+ }
+ h5 {
+ font-weight: bold;
+ }
+ .slider-modal-body {
+ max-height: 505px;
+ }
.next-btn {
margin-left: 5px;
}
@@ -338,12 +346,21 @@ a {
list-style: none;
}
}
- .step2-input {
- width: 80%;
- margin: 5% 10%;
- }
- .components-table {
- margin-bottom: 30px;
+ #step2 {
+ .table-container {
+ max-height: 225px;
+ border: 1px solid #e3e3e3;
+ padding: 5px;
+ margin-bottom: 20px;
+ overflow-y: auto;
+ border-radius: 4px;
+ .components-table {
+ width: 100%;
+ border-spacing: 10px;
+ border-collapse: separate;
+ }
+ margin-bottom: 30px;
+ }
}
}
.app-page {
@@ -476,4 +493,4 @@ a {
.slider-modal-footer .btn-group .btn + .btn {
margin-left: -1px;
-}
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/6d9f0d3d/contrib/views/slider/src/main/resources/ui/app/templates/createAppWizard.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/templates/createAppWizard.hbs b/contrib/views/slider/src/main/resources/ui/app/templates/createAppWizard.hbs
index 92de14d..fc6eb51 100644
--- a/contrib/views/slider/src/main/resources/ui/app/templates/createAppWizard.hbs
+++ b/contrib/views/slider/src/main/resources/ui/app/templates/createAppWizard.hbs
@@ -21,25 +21,21 @@
<h3 id="myModalLabel">{{t wizard.name}}</h3>
</div>
<div class="slider-modal-body">
- <div class="wizard">
- <div class="container">
- <div class="container-fluid">
- <div class="row-fluid">
- <div class="col-md-3">
- <div class="well">
- <ul class="nav nav-pills nav-stacked">
- <li {{bind-attr class="view.isStep1:active view.isStep1Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep 1 target="controller"}}>{{t wizard.step1.name}}</a></li>
- <li {{bind-attr class="view.isStep2:active view.isStep2Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep 2 target="controller"}}>{{t wizard.step2.name}}</a></li>
- <li {{bind-attr class="view.isStep3:active view.isStep3Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep 3 target="controller"}}>{{t wizard.step3.name}}</a></li>
- <li {{bind-attr class="view.isStep4:active view.isStep4Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep 4 target="controller"}}>{{t wizard.step4.name}}</a></li>
- </ul>
- </div>
- </div>
- <div class="wizard-content well col-md-9">
- {{outlet}}
- </div>
+ <div class="container-fluid">
+ <div class="row">
+ <div class="col-md-3 wizard-nav">
+ <div class="well">
+ <ul class="nav nav-pills nav-stacked">
+ <li {{bind-attr class="view.isStep1:active view.isStep1Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep 1 target="controller"}}>{{t wizard.step1.name}}</a></li>
+ <li {{bind-attr class="view.isStep2:active view.isStep2Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep 2 target="controller"}}>{{t wizard.step2.name}}</a></li>
+ <li {{bind-attr class="view.isStep3:active view.isStep3Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep 3 target="controller"}}>{{t wizard.step3.name}}</a></li>
+ <li {{bind-attr class="view.isStep4:active view.isStep4Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep 4 target="controller"}}>{{t wizard.step4.name}}</a></li>
+ </ul>
</div>
</div>
+ <div class="wizard-content well col-md-9">
+ {{outlet}}
+ </div>
</div>
</div>
</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/6d9f0d3d/contrib/views/slider/src/main/resources/ui/app/templates/createAppWizard/step1.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/templates/createAppWizard/step1.hbs b/contrib/views/slider/src/main/resources/ui/app/templates/createAppWizard/step1.hbs
index 98f0e42..179dd99 100644
--- a/contrib/views/slider/src/main/resources/ui/app/templates/createAppWizard/step1.hbs
+++ b/contrib/views/slider/src/main/resources/ui/app/templates/createAppWizard/step1.hbs
@@ -16,7 +16,7 @@
* limitations under the License.
}}
<h4>{{t wizard.step1.header}}</h4>
-<div class="row-fluid">
+<div class="row">
<div class="col-md-6">
{{view view.availableTypesSelect contentBinding="controller.availableTypes" optionLabelPath="content.displayName" multiple="true" class="type-select"}}
</div>
@@ -25,7 +25,7 @@
<label>{{t common.name}}: {{input id="app-name-input" valueBinding="controller.newAppName"}}</label>
</div>
{{#if controller.isNameError}}
- <div class="alert alert-error">
+ <div class="alert alert-danger">
{{controller.nameErrorMessage}}
</div>
{{/if}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/6d9f0d3d/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 271af97..3140fdf 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
@@ -15,40 +15,41 @@
* See the License for the specific language governing permissions and
* limitations under the License.
}}
-
-<p>
- HBase applica;on requires resources to be allocated on the cluster.
- Provide resource allocation requests for each component of the application below.
-</p>
-<table class="components-table">
- <thead>
- <tr>
- <th></th>
- <th>
- Number of Instances
- </th>
- <th>
- YARN Memory (MB)
- </th>
- <th>
- YARN CPU Cores
- </th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>HBASE_MASTER</td>
- <td>{{input class="step2-input"}}</td>
- <td>{{input class="step2-input"}}</td>
- <td>{{input class="step2-input"}}</td>
- </tr>
- <tr>
- <td>HBASE_REGIONSERVER</td>
- <td>{{input class="step2-input"}}</td>
- <td>{{input class="step2-input"}}</td>
- <td>{{input class="step2-input"}}</td>
- </tr>
- </tbody>
-</table>
-<button class="btn btn-success pull-right next-btn" {{action nextStep}}>Next</button>
-<button class="btn pull-right" {{action prevStep}}>Back</button>
+<div id="step2">
+ <p>
+ {{t wizard.step2.header}}
+ </p>
+ <div class="table-container">
+ <table class="components-table">
+ <thead>
+ <tr>
+ <th></th>
+ <th>
+ {{t wizard.step2.table.instances}}
+ </th>
+ <th>
+ {{t wizard.step2.table.memory}}
+ </th>
+ <th>
+ {{t wizard.step2.table.cpu}}
+ </th>
+ </tr>
+ </thead>
+ <tbody>
+ {{#each}}
+ <tr>
+ <td>{{name}}</td>
+ <td>{{input valueBinding="numInstances"}}</td>
+ <td>{{input valueBinding="yarnMemory"}}</td>
+ <td>{{input valueBinding="yarnCPU"}}</td>
+ </tr>
+ {{/each}}
+ </tbody>
+ </table>
+ </div>
+ {{#if controller.isError}}
+ <div class="alert alert-danger">{{t wizard.step2.error.numbers}}</div>
+ {{/if}}
+ <button class="btn btn-success pull-right next-btn" {{bind-attr disabled="controller.isSubmitDisabled"}} {{action submit target="controller"}}>{{t common.next}}</button>
+ <button class="btn pull-right" {{action prevStep}}>{{t common.back}}</button>
+</div>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/6d9f0d3d/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 01eb089..865769d 100644
--- a/contrib/views/slider/src/main/resources/ui/app/translations.js
+++ b/contrib/views/slider/src/main/resources/ui/app/translations.js
@@ -26,6 +26,7 @@ Em.I18n.translations = {
'actions': 'Actions',
'cancel': 'Cancel',
'name': "Name",
+ 'back': "Back",
'value': "Value",
'next': "Next",
'quickLinks': "Quick Links",
@@ -58,6 +59,11 @@ Em.I18n.translations = {
'wizard.step1.nameFormatError': 'App Name should consist only of letters, numbers, \'-\', \'_\' and first character should be a letter.',
'wizard.step1.nameRepeatError': 'App with entered Name already exists.',
'wizard.step2.name': 'Allocate Resources',
+ 'wizard.step2.header': 'HBase application requires resources to be allocated on the cluster. Provide resource allocation requests for each component of the application below.',
+ 'wizard.step2.table.instances': 'Number of Instances',
+ 'wizard.step2.table.memory': 'YARN Memory (MB)',
+ 'wizard.step2.table.cpu': 'Number of Instances',
+ 'wizard.step2.error.numbers': 'All fields should be filled. Only integer numbers allowed.',
'wizard.step3.name': 'Configuration',
'wizard.step4.name': 'Deploy'
};
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/6d9f0d3d/contrib/views/slider/src/main/resources/ui/app/views/createAppWizard.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/views/createAppWizard.js b/contrib/views/slider/src/main/resources/ui/app/views/createAppWizard.js
deleted file mode 100644
index 3a6f1b6..0000000
--- a/contrib/views/slider/src/main/resources/ui/app/views/createAppWizard.js
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * 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.CreateAppWizardView = Ember.View.extend({
-
- didInsertElement: function(){
- this.get('controller').loadStep();
- },
-
- isStep1: function () {
- return this.get('controller.currentStep') == 1;
- }.property('controller.currentStep'),
-
- isStep2: function () {
- return this.get('controller.currentStep') == 2;
- }.property('controller.currentStep'),
-
- isStep3: function () {
- return this.get('controller.currentStep') == 3;
- }.property('controller.currentStep'),
-
- isStep4: function () {
- return this.get('controller.currentStep') == 4;
- }.property('controller.currentStep'),
-
- isStep1Disabled: function () {
- return this.get('controller.currentStep') < 1;
- }.property('controller.currentStep'),
-
- isStep2Disabled: function () {
- return this.get('controller.currentStep') < 2;
- }.property('controller.currentStep'),
-
- isStep3Disabled: function () {
- return this.get('controller.currentStep') < 3;
- }.property('controller.currentStep'),
-
- isStep4Disabled: function () {
- return this.get('controller.currentStep') < 4;
- }.property('controller.currentStep'),
-
- actions: {
- hide: function () {
- this.hidePopup();
- },
- finish: function () {
- this.hidePopup();
- }
- },
-
- hidePopup: function () {
- $(this.get('element')).find('.modal').hide();
- this.get('controller').transitionToRoute('slider_apps');
- }
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/6d9f0d3d/contrib/views/slider/src/main/resources/ui/app/views/createAppWizard/step1.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/views/createAppWizard/step1.js b/contrib/views/slider/src/main/resources/ui/app/views/createAppWizard/step1.js
deleted file mode 100644
index 18312c9..0000000
--- a/contrib/views/slider/src/main/resources/ui/app/views/createAppWizard/step1.js
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * 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.CreateAppWizardStep1View = Ember.View.extend({
-
- didInsertElement: function () {
- this.get('controller').loadStep();
- },
-
- availableTypesSelect: Ember.Select.extend({
-
- /**
- * Forbid user to select more than one App type
- * Set selected type to <code>controller.selectedType</code>
- */
- setSelection: function () {
- var content = this.get('content');
- var selection = this.get('selection');
- if (content.get('length') && !selection.length) {
- this.set('selection', content.objectAt(0));
- }
- if (selection.length > 1) {
- this.set('selection', [selection[0]])
- }
- this.set('controller.selectedType', this.get('selection')[0])
- }.observes('content.length', 'selection.length', 'selection.@each')
- })
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/6d9f0d3d/contrib/views/slider/src/main/resources/ui/app/views/createAppWizard/step1_view.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/views/createAppWizard/step1_view.js b/contrib/views/slider/src/main/resources/ui/app/views/createAppWizard/step1_view.js
new file mode 100644
index 0000000..18312c9
--- /dev/null
+++ b/contrib/views/slider/src/main/resources/ui/app/views/createAppWizard/step1_view.js
@@ -0,0 +1,43 @@
+/**
+ * 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.CreateAppWizardStep1View = Ember.View.extend({
+
+ didInsertElement: function () {
+ this.get('controller').loadStep();
+ },
+
+ availableTypesSelect: Ember.Select.extend({
+
+ /**
+ * Forbid user to select more than one App type
+ * Set selected type to <code>controller.selectedType</code>
+ */
+ setSelection: function () {
+ var content = this.get('content');
+ var selection = this.get('selection');
+ if (content.get('length') && !selection.length) {
+ this.set('selection', content.objectAt(0));
+ }
+ if (selection.length > 1) {
+ this.set('selection', [selection[0]])
+ }
+ this.set('controller.selectedType', this.get('selection')[0])
+ }.observes('content.length', 'selection.length', 'selection.@each')
+ })
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/6d9f0d3d/contrib/views/slider/src/main/resources/ui/app/views/createAppWizard/step2_view.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/views/createAppWizard/step2_view.js b/contrib/views/slider/src/main/resources/ui/app/views/createAppWizard/step2_view.js
new file mode 100644
index 0000000..ab22bc1
--- /dev/null
+++ b/contrib/views/slider/src/main/resources/ui/app/views/createAppWizard/step2_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.CreateAppWizardStep2View = Ember.View.extend({
+
+ didInsertElement: function () {
+ this.get('controller').loadStep();
+ }
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/6d9f0d3d/contrib/views/slider/src/main/resources/ui/app/views/create_app_wizard_view.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/views/create_app_wizard_view.js b/contrib/views/slider/src/main/resources/ui/app/views/create_app_wizard_view.js
new file mode 100644
index 0000000..3a6f1b6
--- /dev/null
+++ b/contrib/views/slider/src/main/resources/ui/app/views/create_app_wizard_view.js
@@ -0,0 +1,70 @@
+/**
+ * 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.CreateAppWizardView = Ember.View.extend({
+
+ didInsertElement: function(){
+ this.get('controller').loadStep();
+ },
+
+ isStep1: function () {
+ return this.get('controller.currentStep') == 1;
+ }.property('controller.currentStep'),
+
+ isStep2: function () {
+ return this.get('controller.currentStep') == 2;
+ }.property('controller.currentStep'),
+
+ isStep3: function () {
+ return this.get('controller.currentStep') == 3;
+ }.property('controller.currentStep'),
+
+ isStep4: function () {
+ return this.get('controller.currentStep') == 4;
+ }.property('controller.currentStep'),
+
+ isStep1Disabled: function () {
+ return this.get('controller.currentStep') < 1;
+ }.property('controller.currentStep'),
+
+ isStep2Disabled: function () {
+ return this.get('controller.currentStep') < 2;
+ }.property('controller.currentStep'),
+
+ isStep3Disabled: function () {
+ return this.get('controller.currentStep') < 3;
+ }.property('controller.currentStep'),
+
+ isStep4Disabled: function () {
+ return this.get('controller.currentStep') < 4;
+ }.property('controller.currentStep'),
+
+ actions: {
+ hide: function () {
+ this.hidePopup();
+ },
+ finish: function () {
+ this.hidePopup();
+ }
+ },
+
+ hidePopup: function () {
+ $(this.get('element')).find('.modal').hide();
+ this.get('controller').transitionToRoute('slider_apps');
+ }
+});