From d37ba7613062efad5b516e9fc462a9d4ae18da02 Mon Sep 17 00:00:00 2001 From: Francesco Torchia Date: Mon, 27 Nov 2023 16:31:24 +0100 Subject: [PATCH] temp Signed-off-by: Francesco Torchia --- .../components/settings/ChartValues.vue | 91 +++++++++++++++---- dashboard/pkg/epinio/edit/services.vue | 4 + dashboard/pkg/epinio/models/services.js | 2 + dashboard/pkg/epinio/utils/settings.ts | 6 +- 4 files changed, 85 insertions(+), 18 deletions(-) diff --git a/dashboard/pkg/epinio/components/settings/ChartValues.vue b/dashboard/pkg/epinio/components/settings/ChartValues.vue index 549de72..53dba56 100644 --- a/dashboard/pkg/epinio/components/settings/ChartValues.vue +++ b/dashboard/pkg/epinio/components/settings/ChartValues.vue @@ -4,6 +4,9 @@ import formRulesGenerator from '@shell/utils/validators/formRules'; import Checkbox from '@components/Form/Checkbox/Checkbox.vue'; import LabeledSelect from '@shell/components/form/LabeledSelect.vue'; import LabeledInput from '@components/Form/LabeledInput/LabeledInput.vue'; +import KeyValue from '@shell/components/form/KeyValue.vue'; +import ArrayList from '@shell/components/form/ArrayList.vue'; +import { _VIEW } from '@shell/config/query-params'; interface Data { valid: { [key: string]: boolean } @@ -12,9 +15,11 @@ interface Data { // Data, Methods, Computed, Props export default Vue.extend({ components: { + ArrayList, Checkbox, LabeledInput, LabeledSelect, + KeyValue }, props: { @@ -41,7 +46,10 @@ export default Vue.extend({ }, data() { - return { valid: {} }; + return { + valid: {}, + VIEW: _VIEW, + }; }, watch: { @@ -50,6 +58,30 @@ export default Vue.extend({ } }, + mounted() { + console.log(this.chart, this.value); + }, + + computed: { + orderedChart() { + const toArray = (value: any, type: string) => Object.keys(value) + .filter((k) => value[k].type === type) + .reduce((acc: any[], key: any) => { + return [ + ...acc, + { name: key, type: value[key].type } + ]; + }, []); + + return [ + ...toArray(this.chart, 'bool'), + ...toArray(this.chart, 'string'), + ...toArray(this.chart, 'map'), + ...toArray({ ...this.chart, 'example.array': { type: 'array' } }, 'array'), + ]; + } + }, + methods: { rules(key: string, min: any, max: any) { const frg = formRulesGenerator(this.$store.getters['i18n/t'], { key }); @@ -92,6 +124,13 @@ export default Vue.extend({ onInputCheckbox(key: string, value: boolean) { Vue.set(this.value, key, value ? 'true' : 'false'); + }, + + setMapValue(v: any) { + console.log(v) + }, + setArrayValue(v: any) { + console.log(v) } }, }); @@ -101,49 +140,67 @@ export default Vue.extend({

{{ title }}

+ +
diff --git a/dashboard/pkg/epinio/edit/services.vue b/dashboard/pkg/epinio/edit/services.vue index e1286c3..0f025e1 100644 --- a/dashboard/pkg/epinio/edit/services.vue +++ b/dashboard/pkg/epinio/edit/services.vue @@ -137,6 +137,10 @@ export default Vue.extend