Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
COLOR_SCHEMA, DATA_FIELD_HEATMAP_COLOR, DATE_FORMAT, DEFAULT_COMPARISON_COLOR, NUMBER_FORMAT, TABLE_DEFAULT_MINIMUM_WIDTH, WIDGET_HEIGHT,
} from '@/common/modules/widgets/_constants/widget-field-constant';
import { integrateFieldsSchema } from '@/common/modules/widgets/_helpers/widget-field-helper';
// eslint-disable-next-line import/no-cycle
import { sortWidgetTableFields } from '@/common/modules/widgets/_helpers/widget-helper';
import type { FieldDefaultValueConvertor, WidgetFieldTypeMap } from '@/common/modules/widgets/_widget-field-value-manager/type';
import type { CategoryByOptions } from '@/common/modules/widgets/_widget-fields/category-by/type';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
<script setup lang="ts">
import {
computed, reactive,
computed, reactive, defineAsyncComponent,
} from 'vue';

import type { DashboardGlobalVariable, GlobalVariableFilterType } from '@/api-clients/dashboard/_types/dashboard-global-variable-type';
import type { DashboardVars } from '@/api-clients/dashboard/_types/dashboard-type';

import { useProxyValue } from '@/common/composables/proxy-state';

import DashboardGlobalVariableFilterEnum
from '@/services/dashboards/components/dashboard-detail/DashboardGlobalVariableFilterEnum.vue';
import DashboardGlobalVariableFilterNumberInput
from '@/services/dashboards/components/dashboard-detail/DashboardGlobalVariableFilterNumberInput.vue';
import DashboardGlobalVariableFilterNumberSlider
from '@/services/dashboards/components/dashboard-detail/DashboardGlobalVariableFilterNumberSlider.vue';
import DashboardGlobalVariableFilterReference
from '@/services/dashboards/components/dashboard-detail/DashboardGlobalVariableFilterReference.vue';
import DashboardGlobalVariableFilterTextInput
from '@/services/dashboards/components/dashboard-detail/DashboardGlobalVariableFilterTextInput.vue';
const FILTER_COMPONENT_MAP: Record<GlobalVariableFilterType, ReturnType<typeof defineAsyncComponent>> = {
ENUM: defineAsyncComponent(() => import('@/services/dashboards/components/dashboard-detail/DashboardGlobalVariableFilterEnum.vue')),
REFERENCE: defineAsyncComponent(() => import('@/services/dashboards/components/dashboard-detail/DashboardGlobalVariableFilterReference.vue')),
TEXT_INPUT: defineAsyncComponent(() => import('@/services/dashboards/components/dashboard-detail/DashboardGlobalVariableFilterTextInput.vue')),
NUMBER_INPUT: defineAsyncComponent(() => import('@/services/dashboards/components/dashboard-detail/DashboardGlobalVariableFilterNumberInput.vue')),
NUMBER_SLIDER: defineAsyncComponent(() => import('@/services/dashboards/components/dashboard-detail/DashboardGlobalVariableFilterNumberSlider.vue')),
};


