From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 314D395264 for ; Fri, 12 Apr 2024 10:05:08 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id E44E755E6 for ; Fri, 12 Apr 2024 10:05:07 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Fri, 12 Apr 2024 10:05:03 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id AF68344FA6 for ; Fri, 12 Apr 2024 10:05:00 +0200 (CEST) From: Dominik Csapak To: pve-devel@lists.proxmox.com Date: Fri, 12 Apr 2024 10:04:57 +0200 Message-Id: <20240412080458.1066580-9-d.csapak@proxmox.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240412080458.1066580-1-d.csapak@proxmox.com> References: <20240412080458.1066580-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.014 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 SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH pve-flutter-frontend 8/9] task logs: use separate color for warnings X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Apr 2024 08:05:08 -0000 orange instead of red, so one can differentiate between error and warnings better. Signed-off-by: Dominik Csapak --- .../pve_task_log_expansiontile_widget.dart | 15 +++++++++++---- lib/widgets/pve_task_log_widget.dart | 5 ++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/lib/widgets/pve_task_log_expansiontile_widget.dart b/lib/widgets/pve_task_log_expansiontile_widget.dart index 2073840..2ff5eb2 100644 --- a/lib/widgets/pve_task_log_expansiontile_widget.dart +++ b/lib/widgets/pve_task_log_expansiontile_widget.dart @@ -36,8 +36,10 @@ class _PveTaskExpansionTileState extends State { @override Widget build(BuildContext context) { - final hasError = - widget.task.status != 'RUNNING' && widget.task.status != "OK"; + final hasWarnings = widget.task.status.startsWith('WARNINGS:'); + final hasError = widget.task.status != 'RUNNING' && + widget.task.status != "OK" && + !hasWarnings; final isFinished = widget.task.endTime != null; final taskLogBloc = Provider.of(context); Duration duration; @@ -48,6 +50,7 @@ class _PveTaskExpansionTileState extends State { } final colorScheme = Theme.of(context).colorScheme; final errorColor = widget.errorColor ?? colorScheme.error; + final warningColor = Colors.orange.shade200; final headerColor = isExpanded ? (widget.headerColorExpanded ?? colorScheme.onSurface) : (widget.headerColor ?? colorScheme.onBackground); @@ -64,8 +67,12 @@ class _PveTaskExpansionTileState extends State { collapsedBackgroundColor: Theme.of(context).colorScheme.background, key: PageStorageKey(widget.task), leading: Icon( - hasError ? Icons.warning : Icons.info, - color: hasError ? errorColor : headerColor, + hasError || hasWarnings ? Icons.warning : Icons.info, + color: hasError + ? errorColor + : hasWarnings + ? warningColor + : headerColor, ), title: Text( '$taskText: ${widget.task.type}', diff --git a/lib/widgets/pve_task_log_widget.dart b/lib/widgets/pve_task_log_widget.dart index 97cbf03..5a12676 100644 --- a/lib/widgets/pve_task_log_widget.dart +++ b/lib/widgets/pve_task_log_widget.dart @@ -198,12 +198,15 @@ class _PveTaskLogScrollViewState extends State { child: ProxmoxStreamBuilder( bloc: Provider.of(context), builder: (context, state) { - // TODO: fix color (for dark theme) and better handle warnings var indicatorColor = Colors.teal.shade500; var statusChipColor = Colors.teal.shade100; if (state.status?.failed ?? false) { indicatorColor = Colors.red; statusChipColor = Colors.red.shade100; + } else if ((state.status?.exitStatus ?? '') + .startsWith('WARNINGS:')) { + indicatorColor = Colors.orange; + statusChipColor = Colors.orange.shade100; } return SizedBox( height: MediaQuery.of(context).size.height * 0.5, -- 2.39.2