You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ab...@apache.org on 2014/11/12 13:19:52 UTC
ambari git commit: AMBARI-8293 Create mock for Ambari Web: Admin:
Stack and upgrade page. (ababiichuk)
Repository: ambari
Updated Branches:
refs/heads/trunk 512c1dfcf -> c234e9781
AMBARI-8293 Create mock for Ambari Web: Admin: Stack and upgrade page. (ababiichuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c234e978
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c234e978
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c234e978
Branch: refs/heads/trunk
Commit: c234e978106364c63258a9664c5d7e1e167a3a6c
Parents: 512c1df
Author: aBabiichuk <ab...@cybervisiontech.com>
Authored: Wed Nov 12 13:46:22 2014 +0200
Committer: aBabiichuk <ab...@cybervisiontech.com>
Committed: Wed Nov 12 14:19:40 2014 +0200
----------------------------------------------------------------------
ambari-web/app/assets/test/tests.js | 2 +-
ambari-web/app/controllers.js | 6 +-
.../app/controllers/main/admin/repositories.js | 161 ------------
.../main/admin/stack_and_upgrade_controller.js | 37 +++
.../stack_version_details_controller.js | 33 ---
.../stack_upgrade/stack_versions_controller.js | 63 -----
.../stack_version_details_controller.js | 33 +++
.../stack_versions/stack_versions_controller.js | 63 +++++
.../controllers/main/service/add_controller.js | 10 +-
ambari-web/app/messages.js | 2 +
ambari-web/app/routes/main.js | 10 +-
ambari-web/app/styles/application.less | 5 +
.../app/templates/main/admin/repositories.hbs | 121 ---------
.../templates/main/admin/stack_and_upgrade.hbs | 49 ++++
ambari-web/app/views.js | 2 +-
ambari-web/app/views/main/admin.js | 6 +-
ambari-web/app/views/main/admin/repositories.js | 246 -------------------
.../views/main/admin/stack_and_upgrade_view.js | 25 ++
ambari-web/app/views/main/menu.js | 6 +-
.../controllers/main/admin/repositories_test.js | 86 -------
.../main/admin/stack_and_upgrade_test.js | 43 ++++
21 files changed, 281 insertions(+), 728 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/c234e978/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 93c61dd..09cc4e8 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -44,7 +44,7 @@ var files = ['test/init_model_test',
'test/controllers/global/update_controller_test',
'test/controllers/global/configuration_controller_test',
'test/controllers/main/app_contoller_test',
- 'test/controllers/main/admin/repositories_test',
+ 'test/controllers/main/admin/stack_and_upgrade_test',
'test/controllers/main/admin/serviceAccounts_controller_test',
'test/controllers/main/admin/highAvailability_controller_test',
'test/controllers/main/admin/highAvailability/progress_controller_test',
http://git-wip-us.apache.org/repos/asf/ambari/blob/c234e978/ambari-web/app/controllers.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers.js b/ambari-web/app/controllers.js
index 146840f..1b8a96c 100644
--- a/ambari-web/app/controllers.js
+++ b/ambari-web/app/controllers.js
@@ -51,10 +51,10 @@ require('controllers/main/admin/highAvailability/resourceManager/step1_controlle
require('controllers/main/admin/highAvailability/resourceManager/step2_controller');
require('controllers/main/admin/highAvailability/resourceManager/step3_controller');
require('controllers/main/admin/highAvailability/resourceManager/step4_controller');
-require('controllers/main/admin/repositories');
+require('controllers/main/admin/stack_and_upgrade_controller');
require('controllers/main/admin/stack_upgrade_controller');
-require('controllers/main/admin/stack_upgrade/stack_versions_controller');
-require('controllers/main/admin/stack_upgrade/stack_version_details_controller');
+require('controllers/main/admin/stack_versions/stack_versions_controller');
+require('controllers/main/admin/stack_versions/stack_version_details_controller');
require('controllers/main/admin/serviceAccounts_controller');
require('controllers/main/admin/advanced');
require('utils/polling');
http://git-wip-us.apache.org/repos/asf/ambari/blob/c234e978/ambari-web/app/controllers/main/admin/repositories.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/repositories.js b/ambari-web/app/controllers/main/admin/repositories.js
deleted file mode 100644
index dcfc63b..0000000
--- a/ambari-web/app/controllers/main/admin/repositories.js
+++ /dev/null
@@ -1,161 +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.
- */
-
-var App = require('app');
-var stringUtils = require('utils/string_utils');
-
-App.MainAdminRepositoriesController = Em.Controller.extend({
- name: 'mainAdminRepositoriesController',
- services: [],
- allRepos: [],
- upgradeVersion: '',
- /**
- * get the newest version of HDP from server
- */
- updateUpgradeVersion: function () {
- if (App.router.get('clusterController.isLoaded')) {
- App.ajax.send({
- name: 'cluster.update_upgrade_version',
- data: {
- stackName: App.get('currentStackName')
- },
- sender: this,
- success: 'updateUpgradeVersionSuccessCallback',
- error: 'updateUpgradeVersionErrorCallback'
- });
- }
- }.observes('App.router.clusterController.isLoaded', 'App.currentStackVersion', 'App.router.mainServiceController.content.length'),
-
- updateUpgradeVersionSuccessCallback: function (data) {
- var upgradeVersion = this.get('upgradeVersion') || App.get('defaultStackVersion');
- var currentVersion = App.get('currentStackVersionNumber');
- var stackNamePrefix = App.get('currentStackName') + '-';
- upgradeVersion = upgradeVersion.replace(stackNamePrefix, '');
- var activeVersions = data.items.filterProperty('Versions.active');
- activeVersions.mapProperty('Versions.stack_version').forEach(function (version) {
- upgradeVersion = (stringUtils.compareVersions(upgradeVersion, version) === -1) ? version : upgradeVersion;
- });
- var currentStack = data.items.findProperty('Versions.stack_version', currentVersion);
- var upgradeStack = data.items.findProperty('Versions.stack_version', upgradeVersion);
- var minUpgradeVersion = upgradeStack.Versions.min_upgrade_version;
- if (minUpgradeVersion && (stringUtils.compareVersions(minUpgradeVersion, currentVersion) === 1)) {
- upgradeVersion = currentVersion;
- upgradeStack = currentStack;
- }
- upgradeVersion = stackNamePrefix + upgradeVersion;
- this.set('upgradeVersion', upgradeVersion);
- if (currentStack && upgradeStack) {
- this.parseServicesInfo(currentStack, upgradeStack);
- }
- else {
- console.log('HDP stack doesn\'t have services with defaultStackVersion');
- }
- },
-
- updateUpgradeVersionErrorCallback: function (request, ajaxOptions, error) {
- console.log('Error message is: ' + request.responseText);
- console.log('HDP stack doesn\'t have services with defaultStackVersion');
- },
-
- /**
- * get the installed repositories of HDP from server
- */
- loadRepositories: function () {
- if (App.router.get('clusterController.isLoaded')) {
- var nameVersionCombo = App.get('currentStackVersion');
- var stackName = nameVersionCombo.split('-')[0];
- var stackVersion = nameVersionCombo.split('-')[1];
- App.ajax.send({
- name: 'cluster.load_repositories',
- sender: this,
- data: {
- stackName: stackName,
- stackVersion: stackVersion
- },
- success: 'loadRepositoriesSuccessCallback',
- error: 'loadRepositoriesErrorCallback'
- });
- }
- }.observes('App.router.clusterController.isLoaded'),
-
- loadRepositoriesSuccessCallback: function (data) {
- var allRepos = [];
- data.items.forEach(function (os) {
- os.repositories.forEach(function (repository) {
- var osType = repository.Repositories.os_type;
- var repo = Em.Object.create({
- baseUrl: repository.Repositories.base_url,
- osType: osType,
- repoId: repository.Repositories.repo_id,
- repoName : repository.Repositories.repo_name,
- stackName : repository.Repositories.stack_name,
- stackVersion : repository.Repositories.stack_version,
- isFirst: false
- });
- var group = allRepos.findProperty('name', osType);
- if (!group) {
- group = {
- name: osType,
- repositories: []
- };
- repo.set('isFirst', true);
- allRepos.push(group);
- }
- group.repositories.push(repo);
- });
- }, this);
- allRepos.stackVersion = App.get('currentStackVersionNumber');
- this.set('allRepos', allRepos);
- },
-
- loadRepositoriesErrorCallback: function (request, ajaxOptions, error) {
- console.log('Error message is: ' + request.responseText);
- },
-
- /**
- * parse services info(versions, description) by version
- */
- parseServicesInfo: function (currentStack, upgradeStack) {
- var result = [];
- if (currentStack.stackServices.length || upgradeStack.stackServices.length) {
- // loop through all the service components
- currentStack.stackServices.forEach(function(currentStackService) {
- var stackService = App.StackService.find().findProperty('serviceName', currentStackService.StackServices.service_name);
- if (!!stackService) {
- var myService = Em.Object.create({
- serviceName: stackService.get('serviceName'),
- displayName: stackService.get('displayNameOnSelectServicePage'),
- isSelected: true,
- isInstalled: false,
- isHidden: stackService.get('isHiddenOnSelectServicePage'),
- description: stackService.get('comments'),
- version: stackService.get('serviceVersion'),
- newVersion: ''
- });
- // it's possible that there is no corresponding service in the new stack
- var matchedService = upgradeStack.stackServices.findProperty("StackServices.service_name", stackService.get('serviceName'));
- if (matchedService) {
- myService.newVersion = matchedService.StackServices.service_version;
- }
- result.push(myService);
- }
- }, this);
- }
- this.set('services', result);
- }
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/c234e978/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js b/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
new file mode 100644
index 0000000..7549e6b
--- /dev/null
+++ b/ambari-web/app/controllers/main/admin/stack_and_upgrade_controller.js
@@ -0,0 +1,37 @@
+/**
+ * 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.MainAdminStackAndUpgradeController = Em.Controller.extend({
+ name: 'mainAdminStackAndUpgradeController',
+
+ serviceToInstall: null,
+
+ services: function() {
+ return App.StackService.find().map(function(s) {
+ s.set('isInstalled', App.Service.find().someProperty('id', s.get('serviceName')));
+ return s;
+ });
+ }.property('App.router.clusterController.isLoaded'),
+
+ goToAddService: function (event) {
+ this.set('serviceToInstall', event.context);
+ App.get('router').transitionTo('main.serviceAdd');
+ }
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/c234e978/ambari-web/app/controllers/main/admin/stack_upgrade/stack_version_details_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/stack_upgrade/stack_version_details_controller.js b/ambari-web/app/controllers/main/admin/stack_upgrade/stack_version_details_controller.js
deleted file mode 100644
index 365b171..0000000
--- a/ambari-web/app/controllers/main/admin/stack_upgrade/stack_version_details_controller.js
+++ /dev/null
@@ -1,33 +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.
- */
-
-var App = require('app');
-
-App.MainStackVersionsDetailsController = Em.Controller.extend({
- name: 'mainStackVersionsDetailsController',
-
- content: null,
-
- totalHostCount: function() {
- return App.get('allHostNames.length');
- }.property('App.allHostNames.length'),
-
- //TODO method that will perform stack upgrade on host
- installStackVersion: Em.K
-
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/c234e978/ambari-web/app/controllers/main/admin/stack_upgrade/stack_versions_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/stack_upgrade/stack_versions_controller.js b/ambari-web/app/controllers/main/admin/stack_upgrade/stack_versions_controller.js
deleted file mode 100644
index 7286f58..0000000
--- a/ambari-web/app/controllers/main/admin/stack_upgrade/stack_versions_controller.js
+++ /dev/null
@@ -1,63 +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.
- */
-
-var App = require('app');
-
-App.MainStackVersionsController = Em.ArrayController.extend({
- name: 'mainStackVersionsController',
-
- content: App.StackVersion.find(),
- mockUrl: '/data/stack_versions/stack_version_all.json',
- realUrl: function () {
- return App.apiPrefix + '/clusters/' + App.get('clusterName') + '/stack_versions&minimal_response=true';
- }.property('App.clusterName'),
-
- /**
- * load all data components required by stack version table
- * @return {*}
- */
- load: function () {
- var dfd = $.Deferred();
- var self = this;
- this.loadStackVersionsToModel().done(function () {
- self.set('dataIsLoaded', true);
- dfd.resolve();
- });
- return dfd.promise();
- },
-
- /**
- * get stack versions from server and push it to model
- * @return {*}
- */
- loadStackVersionsToModel: function () {
- var dfd = $.Deferred();
-
- App.HttpClient.get(this.getUrl(), App.stackVersionMapper, {
- complete: function () {
- dfd.resolve();
- }
- });
- return dfd.promise();
- },
-
- getUrl: function () {
- return App.get('testMode') ? this.get('mockUrl') : this.get('realUrl');
- }
-
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/c234e978/ambari-web/app/controllers/main/admin/stack_versions/stack_version_details_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/stack_versions/stack_version_details_controller.js b/ambari-web/app/controllers/main/admin/stack_versions/stack_version_details_controller.js
new file mode 100644
index 0000000..365b171
--- /dev/null
+++ b/ambari-web/app/controllers/main/admin/stack_versions/stack_version_details_controller.js
@@ -0,0 +1,33 @@
+/**
+ * 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.MainStackVersionsDetailsController = Em.Controller.extend({
+ name: 'mainStackVersionsDetailsController',
+
+ content: null,
+
+ totalHostCount: function() {
+ return App.get('allHostNames.length');
+ }.property('App.allHostNames.length'),
+
+ //TODO method that will perform stack upgrade on host
+ installStackVersion: Em.K
+
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/c234e978/ambari-web/app/controllers/main/admin/stack_versions/stack_versions_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/stack_versions/stack_versions_controller.js b/ambari-web/app/controllers/main/admin/stack_versions/stack_versions_controller.js
new file mode 100644
index 0000000..7286f58
--- /dev/null
+++ b/ambari-web/app/controllers/main/admin/stack_versions/stack_versions_controller.js
@@ -0,0 +1,63 @@
+/**
+ * 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.MainStackVersionsController = Em.ArrayController.extend({
+ name: 'mainStackVersionsController',
+
+ content: App.StackVersion.find(),
+ mockUrl: '/data/stack_versions/stack_version_all.json',
+ realUrl: function () {
+ return App.apiPrefix + '/clusters/' + App.get('clusterName') + '/stack_versions&minimal_response=true';
+ }.property('App.clusterName'),
+
+ /**
+ * load all data components required by stack version table
+ * @return {*}
+ */
+ load: function () {
+ var dfd = $.Deferred();
+ var self = this;
+ this.loadStackVersionsToModel().done(function () {
+ self.set('dataIsLoaded', true);
+ dfd.resolve();
+ });
+ return dfd.promise();
+ },
+
+ /**
+ * get stack versions from server and push it to model
+ * @return {*}
+ */
+ loadStackVersionsToModel: function () {
+ var dfd = $.Deferred();
+
+ App.HttpClient.get(this.getUrl(), App.stackVersionMapper, {
+ complete: function () {
+ dfd.resolve();
+ }
+ });
+ return dfd.promise();
+ },
+
+ getUrl: function () {
+ return App.get('testMode') ? this.get('mockUrl') : this.get('realUrl');
+ }
+
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/c234e978/ambari-web/app/controllers/main/service/add_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/add_controller.js b/ambari-web/app/controllers/main/service/add_controller.js
index 1b3f0e0..190940e 100644
--- a/ambari-web/app/controllers/main/service/add_controller.js
+++ b/ambari-web/app/controllers/main/service/add_controller.js
@@ -29,6 +29,9 @@ App.AddServiceController = App.WizardController.extend({
*/
hideBackButton: true,
+ serviceToInstall: function() {
+ return App.get('router.mainAdminStackAndUpgradeController.serviceToInstall');
+ }.property('App.router.mainAdminStackAndUpgradeController.serviceToInstall'),
/**
* All wizards data will be stored in this variable
*
@@ -77,17 +80,20 @@ App.AddServiceController = App.WizardController.extend({
};
App.StackService.find().forEach(function (item) {
var isInstalled = App.Service.find().someProperty('id', item.get('serviceName'));
- item.set('isSelected', isInstalled);
+ var isSelected = item.get('serviceName') == this.get('serviceToInstall');
+ item.set('isSelected', isInstalled || isSelected);
item.set('isInstalled', isInstalled);
if (isInstalled) {
services.selectedServices.push(item.get('serviceName'));
services.installedServices.push(item.get('serviceName'));
+ } else if(isSelected) {
+ services.selectedServices.push(item.get('serviceName'));
}
}, this);
this.setDBProperty('services', services);
} else {
App.StackService.find().forEach(function (item) {
- var isSelected = services.selectedServices.contains(item.get('serviceName'));
+ var isSelected = services.selectedServices.contains(item.get('serviceName')) || item.get('serviceName') == this.get('serviceToInstall');
var isInstalled = services.installedServices.contains(item.get('serviceName'));
item.set('isSelected', isSelected || (this.get("currentStep") == "1" ? isInstalled : isSelected));
item.set('isInstalled', isInstalled);
http://git-wip-us.apache.org/repos/asf/ambari/blob/c234e978/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 4464534..c57a854 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1190,6 +1190,8 @@ Em.I18n.translations = {
'admin.stackVersions.datails.hosts.btn.nothing': "Nothing to Install",
'admin.stackVersions.datails.hosts.btn.na': "Status not available",
+ 'admin.stackUpgrade.title': "Stack and upgrade",
+
'services.service.start':'Start',
'services.service.stop':'Stop',
'services.service.metrics':'Service Metrics',
http://git-wip-us.apache.org/repos/asf/ambari/blob/c234e978/ambari-web/app/routes/main.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js
index e66fde3..11f5e5b 100644
--- a/ambari-web/app/routes/main.js
+++ b/ambari-web/app/routes/main.js
@@ -361,7 +361,7 @@ module.exports = Em.Route.extend({
router.transitionTo('admin' + controller.get('category').capitalize());
}, */
route: '/',
- redirectsTo: 'adminRepositories'
+ redirectsTo: 'stackAndUpgrade'
}),
adminAuthentication: Em.Route.extend({
@@ -483,11 +483,11 @@ module.exports = Em.Route.extend({
adminAddSecurity: require('routes/add_security')
}),
- adminRepositories: Em.Route.extend({
- route: '/repositories',
+ stackAndUpgrade: Em.Route.extend({
+ route: '/stack',
connectOutlets: function (router) {
- router.set('mainAdminController.category', "repositories");
- router.get('mainAdminController').connectOutlet('mainAdminRepositories');
+ router.set('mainAdminController.category', "stackAndUpgrade");
+ router.get('mainAdminController').connectOutlet('mainAdminStackAndUpgrade');
}
}),
adminStackVersions: Em.Route.extend({
http://git-wip-us.apache.org/repos/asf/ambari/blob/c234e978/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index d955e15..6e15b97 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -7128,3 +7128,8 @@ i.icon-asterisks {
}
}
}
+
+.path-link {
+ white-space: nowrap;
+ cursor: pointer;
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/c234e978/ambari-web/app/templates/main/admin/repositories.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/repositories.hbs b/ambari-web/app/templates/main/admin/repositories.hbs
deleted file mode 100644
index b38b28c..0000000
--- a/ambari-web/app/templates/main/admin/repositories.hbs
+++ /dev/null
@@ -1,121 +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.
-}}
-
-<div class="admin-cluster">
- <div class="header">
- <strong>{{t admin.cluster.stackVersion}}: {{App.currentStackVersion}}
- {{#if App.supports.stackUpgrade}}
- (<a href="#" {{bindAttr class="view.isUpgradeAvailable::inactive"}}{{action "upgradeStack"}}>
- {{#if view.isUpgradeAvailable}}
- {{t admin.cluster.upgradeAvailable}}: {{upgradeVersion}}
- {{else}}
- {{t admin.cluster.upgradeUnavailable}}
- {{/if}}
- </a>)
- {{/if}}
- </strong>
- </div>
- <table class="table table-bordered table-striped">
- <thead>
- <tr>
- <th>{{t common.service}}</th>
- <th>{{t common.version}}</th>
- <th>{{t common.description}}</th>
- </tr>
- </thead>
- <tbody>
- {{#each service in services}}
- {{#unless service.isHidden}}
- <tr>
- <td>{{service.displayName}}</td>
- <td>{{service.version}}</td>
- <td>{{{service.description}}}</td>
- </tr>
- {{/unless}}
- {{/each}}
- </tbody>
- </table>
-
- <div class="header">
- <strong>{{t admin.cluster.repositories.repositories}}</strong>
- </div>
- <ul class="nav nav-tabs">
- <li class="active">
- <a href="javascript:void(null);">{{view.allRepositoriesGroups.stackVersion}}</a>
- </li>
- </ul>
-
- <div class="repositories-table">
- <div class="thead">
- <div class="th os-th">{{t common.os}}</div>
- <div class="th name-th">{{t common.name}}</div>
- <div class="th url-th">{{t installer.step1.advancedRepo.localRepo.column.baseUrl}}</div>
- </div>
- <div class="tbody">
- {{#each repoGroup in view.allRepositoriesGroups}}
- <div class="trow">
- <div class="os-td">
- <label>
- <span class="os">{{repoGroup.name}}</span>
- </label>
- </div>
- <div style="width:89%">
- {{#each repository in repoGroup.repositories}}
- <div class="sub-trow">
- <div class="name-td">{{repository.repoId}}</div>
- <!--edit mode for current url-->
- {{#if repository.onEdit}}
- <div {{bindAttr class=":url-td repository.empty-error:textfield-error repository.invalid-error:textfield-error"}}>
- {{view Ember.TextField valueBinding="repository.baseUrl"}}
- </div>
- <div class="clear-td">
- {{#if repository.clearAll}}
- <a {{action "clearGroupLocalRepository" repository target="view" }}>
- <i class="icon-remove-sign"></i>
- </a>
- {{/if}}
- </div>
- <div class="edit-buttons-td">
- <a class="btn" {{action doCancel repository target="view"}}>{{t common.cancel}}</a>
- </div>
- <div class="edit-buttons-td">
- {{#if repository.empty-error}}
- <a class="btn btn-primary" disabled="disabled">{{t common.save}}</a>
- {{else}}
- <a class="btn btn-primary" {{action saveRepoUrls repository target="view"}}>{{t common.save}}</a>
- {{/if}}
- </div>
- <!--non-edit mode for current url-->
- {{else}}
- <div class="url-text-td">
- {{repository.baseUrl}}
- </div>
- <div class="edit-td">
- <a {{action "onEditClick" repository target="view" }}>
- <i class="icon-edit"></i> {{t common.edit}}
- </a>
- </div>
- {{/if}}
- </div>
- {{/each}}
- </div>
- </div>
- {{/each}}
- </div>
- </div>
-</div>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/c234e978/ambari-web/app/templates/main/admin/stack_and_upgrade.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/stack_and_upgrade.hbs b/ambari-web/app/templates/main/admin/stack_and_upgrade.hbs
new file mode 100644
index 0000000..f40519f
--- /dev/null
+++ b/ambari-web/app/templates/main/admin/stack_and_upgrade.hbs
@@ -0,0 +1,49 @@
+{{!
+* 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="admin-cluster">
+ <div class="header">
+ <strong>{{t common.stack}}: {{App.currentStackVersion}}</strong>
+ </div>
+ <table class="table table-bordered table-striped">
+ <thead>
+ <tr>
+ <th>{{t common.service}}</th>
+ <th>{{t common.version}}</th>
+ <th>{{t common.status}}</th>
+ <th>{{t common.description}}</th>
+ </tr>
+ </thead>
+ <tbody>
+ {{#each service in services}}
+ <tr>
+ <td>{{service.displayName}}</td>
+ <td>{{service.stackVersion}}</td>
+ <td>
+ {{#if service.isInstalled}}
+ <span class="label label-success">{{t common.installed}}</span>
+ {{else}}
+ <a class="path-link" {{action goToAddService service.serviceName target="controller"}}>{{t services.service.add}}</a>
+ {{/if}}
+ </td>
+ <td>{{{service.comments}}}</td>
+ </tr>
+ {{/each}}
+ </tbody>
+ </table>
+</div>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/c234e978/ambari-web/app/views.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views.js b/ambari-web/app/views.js
index ff40a9f..0009cfa 100644
--- a/ambari-web/app/views.js
+++ b/ambari-web/app/views.js
@@ -92,9 +92,9 @@ require('views/main/admin/highAvailability/resourceManager/step1_view');
require('views/main/admin/highAvailability/resourceManager/step2_view');
require('views/main/admin/highAvailability/resourceManager/step3_view');
require('views/main/admin/highAvailability/resourceManager/step4_view');
-require('views/main/admin/repositories');
require('views/main/admin/serviceAccounts_view');
require('views/main/admin/stack_upgrade');
+require('views/main/admin/stack_and_upgrade_view');
require('views/main/admin/stack_versions/stack_version_view');
require('views/main/admin/stack_versions/stack_version_details_view');
require('views/main/admin/advanced');
http://git-wip-us.apache.org/repos/asf/ambari/blob/c234e978/ambari-web/app/views/main/admin.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin.js b/ambari-web/app/views/main/admin.js
index 7e14946..b262f35 100644
--- a/ambari-web/app/views/main/admin.js
+++ b/ambari-web/app/views/main/admin.js
@@ -24,9 +24,9 @@ App.MainAdminView = Em.View.extend({
categories: function() {
var items = [];
items.push({
- name: 'repositories',
- url: 'adminRepositories',
- label: Em.I18n.t('common.repositories')
+ name: 'stackAndUpgrade',
+ url: 'stackAndUpgrade',
+ label: Em.I18n.t('admin.stackUpgrade.title')
});
if (App.get('supports.stackUpgrade')) {
items.push({
http://git-wip-us.apache.org/repos/asf/ambari/blob/c234e978/ambari-web/app/views/main/admin/repositories.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/repositories.js b/ambari-web/app/views/main/admin/repositories.js
deleted file mode 100644
index db234bf..0000000
--- a/ambari-web/app/views/main/admin/repositories.js
+++ /dev/null
@@ -1,246 +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.
- */
-
-var App = require('app');
-var stringUtils = require('utils/string_utils');
-
-App.MainAdminRepositoriesView = Em.View.extend({
- templateName: require('templates/main/admin/repositories'),
-
- isUpgradeAvailable: function(){
- return stringUtils.compareVersions(this.get('controller.upgradeVersion').replace(App.get('currentStackName') + '-', ''), App.get('currentStackVersionNumber')) === 1;
- }.property('controller.upgradeVersion', 'App.currentStackName','App.currentStackVersionNumber'),
-
- didInsertElement: function () {
- this.get('controller').loadRepositories();
- },
-
- /**
- * List of all repo-groups
- * @type {Object[][]}
- */
- allRepositoriesGroups: function () {
- var repos = this.get('controller.allRepos');
- var reposGroup = [];
- var repositories = [];
- reposGroup.set('stackVersion', App.get('currentStackVersionNumber'));
- if (repos) {
- repos.forEach(function (group) {
- group.repositories.forEach (function(repo) {
- var cur_repo = Em.Object.create({
- 'repoId': repo.repoId,
- 'id': repo.repoId + '-' + repo.osType,
- 'repoName' : repo.repoName,
- 'stackName' : repo.stackName,
- 'stackVersion' : repo.stackVersion,
- 'baseUrl': repo.baseUrl,
- 'originalBaseUrl': repo.baseUrl,
- 'osType': repo.osType,
- 'onEdit': false,
- 'empty-error': !repo.baseUrl,
- 'undo': false,
- 'clearAll': repo.baseUrl
- });
- var cur_group = reposGroup.findProperty('name', group.name);
- if (!cur_group) {
- var cur_group = Ember.Object.create({
- name: group.name,
- repositories: []
- });
- reposGroup.push(cur_group);
- }
- cur_group.repositories.push(cur_repo);
- repositories.push(cur_repo);
- });
- });
- }
- this.set('allRepos', repositories);
- return reposGroup;
- }.property('controller.allRepos'),
-
- /**
- * Onclick handler for edit action of each repo, enter edit mode
- * @param {object} event
- */
- onEditClick:function (event) {
- var targetRepo = this.get('allRepos').findProperty('id', event.context.get('id'));
- if (targetRepo) {
- targetRepo.set('onEdit', true);
- }
- },
-
- /**
- * Onclick handler for undo action of each repo group
- * @method undoGroupLocalRepository
- * @param {object} event
- */
- undoGroupLocalRepository: function (event) {
- this.doActionForGroupLocalRepository(event, 'originalBaseUrl');
- },
-
- /**
- * Handler for clear icon click
- * @method clearGroupLocalRepository
- * @param {object} event
- */
- clearGroupLocalRepository: function (event) {
- this.doActionForGroupLocalRepository(event, '');
- },
-
- /**
- * Common handler for repo groups actions
- * @method doActionForGroupLocalRepository
- * @param {object} event
- * @param {string} newBaseUrlField
- */
- doActionForGroupLocalRepository: function (event, newBaseUrlField) {
- var targetRepo = this.get('allRepos').findProperty('id', event.context.get('id'));
- if (targetRepo) {
- targetRepo.set('baseUrl', Em.isEmpty(newBaseUrlField) ? '' : Em.get(targetRepo, newBaseUrlField));
- }
- },
-
- /**
- * Handler when editing any repo group BaseUrl
- * @method editGroupLocalRepository
- */
- editGroupLocalRepository: function (event) {
- var repos = this.get('allRepos');
- repos.forEach(function (targetRepo) {
- targetRepo.set('undo', targetRepo.get('baseUrl') != targetRepo.get('originalBaseUrl'));
- targetRepo.set('clearAll', targetRepo.get('baseUrl'));
- targetRepo.set('empty-error', !targetRepo.get('baseUrl'));
-
- });
- }.observes('allRepos.@each.baseUrl'),
-
- /**
- * onSuccess callback for save Repo URL.
- */
- doSaveRepoUrlsSuccessCallback: function (response, request, data) {
- var id = data.repoId + '-' + data.osType;
- console.log('Success in check Repo URL. data repoId+osType: ' + id);
- var targetRepo = this.get('allRepos').findProperty('id', id);
- if (!targetRepo) {
- return;
- } else {
-
- var modalCloseHandler = function() {
- this.hide();
- targetRepo.set('baseUrl', data.data.Repositories.base_url);
- targetRepo.set('originalBaseUrl', data.data.Repositories.base_url);
- targetRepo.set('onEdit', false);
- };
-
- App.ModalPopup.show({
- header: Em.I18n.t('admin.cluster.repositories.popup.header.success'),
- secondary: null,
- onPrimary: modalCloseHandler,
- onClose: modalCloseHandler,
- message: Em.I18n.t('admin.cluster.repositories.popup.body.success'),
- bodyClass: Em.View.extend({
- template: Em.Handlebars.compile('<div class="alert alert-success">{{{message}}}</div>')
- })
- })
- }
- },
-
- /**
- * onError callback for save Repo URL.
- */
- doSaveRepoUrlsErrorCallback: function (request, ajaxOptions, error, data) {
- console.log('Error in check Repo URL. The baseURL sent is: ' + data.data);
- var self = this;
- var id = data.url.split('/')[10] + '-' + data.url.split('/')[8];
- var targetRepo = this.get('allRepos').findProperty('id', id);
- if (!targetRepo) {
- return;
- } else {
- App.ModalPopup.show({
- header: Em.I18n.t('admin.cluster.repositories.popup.header.fail'),
- primary: Em.I18n.t('common.saveAnyway'),
- secondary: Em.I18n.t('common.revert'),
- third: Em.I18n.t('common.cancel'),
- onPrimary: function () {
- // save anyway: Go ahead and save with Repo URL validation turned off and close Dialog when done.
- this.hide();
- self.doSaveRepoUrls(id, false);
- },
- onSecondary: function () {
- // Revert: Close dialog, revert URL value, go back to non-Edit mode
- this.hide();
- targetRepo.set('baseUrl', targetRepo.get('originalBaseUrl'));
- targetRepo.set('onEdit', false);
- },
- onThird: function () {
- // cancel: Close dialog but stay in Edit mode
- this.hide();
- },
- message: Em.I18n.t('admin.cluster.repositories.popup.body.fail'),
- bodyClass: Em.View.extend({
- template: Em.Handlebars.compile('<div class="alert alert-warning">{{{message}}}</div>')
- })
- })
- }
- },
-
- /**
- * Check validation and Save the customized local urls
- */
- doSaveRepoUrls: function (id, verifyBaseUrl) {
- var targetRepo = this.get('allRepos').findProperty('id', id);
- var verifyBaseUrl = verifyBaseUrl;
- App.ajax.send({
- name: 'wizard.advanced_repositories.valid_url',
- sender: this,
- data: {
- stackName: targetRepo.stackName,
- stackVersion: targetRepo.stackVersion,
- repoId: targetRepo.repoId,
- osType: targetRepo.osType,
- data: {
- 'Repositories': {
- 'base_url': targetRepo.baseUrl,
- "verify_base_url": verifyBaseUrl
- }
- }
- },
- success: 'doSaveRepoUrlsSuccessCallback',
- error: 'doSaveRepoUrlsErrorCallback'
- });
- },
- /**
- * Check validation and Save the customized local urls
- */
- saveRepoUrls: function (event) {
- this.doSaveRepoUrls(event.context.get('id'), true);
- },
-
- /**
- * on click handler 'Cancel' for current repo in edit mode
- */
- doCancel: function (event) {
- var targetRepo = this.get('allRepos').findProperty('id', event.context.get('id'));
- if (targetRepo) {
- targetRepo.set('baseUrl', targetRepo.get('originalBaseUrl'));
- targetRepo.set('onEdit', false);
- }
- }
-
-});
-
http://git-wip-us.apache.org/repos/asf/ambari/blob/c234e978/ambari-web/app/views/main/admin/stack_and_upgrade_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/stack_and_upgrade_view.js b/ambari-web/app/views/main/admin/stack_and_upgrade_view.js
new file mode 100644
index 0000000..ffa41c8
--- /dev/null
+++ b/ambari-web/app/views/main/admin/stack_and_upgrade_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');
+var stringUtils = require('utils/string_utils');
+
+App.MainAdminStackAndUpgradeView = Em.View.extend({
+ templateName: require('templates/main/admin/stack_and_upgrade')
+});
+
http://git-wip-us.apache.org/repos/asf/ambari/blob/c234e978/ambari-web/app/views/main/menu.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/menu.js b/ambari-web/app/views/main/menu.js
index aee9ad9..966f5ae 100644
--- a/ambari-web/app/views/main/menu.js
+++ b/ambari-web/app/views/main/menu.js
@@ -125,9 +125,9 @@ App.MainMenuView = Em.CollectionView.extend({
if (itemName == 'admin') {
categories = [];
categories.push({
- name: 'adminRepositories',
- url: 'repositories',
- label: Em.I18n.t('common.repositories')
+ name: 'stackAndUpgrade',
+ url: 'stack',
+ label: Em.I18n.t('admin.stackUpgrade.title')
});
if (App.get('supports.stackUpgrade')) {
categories.push({
http://git-wip-us.apache.org/repos/asf/ambari/blob/c234e978/ambari-web/test/controllers/main/admin/repositories_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/repositories_test.js b/ambari-web/test/controllers/main/admin/repositories_test.js
deleted file mode 100644
index f002fc9..0000000
--- a/ambari-web/test/controllers/main/admin/repositories_test.js
+++ /dev/null
@@ -1,86 +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.
- */
-
-
-var App = require('app');
-require('controllers/main/admin/repositories');
-
-describe('App.MainAdminRepositoriesController', function() {
- var controller;
- var data = {
- "items": [
- {
- "Versions": {
- "stack_version": "1.3.1",
- "min_upgrade_version": "1.2.0"
- }
- },
- {
- "Versions": {
- "stack_version": "1.3.0",
- "min_upgrade_version": "1.2.0"
- }
- },
- {
- "Versions": {
- "stack_version": "1.2.2",
- "min_upgrade_version": "1.2.0"
- }
- },
- {
- "Versions": {
- "stack_version": "1.2.0",
- "min_upgrade_version": "1.2.0"
- }
- },
- {
- "Versions": {
- "stack_version": "2.0.5",
- "min_upgrade_version": "2.0.0"
- }
- },
- {
- "Versions": {
- "stack_version": "2.0.5",
- "min_upgrade_version": "2.0.5"
- }
- }
- ]
- };
-
- beforeEach(function() {
- controller = App.MainAdminRepositoriesController.create({
- parseServicesInfo: Em.K
- });
- });
-
- //todo should be verified
- describe('#updateUpgradeVersionSuccessCallback()', function () {
- it('upgrade version of stack should be "HDP-1.2.2"', function () {
- App.set('currentStackVersion', 'HDP-1.2.2');
- controller.updateUpgradeVersionSuccessCallback.call(controller, data);
- expect(controller.get('upgradeVersion')).to.equal('HDP-1.2.2');
- });
- it('if min upgrade version less then current then upgrade version equal current', function () {
- App.set('currentStackVersion', 'HDP-1.2.2');
- data.items[0].Versions.min_upgrade_version = "1.2.3";
- controller.updateUpgradeVersionSuccessCallback.call(controller, data);
- expect(controller.get('upgradeVersion')).to.equal('HDP-1.2.2');
- })
- });
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/c234e978/ambari-web/test/controllers/main/admin/stack_and_upgrade_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/stack_and_upgrade_test.js b/ambari-web/test/controllers/main/admin/stack_and_upgrade_test.js
new file mode 100644
index 0000000..6e5478f
--- /dev/null
+++ b/ambari-web/test/controllers/main/admin/stack_and_upgrade_test.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.
+ */
+
+
+var App = require('app');
+var controller;
+require('controllers/main/admin/stack_and_upgrade_controller');
+
+describe('App.MainAdminStackAndUpgradeController', function() {
+
+ beforeEach(function() {
+ controller = App.MainAdminStackAndUpgradeController.create({});
+ });
+
+ describe("goToAddService" , function() {
+ beforeEach(function() {
+ sinon.stub(App.get('router'), 'transitionTo', Em.K);
+ });
+ afterEach(function() {
+ App.get('router').transitionTo.restore();
+ });
+ it("routes to Addservice Wizard", function() {
+ controller.goToAddService({context: "serviceName"});
+ expect(App.get('router').transitionTo.calledOnce).to.be.true;
+ expect(controller.get('serviceToInstall')).to.be.equal("serviceName");
+ });
+ })
+});