Merge pull request #3824 from richard-cox/master-fix-node-ssh-and-download-actions

[master] Ensure we pre-fetch machines to show node ssh & download key actions
This commit is contained in:
Vincent Fiduccia 2021-08-13 09:47:47 -07:00 committed by GitHub
commit 55717e445b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 5 deletions

View File

@ -8,6 +8,7 @@ import {
import metricPoller from '@/mixins/metric-poller';
import {
CAPI,
MANAGEMENT, METRIC, NODE, NORMAN, POD
} from '@/config/types';
import { allHash } from '@/utils/promise';
@ -32,20 +33,22 @@ export default {
async fetch() {
const hash = { kubeNodes: this.$store.dispatch('cluster/findAll', { type: NODE }) };
const canViewMgmtNodes = this.$store.getters[`management/schemaFor`](MANAGEMENT.NODE);
const canViewNormanNodes = this.$store.getters[`rancher/schemaFor`](NORMAN.NODE);
this.canViewPods = this.$store.getters[`cluster/schemaFor`](POD);
if (canViewNormanNodes) {
if (this.$store.getters[`management/schemaFor`](MANAGEMENT.NODE)) {
// Required for Drain/Cordon action
hash.normanNodes = this.$store.dispatch('rancher/findAll', { type: NORMAN.NODE });
}
if (canViewMgmtNodes) {
if (this.$store.getters[`rancher/schemaFor`](NORMAN.NODE)) {
hash.mgmtNodes = this.$store.dispatch('management/findAll', { type: MANAGEMENT.NODE });
}
if (this.$store.getters[`management/schemaFor`](CAPI.MACHINE)) {
// Required for ssh / download key actions
hash.machines = this.$store.dispatch('management/findAll', { type: CAPI.MACHINE });
}
if (this.canViewPods) {
// Used for running pods metrics
hash.pods = this.$store.dispatch('cluster/findAll', { type: POD });