AMBARI-12463. Decrease initial application load time. (jaimin)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/508d8db4 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/508d8db4 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/508d8db4 Branch: refs/heads/branch-2.1 Commit: 508d8db4c138e74cad833dd461862daa825dc52f Parents: 96735e2 Author: Jaimin Jetly <jai...@hortonworks.com> Authored: Tue Jul 21 12:43:22 2015 -0700 Committer: Jaimin Jetly <jai...@hortonworks.com> Committed: Tue Jul 21 12:43:22 2015 -0700 ---------------------------------------------------------------------- .../controllers/global/cluster_controller.js | 257 ++++++------------- .../app/controllers/global/update_controller.js | 4 +- ambari-web/app/controllers/main.js | 27 ++ .../nameNode/step5_controller.js | 2 +- .../main/admin/kerberos/step2_controller.js | 5 - .../main/admin/kerberos/wizard_controller.js | 2 +- .../main/alert_definitions_controller.js | 7 - ambari-web/app/controllers/main/host/details.js | 1 - ambari-web/app/controllers/main/service.js | 4 +- .../controllers/main/service/add_controller.js | 4 +- .../controllers/main/service/info/configs.js | 4 +- ambari-web/app/controllers/main/service/item.js | 1 - .../main/service/reassign/step4_controller.js | 2 +- .../main/service/reassign_controller.js | 62 ----- .../app/controllers/wizard/step7_controller.js | 9 +- .../app/controllers/wizard/step8_controller.js | 22 +- .../mappers/alert_definition_summary_mapper.js | 4 - .../app/mappers/alert_definitions_mapper.js | 3 - ambari-web/app/mappers/cluster_mapper.js | 5 +- .../app/mappers/components_state_mapper.js | 34 ++- ambari-web/app/mappers/racks_mapper.js | 5 - ambari-web/app/mappers/service_mapper.js | 2 + ambari-web/app/messages.js | 2 +- ambari-web/app/mixins/common/serverValidator.js | 2 +- .../app/mixins/wizard/addSecurityConfigs.js | 2 +- .../wizard/wizardProgressPageController.js | 2 +- ambari-web/app/models.js | 1 + ambari-web/app/models/cluster.js | 22 +- ambari-web/app/models/master_component.js | 28 ++ ambari-web/app/models/service.js | 8 + ambari-web/app/router.js | 57 ++-- ambari-web/app/routes/add_service_routes.js | 167 ++++++------ ambari-web/app/routes/main.js | 27 +- ambari-web/app/templates/application.hbs | 14 +- ambari-web/app/templates/main/alerts.hbs | 105 ++++---- .../app/templates/main/host/host_alerts.hbs | 78 +++--- .../templates/main/service/services/hbase.hbs | 74 +++--- .../templates/main/service/services/hdfs.hbs | 132 ++++++---- .../templates/main/service/services/storm.hbs | 99 +++---- .../templates/main/service/services/yarn.hbs | 77 +++--- ambari-web/app/utils/ajax/ajax.js | 2 +- ambari-web/app/utils/components.js | 29 ++- ambari-web/app/utils/http_client.js | 2 +- ambari-web/app/utils/updater.js | 2 +- .../main/dashboard/widgets/datanode_live.js | 26 +- .../dashboard/widgets/node_managers_live.js | 8 +- .../main/dashboard/widgets/supervisor_live.js | 8 +- .../main/host/details/host_component_view.js | 22 +- ambari-web/app/views/main/host/summary.js | 28 +- .../app/views/main/service/info/configs.js | 5 +- .../views/main/service/reassign/step5_view.js | 4 +- .../global/cluster_controller_test.js | 117 --------- .../admin/kerberos/step4_controller_test.js | 10 +- .../test/controllers/main/host/details_test.js | 23 +- .../main/service/add_controller_test.js | 4 +- .../test/controllers/main/service/item_test.js | 3 - .../service/reassign/step4_controller_test.js | 24 +- .../test/controllers/main/service_test.js | 2 +- .../test/controllers/wizard/step8_test.js | 6 +- .../wizard/wizardProgressPageController_test.js | 11 +- ambari-web/test/router_test.js | 24 +- .../widgets/node_managers_live_test.js | 10 +- .../host/details/host_component_view_test.js | 22 +- 63 files changed, 838 insertions(+), 917 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/508d8db4/ambari-web/app/controllers/global/cluster_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/global/cluster_controller.js b/ambari-web/app/controllers/global/cluster_controller.js index f83d03e..b16de85 100644 --- a/ambari-web/app/controllers/global/cluster_controller.js +++ b/ambari-web/app/controllers/global/cluster_controller.js @@ -25,15 +25,21 @@ App.ClusterController = Em.Controller.extend({ ambariProperties: null, clusterDataLoadedPercent: 'width:0', // 0 to 1 - isGangliaUrlLoaded: false, + isClusterNameLoaded: false, - /** - * Provides the URL to use for Ganglia server. This URL - * is helpful in populating links in UI. - * - * If null is returned, it means GANGLIA service is not installed. - */ - gangliaUrl: null, + isAlertsLoaded: false, + + isComponentsStateLoaded: false, + + isHostsLoaded: false, + + isConfigsPropertiesLoaded: false, + + isStackConfigsLoaded: false, + + isHostContentLoaded: function () { + return this.get('isHostsLoaded') && this.get('isComponentsStateLoaded'); + }.property('isHostsLoaded', 'isComponentsStateLoaded'), clusterName: function () { return App.get('clusterName'); @@ -62,18 +68,9 @@ App.ClusterController = Em.Controller.extend({ }, dataLoadList: Em.Object.create({ - 'hosts': false, 'serviceMetrics': false, 'stackComponents': false, - 'services': false, - 'cluster': false, - 'clusterStatus': false, - 'racks': false, - 'componentConfigs': false, - 'componentsState': false, - 'rootService': false, - 'alertDefinitions': false, - 'securityStatus': false + 'services': false }), /** @@ -84,6 +81,7 @@ App.ClusterController = Em.Controller.extend({ if (App.get('clusterName') && !reload) { App.set('clusterName', this.get('clusterName')); + this.set('isClusterNameLoaded', true); dfd.resolve(); } else { App.ajax.send({ @@ -105,6 +103,8 @@ App.ClusterController = Em.Controller.extend({ if (data.items && data.items.length > 0) { App.set('clusterName', data.items[0].Clusters.cluster_name); App.set('currentStackVersion', data.items[0].Clusters.version); + this.set('isClusterNameLoaded', true); + App.set('isKerberosEnabled', data.items[0].Clusters.security_type === 'KERBEROS'); } }, @@ -151,51 +151,6 @@ App.ClusterController = Em.Controller.extend({ return (App.get('testMode')) ? testUrl : App.get('apiPrefix') + '/clusters/' + App.get('clusterName') + url; }, - setGangliaUrl: function () { - if (App.get('testMode')) { - this.set('gangliaUrl', 'http://gangliaserver/ganglia/?t=yes'); - this.set('isGangliaUrlLoaded', true); - } else { - // We want live data here - var gangliaServer = App.HostComponent.find().findProperty('componentName', 'GANGLIA_SERVER'); - if (this.get('isLoaded') && gangliaServer) { - this.set('isGangliaUrlLoaded', false); - App.ajax.send({ - name: 'hosts.for_quick_links', - sender: this, - data: { - clusterName: App.get('clusterName'), - masterHosts: gangliaServer.get('hostName'), - urlParams: '' - }, - success: 'setGangliaUrlSuccessCallback' - }); - } - } - }.observes('App.router.updateController.isUpdated', 'dataLoadList.hosts', 'gangliaWebProtocol', 'isLoaded'), - - setGangliaUrlSuccessCallback: function (response) { - var url = null; - if (response.items.length > 0) { - url = this.get('gangliaWebProtocol') + "://" + (App.singleNodeInstall ? App.singleNodeAlias + ":42080" : response.items[0].Hosts.public_host_name) + "/ganglia"; - } - this.set('gangliaUrl', url); - this.set('isGangliaUrlLoaded', true); - }, - - gangliaWebProtocol: function () { - var properties = this.get('ambariProperties'); - if (properties && properties.hasOwnProperty('ganglia.https') && properties['ganglia.https']) { - return "https"; - } else { - return "http"; - } - }.property('ambariProperties'), - - isGangliaInstalled: function () { - return !!App.Service.find().findProperty('serviceName', 'GANGLIA'); - }.property('App.router.updateController.isUpdated', 'dataLoadList.serviceMetrics'), - /** * load all data and update load status */ @@ -213,112 +168,88 @@ App.ClusterController = Em.Controller.extend({ } var clusterUrl = this.getUrl('/data/clusters/cluster.json', '?fields=Clusters'); - var racksUrl = "/data/racks/racks.json"; - - var hostsController = App.router.get('mainHostController'); hostsController.set('isCountersUpdating', true); hostsController.updateStatusCounters(); - App.HttpClient.get(racksUrl, App.racksMapper, { - complete: function (jqXHR, textStatus) { - self.updateLoadStatus('racks'); - } - }, function (jqXHR, textStatus) { - self.updateLoadStatus('racks'); - }); - App.HttpClient.get(clusterUrl, App.clusterMapper, { complete: function (jqXHR, textStatus) { - self.updateLoadStatus('cluster'); } }, function (jqXHR, textStatus) { - self.updateLoadStatus('cluster'); }); - if (App.get('testMode')) { - self.updateLoadStatus('clusterStatus'); - } else { - App.clusterStatus.updateFromServer().complete(function () { - self.updateLoadStatus('clusterStatus'); - if (App.get('supports.stackUpgrade')) { - self.restoreUpgradeState(); - } - }); + + if (App.get('supports.stackUpgrade')) { + self.restoreUpgradeState(); } + + var updater = App.router.get('updateController'); + /** * Order of loading: * 1. load all created service components - * 2. request for service components supported by stack - * 3. load stack components to model - * 4. request for services - * 5. put services in cache - * 6. request for hosts and host-components (single call) - * 7. request for service metrics - * 8. load host-components to model - * 9. load hosts to model - * 10. load services from cache with metrics to model - * 11. update stale_configs of host-components (depends on App.supports.hostOverrides) - * 12. load root service (Ambari) - * 13. load alert definitions to model - * 14. load unhealthy alert instances - * 15. load security status + * 1. request for service components supported by stack + * 2. load stack components to model + * 3. request for services + * 4. put services in cache + * 5. request for hosts and host-components (single call) + * 6. request for service metrics + * 7. load host-components to model + * 8. load services from cache with metrics to model */ - self.loadServiceComponents(function () { - self.loadStackServiceComponents(function (data) { - data.items.forEach(function (service) { - service.StackServices.is_selected = true; - service.StackServices.is_installed = false; - }, self); - App.stackServiceMapper.mapStackServices(data); - App.config.setPreDefinedServiceConfigs(true); - var updater = App.router.get('updateController'); - self.updateLoadStatus('stackComponents'); - updater.updateServices(function () { - self.updateLoadStatus('services'); - //force clear filters for hosts page to load all data - App.db.setFilterConditions('mainHostController', null); - - updater.updateHost(function () { - self.updateLoadStatus('hosts'); + self.loadStackServiceComponents(function (data) { + data.items.forEach(function (service) { + service.StackServices.is_selected = true; + service.StackServices.is_installed = false; + }, self); + App.stackServiceMapper.mapStackServices(data); + App.config.setPreDefinedServiceConfigs(true); + self.updateLoadStatus('stackComponents'); + updater.updateServices(function () { + self.updateLoadStatus('services'); + updater.updateServiceMetric(function () { + self.updateLoadStatus('serviceMetrics'); + App.config.loadConfigsFromStack(App.Service.find().mapProperty('serviceName')).complete(function () { + self.set('isConfigsPropertiesLoaded', true); }); + }); + }); + }); + + //force clear filters for hosts page to load all data + App.db.setFilterConditions('mainHostController', null); + + // hosts loading doesn't affect overall progress + updater.updateHost(function () { + self.set('isHostsLoaded', true); + }); - updater.updateServiceMetric(function () { - App.config.loadConfigsFromStack(App.Service.find().mapProperty('serviceName')).complete(function () { - updater.updateComponentConfig(function () { - self.updateLoadStatus('componentConfigs'); - }); - - updater.updateComponentsState(function () { - self.updateLoadStatus('componentsState'); - }); - self.updateLoadStatus('serviceMetrics'); - - updater.updateAlertGroups(function () { - updater.updateAlertDefinitions(function () { - updater.updateAlertDefinitionSummary(function () { - updater.updateUnhealthyAlertInstances(function () { - self.updateLoadStatus('alertGroups'); - self.updateLoadStatus('alertDefinitions'); - self.updateLoadStatus('alertInstancesUnhealthy'); - }); - }); - }); - }); - }); + // alerts loading doesn't affect overall progress + updater.updateAlertGroups(function () { + updater.updateAlertDefinitions(function () { + updater.updateAlertDefinitionSummary(function () { + updater.updateUnhealthyAlertInstances(function() { + self.set('isAlertsLoaded', true); }); }); - self.loadRootService().done(function (data) { - App.rootServiceMapper.map(data); - self.updateLoadStatus('rootService'); - }); - // load security status - App.router.get('mainAdminKerberosController').getSecurityStatus().always(function () { - self.updateLoadStatus('securityStatus'); - }); }); }); + // components state and config loading doesn't affect overall progress + updater.updateComponentConfig(Em.K); + updater.updateComponentsState(function () { + self.set('isComponentsStateLoaded', true); + }); + + /* Root service mapper maps all the data exposed under Ambari root service which includes ambari configurations i.e ambari-properties + ** This is useful information but its not being used in the code anywhere as of now + + self.loadRootService().done(function (data) { + App.rootServiceMapper.map(data); + self.updateLoadStatus('rootService'); + }); + + */ }, /** @@ -326,7 +257,7 @@ App.ClusterController = Em.Controller.extend({ * and make call to get latest status from server */ restoreUpgradeState: function () { - this.getAllUpgrades().done(function (data) { + return this.getAllUpgrades().done(function (data) { var upgradeController = App.router.get('mainAdminStackAndUpgradeController'); var lastUpgradeData = data.items.sortProperty('Upgrade.request_id').pop(); var dbUpgradeState = App.db.get('MainAdminStackAndUpgrade', 'upgradeState'); @@ -370,36 +301,6 @@ App.ClusterController = Em.Controller.extend({ }, /** - * Load data about created service components - * @param callback - */ - loadServiceComponents: function (callback) { - App.ajax.send({ - name: 'service.components.load', - sender: this, - data: { - callback: callback - }, - success: 'loadStackServiceComponentsSuccess' - }); - }, - - /** - * Callback for load service components request - * @param data - * @param request - * @param params - */ - loadStackServiceComponentsSuccess: function (data, request, params) { - var serviceComponents = []; - data.items.forEach(function (service) { - serviceComponents = serviceComponents.concat(service.components.mapProperty('ServiceComponentInfo.component_name')); - }); - App.serviceComponents = serviceComponents; - params.callback(); - }, - - /** * * @param callback */ http://git-wip-us.apache.org/repos/asf/ambari/blob/508d8db4/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 9a1d53a..f5c45fe 100644 --- a/ambari-web/app/controllers/global/update_controller.js +++ b/ambari-web/app/controllers/global/update_controller.js @@ -496,7 +496,7 @@ App.UpdateController = Em.Controller.extend({ }, updateServices: function (callback) { var testUrl = '/data/services/HDP2/services.json'; - var componentConfigUrl = this.getUrl(testUrl, '/services?fields=ServiceInfo/state,ServiceInfo/maintenance_state&minimal_response=true'); + var componentConfigUrl = this.getUrl(testUrl, '/services?fields=ServiceInfo/state,ServiceInfo/maintenance_state,components/ServiceComponentInfo/component_name&minimal_response=true'); App.HttpClient.get(componentConfigUrl, App.serviceMapper, { complete: callback }); @@ -510,7 +510,7 @@ App.UpdateController = Em.Controller.extend({ }, updateComponentsState: function (callback) { var testUrl = '/data/services/HDP2/components_state.json'; - var realUrl = '/components/?ServiceComponentInfo/category.in(SLAVE,CLIENT)&fields=ServiceComponentInfo/service_name,' + + var realUrl = '/components/?fields=ServiceComponentInfo/service_name,' + 'ServiceComponentInfo/category,ServiceComponentInfo/installed_count,ServiceComponentInfo/started_count,ServiceComponentInfo/total_count,host_components/HostRoles/host_name&minimal_response=true'; var url = this.getUrl(testUrl, realUrl); http://git-wip-us.apache.org/repos/asf/ambari/blob/508d8db4/ambari-web/app/controllers/main.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main.js b/ambari-web/app/controllers/main.js index 09ae8df..932c8af 100644 --- a/ambari-web/app/controllers/main.js +++ b/ambari-web/app/controllers/main.js @@ -64,6 +64,33 @@ App.MainController = Em.Controller.extend({ return dfd.promise(); }, + /** + * + * @param isLoaded {Boolean} + * @param opts {Object} + * { + * period {Number} + * } + * @return {*|{then}} + */ + isLoading: function(isLoaded, opts) { + var dfd = $.Deferred(); + var self = this; + opts = opts || {}; + var period = opts.period || 20; + if (this.get(isLoaded)) { + dfd.resolve(); + } else { + var interval = setInterval(function () { + if (self.get(isLoaded)) { + dfd.resolve(); + clearInterval(interval); + } + }, period); + } + return dfd.promise(); + }, + startPolling: function () { if (App.router.get('applicationController.isExistingClusterDataLoaded')) { App.router.get('updateController').set('isWorking', true); http://git-wip-us.apache.org/repos/asf/ambari/blob/508d8db4/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step5_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step5_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step5_controller.js index 9f310ee..09e6d3c 100644 --- a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step5_controller.js +++ b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step5_controller.js @@ -59,7 +59,7 @@ App.HighAvailabilityWizardStep5Controller = App.HighAvailabilityProgressPageCont reconfigureHDFS: function () { var data = this.get('content.serviceConfigProperties'); - if (App.router.get('mainAdminKerberosController.securityEnabled')) { + if (App.get('isKerberosEnabled')) { this.reconfigureSecureHDFS(); } else { this.updateConfigProperties(data); http://git-wip-us.apache.org/repos/asf/ambari/blob/508d8db4/ambari-web/app/controllers/main/admin/kerberos/step2_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/admin/kerberos/step2_controller.js b/ambari-web/app/controllers/main/admin/kerberos/step2_controller.js index 0691891..f6828ef 100644 --- a/ambari-web/app/controllers/main/admin/kerberos/step2_controller.js +++ b/ambari-web/app/controllers/main/admin/kerberos/step2_controller.js @@ -131,15 +131,10 @@ App.KerberosWizardStep2Controller = App.WizardStep7Controller.extend({ this.set('isSubmitDisabled', true); var self = this; this.deleteKerberosService().always(function (data) { - self.removeLocalKerberosComponentData(); self.configureKerberos(); }); }, - removeLocalKerberosComponentData: function () { - App.serviceComponents.removeObject('KERBEROS_CLIENT'); - }, - configureKerberos: function () { var self = this; var wizardController = App.router.get(this.get('content.controllerName')); http://git-wip-us.apache.org/repos/asf/ambari/blob/508d8db4/ambari-web/app/controllers/main/admin/kerberos/wizard_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/admin/kerberos/wizard_controller.js b/ambari-web/app/controllers/main/admin/kerberos/wizard_controller.js index 5251b66..e66d6c7 100644 --- a/ambari-web/app/controllers/main/admin/kerberos/wizard_controller.js +++ b/ambari-web/app/controllers/main/admin/kerberos/wizard_controller.js @@ -204,7 +204,7 @@ App.KerberosWizardController = App.WizardController.extend({ createKerberosResources: function (callback) { var self = this; this.createKerberosService().done(function () { - componentsUtils.createServiceComponent('KERBEROS_CLIENT').done(function () { + componentsUtils.updateAndCreateServiceComponent('KERBEROS_CLIENT').done(function () { self.createKerberosHostComponents().done(callback); }); }); http://git-wip-us.apache.org/repos/asf/ambari/blob/508d8db4/ambari-web/app/controllers/main/alert_definitions_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/alert_definitions_controller.js b/ambari-web/app/controllers/main/alert_definitions_controller.js index a1222e5..e77ee6d 100644 --- a/ambari-web/app/controllers/main/alert_definitions_controller.js +++ b/ambari-web/app/controllers/main/alert_definitions_controller.js @@ -23,13 +23,6 @@ App.MainAlertDefinitionsController = Em.ArrayController.extend({ name: 'mainAlertDefinitionsController', /** - * Timestamp when <code>App.alertDefinitionsMapper</code> run last time - * Current <code>content</code> is updated on when it changed - * @type {number|null} - */ - mapperTimestamp: null, - - /** * Define whether restore filter conditions from local db * @type {Boolean} */ http://git-wip-us.apache.org/repos/asf/ambari/blob/508d8db4/ambari-web/app/controllers/main/host/details.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js index 87da8c2..d274dd0 100644 --- a/ambari-web/app/controllers/main/host/details.js +++ b/ambari-web/app/controllers/main/host/details.js @@ -2113,7 +2113,6 @@ App.MainHostDetailsController = Em.Controller.extend({ var component = event.context; var reassignMasterController = App.router.get('reassignMasterController'); reassignMasterController.saveComponentToReassign(component); - reassignMasterController.getSecurityStatus(); reassignMasterController.setCurrentStep('1'); App.router.transitionTo('reassign'); }); http://git-wip-us.apache.org/repos/asf/ambari/blob/508d8db4/ambari-web/app/controllers/main/service.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service.js b/ambari-web/app/controllers/main/service.js index d87c15c..d1346e4 100644 --- a/ambari-web/app/controllers/main/service.js +++ b/ambari-web/app/controllers/main/service.js @@ -37,11 +37,11 @@ App.MainServiceController = Em.ArrayController.extend({ * @type {Ember.Object} */ cluster: function () { - if (!App.router.get('clusterController.isLoaded')) { + if (!App.router.get('clusterController.isClusterDataLoaded')) { return null; } return App.Cluster.find().objectAt(0); - }.property('App.router.clusterController.isLoaded'), + }.property('App.router.clusterController.isClusterDataLoaded'), /** * Check if all services are installed http://git-wip-us.apache.org/repos/asf/ambari/blob/508d8db4/ambari-web/app/controllers/main/service/add_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/add_controller.js b/ambari-web/app/controllers/main/service/add_controller.js index adf5c37..777775d 100644 --- a/ambari-web/app/controllers/main/service/add_controller.js +++ b/ambari-web/app/controllers/main/service/add_controller.js @@ -297,7 +297,7 @@ App.AddServiceController = App.WizardController.extend(App.AddSecurityConfigs, { loadKerberosDescriptorConfigs: function() { var self = this, dfd = $.Deferred(); - if (App.router.get('mainAdminKerberosController.securityEnabled')) { + if (App.get('isKerberosEnabled')) { this.getDescriptorConfigs().then(function(properties) { self.set('kerberosDescriptorConfigs', properties); }).always(function(){ @@ -589,7 +589,7 @@ App.AddServiceController = App.WizardController.extend(App.AddSecurityConfigs, { }, checkSecurityStatus: function() { - if (!App.router.get('mainAdminKerberosController.securityEnabled')) { + if (!App.get('isKerberosEnabled')) { this.set('skipConfigureIdentitiesStep', true); this.get('isStepDisabled').findProperty('step', 5).set('value', true); } http://git-wip-us.apache.org/repos/asf/ambari/blob/508d8db4/ambari-web/app/controllers/main/service/info/configs.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/info/configs.js b/ambari-web/app/controllers/main/service/info/configs.js index f219f04..de9f741 100644 --- a/ambari-web/app/controllers/main/service/info/configs.js +++ b/ambari-web/app/controllers/main/service/info/configs.js @@ -113,7 +113,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ConfigsLoader, A return App.StackConfigProperty.find().filter(function(scp) { return this.get('servicesToLoad').contains(scp.get('serviceName')); }, this); - }.property('content.serviceName'), + }.property('content.serviceName', 'App.router.clusterController.isStackConfigsLoaded'), /** * @type {boolean} @@ -543,7 +543,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ConfigsLoader, A onLoadOverrides: function (allConfigs) { this.get('servicesToLoad').forEach(function(serviceName) { var configGroups = serviceName == this.get('content.serviceName') ? this.get('configGroups') : this.get('dependentConfigGroups').filterProperty('serviceName', serviceName); - var serviceNames = [ serviceName ] + var serviceNames = [ serviceName ]; if(serviceName === 'OOZIE') { // For Oozie, also add ELService properties which are marked as FALCON properties. serviceNames.push('FALCON') http://git-wip-us.apache.org/repos/asf/ambari/blob/508d8db4/ambari-web/app/controllers/main/service/item.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/item.js b/ambari-web/app/controllers/main/service/item.js index 3312457..ea7488e 100644 --- a/ambari-web/app/controllers/main/service/item.js +++ b/ambari-web/app/controllers/main/service/item.js @@ -575,7 +575,6 @@ App.MainServiceItemController = Em.Controller.extend({ if (component) { var reassignMasterController = App.router.get('reassignMasterController'); reassignMasterController.saveComponentToReassign(component); - reassignMasterController.getSecurityStatus(); reassignMasterController.setCurrentStep('1'); App.router.transitionTo('reassign'); } http://git-wip-us.apache.org/repos/asf/ambari/blob/508d8db4/ambari-web/app/controllers/main/service/reassign/step4_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/reassign/step4_controller.js b/ambari-web/app/controllers/main/service/reassign/step4_controller.js index 4a58804..e6d2cc1 100644 --- a/ambari-web/app/controllers/main/service/reassign/step4_controller.js +++ b/ambari-web/app/controllers/main/service/reassign/step4_controller.js @@ -757,7 +757,7 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro * @return {Boolean} */ setSecureConfigs: function (secureConfigs, configs, componentName) { - var securityEnabled = this.get('content.securityEnabled'); + var securityEnabled = App.get('isKerberosEnabled'); var component = this.get('secureConfigsMap').findProperty('componentName', componentName); if (Em.isNone(component) || !securityEnabled) return false; http://git-wip-us.apache.org/repos/asf/ambari/blob/508d8db4/ambari-web/app/controllers/main/service/reassign_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/reassign_controller.js b/ambari-web/app/controllers/main/service/reassign_controller.js index 1827bf5..762aad8 100644 --- a/ambari-web/app/controllers/main/service/reassign_controller.js +++ b/ambari-web/app/controllers/main/service/reassign_controller.js @@ -59,7 +59,6 @@ App.ReassignMasterController = App.WizardController.extend({ hasManualSteps: false, hasCheckDBStep: false, componentsWithCheckDBStep: ['HIVE_METASTORE', 'HIVE_SERVER', 'OOZIE_SERVER'], - securityEnabled: false, componentsWithoutSecurityConfigs: ['MYSQL_SERVER'] }), @@ -73,7 +72,6 @@ App.ReassignMasterController = App.WizardController.extend({ 'masterComponentHosts', 'serviceComponents', 'masterComponent', - 'securityEnabled', 'currentStep', 'reassignHosts', 'tasksStatuses', @@ -89,55 +87,6 @@ App.ReassignMasterController = App.WizardController.extend({ this.set('content.hasCheckDBStep', this.get('content.componentsWithCheckDBStep').contains(this.get('content.reassign.component_name'))); }.observes('content.reassign.component_name'), - getSecurityStatus: function () { - if (App.get('testMode')) { - this.set('securityEnabled', !App.get('testEnableSecurity')); - } else { - //get Security Status From Server - App.ajax.send({ - name: 'config.tags', - sender: this, - success: 'getSecurityStatusSuccessCallback', - error: 'errorCallback' - }); - } - }, - - errorCallback: function () { - console.error('Cannot get security status from server'); - }, - - getSecurityStatusSuccessCallback: function (data) { - var configs = data.Clusters.desired_configs; - if ('cluster-env' in configs) { - this.getServiceConfigsFromServer(configs['cluster-env'].tag); - } - else { - console.error('Cannot get security status from server'); - } - }, - - getServiceConfigsFromServer: function (tag) { - var self = this; - var tags = [ - { - siteName: "cluster-env", - tagName: tag - } - ]; - App.router.get('configurationController').getConfigsByTags(tags).done(function (data) { - var configs = data.findProperty('tag', tag).properties; - var result = configs && (configs['security_enabled'] === 'true' || configs['security_enabled'] === true); - self.saveSecurityEnabled(result); - App.clusterStatus.setClusterStatus({ - clusterName: self.get('content.cluster.name'), - clusterState: 'DEFAULT', - wizardControllerName: 'reassignMasterController', - localdb: App.db.data - }); - }); - }, - /** * Load tasks statuses for step5 of Reassign Master Wizard to restore installation */ @@ -249,17 +198,6 @@ App.ReassignMasterController = App.WizardController.extend({ this.set('content.reassignHosts', reassignHosts); }, - - saveSecurityEnabled: function (securityEnabled) { - this.setDBProperty('securityEnabled', securityEnabled); - this.set('content.securityEnabled', securityEnabled); - }, - - loadSecurityEnabled: function () { - var securityEnabled = this.getDBProperty('securityEnabled'); - this.set('content.securityEnabled', securityEnabled); - }, - saveSecureConfigs: function (secureConfigs) { this.setDBProperty('secureConfigs', secureConfigs); this.set('content.secureConfigs', secureConfigs); http://git-wip-us.apache.org/repos/asf/ambari/blob/508d8db4/ambari-web/app/controllers/wizard/step7_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard/step7_controller.js b/ambari-web/app/controllers/wizard/step7_controller.js index 6aba895..e345670 100644 --- a/ambari-web/app/controllers/wizard/step7_controller.js +++ b/ambari-web/app/controllers/wizard/step7_controller.js @@ -66,13 +66,6 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E }.property(), /** - * uses for add service - find out is security is enabled - */ - securityEnabled: function () { - return App.router.get('mainAdminKerberosController.securityEnabled'); - }.property('App.router.mainAdminKerberosController.securityEnabled'), - - /** * If configChangeObserver Modal is shown * @type {bool} */ @@ -667,7 +660,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E } }, this); //STEP 6: Distribute configs by service and wrap each one in App.ServiceConfigProperty (configs -> serviceConfigs) - if (this.get('securityEnabled') && this.get('wizardController.name') == 'addServiceController') { + if (App.get('isKerberosEnabled') && this.get('wizardController.name') == 'addServiceController') { this.addKerberosDescriptorConfigs(configs, this.get('wizardController.kerberosDescriptorConfigs') || []); } this.setStepConfigs(configs, storedConfigs); http://git-wip-us.apache.org/repos/asf/ambari/blob/508d8db4/ambari-web/app/controllers/wizard/step8_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard/step8_controller.js b/ambari-web/app/controllers/wizard/step8_controller.js index 6a5cc3c..cc587e8 100644 --- a/ambari-web/app/controllers/wizard/step8_controller.js +++ b/ambari-web/app/controllers/wizard/step8_controller.js @@ -121,14 +121,6 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, App.wiz serviceConfigTags: [], /** - * Is cluster security enabled - * @type {bool} - */ - securityEnabled: function () { - return App.router.get('mainAdminKerberosController.securityEnabled'); - }.property('App.router.mainAdminKerberosController.securityEnabled'), - - /** * Selected config group * @type {Object} */ @@ -742,7 +734,7 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, App.wiz this.set('isSubmitDisabled', true); this.set('isBackBtnDisabled', true); wizardController.setLowerStepsDisable(wizardController.get('currentStep')); - if (this.get('content.controllerName') != 'installerController' && this.get('securityEnabled') && !this.get('isManualKerberos')) { + if (this.get('content.controllerName') != 'installerController' && App.get('isKerberosEnabled') && !this.get('isManualKerberos')) { App.get('router.mainAdminKerberosController').getKDCSessionState(this.submitProceed.bind(this), function () { self.set('isSubmitDisabled', false); self.set('isBackBtnDisabled', false); @@ -990,7 +982,7 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, App.wiz if (this.get('content.controllerName') !== 'addHostController') { if (this.get('content.controllerName') === 'addServiceController') { // for manually enabled Kerberos descriptor was updated on transition to this step - if (this.get('securityEnabled') && !this.get('isManualKerberos')) { + if (App.get('isKerberosEnabled') && !this.get('isManualKerberos')) { this.updateKerberosDescriptor(); } } @@ -1090,8 +1082,14 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, App.wiz }, this); if (this.get('content.controllerName') === 'addHostController') { + var allServiceComponents = []; + var services = App.Service.find().mapProperty('serviceName'); + services.forEach(function(_service){ + var _serviceComponents = App.Service.find(_service).get('serviceComponents'); + allServiceComponents = allServiceComponents.concat(_serviceComponents); + }, this); this.get('content.slaveComponentHosts').forEach(function (component) { - if (component.componentName !== 'CLIENT' && !App.serviceComponents.contains(component.componentName)) { + if (component.componentName !== 'CLIENT' && !allServiceComponents.contains(component.componentName)) { this.addRequestToCreateComponent( [{"ServiceComponentInfo": {"component_name": component.componentName}}], App.StackServiceComponent.find().findProperty('componentName', component.componentName).get('serviceName') @@ -1099,7 +1097,7 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, App.wiz } }, this); this.get('content.clients').forEach(function (component) { - if (!App.serviceComponents.contains(component.component_name)) { + if (!allServiceComponents.contains(component.component_name)) { this.addRequestToCreateComponent( [{"ServiceComponentInfo": {"component_name": component.component_name}}], App.StackServiceComponent.find().findProperty('componentName', component.component_name).get('serviceName') http://git-wip-us.apache.org/repos/asf/ambari/blob/508d8db4/ambari-web/app/mappers/alert_definition_summary_mapper.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/mappers/alert_definition_summary_mapper.js b/ambari-web/app/mappers/alert_definition_summary_mapper.js index 0642ee6..20b5ae4 100644 --- a/ambari-web/app/mappers/alert_definition_summary_mapper.js +++ b/ambari-web/app/mappers/alert_definition_summary_mapper.js @@ -55,9 +55,5 @@ App.alertDefinitionSummaryMapper = App.QuickDataMapper.create({ } }); - if (App.router.get('mainAlertDefinitionsController')) { - App.router.set('mainAlertDefinitionsController.mapperTimestamp', (new Date()).getTime()); - } - } }); http://git-wip-us.apache.org/repos/asf/ambari/blob/508d8db4/ambari-web/app/mappers/alert_definitions_mapper.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/mappers/alert_definitions_mapper.js b/ambari-web/app/mappers/alert_definitions_mapper.js index 99cea05..29c1c97 100644 --- a/ambari-web/app/mappers/alert_definitions_mapper.js +++ b/ambari-web/app/mappers/alert_definitions_mapper.js @@ -189,9 +189,6 @@ App.alertDefinitionsMapper = App.QuickDataMapper.create({ App.store.loadMany(this.get('metricsUriModel'), alertMetricsUriDefinitions); App.store.loadMany(this.get('model'), alertDefinitions); this.setAlertDefinitionsRawSourceData(rawSourceData); - if (App.router.get('mainAlertDefinitionsController')) { - App.router.set('mainAlertDefinitionsController.mapperTimestamp', (new Date()).getTime()); - } App.store.commit(); } }, http://git-wip-us.apache.org/repos/asf/ambari/blob/508d8db4/ambari-web/app/mappers/cluster_mapper.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/mappers/cluster_mapper.js b/ambari-web/app/mappers/cluster_mapper.js index 95b3075..4604aaf 100644 --- a/ambari-web/app/mappers/cluster_mapper.js +++ b/ambari-web/app/mappers/cluster_mapper.js @@ -56,8 +56,7 @@ App.clusterMapper = App.QuickDataMapper.create({ cluster_name: 'Clusters.cluster_name', stack_name: 'Clusters.stack_name', version: 'Clusters.version', - //$hosts: [1, 2, 3, 4], - $racks: [1], - max_hosts_per_rack: 'Clusters.max_hosts_per_rack' + security_type: 'Clusters.security_type', + total_hosts: 'Clusters.total_hosts' } }); http://git-wip-us.apache.org/repos/asf/ambari/blob/508d8db4/ambari-web/app/mappers/components_state_mapper.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/mappers/components_state_mapper.js b/ambari-web/app/mappers/components_state_mapper.js index 1359dc3..0a960c4 100644 --- a/ambari-web/app/mappers/components_state_mapper.js +++ b/ambari-web/app/mappers/components_state_mapper.js @@ -36,6 +36,7 @@ App.componentsStateMapper = App.QuickDataMapper.create({ }, slaveModel: App.SlaveComponent, + masterModel: App.MasterComponent, paths: { INSTALLED_PATH: 'ServiceComponentInfo.installed_count', @@ -146,6 +147,7 @@ App.componentsStateMapper = App.QuickDataMapper.create({ var clients = []; var slaves = []; + var masters = []; if (json.items) { json.items.forEach(function (item) { @@ -158,29 +160,33 @@ App.componentsStateMapper = App.QuickDataMapper.create({ if (item.ServiceComponentInfo.category === 'CLIENT') { item.host_names = item.host_components.mapProperty('HostRoles.host_name'); clients.push(this.parseIt(item, this.clientMap)); - } - if (item.ServiceComponentInfo.category === 'SLAVE') { + } else if (item.ServiceComponentInfo.category === 'SLAVE') { // for now map for slaves and clients are equal but it may vary in future. item.host_names = item.host_components.mapProperty('HostRoles.host_name'); slaves.push(this.parseIt(item, this.clientMap)); + } else if (item.ServiceComponentInfo.category === 'MASTER') { + item.host_names = item.host_components.mapProperty('HostRoles.host_name'); + masters.push(this.parseIt(item, this.clientMap)); } + if (cacheService) { + cacheService.client_components = clients.filterProperty('service_name', cacheService.ServiceInfo.service_name).mapProperty('component_name'); + cacheService.slave_components = slaves.filterProperty('service_name', cacheService.ServiceInfo.service_name).mapProperty('component_name'); - cacheService.client_components = clients.filterProperty('service_name', cacheService.ServiceInfo.service_name).mapProperty('component_name'); - cacheService.slave_components = slaves.filterProperty('service_name', cacheService.ServiceInfo.service_name).mapProperty('component_name'); - - for (var i in parsedItem) { - if (service.get('isLoaded')) { - cacheService[i] = parsedItem[i]; - service.set(stringUtils.underScoreToCamelCase(i), parsedItem[i]); - if (extendedModel) { - extendedModel.set(stringUtils.underScoreToCamelCase(i), parsedItem[i]); - } - } - } + for (var i in parsedItem) { + if (service.get('isLoaded')) { + cacheService[i] = parsedItem[i]; + service.set(stringUtils.underScoreToCamelCase(i), parsedItem[i]); + if (extendedModel) { + extendedModel.set(stringUtils.underScoreToCamelCase(i), parsedItem[i]); + } + } + } + } }, this) } App.store.loadMany(this.clientModel, clients); App.store.loadMany(this.slaveModel, slaves); + App.store.loadMany(this.masterModel, masters); console.timeEnd('App.componentsStateMapper execution time'); } http://git-wip-us.apache.org/repos/asf/ambari/blob/508d8db4/ambari-web/app/mappers/racks_mapper.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/mappers/racks_mapper.js b/ambari-web/app/mappers/racks_mapper.js index 47abc4d..52c68e1 100644 --- a/ambari-web/app/mappers/racks_mapper.js +++ b/ambari-web/app/mappers/racks_mapper.js @@ -21,10 +21,5 @@ App.racksMapper = App.QuickDataMapper.create({ config: { id: "Racks.id", name: "Racks.name" - //$hosts: ["host01", "host06", "host05"], - //status: "Racks.status", - //live_hosts_count: "Racks.live_hosts_count", - //critical_hosts_count: "Racks.critical_hosts_count", - //dead_hosts_count: "Racks.dead_hosts_count" } }); http://git-wip-us.apache.org/repos/asf/ambari/blob/508d8db4/ambari-web/app/mappers/service_mapper.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/mappers/service_mapper.js b/ambari-web/app/mappers/service_mapper.js index 8a47537..d340d22 100644 --- a/ambari-web/app/mappers/service_mapper.js +++ b/ambari-web/app/mappers/service_mapper.js @@ -21,6 +21,8 @@ App.serviceMapper = App.QuickDataMapper.create({ map: function (json) { console.time("App.serviceMapper execution time"); + App.serviceComponents = [].concat.apply([], json.items.mapProperty('components').invoke('getEach', 'ServiceComponentInfo.component_name')); + json.items.forEach(function (service) { var cachedService = App.cache['services'].findProperty('ServiceInfo.service_name', service.ServiceInfo.service_name); if (cachedService) { http://git-wip-us.apache.org/repos/asf/ambari/blob/508d8db4/ambari-web/app/messages.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js index 2799156..ced4d16 100644 --- a/ambari-web/app/messages.js +++ b/ambari-web/app/messages.js @@ -269,6 +269,7 @@ Em.I18n.translations = { 'common.clone': 'Clone', 'common.removed': 'Removed', 'common.testing': 'Testing', + 'common.noData': 'No Data', 'models.alert_instance.tiggered.verbose': "Occurred on {0} <br> Checked on {1}", 'models.alert_definition.triggered.verbose': "Occurred on {0}", @@ -1496,7 +1497,6 @@ Em.I18n.translations = { 'services.service.summary.viewHost':'View Host', 'services.service.summary.viewHosts':'View Hosts', 'services.service.summary.clientOnlyService.ToolTip':'Client-only service', - 'services.service.summary.DataNodesLive':'DataNodes Live', 'services.service.summary.JournalNodesLive':'JournalNodes Live', 'services.service.summary.mapreduce2.client':'MapReduce2 Client', 'services.service.summary.mapreduce2.clients':'MapReduce2 Clients', http://git-wip-us.apache.org/repos/asf/ambari/blob/508d8db4/ambari-web/app/mixins/common/serverValidator.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/mixins/common/serverValidator.js b/ambari-web/app/mixins/common/serverValidator.js index 40ab94e..b0c0772 100644 --- a/ambari-web/app/mixins/common/serverValidator.js +++ b/ambari-web/app/mixins/common/serverValidator.js @@ -310,7 +310,7 @@ App.ServerValidatorMixin = Em.Mixin.create({ /** * warn user if some errors or warning were - * in seting up configs otherwise go to the nex operation + * in setting up configs otherwise go to the nex operation * @param deferred * @returns {*} */ http://git-wip-us.apache.org/repos/asf/ambari/blob/508d8db4/ambari-web/app/mixins/wizard/addSecurityConfigs.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/mixins/wizard/addSecurityConfigs.js b/ambari-web/app/mixins/wizard/addSecurityConfigs.js index 0b4a51e..7ffdd3b 100644 --- a/ambari-web/app/mixins/wizard/addSecurityConfigs.js +++ b/ambari-web/app/mixins/wizard/addSecurityConfigs.js @@ -676,7 +676,7 @@ App.AddSecurityConfigs = Em.Mixin.create({ * @returns {Boolean} */ shouldLoadClusterDescriptor: function() { - return App.router.get('mainAdminKerberosController.securityEnabled') && !App.router.get('mainAdminKerberosController.defaultKerberosLoaded'); + return App.get('isKerberosEnabled') && !App.router.get('mainAdminKerberosController.defaultKerberosLoaded'); }.property('App.router.mainAdminKerberosController.securityEnabled', 'App.router.mainAdminKerberosController.defaultKerberosLoaded'), /** http://git-wip-us.apache.org/repos/asf/ambari/blob/508d8db4/ambari-web/app/mixins/wizard/wizardProgressPageController.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/mixins/wizard/wizardProgressPageController.js b/ambari-web/app/mixins/wizard/wizardProgressPageController.js index 22522ef..226b69a 100644 --- a/ambari-web/app/mixins/wizard/wizardProgressPageController.js +++ b/ambari-web/app/mixins/wizard/wizardProgressPageController.js @@ -515,7 +515,7 @@ App.wizardProgressPageControllerMixin = Em.Mixin.create({ } }; if (!!hostsWithoutComponents.length) { - componentsUtils.createServiceComponent(componentName).done(function () { + componentsUtils.updateAndCreateServiceComponent(componentName).done(function () { App.ajax.send({ name: 'wizard.step8.register_host_to_component', sender: self, http://git-wip-us.apache.org/repos/asf/ambari/blob/508d8db4/ambari-web/app/models.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/models.js b/ambari-web/app/models.js index b4a9d24..64860ea 100644 --- a/ambari-web/app/models.js +++ b/ambari-web/app/models.js @@ -55,6 +55,7 @@ require('models/client_component'); require('models/host_component'); require('models/target_cluster'); require('models/slave_component'); +require('models/master_component'); require('models/config_group'); require('models/host_stack_version'); require('models/root_service'); http://git-wip-us.apache.org/repos/asf/ambari/blob/508d8db4/ambari-web/app/models/cluster.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/models/cluster.js b/ambari-web/app/models/cluster.js index 9085058..b4a2010 100644 --- a/ambari-web/app/models/cluster.js +++ b/ambari-web/app/models/cluster.js @@ -23,23 +23,17 @@ App.Cluster = DS.Model.extend({ clusterName: DS.attr('string'), stackName: DS.attr('string'), version: DS.attr('string'), - hosts: DS.hasMany('App.Host'), - racks: DS.hasMany('App.Rack'), - maxHostsPerRack: DS.attr('number'), + totalHosts:DS.attr('number'), + securityType: DS.attr('string'), /** * Array containing desired configs. New array * should be set by instances of class. */ - desiredConfigs: null + desiredConfigs: null, + + isKerberosEnabled: function() { + return this.get('securityType') === 'KERBEROS'; + }.property('securityType') }); -App.Cluster.FIXTURES = [/* - { - id: 1, - cluster_name: 'cluster1', - stack_name: 'HDP', - hosts: [1, 2, 3, 4], - racks: [1, 2, 3, 4, 5, 6], - max_hosts_per_rack: 10 - }*/ -]; \ No newline at end of file +App.Cluster.FIXTURES = []; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/508d8db4/ambari-web/app/models/master_component.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/models/master_component.js b/ambari-web/app/models/master_component.js new file mode 100644 index 0000000..ee44d0d --- /dev/null +++ b/ambari-web/app/models/master_component.js @@ -0,0 +1,28 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var App = require('app'); +var stringUtils = require('utils/string_utils'); + +App.MasterComponent = App.ClientComponent.extend({ + displayNamePluralized: function() { + return stringUtils.pluralize(this.get('startedCount'), this.get('displayName')); + }.property('startedCount') +}); + +App.MasterComponent.FIXTURES = []; http://git-wip-us.apache.org/repos/asf/ambari/blob/508d8db4/ambari-web/app/models/service.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/models/service.js b/ambari-web/app/models/service.js index a255157..564cbae 100644 --- a/ambari-web/app/models/service.js +++ b/ambari-web/app/models/service.js @@ -40,6 +40,7 @@ App.Service = DS.Model.extend({ clientComponents: DS.hasMany('App.ClientComponent'), slaveComponents: DS.hasMany('App.SlaveComponent'), + masterComponents: DS.hasMany('App.MasterComponent'), /** * @type {bool} @@ -48,6 +49,13 @@ App.Service = DS.Model.extend({ return this.get('passiveState') === "ON"; }.property('passiveState'), + serviceComponents: function() { + var clientComponents = this.get('clientComponents').mapProperty('componentName'); + var slaveComponents = this.get('slaveComponents').mapProperty('componentName'); + var masterComponents = this.get('masterComponents').mapProperty('componentName'); + return clientComponents.concat(slaveComponents).concat(masterComponents); + }.property('clientComponents.@each', 'slaveComponents.@each','masterComponents.@each'), + // Instead of making healthStatus a computed property that listens on hostComponents.@each.workStatus, // we are creating a separate observer _updateHealthStatus. This is so that healthStatus is updated // only once after the run loop. This is because Ember invokes the computed property every time http://git-wip-us.apache.org/repos/asf/ambari/blob/508d8db4/ambari-web/app/router.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/router.js b/ambari-web/app/router.js index f745b16..3e30205 100644 --- a/ambari-web/app/router.js +++ b/ambari-web/app/router.js @@ -165,8 +165,15 @@ App.Router = Em.Router.extend({ return dfd.promise(); }, + /** + * Response for <code>/clusters?fields=Clusters/provisioning_state</code> + * @type {null|object} + */ + clusterData: null, + onAuthenticationSuccess: function (data) { if (App.db.getAuthenticated() === true) { + this.set('clusterData', data); this.setAuthenticated(true); if (data.items.length) { this.setClusterInstalled(data); @@ -265,17 +272,22 @@ App.Router = Em.Router.extend({ console.log('login success'); App.usersMapper.map({"items": [data]}); this.setUserLoggedIn(decodeURIComponent(params.loginName)); - App.router.get('mainViewsController').loadAmbariViews(); - App.ajax.send({ - name: 'router.login.clusters', - sender: this, - data: { - loginName: params.loginName, - loginData: data - }, - success: 'loginGetClustersSuccessCallback', - error: 'loginGetClustersErrorCallback' - }); + var requestData = { + loginName: params.loginName, + loginData: data + }; + // no need to load cluster data if it's already loaded + if (this.get('clusterData')) { + this.loginGetClustersSuccessCallback(this.get('clusterData'), {}, requestData); + } + else { + App.ajax.send({ + name: 'router.login.clusters', + sender: this, + data: requestData, + success: 'loginGetClustersSuccessCallback' + }); + } }, loginErrorCallback: function(request, ajaxOptions, error, opt) { @@ -311,8 +323,7 @@ App.Router = Em.Router.extend({ App.ajax.send({ name: 'ambari.service.load_server_version', sender: this, - success: 'adminViewInfoSuccessCallback', - error: 'adminViewInfoErrorCallback' + success: 'adminViewInfoSuccessCallback' }); } } else { @@ -345,6 +356,7 @@ App.Router = Em.Router.extend({ }); } } else { + App.router.get('mainViewsController').loadAmbariViews(); router.transitionTo('main.views.index'); loginController.postLogin(true,true); } @@ -363,14 +375,6 @@ App.Router = Em.Router.extend({ } }, - adminViewInfoErrorCallback: function (req) { - console.log("Get admin view version error: " + req.statusCode); - }, - - loginGetClustersErrorCallback: function (req) { - console.log("Get clusters error: " + req.statusCode); - }, - getSection: function (callback) { if (App.get('testMode')) { if (App.alwaysGoToInstaller) { @@ -390,7 +394,13 @@ App.Router = Em.Router.extend({ route = wizardControllerRoute.route; } } - callback(route); + if (wizardControllerRoute && wizardControllerRoute.wizardControllerName === 'mainAdminStackAndUpgradeController') { + App.router.get('clusterController').restoreUpgradeState().done(function(){ + callback(route); + }); + } else { + callback(route); + } }); } else { callback('installer'); @@ -534,8 +544,7 @@ App.Router = Em.Router.extend({ App.ajax.send({ name: 'ambari.service.load_server_version', sender: router, - success: 'adminViewInfoSuccessCallback', - error: 'adminViewInfoErrorCallback' + success: 'adminViewInfoSuccessCallback' }); } } http://git-wip-us.apache.org/repos/asf/ambari/blob/508d8db4/ambari-web/app/routes/add_service_routes.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/routes/add_service_routes.js b/ambari-web/app/routes/add_service_routes.js index c646002..3977996 100644 --- a/ambari-web/app/routes/add_service_routes.js +++ b/ambari-web/app/routes/add_service_routes.js @@ -25,63 +25,74 @@ module.exports = App.WizardRoute.extend({ enter: function (router) { console.log('in /service/add:enter'); if (App.isAccessible('ADMIN')) { - Em.run.next(function () { - var addServiceController = router.get('addServiceController'); - App.router.get('updateController').set('isWorking', false); - var popup = App.ModalPopup.show({ - classNames: ['full-width-modal', 'add-service-wizard-modal'], - header:Em.I18n.t('services.add.header'), - bodyClass: App.AddServiceView.extend({ - controllerBinding: 'App.router.addServiceController' - }), - primary:Em.I18n.t('form.cancel'), - showFooter: false, - secondary: null, + // `getSecurityStatus` call is required to retrieve information related to kerberos type: Manual or automated kerberos + router.get('mainController').isLoading.call(router.get('clusterController'),'isClusterNameLoaded').done(function () { + App.router.get('mainAdminKerberosController').getSecurityStatus().always(function () { + Em.run.next(function () { + var addServiceController = router.get('addServiceController'); + App.router.get('updateController').set('isWorking', false); + var popup = App.ModalPopup.show({ + classNames: ['full-width-modal', 'add-service-wizard-modal'], + header: Em.I18n.t('services.add.header'), + bodyClass: App.AddServiceView.extend({ + controllerBinding: 'App.router.addServiceController' + }), + primary: Em.I18n.t('form.cancel'), + showFooter: false, + secondary: null, + + onPrimary: function () { + this.hide(); + App.router.transitionTo('main.services.index'); + }, + onClose: function () { + this.set('showCloseButton', false); // prevent user to click "Close" many times + App.router.get('updateController').set('isWorking', true); + var self = this; + App.router.get('updateController').updateServices(function () { + App.router.get('updateController').updateServiceMetric(); + }); + var exitPath = addServiceController.getDBProperty('onClosePath') || 'main.services.index'; + addServiceController.finish(); + // We need to do recovery based on whether we are in Add Host or Installer wizard + App.clusterStatus.setClusterStatus({ + clusterName: App.router.get('content.cluster.name'), + clusterState: 'DEFAULT' + }, { + alwaysCallback: function () { + self.hide(); + App.router.transitionTo(exitPath); + location.reload(); + } + }); - onPrimary:function () { - this.hide(); - App.router.transitionTo('main.services.index'); - }, - onClose: function() { - this.set('showCloseButton', false); // prevent user to click "Close" many times - App.router.get('updateController').set('isWorking', true); - var self = this; - App.router.get('updateController').updateServices(function(){ - App.router.get('updateController').updateServiceMetric(); + }, + didInsertElement: function () { + this.fitHeight(); + } }); - var exitPath = addServiceController.getDBProperty('onClosePath') || 'main.services.index'; - addServiceController.finish(); - // We need to do recovery based on whether we are in Add Host or Installer wizard - App.clusterStatus.setClusterStatus({ - clusterName: App.router.get('content.cluster.name'), - clusterState: 'DEFAULT' - }, {alwaysCallback: function() {self.hide();App.router.transitionTo(exitPath);location.reload();}}); + addServiceController.set('popup', popup); + var currentClusterStatus = App.clusterStatus.get('value'); + if (currentClusterStatus) { + switch (currentClusterStatus.clusterState) { + case 'ADD_SERVICES_DEPLOY_PREP_2' : + addServiceController.setCurrentStep('5'); + break; + case 'ADD_SERVICES_INSTALLING_3' : + case 'SERVICE_STARTING_3' : + addServiceController.setCurrentStep('6'); + break; + case 'ADD_SERVICES_INSTALLED_4' : + addServiceController.setCurrentStep('7'); + break; + default: + break; + } + } - }, - didInsertElement: function(){ - this.fitHeight(); - } + router.transitionTo('step' + addServiceController.get('currentStep')); + }); }); - addServiceController.set('popup',popup); - var currentClusterStatus = App.clusterStatus.get('value'); - if (currentClusterStatus) { - switch (currentClusterStatus.clusterState) { - case 'ADD_SERVICES_DEPLOY_PREP_2' : - addServiceController.setCurrentStep('5'); - break; - case 'ADD_SERVICES_INSTALLING_3' : - case 'SERVICE_STARTING_3' : - addServiceController.setCurrentStep('6'); - break; - case 'ADD_SERVICES_INSTALLED_4' : - addServiceController.setCurrentStep('7'); - break; - default: - break; - } - } - - router.transitionTo('step' + addServiceController.get('currentStep')); }); } else { Em.run.next(function () { @@ -92,9 +103,9 @@ module.exports = App.WizardRoute.extend({ }, /*connectOutlets: function (router) { - console.log('in /service/add:connectOutlets'); - router.get('mainController').connectOutlet('addService'); - },*/ + console.log('in /service/add:connectOutlets'); + router.get('mainController').connectOutlet('addService'); + },*/ step1: Em.Route.extend({ route: '/step1', @@ -166,9 +177,9 @@ module.exports = App.WizardRoute.extend({ }); }); }, - back: function(router){ + back: function (router) { var controller = router.get('addServiceController'); - if(!controller.get('content.skipMasterStep')){ + if (!controller.get('content.skipMasterStep')) { router.transitionTo('step2'); } else { router.transitionTo('step1'); @@ -178,8 +189,8 @@ module.exports = App.WizardRoute.extend({ var addServiceController = router.get('addServiceController'); var wizardStep6Controller = router.get('wizardStep6Controller'); - wizardStep6Controller.callValidation(function() { - wizardStep6Controller.showValidationIssuesAcceptBox(function() { + wizardStep6Controller.callValidation(function () { + wizardStep6Controller.showValidationIssuesAcceptBox(function () { addServiceController.saveSlaveComponentHosts(wizardStep6Controller); addServiceController.get('content').set('serviceConfigProperties', null); addServiceController.setDBProperty('serviceConfigProperties', null); @@ -205,16 +216,18 @@ module.exports = App.WizardRoute.extend({ wizardStep7Controller.getConfigTags(); wizardStep7Controller.set('wizardController', controller); controller.usersLoading().done(function () { - controller.connectOutlet('wizardStep7', controller.get('content')); + router.get('mainController').isLoading.call(router.get('clusterController'), 'isClusterNameLoaded').done(function () { + controller.connectOutlet('wizardStep7', controller.get('content')); + }); }); }); }); }, - back: function(router){ + back: function (router) { var controller = router.get('addServiceController'); - if(!controller.get('content.skipSlavesStep')){ + if (!controller.get('content.skipSlavesStep')) { router.transitionTo('step3'); - } else if(!controller.get('content.skipMasterStep')) { + } else if (!controller.get('content.skipMasterStep')) { router.transitionTo('step2'); } else { router.transitionTo('step1'); @@ -225,7 +238,7 @@ module.exports = App.WizardRoute.extend({ var wizardStep7Controller = router.get('wizardStep7Controller'); addServiceController.saveServiceConfigProperties(wizardStep7Controller); addServiceController.saveServiceConfigGroups(wizardStep7Controller, true); - if (router.get('mainAdminKerberosController.securityEnabled')) { + if (App.get('isKerberosEnabled')) { addServiceController.clearCachedStepConfigValues(router.get('kerberosWizardStep4Controller')); router.transitionTo('step5'); return; @@ -247,17 +260,17 @@ module.exports = App.WizardRoute.extend({ }); }); }, - back: function(router){ + back: function (router) { var controller = router.get('addServiceController'); - if(!controller.get('content.skipConfigStep')) { + if (!controller.get('content.skipConfigStep')) { router.transitionTo('step4'); } else { - if(!controller.get('content.skipSlavesStep')) { + if (!controller.get('content.skipSlavesStep')) { router.transitionTo('step3'); } else { - if(!controller.get('content.skipMasterStep')) { + if (!controller.get('content.skipMasterStep')) { router.transitionTo('step2'); } else { @@ -267,7 +280,7 @@ module.exports = App.WizardRoute.extend({ } }, next: function (router) { - if (router.get('mainAdminKerberosController.securityEnabled')) { + if (App.Cluster.find().objectAt(0).get('isKerberosEnabled')) { if (router.get('mainAdminKerberosController.isManualKerberos')) { router.get('wizardStep8Controller').updateKerberosDescriptor(true); } else { @@ -293,21 +306,21 @@ module.exports = App.WizardRoute.extend({ }); }); }, - back: function(router){ + back: function (router) { var controller = router.get('addServiceController'); - if (router.get('mainAdminKerberosController.securityEnabled')) { + if (App.get('isKerberosEnabled')) { router.transitionTo('step5'); return; } - if(!controller.get('content.skipConfigStep')) { + if (!controller.get('content.skipConfigStep')) { router.transitionTo('step4'); } else { - if(!controller.get('content.skipSlavesStep')) { + if (!controller.get('content.skipSlavesStep')) { router.transitionTo('step3'); } else { - if(!controller.get('content.skipMasterStep')) { + if (!controller.get('content.skipMasterStep')) { router.transitionTo('step2'); } else { @@ -345,7 +358,7 @@ module.exports = App.WizardRoute.extend({ }); }, back: Em.Router.transitionTo('step6'), - retry: function(router,context) { + retry: function (router, context) { var addServiceController = router.get('addServiceController'); var wizardStep9Controller = router.get('wizardStep9Controller'); if (wizardStep9Controller.get('showRetry')) { @@ -362,7 +375,7 @@ module.exports = App.WizardRoute.extend({ } } }, - unroutePath: function() { + unroutePath: function () { return false; }, next: function (router) { http://git-wip-us.apache.org/repos/asf/ambari/blob/508d8db4/ambari-web/app/routes/main.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js index 2023ef4..1b17ab8 100644 --- a/ambari-web/app/routes/main.js +++ b/ambari-web/app/routes/main.js @@ -47,7 +47,7 @@ module.exports = Em.Route.extend(App.RouterRedirections, { App.clusterStatus.updateFromServer().complete(function () { var currentClusterStatus = App.clusterStatus.get('value'); if (router.get('currentState.parentState.name') !== 'views' - && currentClusterStatus && self.get('installerStatuses').contains(currentClusterStatus.clusterState)) { + && currentClusterStatus && self.get('installerStatuses').contains(currentClusterStatus.clusterState)) { if (App.isAccessible('ADMIN')) { self.redirectToInstaller(router, currentClusterStatus, false); } else { @@ -181,7 +181,13 @@ module.exports = Em.Route.extend(App.RouterRedirections, { index: Ember.Route.extend({ route: '/', connectOutlets: function (router, context) { - router.get('mainController').connectOutlet('mainHost'); + router.get('mainController').connectOutlet('loading'); + router.get('mainController').isLoading.call(router.get('clusterController'), 'isClusterNameLoaded').done(function () { + // `getSecurityStatus` call is required to retrieve information related to kerberos type: Manual or automated kerberos + router.get('mainAdminKerberosController').getSecurityStatus().always(function () { + router.get('mainController').connectOutlet('mainHost'); + }); + }); } }), @@ -207,7 +213,7 @@ module.exports = Em.Route.extend(App.RouterRedirections, { controller.isOozieConfigLoaded.always(function () { controller.connectOutlet('mainHostSummary'); }); - }else { + } else { controller.connectOutlet('mainHostSummary'); } }); @@ -217,7 +223,10 @@ module.exports = Em.Route.extend(App.RouterRedirections, { configs: Em.Route.extend({ route: '/configs', connectOutlets: function (router, context) { - router.get('mainHostDetailsController').connectOutlet('mainHostConfigs'); + router.get('mainHostDetailsController').connectOutlet('loading'); + router.get('mainController').isLoading.call(router.get('clusterController'), 'isConfigsPropertiesLoaded').done(function () { + router.get('mainHostDetailsController').connectOutlet('mainHostConfigs'); + }); } }), @@ -340,10 +349,6 @@ module.exports = Em.Route.extend(App.RouterRedirections, { }, index: Em.Route.extend({ - /* enter: function(router, transition){ - var controller = router.get('mainAdminController'); - router.transitionTo('admin' + controller.get('category').capitalize()); - }, */ route: '/', redirectsTo: 'stackAndUpgrade.index' }), @@ -408,7 +413,7 @@ module.exports = Em.Route.extend(App.RouterRedirections, { route: '/disableSecurity', enter: function (router) { App.router.get('updateController').set('isWorking', false); - router.get('mainController').dataLoading().done(function() { + router.get('mainController').dataLoading().done(function () { App.ModalPopup.show({ classNames: ['full-width-modal'], header: Em.I18n.t('admin.removeSecurity.header'), @@ -456,7 +461,7 @@ module.exports = Em.Route.extend(App.RouterRedirections, { clusterState: 'DEFAULT', localdb: App.db.data }, { - alwaysCallback: function() { + alwaysCallback: function () { self.hide(); router.transitionTo('adminKerberos.index'); location.reload(); @@ -686,7 +691,7 @@ module.exports = Em.Route.extend(App.RouterRedirections, { var item = router.get('mainServiceItemController.content'); if (item.get('isLoaded')) { router.get('mainController').dataLoading().done(function () { - router.get('mainServiceInfoHeatmapController').loadRacks().done(function(data) { + router.get('mainServiceInfoHeatmapController').loadRacks().done(function (data) { router.get('mainServiceInfoHeatmapController').loadRacksSuccessCallback(data); router.get('mainServiceItemController').connectOutlet('mainServiceInfoHeatmap', item); }); http://git-wip-us.apache.org/repos/asf/ambari/blob/508d8db4/ambari-web/app/templates/application.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/application.hbs b/ambari-web/app/templates/application.hbs index f767e54..2716fb5 100644 --- a/ambari-web/app/templates/application.hbs +++ b/ambari-web/app/templates/application.hbs @@ -38,6 +38,7 @@ {{allOperationsCount}} {{pluralize allOperationsCount singular="t:op" plural="t:ops"}}</span> {{/if}} {{/with}} + {{#if App.router.clusterController.isAlertsLoaded}} {{#if App.router.mainAlertDefinitionsController.unhealthyAlertInstancesCount}} <span {{bindAttr class=":label App.router.mainAlertDefinitionsController.isCriticalAlerts:alert-crit-count:alert-warn-count"}} {{action "showPopup" target="App.router.mainAlertInstancesController"}}> {{App.router.mainAlertDefinitionsController.unhealthyAlertInstancesCount}} {{pluralize App.router.mainAlertDefinitionsController.unhealthyAlertInstancesCount singular="alert" plural="alerts"}}</span> @@ -46,6 +47,7 @@ class="label alerts-none-count" {{action "showPopup" target="App.router.mainAlertInstancesController"}}> {{App.router.mainAlertDefinitionsController.unhealthyAlertInstancesCount}} {{pluralize App.router.mainAlertDefinitionsController.unhealthyAlertInstancesCount singular="alert" plural="alerts"}}</span> {{/if}} + {{/if}} </a> {{else}} <a class="logo"><img src="/img/logo-white.png" alt="Apache Ambari" title="Apache Ambari"></a> @@ -106,33 +108,33 @@ {{#if App.upgradeInProgress}} {{#if App.router.mainAdminStackAndUpgradeController.isDowngrade}} <span - class="label upgrade-in-progress" {{action "openUpgradeDialog" target="App.router.mainAdminStackAndUpgradeController"}}> + class="label upgrade-in-progress" {{action "openUpgradeDialog" target="App.router.mainAdminStackAndUpgradeController"}}> <i class="icon-cog"></i> {{t admin.stackVersions.version.downgrade.running}}</span> {{else}} <span - class="label upgrade-in-progress" {{action "openUpgradeDialog" target="App.router.mainAdminStackAndUpgradeController"}}> + class="label upgrade-in-progress" {{action "openUpgradeDialog" target="App.router.mainAdminStackAndUpgradeController"}}> <i class="icon-cog"></i> {{t admin.stackVersions.version.upgrade.running}}</span> {{/if}} {{/if}} {{#if App.upgradeHolding}} {{#if App.router.mainAdminStackAndUpgradeController.isDowngrade}} <span - class="label upgrade-holding" {{action "openUpgradeDialog" target="App.router.mainAdminStackAndUpgradeController"}}> + class="label upgrade-holding" {{action "openUpgradeDialog" target="App.router.mainAdminStackAndUpgradeController"}}> <i class="icon-pause"></i> {{t admin.stackVersions.version.downgrade.pause}}</span> {{else}} <span - class="label upgrade-holding" {{action "openUpgradeDialog" target="App.router.mainAdminStackAndUpgradeController"}}> + class="label upgrade-holding" {{action "openUpgradeDialog" target="App.router.mainAdminStackAndUpgradeController"}}> <i class="icon-pause"></i> {{t admin.stackVersions.version.upgrade.pause}}</span> {{/if}} {{/if}} {{#if App.upgradeAborted}} {{#if App.router.mainAdminStackAndUpgradeController.isDowngrade}} <span - class="label upgrade-aborted" {{action "openUpgradeDialog" target="App.router.mainAdminStackAndUpgradeController"}}> + class="label upgrade-aborted" {{action "openUpgradeDialog" target="App.router.mainAdminStackAndUpgradeController"}}> <i class="icon-remove"></i> {{t admin.stackVersions.version.downgrade.aborted}}</span> {{else}} <span - class="label upgrade-aborted" {{action "openUpgradeDialog" target="App.router.mainAdminStackAndUpgradeController"}}> + class="label upgrade-aborted" {{action "openUpgradeDialog" target="App.router.mainAdminStackAndUpgradeController"}}> <i class="icon-remove"></i> {{t admin.stackVersions.version.upgrade.aborted}}</span> {{/if}} {{/if}} http://git-wip-us.apache.org/repos/asf/ambari/blob/508d8db4/ambari-web/app/templates/main/alerts.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/alerts.hbs b/ambari-web/app/templates/main/alerts.hbs index 8fa9093..2547ad9 100644 --- a/ambari-web/app/templates/main/alerts.hbs +++ b/ambari-web/app/templates/main/alerts.hbs @@ -31,13 +31,13 @@ </div> <table class="table advanced-header-table table-bordered table-striped alerts-table" id="alert-definitions-table"> <thead> - {{#view view.sortView classNames="label-row" contentBinding="view.filteredContent"}} - {{view view.parentView.nameSort class="first name-sorting"}} - {{view view.parentView.statusSort class="status-sorting"}} - {{view view.parentView.serviceSort class="service-sorting"}} - {{view view.parentView.lastTriggeredSort class="last-triggred-sorting"}} - {{view view.parentView.enabledSort class="enabled-sorting"}} - {{/view}} + {{#view view.sortView classNames="label-row" contentBinding="view.filteredContent"}} + {{view view.parentView.nameSort class="first name-sorting"}} + {{view view.parentView.statusSort class="status-sorting"}} + {{view view.parentView.serviceSort class="service-sorting"}} + {{view view.parentView.lastTriggeredSort class="last-triggred-sorting"}} + {{view view.parentView.enabledSort class="enabled-sorting"}} + {{/view}} <tr class="filter-row"> <th class="first">{{view view.nameFilterView class="name-filter"}}</th> <th>{{view view.stateFilterView class="status-filter"}}</th> @@ -47,62 +47,73 @@ </tr> </thead> <tbody> - {{#if view.pageContent}} - {{#each alertDefinition in view.pageContent}} - <tr> - <td class="first"> - <span {{bindAttr title="alertDefinition.type"}} {{bindAttr class=":type-icon alertDefinition.typeIconClass"}}></span> - <a href="#" {{action "gotoAlertDetails" alertDefinition}}>{{alertDefinition.label}}</a> - </td> - <td>{{{alertDefinition.status}}}</td> - <td>{{alertDefinition.serviceDisplayName}}</td> - <td><time class="timeago" {{bindAttr data-original-title="alertDefinition.lastTriggeredFormatted"}}>{{alertDefinition.lastTriggeredAgoFormatted}}</time></td> - <td class="last toggle-state-button"> - {{#if alertDefinition.enabled}} - {{#isAccessible ADMIN}} - <a href="#" {{action "toggleState" alertDefinition target="controller"}} {{bindAttr class="alertDefinition.enabled:alert-definition-enable:alert-definition-disable"}}> + {{#if App.router.clusterController.isAlertsLoaded}} + {{#if view.pageContent}} + {{#each alertDefinition in view.pageContent}} + <tr> + <td class="first"> + <span {{bindAttr title="alertDefinition.type"}} {{bindAttr class=":type-icon alertDefinition.typeIconClass"}}></span> + <a href="#" {{action "gotoAlertDetails" alertDefinition}}>{{alertDefinition.label}}</a> + </td> + <td>{{{alertDefinition.status}}}</td> + <td>{{alertDefinition.serviceDisplayName}}</td> + <td> + <time class="timeago" {{bindAttr data-original-title="alertDefinition.lastTriggeredFormatted"}}>{{alertDefinition.lastTriggeredAgoFormatted}}</time> + </td> + <td class="last toggle-state-button"> + {{#if alertDefinition.enabled}} + {{#isAccessible ADMIN}} + <a href="#" {{action "toggleState" alertDefinition target="controller"}} {{bindAttr class="alertDefinition.enabled:alert-definition-enable:alert-definition-disable"}}> <span class="enable-disable-button" {{bindAttr data-original-title="view.enabledTooltip"}}> {{view.enabledDisplay}} </span> - </a> - {{/isAccessible}} - {{#isAccessible NON_ADMIN}} - <span {{bindAttr class="alertDefinition.enabled:alert-definition-enable:alert-definition-disable"}}> - {{t alerts.table.state.enabled}} - </span> - {{/isAccessible}} - {{else}} - {{#isAccessible ADMIN}} - <a href="#" {{action "toggleState" alertDefinition target="controller"}} {{bindAttr class="alertDefinition.enabled:alert-definition-enable:alert-definition-disable"}}> + </a> + {{/isAccessible}} + {{#isAccessible NON_ADMIN}} + <span {{bindAttr class="alertDefinition.enabled:alert-definition-enable:alert-definition-disable"}}> + {{t alerts.table.state.enabled}} + </span> + {{/isAccessible}} + {{else}} + {{#isAccessible ADMIN}} + <a href="#" {{action "toggleState" alertDefinition target="controller"}} {{bindAttr class="alertDefinition.enabled:alert-definition-enable:alert-definition-disable"}}> <span class="enable-disable-button" {{bindAttr data-original-title="view.disabledTooltip"}}> {{view.disabledDisplay}} </span> - </a> - {{/isAccessible}} - {{#isAccessible NON_ADMIN}} - <span {{bindAttr class="alertDefinition.enabled:alert-definition-enable:alert-definition-disable"}}> - {{t alerts.table.state.disabled}} - </span> - {{/isAccessible}} - {{/if}} + </a> + {{/isAccessible}} + {{#isAccessible NON_ADMIN}} + <span {{bindAttr class="alertDefinition.enabled:alert-definition-enable:alert-definition-disable"}}> + {{t alerts.table.state.disabled}} + </span> + {{/isAccessible}} + {{/if}} + </td> + </tr> + {{/each}} + {{else}} + <tr> + <td class="first"></td> + <td colspan="4"> + {{t alerts.table.noAlerts}} </td> </tr> - {{/each}} + {{/if}} {{else}} <tr> <td class="first"></td> - <td colspan="4"> - {{t alerts.table.noAlerts}} + <td colspan="2"> + <div class="spinner"></div> </td> </tr> - {{/if}} + {{/if}} </tbody> </table> <div class="page-bar"> <div class="filtered-info span4"> <label>{{view.filteredContentInfo}} - <a {{action clearFilters target="view"}} - href="#">{{t tableView.filters.clearAllFilters}}</a></label> + href="#">{{t tableView.filters.clearAllFilters}}</a></label> </div> <div class="selected-hosts-info span4"> </div> @@ -111,8 +122,10 @@ </div> <div class="info">{{view.paginationInfo}}</div> <div class="paging_two_button"> - <a {{bindAttr class="view.paginationLeftClass"}}{{action previousPage target="view"}}><i class="icon-arrow-left"></i></a> - <a {{bindAttr class="view.paginationRightClass"}}{{action nextPage target="view"}}><i class="icon-arrow-right"></i></a> + <a {{bindAttr class="view.paginationLeftClass"}}{{action previousPage target="view"}}><i + class="icon-arrow-left"></i></a> + <a {{bindAttr class="view.paginationRightClass"}}{{action nextPage target="view"}}><i + class="icon-arrow-right"></i></a> </div> </div> </div>