Fix question charts saving to values (#1221)

This commit is contained in:
Vincent Fiduccia 2020-09-10 17:31:16 -07:00
parent 7dd90c7777
commit 000ad98d30
No known key found for this signature in database
GPG Key ID: 2B29AD6BB2BB2582
2 changed files with 8 additions and 4 deletions

View File

@ -306,6 +306,10 @@ export default {
return EDITOR_MODES.EDIT_CODE; return EDITOR_MODES.EDIT_CODE;
}, },
hasQuestions() {
return this.versionInfo && !!this.versionInfo.questions;
}
}, },
watch: { watch: {
@ -525,7 +529,7 @@ export default {
actionInput(isUpgrade) { actionInput(isUpgrade) {
const fromChart = this.versionInfo.values || {}; const fromChart = this.versionInfo.values || {};
if ( !this.valuesComponent ) { if ( !this.valuesComponent && !this.hasQuestions ) {
try { try {
this.chartValues = jsyaml.safeLoad(this.valuesYaml); this.chartValues = jsyaml.safeLoad(this.valuesYaml);
} catch (err) { } catch (err) {
@ -787,7 +791,7 @@ export default {
</tab> </tab>
</template> </template>
<Questions <Questions
v-else-if="versionInfo && versionInfo.questions" v-else-if="hasQuestions"
v-model="chartValues" v-model="chartValues"
:chart="chart" :chart="chart"
:version="version" :version="version"

View File

@ -958,10 +958,10 @@ export default {
for ( const item of items ) { for ( const item of items ) {
let name = `${ item.nameDisplay }.yaml`; let name = `${ item.nameDisplay }.yaml`;
const i = 2; let i = 2;
while ( names.includes(name) ) { while ( names.includes(name) ) {
name = `${ item.nameDisplay }_${ i }.yaml`; name = `${ item.nameDisplay }_${ i++ }.yaml`;
} }
names.push(name); names.push(name);