Return-Path: X-Original-To: apmail-brooklyn-commits-archive@minotaur.apache.org Delivered-To: apmail-brooklyn-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AF603117B0 for ; Tue, 9 Sep 2014 22:49:37 +0000 (UTC) Received: (qmail 85033 invoked by uid 500); 9 Sep 2014 22:49:31 -0000 Delivered-To: apmail-brooklyn-commits-archive@brooklyn.apache.org Received: (qmail 84994 invoked by uid 500); 9 Sep 2014 22:49:31 -0000 Mailing-List: contact commits-help@brooklyn.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@brooklyn.incubator.apache.org Delivered-To: mailing list commits@brooklyn.incubator.apache.org Received: (qmail 84976 invoked by uid 99); 9 Sep 2014 22:49:31 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Sep 2014 22:49:31 +0000 X-ASF-Spam-Status: No, hits=-2001.7 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 09 Sep 2014 22:49:07 +0000 Received: (qmail 81832 invoked by uid 99); 9 Sep 2014 22:49:05 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Sep 2014 22:49:05 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id AD2BF85F4; Tue, 9 Sep 2014 22:49:04 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: heneveld@apache.org To: commits@brooklyn.incubator.apache.org Date: Tue, 09 Sep 2014 22:49:04 -0000 Message-Id: <1625b4809a604416aea888f4f6dbe7b5@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [01/19] git commit: include data from problem indicators in jsgui when entities are on fire X-Virus-Checked: Checked by ClamAV on apache.org Repository: incubator-brooklyn Updated Branches: refs/heads/master ed69cf621 -> 283eef2bb include data from problem indicators in jsgui when entities are on fire Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/3d0e0c14 Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/3d0e0c14 Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/3d0e0c14 Branch: refs/heads/master Commit: 3d0e0c1461faf7c9e07c52601741ed4759631365 Parents: 0eda14b Author: Alex Heneveld Authored: Wed Sep 3 17:01:46 2014 +0100 Committer: Alex Heneveld Committed: Tue Sep 9 11:26:23 2014 +0100 ---------------------------------------------------------------------- .../webapp/assets/js/view/entity-summary.js | 32 ++++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/3d0e0c14/usage/jsgui/src/main/webapp/assets/js/view/entity-summary.js ---------------------------------------------------------------------- diff --git a/usage/jsgui/src/main/webapp/assets/js/view/entity-summary.js b/usage/jsgui/src/main/webapp/assets/js/view/entity-summary.js index 93fa94d..22fd70c 100644 --- a/usage/jsgui/src/main/webapp/assets/js/view/entity-summary.js +++ b/usage/jsgui/src/main/webapp/assets/js/view/entity-summary.js @@ -91,15 +91,14 @@ define([ var status = this.updateStatusIcon(); + this.updateCachedProblemIndicator(data); + if (status.problem) { this.updateAddlInfoForProblem(); } else { this.$(".additional-info-on-problem").html("").hide() } }, - updateSensorsNow: function() { - this.updateWithData(); - }, updateStatusIcon: function() { var statusIconInfo = ViewUtils.computeStatusIconInfo(this.$(".serviceUp .value").html(), this.$(".status .value").html()); if (statusIconInfo.url) { @@ -110,6 +109,14 @@ define([ } return statusIconInfo; }, + updateCachedProblemIndicator: function(data) { + if (!data) return; + this.problemIndicators = data['service.problems']; + if (!this.problemIndicators || !_.size(this.problemIndicators)) + this.problemIndicators = data['service.notUp.indicators']; + if (!this.problemIndicators || !_.size(this.problemIndicators)) + this.problemIndicators = null; + }, updateAddlInfoForProblem: function(tasksReloaded) { if (!this.options.tasks) // if tasks not supplied, then don't attempt to show status info! @@ -127,18 +134,31 @@ define([ } } ); + if (this.problemIndicators) { + var indicatorText = _.values(this.problemIndicators); + for (error in indicatorText) { + if (problemDetails) + problemDetails = problemDetails + "
"; + problemDetails = problemDetails + _.escape(indicatorText[error]); + } + } if (lastFailedTask) { var path = "activities/subtask/"+lastFailedTask.id; var base = this.model.getLinkByName("self"); - problemDetails = ""+_.escape("Failure running task ") + if (problemDetails) + problemDetails = problemDetails + "
"; + problemDetails = problemDetails + ""+_.escape("Failure running task ") +"" + ""+_.escape(lastFailedTask.attributes.displayName)+" " +"("+lastFailedTask.id+"): "+ _.escape(lastFailedTask.attributes.result); - } else if (!that.problemTasksLoaded) { + } + if (!that.problemTasksLoaded && this.options.tasks) { // trigger callback to get tasks - problemDetails = "Loading problem details..."; + if (!problemDetails) + problemDetails = "Loading problem details..."; + ViewUtils.get(this, this.options.tasks.url, function() { that.problemTasksLoaded = true; that.updateAddlInfoForProblem();