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 1D71083C5 for ; Tue, 15 Nov 2022 14:02:53 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 05DFB2CCC for ; Tue, 15 Nov 2022 14:02:52 +0100 (CET) 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 ; Tue, 15 Nov 2022 14:02:49 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 9808D44C30 for ; Tue, 15 Nov 2022 14:02:49 +0100 (CET) From: Dominik Csapak To: pve-devel@lists.proxmox.com Date: Tue, 15 Nov 2022 14:02:25 +0100 Message-Id: <20221115130248.1007325-1-d.csapak@proxmox.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: =?UTF-8?Q?0=0A=09?=AWL -0.085 Adjusted score from AWL reputation of From: =?UTF-8?Q?address=0A=09?=BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict =?UTF-8?Q?Alignment=0A=09?=POISEN_SPAM_PILL 0.1 Meta: its =?UTF-8?Q?spam=0A=09?=POISEN_SPAM_PILL_1 0.1 random spam to be learned in =?UTF-8?Q?bayes=0A=09?=POISEN_SPAM_PILL_3 0.1 random spam to be learned in =?UTF-8?Q?bayes=0A=09?=SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF =?UTF-8?Q?Record=0A=09?=SPF_PASS -0.001 SPF: sender matches SPF =?UTF-8?Q?record=0A=09?=URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [guesthelpers.pm, api2.pm, qemu.pm, datacenterconfig.pm, cluster.pm, lxc.pm] Subject: [pve-devel] [PATCH cluster/guest-common/qemu-server/container/wt/manager v10 0/5] add tags to ui 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: Tue, 15 Nov 2022 13:02:53 -0000 this series brings the already existing 'tags' for ct/vms to the gui: * tags can be edited in the status toolbar of the guest * existing tags will be shown in the tree/global search/resource grids * when editing a tag, a list of tags will be shown * by default, the color is (consistently) autogenerated based on the text * that color can be overridden in datacenter -> options (cluster wide) (edit window for browser local storage is TBD) * by default, the text color is either white or black, depending which provides the greater contrast (according to SAPC) * this text color can also be overridden * there are multiple shapes available for the tree * implements some permission control in datacenter.cfg with 'user-tag-access' and 'privileged-tags' with that it's possible to have better control over what tags a user can actually add to its guests i intentionally left out the gui for those for now, but they shouldn't be that hard to add, should we go this way some notes: * noticed that on firefox in linux, something is off with the font-rendering, the text is weirdly aligned. not only with my tags, but also in the regular buttons, etc. but with the editing of the tags it's noticable. on a windows 10 machine i don't have the problem with firefox (and chrome/chromium is ok also on linux) * the privileged tags/user-tag-access editing is very basic, but imho functional. if we want to have it 'fancier' please tell ;) * maybe having the allowed tags in the 'ui-options' is not the completely right place, but we only use it in the ui, and i did not want to add another api call we have to call after logging in (imho it's border-line already with) changes from v9: * implemented changes required by wolfgang - fixed some c code behaviour - refactored the permission check into guest-common * changed a bit how the permission check worked: - get_allowed_tags now takes a bool (privileged_user) and a closure for checking the vm access. with this we can avoid a cluster <-> access-control cyclic dependency - refactored some of the internal code of the permission check (see patch for details) - the forbidden tags are now in quotes in the error * added an optional 'ordering' option into the 'tag-style' property with this the tags will be sorted in the gui (ui only) i left the patches separately changes from v8: * renamed datacenter.cfg fields according to thomas input * reworked the 'get_user_admin_tags' function to 'get_allowed_tags' which now also checks the appropriate permissions and only returns the allowed tags for the given user. (in list context also returns the admin tags and if 'freeform' is allowed so that users can check the privileges properly). this list is also added to the 'ui-options' api call, since we'll use it for showing tag suggestions * included the missing css styles in the appropriate patches * changed the styling of tags while editings (emulate a textfield) to make it clearer it's ready for editing * changed the color of the 'add tag' field * added a gui for editing the privileged tags and the user-tag-access field * imroved wording + description * improved commit messages * changed how we collect the taglist for the tag picker * mention the tags in the privilige check * added the allowed tags to the ui-options (omitted older changelog) pve-cluster: Dominik Csapak (5): add CFS_IPC_GET_GUEST_CONFIG_PROPERTIES method Cluster: add get_guest_config_properties datacenter.cfg: add option for tag-style datacenter.cfg: add tag rights control to the datacenter config datacenter.cfg: add 'ordering' to 'tag-style' config data/PVE/Cluster.pm | 27 +++++ data/PVE/DataCenterConfig.pm | 149 ++++++++++++++++++++++++++++ data/src/cfs-ipc-ops.h | 2 + data/src/server.c | 63 ++++++++++++ data/src/status.c | 184 ++++++++++++++++++++++++----------- data/src/status.h | 3 + 6 files changed, 370 insertions(+), 58 deletions(-) pve-guest-common: Dominik Csapak (1): GuestHelpers: add 'assert_tag_permissions' debian/control | 3 ++- src/PVE/GuestHelpers.pm | 54 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 55 insertions(+), 2 deletions(-) qemu-server: Dominik Csapak (1): api: update: check for tags permissions with 'assert_tag_permissions' PVE/API2/Qemu.pm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) pve-container: Dominik Csapak (1): check_ct_modify_config_perm: check for tags permissions with 'assert_tag_permissions' src/PVE/LXC.pm | 4 ++++ 1 file changed, 4 insertions(+) proxmox-widget-toolkit: Dominik Csapak (2): add tag related helpers Toolkit: add override for Ext.dd.DragDropManager src/Toolkit.js | 16 ++++++++ src/Utils.js | 88 ++++++++++++++++++++++++++++++++++++++++++++ src/css/ext6-pmx.css | 52 ++++++++++++++++++++++++++ 3 files changed, 156 insertions(+) pve-manager: Dominik Csapak (13): api: /cluster/resources: add tags to returned properties api: add /ui-options api call ui: call '/ui-options' and save the result in PVE.UIOptions ui: parse and save tag infos from /ui-options ui: add form/TagColorGrid ui: add PVE.form.ListField ui: dc/OptionView: add editors for tag settings ui: add form/Tag ui: add form/TagEdit.js ui: {lxc,qemu}/Config: show Tags and make them editable ui: tree/ResourceTree: show Tags in tree ui: add tags to ResourceGrid and GlobalSearchField ui: implement tag ordering from datacenter.cfg PVE/API2.pm | 61 +++++ PVE/API2/Cluster.pm | 9 +- www/css/ext6-pve.css | 57 ++++ www/manager6/Makefile | 4 + www/manager6/Utils.js | 95 ++++++- www/manager6/Workspace.js | 2 + www/manager6/data/ResourceStore.js | 7 + www/manager6/dc/OptionView.js | 221 ++++++++++++++- www/manager6/form/GlobalSearchField.js | 20 +- www/manager6/form/ListField.js | 165 ++++++++++++ www/manager6/form/Tag.js | 232 ++++++++++++++++ www/manager6/form/TagColorGrid.js | 357 +++++++++++++++++++++++++ www/manager6/form/TagEdit.js | 336 +++++++++++++++++++++++ www/manager6/grid/ResourceGrid.js | 1 + www/manager6/lxc/Config.js | 36 ++- www/manager6/qemu/Config.js | 35 ++- www/manager6/tree/ResourceTree.js | 10 +- 17 files changed, 1630 insertions(+), 18 deletions(-) create mode 100644 www/manager6/form/ListField.js create mode 100644 www/manager6/form/Tag.js create mode 100644 www/manager6/form/TagColorGrid.js create mode 100644 www/manager6/form/TagEdit.js -- 2.30.2