You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by at...@apache.org on 2014/11/24 17:46:48 UTC
ambari git commit: AMBARI-8425 Host Details: Integration stack
versions table with server. (atkach)
Repository: ambari
Updated Branches:
refs/heads/trunk 84ecfa562 -> ab77f2bf0
AMBARI-8425 Host Details: Integration stack versions table with server. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ab77f2bf
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ab77f2bf
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ab77f2bf
Branch: refs/heads/trunk
Commit: ab77f2bf0787f4d80abd4bd38958bca62f822033
Parents: 84ecfa5
Author: Andrii Tkach <at...@hortonworks.com>
Authored: Mon Nov 24 15:44:57 2014 +0200
Committer: Andrii Tkach <at...@hortonworks.com>
Committed: Mon Nov 24 18:45:36 2014 +0200
----------------------------------------------------------------------
.../app/assets/data/hosts/HDP2/hosts.json | 25 ++++---
.../app/controllers/global/update_controller.js | 3 +-
ambari-web/app/controllers/main/host.js | 77 ++++++++++++--------
ambari-web/app/mappers/hosts_mapper.js | 10 +--
ambari-web/app/views/common/filter_view.js | 6 +-
ambari-web/app/views/main/host.js | 45 +++++++++---
.../app/views/main/host/stack_versions_view.js | 25 ++-----
ambari-web/app/views/main/host/summary.js | 3 +-
.../test/views/common/filter_view_test.js | 53 ++++++++++----
9 files changed, 155 insertions(+), 92 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/ab77f2bf/ambari-web/app/assets/data/hosts/HDP2/hosts.json
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/data/hosts/HDP2/hosts.json b/ambari-web/app/assets/data/hosts/HDP2/hosts.json
index 4275ee2..b7d1893 100644
--- a/ambari-web/app/assets/data/hosts/HDP2/hosts.json
+++ b/ambari-web/app/assets/data/hosts/HDP2/hosts.json
@@ -15,36 +15,41 @@
},
"stack_versions": [
{
- "StackVersion": {
- "name": "HDP-2.2",
+ "HostStackVersions": {
+ "id": 1,
+ "stack": "HDP-2.2",
"version": "2.2.0.1-885",
"state": "INIT"
}
},
{
- "StackVersion": {
- "name": "HDP-2.2",
+ "HostStackVersions": {
+ "id": 2,
+ "stack": "HDP-2.2",
"version": "2.2.1.1-885",
"state": "INSTALLED"
}
},
{
- "StackVersion": {
- "name": "HDP-2.2",
+ "HostStackVersions": {
+ "id": 3,
+ "stack": "HDP-2.2",
"version": "2.2.2.1-885",
"state": "INSTALL_FAILED"
}
},
{
- "StackVersion": {
- "name": "HDP-2.3",
+ "HostStackVersions": {
+ "id": 4,
+ "stack": "HDP-2.3",
"version": "2.3.0.1-885",
"state": "INSTALLING"
}
},
{
- "StackVersion": {
- "name": "HDP-2.3",
+ "HostStackVersions": {
+ "id": 5,
+ "stack": "HDP-2.3",
"version": "2.3.1.1-885",
"state": "CURRENT"
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/ab77f2bf/ambari-web/app/controllers/global/update_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/update_controller.js b/ambari-web/app/controllers/global/update_controller.js
index 9393f3b..e54716b 100644
--- a/ambari-web/app/controllers/global/update_controller.js
+++ b/ambari-web/app/controllers/global/update_controller.js
@@ -157,8 +157,9 @@ App.UpdateController = Em.Controller.extend({
var realUrl = '/hosts?<parameters>fields=Hosts/host_name,Hosts/maintenance_state,Hosts/public_host_name,Hosts/cpu_count,Hosts/ph_cpu_count,' +
'Hosts/host_status,Hosts/last_heartbeat_time,Hosts/ip,host_components/HostRoles/state,host_components/HostRoles/maintenance_state,' +
'host_components/HostRoles/stale_configs,host_components/HostRoles/service_name,host_components/HostRoles/desired_admin_state,' +
- 'metrics/disk,metrics/load/load_one,Hosts/total_mem&minimal_response=true';
+ 'metrics/disk,metrics/load/load_one,Hosts/total_mem<hostAuxiliaryInfo><stackVersions>&minimal_response=true';
var hostAuxiliaryInfo = ',Hosts/os_arch,Hosts/os_type,metrics/cpu/cpu_system,metrics/cpu/cpu_user,metrics/memory/mem_total,metrics/memory/mem_free';
+ realUrl = realUrl.replace("<stackVersions>", (App.get('supports.stackUpgrade') ? ",stack_versions/HostStackVersions" : ""));
if (App.router.get('currentState.name') == 'index' && App.router.get('currentState.parentState.name') == 'hosts') {
App.updater.updateInterval('updateHost', App.get('contentUpdateInterval'));
http://git-wip-us.apache.org/repos/asf/ambari/blob/ab77f2bf/ambari-web/app/controllers/main/host.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host.js b/ambari-web/app/controllers/main/host.js
index 63945ec..787bd66 100644
--- a/ambari-web/app/controllers/main/host.js
+++ b/ambari-web/app/controllers/main/host.js
@@ -68,59 +68,64 @@ App.MainHostController = Em.ArrayController.extend(App.TableServerMixin, {
*/
filterProperties: [
{
- key: 'hostName',
- alias: 'Hosts/host_name',
+ name: 'hostName',
+ key: 'Hosts/host_name',
type: 'MATCH'
},
{
- key: 'ip',
- alias: 'Hosts/ip',
+ name: 'ip',
+ key: 'Hosts/ip',
type: 'MATCH'
},
{
- key: 'cpu',
- alias: 'Hosts/cpu_count',
+ name: 'cpu',
+ key: 'Hosts/cpu_count',
type: 'EQUAL'
},
{
- key: 'memoryFormatted',
- alias: 'Hosts/total_mem',
+ name: 'memoryFormatted',
+ key: 'Hosts/total_mem',
type: 'EQUAL'
},
{
- key: 'loadAvg',
- alias: 'metrics/load/load_one',
+ name: 'loadAvg',
+ key: 'metrics/load/load_one',
type: 'EQUAL'
},
{
- key: 'hostComponents',
- alias: 'host_components/HostRoles/component_name',
+ name: 'hostComponents',
+ key: 'host_components/HostRoles/component_name',
type: 'MULTIPLE'
},
{
- key: 'healthClass',
- alias: 'Hosts/host_status',
+ name: 'healthClass',
+ key: 'Hosts/host_status',
type: 'EQUAL'
},
{
- key: 'criticalAlertsCount',
- alias: 'legacy_alerts/summary/CRITICAL{0}|legacy_alerts/summary/WARNING{1}',
+ name: 'criticalAlertsCount',
+ key: 'legacy_alerts/summary/CRITICAL{0}|legacy_alerts/summary/WARNING{1}',
type: 'CUSTOM'
},
{
- key: 'componentsWithStaleConfigsCount',
- alias: 'host_components/HostRoles/stale_configs',
+ name: 'componentsWithStaleConfigsCount',
+ key: 'host_components/HostRoles/stale_configs',
type: 'EQUAL'
},
{
- key: 'componentsInPassiveStateCount',
- alias: 'host_components/HostRoles/maintenance_state',
+ name: 'componentsInPassiveStateCount',
+ key: 'host_components/HostRoles/maintenance_state',
type: 'MULTIPLE'
},
{
- key: 'selected',
- alias: 'Hosts/host_name',
+ name: 'selected',
+ key: 'Hosts/host_name',
type: 'MULTIPLE'
+ },
+ {
+ name: 'stackVersions',
+ key: 'stack_versions/HostStackVersions',
+ type: 'EQUAL'
}
],
@@ -197,10 +202,10 @@ App.MainHostController = Em.ArrayController.extend(App.TableServerMixin, {
queryParams.pushObjects(this.getPaginationProps());
savedFilterConditions.forEach(function (filter) {
- var property = filterProperties.findProperty('key', colPropAssoc[filter.iColumn]);
+ var property = filterProperties.findProperty('name', colPropAssoc[filter.iColumn]);
if (property && filter.value.length > 0 && !filter.skipFilter) {
var result = {
- key: property.alias,
+ key: property.key,
value: filter.value,
type: property.type,
isFilter: true
@@ -229,7 +234,15 @@ App.MainHostController = Em.ArrayController.extend(App.TableServerMixin, {
// enter a comparison type, eg > 1, just do regular match
result.value = this.convertMemory(filter.value);
queryParams.push(result);
- } else if (result.value) {
+ } else if (filter.type === 'sub-resource') {
+ filter.value.forEach(function (item) {
+ queryParams.push({
+ key: result.key + "/" + item.property,
+ value: item.value,
+ type: 'EQUAL'
+ });
+ }, this);
+ } else {
queryParams.push(result);
}
@@ -458,10 +471,16 @@ App.MainHostController = Em.ArrayController.extend(App.TableServerMixin, {
var filterForStack = {
iColumn: column,
- value: {
- version: version,
- status: state.toUpperCase()
- },
+ value: [
+ {
+ property: 'version',
+ value: version
+ },
+ {
+ property: 'state',
+ value: state.toUpperCase()
+ }
+ ],
type: 'sub-resource'
};
App.db.setFilterConditions(this.get('name'), [filterForStack]);
http://git-wip-us.apache.org/repos/asf/ambari/blob/ab77f2bf/ambari-web/app/mappers/hosts_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/hosts_mapper.js b/ambari-web/app/mappers/hosts_mapper.js
index 4f2f0a1..e4f6733 100644
--- a/ambari-web/app/mappers/hosts_mapper.js
+++ b/ambari-web/app/mappers/hosts_mapper.js
@@ -67,9 +67,9 @@ App.hostsMapper = App.QuickDataMapper.create({
stackVersionConfig: {
id: 'id',
stack_id: 'stack_id',
- stack_name: 'StackVersion.name',
- version: 'StackVersion.version',
- status: 'StackVersion.state',
+ stack_name: 'HostStackVersions.stack',
+ version: 'HostStackVersions.version',
+ status: 'HostStackVersions.state',
host_name: 'host_name',
host_id: 'host_name'
},
@@ -106,9 +106,9 @@ App.hostsMapper = App.QuickDataMapper.create({
if (App.get('supports.stackUpgrade')) {
item.stack_versions.forEach(function (stackVersion) {
- stackVersion.id = stackVersion.StackVersion.name + "_" + stackVersion.StackVersion.version + "_" + item.Hosts.host_name;
+ stackVersion.id = stackVersion.HostStackVersions.stack + "_" + stackVersion.HostStackVersions.version + "_" + item.Hosts.host_name;
stackVersion.host_name = item.Hosts.host_name;
- stackVersion.stack_id = stackVersion.StackVersion.name + stackVersion.StackVersion.version;
+ stackVersion.stack_id = stackVersion.HostStackVersions.stack + stackVersion.HostStackVersions.version;
stackVersions.push(this.parseIt(stackVersion, this.stackVersionConfig));
}, this);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/ab77f2bf/ambari-web/app/views/common/filter_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/filter_view.js b/ambari-web/app/views/common/filter_view.js
index 60829b5..1efcb72 100644
--- a/ambari-web/app/views/common/filter_view.js
+++ b/ambari-web/app/views/common/filter_view.js
@@ -541,11 +541,11 @@ module.exports = {
break;
case 'sub-resource':
return function (origin, compareValue) {
- if (Ember.isNone(compareValue) || App.isEmptyObject(compareValue)) return true;
+ if (!Array.isArray(compareValue) || compareValue.length === 0) return true;
return origin.some(function (item) {
- for (var i in compareValue) {
- if(item.get(i) !== compareValue[i]) return false
+ for (var i = 0, l = compareValue.length; i < l; i++) {
+ if(item.get(compareValue[i].property) !== compareValue[i].value) return false
}
return true;
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/ab77f2bf/ambari-web/app/views/main/host.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host.js b/ambari-web/app/views/main/host.js
index d331764..34b8e30 100644
--- a/ambari-web/app/views/main/host.js
+++ b/ambari-web/app/views/main/host.js
@@ -1003,31 +1003,43 @@ App.MainHostView = App.TableView.extend(App.TableServerViewMixin, {
templateName: require('templates/main/host/version_filter'),
selectedVersion: null,
selecteStatus: null,
- value: {},
+ value: [],
versionSelectView: filters.createSelectView({
+ classNames: ['notActive'],
fieldType: 'filter-input-width',
content: function () {
- return this.get('parentView.parentView.parentView.stackVersions').map(function (version) {
+ return [
+ {
+ value: '',
+ label: Em.I18n.t('common.all')
+ }
+ ].concat(this.get('parentView.parentView.parentView.stackVersions').map(function (version) {
return {
value: version,
label: version
}
- });
+ }));
}.property('App.router.clusterController.isLoaded'),
onChangeValue: function () {
this.set('parentView.selectedVersion', this.get('value'));
}
}),
statusSelectView: filters.createSelectView({
+ classNames: ['notActive'],
fieldType: 'filter-input-width',
content: function () {
- return App.HostStackVersion.statusDefinition.map(function (status) {
+ return [
+ {
+ value: '',
+ label: Em.I18n.t('common.all')
+ }
+ ].concat(App.HostStackVersion.statusDefinition.map(function (status) {
return {
value: status,
label: App.HostStackVersion.formatStatus(status)
}
- });
+ }));
}.property('App.router.clusterController.isLoaded'),
onChangeValue: function () {
this.set('parentView.selectedStatus', this.get('value'));
@@ -1039,12 +1051,18 @@ App.MainHostView = App.TableView.extend(App.TableServerViewMixin, {
applyFilter: function () {
this._super();
var self = this;
- var filterProperties = {};
+ var filterProperties = [];
if (this.get('selectedVersion')) {
- filterProperties['version'] = this.get('selectedVersion');
+ filterProperties.push({
+ property: 'version',
+ value: this.get('selectedVersion')
+ });
}
if (this.get('selectedStatus')) {
- filterProperties['status'] = this.get('selectedStatus');
+ filterProperties.push({
+ property: 'state',
+ value: this.get('selectedStatus')
+ });
}
self.set('value', filterProperties);
},
@@ -1052,11 +1070,20 @@ App.MainHostView = App.TableView.extend(App.TableServerViewMixin, {
* Clear filter to initial state
*/
clearFilter: function () {
- this.set('value', {});
+ this.set('value', []);
+ this.get('childViews').forEach(function (view) {
+ if (typeof view.clearFilter === "function") view.clearFilter();
+ });
}
}),
onChangeValue: function () {
this.get('parentView').updateFilter(this.get('column'), this.get('value'), 'sub-resource');
+ },
+ clearFilter: function () {
+ this._super();
+ this.get('childViews').forEach(function (view) {
+ if (typeof view.clearFilter === "function") view.clearFilter();
+ });
}
}),
http://git-wip-us.apache.org/repos/asf/ambari/blob/ab77f2bf/ambari-web/app/views/main/host/stack_versions_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host/stack_versions_view.js b/ambari-web/app/views/main/host/stack_versions_view.js
index 8b004cb..f45ba17 100644
--- a/ambari-web/app/views/main/host/stack_versions_view.js
+++ b/ambari-web/app/views/main/host/stack_versions_view.js
@@ -121,25 +121,14 @@ App.MainHostStackVersionsView = App.TableView.extend({
{
value: '',
label: Em.I18n.t('common.all')
- },
- {
- value: 'INSTALLED',
- label: Em.I18n.t('hosts.host.stackVersions.status.installed')
- },
- {
- value: 'INSTALLING',
- label: Em.I18n.t('hosts.host.stackVersions.status.installing')
- },
- {
- value: 'INSTALL_FAILED',
- label: Em.I18n.t('hosts.host.stackVersions.status.install_failed')
- },
- {
- value: 'INIT',
- label: Em.I18n.t('hosts.host.stackVersions.status.init')
}
- ];
- }.property('App.router.clusterController.isLoaded'),
+ ].concat(App.HostStackVersion.statusDefinition.map(function (status) {
+ return {
+ value: status,
+ label: App.HostStackVersion.formatStatus(status)
+ }
+ }));
+ }.property(),
onChangeValue: function () {
this.get('parentView').updateFilter(this.get('column'), this.get('value'), 'select');
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/ab77f2bf/ambari-web/app/views/main/host/summary.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host/summary.js b/ambari-web/app/views/main/host/summary.js
index c8317a9..b462722 100644
--- a/ambari-web/app/views/main/host/summary.js
+++ b/ambari-web/app/views/main/host/summary.js
@@ -96,6 +96,7 @@ App.MainHostSummaryView = Em.View.extend({
willInsertElement: function() {
this.set('sortedComponents', []);
this.sortedComponentsFormatter();
+ this.addObserver('content.hostComponents.length', this, 'sortedComponentsFormatter');
},
didInsertElement: function () {
@@ -171,7 +172,7 @@ App.MainHostSummaryView = Em.View.extend({
}
}
}, this);
- }.observes('content.hostComponents.length'),
+ },
/**
* List of installed clients
http://git-wip-us.apache.org/repos/asf/ambari/blob/ab77f2bf/ambari-web/test/views/common/filter_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/filter_view_test.js b/ambari-web/test/views/common/filter_view_test.js
index 3c8aeee..21f4b01 100644
--- a/ambari-web/test/views/common/filter_view_test.js
+++ b/ambari-web/test/views/common/filter_view_test.js
@@ -404,7 +404,7 @@ describe('filters.getFilterByType', function () {
},
{
title: 'condition is empty',
- condition: {},
+ condition: [],
value: [Em.Object.create({
prop1: 1
})],
@@ -412,9 +412,12 @@ describe('filters.getFilterByType', function () {
},
{
title: 'condition match one property',
- condition: {
- prop1: 1
- },
+ condition: [
+ {
+ property: 'prop1',
+ value: 1
+ }
+ ],
value: [Em.Object.create({
prop1: 1
})],
@@ -422,10 +425,16 @@ describe('filters.getFilterByType', function () {
},
{
title: 'condition match two properties',
- condition: {
- prop1: 1,
- prop2: 2
- },
+ condition: [
+ {
+ property: 'prop1',
+ value: 1
+ },
+ {
+ property: 'prop2',
+ value: 2
+ }
+ ],
value: [Em.Object.create({
prop1: 1,
prop2: 2
@@ -434,10 +443,16 @@ describe('filters.getFilterByType', function () {
},
{
title: 'only one of two properties match',
- condition: {
- prop1: 3,
- prop2: 2
- },
+ condition: [
+ {
+ property: 'prop1',
+ value: 3
+ },
+ {
+ property: 'prop2',
+ value: 2
+ }
+ ],
value: [Em.Object.create({
prop1: 1,
prop2: 2
@@ -446,10 +461,16 @@ describe('filters.getFilterByType', function () {
},
{
title: 'none of two properties match',
- condition: {
- prop1: 3,
- prop2: 4
- },
+ condition: [
+ {
+ property: 'prop1',
+ value: 3
+ },
+ {
+ property: 'prop2',
+ value: 4
+ }
+ ],
value: [Em.Object.create({
prop1: 1,
prop2: 2