|
@@ -89,7 +89,7 @@ App.UpdateController = Em.Controller.extend({
|
|
|
},
|
|
|
|
|
|
getUrl: function (testUrl, url) {
|
|
|
- return (App.get('testMode')) ? testUrl : App.apiPrefix + '/clusters/' + this.get('clusterName') + url;
|
|
|
+ return App.get('testMode') ? testUrl : App.apiPrefix + '/clusters/' + this.get('clusterName') + url;
|
|
|
},
|
|
|
|
|
|
/**
|
|
@@ -105,7 +105,7 @@ App.UpdateController = Em.Controller.extend({
|
|
|
if (queryParams) {
|
|
|
params = this.computeParameters(queryParams);
|
|
|
}
|
|
|
- params = (params.length > 0) ? params + "&" : params;
|
|
|
+ params = params.length > 0 ? params + "&" : params;
|
|
|
return prefix + realUrl.replace('<parameters>', params);
|
|
|
},
|
|
|
|
|
@@ -136,12 +136,9 @@ App.UpdateController = Em.Controller.extend({
|
|
|
break;
|
|
|
case 'MATCH':
|
|
|
if (Em.isArray(param.value)) {
|
|
|
- params += '(';
|
|
|
- param.value.forEach(function(v) {
|
|
|
- params += param.key + '.matches(' + v + ')' + '|';
|
|
|
- });
|
|
|
- params = params.substring(0, params.length - 1);
|
|
|
- params += ')';
|
|
|
+ params += '(' + param.value.map(function(v) {
|
|
|
+ return param.key + '.matches(' + v + ')';
|
|
|
+ }).join('|') + ')';
|
|
|
} else {
|
|
|
params += param.key + '.matches(' + param.value + ')';
|
|
|
}
|
|
@@ -235,12 +232,12 @@ App.UpdateController = Em.Controller.extend({
|
|
|
sortProperties = mainHostController.getSortProps(),
|
|
|
isHostsLoaded = false;
|
|
|
this.get('queryParams').set('Hosts', mainHostController.getQueryParameters(true));
|
|
|
- if (App.router.get('currentState.parentState.name') == 'hosts') {
|
|
|
+ if (App.router.get('currentState.parentState.name') === 'hosts') {
|
|
|
App.updater.updateInterval('updateHost', App.get('contentUpdateInterval'));
|
|
|
hostDetailsParams = '';
|
|
|
}
|
|
|
else {
|
|
|
- if (App.router.get('currentState.parentState.name') == 'hostDetails') {
|
|
|
+ if (App.router.get('currentState.parentState.name') === 'hostDetails') {
|
|
|
hostDetailsFilter = App.router.get('location.lastSetURL').match(/\/hosts\/(.*)\/(summary|configs|alerts|stackVersions|logs)/)[1];
|
|
|
App.updater.updateInterval('updateHost', App.get('componentsUpdateInterval'));
|
|
|
//if host details page opened then request info only of one displayed host
|
|
@@ -263,8 +260,8 @@ App.UpdateController = Em.Controller.extend({
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- realUrl = realUrl.replace("<stackVersions>", (App.get('supports.stackUpgrade') ? stackVersionInfo : ""));
|
|
|
- realUrl = realUrl.replace("<metrics>", (lazyLoadMetrics ? "" : "metrics/disk,metrics/load/load_one,"));
|
|
|
+ realUrl = realUrl.replace("<stackVersions>", App.get('supports.stackUpgrade') ? stackVersionInfo : "");
|
|
|
+ realUrl = realUrl.replace("<metrics>", lazyLoadMetrics ? "" : "metrics/disk,metrics/load/load_one,");
|
|
|
realUrl = realUrl.replace('<hostDetailsParams>', hostDetailsParams);
|
|
|
|
|
|
var clientCallback = function (skipCall, queryParams) {
|
|
@@ -286,7 +283,7 @@ App.UpdateController = Em.Controller.extend({
|
|
|
if (App.get('testMode')) {
|
|
|
realUrl = testUrl;
|
|
|
} else {
|
|
|
- realUrl = self.addParamsToHostsUrl.call(self, queryParams, sortProperties, realUrl);
|
|
|
+ realUrl = self.addParamsToHostsUrl(queryParams, sortProperties, realUrl);
|
|
|
}
|
|
|
|
|
|
App.HttpClient.get(realUrl, App.hostsMapper, {
|
|
@@ -312,7 +309,7 @@ App.UpdateController = Em.Controller.extend({
|
|
|
*/
|
|
|
addParamsToHostsUrl: function (queryParams, sortProperties, realUrl) {
|
|
|
var paginationProps = this.computeParameters(queryParams.filter(function (param) {
|
|
|
- return (this.get('paginationKeys').contains(param.key));
|
|
|
+ return this.get('paginationKeys').contains(param.key);
|
|
|
}, this));
|
|
|
var sortProps = this.computeParameters(sortProperties);
|
|
|
|
|
@@ -362,7 +359,7 @@ App.UpdateController = Em.Controller.extend({
|
|
|
var preLoadKeys = this.get('hostsPreLoadKeys');
|
|
|
|
|
|
if (this.get('queryParams.Hosts').length > 0 && this.get('queryParams.Hosts').filter(function (param) {
|
|
|
- return (preLoadKeys.contains(param.key));
|
|
|
+ return preLoadKeys.contains(param.key);
|
|
|
}, this).length > 0) {
|
|
|
this.getHostByHostComponents(callback);
|
|
|
return true;
|
|
@@ -394,7 +391,7 @@ App.UpdateController = Em.Controller.extend({
|
|
|
var hostNames = data.items.mapProperty('Hosts.host_name');
|
|
|
var skipCall = hostNames.length === 0;
|
|
|
|
|
|
- var itemTotal = parseInt(data.itemTotal);
|
|
|
+ var itemTotal = parseInt(data.itemTotal, 10);
|
|
|
if (!isNaN(itemTotal)) {
|
|
|
App.router.set('mainHostController.filteredCount', itemTotal);
|
|
|
}
|
|
@@ -403,7 +400,7 @@ App.UpdateController = Em.Controller.extend({
|
|
|
params.callback(skipCall);
|
|
|
} else {
|
|
|
queryParams = queryParams.filter(function (param) {
|
|
|
- return !(preLoadKeys.contains(param.key));
|
|
|
+ return !preLoadKeys.contains(param.key);
|
|
|
});
|
|
|
|
|
|
queryParams.push({
|
|
@@ -450,8 +447,8 @@ App.UpdateController = Em.Controller.extend({
|
|
|
requestsRunningStatus = this.get('requestsRunningStatus'),
|
|
|
conditionalFieldsString = conditionalFields.length > 0 ? ',' + conditionalFields.join(',') : '',
|
|
|
testUrl = '/data/dashboard/HDP2/master_components.json',
|
|
|
- isFlumeInstalled = App.cache['services'].mapProperty('ServiceInfo.service_name').contains('FLUME'),
|
|
|
- isATSInstalled = App.cache['services'].mapProperty('ServiceInfo.service_name').contains('YARN') && isATSPresent,
|
|
|
+ isFlumeInstalled = App.cache.services.mapProperty('ServiceInfo.service_name').contains('FLUME'),
|
|
|
+ isATSInstalled = App.cache.services.mapProperty('ServiceInfo.service_name').contains('YARN') && isATSPresent,
|
|
|
flumeHandlerParam = isFlumeInstalled ? 'ServiceComponentInfo/component_name=FLUME_HANDLER|' : '',
|
|
|
atsHandlerParam = isATSInstalled ? 'ServiceComponentInfo/component_name=APP_TIMELINE_SERVER|' : '',
|
|
|
haComponents = App.get('isHaEnabled') ? 'ServiceComponentInfo/component_name=JOURNALNODE|ServiceComponentInfo/component_name=ZKFC|' : '',
|
|
@@ -473,12 +470,12 @@ App.UpdateController = Em.Controller.extend({
|
|
|
self.set('isUpdated', true);
|
|
|
};
|
|
|
|
|
|
- if (!requestsRunningStatus["updateServiceMetric"]) {
|
|
|
- requestsRunningStatus["updateServiceMetric"] = true;
|
|
|
+ if (!requestsRunningStatus.updateServiceMetric) {
|
|
|
+ requestsRunningStatus.updateServiceMetric = true;
|
|
|
App.HttpClient.get(servicesUrl, App.serviceMetricsMapper, {
|
|
|
complete: function () {
|
|
|
App.set('router.mainServiceItemController.isServicesInfoLoaded', App.get('router.clusterController.isLoaded'));
|
|
|
- requestsRunningStatus["updateServiceMetric"] = false;
|
|
|
+ requestsRunningStatus.updateServiceMetric = false;
|
|
|
callback();
|
|
|
}
|
|
|
});
|
|
@@ -496,12 +493,12 @@ App.UpdateController = Em.Controller.extend({
|
|
|
var metricsKey = 'metrics/';
|
|
|
|
|
|
if (/^2.1/.test(App.get('currentStackVersionNumber'))) {
|
|
|
- serviceSpecificParams['STORM'] = 'metrics/api/cluster/summary';
|
|
|
+ serviceSpecificParams.STORM = 'metrics/api/cluster/summary';
|
|
|
} else if (/^2.2/.test(App.get('currentStackVersionNumber'))) {
|
|
|
- serviceSpecificParams['STORM'] = 'metrics/api/v1/cluster/summary,metrics/api/v1/topology/summary';
|
|
|
+ serviceSpecificParams.STORM = 'metrics/api/v1/cluster/summary,metrics/api/v1/topology/summary';
|
|
|
}
|
|
|
|
|
|
- App.cache['services'].forEach(function (service) {
|
|
|
+ App.cache.services.forEach(function (service) {
|
|
|
var urlParams = serviceSpecificParams[service.ServiceInfo.service_name];
|
|
|
if (urlParams) {
|
|
|
conditionalFields.push(urlParams);
|
|
@@ -511,7 +508,7 @@ App.UpdateController = Em.Controller.extend({
|
|
|
//first load shouldn't contain metrics in order to make call lighter
|
|
|
if (!App.get('router.clusterController.isServiceMetricsLoaded')) {
|
|
|
return conditionalFields.filter(function (condition) {
|
|
|
- return (condition.indexOf(metricsKey) === -1);
|
|
|
+ return condition.indexOf(metricsKey) === -1;
|
|
|
});
|
|
|
}
|
|
|
|