mirror of https://github.com/rancher/dashboard.git
Merge pull request #405 from codyrancher/apply-type-config
Ensure typeconfigs are applied before type-map getters are used
This commit is contained in:
commit
518f11e654
|
|
@ -17,7 +17,13 @@ import {
|
||||||
|
|
||||||
import { DSL } from '@/store/type-map';
|
import { DSL } from '@/store/type-map';
|
||||||
|
|
||||||
|
let called = false;
|
||||||
|
|
||||||
export default function(store) {
|
export default function(store) {
|
||||||
|
if (called) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
called = true;
|
||||||
const {
|
const {
|
||||||
basicType,
|
basicType,
|
||||||
ignoreType,
|
ignoreType,
|
||||||
|
|
@ -38,7 +44,7 @@ export default function(store) {
|
||||||
WORKLOAD,
|
WORKLOAD,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
mapTypeToComponentName('constraints.gatekeeper.sh.k8sallowedrepos', 'gatekeeper-constraint');
|
mapTypeToComponentName(/^constraints.gatekeeper.sh.*$/, 'gatekeeper-constraint');
|
||||||
|
|
||||||
ignoreType('events.k8s.io.event'); // Events type moved into core
|
ignoreType('events.k8s.io.event'); // Events type moved into core
|
||||||
ignoreType('extensions.ingress'); // Moved into networking
|
ignoreType('extensions.ingress'); // Moved into networking
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import { mapState } from 'vuex';
|
||||||
import {
|
import {
|
||||||
mapPref, DEV, THEME, EXPANDED_GROUPS, RECENT_TYPES, FAVORITE_TYPES
|
mapPref, DEV, THEME, EXPANDED_GROUPS, RECENT_TYPES, FAVORITE_TYPES
|
||||||
} from '@/store/prefs';
|
} from '@/store/prefs';
|
||||||
import applyTypeConfigs from '@/config/type-config';
|
|
||||||
import ActionMenu from '@/components/ActionMenu';
|
import ActionMenu from '@/components/ActionMenu';
|
||||||
import Jump from '@/components/nav/Jump';
|
import Jump from '@/components/nav/Jump';
|
||||||
import NamespaceFilter from '@/components/nav/NamespaceFilter';
|
import NamespaceFilter from '@/components/nav/NamespaceFilter';
|
||||||
|
|
@ -128,7 +127,6 @@ export default {
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
this.queueUpdate = debounce(this.getGroups, 500);
|
this.queueUpdate = debounce(this.getGroups, 500);
|
||||||
applyTypeConfigs(this.$store);
|
|
||||||
this.getGroups();
|
this.getGroups();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import { findBy } from '@/utils/array';
|
||||||
import { SETUP } from '@/config/query-params';
|
import { SETUP } from '@/config/query-params';
|
||||||
import { get } from '@/utils/object';
|
import { get } from '@/utils/object';
|
||||||
import { ClusterNotFoundError } from '@/utils/error';
|
import { ClusterNotFoundError } from '@/utils/error';
|
||||||
|
import applyTypeConfigs from '@/config/type-config';
|
||||||
|
|
||||||
export default async function({
|
export default async function({
|
||||||
route, app, store, redirect, req, isDev
|
route, app, store, redirect, req, isDev
|
||||||
|
|
@ -56,6 +57,8 @@ export default async function({
|
||||||
// Load stuff
|
// Load stuff
|
||||||
const clusterId = get(route, 'params.cluster');
|
const clusterId = get(route, 'params.cluster');
|
||||||
|
|
||||||
|
applyTypeConfigs(store);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
await store.dispatch('loadManagement'),
|
await store.dispatch('loadManagement'),
|
||||||
|
|
|
||||||
|
|
@ -769,6 +769,8 @@ export const mutations = {
|
||||||
},
|
},
|
||||||
|
|
||||||
mapTypeToComponentName(state, { match, replace }) {
|
mapTypeToComponentName(state, { match, replace }) {
|
||||||
|
match = ensureRegex(match);
|
||||||
|
match = regexToString(match);
|
||||||
state.typeToComponentMappings.push({ match, replace });
|
state.typeToComponentMappings.push({ match, replace });
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue