On 25.01.22 09:51, Aaron Lauterer wrote: > Showing already configured custom device classes makes it easier to > create new OSDs with custom device classes. > > The Crush map contains a list of all OSDs in the cluster, including > their device class. > This means we can create a list of used device classes from it, avoiding > adding another API endpoint. > > Fetching the crushmap should also be quite a bit less data that needs to > be transferred, compared to the other possible nodes/<node>/ceph/osd > endpoint, especially in larger clusters. > > Signed-off-by: Aaron Lauterer <a.laute...@proxmox.com> > --- > changes from v2: > - check against eslint warnings, adding two commas > > changes from v1: > - template string for API call > - API failure now throws an alert > - used Thomas idea on how to make the list creation more concise and > only update the combo items if we do have custom device classes > - reverted default `comboItems` to the element definition > > @Thomas by using `Array.from` we can iterate over the results returned > from matchAll and also map element [1] from the returned array as it > actually holds the matched item. > The unshift needed the `...` deconstruction operator as comboItems is an > array of arrays.
I actually dropped the unshift and expanded directly: kvField.setComboItems([...kvField.comboItems, ...classes]); In theory this could allow a minimally slightly more efficient use, not that it'd matter here much, but hey a line less code ;-P > > www/manager6/ceph/OSD.js | 21 +++++++++++++++++++++ > 1 file changed, 21 insertions(+) > > applied, thanks! _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel