]> git.proxmox.com Git - ui/proxmox-yew-comp.git/log
ui/proxmox-yew-comp.git
2 days agobump version to 0.3.9 master
Wolfgang Bumiller [Wed, 15 Jan 2025 11:58:17 +0000 (12:58 +0100)]
bump version to 0.3.9

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 days agoupdate proxmox-schema to 4.0.0
Wolfgang Bumiller [Wed, 15 Jan 2025 11:56:20 +0000 (12:56 +0100)]
update proxmox-schema to 4.0.0

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 days agowizzard: docs: Use full path for structs
Maximiliano Sandoval [Tue, 14 Jan 2025 09:41:03 +0000 (10:41 +0100)]
wizzard: docs: Use full path for structs

Fixes:

warning: unresolved link to `MiniScroll`
   --> src/wizard.rs:108:5
    |
108 |     /// Use [MiniScroll] for [TabBar] to allow scrolling.
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: the link appears in this line:

            Use [MiniScroll] for [TabBar] to allow scrolling.
                 ^^^^^^^^^^
    = note: no item named `MiniScroll` in scope
    = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
    = note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default

warning: unresolved link to `TabBar`
   --> src/wizard.rs:108:5
    |
108 |     /// Use [MiniScroll] for [TabBar] to allow scrolling.
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: the link appears in this line:

            Use [MiniScroll] for [TabBar] to allow scrolling.
                                  ^^^^^^
    = note: no item named `TabBar` in scope
    = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
3 days agotasks: docs: Escape unscaped HTML
Maximiliano Sandoval [Tue, 14 Jan 2025 09:41:02 +0000 (10:41 +0100)]
tasks: docs: Escape unscaped HTML

Fixes:

warning: unclosed HTML tag `nodename`
  --> src/tasks.rs:42:5
   |
42 |     /// The base url, default is '/nodes/<nodename>/tasks'
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(rustdoc::invalid_html_tags)]` on by default

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
3 days agoapt package manager: use a `Box` for `Package` enum variant
Shannon Sterz [Tue, 14 Jan 2025 09:09:40 +0000 (10:09 +0100)]
apt package manager: use a `Box` for `Package` enum variant

otherwise there is a large size difference between different enum
members. this fixes the clippy lint `large_enum_variant` [1].

[1]:
https://rust-lang.github.io/rust-clippy/master/index.html#large_enum_variant

Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
3 days agotree wide: implement `Default` for `new()` functions without parameter
Shannon Sterz [Tue, 14 Jan 2025 09:09:39 +0000 (10:09 +0100)]
tree wide: implement `Default` for `new()` functions without parameter

this allows usage of functions like `unwrap_or_default` for these
types and fixes the clippy lint `new_without_default`.

[1]:
https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default

Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
3 days agotree wide: switch from `Into` to `From` implementations where possible
Shannon Sterz [Tue, 14 Jan 2025 09:09:38 +0000 (10:09 +0100)]
tree wide: switch from `Into` to `From` implementations where possible

this is more flexible as a `From` implementation gives us an `Into`
implementation for free. fixes the clippy ling `from_over_into` [1].

[1]:
https://rust-lang.github.io/rust-clippy/master/index.html#from_over_into

Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
3 days agouse and_then instead of map(..).flatten(..) on Option
Maximiliano Sandoval [Mon, 13 Jan 2025 14:27:25 +0000 (15:27 +0100)]
use and_then instead of map(..).flatten(..) on Option

Fixes:

warning: called `map(..).flatten()` on `Option`
  --> src/configuration/network_view.rs:30:10
   |
30 |           .map(|c| c.as_str())
   |  __________^
31 | |         .flatten()
   | |__________________^ help: try replacing `map` with `and_then` and remove the `.flatten()`: `and_then(|c| c.as_str())`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_flatten
   = note: `#[warn(clippy::map_flatten)]` on by default

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
3 days agouse cloned() instead of explicit clone() in closure
Maximiliano Sandoval [Mon, 13 Jan 2025 14:27:24 +0000 (15:27 +0100)]
use cloned() instead of explicit clone() in closure

Fixes:

warning: you are using an explicit closure for cloning elements
  --> src/configuration/network_view.rs:91:31
   |
91 |             selected_record = self.store.read().lookup_record(key).map(|r| r.clone());
   |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `cloned` method: `self.store.read().lookup_record(key).cloned()`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone
   = note: `#[warn(clippy::map_clone)]` on by default

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
3 days agouse is_empty() instead of length comparison to zero
Maximiliano Sandoval [Mon, 13 Jan 2025 14:27:23 +0000 (15:27 +0100)]
use is_empty() instead of length comparison to zero

Fixes:

warning: length comparison to zero
   --> src/rrd_graph_new.rs:660:22
    |
