Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove custom chart steps feature #12044

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 2 additions & 56 deletions shell/pages/c/_cluster/apps/charts/install.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import isEqual from 'lodash/isEqual';
import { mapPref, DIFF } from '@shell/store/prefs';
import { mapFeature, MULTI_CLUSTER, LEGACY } from '@shell/store/features';
import { mapGetters } from 'vuex';
import { markRaw } from 'vue';
import { Banner } from '@components/Banner';
import ButtonGroup from '@shell/components/ButtonGroup';
import ChartReadme from '@shell/components/ChartReadme';
Expand Down Expand Up @@ -260,14 +261,6 @@ export default {
await this.loadValuesComponent();
}

/*
Check if the Helm chart has indicated
that the user should fill out the chart values
through a wizard-style workflow. If so, load
the chart steps.
*/
await this.loadChartSteps();

/*
this.loadedVersion will only be true if you select a non-defalut
option from the "Version" dropdown menu in Apps & Marketplace
Expand Down Expand Up @@ -451,10 +444,6 @@ export default {
weight: 10
},

customSteps: [

],

isPlainLayout: isPlainLayout(this.$route.query),

legacyDefs: {
Expand Down Expand Up @@ -674,7 +663,6 @@ export default {
steps.push(
this.stepBasic,
this.stepValues,
...this.customSteps
);
}

Expand Down Expand Up @@ -826,10 +814,6 @@ export default {
// for editing values
await this.loadValuesComponent();

// Load Helm chart info used for showing
// wizard steps
await this.loadChartSteps();

window.scrollTop = 0;

this.preFormYamlOption = this.valuesComponent || this.hasQuestions ? VALUES_STATE.FORM : VALUES_STATE.YAML;
Expand Down Expand Up @@ -910,7 +894,7 @@ export default {
const hasChartComponent = this.$store.getters['type-map/hasCustomChart'](component);

if ( hasChartComponent ) {
this.valuesComponent = this.$store.getters['type-map/importChart'](component);
this.valuesComponent = markRaw(this.$store.getters['type-map/importChart'](component));
this.showValuesComponent = true;
} else {
this.valuesComponent = null;
Expand All @@ -922,33 +906,6 @@ export default {
}
},

async loadChartSteps() {
const component = this.version?.annotations?.[CATALOG_ANNOTATIONS.COMPONENT];

if ( component ) {
const steps = await this.$store.getters['catalog/chartSteps'](component);
rak-phillip marked this conversation as resolved.
Show resolved Hide resolved

this.customSteps = await Promise.all( steps.map((cs) => this.loadChartStep(cs)));
}
},

async loadChartStep(customStep) {
// Broken in 2.10, see https://github.com/rancher/dashboard/issues/11898
const loaded = await customStep.component();
const withFallBack = this.$store.getters['i18n/withFallback'];

return {
name: customStep.name,
label: withFallBack(loaded?.default?.label, null, customStep.name),
subtext: withFallBack(loaded?.default?.subtext, null, ''),
weight: loaded?.default?.weight,
ready: false,
hidden: true,
loading: true,
component: customStep.component,
};
},

selectChart(chart) {
if ( !chart ) {
return;
Expand Down Expand Up @@ -1348,17 +1305,6 @@ export default {
@cancel="cancel"
@finish="finish"
>
<template
v-for="customStep of customSteps"
v-slot:[customStep.name]
:key="customStep.name"
>
<component
:is="customStep.component"
@update="updateStep(customStep.name, $event)"
@errors="e=>errors.push(...e)"
/>
</template>
<template #bannerTitleImage>
<div>
<div class="logo-bg">
Expand Down
26 changes: 0 additions & 26 deletions shell/store/catalog.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { findBy, addObject, filterBy, isArray } from '@shell/utils/array';
import { stringify } from '@shell/utils/error';
import { classify } from '@shell/plugins/dashboard-store/classify';
import { sortBy } from '@shell/utils/sort';
import { importChart } from '@shell/utils/dynamic-importer';
import { ensureRegex } from '@shell/utils/string';
import { isPrerelease } from '@shell/utils/version';
import difference from 'lodash/difference';
Expand Down Expand Up @@ -265,31 +264,6 @@ export const getters = {
};
},

chartSteps(state, getters) {
return (name) => {
const steps = [];

const stepsPath = `./${ name }/steps/`;
// require.context only takes literals, so find all candidate step files and filter out
const allPaths = require.context('@shell/chart', true, /\.vue$/).keys();

allPaths
.filter((path) => path.startsWith(stepsPath))
.forEach((path) => {
try {
steps.push({
name: path.replace(stepsPath, ''),
component: importChart(path.substr(2, path.length)),
});
} catch (e) {
console.warn(`Failed to load step component ${ path } for chart ${ name }`, e); // eslint-disable-line no-console
}
});

return steps;
};
},

inStore(state) {
return state.inStore;
},
Expand Down
Loading