interface Props {
Expand Down Expand Up @@ -46,25 +43,9 @@ const state = reactive({

<template>
<div class="dashboard-global-variable-filter">
<dashboard-global-variable-filter-enum v-if="state.variableFilterType === 'ENUM'"
:variable="props.variable"
:vars.sync="state.proxyVars"
/>
<dashboard-global-variable-filter-reference v-else-if="state.variableFilterType === 'REFERENCE'"
:variable="props.variable"
:vars.sync="state.proxyVars"
/>
<dashboard-global-variable-filter-text-input v-else-if="state.variableFilterType === 'TEXT_INPUT'"
:variable="props.variable"
:vars.sync="state.proxyVars"
/>
<dashboard-global-variable-filter-number-input v-else-if="state.variableFilterType === 'NUMBER_INPUT'"
:variable="props.variable"
:vars.sync="state.proxyVars"
/>
<dashboard-global-variable-filter-number-slider v-else-if="state.variableFilterType === 'NUMBER_SLIDER'"
:variable="props.variable"
:vars.sync="state.proxyVars"
<component :is="FILTER_COMPONENT_MAP[state.variableFilterType]"
:variable="props.variable"
:vars.sync="state.proxyVars"
/>
</div>
</template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ const changeVariables = (changedSelected?: number) => {
watch(() => dashboard.value?.vars_schema?.properties, (varsSchema, prevVarsSchema) => {
if (!varsSchema) return;
const _variable = props.variable as NumberAnyVariable;
if (isEqual(varsSchema[_variable.key], prevVarsSchema?.[varsSchema[_variable.key]])) return;
if (isEqual(varsSchema[_variable.key], prevVarsSchema?.[_variable.key])) return;

state.value = (dashboard.value?.vars?.[_variable.key] as number) || _variable.options.min;
changeVariables(state.value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,13 @@ const handleResetVariables = () => {
dashboardDetailStore.setVars(_originVars);
};

const handleUpdateVars = (val: DashboardVars) => {
state.tempVars = val;
dashboardDetailStore.setVars(val);
};

watch(() => dashboard.value?.vars, (_vars) => {
state.tempVars = { ..._vars };
}, { immediate: true });

watch([() => state.tempVars, dashboard], ([_tempVars]) => {
dashboardDetailStore.setVars(_tempVars);
}, { deep: true });
</script>

<template>
Expand All @@ -104,8 +103,7 @@ watch(() => dashboard.value?.vars, (_vars) => {
<template v-for="(property, idx) in state.globalVariables">
<div :key="`${property.name}-${idx}`">
<dashboard-global-variable-filter :variable="property"
:vars="state.tempVars"
@update:vars="handleUpdateVars"
:vars.sync="state.tempVars"
/>
<changed-mark v-if="state.modifiedVariablesSchemaProperties.includes(property.key)" />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { SpaceRouter } from '@/router';

import { useAppContextStore } from '@/store/app-context/app-context-store';

import { showErrorMessage } from '@/lib/helper/notice-alert-helper';

import { useBreadcrumbs } from '@/common/composables/breadcrumbs';
import ErrorHandler from '@/common/composables/error/errorHandler';
import { useProperRouteLocation } from '@/common/composables/proper-route-location';
Expand Down Expand Up @@ -111,6 +113,7 @@ const { mutate: updateDashboard, isPending: dashboardUpdateLoading } = useMutati
});
},
onError: (e) => {
showErrorMessage(e.message, e);
ErrorHandler.handleError(e);
},
},
Expand Down
21 changes: 21 additions & 0 deletions packages/language-pack/console-translation-2.8.babel
Original file line number Diff line number Diff line change
Expand Up @@ -32970,6 +32970,27 @@
</concept_node>
</children>
</folder_node>
<concept_node>
<name>NO_DATA_TABLE_ERROR_MESSAGE</name>
<definition_loaded>false</definition_loaded>
<description/>
<comment/>
<default_text/>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>ja-JP</language>
<approved>false</approved>
</translation>
<translation>
<language>ko-KR</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node>
<name>NO_DATA_TO_DISPLAY</name>
<definition_loaded>false</definition_loaded>
Expand Down
1 change: 1 addition & 0 deletions packages/language-pack/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1799,6 +1799,7 @@
"LINE_TO_ZERO": "Line to Zero",
"MISSING_VALUE": "Missing Value"
},
"NO_DATA_TABLE_ERROR_MESSAGE": "Please check the data source or review the widget settings.",
"NO_DATA_TO_DISPLAY": "No Data to Display",
"NUMBER_CARD": {
"LESS_THAN_PREVIOUS_DAY": "less than previous day",
Expand Down
1 change: 1 addition & 0 deletions packages/language-pack/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -1799,6 +1799,7 @@
"LINE_TO_ZERO": "0として表示",
"MISSING_VALUE": "欠損値の処理方式"
},
"NO_DATA_TABLE_ERROR_MESSAGE": "データソースを確認するか、ウィジェットの設定を見直してください。",
"NO_DATA_TO_DISPLAY": "データがありません",
"NUMBER_CARD": {
"LESS_THAN_PREVIOUS_DAY": "前日よりも少ない",
Expand Down
1 change: 1 addition & 0 deletions packages/language-pack/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -1799,6 +1799,7 @@
"LINE_TO_ZERO": "0으로 표시",
"MISSING_VALUE": "없는 값 처리 방식"
},
"NO_DATA_TABLE_ERROR_MESSAGE": "데이터 소스를 확인하거나 위젯 설정을 검토해 주세요.",
"NO_DATA_TO_DISPLAY": "데이터가 없습니다.",
"NUMBER_CARD": {
"LESS_THAN_PREVIOUS_DAY": "전일 대비 하락",
Expand Down
Loading