mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-11-22 00:27:38 +08:00
f062fbee907b2b39e421f380b6af693b18f7deb8
3
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
0c6eee1744 |
feat: page the VM list on the server when the API supports it (#1261)
* feat: page the VM list on the server when the API supports it On clusters whose API serves lists from the Steve SQL cache, the VM list uses PaginatedResourceTable: it loads one page of VMs, and the VMIs, pods, PVCs, PVs, migrations, restores and backups of those VMs only. Sorting, search and the namespace filter run on the server, so CPU, memory, IP and node can't be sorted or searched there. The feature is gated by the vmListPagination feature flag and enabled for the VM list only, through a pagination context. Older clusters keep the current list. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * feat: enable the VM list pagination from v1.10.0 The backend change that serves API lists from the SQL cache has to be on the v1.10 branch before this is merged. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * fix: keep the paged VM list when adding a volume The Add Volume dialog loaded every VM to find the volumes in use, which replaced the page the VM list keeps in the store and emptied the list. When the list is paged, the dialog now reads only the VMs of the namespace and doesn't store them. The requests for the resources of a page use one IN filter instead of one filter per value, which keeps the URLs about a third as long. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * fix: keep the paged VM list intact in its dialogs and on older APIs The Add Volume, Storage Migration and Restore dialogs read the VMs, PVCs and backups of the VM's namespace through the VM. While the list keeps a page of a type in the store they read the namespace without storing it, so the list keeps its page and the dialogs' own lists don't shrink when the page reloads. Storage Migration no longer offers volumes of VMs on other pages as targets. The list is paged only when the API lists the VM's printer columns as metadata.fields, which the SQL cache does, so a missing or non-semver server version can't turn it on against an API that can't filter. One failed request for a page's resources no longer stops the others. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * fix: show the restart notice only when its VMs change The list rebuilds the names of the VMs that need a restart on every refresh, and when it pages also on every page, sort and search, so the notice popped up again each time even when nothing new needed a restart. Show it only when the set of VMs changes. While paging it still covers only the VMs on the current page: the API can't filter VMs by their RestartRequired condition. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * fix: find the launcher pods of every VM on the page The paged list loaded the page's launcher pods by the harvesterhci.io/vmName label, which only the Harvester VM form writes into a VM's template. VMs created any other way, like an imported VM or one applied with kubectl, got no pod, so their rows lost View Logs and the starting and pod error states. Load the pods after the page's VMIs instead, by the kubevirt.io/created-by label KubeVirt puts on every launcher pod (the VMI's UID). Also cover the paged mode in the tests: it must not load every VMI, migration or pod, and a forced refresh must reach every request. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * fix: notify about restarts again when coming back to the VM list The restart notice compared the VMs that need a restart with the previous value of the list. Coming back from a page that loads every VM, like Volumes or a VM's detail page, that previous value already held the same VMs, so the notice didn't show. Remember what was notified on the list itself instead, so each visit starts fresh, and compare by namespace and name, so a VM of the same name in another namespace counts as a change. Also say which VMs lack Harvester's vmName label: the ones from Forklift or plain manifests, not every VM created outside the UI. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * refactor: keep the VM list's paging helpers in the component Only canPaginate stays outside, because ResourceList calls $loadingResources(route, store) on the component options, where there is no `this`. The pagination headers become a computed property and the printer column lookup a method. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * refactor: always list VMs with PaginatedResourceTable PaginatedResourceTable handles both modes. fetchSecondaryResources loads every pod, volume, restore, backup, VMI and migration when the list isn't paged, and only what every row shares when it is. VMIs without a VM are added back through localFilter, which only runs without pagination. The list passes the pagination context only when the cluster's API can page, so older clusters keep the full list. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * refactor: register the VM list's columns with the product Both column sets go through the product's headers(), with the paged set next to the unpaged one in config/table-headers.js. The list only adds the node and restore progress columns, which the API can't sort or search when paging. State sorts by the VM's Status printer column, metadata.fields.2. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * fix: show the restart notice when coming back to the VM list Since the list always uses PaginatedResourceTable it reads the VMs from the store. Coming back to the list the store already holds them, so the restart watcher never saw a change and the notice didn't show. Run it when the list is created too. While paging, the store can still hold the VMs another view loaded, like every VM after Volumes or a VM's detail, so wait for the list's own page before notifying. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * fix: let the namespace filter know the VM list is paged The VMs were registered for pagination with a context that only the VM list passed. The header's namespace filter asks without one, so it didn't know the list was paged and kept offering "Not in a Project", which the paged API can't filter by: picking it hid every VM. Register the VMs in every context and answer per cluster in the store's paginationEnabled getter instead: only when the feature is on and the API lists the VM's printer columns as metadata.fields, as the SQL cache does. The filter, the list and the store now agree, and clusters whose API can't page keep the full list. The filter is shared by every list, so Not in a Project can still be picked on a list that doesn't page. The paged VM list then asks for another option, like the shell's generic lists do, instead of showing no rows. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * fix: keep the paged VM list when showing a VM's configuration The Config tab of the Show Configuration drawer renders the VM form, which loads every VM, PVC, PV, VMI and migration, and its device tabs every VM again. On a paged list that replaced the list's page in the store and emptied the list. Hide the Config tab while the store keeps a page of VMs, so the drawer shows the YAML. The VM's own page still shows its configuration, and a drawer opened where every VM is loaded keeps its Config tab. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * refactor: define the VM list's node and restore columns with the others The node and restore progress columns are now in VM_HEADERS, so the paged set turns their sort and search off through VM_PAGINATION_FIELDS, like the other columns the API can't index. The list only leaves them out when they don't apply: the node column when the cluster's nodes can't be seen, the restore progress while no backup is being restored. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> --------- Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> |
||
|
|
784c22e27e |
fix: show resource counts for all side navigation items (#1196)
* fix: show resource counts for all side navigation items The side navigation looks up the count of a nav item by its name, but the counts are keyed by the K8s resource type. Many Harvester nav items are named differently than the resource they list (e.g. harvesterhci.io.volume lists persistentvolumeclaim), so no count was shown for them. Some list views also show only a subset of their resource type, so the plain count would not match the list. Override the count getter of the harvester store: - Resolve the nav item to the resource type it lists, using the same fallback to the configureType resource as schemaFor. This fixes Hosts, Alertmanager Configs, Cluster Flows, Cluster Outputs, Flows, Outputs and Secrets. - Count only the subset shown by the list for Volumes, VM Networks, VM Backups, VM Snapshots, Volume Snapshots, Cloud Configuration Templates and Storage. The matches are counted per namespace once per store list using sharedComputed. - Like the list views, do not count resources in system namespaces when "All Namespaces" is selected. Steve's counts endpoint only returns the total per resource type, so the filtered counts are computed from the store list and are only available once that list is loaded. Until then these nav items show no count, unless there are no resources of that type at all (then 0). The dashboard loads PVCs and networks, the VM list PVCs and backups, the other resources are loaded when their list is opened. Related to: https://github.com/harvester/harvester/issues/11984 Signed-off-by: Volker Theile <vtheile@suse.com> * refactor: get the side navigation counts from the server Stop loading full resource lists and filtering them in the browser to get the side navigation counts. - Nav items listing all resources of a type use the counts endpoint, through the resource type of the nav item. - VM backups, VM snapshots, volume snapshots, storage classes, cloud config templates and VM networks request their subset from /v1/harvester with a page size of 1. These requests run again when the counts endpoint reports other numbers for the type, and when the namespace filter changes. - Namespaces count the already loaded namespaces that are neither system nor Fleet managed. - Volumes have no count: the list hides volumes that are only marked by annotations, which the API cannot filter on. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * refactor: keep the side navigation count helpers in the store getters Move them out of their own file, next to the count getter that uses them. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * fix: make the side navigation count requests more robust - Ignore a late response of the previous cluster. Resetting the request ids when loading a cluster let it overwrite the count of the new one. - Keep the watchers when a cluster left while it was loading finishes loading after the new one. - Show no count instead of 0 on Harvester v1.3, which ignores the query and sends all resources without a count. - Hide the storage network by its generated name. Networks created before Harvester v1.4 do not have the hash label, and an upgrade does not add it. - Stop refreshing after leaving the product, cancel pending refreshes when the watchers stop, and cope with the store module being unregistered when logging out. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * fix: count only the settings the Settings page shows The nav item showed the total of all Setting resources, but the page only shows the allowed ones that exist in the cluster and are supported by its version. Move these rules into a visibleSettings getter that both the page and the count use, so that they always agree. SettingList no longer needs its feature flag check. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * test: remove a Settings page test that was committed twice Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * fix: show the number of volumes in the side navigation The Volumes list hides golden image volumes and the temporary volumes CDI uses to populate a volume, so the total of the counts endpoint would be wrong. Golden image volumes are only marked by an annotation, which Harvester's API cannot filter on, but each one belongs to a DataVolume owned by its VM image. So request the volumes that are not owned by another volume, and the DataVolumes owned by a VM image, and show the difference. Every nav item with a list now has a number, so remove NO_COUNT. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> --------- Signed-off-by: Volker Theile <vtheile@suse.com> Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> Co-authored-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> |
||
|
|
77b643540e |
fix: label the VPC group of subnets without a VPC as None (#1210)
Kube-OVN sets a subnet's VPC (ovn-cluster when none is given), but a subnet it hasn't processed, such as one with an invalid provider, has none. The VPC page grouped those under "Virtual Private Cloud:" with an empty name, and its Create Subnet, Topology and actions buttons pointed at no VPC. Show None as the VPC name for that group and leave out its VPC buttons. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> |