[pdm-devel] [PATCH yew-comp 1/2] tasks: don't mark running tasks from pve with 'error' color

Dominik Csapak d.csapak at proxmox.com
Thu Mar 20 09:10:59 CET 2025


On 3/20/25 07:25, Dietmar Maurer wrote:
>> running tasks from the PVE tasks API have 'RUNNING' in their status
>> field (in contrast to e.g. the PBS API) instead of nothing.
> 
> Instead of nothing?
> 
> Would it be more clear to use:
> 
> if !(status == "OK" /* PBS */ || status == "RUNNING" /* PVE */)) {
> 
> }

yeah looks fine to me too

alternatively we could maybe do (untested):

match status {
     "RUNNING" | "OK" => {},
     status if status.starts_with("WARNINGS:") => { .. warning .. }
     _ => { .. error .. }
}

> 
>> To not mark
>> them with an error color, we have to make an exception for this here.
>>
>> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
>> ---
>>   src/tasks.rs | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/tasks.rs b/src/tasks.rs
>> index 1b65c8e..499f5b9 100644
>> --- a/src/tasks.rs
>> +++ b/src/tasks.rs
>> @@ -172,7 +172,7 @@ impl LoadableComponent for ProxmoxTasks {
>>                       if status != "OK" {
>>                           if status.starts_with("WARNINGS:") {
>>                               args.add_class("pwt-color-warning");
>> -                        } else {
>> +                        } else if status != "RUNNING" {
>>                               args.add_class("pwt-color-error");
>>                           }
>>                       }
>> -- 
>> 2.39.5
>>
>>
>>
>> _______________________________________________
>> pdm-devel mailing list
>> pdm-devel at lists.proxmox.com
>> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel





More information about the pdm-devel mailing list