public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 4/7] ui: refactor render_icon code
Date: Mon,  5 Oct 2020 15:43:14 +0200	[thread overview]
Message-ID: <20201005134317.12425-4-d.csapak@proxmox.com> (raw)
In-Reply-To: <20201005134317.12425-1-d.csapak@proxmox.com>

we will reuse this later

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 www/dashboard/TaskSummary.js | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/www/dashboard/TaskSummary.js b/www/dashboard/TaskSummary.js
index 6f2e1d99..0cf049cd 100644
--- a/www/dashboard/TaskSummary.js
+++ b/www/dashboard/TaskSummary.js
@@ -7,30 +7,36 @@ Ext.define('PBS.TaskSummary', {
     controller: {
 	xclass: 'Ext.app.ViewController',
 
-	render_count: function(value, md, record, rowindex, colindex) {
+	render_icon: function(state, count) {
 	    let cls = 'question';
 	    let color = 'faded';
-	    switch (colindex) {
-		case 1:
+	    switch (state) {
+		case "error":
 		    cls = "times-circle";
 		    color = "critical";
 		    break;
-		case 2:
+		case "warning":
 		    cls = "exclamation-circle";
 		    color = "warning";
 		    break;
-		case 3:
+		case "ok":
 		    cls = "check-circle";
 		    color = "good";
 		    break;
 		default: break;
 	    }
 
-	    if (value < 1) {
+	    if (count < 1) {
 		color = "faded";
 	    }
 	    cls += " " + color;
-	    return `<i class="fa fa-${cls}"></i> ${value}`;
+	    return `<i class="fa fa-${cls}"></i>`;
+	},
+
+	render_count: function(value, md, record, rowindex, colindex) {
+	    let me = this;
+	    let icon = me.render_icon(me.states[colindex], value);
+	    return `${icon} ${value}`;
 	},
     },
 
-- 
2.20.1





  parent reply	other threads:[~2020-10-05 13:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-05 13:43 [pbs-devel] [PATCH proxmox-backup 1/7] api2/types: add TaskStateType struct Dominik Csapak
2020-10-05 13:43 ` [pbs-devel] [PATCH proxmox-backup 2/7] api2/status: add type- and statusfilter to tasks api call Dominik Csapak
2020-10-05 13:43 ` [pbs-devel] [PATCH proxmox-backup 3/7] ui: implment task history limit and make it configurable Dominik Csapak
2020-10-05 14:44   ` Thomas Lamprecht
2020-10-05 13:43 ` Dominik Csapak [this message]
2020-10-05 14:52   ` [pbs-devel] applied: [PATCH proxmox-backup 4/7] ui: refactor render_icon code Thomas Lamprecht
2020-10-05 13:43 ` [pbs-devel] [PATCH proxmox-backup 5/7] ui: Dashboard/TaskSummary: refactor types and title Dominik Csapak
2020-10-05 14:52   ` Thomas Lamprecht
2020-10-06  6:56     ` Dominik Csapak
2020-10-05 13:43 ` [pbs-devel] [PATCH proxmox-backup 6/7] ui: Dashboard/TaskSummary: add Verifies to the Summary Dominik Csapak
2020-10-05 13:43 ` [pbs-devel] [PATCH proxmox-backup 7/7] ui: Dashboard/TaskSummary: show task overlay when clicking on a count Dominik Csapak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201005134317.12425-4-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal