You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jl...@apache.org on 2016/06/27 23:36:47 UTC
[21/34] ambari git commit: AMBARI-17355 & AMBARI-17354: POC: FE & BE
changes for first class support for Yarn hosted services
http://git-wip-us.apache.org/repos/asf/ambari/blob/b88db3cc/ambari-web/app/views/main/assemblies/deploy_store_app/deploy_store_app_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/assemblies/deploy_store_app/deploy_store_app_view.js b/ambari-web/app/views/main/assemblies/deploy_store_app/deploy_store_app_view.js
new file mode 100644
index 0000000..cf0b91c
--- /dev/null
+++ b/ambari-web/app/views/main/assemblies/deploy_store_app/deploy_store_app_view.js
@@ -0,0 +1,62 @@
+/**
+ * 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 validator = require('utils/validator');
+
+App.DeployStoreAppView = Em.View.extend({
+
+ templateName: require('templates/main/assemblies/deploy_store_app/config'),
+
+ config: null,
+
+ observeDisable: function() {
+ this.get('parentView').$('.sliderBar').slider('option', 'disabled', this.get('isDeploying'));
+ }.observes('isDeploying'),
+
+ didInsertElement: function() {
+ this.$('.sliderBar').slider({
+ step: this.get('config.step'),
+ min: this.get('config.minValue'),
+ max: this.get('config.maxValue'),
+ value: this.get('config.defaultValue'),
+ slide: function( event, ui ) {
+ this.set('config.value', ui.value);
+ this.set('config.errorMessage', '');
+ }.bind(this)
+ });
+ },
+
+ sliderInputView: Em.TextField.extend({
+ disabled: Em.computed.alias('parentView.isDeploying'),
+ keyUp: function() {
+ if (validator.isValidInt(this.get('value'))) {
+ if (this.get('value') > this.get('parentView.config.maxValue')) {
+ this.set('value', this.get('parentView.config.maxValue'));
+ } else if (this.get('value') < this.get('parentView.config.minValue')) {
+ this.set('value', this.get('parentView.config.minValue'));
+ }
+ this.get('parentView').$('.sliderBar').slider('value', this.get('value'));
+ this.set('parentView.config.errorMessage', '');
+ } else {
+ this.set('parentView.config.errorMessage', Em.I18n.t('errorMessage.config.number.integer'));
+ }
+ }
+ })
+
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/b88db3cc/ambari-web/app/views/main/assemblies/service_groups/configs_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/assemblies/service_groups/configs_view.js b/ambari-web/app/views/main/assemblies/service_groups/configs_view.js
new file mode 100644
index 0000000..65318cb
--- /dev/null
+++ b/ambari-web/app/views/main/assemblies/service_groups/configs_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.MainAssembliesServiceGroupConfigsView = Em.View.extend({
+
+ templateName: require('templates/main/assemblies/service_groups/configs')
+
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/b88db3cc/ambari-web/app/views/main/assemblies/service_groups/detailed_info_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/assemblies/service_groups/detailed_info_view.js b/ambari-web/app/views/main/assemblies/service_groups/detailed_info_view.js
new file mode 100644
index 0000000..c6ed246
--- /dev/null
+++ b/ambari-web/app/views/main/assemblies/service_groups/detailed_info_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.MainAssembliesServiceGroupDetailedInfoView = Em.View.extend({
+
+ templateName: require('templates/main/assemblies/service_groups/detailed_info')
+
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/b88db3cc/ambari-web/app/views/main/assemblies/service_groups/menu_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/assemblies/service_groups/menu_view.js b/ambari-web/app/views/main/assemblies/service_groups/menu_view.js
new file mode 100644
index 0000000..f9e0932
--- /dev/null
+++ b/ambari-web/app/views/main/assemblies/service_groups/menu_view.js
@@ -0,0 +1,50 @@
+/**
+ * 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.MainAssembliesServiceGroupMenuView = Em.View.extend({
+
+ templateName: require('templates/main/assemblies/service_groups/menu'),
+
+ menu: function () {
+ var currentPath = App.get('router.currentState.path');
+ return [
+ {title: Em.I18n.t('common.summary'), route: 'summary', isActive: currentPath.endsWith('summary')},
+ {title: Em.I18n.t('common.settings'), route: 'settings', isActive: currentPath.endsWith('settings')},
+ {title: Em.I18n.t('assemblies.serviceGroups.menu.detailedInfo'), route: 'detailedInfo', isActive: currentPath.endsWith('detailedInfo')}
+ ];
+ }.property('App.router.currentState.path'),
+
+ didInsertElement: function () {
+ App.tooltip(this.$("[rel='assembly-file-link']"));
+ },
+
+ willDestroyElement: function () {
+ this.$("[rel='assembly-file-link']").tooltip('destroy');
+ },
+
+ /**
+ * @param {{context: string}} event
+ */
+ moveTo: function (event) {
+ var route = event.context;
+ this.get('controller.target').transitionTo(route);
+ }
+
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/b88db3cc/ambari-web/app/views/main/assemblies/service_groups/service_group_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/assemblies/service_groups/service_group_view.js b/ambari-web/app/views/main/assemblies/service_groups/service_group_view.js
new file mode 100644
index 0000000..b42b46f
--- /dev/null
+++ b/ambari-web/app/views/main/assemblies/service_groups/service_group_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.MainAssembliesServiceGroupView = Em.View.extend({
+
+ templateName: require('templates/main/assemblies/service_groups/service_group')
+
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/b88db3cc/ambari-web/app/views/main/assemblies/service_groups/summary_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/assemblies/service_groups/summary_view.js b/ambari-web/app/views/main/assemblies/service_groups/summary_view.js
new file mode 100644
index 0000000..d3ecf04
--- /dev/null
+++ b/ambari-web/app/views/main/assemblies/service_groups/summary_view.js
@@ -0,0 +1,186 @@
+/**
+ * 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.MainAssembliesServiceGroupSummaryView = Em.View.extend({
+
+ templateName: require('templates/main/assemblies/service_groups/summary'),
+
+ /**
+ * Contain array with list of master components from <code>App.Service.hostComponets</code> which are
+ * <code>App.HostComponent</code> models.
+ *
+ * @type {App.HostComponent[]}
+ */
+ mastersObj: [],
+ mastersLength: 0,
+
+ /**
+ * Contain array with list of slave components models <code>App.SlaveComponent</code>.
+ *
+ * @type {App.SlaveComponent[]}
+ */
+ slavesObj: [],
+ slavesLength: 0,
+
+ /**
+ * Contain array with list of client components models <code>App.ClientComponent</code>.
+ *
+ * @type {App.ClientComponent[]}
+ */
+ clientObj: [],
+ clientsLength: 0,
+
+ /**
+ * Show spinner while components are loading
+ *
+ * @type {boolean}
+ * @default true
+ */
+ showSpinner: true,
+
+ didInsertElement: function() {
+ var services = this.get('controller.content.services');
+ if (services.content.length) {
+ this.set('controller.activeService', services.objectAt(0));
+ }
+ var shownServices = this.get('controller.content.services').map(function(_service, index) {
+ return Em.Object.create({
+ id: _service.get('id'),
+ displayName: _service.get('displayName'),
+ url: _service.get('logo'),
+ isActive: !!index
+ });
+ });
+ this.set('shownServices', shownServices);
+ this.set('activeService', shownServices.objectAt(0));
+ },
+
+ willDestroyElement: function() {
+ this.get('mastersObj').clear();
+ this.get('slavesObj').clear();
+ this.get('clientObj').clear();
+ },
+
+
+ /**
+ * Show services icons
+ *
+ * @type {{displayName: string, url: string}[]}
+ */
+ shownServices: [],
+
+ /**
+ * {{context: App.ServiceGroup}} @param event
+ */
+ makeServiceActive: function(event) {
+ var service = event.context;
+ var controller= this.get('controller');
+ service.set('isActive', true);
+ this.set('activeService', service);
+ },
+
+ setActiveService: function() {
+ var activeService = this.get('activeService');
+ var services = this.get('shownServices');
+ services.forEach(function(item) {
+ item.set('isActive', activeService.get('id') === item.get('id'));
+ });
+ }.observes('activeService'),
+
+
+ serviceSummaryView: Em.View.extend(App.MainDashboardServiceViewWrapper, {
+ templateName: 'templates/main/service/info/summary/base',
+ isFullWidth: true
+ }),
+
+ componentsLengthDidChange: function() {
+ var self = this;
+ var service = this.get('controller.activeService');
+ if (!service || service.get('deleteInProgress')) return;
+ Em.run.once(self, 'setComponentsContent');
+ }.observes('activeService','activeService.hostComponents.length', 'activeService.slaveComponents.@each.totalCount', 'activeService.clientComponents.@each.totalCount'),
+
+ setComponentsContent: function() {
+ Em.run.next(function() {
+ var activeService = this.get('activeService');
+
+ var service = App.Service.find().findProperty('id',activeService.get('id'));
+ if (Em.isNone(service)) {
+ return;
+ }
+
+ var masters = service.get('hostComponents').filterProperty('isMaster');
+ var slaves = service.get('slaveComponents').toArray();
+ var clients = service.get('clientComponents').toArray();
+
+ this.get('mastersObj').clear();
+ this.get('slavesObj').clear();
+ this.get('clientObj').clear();
+ this.updateComponentList(this.get('mastersObj'), masters);
+ this.updateComponentList(this.get('slavesObj'), slaves);
+ this.updateComponentList(this.get('clientObj'), clients);
+ this.set('showSpinner', !(masters.length || slaves.length || clients.length));
+
+ }.bind(this));
+ },
+
+ updateComponentList: function(source, data) {
+ var sourceIds = source.mapProperty('id');
+ var dataIds = data.mapProperty('id');
+ if (!sourceIds.length) {
+ source.pushObjects(data);
+ }
+ if (source.length > data.length) {
+ sourceIds.forEach(function(item, index) {
+ if (!dataIds.contains(item)) {
+ source.removeAt(index);
+ }
+ });
+ }
+ else {
+ if (source.length < data.length) {
+ dataIds.forEach(function (item, index) {
+ if (!sourceIds.contains(item)) {
+ source.pushObject(data.objectAt(index));
+ }
+ });
+ }
+ }
+ },
+
+ /**
+ * Open another browser window with assembly file content highlighted with highlight.js
+ */
+ showAssemblyFile: function () {
+ var assemblyFile = this.get('controller.content.assemblyFile');
+ var assemblyFileContent = '';
+ try {
+ assemblyFileContent = JSON.stringify(JSON.parse(assemblyFile), null, 2);
+ }
+ catch(e) {
+ assemblyFileContent = assemblyFile;
+ }
+ var newwindow = window.open();
+ var newdocument = newwindow.document;
+ newdocument.write('<head><link rel="stylesheet" href="stylesheets/vendor.css"></head><body><pre>' + hljs.highlight('json', assemblyFileContent).value + '</pre></body>');
+ newdocument.close();
+ }
+
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/b88db3cc/ambari-web/app/views/main/assemblies/service_groups_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/assemblies/service_groups_view.js b/ambari-web/app/views/main/assemblies/service_groups_view.js
new file mode 100644
index 0000000..e5e1356
--- /dev/null
+++ b/ambari-web/app/views/main/assemblies/service_groups_view.js
@@ -0,0 +1,23 @@
+/**
+ * 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.MainAssembliesServiceGroupsView = Em.View.extend({
+
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/b88db3cc/ambari-web/app/views/main/assemblies/store_app_block_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/assemblies/store_app_block_view.js b/ambari-web/app/views/main/assemblies/store_app_block_view.js
new file mode 100644
index 0000000..9e95c74
--- /dev/null
+++ b/ambari-web/app/views/main/assemblies/store_app_block_view.js
@@ -0,0 +1,82 @@
+/**
+ * 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');
+
+/**
+ * Usage in the templates:
+ * <pre>
+ * {{view App.StoreAppBlockView storeAppBinding="storeApp"}}
+ * </pre>
+ *
+ * @type {Em.View}
+ */
+App.StoreAppBlockView = Em.View.extend({
+
+ classNames: ['store-app-block-view'],
+
+ classNameBindings: ['storeApp.isActive:active'],
+
+ templateName: require('templates/main/assemblies/store_app_block'),
+
+ /**
+ * Bound from template
+ *
+ * @type {App.StoreApp}
+ */
+ storeApp: null,
+
+ /**
+ * Coma-separated list of the category names that App belongs to
+ *
+ * @type {string}
+ */
+ categoryNames: function () {
+ return this.get('storeApp.storeCategories').mapProperty('name').join(', ');
+ }.property('storeApp.storeCategories.@each.name'),
+
+ /**
+ * Show only two first services for App
+ *
+ * @type {string}
+ */
+ shownServices: function () {
+ return this.get('storeApp.services') ? this.get('storeApp.services').substring(0, 19) : '';
+ }.property('storeApp.services'),
+
+ /**
+ * Should be '...' shown for services
+ * true - if App belongs to more services
+ * false - otherwise
+ *
+ * @type {boolean}
+ */
+ moreServices: Em.computed.gt('storeApp.services.length', 19),
+
+ /**
+ * Should be double-pane shown for App
+ * true - if App belongs to more than one service
+ * false - otherwise
+ *
+ * @type {boolean}
+ */
+ showBgBlock: function () {
+ return this.get('storeApp.services') ? this.get('storeApp.services').split('|').length > 1 : false;
+ }.property('storeApp.services.[]'),
+
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/b88db3cc/ambari-web/app/views/main/assemblies_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/assemblies_view.js b/ambari-web/app/views/main/assemblies_view.js
new file mode 100644
index 0000000..ca289b8
--- /dev/null
+++ b/ambari-web/app/views/main/assemblies_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.MainAssembliesView = Em.View.extend({
+
+ templateName: require('templates/main/assemblies'),
+
+ didInsertElement: function () {
+ App.loadTimer.finish('App Store Page');
+ }
+
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/b88db3cc/ambari-web/app/views/main/dashboard.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard.js b/ambari-web/app/views/main/dashboard.js
index 9694774..61b756c 100644
--- a/ambari-web/app/views/main/dashboard.js
+++ b/ambari-web/app/views/main/dashboard.js
@@ -22,6 +22,9 @@ App.MainDashboardView = Em.View.extend({
name: 'mainDashboardView',
templateName: require('templates/main/dashboard'),
+ didInsertElement: function() {
+
+ },
selectedBinding: 'controller.selectedCategory',
categories: [
http://git-wip-us.apache.org/repos/asf/ambari/blob/b88db3cc/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 8f6b14e..6cb427d 100644
--- a/ambari-web/app/views/main/menu.js
+++ b/ambari-web/app/views/main/menu.js
@@ -38,6 +38,7 @@ App.MainMenuView = Em.CollectionView.extend({
if (!App.get('isOnlyViewUser')) {
result.push(
{label: Em.I18n.t('menu.item.dashboard'), routing: 'dashboard', active: 'active'},
+ {label: Em.I18n.t('menu.item.appStore'), routing: 'assemblies'},
{label: Em.I18n.t('menu.item.services'), routing: 'services'},
{label: Em.I18n.t('menu.item.hosts'), routing: 'hosts'},
{label: Em.I18n.t('menu.item.alerts'), routing: 'alerts'}
@@ -65,13 +66,13 @@ App.MainMenuView = Em.CollectionView.extend({
active: function () {
if (App.get('clusterName') && App.router.get('clusterController.isLoaded')) {
- var last_url = App.router.location.lastSetURL || location.href.replace(/^[^#]*#/, '');
- if (last_url.substr(1, 4) !== 'main' || !this._childViews) {
+ var lastUrl = App.router.location.lastSetURL || location.href.replace(/^[^#]*#/, '');
+ if (lastUrl.substr(1, 4) !== 'main' || !this._childViews) {
return;
}
var reg = /^\/main\/([a-z]+)/g;
- var sub_url = reg.exec(last_url);
- var chunk = (null != sub_url) ? sub_url[1] : 'dashboard';
+ var subUrl = reg.exec(lastUrl);
+ var chunk = (null != subUrl) ? subUrl[1] : 'dashboard';
return this.get('content.routing').indexOf(chunk) === 0 ? "active" : "";
}
return "";
@@ -103,7 +104,7 @@ App.MainMenuView = Em.CollectionView.extend({
var itemName = this.get('content').routing;
var categories = [];
// create dropdown categories for each menu item
- if (itemName == 'admin') {
+ if (itemName === 'admin') {
categories = [];
if(App.isAuthorized('CLUSTER.VIEW_STACK_DETAILS, CLUSTER.UPGRADE_DOWNGRADE_STACK') || (App.get('upgradeInProgress') || App.get('upgradeHolding'))) {
categories.push({
@@ -112,7 +113,7 @@ App.MainMenuView = Em.CollectionView.extend({
label: Em.I18n.t('admin.stackUpgrade.title')
});
}
- if(App.isAuthorized('AMBARI.SET_SERVICE_USERS_GROUPS') || (App.get('upgradeInProgress') || App.get('upgradeHolding'))) {
+ if(App.isAuthorized('AMBARI.SET_SERVICE_USERS_GROUPS') || App.get('upgradeInProgress') || App.get('upgradeHolding')) {
categories.push({
name: 'adminServiceAccounts',
url: 'serviceAccounts',
@@ -126,7 +127,7 @@ App.MainMenuView = Em.CollectionView.extend({
label: Em.I18n.t('common.kerberos')
});
}
- if (App.isAuthorized('SERVICE.START_STOP, CLUSTER.MODIFY_CONFIGS') || (App.get('upgradeInProgress') || App.get('upgradeHolding'))) {
+ if (App.isAuthorized('SERVICE.START_STOP, CLUSTER.MODIFY_CONFIGS') || App.get('upgradeInProgress') || App.get('upgradeHolding')) {
if (App.supports.serviceAutoStart) {
categories.push({
name: 'serviceAutoStart',
@@ -137,7 +138,7 @@ App.MainMenuView = Em.CollectionView.extend({
}
}
return categories;
- }.property(''),
+ }.property(),
AdminDropdownItemView: Ember.View.extend({
tagName: 'li',
http://git-wip-us.apache.org/repos/asf/ambari/blob/b88db3cc/ambari-web/app/views/main/service/all_services_actions.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/all_services_actions.js b/ambari-web/app/views/main/service/all_services_actions.js
index b0aa99c..1a22934 100644
--- a/ambari-web/app/views/main/service/all_services_actions.js
+++ b/ambari-web/app/views/main/service/all_services_actions.js
@@ -18,9 +18,38 @@
var App = require('app');
+/**
+ * Check serviceGroup's <code>dependentKey</code>
+ * If there is no serviceGroup, it means that view is used for the whole cluster and all service groups should be checked
+ *
+ * @param {string} dependentKey
+ * @returns {Ember.ComputedProperty}
+ */
+function serviceGroupBased(dependentKey) {
+ var key1 = 'serviceGroup.' + dependentKey;
+ var key2 = 'serviceController.content.@each.' + dependentKey;
+ return Ember.computed(key1, key2, function () {
+ var serviceGroup = this.get('serviceGroup');
+ if (!serviceGroup) {
+ return this.get('serviceController.content').everyProperty(dependentKey, true);
+ }
+ return serviceGroup.get(dependentKey);
+ });
+}
+
+/**
+ * List of actions like "Start All", "Stop All" etc
+ * Used for service groups and whole cluster
+ *
+ * @type {Em.View}
+ */
App.AllServicesActionView = Em.View.extend({
templateName: require('templates/main/service/all_services_actions'),
+ isStopAllDisabled: serviceGroupBased('isStopAllDisabled'),
+ isStartAllDisabled: serviceGroupBased('isStartAllDisabled'),
+ isRestartAllRequiredDisabled: serviceGroupBased('isRestartAllRequiredDisabled'),
+
serviceController: function () {
return App.get('router.mainServiceController');
}.property('App.router.mainServiceController')
http://git-wip-us.apache.org/repos/asf/ambari/blob/b88db3cc/ambari-web/app/views/main/service/info/summary.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/info/summary.js b/ambari-web/app/views/main/service/info/summary.js
index 6191e6a..9c987b8 100644
--- a/ambari-web/app/views/main/service/info/summary.js
+++ b/ambari-web/app/views/main/service/info/summary.js
@@ -357,7 +357,9 @@ App.MainServiceInfoSummaryView = Em.View.extend(App.UserPref, App.TimeRangeMixin
var self = this,
stackService = App.StackService.find(this.get('controller.content.serviceName'));
- if (!graphNames && !stackService.get('isServiceWithWidgets')) {
+ var isAssembly = this.get('controller.content.serviceGroupName') !== 'CORE';
+
+ if ((!graphNames && !stackService.get('isServiceWithWidgets')) || isAssembly) {
this.get('serviceMetricGraphs').clear();
this.set('isServiceMetricLoaded', false);
return;
http://git-wip-us.apache.org/repos/asf/ambari/blob/b88db3cc/ambari-web/app/views/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/item.js b/ambari-web/app/views/main/service/item.js
index 36b3413..b1913cd 100644
--- a/ambari-web/app/views/main/service/item.js
+++ b/ambari-web/app/views/main/service/item.js
@@ -318,13 +318,20 @@ App.MainServiceItemView = Em.View.extend({
return this.get('state') !== 'inDOM' || this.get('maintenance').length !== 0;
}.property('maintenance'),
+ isServiceActionsVisible: function() {
+ var isCore = App.get('router.mainServiceController.serviceGroup.id') === 'CORE';
+ return this.get('isMaintenanceActive') && isCore;
+ }.property('isMaintenanceActive', 'controller.content.serviceName'),
+
hasConfigTab: function() {
- return App.isAuthorized('CLUSTER.VIEW_CONFIGS', {ignoreWizard: true}) && !App.get('services.noConfigTypes').contains(this.get('controller.content.serviceName'));
- }.property('controller.content.serviceName','App.services.noConfigTypes'),
+ var isCore = App.get('router.mainServiceController.serviceGroup.id') === 'CORE';
+ return App.isAuthorized('CLUSTER.VIEW_CONFIGS', {ignoreWizard: true}) && isCore && !App.get('services.noConfigTypes').contains(this.get('controller.content.serviceName'));
+ }.property('controller.content.serviceName','App.services.noConfigTypes', 'App.router.mainServiceController.serviceGroup'),
hasHeatmapTab: function() {
- return App.get('services.servicesWithHeatmapTab').contains(this.get('controller.content.serviceName'));
- }.property('controller.content.serviceName', 'App.services.servicesWithHeatmapTab'),
+ var isCore = App.get('router.mainServiceController.serviceGroup.id') === 'CORE';
+ return isCore && App.get('services.servicesWithHeatmapTab').contains(this.get('controller.content.serviceName'));
+ }.property('controller.content.serviceName', 'App.services.servicesWithHeatmapTab', 'App.router.mainServiceController.serviceGroup'),
didInsertElement: function () {
this.get('controller').setStartStopState();
http://git-wip-us.apache.org/repos/asf/ambari/blob/b88db3cc/ambari-web/app/views/main/service/menu.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/menu.js b/ambari-web/app/views/main/service/menu.js
index f5768f8..9cb0033 100644
--- a/ambari-web/app/views/main/service/menu.js
+++ b/ambari-web/app/views/main/service/menu.js
@@ -17,15 +17,14 @@
*/
var App = require('app');
+var misc = require('utils/misc');
App.MainServiceMenuView = Em.CollectionView.extend({
- disabledServices: [],
content: function () {
- return App.router.get('mainServiceController.content').filter(function(item){
- return !this.get('disabledServices').contains(item.get('id'));
- }, this);
- }.property('App.router.mainServiceController.content', 'App.router.mainServiceController.content.length'),
+ var serviceGroup = this.get('serviceGroup');
+ return serviceGroup ? misc.sortByOrder(App.StackService.find().mapProperty('serviceName'), serviceGroup.get('services').toArray()) : [];
+ }.property('serviceGroup'),
didInsertElement:function () {
App.router.location.addObserver('lastSetURL', this, 'renderOnRoute');
@@ -38,20 +37,20 @@ App.MainServiceMenuView = Em.CollectionView.extend({
this.$(".restart-required-service").tooltip('destroy');
},
- activeServiceId:null,
+ activeServiceId: null,
/**
* Syncs navigation menu with requested URL
*/
renderOnRoute:function () {
- var last_url = App.router.location.lastSetURL || location.href.replace(/^[^#]*#/, '');
- if (last_url.substr(1, 4) !== 'main' || !this._childViews) {
+ var lastUrl = App.router.location.lastSetURL || location.href.replace(/^[^#]*#/, '');
+ if (lastUrl.substr(1, 4) !== 'main' || !this._childViews) {
return;
}
var reg = /^\/main\/services\/(\S+)\//g;
- var sub_url = reg.exec(last_url);
- var service_id = (null != sub_url) ? sub_url[1] : 1;
- this.set('activeServiceId', service_id);
+ var subUrl = reg.exec(lastUrl);
+ var serviceId = null != subUrl ? subUrl[1] : 1;
+ this.set('activeServiceId', serviceId);
},
tagName:'ul',
@@ -59,15 +58,15 @@ App.MainServiceMenuView = Em.CollectionView.extend({
itemViewClass:Em.View.extend({
- classNameBindings:["active", "clients"],
- templateName:require('templates/main/service/menu_item'),
+ classNameBindings: ["active", "clients"],
+ templateName: require('templates/main/service/menu_item'),
restartRequiredMessage: null,
shouldBeRestarted: Em.computed.someBy('content.hostComponents', 'staleConfigs', true),
active:function () {
return this.get('content.id') == this.get('parentView.activeServiceId') ? 'active' : '';
- }.property('parentView.activeServiceId'),
+ }.property('content.id', 'parentView.activeServiceId'),
alertsCount: function () {
return this.get('content.alertsCount') > 99 ? "99+" : this.get('content.alertsCount') ;
@@ -79,39 +78,33 @@ App.MainServiceMenuView = Em.CollectionView.extend({
return !App.get('services.noConfigTypes').contains(this.get('content.serviceName'));
}.property('App.services.noConfigTypes','content.serviceName'),
- link: function() {
- var stateName = (['summary','configs'].contains(App.router.get('currentState.name')))
- ? this.get('isConfigurable') && this.get('parentView.activeServiceId') != this.get('content.id') ? App.router.get('currentState.name') : 'summary'
- : 'summary';
- return "#/main/services/" + this.get('content.id') + "/" + stateName;
- }.property('App.router.currentState.name', 'parentView.activeServiceId', 'isConfigurable'),
-
goToConfigs: function () {
App.router.set('mainServiceItemController.routeToConfigs', true);
App.router.transitionTo('services.service.configs', this.get('content'));
App.router.set('mainServiceItemController.routeToConfigs', false);
},
+ link: function() {
+ if (this.get('controller.name') && this.get('controller.name') == "mainAssembliesController" ) {
+ return "javascript: void(0)";
+ }
+ var stateName = (['summary','configs'].contains(App.router.get('currentState.name')))
+ ? this.get('isConfigurable') && this.get('parentView.activeServiceId') != this.get('content.id') ? App.router.get('currentState.name') : 'summary' : 'summary';
+ return "#/main/services/" + this.get('content.id') + "/" + stateName;
+ }.property('App.router.currentState.name', 'parentView.activeServiceId', 'isConfigurable'),
+
refreshRestartRequiredMessage: function() {
var restarted, componentsCount, hostsCount, message, tHosts, tComponents;
restarted = this.get('content.restartRequiredHostsAndComponents');
componentsCount = 0;
hostsCount = 0;
- message = "";
+ message = '';
for (var host in restarted) {
hostsCount++;
componentsCount += restarted[host].length;
}
- if (hostsCount > 1) {
- tHosts = Em.I18n.t('common.hosts');
- } else {
- tHosts = Em.I18n.t('common.host');
- }
- if (componentsCount > 1) {
- tComponents = Em.I18n.t('common.components');
- } else {
- tComponents = Em.I18n.t('common.component');
- }
+ tHosts = hostsCount > 1 ? Em.I18n.t('common.hosts') : Em.I18n.t('common.host');
+ tComponents = componentsCount > 1 ? Em.I18n.t('common.components') : Em.I18n.t('common.component');
message += componentsCount + ' ' + tComponents + ' ' + Em.I18n.t('on') + ' ' +
hostsCount + ' ' + tHosts + ' ' + Em.I18n.t('services.service.config.restartService.needToRestartEnd');
this.set('restartRequiredMessage', message);
@@ -121,13 +114,14 @@ App.MainServiceMenuView = Em.CollectionView.extend({
});
App.TopNavServiceMenuView = Em.CollectionView.extend({
- disabledServices: [],
content: function () {
- return App.router.get('mainServiceController.content').filter(function (item) {
- return !this.get('disabledServices').contains(item.get('id'));
- }, this);
- }.property('App.router.mainServiceController.content', 'App.router.mainServiceController.content.length'),
+ if (!App.router.get('clusterController.isLoaded')) {
+ return [];
+ }
+ var serviceGroup = App.ServiceGroup.find('CORE');
+ return misc.sortByOrder(App.StackService.find().mapProperty('serviceName'), serviceGroup.get('services').toArray());
+ }.property('App.router.clusterController.isLoaded'),
didInsertElement:function () {
App.router.location.addObserver('lastSetURL', this, 'renderOnRoute');
@@ -145,14 +139,14 @@ App.TopNavServiceMenuView = Em.CollectionView.extend({
* Syncs navigation menu with requested URL
*/
renderOnRoute:function () {
- var last_url = App.router.location.lastSetURL || location.href.replace(/^[^#]*#/, '');
- if (last_url.substr(1, 4) !== 'main' || !this._childViews) {
+ var lastUrl = App.router.location.lastSetURL || location.href.replace(/^[^#]*#/, '');
+ if (lastUrl.substr(1, 4) !== 'main' || !this._childViews) {
return;
}
var reg = /^\/main\/services\/(\S+)\//g;
- var sub_url = reg.exec(last_url);
- var service_id = (null != sub_url) ? sub_url[1] : 1;
- this.set('activeServiceId', service_id);
+ var subUrl = reg.exec(lastUrl);
+ var serviceId = null != subUrl ? subUrl[1] : 1;
+ this.set('activeServiceId', serviceId);
},
tagName:'ul',
@@ -179,8 +173,8 @@ App.TopNavServiceMenuView = Em.CollectionView.extend({
}.property('App.services.noConfigTypes','content.serviceName'),
link: function() {
- var stateName = (['summary','configs'].contains(App.router.get('currentState.name')))
- ? this.get('isConfigurable') ? App.router.get('currentState.name') : 'summary'
+ var stateName = ['summary','configs'].contains(App.router.get('currentState.name'))
+ ? this.get('isConfigurable') ? App.router.get('currentState.name') : 'summary'
: 'summary';
return "#/main/services/" + this.get('content.id') + "/" + stateName;
}.property('App.router.currentState.name', 'parentView.activeServiceId','isConfigurable'),
@@ -196,21 +190,13 @@ App.TopNavServiceMenuView = Em.CollectionView.extend({
restarted = this.get('content.restartRequiredHostsAndComponents');
componentsCount = 0;
hostsCount = 0;
- message = "";
+ message = '';
for (var host in restarted) {
hostsCount++;
componentsCount += restarted[host].length;
}
- if (hostsCount > 1) {
- tHosts = Em.I18n.t('common.hosts');
- } else {
- tHosts = Em.I18n.t('common.host');
- }
- if (componentsCount > 1) {
- tComponents = Em.I18n.t('common.components');
- } else {
- tComponents = Em.I18n.t('common.component');
- }
+ tHosts = hostsCount > 1 ? Em.I18n.t('common.hosts') : Em.I18n.t('common.host');
+ tComponents = componentsCount > 1 ? Em.I18n.t('common.components') : Em.I18n.t('common.component');
message += componentsCount + ' ' + tComponents + ' ' + Em.I18n.t('on') + ' ' +
hostsCount + ' ' + tHosts + ' ' + Em.I18n.t('services.service.config.restartService.needToRestartEnd');
this.set('restartRequiredMessage', message);
http://git-wip-us.apache.org/repos/asf/ambari/blob/b88db3cc/ambari-web/app/views/main/service/widgets/create/expression_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/widgets/create/expression_view.js b/ambari-web/app/views/main/service/widgets/create/expression_view.js
index 32c664f..d48cdb3 100644
--- a/ambari-web/app/views/main/service/widgets/create/expression_view.js
+++ b/ambari-web/app/views/main/service/widgets/create/expression_view.js
@@ -116,7 +116,7 @@ App.WidgetWizardExpressionView = Em.View.extend({
redrawField: function () {
this.set('expression.data', misc.sortByOrder($(this.get('element')).find('.metric-instance').map(function () {
return this.id;
- }), this.get('expression.data')));
+ }), this.get('expression.data'), 'id'));
},
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/b88db3cc/ambari-web/config.coffee
----------------------------------------------------------------------
diff --git a/ambari-web/config.coffee b/ambari-web/config.coffee
index 6ed0915..8d44244 100644
--- a/ambari-web/config.coffee
+++ b/ambari-web/config.coffee
@@ -68,7 +68,8 @@ exports.config =
'vendor/scripts/spin.js',
'vendor/scripts/jquery.flexibleArea.js',
'vendor/scripts/FileSaver.js',
- 'vendor/scripts/Blob.js'
+ 'vendor/scripts/Blob.js',
+ 'vendor/scripts/highlight.pack.js'
]
@@ -88,7 +89,8 @@ exports.config =
'vendor/styles/bootstrap-checkbox.css',
'vendor/styles/bootstrap-slider.min.css',
'vendor/styles/bootstrap-switch.min.css',
- 'vendor/styles/visualsearch-datauri.css'
+ 'vendor/styles/visualsearch-datauri.css',
+ 'vendor/styles/highlight.css'
],
after: ['app/styles/custom-ui.css']
http://git-wip-us.apache.org/repos/asf/ambari/blob/b88db3cc/ambari-web/test/controllers/global/update_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/global/update_controller_test.js b/ambari-web/test/controllers/global/update_controller_test.js
index dc57a57..d44f155 100644
--- a/ambari-web/test/controllers/global/update_controller_test.js
+++ b/ambari-web/test/controllers/global/update_controller_test.js
@@ -59,7 +59,7 @@ describe('App.UpdateController', function () {
it('isWorking = true', function () {
controller.set('isWorking', true);
- expect(App.updater.run.callCount).to.equal(13);
+ expect(App.updater.run.callCount).to.equal(14);
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/b88db3cc/ambari-web/test/controllers/main/assemblies/assemblies_set_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/assemblies/assemblies_set_controller_test.js b/ambari-web/test/controllers/main/assemblies/assemblies_set_controller_test.js
new file mode 100644
index 0000000..10c2234
--- /dev/null
+++ b/ambari-web/test/controllers/main/assemblies/assemblies_set_controller_test.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.
+ */
+
+var App = require('app');
+
+function getController() {
+ return App.MainAssembliesSetController.create();
+}
+
+describe('App.MainAssembliesSetController', function() {
+
+ App.TestAliases.testAsComputedEqual(getController(), 'storeAppsEmpty', 'content.storeApps.length', 0);
+
+ App.TestAliases.testAsComputedFindBy(getController(), 'activeStoreApp', 'content.storeApps', 'isActive', true);
+
+ App.TestAliases.testAsComputedFilterBy(getController(), 'components', 'filteredStoreApps', 'isComponent', true);
+
+ App.TestAliases.testAsComputedFilterBy(getController(), 'assemblies', 'filteredStoreApps', 'isComponent', false);
+
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/b88db3cc/ambari-web/test/controllers/main/assemblies_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/assemblies_controller_test.js b/ambari-web/test/controllers/main/assemblies_controller_test.js
new file mode 100644
index 0000000..09d2543
--- /dev/null
+++ b/ambari-web/test/controllers/main/assemblies_controller_test.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.
+ */
+
+var App = require('app');
+
+function getController() {
+ return App.MainAssembliesController.create();
+}
+
+describe('App.MainAssembliesController', function() {
+
+ App.TestAliases.testAsComputedFindBy(getController(), 'activeStoreCollection', 'storeCollections', 'isActive', true);
+
+ App.TestAliases.testAsComputedEveryBy(getController(), 'noCategorySelected', 'storeCategories', 'isActive', false);
+
+ App.TestAliases.testAsComputedEveryBy(getController(), 'noCollectionSelected', 'storeCollections', 'isActive', false);
+
+ App.TestAliases.testAsComputedAnd(getController(), 'allAppsAreShown', ['noCategorySelected', 'noCollectionSelected']);
+
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/b88db3cc/ambari-web/test/controllers/main/service_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service_test.js b/ambari-web/test/controllers/main/service_test.js
index 9db4849..8e1e952 100644
--- a/ambari-web/test/controllers/main/service_test.js
+++ b/ambari-web/test/controllers/main/service_test.js
@@ -87,67 +87,6 @@ describe('App.MainServiceController', function () {
mainServiceController.destroy();
});
- App.TestAliases.testAsComputedNotEqual(getController(), 'isStartStopAllClicked', 'App.router.backgroundOperationsController.allOperationsCount', 0);
-
- describe('#isStartAllDisabled', function () {
- tests.forEach(function (test) {
- it(test.mStart, function () {
- mainServiceController = App.MainServiceController.create({
- content: test.content,
- isStartStopAllClicked: test.isStartStopAllClicked
- });
- expect(mainServiceController.get('isStartAllDisabled')).to.equals(test.eStart);
- });
- });
- });
-
- describe('#isStopAllDisabled', function () {
- tests.forEach(function (test) {
- it(test.mStop, function () {
- mainServiceController = App.MainServiceController.create({
- content: test.content,
- isStartStopAllClicked: test.isStartStopAllClicked
- });
- expect(mainServiceController.get('isStopAllDisabled')).to.equals(test.eStop);
- });
- });
- });
-
- describe("#isAllServicesInstalled", function() {
-
- beforeEach(function() {
- sinon.stub(App.StackService, 'find').returns([
- Em.Object.create({serviceName: 'S1'})
- ]);
- });
- afterEach(function() {
- App.StackService.find.restore();
- });
-
- it("content is null", function() {
- mainServiceController.reopen({
- 'content': null
- });
- mainServiceController.propertyDidChange('isAllServicesInstalled');
- expect(mainServiceController.get('isAllServicesInstalled')).to.be.false;
- });
-
- it("content is empty", function() {
- mainServiceController.reopen({
- 'content': []
- });
- mainServiceController.propertyDidChange('isAllServicesInstalled');
- expect(mainServiceController.get('isAllServicesInstalled')).to.be.false;
- });
-
- it("content match stack services", function() {
- mainServiceController.reopen({
- 'content': [Em.Object.create({serviceName: 'S1'})]
- });
- mainServiceController.propertyDidChange('isAllServicesInstalled');
- expect(mainServiceController.get('isAllServicesInstalled')).to.be.true;
- });
- });
describe('#cluster', function() {
@@ -192,56 +131,10 @@ describe('App.MainServiceController', function () {
});
- describe('#startAllService', function() {
-
- beforeEach(function() {
- sinon.stub(mainServiceController, 'allServicesCall', Em.K);
- });
-
- afterEach(function() {
- mainServiceController.allServicesCall.restore();
- });
-
- it('target is disabled', function() {
- var event = {target: {className: 'disabled', nodeType: 1}};
- var r = mainServiceController.startAllService(event);
- expect(r).to.be.null;
- });
-
- it('parent is disabled', function() {
- var event = {target: {parentElement: {className: 'disabled', nodeType: 1}}};
- var r = mainServiceController.startAllService(event);
- expect(r).to.be.null;
- });
-
- });
-
- describe('#stopAllService', function() {
-
- beforeEach(function() {
- sinon.stub(mainServiceController, 'allServicesCall', Em.K);
- });
-
- afterEach(function() {
- mainServiceController.allServicesCall.restore();
- });
-
- it('target is disabled', function() {
- var event = {target: {className: 'disabled', nodeType: 1}};
- var r = mainServiceController.stopAllService(event);
- expect(r).to.be.null;
- });
-
- it('parent is disabled', function() {
- var event = {target: {parentElement: {className: 'disabled', nodeType: 1}}};
- var r = mainServiceController.stopAllService(event);
- expect(r).to.be.null;
- });
-
- });
-
describe('#startStopAllService', function() {
- var event = { target: document.createElement("BUTTON") };
+ var serviceGroup = Em.Object.create({
+ serviceGroupName: 'CORE'
+ });
beforeEach(function() {
sinon.stub(mainServiceController, 'allServicesCall', Em.K);
@@ -254,8 +147,8 @@ describe('App.MainServiceController', function () {
});
it ("should confirm stop if state is INSTALLED", function() {
- mainServiceController.startStopAllService(event, "INSTALLED");
- expect(Em.I18n.t.calledWith('services.service.stopAll.confirmMsg')).to.be.ok;
+ mainServiceController.startStopAllService(serviceGroup, "INSTALLED");
+ expect(Em.I18n.t.calledWith('services.service.core.stopAll.confirmMsg')).to.be.ok;
expect(Em.I18n.t.calledWith('services.service.stop.confirmButton')).to.be.ok;
});
@@ -287,15 +180,15 @@ describe('App.MainServiceController', function () {
});
it('checkNnLastCheckpointTime is called once', function () {
- mainServiceController.startStopAllService(event, "INSTALLED");
+ mainServiceController.startStopAllService(serviceGroup, "INSTALLED");
expect(mainServiceItemController.checkNnLastCheckpointTime.calledOnce).to.equal(true);
});
});
it ("should confirm start if state is not INSTALLED", function() {
- mainServiceController.startStopAllService(event, "STARTED");
- expect(Em.I18n.t.calledWith('services.service.startAll.confirmMsg')).to.be.ok;
+ mainServiceController.startStopAllService(serviceGroup, "STARTED");
+ expect(Em.I18n.t.calledWith('services.service.core.startAll.confirmMsg')).to.be.ok;
expect(Em.I18n.t.calledWith('services.service.start.confirmButton')).to.be.ok;
});
});
@@ -304,13 +197,26 @@ describe('App.MainServiceController', function () {
var state = 'STARTED',
query = 'some query';
+ var serviceGroup = Em.Object.create({
+ services: [
+ Em.Object.create({
+ serviceName: 'HDFS'
+ }),
+ Em.Object.create({
+ serviceName: 'YARN'
+ }),
+ Em.Object.create({
+ serviceName: 'MAPREDUCE2'
+ })
+ ]
+ });
beforeEach(function() {
sinon.stub(App, 'get', function(k) {
if ('clusterName' === k) return 'tdk';
return Em.get(App, k);
});
- mainServiceController.allServicesCall(state, query);
+ mainServiceController.allServicesCall(state, query, serviceGroup);
var args = testHelpers.findAjaxRequest('name', 'common.services.update');
this.params = App.ajax.fakeGetUrl('common.services.update').format(args[0].data);
this.data = JSON.parse(this.params.data);
@@ -353,21 +259,19 @@ describe('App.MainServiceController', function () {
});
it('should not go to wizard', function() {
- mainServiceController.reopen({isAllServicesInstalled: true});
+ mainServiceController.reopen({isAllCoreServicesInstalled: true});
mainServiceController.gotoAddService();
expect(App.router.transitionTo.called).to.be.false;
});
it('should go to wizard', function() {
- mainServiceController.reopen({isAllServicesInstalled: false});
+ mainServiceController.reopen({isAllCoreServicesInstalled: false});
mainServiceController.gotoAddService();
expect(App.router.transitionTo.calledWith('main.serviceAdd')).to.be.true;
});
});
- App.TestAliases.testAsComputedEveryBy(getController(), 'isRestartAllRequiredDisabled', 'content', 'isRestartRequired', false);
-
describe('#restartAllRequired', function () {
beforeEach(function () {
@@ -411,23 +315,20 @@ describe('App.MainServiceController', function () {
App.showConfirmationPopup.restore();
mainServiceController.restartHostComponents.restore();
});
+ var serviceGroup = Em.Object.create({
+ isRestartAllRequiredDisabled: false
+ });
it('should show confirmation popup with list of services and call restartHostComponents after confirmation', function () {
- var popup;
- mainServiceController.reopen({
- isRestartAllRequiredDisabled: false
- });
- popup = mainServiceController.restartAllRequired();
+ var popup = mainServiceController.restartAllRequired(serviceGroup);
popup.onPrimary();
expect(App.showConfirmationPopup.args[0][1]).to.equal(Em.I18n.t('services.service.refreshAll.confirmMsg').format('displayName1, displayName2'));
expect(mainServiceController.restartHostComponents.calledOnce).to.be.true;
});
it('should not open popup if isRestartAllRequiredDisabled is true', function(){
- mainServiceController.reopen({
- isRestartAllRequiredDisabled: true
- });
- expect(mainServiceController.restartAllRequired()).to.be.null;
+ serviceGroup.set('isRestartAllRequiredDisabled', true);
+ expect(mainServiceController.restartAllRequired(serviceGroup)).to.be.null;
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/b88db3cc/ambari-web/test/models/service_group_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/service_group_test.js b/ambari-web/test/models/service_group_test.js
new file mode 100644
index 0000000..ff91682
--- /dev/null
+++ b/ambari-web/test/models/service_group_test.js
@@ -0,0 +1,47 @@
+/**
+ * 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');
+
+function getModel() {
+ return App.ServiceGroup.createRecord();
+}
+
+describe('App.ServiceGroup', function () {
+
+ App.TestAliases.testAsComputedOr(getModel(), 'isStartAllDisabled', ['isStartStopAllClicked', '!someServiceIsStopped']);
+
+ App.TestAliases.testAsComputedOr(getModel(), 'isStopAllDisabled', ['isStartStopAllClicked', '!someServiceIsStarted']);
+
+ App.TestAliases.testAsComputedEveryBy(getModel(), 'isRestartAllRequiredDisabled', 'services', 'isRestartRequired', false);
+
+ App.TestAliases.testAsComputedSomeBy(getModel(), 'someServiceIsStarted', 'services', 'healthStatus', 'green');
+
+ App.TestAliases.testAsComputedEveryBy(getModel(), 'allServicesAreStarted', 'services', 'healthStatus', 'green');
+
+ App.TestAliases.testAsComputedNotEqual(getModel(), 'isStartStopAllClicked', 'App.router.backgroundOperationsController.allOperationsCount', 0);
+
+ App.TestAliases.testAsComputedEqual(getModel(), 'isCoreServiceGroup', 'serviceGroupName', 'CORE');
+
+ App.TestAliases.testAsComputedSumBy(getModel(), 'alertsCount', 'services', 'alertsCount');
+
+ App.TestAliases.testAsComputedEqual(getModel(), 'isStopped', 'desiredState', 'INSTALLED');
+
+ App.TestAliases.testAsComputedEqual(getModel(), 'isStarted', 'desiredState', 'STARTED');
+
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/b88db3cc/ambari-web/test/views/main/assemblies/active_store_app_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/assemblies/active_store_app_view_test.js b/ambari-web/test/views/main/assemblies/active_store_app_view_test.js
new file mode 100644
index 0000000..0535bd5
--- /dev/null
+++ b/ambari-web/test/views/main/assemblies/active_store_app_view_test.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');
+
+function getView() {
+ return App.ActiveStoreAppView.create({});
+}
+
+describe('App.ActiveStoreAppView', function() {
+
+ App.TestAliases.testAsComputedFirstNotBlank(getView(), 'title', ['storeApp.title', 'storeApp.name']);
+
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/b88db3cc/ambari-web/test/views/main/assemblies/apps_row_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/assemblies/apps_row_view_test.js b/ambari-web/test/views/main/assemblies/apps_row_view_test.js
new file mode 100644
index 0000000..396c36b
--- /dev/null
+++ b/ambari-web/test/views/main/assemblies/apps_row_view_test.js
@@ -0,0 +1,39 @@
+/**
+ * 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 view;
+
+function getView() {
+ return App.AppsRowView.create({apps: []});
+}
+
+describe('App.AppsRowView', function() {
+
+ beforeEach(function() {
+ view = getView();
+ });
+
+ App.TestAliases.testAsComputedFindBy(getView(), 'activeApp', 'visibleApps', 'isActive', true);
+
+ App.TestAliases.testAsComputedEqual(getView(), 'disabledLeft', 'startIndex', 0);
+
+ App.TestAliases.testAsComputedGteProperties(getView(), 'disabledRight', 'endIndex', 'apps.length');
+
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/b88db3cc/ambari-web/test/views/main/assemblies/store_app_block_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/assemblies/store_app_block_view_test.js b/ambari-web/test/views/main/assemblies/store_app_block_view_test.js
new file mode 100644
index 0000000..5794c92
--- /dev/null
+++ b/ambari-web/test/views/main/assemblies/store_app_block_view_test.js
@@ -0,0 +1,47 @@
+/**
+ * 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 view;
+
+function getView() {
+ return App.StoreAppBlockView.create({
+ storeApp: Em.Object.create({
+ storeCategories: [Em.Object.create({name: 'n1'}), Em.Object.create({name: 'n2'}), Em.Object.create({name: 'n3'})]
+ })
+ });
+}
+
+describe('App.StoreAppBlockView', function() {
+
+ beforeEach(function () {
+ view = getView();
+ });
+
+ describe('#categoryNames', function () {
+
+ it('should be mapped with coma', function () {
+ expect(view.get('categoryNames')).to.be.equal('n1, n2, n3');
+ });
+
+ });
+
+ App.TestAliases.testAsComputedGt(getView(), 'moreServices', 'storeApp.services.length', 19);
+
+});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/b88db3cc/ambari-web/test/views/main/service/info/summary_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/service/info/summary_test.js b/ambari-web/test/views/main/service/info/summary_test.js
index d9fff97..a120ed0 100644
--- a/ambari-web/test/views/main/service/info/summary_test.js
+++ b/ambari-web/test/views/main/service/info/summary_test.js
@@ -559,11 +559,13 @@ describe('App.MainServiceInfoSummaryView', function() {
sinon.stub(App.StackService, 'find').returns(mock);
sinon.stub(view, 'getUserPref').returns({
complete: function(callback){callback();}
- })
+ });
+ view.set('controller.content.serviceGroupName', 'CORE');
});
afterEach(function() {
App.StackService.find.restore();
view.getUserPref.restore();
+ view.set('controller.content.serviceGroupName', undefined);
});
it("metrics not loaded", function() {
http://git-wip-us.apache.org/repos/asf/ambari/blob/b88db3cc/ambari-web/vendor/scripts/highlight.pack.js
----------------------------------------------------------------------
diff --git a/ambari-web/vendor/scripts/highlight.pack.js b/ambari-web/vendor/scripts/highlight.pack.js
new file mode 100644
index 0000000..ceb5ea6
--- /dev/null
+++ b/ambari-web/vendor/scripts/highlight.pack.js
@@ -0,0 +1,2 @@
+/*! highlight.js v9.4.0 | BSD3 License | git.io/hljslicense */
+!function(e){var n="object"==typeof window&&window||"object"==typeof self&&self;"undefined"!=typeof exports?e(exports):n&&(n.hljs=e({}),"function"==typeof define&&define.amd&&define([],function(){return n.hljs}))}(function(e){function n(e){return e.replace(/&/gm,"&").replace(/</gm,"<").replace(/>/gm,">")}function t(e){return e.nodeName.toLowerCase()}function r(e,n){var t=e&&e.exec(n);return t&&0==t.index}function a(e){return/^(no-?highlight|plain|text)$/i.test(e)}function i(e){var n,t,r,i=e.className+" ";if(i+=e.parentNode?e.parentNode.className:"",t=/\blang(?:uage)?-([\w-]+)\b/i.exec(i))return w(t[1])?t[1]:"no-highlight";for(i=i.split(/\s+/),n=0,r=i.length;r>n;n++)if(w(i[n])||a(i[n]))return i[n]}function o(e,n){var t,r={};for(t in e)r[t]=e[t];if(n)for(t in n)r[t]=n[t];return r}function u(e){var n=[];return function r(e,a){for(var i=e.firstChild;i;i=i.nextSibling)3==i.nodeType?a+=i.nodeValue.length:1==i.nodeType&&(n.push({event:"start",offset:a,node:i}),a=r(i,a),t(i).match
(/br|hr|img|input/)||n.push({event:"stop",offset:a,node:i}));return a}(e,0),n}function c(e,r,a){function i(){return e.length&&r.length?e[0].offset!=r[0].offset?e[0].offset<r[0].offset?e:r:"start"==r[0].event?e:r:e.length?e:r}function o(e){function r(e){return" "+e.nodeName+'="'+n(e.value)+'"'}f+="<"+t(e)+Array.prototype.map.call(e.attributes,r).join("")+">"}function u(e){f+="</"+t(e)+">"}function c(e){("start"==e.event?o:u)(e.node)}for(var s=0,f="",l=[];e.length||r.length;){var g=i();if(f+=n(a.substr(s,g[0].offset-s)),s=g[0].offset,g==e){l.reverse().forEach(u);do c(g.splice(0,1)[0]),g=i();while(g==e&&g.length&&g[0].offset==s);l.reverse().forEach(o)}else"start"==g[0].event?l.push(g[0].node):l.pop(),c(g.splice(0,1)[0])}return f+n(a.substr(s))}function s(e){function n(e){return e&&e.source||e}function t(t,r){return new RegExp(n(t),"m"+(e.cI?"i":"")+(r?"g":""))}function r(a,i){if(!a.compiled){if(a.compiled=!0,a.k=a.k||a.bK,a.k){var u={},c=function(n,t){e.cI&&(t=t.toLowerCase()),t.split(
" ").forEach(function(e){var t=e.split("|");u[t[0]]=[n,t[1]?Number(t[1]):1]})};"string"==typeof a.k?c("keyword",a.k):Object.keys(a.k).forEach(function(e){c(e,a.k[e])}),a.k=u}a.lR=t(a.l||/\w+/,!0),i&&(a.bK&&(a.b="\\b("+a.bK.split(" ").join("|")+")\\b"),a.b||(a.b=/\B|\b/),a.bR=t(a.b),a.e||a.eW||(a.e=/\B|\b/),a.e&&(a.eR=t(a.e)),a.tE=n(a.e)||"",a.eW&&i.tE&&(a.tE+=(a.e?"|":"")+i.tE)),a.i&&(a.iR=t(a.i)),void 0===a.r&&(a.r=1),a.c||(a.c=[]);var s=[];a.c.forEach(function(e){e.v?e.v.forEach(function(n){s.push(o(e,n))}):s.push("self"==e?a:e)}),a.c=s,a.c.forEach(function(e){r(e,a)}),a.starts&&r(a.starts,i);var f=a.c.map(function(e){return e.bK?"\\.?("+e.b+")\\.?":e.b}).concat([a.tE,a.i]).map(n).filter(Boolean);a.t=f.length?t(f.join("|"),!0):{exec:function(){return null}}}}r(e)}function f(e,t,a,i){function o(e,n){for(var t=0;t<n.c.length;t++)if(r(n.c[t].bR,e))return n.c[t]}function u(e,n){if(r(e.eR,n)){for(;e.endsParent&&e.parent;)e=e.parent;return e}return e.eW?u(e.parent,n):void 0}function c(e
,n){return!a&&r(n.iR,e)}function g(e,n){var t=N.cI?n[0].toLowerCase():n[0];return e.k.hasOwnProperty(t)&&e.k[t]}function p(e,n,t,r){var a=r?"":E.classPrefix,i='<span class="'+a,o=t?"":"</span>";return i+=e+'">',i+n+o}function h(){if(!k.k)return n(M);var e="",t=0;k.lR.lastIndex=0;for(var r=k.lR.exec(M);r;){e+=n(M.substr(t,r.index-t));var a=g(k,r);a?(B+=a[1],e+=p(a[0],n(r[0]))):e+=n(r[0]),t=k.lR.lastIndex,r=k.lR.exec(M)}return e+n(M.substr(t))}function d(){var e="string"==typeof k.sL;if(e&&!R[k.sL])return n(M);var t=e?f(k.sL,M,!0,y[k.sL]):l(M,k.sL.length?k.sL:void 0);return k.r>0&&(B+=t.r),e&&(y[k.sL]=t.top),p(t.language,t.value,!1,!0)}function b(){L+=void 0!==k.sL?d():h(),M=""}function v(e,n){L+=e.cN?p(e.cN,"",!0):"",k=Object.create(e,{parent:{value:k}})}function m(e,n){if(M+=e,void 0===n)return b(),0;var t=o(n,k);if(t)return t.skip?M+=n:(t.eB&&(M+=n),b(),t.rB||t.eB||(M=n)),v(t,n),t.rB?0:n.length;var r=u(k,n);if(r){var a=k;a.skip?M+=n:(a.rE||a.eE||(M+=n),b(),a.eE&&(M=n));do k.cN&&(L+
="</span>"),k.skip||(B+=k.r),k=k.parent;while(k!=r.parent);return r.starts&&v(r.starts,""),a.rE?0:n.length}if(c(n,k))throw new Error('Illegal lexeme "'+n+'" for mode "'+(k.cN||"<unnamed>")+'"');return M+=n,n.length||1}var N=w(e);if(!N)throw new Error('Unknown language: "'+e+'"');s(N);var x,k=i||N,y={},L="";for(x=k;x!=N;x=x.parent)x.cN&&(L=p(x.cN,"",!0)+L);var M="",B=0;try{for(var C,j,I=0;;){if(k.t.lastIndex=I,C=k.t.exec(t),!C)break;j=m(t.substr(I,C.index-I),C[0]),I=C.index+j}for(m(t.substr(I)),x=k;x.parent;x=x.parent)x.cN&&(L+="</span>");return{r:B,value:L,language:e,top:k}}catch(O){if(-1!=O.message.indexOf("Illegal"))return{r:0,value:n(t)};throw O}}function l(e,t){t=t||E.languages||Object.keys(R);var r={r:0,value:n(e)},a=r;return t.filter(w).forEach(function(n){var t=f(n,e,!1);t.language=n,t.r>a.r&&(a=t),t.r>r.r&&(a=r,r=t)}),a.language&&(r.second_best=a),r}function g(e){return E.tabReplace&&(e=e.replace(/^((<[^>]+>|\t)+)/gm,function(e,n){return n.replace(/\t/g,E.tabReplace)})),E.us
eBR&&(e=e.replace(/\n/g,"<br>")),e}function p(e,n,t){var r=n?x[n]:t,a=[e.trim()];return e.match(/\bhljs\b/)||a.push("hljs"),-1===e.indexOf(r)&&a.push(r),a.join(" ").trim()}function h(e){var n=i(e);if(!a(n)){var t;E.useBR?(t=document.createElementNS("http://www.w3.org/1999/xhtml","div"),t.innerHTML=e.innerHTML.replace(/\n/g,"").replace(/<br[ \/]*>/g,"\n")):t=e;var r=t.textContent,o=n?f(n,r,!0):l(r),s=u(t);if(s.length){var h=document.createElementNS("http://www.w3.org/1999/xhtml","div");h.innerHTML=o.value,o.value=c(s,u(h),r)}o.value=g(o.value),e.innerHTML=o.value,e.className=p(e.className,n,o.language),e.result={language:o.language,re:o.r},o.second_best&&(e.second_best={language:o.second_best.language,re:o.second_best.r})}}function d(e){E=o(E,e)}function b(){if(!b.called){b.called=!0;var e=document.querySelectorAll("pre code");Array.prototype.forEach.call(e,h)}}function v(){addEventListener("DOMContentLoaded",b,!1),addEventListener("load",b,!1)}function m(n,t){var r=R[n]=t(e);r.alias
es&&r.aliases.forEach(function(e){x[e]=n})}function N(){return Object.keys(R)}function w(e){return e=(e||"").toLowerCase(),R[e]||R[x[e]]}var E={classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:void 0},R={},x={};return e.highlight=f,e.highlightAuto=l,e.fixMarkup=g,e.highlightBlock=h,e.configure=d,e.initHighlighting=b,e.initHighlightingOnLoad=v,e.registerLanguage=m,e.listLanguages=N,e.getLanguage=w,e.inherit=o,e.IR="[a-zA-Z]\\w*",e.UIR="[a-zA-Z_]\\w*",e.NR="\\b\\d+(\\.\\d+)?",e.CNR="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",e.BNR="\\b(0b[01]+)",e.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",e.BE={b:"\\\\[\\s\\S]",r:0},e.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[e.BE]},e.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[e.BE]},e.PWM={b:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|like)\
b/},e.C=function(n,t,r){var a=e.inherit({cN:"comment",b:n,e:t,c:[]},r||{});return a.c.push(e.PWM),a.c.push({cN:"doctag",b:"(?:TODO|FIXME|NOTE|BUG|XXX):",r:0}),a},e.CLCM=e.C("//","$"),e.CBCM=e.C("/\\*","\\*/"),e.HCM=e.C("#","$"),e.NM={cN:"number",b:e.NR,r:0},e.CNM={cN:"number",b:e.CNR,r:0},e.BNM={cN:"number",b:e.BNR,r:0},e.CSSNM={cN:"number",b:e.NR+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",r:0},e.RM={cN:"regexp",b:/\//,e:/\/[gimuy]*/,i:/\n/,c:[e.BE,{b:/\[/,e:/\]/,r:0,c:[e.BE]}]},e.TM={cN:"title",b:e.IR,r:0},e.UTM={cN:"title",b:e.UIR,r:0},e.METHOD_GUARD={b:"\\.\\s*"+e.UIR,r:0},e});hljs.registerLanguage("json",function(e){var i={literal:"true false null"},n=[e.QSM,e.CNM],r={e:",",eW:!0,eE:!0,c:n,k:i},t={b:"{",e:"}",c:[{cN:"attr",b:/"/,e:/"/,c:[e.BE],i:"\\n"},e.inherit(r,{b:/:/})],i:"\\S"},c={b:"\\[",e:"\\]",c:[e.inherit(r)],i:"\\S"};return n.splice(n.length,0,t,c),{c:n,k:i,i:"\\S"}});hljs.registerLanguage("xml",function(s){var e="
[A-Za-z0-9\\._:-]+",t={eW:!0,i:/</,r:0,c:[{cN:"attr",b:e,r:0},{b:/=\s*/,r:0,c:[{cN:"string",endsParent:!0,v:[{b:/"/,e:/"/},{b:/'/,e:/'/},{b:/[^\s"'=<>`]+/}]}]}]};return{aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist"],cI:!0,c:[{cN:"meta",b:"<!DOCTYPE",e:">",r:10,c:[{b:"\\[",e:"\\]"}]},s.C("<!--","-->",{r:10}),{b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{b:/<\?(php)?/,e:/\?>/,sL:"php",c:[{b:"/\\*",e:"\\*/",skip:!0}]},{cN:"tag",b:"<style(?=\\s|>|$)",e:">",k:{name:"style"},c:[t],starts:{e:"</style>",rE:!0,sL:["css","xml"]}},{cN:"tag",b:"<script(?=\\s|>|$)",e:">",k:{name:"script"},c:[t],starts:{e:"</script>",rE:!0,sL:["actionscript","javascript","handlebars","xml"]}},{cN:"meta",v:[{b:/<\?xml/,e:/\?>/,r:10},{b:/<\?\w+/,e:/\?>/}]},{cN:"tag",b:"</?",e:"/?>",c:[{cN:"name",b:/[^\/><\s]+/,r:0},t]}]}});hljs.registerLanguage("javascript",function(e){return{aliases:["js","jsx"],k:{keyword:"in of if for while finally var new function do return void else break catch instanceof with throw
case default try this switch continue typeof delete let yield const export super debugger as async await static import from as",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect Promise"},c:[{cN:"meta",r:10,b:/^\s*['"]use (strict|asm)['"]/},{cN:"meta",b:/^#!/,e:/$/},e.ASM,e.QSM,{cN:"string",b:"`",e:"`",c:[e.BE,{cN:"subst",b:"\\$\\{",e:"\\}"}]},e.CLCM,e.CBCM,{cN:"number",v:[{b:"\\b(0[bB][01]+)"},{b:"\\b(0[oO][0-7]+)"},{b:e.CNR}],r:0},{b:"("+e.RSR+"|\\b(case|return|throw)\
\b)\\s*",k:"return throw case",c:[e.CLCM,e.CBCM,e.RM,{b:/</,e:/(\/\w+|\w+\/)>/,sL:"xml",c:[{b:/<\w+\s*\/>/,skip:!0},{b:/<\w+/,e:/(\/\w+|\w+\/)>/,skip:!0,c:["self"]}]}],r:0},{cN:"function",bK:"function",e:/\{/,eE:!0,c:[e.inherit(e.TM,{b:/[A-Za-z$_][0-9A-Za-z$_]*/}),{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,c:[e.CLCM,e.CBCM]}],i:/\[|%/},{b:/\$[(.]/},e.METHOD_GUARD,{cN:"class",bK:"class",e:/[{;=]/,eE:!0,i:/[:"\[\]]/,c:[{bK:"extends"},e.UTM]},{bK:"constructor",e:/\{/,eE:!0}],i:/#(?!!)/}});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/b88db3cc/ambari-web/vendor/styles/highlight.css
----------------------------------------------------------------------
diff --git a/ambari-web/vendor/styles/highlight.css b/ambari-web/vendor/styles/highlight.css
new file mode 100644
index 0000000..f1bfade
--- /dev/null
+++ b/ambari-web/vendor/styles/highlight.css
@@ -0,0 +1,99 @@
+/*
+
+Original highlight.js style (c) Ivan Sagalaev <ma...@softwaremaniacs.org>
+
+*/
+
+.hljs {
+ display: block;
+ overflow-x: auto;
+ padding: 0.5em;
+ background: #F0F0F0;
+}
+
+
+/* Base color: saturation 0; */
+
+.hljs,
+.hljs-subst {
+ color: #444;
+}
+
+.hljs-comment {
+ color: #888888;
+}
+
+.hljs-keyword,
+.hljs-attribute,
+.hljs-selector-tag,
+.hljs-meta-keyword,
+.hljs-doctag,
+.hljs-name {
+ font-weight: bold;
+}
+
+
+/* User color: hue: 0 */
+
+.hljs-type,
+.hljs-string,
+.hljs-number,
+.hljs-selector-id,
+.hljs-selector-class,
+.hljs-quote,
+.hljs-template-tag,
+.hljs-deletion {
+ color: #880000;
+}
+
+.hljs-title,
+.hljs-section {
+ color: #880000;
+ font-weight: bold;
+}
+
+.hljs-regexp,
+.hljs-symbol,
+.hljs-variable,
+.hljs-template-variable,
+.hljs-link,
+.hljs-selector-attr,
+.hljs-selector-pseudo {
+ color: #BC6060;
+}
+
+
+/* Language color: hue: 90; */
+
+.hljs-literal {
+ color: #78A960;
+}
+
+.hljs-built_in,
+.hljs-bullet,
+.hljs-code,
+.hljs-addition {
+ color: #397300;
+}
+
+
+/* Meta color: hue: 200 */
+
+.hljs-meta {
+ color: #1f7199;
+}
+
+.hljs-meta-string {
+ color: #4d99bf;
+}
+
+
+/* Misc effects */
+
+.hljs-emphasis {
+ font-style: italic;
+}
+
+.hljs-strong {
+ font-weight: bold;
+}