Skip to content

Commit

Permalink
fix: fix minor bugs
Browse files Browse the repository at this point in the history
Signed-off-by: yuda <[email protected]>
  • Loading branch information
yuda110 committed Dec 17, 2024
1 parent 21d68b8 commit 0368f2e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import {
computed, onMounted, reactive, ref, watch,
onMounted, reactive, ref, watch,
} from 'vue';
import type { TranslateResult } from 'vue-i18n';
Expand Down Expand Up @@ -38,7 +38,7 @@ const labelsInfo = ref<AddLabelsOptions['labels']>(props.originData.labels);
const state = reactive({
proxyOperatorOptions: useProxyValue<AddLabelsOptions>('operator-options', props, emit),
refinedLabels: [] as AdditionalLabel[],
groupByKeys: computed<string[]>(() => []),
// groupByKeys: computed<string[]>(() => []),
});
/* Helper */
Expand All @@ -47,9 +47,9 @@ const getInvalidText = (idx: number): TranslateResult|undefined => {
if (!targetName) {
return undefined;
}
if (state.groupByKeys.includes(targetName)) {
return i18n.t('COMMON.WIDGETS.DATA_TABLE.FORM.ADD_LABELS.GROUP_BY_KEY_INVALID');
}
// if (state.groupByKeys.includes(targetName)) {
// return i18n.t('COMMON.WIDGETS.DATA_TABLE.FORM.ADD_LABELS.GROUP_BY_KEY_INVALID');
// }
if (targetName === DATE_FIELD) {
return i18n.t('COMMON.WIDGETS.DATA_TABLE.FORM.ADD_LABELS.DATE_FIELD_INVALID');
}
Expand Down Expand Up @@ -84,7 +84,7 @@ watch(() => state.refinedLabels, (_refinedLabels) => {
return acc;
}, {}),
};
});
}, { deep: true });
onMounted(() => {
state.refinedLabels = Object.entries(labelsInfo.value).map(([name, value]) => ({ name, value }));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import {
computed, reactive, ref, watch,
} from 'vue';
import { cloneDeep } from 'lodash';
import {
PIconButton, PI, PFieldGroup, PSelectButton, PTextInput, PButton, PTextarea, PButtonModal, PToggleButton, PLink, PFieldTitle,
} from '@cloudforet/mirinae';
Expand Down Expand Up @@ -30,7 +32,7 @@ const emit = defineEmits<{(e: 'update:operator-options', value: EvalOptions): vo
const dataTableInfo = ref<TransformDataTableInfo>({
dataTableId: props.originData?.data_table_id,
});
const expressionsInfo = ref<EvalOptions['expressions']>(props.originData.expressions || []);
const expressionsInfo = ref<EvalOptions['expressions']>(cloneDeep(props.originData.expressions) || []);
const CONDITION_PLACEHOLDER = '{{ Product }} == \'A\' & {{ Provider }} == \'B\'';
const FORMULA_PLACEHOLDER = '{{ Product }}';
Expand Down Expand Up @@ -123,7 +125,6 @@ watch([dataTableInfo, expressionsInfo], ([_dataTableInfo, _expressionsInfo]) =>
data_table_id: _dataTableInfo.dataTableId,
expressions: _expressionsInfo,
};
console.log(_expressionsInfo, state.proxyOperatorOptions);
}, { deep: true, immediate: true });
</script>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import {
reactive, ref, watch,
} from 'vue';
import { cloneDeep } from 'lodash';
import {
PButton, PIconButton, PTextInput, PFieldTitle, PLink,
} from '@cloudforet/mirinae';
Expand Down Expand Up @@ -30,7 +32,7 @@ const emit = defineEmits<{(e: 'update:operator-options', value: QueryOptions): v
const dataTableInfo = ref<TransformDataTableInfo>({
dataTableId: props.originData?.data_table_id,
});
const conditionsInfo = ref<QueryOptions['conditions']>(props.originData.conditions);
const conditionsInfo = ref<QueryOptions['conditions']>(cloneDeep(props.originData.conditions));
// HACK: remove comments after backend development
// const operatorInfo = ref<QueryOptions['operator']>(props.originData.operator);
const state = reactive({
Expand Down

0 comments on commit 0368f2e

Please sign in to comment.