660 |                 _ if data0.len() == 0 => {}
    |                      ^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `data0.is_empty()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero
    = note: `#[warn(clippy::len_zero)]` on by default

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
3 days agouse enumerate() instead of indexing
Maximiliano Sandoval [Mon, 13 Jan 2025 14:27:22 +0000 (15:27 +0100)]
use enumerate() instead of indexing

Fixes:

warning: the loop variable `i` is used to index `time_data`
   --> src/rrd_graph_new.rs:388:14
    |
388 |     for i in 0..time_data.len() {
    |              ^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop
    = note: `#[warn(clippy::needless_range_loop)]` on by default
help: consider using an iterator and enumerate()
    |
388 |     for (i, <item>) in time_data.iter().enumerate() {
    |         ~~~~~~~~~~~    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
3 days agouse std::mem::swap instead of manual swapping
Maximiliano Sandoval [Mon, 13 Jan 2025 14:27:21 +0000 (15:27 +0100)]
use std::mem::swap instead of manual swapping

Fixes:

warning: this looks like you are swapping `start_x` and `end_x` manually
   --> src/rrd_graph_new.rs:643:25
    |
643 | /                         let t = start_x;
644 | |                         start_x = end_x;
645 | |                         end_x = t;
    | |__________________________________^ help: try: `std::mem::swap(&mut start_x, &mut end_x);`
    |
    = note: or maybe you should use `std::mem::replace`?
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_swap
    = note: `#[warn(clippy::manual_swap)]` on by default

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
3 days agoremove redundant pattern matching
Maximiliano Sandoval [Mon, 13 Jan 2025 14:27:20 +0000 (15:27 +0100)]
remove redundant pattern matching

Fixes:

warning: redundant pattern matching, consider using `is_err()`
   --> src/rrd_timeframe_selector.rs:116:20
    |
116 |             if let Err(_) = store.set_item("ProxmoxRRDTimeframe", &timeframe_str) {
    |             -------^^^^^^-------------------------------------------------------- help: try: `if store.set_item("ProxmoxRRDTimeframe", &timeframe_str).is_err()`
    |
    = note: this will change drop order of the result, as well as all temporaries
    = note: add `#[allow(clippy::redundant_pattern_matching)]` if this is important
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching
    = note: `#[warn(clippy::redundant_pattern_matching)]` on by default

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
3 days agouse or_default and unwrap_or_default
Maximiliano Sandoval [Mon, 13 Jan 2025 14:27:19 +0000 (15:27 +0100)]
use or_default and unwrap_or_default

Fixes:

warning: use of `or_insert` to construct default value
   --> src/apt_repositories.rs:335:55
    |
335 |         let inner = info_map.entry(info.path.clone()).or_insert(HashMap::new());
    |                                                       ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default
    = note: `#[warn(clippy::unwrap_or_default)]` on by default

warning: use of `or_insert` to construct default value
   --> src/apt_repositories.rs:336:45
    |
336 |         let entry = inner.entry(info.index).or_insert(Vec::new());
    |                                             ^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
3 days agouse *= operator for assigments
Maximiliano Sandoval [Mon, 13 Jan 2025 14:27:18 +0000 (15:27 +0100)]
use *= operator for assigments

Fixes:

warning: manual implementation of an assign operation
   --> src/rrd_graph_new.rs:261:9
    |
261 |         l = l * 2;
    |         ^^^^^^^^^ help: replace it with: `l *= 2`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
3 days agoremove unnecesary closure used with then()
Maximiliano Sandoval [Mon, 13 Jan 2025 14:27:17 +0000 (15:27 +0100)]
remove unnecesary closure used with then()

Fixes:

warning: unnecessary closure used with `bool::then`
   --> src/rrd_graph_new.rs:950:33
    |
950 |         .attribute("data-show", (self.draw_cross && data_time.is_some()).then(|| ""))
    |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
    = note: `#[warn(clippy::unnecessary_lazy_evaluations)]` on by default
help: use `then_some` instead
    |
950 |         .attribute("data-show", (self.draw_cross && data_time.is_some()).then_some(""))
    |                                                                          ~~~~~~~~~~~~~

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
3 days agouse any() instead of find and is_none combination
Maximiliano Sandoval [Mon, 13 Jan 2025 14:27:16 +0000 (15:27 +0100)]
use any() instead of find and is_none combination

Fixes:

warning: called `is_none()` after searching an `Iterator` with `find`
   --> src/apt_repositories.rs:282:8
    |
282 |     if list.iter().find(|l| l.status != Status::Ok).is_none() {
    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `!list.iter().any(|l| l.status != Status::Ok)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#search_is_some
    = note: `#[warn(clippy::search_is_some)]` on by default

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
3 days agoapt_repositories: collapse match statement with if-let
Maximiliano Sandoval [Mon, 13 Jan 2025 14:27:15 +0000 (15:27 +0100)]
apt_repositories: collapse match statement with if-let

Fixes:

warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
   --> src/apt_repositories.rs:521:17
    |
521 | /                 match selected_record {
522 | |                     TreeEntry::Repository {
523 | |                         path, index, repo, ..
524 | |                     } => {
...   |
544 | |                     _ => {}
545 | |                 }
    | |_________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
    = note: `#[warn(clippy::single_match)]` on by default
help: try
    |
521 ~                 if let TreeEntry::Repository {
522 +                         path, index, repo, ..
523 +                     } = selected_record {
524 +                     let param = json!({
525 +                         "path": path,
526 +                         "index": index,
527 +                         "enabled": !repo.enabled,
528 +                     });
529 +                     // fixme: add digest to protect against concurrent changes
530 +                     let url = format!("{}/repositories", props.base_url);
531 +                     let link = ctx.link();
532 +                     link.clone().spawn(async move {
533 +                         match crate::http_post(url, Some(param)).await {
534 +                             Ok(()) => {
535 +                                 link.send_reload();
536 +                             }
537 +                             Err(err) => {
538 +                                 link.show_error(tr!("API call failed"), err, true);
539 +                             }
540 +                         }
541 +                     });
542 +                 }

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
3 days agoapt_repositories: collapse else-if blocks
Maximiliano Sandoval [Mon, 13 Jan 2025 14:27:14 +0000 (15:27 +0100)]
apt_repositories: collapse else-if blocks

Fixes:

warning: this `else { if .. }` block can be collapsed
   --> src/apt_repositories.rs:151:12
    |
151 |       } else {
    |  ____________^
152 | |         if config.errors.is_empty() {
153 | |             // just avoid that we show "get updates"
154 | |             if has_test || has_no_subscription {
...   |
165 | |         }
166 | |     }
    | |_____^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_else_if
    = note: `#[warn(clippy::collapsible_else_if)]` on by default
help: collapse nested if block
    |
151 ~     } else if config.errors.is_empty() {
152 +         // just avoid that we show "get updates"
153 +         if has_test || has_no_subscription {
154 +             list.push(StatusLine::ok(tr!(
155 +                 "You get updates for {0}",
156 +                 product.project_text()
157 +             )));
158 +         } else if has_enterprise && active_subscription {
159 +             list.push(StatusLine::ok(tr!(
160 +                 "You get supported updates for {0}",
161 +                 product.project_text()
162 +             )));
163 +         }
164 +     }
    |

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
3 days agoapt_package_manager: use &str instead of format!
Maximiliano Sandoval [Mon, 13 Jan 2025 14:27:13 +0000 (15:27 +0100)]
apt_package_manager: use &str instead of format!

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
3 days agoremove needless casts
Maximiliano Sandoval [Mon, 13 Jan 2025 14:27:12 +0000 (15:27 +0100)]
remove needless casts

Fixes:

warning: casting to the same type is unnecessary (`f64` -> `f64`)
   --> src/rrd_graph_new.rs:514:23
    |
514 |                     + (((t - start_time) as f64 * width) as f64) / time_span
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `((t - start_time) as f64 * width)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

warning: casting float literal to `f64` is unnecessary
   --> src/rrd_graph_new.rs:208:20
    |
208 |     while (range / (2.0 as f64).powi(l)) < 4.0 {
    |                    ^^^^^^^^^^^^ help: try: `2.0_f64`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
3 days agoremove needless borrows
Maximiliano Sandoval [Mon, 13 Jan 2025 14:27:11 +0000 (15:27 +0100)]
remove needless borrows

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
3 days agochangelog: fix typo
Dietmar Maurer [Tue, 14 Jan 2025 08:16:50 +0000 (09:16 +0100)]
changelog: fix typo

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
3 days agochangelog: fix release name (bookworm)
Dietmar Maurer [Tue, 14 Jan 2025 08:11:44 +0000 (09:11 +0100)]
changelog: fix release name (bookworm)

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
4 days agobump version to 0.3.8
Dietmar Maurer [Mon, 13 Jan 2025 12:50:28 +0000 (13:50 +0100)]
bump version to 0.3.8

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
4 days agoform: add helpers for property strings
Dominik Csapak [Fri, 10 Jan 2025 10:21:37 +0000 (11:21 +0100)]
form: add helpers for property strings

when handling property strings in edit windows/input panels, we want to
have a consistent and easy way to handle them.

This introduces two helpers for parsing the property string into
separate parts (`flatten_property_string`) and one to generate the
property string again from parts (`property_string_from_parts`)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 days agoobject-grid/tasks: replace match statements with `?`
Shannon Sterz [Mon, 13 Jan 2025 11:04:02 +0000 (12:04 +0100)]
object-grid/tasks: replace match statements with `?`

this makes the code more succinct and fixes the clippy lint
`question_mark` [1].

[1]:
https://rust-lang.github.io/rust-clippy/master/index.html#question_mark

Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
8 days agowasm http client: only use Error::Client if fetch failes
Dietmar Maurer [Thu, 9 Jan 2025 11:28:17 +0000 (12:28 +0100)]
wasm http client: only use Error::Client if fetch failes

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
8 days agowasm http client: simplify error message (avoid duplicate status code)
Dietmar Maurer [Thu, 9 Jan 2025 11:17:18 +0000 (12:17 +0100)]
wasm http client: simplify error message (avoid duplicate status code)

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
8 days agowasm http client: use and return proxmox_client::Error
Dietmar Maurer [Thu, 9 Jan 2025 08:34:44 +0000 (09:34 +0100)]
wasm http client: use and return proxmox_client::Error

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
9 days agologin panel: improve layout
Dominik Csapak [Wed, 8 Jan 2025 13:23:07 +0000 (14:23 +0100)]
login panel: improve layout

make the window fix 500px wide, and stretch the inputpanel to the whole
width by resetting the 'width' property.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
9 days agologin panel: improve message on login error
Dominik Csapak [Wed, 8 Jan 2025 13:23:06 +0000 (14:23 +0100)]
login panel: improve message on login error

similar to PVE's error, but with the raw HTTP error included.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
9 days agohttp client: include canonical http error with status code
Dominik Csapak [Wed, 8 Jan 2025 13:23:05 +0000 (14:23 +0100)]
http client: include canonical http error with status code

e.g. when receiving a 401 error, this will change from

'HTTP status 401' to
'HTTP status 401 Unauthorized'

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
9 days agobump version to 0.3.7
Dietmar Maurer [Wed, 8 Jan 2025 09:42:20 +0000 (10:42 +0100)]
bump version to 0.3.7

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
9 days agoconfirm_button: use confirm dialog and always spawn a dialog
Shannon Sterz [Thu, 19 Dec 2024 11:00:58 +0000 (12:00 +0100)]
confirm_button: use confirm dialog and always spawn a dialog

this uses the new `ConfirmDialog` component from pwt and now always
spawns a dialog, even if no explicit confirm message was set.

Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
9 days agodepend on pwt 0.4.7
Dietmar Maurer [Wed, 8 Jan 2025 09:40:22 +0000 (10:40 +0100)]
depend on pwt 0.4.7

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
10 days agoconfiguration/common api types: run rustfmt
Shannon Sterz [Fri, 27 Dec 2024 14:39:28 +0000 (15:39 +0100)]
configuration/common api types: run rustfmt

10 days agorunning tasks btton: match result directly
Shannon Sterz [Fri, 27 Dec 2024 14:38:37 +0000 (15:38 +0100)]
running tasks btton: match result directly

instead of converting to an Option an then matching. this fixes the
`match_result_ok` clippy lint [1].

[1]: https://rust-lang.github.io/rust-clippy/master/#match_result_ok

10 days agolog view: don't manually implement `div_ceil()`
Shannon Sterz [Fri, 27 Dec 2024 14:35:07 +0000 (15:35 +0100)]
log view: don't manually implement `div_ceil()`

this fixes the clippy lint `manual_div_ceil` [1].

[1]: https://rust-lang.github.io/rust-clippy/master/#manual_div_ceil

10 days agotfa add totp: return Html directly instead of binding it locally
Shannon Sterz [Fri, 27 Dec 2024 14:28:53 +0000 (15:28 +0100)]
tfa add totp: return Html directly instead of binding it locally

this fixes the clippy ling `let_and_return` [1].

[1]: https://rust-lang.github.io/rust-clippy/master/#let_and_return

10 days agolog view: use an entry for better efficiency when manipulating hashmap
Shannon Sterz [Fri, 27 Dec 2024 14:22:14 +0000 (15:22 +0100)]
log view: use an entry for better efficiency when manipulating hashmap

this is more efficient and fixes the clippy lint `map_entry` [1].

[1]: https://rust-lang.github.io/rust-clippy/master/#map_entry

10 days agolog view: remove unnecessary casts
Shannon Sterz [Fri, 27 Dec 2024 14:13:06 +0000 (15:13 +0100)]
log view: remove unnecessary casts

this fixes the clippy lint `unnecessary_cast` [1].

[1]: https://rust-lang.github.io/rust-clippy/master/#unnecessary_cast

10 days agowizard: remove unnecessary clone
Shannon Sterz [Fri, 27 Dec 2024 14:10:21 +0000 (15:10 +0100)]
wizard: remove unnecessary clone

this fixes the `clone_on_copy` lint [1].

[1]: https://rust-lang.github.io/rust-clippy/master/#clone_on_copy

10 days agotree wide: allow complex types where necessary
Shannon Sterz [Fri, 27 Dec 2024 14:04:12 +0000 (15:04 +0100)]
tree wide: allow complex types where necessary

to avoid triggering the `type_complexity` clippy lint [1].

[1]: https://rust-lang.github.io/rust-clippy/master/#type_complexity

10 days agotfa add totp: ignore clippy lint ptr_args for validate
Shannon Sterz [Fri, 27 Dec 2024 13:44:17 +0000 (14:44 +0100)]
tfa add totp: ignore clippy lint ptr_args for validate

this is a private function for the validator, the signature needs to
match so we don't have to use a closure when using it. so ignore this
clippy lint here.

10 days agotree wide: re-write non-idiomatic match statements
Shannon Sterz [Fri, 27 Dec 2024 13:29:02 +0000 (14:29 +0100)]
tree wide: re-write non-idiomatic match statements

this fixes the clippy lint `match_likes_matches_macro` [1].

[1]:
https://rust-lang.github.io/rust-clippy/master/#match_like_matches_macro

10 days agotree wide: ignore clippy lint `enum_variant_names` for public enums
Shannon Sterz [Fri, 27 Dec 2024 12:59:43 +0000 (13:59 +0100)]
tree wide: ignore clippy lint `enum_variant_names` for public enums

if the clippy lint is implemented here, this would break a public
interface, so just ignore the lint for now.

10 days agotfa view: use ? instead of let-else pattern
Shannon Sterz [Fri, 27 Dec 2024 12:41:09 +0000 (13:41 +0100)]
tfa view: use ? instead of let-else pattern

this fixes the clippy lint `question_mark` [1].

[1]: https://rust-lang.github.io/rust-clippy/master/#question_mark

10 days agotfa add recovery: use fold-write instead of format-collect
Shannon Sterz [Fri, 27 Dec 2024 12:37:22 +0000 (13:37 +0100)]
tfa add recovery: use fold-write instead of format-collect

this should be more efficient as it shouldn't allocate a new string for
each element. this fixes the `format_collect` clippy lint. [1]

[1]: https://rust-lang.github.io/rust-clippy/master/#format_collect

10 days agolib: don't pattern match on storing csrf token use `is_err()` instead
Shannon Sterz [Fri, 27 Dec 2024 12:19:26 +0000 (13:19 +0100)]
lib: don't pattern match on storing csrf token use `is_err()` instead

this fixes the clippy lint `redundant_patter_matching` [1].

[1]:
https://rust-lang.github.io/rust-clippy/master/#redundant_pattern_matching

10 days agohttp helpers: dereference instead of constructing a new `Value`
Shannon Sterz [Fri, 27 Dec 2024 12:03:19 +0000 (13:03 +0100)]
http helpers: dereference instead of constructing a new `Value`

this fixes the clippy lint `cmp_owned` [1].

[1]: https://rust-lang.github.io/rust-clippy/master/#cmp_owned

10 days agoloadable component: `tr!` already returns a string, no need to convert
Shannon Sterz [Fri, 27 Dec 2024 11:56:33 +0000 (12:56 +0100)]
loadable component: `tr!` already returns a string, no need to convert

this fixes the clippy lint `useless_conversion` [1].

[1]: https://rust-lang.github.io/rust-clippy/master/#useless_conversion

10 days agotree wide: remove unnecessary lazy evaluations
Shannon Sterz [Fri, 27 Dec 2024 11:52:31 +0000 (12:52 +0100)]
tree wide: remove unnecessary lazy evaluations

mostly by switching from `then()` to `then_some()`. this fixes the
`unnecessary_lazy_evaluations` lint [1].

[1]:
https://rust-lang.github.io/rust-clippy/master/#unnecessary_lazy_evaluations

10 days agotree wide: remove needless lifetimes
Shannon Sterz [Fri, 27 Dec 2024 11:49:24 +0000 (12:49 +0100)]
tree wide: remove needless lifetimes

this fixes the clippy lint `needless_lifetimes` [1].

[1]: https://rust-lang.github.io/rust-clippy/master/#needless_lifetimes

10 days agoedit window: use `is_some()` instead of comparing to `None`
Shannon Sterz [Fri, 27 Dec 2024 11:46:57 +0000 (12:46 +0100)]
edit window: use `is_some()` instead of comparing to `None`

this fixes the clippy lint `partialeq_to_none` [1].

[1]: https://rust-lang.github.io/rust-clippy/master/#partialeq_to_none

10 days agohelp button: use `as_deref*(` instad of `as_ref().map()`
Shannon Sterz [Fri, 27 Dec 2024 11:37:23 +0000 (12:37 +0100)]
help button: use `as_deref*(` instad of `as_ref().map()`

this fixes the clippy lint `option_as_ref_deref` [1].

[1]: https://rust-lang.github.io/rust-clippy/master/#option_as_ref_deref

10 days agohttp helpers: make thread_local variables const
Shannon Sterz [Fri, 27 Dec 2024 11:34:20 +0000 (12:34 +0100)]
http helpers: make thread_local variables const

this fixes the clippy lint `missing_const_for_thread_local` [1].

[1]:
https://rust-lang.github.io/rust-clippy/master/#missing_const_for_thread_local

10 days agoformat_duration_human: don't manually implement assign operations
Shannon Sterz [Fri, 27 Dec 2024 11:31:35 +0000 (12:31 +0100)]
format_duration_human: don't manually implement assign operations

this fixes the clippy lint `assgin_op_pattern` [1].

[1]: https://rust-lang.github.io/rust-clippy/master/#assign_op_pattern

10 days agotree wide: remove match statements where `map()` is more concise
Shannon Sterz [Fri, 27 Dec 2024 10:56:22 +0000 (11:56 +0100)]
tree wide: remove match statements where `map()` is more concise

fixes the clippy lint `manual_map` [1].

[1]: https://rust-lang.github.io/rust-clippy/master/#manual_map

10 days agogauge: use `clamp()` instead of `max().min()`
Shannon Sterz [Fri, 27 Dec 2024 10:52:41 +0000 (11:52 +0100)]
gauge: use `clamp()` instead of `max().min()`

this fixes the clippy lint `manual_clamp` [1].

[1]: https://rust-lang.github.io/rust-clippy/master/#manual_clamp

10 days agotree wide: remove needless returns
Shannon Sterz [Fri, 27 Dec 2024 10:48:42 +0000 (11:48 +0100)]
tree wide: remove needless returns

this fixes the `needless_return` clippy lint [1].

[1]: https://rust-lang.github.io/rust-clippy/master/#needless_return

10 days agotree wide: use `cloned()` instead of `map(|e| e.clone())`
Shannon Sterz [Fri, 27 Dec 2024 10:37:11 +0000 (11:37 +0100)]
tree wide: use `cloned()` instead of `map(|e| e.clone())`

this fixes the clippy lint `map_clone` [1].

[1]: https://rust-lang.github.io/rust-clippy/master/#map_clone

10 days agotree wide: use `and_then()` instead of `map().flatten()`
Shannon Sterz [Fri, 27 Dec 2024 10:32:18 +0000 (11:32 +0100)]
tree wide: use `and_then()` instead of `map().flatten()`

this fixes the clippy lint `map_flatten` [1].

[1]: https://rust-lang.github.io/rust-clippy/master/#map_flatten

10 days agoauth view: don't bind unit return value
Shannon Sterz [Fri, 27 Dec 2024 10:29:41 +0000 (11:29 +0100)]
auth view: don't bind unit return value

this fixes the clippy lint `let_unit_value` [1].

[1]: https://rust-lang.github.io/rust-clippy/master/#let_unit_value

10 days agoapi load callback: remove empty line after doc comment
Shannon Sterz [Fri, 27 Dec 2024 10:19:41 +0000 (11:19 +0100)]
api load callback: remove empty line after doc comment

otherwise it's confusing whether the documentation actually belongs to
the struct. fixes the clippy lint `empty_line_after_doc_comments` [1].

[1]:
https://rust-lang.github.io/rust-clippy/master/#empty_line_after_doc_comments

10 days agotree wide: switch from `format!` to `to_string()` where possible
Shannon Sterz [Fri, 27 Dec 2024 10:14:24 +0000 (11:14 +0100)]
tree wide: switch from `format!` to `to_string()` where possible

this fixes the clippy lint `useless_format` [1].

[1]: https://rust-lang.github.io/rust-clippy/master/#useless_format

10 days agotree wide: use `unwrap_or_default` where possible
Shannon Sterz [Fri, 27 Dec 2024 10:11:44 +0000 (11:11 +0100)]
tree wide: use `unwrap_or_default` where possible

this fixes the clippy lint `unwrap_or_default` [1].

[1]: https://rust-lang.github.io/rust-clippy/master/#unwrap_or_default

10 days agotree wide: remove redundant closures
Shannon Sterz [Fri, 27 Dec 2024 10:08:42 +0000 (11:08 +0100)]
tree wide: remove redundant closures

this fixes the clippy lint `redundant_closure` [1].

[1]: https://rust-lang.github.io/rust-clippy/master/#redundant_closure

10 days agotree wide: use `any()` instead of `find().is_some()`
Shannon Sterz [Fri, 27 Dec 2024 10:02:42 +0000 (11:02 +0100)]
tree wide: use `any()` instead of `find().is_some()`

this fixes the clippy lint `search_is_some` [1].

[1]: https://rust-lang.github.io/rust-clippy/master/#search_is_some

10 days agotree wide: fix referencing and dereferencing when comparing
Shannon Sterz [Fri, 27 Dec 2024 09:56:25 +0000 (10:56 +0100)]
tree wide: fix referencing and dereferencing when comparing

this fixes the clippy lint `op_ref` [1].

[1]: https://rust-lang.github.io/rust-clippy/master/#op_ref

10 days agoutils: collapse if statements
Shannon Sterz [Fri, 27 Dec 2024 09:50:33 +0000 (10:50 +0100)]
utils: collapse if statements

this fixes the clippy lint `collapsible_if` [1].

[1]: https://rust-lang.github.io/rust-clippy/master/#collapsible_if

10 days agotask status selector: removed unusded unit
Shannon Sterz [Fri, 27 Dec 2024 09:47:50 +0000 (10:47 +0100)]
task status selector: removed unusded unit

this fixes the clippy lint `unused_unit` [1].

[1]: https://rust-lang.github.io/rust-clippy/master/#unused_unit

10 days agotfa: remove needles `pub self`
Shannon Sterz [Fri, 27 Dec 2024 09:45:04 +0000 (10:45 +0100)]
tfa: remove needles `pub self`

this fixes the clippy lint `needless_pub_self` [1].

[1]: https://rust-lang.github.io/rust-clippy/master/#needless_pub_self

10 days agotree wide: collapse else-if where possible
Shannon Sterz [Fri, 27 Dec 2024 09:43:06 +0000 (10:43 +0100)]
tree wide: collapse else-if where possible

this fixes the clippy lint `collapsible_else_if` [1].

[1]: https://rust-lang.github.io/rust-clippy/master/#collapsible_else_if

10 days agotree wide: remove static life-times from static variables
Shannon Sterz [Fri, 27 Dec 2024 09:39:04 +0000 (10:39 +0100)]
tree wide: remove static life-times from static variables

this is always the case, fixes the clipy lint
`redundant_static_lifetimes` [1].

[1]:
https://rust-lang.github.io/rust-clippy/master/#redundant_static_lifetimes

10 days agotree wide: remove borrows that will be dereferenced immediately
Shannon Sterz [Fri, 27 Dec 2024 09:36:02 +0000 (10:36 +0100)]
tree wide: remove borrows that will be dereferenced immediately

this fixes the clippy lint `needless_borrow` [1].

[1]: https://rust-lang.github.io/rust-clippy/master/#needless_borrow

10 days agohttp_client_wasm: run rustfmt
Shannon Sterz [Fri, 27 Dec 2024 09:34:17 +0000 (10:34 +0100)]
http_client_wasm: run rustfmt

10 days agotree wide: remove derefs that would be be done by auto-deref
Shannon Sterz [Fri, 27 Dec 2024 09:29:45 +0000 (10:29 +0100)]
tree wide: remove derefs that would be be done by auto-deref

this fixes the clippy lint `explicit_auto_deref` [1].

[1]: https://rust-lang.github.io/rust-clippy/master/#explicit_auto_deref

10 days agotree wide: remove deref ref patterns where possible
Shannon Sterz [Fri, 27 Dec 2024 09:21:24 +0000 (10:21 +0100)]
tree wide: remove deref ref patterns where possible

just reborrow in these case, this fixes the clippy lint
`borrow_deref_ref` [1].

[1]: https://rust-lang.github.io/rust-clippy/master/#borrow_deref_ref

10 days agotree wide: implement `From` instead of `Into` where possible
Shannon Sterz [Fri, 20 Dec 2024 14:50:54 +0000 (15:50 +0100)]
tree wide: implement `From` instead of `Into` where possible

as a `From` implementation gives you an `Into` implementation for free,
it should be preferred wherever possible. this fixes the
`from_over_into` clippy lint.

[1]:
https://rust-lang.github.io/rust-clippy/master/index.html#from_over_into

10 days agotree wide: implement `Default` for types with `fn new()`
Shannon Sterz [Fri, 20 Dec 2024 14:38:57 +0000 (15:38 +0100)]
tree wide: implement `Default` for types with `fn new()`

this adds a `Default` implementation for all types that have a `new`
function that takes no parameters. this allows using in-build helpers
such as `unwrap_or_default` for these types and also removes the
`new_without_default` clippy lint [1].

[1]:
https://rust-lang.github.io/rust-clippy/master/index.html#/without_def

10 days agoacme/bond/help_button/task_(status|type): run cargo fmt
Shannon Sterz [Fri, 20 Dec 2024 14:34:08 +0000 (15:34 +0100)]
acme/bond/help_button/task_(status|type): run cargo fmt

10 days agoacme: use `as_str` instead of re- and dereferencing
Shannon Sterz [Fri, 20 Dec 2024 14:16:26 +0000 (15:16 +0100)]
acme: use `as_str` instead of re- and dereferencing

this check trips up clippy fixes, as `&*` should be redundant if both
sides try to take reference. however, due to how this type is
encapsulated, that won't work and break the check. so use `as_str` to
get a reference to a string slice for with comparison with `String` is
properly implemented.

2 weeks agorrd graph: cope with out-of-bound selection
Thomas Lamprecht [Fri, 3 Jan 2025 12:27:37 +0000 (13:27 +0100)]
rrd graph: cope with out-of-bound selection

Avoid panicking due to unconditionally access the data0 slice, rather
use get and see if we actually got data to work with, if not then
ignore it when the data slice is empty or log a debug message
otherwise, as that case shouldn't really happen.

The diff is consisting mostly of a indentation change, so best to
checkout with git's `-w` flag to ignore white space change.

This was reported in our community forum [0].

[0]: https://forum.proxmox.com/threads/159485/

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 weeks agobump version to 0.3.6
Thomas Lamprecht [Thu, 19 Dec 2024 17:22:26 +0000 (18:22 +0100)]
bump version to 0.3.6

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 weeks agoacme domains: do not require dns-plugin field in http-mode
Thomas Lamprecht [Thu, 19 Dec 2024 17:20:58 +0000 (18:20 +0100)]
acme domains: do not require dns-plugin field in http-mode

One never could submit a domain when the HTTP challenge mode was
selected, as the hidden plugin field was required.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 weeks agobump version to 0.3.5
Fabian Grünbichler [Tue, 17 Dec 2024 13:33:24 +0000 (14:33 +0100)]
bump version to 0.3.5

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 weeks agorrd: adapt to pwt changes
Fabian Grünbichler [Tue, 17 Dec 2024 13:32:39 +0000 (14:32 +0100)]
rrd: adapt to pwt changes

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 weeks agobuildsys: add all .deb files to upload target
Dietmar Maurer [Tue, 17 Dec 2024 12:59:53 +0000 (13:59 +0100)]
buildsys: add all .deb files to upload target

We also need to upload the feature debs...

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
4 weeks agobump version to 0.3.4
Dietmar Maurer [Tue, 17 Dec 2024 12:02:19 +0000 (13:02 +0100)]
bump version to 0.3.4

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
4 weeks agodepend on pwt 0.4.3
Dietmar Maurer [Tue, 17 Dec 2024 12:00:57 +0000 (13:00 +0100)]
depend on pwt 0.4.3

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
4 weeks agobuildsys: add upload target
Thomas Lamprecht [Tue, 17 Dec 2024 11:48:04 +0000 (12:48 +0100)]
buildsys: add upload target

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 weeks agobuildsys: add DEB and BUILDDIR variables
Thomas Lamprecht [Tue, 17 Dec 2024 10:58:44 +0000 (11:58 +0100)]
buildsys: add DEB and BUILDDIR variables

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 weeks agofix path to align module (pwt::dom::align)
Dietmar Maurer [Tue, 17 Dec 2024 11:31:08 +0000 (12:31 +0100)]
fix path to align module (pwt::dom::align)

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
4 weeks agobump version to 0.3.3
Dietmar Maurer [Tue, 17 Dec 2024 09:17:26 +0000 (10:17 +0100)]
bump version to 0.3.3

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
4 weeks agodepend on pwt 0.4.2 and pwt-macros 0.3
Dietmar Maurer [Tue, 17 Dec 2024 09:02:44 +0000 (10:02 +0100)]
depend on pwt 0.4.2 and pwt-macros 0.3

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
4 weeks agobump version to 0.3.2
Thomas Lamprecht [Mon, 16 Dec 2024 13:27:05 +0000 (14:27 +0100)]
bump version to 0.3.2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 weeks agoedit window: add explicit 'edit' option
Dominik Csapak [Mon, 16 Dec 2024 11:08:43 +0000 (12:08 +0100)]
edit window: add explicit 'edit' option

so one can manually override the configuration if the window is in edit
mode or not, not only depending on the loader.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 weeks agotime zone selector: rustfmt
Dominik Csapak [Mon, 16 Dec 2024 09:09:48 +0000 (10:09 +0100)]
time zone selector: rustfmt

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 weeks agoremove debug log statements
Dominik Csapak [Mon, 16 Dec 2024 09:09:47 +0000 (10:09 +0100)]
remove debug log statements

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>