Merge pull request #405 from codyrancher/apply-type-config

Ensure typeconfigs are applied before type-map getters are used
This commit is contained in:
Vincent Fiduccia 2020-03-19 14:40:48 -07:00 committed by GitHub
commit 518f11e654
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 3 deletions

View File

@ -17,7 +17,13 @@ import {
import { DSL } from '@/store/type-map';
let called = false;
export default function(store) {
if (called) {
return;
}
called = true;
const {
basicType,
ignoreType,
@ -38,7 +44,7 @@ export default function(store) {
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('extensions.ingress'); // Moved into networking

View File

@ -4,7 +4,6 @@ import { mapState } from 'vuex';
import {
mapPref, DEV, THEME, EXPANDED_GROUPS, RECENT_TYPES, FAVORITE_TYPES
} from '@/store/prefs';
import applyTypeConfigs from '@/config/type-config';
import ActionMenu from '@/components/ActionMenu';
import Jump from '@/components/nav/Jump';
import NamespaceFilter from '@/components/nav/NamespaceFilter';
@ -128,7 +127,6 @@ export default {
created() {
this.queueUpdate = debounce(this.getGroups, 500);
applyTypeConfigs(this.$store);
this.getGroups();
},

View File

@ -3,6 +3,7 @@ import { findBy } from '@/utils/array';
import { SETUP } from '@/config/query-params';
import { get } from '@/utils/object';
import { ClusterNotFoundError } from '@/utils/error';
import applyTypeConfigs from '@/config/type-config';
export default async function({
route, app, store, redirect, req, isDev
@ -56,6 +57,8 @@ export default async function({
// Load stuff
const clusterId = get(route, 'params.cluster');
applyTypeConfigs(store);
try {
await Promise.all([
await store.dispatch('loadManagement'),

View File

@ -769,6 +769,8 @@ export const mutations = {
},
mapTypeToComponentName(state, { match, replace }) {
match = ensureRegex(match);
match = regexToString(match);
state.typeToComponentMappings.push({ match, replace });
},