You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by on...@apache.org on 2014/11/24 18:41:58 UTC
ambari git commit: AMBARI-8427. Alerts UI: Need a multi page wizard
to 'Create Alert' (onechiporenko)
Repository: ambari
Updated Branches:
refs/heads/trunk ab77f2bf0 -> 531c4384b
AMBARI-8427. Alerts UI: Need a multi page wizard to 'Create Alert' (onechiporenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/531c4384
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/531c4384
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/531c4384
Branch: refs/heads/trunk
Commit: 531c4384bd6304fc8f32e4704b8653fd7ad91578
Parents: ab77f2b
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Mon Nov 24 19:08:34 2014 +0200
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Mon Nov 24 19:08:34 2014 +0200
----------------------------------------------------------------------
ambari-web/app/assets/test/tests.js | 1 +
ambari-web/app/controllers.js | 4 +
.../add_alert_definition_controller.js | 36 +++++
.../add_alert_definition/step1_controller.js | 70 +++++++++
.../add_alert_definition/step2_controller.js | 25 ++++
.../add_alert_definition/step3_controller.js | 25 ++++
.../alert_definitions_actions_controller.js | 8 +-
ambari-web/app/messages.js | 5 +
.../app/routes/add_alert_definition_routes.js | 141 +++++++++++++++++++
ambari-web/app/routes/main.js | 2 +
.../add_alert_definition.hbs | 41 ++++++
.../main/alerts/add_alert_definition/step1.hbs | 29 ++++
.../main/alerts/add_alert_definition/step2.hbs | 26 ++++
.../main/alerts/add_alert_definition/step3.hbs | 26 ++++
ambari-web/app/utils/db.js | 3 +
ambari-web/app/views.js | 4 +
.../add_alert_definition_view.js | 41 ++++++
.../alerts/add_alert_definition/step1_view.js | 29 ++++
.../alerts/add_alert_definition/step2_view.js | 25 ++++
.../alerts/add_alert_definition/step3_view.js | 25 ++++
.../step1_controller_test.js | 74 ++++++++++
21 files changed, 639 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/531c4384/ambari-web/app/assets/test/tests.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/test/tests.js b/ambari-web/app/assets/test/tests.js
index 89ad16b..b82dbaf 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -49,6 +49,7 @@ var files = ['test/init_model_test',
'test/controllers/main/alerts/definitions_configs_controller_test',
'test/controllers/main/alerts/definitions_details_controller_test',
'test/controllers/main/alerts/alert_instances_controller_test',
+ 'test/controllers/main/alerts/add_alert_definition/step1_controller_test',
'test/controllers/main/admin/stack_and_upgrade_test',
'test/controllers/main/admin/stack_version/stack_version_details_controller_test',
'test/controllers/main/admin/serviceAccounts_controller_test',
http://git-wip-us.apache.org/repos/asf/ambari/blob/531c4384/ambari-web/app/controllers.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers.js b/ambari-web/app/controllers.js
index 374f39b..476b777 100644
--- a/ambari-web/app/controllers.js
+++ b/ambari-web/app/controllers.js
@@ -78,6 +78,10 @@ require('controllers/main/admin/security/add/step4');
require('controllers/main/admin/authentication');
require('controllers/main/alert_definitions_controller');
require('controllers/main/alerts/alert_definitions_actions_controller');
+require('controllers/main/alerts/add_alert_definition/add_alert_definition_controller');
+require('controllers/main/alerts/add_alert_definition/step1_controller');
+require('controllers/main/alerts/add_alert_definition/step2_controller');
+require('controllers/main/alerts/add_alert_definition/step3_controller');
require('controllers/main/alerts/definition_details_controller');
require('controllers/main/alerts/definition_configs_controller');
require('controllers/main/alerts/alert_instances_controller');
http://git-wip-us.apache.org/repos/asf/ambari/blob/531c4384/ambari-web/app/controllers/main/alerts/add_alert_definition/add_alert_definition_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/alerts/add_alert_definition/add_alert_definition_controller.js b/ambari-web/app/controllers/main/alerts/add_alert_definition/add_alert_definition_controller.js
new file mode 100644
index 0000000..ea8f95d
--- /dev/null
+++ b/ambari-web/app/controllers/main/alerts/add_alert_definition/add_alert_definition_controller.js
@@ -0,0 +1,36 @@
+/**
+ * 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.
+ */
+
+var App = require('app');
+
+App.AddAlertDefinitionController = App.WizardController.extend({
+
+ name: 'addAlertDefinitionController',
+
+ totalSteps: 3,
+
+ content: {
+ selectedType: null
+ },
+
+ finish: function() {
+ this.clear();
+ this.setCurrentStep('1');
+ }
+
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/531c4384/ambari-web/app/controllers/main/alerts/add_alert_definition/step1_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/alerts/add_alert_definition/step1_controller.js b/ambari-web/app/controllers/main/alerts/add_alert_definition/step1_controller.js
new file mode 100644
index 0000000..cd3b4c7
--- /dev/null
+++ b/ambari-web/app/controllers/main/alerts/add_alert_definition/step1_controller.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.
+ */
+
+var App = require('app');
+
+App.AddAlertDefinitionStep1Controller = Em.Controller.extend({
+
+ name: 'addAlertDefinitionStep1',
+
+ /**
+ * List of available alert definition types
+ * @type {{value: string, isActive: boolean}[]}
+ */
+ alertDefinitionsTypes: [
+ Em.Object.create({value: 'PORT', isActive: false, icon: 'icon-signal'}),
+ Em.Object.create({value: 'METRICS', isActive: false, icon: 'icon-bolt'}),
+ Em.Object.create({value: 'WEB', isActive: false, icon: 'icon-globe'}),
+ Em.Object.create({value: 'AGGREGATE', isActive: false, icon: 'icon-plus-sign-alt'}),
+ Em.Object.create({value: 'SCRIPT', isActive: false, icon: 'icon-code'})
+ ],
+
+ /**
+ * "Next"-button is disabled if user doesn't select any alert definition type
+ * @type {boolean}
+ */
+ isSubmitDisabled: function() {
+ return this.get('alertDefinitionsTypes').everyProperty('isActive', false);
+ }.property('alertDefinitionsTypes.@each.isActive'),
+
+ /**
+ * Set selectedType if it exists in the wizard controller
+ * @method loadStep
+ */
+ loadStep: function() {
+ this.get('alertDefinitionsTypes').setEach('isActive', false);
+ var selectedType = this.get('content.selectedType');
+ if(selectedType) {
+ this.selectType({context: {value: selectedType}});
+ }
+ },
+
+ /**
+ * Handler for select alert definition type selection
+ * @param {object} e
+ * @method selectType
+ */
+ selectType: function(e) {
+ var type = e.context,
+ types = this.get('alertDefinitionsTypes');
+ types.setEach('isActive', false);
+ types.findProperty('value', type.value).set('isActive', true);
+ this.set('content.selectedType', type.value);
+ }
+
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/531c4384/ambari-web/app/controllers/main/alerts/add_alert_definition/step2_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/alerts/add_alert_definition/step2_controller.js b/ambari-web/app/controllers/main/alerts/add_alert_definition/step2_controller.js
new file mode 100644
index 0000000..955b75e
--- /dev/null
+++ b/ambari-web/app/controllers/main/alerts/add_alert_definition/step2_controller.js
@@ -0,0 +1,25 @@
+/**
+ * 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.
+ */
+
+var App = require('app');
+
+App.AddAlertDefinitionStep2Controller = Em.Controller.extend({
+
+ name: 'addAlertDefinitionStep2'
+
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/531c4384/ambari-web/app/controllers/main/alerts/add_alert_definition/step3_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/alerts/add_alert_definition/step3_controller.js b/ambari-web/app/controllers/main/alerts/add_alert_definition/step3_controller.js
new file mode 100644
index 0000000..8d4d019
--- /dev/null
+++ b/ambari-web/app/controllers/main/alerts/add_alert_definition/step3_controller.js
@@ -0,0 +1,25 @@
+/**
+ * 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.
+ */
+
+var App = require('app');
+
+App.AddAlertDefinitionStep3Controller = Em.Controller.extend({
+
+ name: 'addAlertDefinitionStep3'
+
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/531c4384/ambari-web/app/controllers/main/alerts/alert_definitions_actions_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/alerts/alert_definitions_actions_controller.js b/ambari-web/app/controllers/main/alerts/alert_definitions_actions_controller.js
index e6790a0..00349a6 100644
--- a/ambari-web/app/controllers/main/alerts/alert_definitions_actions_controller.js
+++ b/ambari-web/app/controllers/main/alerts/alert_definitions_actions_controller.js
@@ -62,7 +62,13 @@ App.MainAlertDefinitionActionsController = Em.ArrayController.extend({
}
},
- createNewAlertDefinition: Em.K,
+ /**
+ * Start "Create Alert Definition" wizard
+ * @method createNewAlertDefinition
+ */
+ createNewAlertDefinition: function() {
+ App.router.transitionTo('alertAdd');
+ },
/**
* handler when clicking on "Manage Alert Groups", a popup will show up
http://git-wip-us.apache.org/repos/asf/ambari/blob/531c4384/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 42f8da1..2de90bc 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -839,6 +839,11 @@ Em.I18n.translations = {
'form.validator.alertGroupName':'Invalid Alert Group Name. Only alphanumerics, hyphens, spaces and underscores are allowed.',
'form.validator.configKey.specific':'"{0}" is invalid Key. Only alphanumerics, hyphens, underscores, asterisks and periods are allowed.',
+ 'alerts.add.header': 'Create Alert Definition',
+ 'alerts.add.step1.header': 'Choose Type',
+ 'alerts.add.step2.header': 'Configure',
+ 'alerts.add.step3.header': 'Review',
+
'alerts.fastAccess.popup.header': '{0} critical or warning alerts',
'alerts.fastAccess.popup.body.name': 'Alert name',
'alerts.fastAccess.popup.body.showmore': 'Show all Alerts',
http://git-wip-us.apache.org/repos/asf/ambari/blob/531c4384/ambari-web/app/routes/add_alert_definition_routes.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/add_alert_definition_routes.js b/ambari-web/app/routes/add_alert_definition_routes.js
new file mode 100644
index 0000000..ef44d2a
--- /dev/null
+++ b/ambari-web/app/routes/add_alert_definition_routes.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.
+ */
+
+var App = require('app');
+
+module.exports = App.WizardRoute.extend({
+
+ route: '/alerts/add',
+
+ enter: function (router) {
+ if (App.get('isAdmin')) {
+ Em.run.next(function () {
+ var addAlertDefinitionController = router.get('addAlertDefinitionController');
+ App.router.get('updateController').set('isWorking', false);
+ var popup = App.ModalPopup.show({
+ classNames: ['full-width-modal'],
+ header: Em.I18n.t('alerts.add.header'),
+ bodyClass: App.AddAlertDefinitionView.extend({
+ controllerBinding: 'App.router.addAlertDefinitionController'
+ }),
+ primary: Em.I18n.t('form.cancel'),
+ showFooter: false,
+ secondary: null,
+
+ onPrimary: function () {
+ this.hide();
+ App.router.transitionTo('main.alerts.index');
+ },
+ onClose: function () {
+ this.set('showCloseButton', false); // prevent user to click "Close" many times
+ App.router.get('updateController').set('isWorking', true);
+ router.transitionTo('main.alerts.index');
+ this.hide();
+ },
+ didInsertElement: function () {
+ this.fitHeight();
+ }
+ });
+ addAlertDefinitionController.set('popup', popup);
+ router.transitionTo('step' + addAlertDefinitionController.get('currentStep'));
+ });
+ } else {
+ Em.run.next(function () {
+ App.router.transitionTo('main.alerts');
+ });
+ }
+ },
+
+ step1: Em.Route.extend({
+
+ route: '/step1',
+
+ connectOutlets: function (router) {
+ var controller = router.get('addAlertDefinitionController');
+ controller.setCurrentStep('1');
+ controller.set('content', controller.getDBProperty('content'));
+ controller.connectOutlet('addAlertDefinitionStep1', controller.get('content'));
+ },
+
+ next: function (router) {
+ var controller = router.get('addAlertDefinitionController');
+ controller.setDBProperty('content', controller.get('content'));
+ router.transitionTo('step2');
+ }
+
+ }),
+
+ step2: Em.Route.extend({
+
+ route: '/step2',
+
+ connectOutlets: function (router) {
+ var controller = router.get('addAlertDefinitionController');
+ controller.setCurrentStep('2');
+ controller.set('content', controller.getDBProperty('content'));
+ controller.connectOutlet('addAlertDefinitionStep2', controller.get('content'));
+ },
+
+ back: Em.Router.transitionTo('step1'),
+
+ next: function (router) {
+ var controller = router.get('addAlertDefinitionController');
+ router.transitionTo('step3');
+ }
+
+ }),
+
+ step3: Em.Route.extend({
+
+ route: '/step3',
+
+ connectOutlets: function (router) {
+ var controller = router.get('addAlertDefinitionController');
+ controller.setCurrentStep('3');
+ controller.connectOutlet('addAlertDefinitionStep3', controller.get('content'));
+ },
+
+ back: Em.Router.transitionTo('step2'),
+
+ done: function (router) {
+ var controller = router.get('addAlertDefinitionController');
+ controller.get('popup').hide();
+ controller.setDBProperty('content', {});
+ controller.finish();
+ App.clusterStatus.setClusterStatus({
+ clusterName: controller.get('content.cluster.name'),
+ clusterState: 'DEFAULT',
+ localdb: App.db.data
+ },
+ {
+ alwaysCallback: function () {
+ controller.get('popup').hide();
+ router.transitionTo('main.alerts');
+ location.reload();
+ }
+ });
+ }
+ }),
+
+ gotoStep1: Em.Router.transitionTo('step1'),
+
+ gotoStep2: Em.Router.transitionTo('step2'),
+
+ gotoStep3: Em.Router.transitionTo('step3')
+
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/531c4384/ambari-web/app/routes/main.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js
index b5d353a..53f4140 100644
--- a/ambari-web/app/routes/main.js
+++ b/ambari-web/app/routes/main.js
@@ -348,6 +348,8 @@ module.exports = Em.Route.extend({
}
}),
+ alertAdd: require('routes/add_alert_definition_routes'),
+
admin: Em.Route.extend({
route: '/admin',
enter: function (router, transition) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/531c4384/ambari-web/app/templates/main/alerts/add_alert_definition/add_alert_definition.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/alerts/add_alert_definition/add_alert_definition.hbs b/ambari-web/app/templates/main/alerts/add_alert_definition/add_alert_definition.hbs
new file mode 100644
index 0000000..b12ab7e
--- /dev/null
+++ b/ambari-web/app/templates/main/alerts/add_alert_definition/add_alert_definition.hbs
@@ -0,0 +1,41 @@
+{{!
+* 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.
+}}
+
+<div class="wizard">
+ <div class="container">
+ <div class="container-fluid">
+
+ <div class="row-fluid">
+ <div class="span3">
+ <!--Sidebar content-->
+ <div class="well">
+ <ul class="nav nav-pills nav-stacked">
+ <li class="nav-header">{{t alerts.add.header}}</li>
+ <li {{bindAttr class="isStep1:active view.isStep1Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep1 target="controller"}}>{{t alerts.add.step1.header}}</a></li>
+ <li {{bindAttr class="isStep2:active view.isStep2Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep2 target="controller"}}>{{t alerts.add.step2.header}}</a></li>
+ <li {{bindAttr class="isStep3:active view.isStep3Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep3 target="controller"}}>{{t alerts.add.step3.header}}</a></li>
+ </ul>
+ </div>
+ </div>
+ <div class="wizard-content well span9">
+ {{outlet}}
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/531c4384/ambari-web/app/templates/main/alerts/add_alert_definition/step1.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/alerts/add_alert_definition/step1.hbs b/ambari-web/app/templates/main/alerts/add_alert_definition/step1.hbs
new file mode 100644
index 0000000..9b207cd
--- /dev/null
+++ b/ambari-web/app/templates/main/alerts/add_alert_definition/step1.hbs
@@ -0,0 +1,29 @@
+{{!
+* 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.
+}}
+
+<h2>{{t alerts.add.step1.header}}</h2>
+
+{{#each type in controller.alertDefinitionsTypes}}
+ <a href="#" {{bindAttr class=":btn type.isActive:active"}} {{action selectType type target="controller"}}>
+ <span {{bindAttr class="type.icon"}}></span> {{type.value}}
+ </a>
+{{/each}}
+
+<div class="btn-area">
+ <a class="btn btn-success pull-right" {{bindAttr disabled="isSubmitDisabled"}} {{action next}}>{{t common.next}} →</a>
+</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/531c4384/ambari-web/app/templates/main/alerts/add_alert_definition/step2.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/alerts/add_alert_definition/step2.hbs b/ambari-web/app/templates/main/alerts/add_alert_definition/step2.hbs
new file mode 100644
index 0000000..19bff18
--- /dev/null
+++ b/ambari-web/app/templates/main/alerts/add_alert_definition/step2.hbs
@@ -0,0 +1,26 @@
+{{!
+* 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.
+}}
+
+<h2>{{t alerts.add.step2.header}}</h2>
+
+{{controller.content.selectedType}}
+
+<div class="btn-area">
+ <a class="btn" {{bindAttr disabled="isBackBtnDisabled"}} {{action back}}>← {{t common.back}}</a>
+ <a class="btn btn-success pull-right" {{bindAttr disabled="isSubmitDisabled"}} {{action next}}>{{t common.next}} →</a>
+</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/531c4384/ambari-web/app/templates/main/alerts/add_alert_definition/step3.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/alerts/add_alert_definition/step3.hbs b/ambari-web/app/templates/main/alerts/add_alert_definition/step3.hbs
new file mode 100644
index 0000000..6fc9d2f
--- /dev/null
+++ b/ambari-web/app/templates/main/alerts/add_alert_definition/step3.hbs
@@ -0,0 +1,26 @@
+{{!
+* 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.
+}}
+
+<h2>{{t alerts.add.step3.header}}</h2>
+
+{{controller.content.selectedType}}
+
+<div class="btn-area">
+ <a class="btn" {{bindAttr disabled="isBackBtnDisabled"}} {{action back}}>← {{t common.back}}</a>
+ <a class="btn btn-success pull-right" {{bindAttr disabled="isSubmitDisabled"}} {{action done}}>{{t common.done}} </a>
+</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/531c4384/ambari-web/app/utils/db.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/db.js b/ambari-web/app/utils/db.js
index 707dc42..1cc8fde 100644
--- a/ambari-web/app/utils/db.js
+++ b/ambari-web/app/utils/db.js
@@ -38,6 +38,9 @@ var InitialData = {
'StackUpgrade' : {},
'ReassignMaster' : {},
'AddSecurity': {},
+ 'AddAlertDefinition': {
+ content: {}
+ },
'HighAvailabilityWizard': {},
'RMHighAvailabilityWizard': {},
'RollbackHighAvailabilityWizard': {},
http://git-wip-us.apache.org/repos/asf/ambari/blob/531c4384/ambari-web/app/views.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views.js b/ambari-web/app/views.js
index d31c5b9..da680a7 100644
--- a/ambari-web/app/views.js
+++ b/ambari-web/app/views.js
@@ -46,6 +46,10 @@ require('views/main/alert_definitions_view');
require('views/main/alerts/definition_details_view');
require('views/main/alerts/alert_definitions_actions_view');
require('views/main/alerts/definition_configs_view');
+require('views/main/alerts/add_alert_definition/add_alert_definition_view');
+require('views/main/alerts/add_alert_definition/step1_view');
+require('views/main/alerts/add_alert_definition/step2_view');
+require('views/main/alerts/add_alert_definition/step3_view');
require('views/main/alerts');
require('views/main/alerts/manage_alert_groups_view');
require('views/main/alerts/manage_alert_notifications_view');
http://git-wip-us.apache.org/repos/asf/ambari/blob/531c4384/ambari-web/app/views/main/alerts/add_alert_definition/add_alert_definition_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/alerts/add_alert_definition/add_alert_definition_view.js b/ambari-web/app/views/main/alerts/add_alert_definition/add_alert_definition_view.js
new file mode 100644
index 0000000..dde686c
--- /dev/null
+++ b/ambari-web/app/views/main/alerts/add_alert_definition/add_alert_definition_view.js
@@ -0,0 +1,41 @@
+/**
+ * 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.
+ */
+
+var App = require('app');
+
+App.AddAlertDefinitionView = Em.View.extend({
+
+ templateName: require('templates/main/alerts/add_alert_definition/add_alert_definition'),
+
+ isStep1Disabled: function () {
+ return this.isStepDisabled(1);
+ }.property('controller.isStepDisabled.@each.value').cacheable(),
+
+ isStep2Disabled: function () {
+ return this.isStepDisabled(2);
+ }.property('controller.isStepDisabled.@each.value').cacheable(),
+
+ isStep3Disabled: function () {
+ return this.isStepDisabled(3);
+ }.property('controller.isStepDisabled.@each.value').cacheable(),
+
+ isStepDisabled: function (index) {
+ return this.get('controller.isStepDisabled').findProperty('step', index).get('value');
+ }
+
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/531c4384/ambari-web/app/views/main/alerts/add_alert_definition/step1_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/alerts/add_alert_definition/step1_view.js b/ambari-web/app/views/main/alerts/add_alert_definition/step1_view.js
new file mode 100644
index 0000000..d55d20f
--- /dev/null
+++ b/ambari-web/app/views/main/alerts/add_alert_definition/step1_view.js
@@ -0,0 +1,29 @@
+/**
+ * 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.
+ */
+
+var App = require('app');
+
+App.AddAlertDefinitionStep1View = Em.View.extend({
+
+ templateName: require('templates/main/alerts/add_alert_definition/step1'),
+
+ didInsertElement: function() {
+ this.get('controller').loadStep();
+ }
+
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/531c4384/ambari-web/app/views/main/alerts/add_alert_definition/step2_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/alerts/add_alert_definition/step2_view.js b/ambari-web/app/views/main/alerts/add_alert_definition/step2_view.js
new file mode 100644
index 0000000..548f961
--- /dev/null
+++ b/ambari-web/app/views/main/alerts/add_alert_definition/step2_view.js
@@ -0,0 +1,25 @@
+/**
+ * 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.
+ */
+
+var App = require('app');
+
+App.AddAlertDefinitionStep2View = Em.View.extend({
+
+ templateName: require('templates/main/alerts/add_alert_definition/step2')
+
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/531c4384/ambari-web/app/views/main/alerts/add_alert_definition/step3_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/alerts/add_alert_definition/step3_view.js b/ambari-web/app/views/main/alerts/add_alert_definition/step3_view.js
new file mode 100644
index 0000000..9ed836a
--- /dev/null
+++ b/ambari-web/app/views/main/alerts/add_alert_definition/step3_view.js
@@ -0,0 +1,25 @@
+/**
+ * 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.
+ */
+
+var App = require('app');
+
+App.AddAlertDefinitionStep3View = Em.View.extend({
+
+ templateName: require('templates/main/alerts/add_alert_definition/step3')
+
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/531c4384/ambari-web/test/controllers/main/alerts/add_alert_definition/step1_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/alerts/add_alert_definition/step1_controller_test.js b/ambari-web/test/controllers/main/alerts/add_alert_definition/step1_controller_test.js
new file mode 100644
index 0000000..322c08a
--- /dev/null
+++ b/ambari-web/test/controllers/main/alerts/add_alert_definition/step1_controller_test.js
@@ -0,0 +1,74 @@
+/**
+ * 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.
+ */
+
+var App = require('app');
+require('controllers/main/alerts/add_alert_definition/step1_controller');
+
+var controller;
+
+describe('App.AddAlertDefinitionStep1Controller', function () {
+
+ beforeEach(function () {
+ controller = App.AddAlertDefinitionStep1Controller.create({content: {}});
+ });
+
+ describe('#selectType', function() {
+
+ beforeEach(function () {
+ controller.get('alertDefinitionsTypes').setEach('isActive', false);
+ });
+
+ it('should set isActive for selected type', function () {
+ var e = {context: {value: 'PORT'}};
+ controller.selectType(e);
+ expect(controller.get('alertDefinitionsTypes').findProperty('value', 'PORT').get('isActive')).to.be.true;
+ });
+
+ });
+
+ describe('#loadStep', function () {
+
+ beforeEach(function () {
+ controller.set('content.selectedType', 'PORT');
+
+ });
+
+ it('should set predefined type', function () {
+ controller.loadStep();
+ expect(controller.get('alertDefinitionsTypes').findProperty('value', 'PORT').get('isActive')).to.be.true;
+ });
+
+ });
+
+ describe('#isSubmitDisabled', function () {
+
+ beforeEach(function () {
+ controller.get('alertDefinitionsTypes').setEach('isActive', false);
+ });
+
+ it('should be based on isActive', function () {
+
+ expect(controller.get('isSubmitDisabled')).to.be.true;
+ controller.get('alertDefinitionsTypes').objectAt(0).set('isActive', true);
+ expect(controller.get('isSubmitDisabled')).to.be.false;
+
+ });
+
+ });
+
+});
\ No newline at end of file