From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 7D2D21FF165 for ; Thu, 6 Nov 2025 14:43:27 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 2598817655; Thu, 6 Nov 2025 14:44:07 +0100 (CET) From: Lukas Wagner To: pdm-devel@lists.proxmox.com Date: Thu, 6 Nov 2025 14:43:42 +0100 Message-ID: <20251106134353.263598-1-l.wagner@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1762436617955 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.121 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 POISEN_SPAM_PILL 0.1 Meta: its spam POISEN_SPAM_PILL_1 0.1 random spam to be learned in bayes POISEN_SPAM_PILL_3 0.1 random spam to be learned in bayes SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pdm-devel] [PATCH datacenter-manager v3 00/11] backend implementation for view filters X-BeenThere: pdm-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Datacenter Manager development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pdm-devel-bounces@lists.proxmox.com Sender: "pdm-devel" Key aspects: - new config file at /etc/proxmox-datacenter-manager/views.cfg - ViewConfig as a definition type, has - {include,exclude} {remote,resource-id,resource-type,resource-pool,tag}:{value} - View resource filter implementation & big suite of unit tests - excludes are processed after includes - if no include rules are defined, all resources but those which were excluded are matched - if no rules are defined in a filter, everything is matched - Added the 'view' parameter to a couple of API endpoints - /resources/list - /resources/status - /resources/subscription - /resources/top-entities - /remote-tasks/list - /remote-tasks/statistis - ACL checks are done on /view/{view-filter-id} for now, replace any other permission check in the handler iff the view-filter paramter is set Left to do: - CRUD for filter definition - UI for filter rules Changes since v2 (thx for the review @Dominik): - Renamed: - ViewFilter -> View - ViewFilterConfig -> ViewConfig - 'view-filter' parameters to 'view' - Use ApiSectionDataEntry trait for ViewConfig - Use SAFE_ID_FORMAT to validate filter values - Changed path for config file from `views/filter.cfg` to just `views.cfg` - Include failed remotes in API responses iff they have been explicitly included via `include remote:<...>`. Previously, they had been filtered out to avoid leaking the existence of remotes, but if they have been explicitly included, this is fine. - Simplify `check_rules` function by using `.any()` instead of looping manually - Merged the rule implementation and test commits - Added views::get_optional_view as a convenience helper. This one is similar to views::get_view, but accepts Option<&str> and returns Option. Changes since v1 (RFC): - Change config key structure, moving the type into the value e.g. include-remote foo became include remote:foo - Minor fixes from the review (thanks Wolfgang & Shannon) proxmox-datacenter-manager: Lukas Wagner (11): pdm-api-types: views: add ViewConfig type pdm-config: views: add support for views acl: add '/view' and '/view/{view-id}' as allowed ACL paths views: add implementation for view resource filtering api: resources: list: add support for view parameter api: resources: top entities: add support for view parameter api: resources: status: add support for view parameter api: subscription status: add support for view parameter api: remote-tasks: add support for view parameter pdm-client: resource list: add view-filter parameter pdm-client: top entities: add view-filter parameter cli/client/src/resources.rs | 2 +- lib/pdm-api-types/src/lib.rs | 8 + lib/pdm-api-types/src/views.rs | 202 ++++++ lib/pdm-client/src/lib.rs | 19 +- lib/pdm-config/src/lib.rs | 2 +- lib/pdm-config/src/views.rs | 17 + server/src/acl.rs | 6 + server/src/api/remote_tasks.rs | 36 +- server/src/api/resources.rs | 166 ++++- server/src/lib.rs | 1 + server/src/metric_collection/top_entities.rs | 5 + server/src/remote_tasks/mod.rs | 37 +- server/src/resource_cache.rs | 3 +- server/src/views/mod.rs | 205 ++++++ server/src/views/tests.rs | 619 +++++++++++++++++++ ui/src/dashboard/view.rs | 2 +- ui/src/sdn/zone_tree.rs | 2 +- 17 files changed, 1283 insertions(+), 49 deletions(-) create mode 100644 lib/pdm-api-types/src/views.rs create mode 100644 lib/pdm-config/src/views.rs create mode 100644 server/src/views/mod.rs create mode 100644 server/src/views/tests.rs Summary over all repositories: 17 files changed, 1283 insertions(+), 49 deletions(-) -- Generated by murpp 0.9.0 _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel