Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id C7E14200C41 for ; Fri, 24 Mar 2017 20:02:16 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id C6503160B93; Fri, 24 Mar 2017 19:02:16 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id E2DCE160B75 for ; Fri, 24 Mar 2017 20:02:15 +0100 (CET) Received: (qmail 74801 invoked by uid 500); 24 Mar 2017 19:02:13 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 74792 invoked by uid 99); 24 Mar 2017 19:02:13 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Mar 2017 19:02:13 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C2C6ADFF5A; Fri, 24 Mar 2017 19:02:13 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: rzang@apache.org To: commits@ambari.apache.org Message-Id: <062d3c14cebe486ba10079292938b438@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: ambari git commit: AMBARI-20429 - Warn users about pending requests while trying to enable Interactive Query immediately after disabling it (Vivek Subramanian via rzang) Date: Fri, 24 Mar 2017 19:02:13 +0000 (UTC) archived-at: Fri, 24 Mar 2017 19:02:17 -0000 Repository: ambari Updated Branches: refs/heads/branch-2.5 70b4ba403 -> dd7f46f10 AMBARI-20429 - Warn users about pending requests while trying to enable Interactive Query immediately after disabling it (Vivek Subramanian via rzang) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/dd7f46f1 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/dd7f46f1 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/dd7f46f1 Branch: refs/heads/branch-2.5 Commit: dd7f46f10df8b31476bb17e427775c4acf8c303d Parents: 70b4ba4 Author: Richard Zang Authored: Fri Mar 24 11:52:22 2017 -0700 Committer: Richard Zang Committed: Fri Mar 24 11:53:53 2017 -0700 ---------------------------------------------------------------------- .../wizard/step7/assign_master_controller.js | 75 ++++++++++++++++++-- ambari-web/app/messages.js | 2 + ambari-web/app/utils/ajax/ajax.js | 4 ++ .../configs/widgets/config_widget_view.js | 3 + 4 files changed, 78 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/dd7f46f1/ambari-web/app/controllers/wizard/step7/assign_master_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard/step7/assign_master_controller.js b/ambari-web/app/controllers/wizard/step7/assign_master_controller.js index e2c5fa6..b1e3397 100644 --- a/ambari-web/app/controllers/wizard/step7/assign_master_controller.js +++ b/ambari-web/app/controllers/wizard/step7/assign_master_controller.js @@ -62,15 +62,13 @@ App.AssignMasterOnStep7Controller = Em.Controller.extend(App.BlueprintMixin, App this.set('configWidgetContext', context); this.set('content', context.get('controller.content')); this.set('configActionComponent', hostComponent); - var missingDependentServices = this.getAllMissingDependentServices(); - var isNonWizardPage = !this.get('content.controllerName'); + switch (action) { case 'ADD': - if (missingDependentServices.length && isNonWizardPage) { - this.showInstallServicesPopup(missingDependentServices); + if (hostComponent.componentName == "HIVE_SERVER_INTERACTIVE") { + this.getPendingBatchRequests(hostComponent); } else { - this.set('mastersToCreate', [hostComponent.componentName]); - this.showAssignComponentPopup(); + this.showPopup(hostComponent); } break; case 'DELETE': @@ -80,6 +78,71 @@ App.AssignMasterOnStep7Controller = Em.Controller.extend(App.BlueprintMixin, App } }, + getPendingBatchRequests: function(hostComponent) { + var self = this; + // Send Ajax request to get status of pending batch requests + App.ajax.send({ + name : 'request_schedule.get.pending', + sender: self, + error : 'pendingBatchRequestsAjaxError', + success: 'pendingBatchRequestsAjaxSuccess', + data: { + hostComponent: hostComponent + } + }); + }, + + pendingBatchRequestsAjaxError: function(data) { + var error = Em.I18n.t('services.service.actions.run.yarnRefreshQueues.error'); + if(data && data.responseText){ + try { + var json = $.parseJSON(data.responseText); + error += json.message; + } catch (err) {} + } + App.showAlertPopup(Em.I18n.t('services.service.actions.run.yarnRefreshQueues.error'), error, null); + }, + + pendingBatchRequestsAjaxSuccess : function(data, opt, params) { + var self = this; + var showAlert = false; + if (data.hasOwnProperty('items') && data.items.length > 0) { + data.items.forEach( function(_item) { + _item.RequestSchedule.batch.batch_requests.forEach( function(batchRequest) { + // Check if a DELETE request on HIVE_SERVER_INTERACTIVE is in progress + if (batchRequest.request_type == "DELETE" && batchRequest.request_uri.indexOf("HIVE_SERVER_INTERACTIVE") > -1) { + showAlert = true; + } + }); + }); + } + if (showAlert) { + App.showAlertPopup(Em.I18n.t('services.service.actions.hsi.alertPopup.header'), Em.I18n.t('services.service.actions.hsi.alertPopup.body'), function() { + var configWidgetContext = self.get('configWidgetContext'); + var config = self.get('configWidgetContext.config'); + configWidgetContext.toggleProperty('controller.forceUpdateBoundaries'); + var value = config.get('initialValue'); + config.set('value', value); + configWidgetContext.setValue(value); + configWidgetContext.sendRequestRorDependentConfigs(config); + this.hide(); + }); + } else { + this.showPopup(params.hostComponent); + } + }, + + showPopup: function(hostComponent) { + var missingDependentServices = this.getAllMissingDependentServices(); + var isNonWizardPage = !this.get('content.controllerName'); + if (missingDependentServices.length && isNonWizardPage) { + this.showInstallServicesPopup(missingDependentServices); + } else { + this.set('mastersToCreate', [hostComponent.componentName]); + this.showAssignComponentPopup(); + } + }, + /** * Used to set showAddControl/showRemoveControl flag * @param componentName http://git-wip-us.apache.org/repos/asf/ambari/blob/dd7f46f1/ambari-web/app/messages.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js index a2a9d60..8173ca3 100644 --- a/ambari-web/app/messages.js +++ b/ambari-web/app/messages.js @@ -1963,6 +1963,8 @@ Em.I18n.translations = { 'services.service.actions.run.runHawqCheck.label':'Run HAWQ Config Check', 'services.service.actions.manage_configuration_groups.short':'Manage Config Groups', 'services.service.actions.serviceActions':'Service Actions', + 'services.service.actions.hsi.alertPopup.header':'Cannot enable Interactive Query', + 'services.service.actions.hsi.alertPopup.body':'You cannot enable Interactive Query now because Interactive Query is in the process of being disabled. This may take a few minutes. Try again later.', 'services.service.delete.popup.header': 'Delete Service', 'services.service.delete.popup.kerberos': 'The Kerberos Service cannot be deleted because Kerberos is ' + http://git-wip-us.apache.org/repos/asf/ambari/blob/dd7f46f1/ambari-web/app/utils/ajax/ajax.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/utils/ajax/ajax.js b/ambari-web/app/utils/ajax/ajax.js index 8be3b62..70ecb23 100644 --- a/ambari-web/app/utils/ajax/ajax.js +++ b/ambari-web/app/utils/ajax/ajax.js @@ -2326,6 +2326,10 @@ var urls = { 'real': '/clusters/{clusterName}/request_schedules/{request_schedule_id}', 'mock': '' }, + 'request_schedule.get.pending': { + 'real': '/clusters/{clusterName}/request_schedules?fields=*&(RequestSchedule/status.in(SCHEDULED,IN_PROGRESS))', + 'mock': '' + }, 'restart.hostComponents': { 'real': '/clusters/{clusterName}/requests', 'mock': '', http://git-wip-us.apache.org/repos/asf/ambari/blob/dd7f46f1/ambari-web/app/views/common/configs/widgets/config_widget_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/common/configs/widgets/config_widget_view.js b/ambari-web/app/views/common/configs/widgets/config_widget_view.js index cb5d5b9..3a1e24d 100644 --- a/ambari-web/app/views/common/configs/widgets/config_widget_view.js +++ b/ambari-web/app/views/common/configs/widgets/config_widget_view.js @@ -482,6 +482,9 @@ App.ConfigWidgetView = Em.View.extend(App.SupportsDependentConfigs, App.WidgetPo this.set('controller.saveInProgress', true); assignMasterOnStep7Controller.execute(this, 'ADD', hostComponent); } else { + if(hostComponent.componentName == "HIVE_SERVER_INTERACTIVE") { + assignMasterOnStep7Controller.execute(this, 'ADD', hostComponent); + } assignMasterOnStep7Controller.clearComponentsToBeDeleted(hostComponent.componentName); } break;