From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pbs-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
	by lore.proxmox.com (Postfix) with ESMTPS id C46361FF16B
	for <inbox@lore.proxmox.com>; Thu, 28 Nov 2024 15:15:46 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id 7FE21767D;
	Thu, 28 Nov 2024 15:15:48 +0100 (CET)
Message-ID: <2a4b6b22-09a3-473a-ba37-fe30ae865e8a@proxmox.com>
Date: Thu, 28 Nov 2024 15:15:14 +0100
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
To: Proxmox Backup Server development discussion
 <pbs-devel@lists.proxmox.com>, Shannon Sterz <s.sterz@proxmox.com>
References: <20241128134925.196856-1-s.sterz@proxmox.com>
Content-Language: en-US
From: Fiona Ebner <f.ebner@proxmox.com>
In-Reply-To: <20241128134925.196856-1-s.sterz@proxmox.com>
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.054 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: Re: [pbs-devel] [PATCH proxmox-backup] ui: check that store is set
 before trying to select in GCJobView
X-BeenThere: pbs-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox Backup Server development discussion
 <pbs-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pbs-devel/>
List-Post: <mailto:pbs-devel@lists.proxmox.com>
List-Help: <mailto:pbs-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=subscribe>
Reply-To: Proxmox Backup Server development discussion
 <pbs-devel@lists.proxmox.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: pbs-devel-bounces@lists.proxmox.com
Sender: "pbs-devel" <pbs-devel-bounces@lists.proxmox.com>

Am 28.11.24 um 14:49 schrieb Shannon Sterz:
> otherwise users will get a `b.store is null` error in the console and
> a loading spinner is shown for a while.
> 
> the issue in question seems to stem from the event handler that gets
> attached when the "Prune & GC Jobs" tab is opened for a specific
> datastore. however, that event handler should *not* be attached for
> the "Datastore" -> "Prune & GC Jobs" panel. it seems that the event
> handler does still get attached, and will fire in the "Datastore"
> view if it hasn't fired while opened in a specific datastore
> (it should only trigger a single time).
> 
> that scenario seems to occur when a different tab was previously
> selected in a specific datastore and navigation is triggered via the
> side bar from the "Datastore" -> "Prune GC Jobs" to a specific
> datastore. that leads to the "Prune & GC Jobs" view for that specific
> datastore being opened very briefly in which the event handler gets
> attached, navigation then automatically moves to the previously
> selected tab. this will stop the store from updating ensuring that
> the event is never triggered. when we then move to
> the "Datastore" -> "Prune & GC Jobs" tab again the event handler will
> be triggered but the store of the view is null leading to the error.
> 
> Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
> ---
>  www/config/GCView.js | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/www/config/GCView.js b/www/config/GCView.js
> index a6e79fb3..51ce1cb6 100644
> --- a/www/config/GCView.js
> +++ b/www/config/GCView.js
> @@ -33,7 +33,11 @@ Ext.define('PBS.config.GCJobView', {
>  		// after the store is loaded, select the row to enable the Edit,.. buttons
>  		store.rstore.proxy.on({
>  		    'afterload': {
> -			fn: () => view.getSelectionModel().select(0),
> +			fn: () => {
> +			    if (view.store) {
> +				view.getSelectionModel().select(0);

In my testing, view.store is set if I was previously at a datastore's
"Prune & GC Jobs" but not if I was on a different tab from a datastore.
In both cases, the row does not seem to be selected and the "Edit" and
"Run Now" buttons are still grayed out. So your patch is certainly an
improvement, because there is no error and loading :) But it still
doesn't seem to do what was intended according to the code comment.

> +			    }
> +			},
>  			single: true,
>  		    },
>  		});



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel