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

feat(dashboard-qa): merge to master #5562

Merged
merged 4 commits into from
Jan 20, 2025
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 @@ -128,10 +128,10 @@ const handleClickAddCase = () => {
const handleClickDeleteCase = (idx: number) => {
casesInfo.value.splice(idx, 1);
};
const handleClickExpand = (idx: number) => {
state.expandCaseMap[idx] = !state.expandCaseMap[idx];
state.expandCaseMap = { ...state.expandCaseMap };
};
// const handleClickExpand = (idx: number) => {
// state.expandCaseMap[idx] = !state.expandCaseMap[idx];
// state.expandCaseMap = { ...state.expandCaseMap };
// };
const handleUpdateBasedOn = (key: string) => {
keyInfo.value = key;
};
Expand Down Expand Up @@ -247,11 +247,11 @@ watch(() => state.invalid, (_invalid) => {
:disabled="casesInfo.length === 1"
@click="handleClickDeleteCase(cIdx)"
/>
<p-icon-button name="ic_arrows-expand-all"
size="sm"
class="expand-button"
@click="handleClickExpand(cIdx)"
/>
<!-- <p-icon-button name="ic_arrows-expand-all"-->
<!-- size="sm"-->
<!-- class="expand-button"-->
<!-- @click="handleClickExpand(cIdx)"-->
<!-- />-->
</div>

<div class="grid grid-cols-12 gap-2">
Expand Down Expand Up @@ -319,7 +319,6 @@ watch(() => state.invalid, (_invalid) => {
@apply bg-white rounded border border-gray-150;
position: relative;
padding: 0.5rem;
z-index: 1;
margin-bottom: 0.5rem;
&.expanded {
width: 35rem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ const queryResult = useQuery({
page: state.page,
vars: dashboardDetailGetters.dashboardInfo?.vars,
}),
enabled: computed(() => storeState.selectedDataTableId !== undefined),
enabled: computed(() => storeState.selectedDataTableId !== undefined && storeState.selectedDataTable !== undefined),
staleTime: WIDGET_LOAD_STALE_TIME,
retry: 2,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ const state = reactive({
}
if (state.fixedValue) return state.fixedValue;
if (state.multiselectable) {
return state.menuItems.filter((d) => state.fieldValue.data?.includes(d.name));
return state.fieldValue.data?.map((d) => {
const validMenuItem = state.menuItems.find((item) => item.name === d);
return validMenuItem || { name: d, label: d };
}) || [];
}
return state.fieldValue.data;
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ const queryResult = useQuery({
staleTime: WIDGET_LOAD_STALE_TIME,
});

const widgetLoading = computed<boolean>(() => queryResult.isLoading.value || queryResult.isRefetching.value);
const widgetLoading = computed<boolean>(() => queryResult.isFetching.value || queryResult.isPending.value);
const errorMessage = computed<string|undefined>(() => {
if (!state.dataTable) return i18n.t('COMMON.WIDGETS.NO_DATA_TABLE_ERROR_MESSAGE');
return queryResult.error?.value?.message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ const queryResult = useQuery({
staleTime: WIDGET_LOAD_STALE_TIME,
});

const widgetLoading = computed<boolean>(() => queryResult.isLoading.value || queryResult.isRefetching.value);
const widgetLoading = computed<boolean>(() => queryResult.isFetching.value || queryResult.isPending.value);
const errorMessage = computed<string|undefined>(() => {
if (!state.dataTable) return i18n.t('COMMON.WIDGETS.NO_DATA_TABLE_ERROR_MESSAGE');
return queryResult.error?.value?.message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ const queryResult = useQuery({
staleTime: WIDGET_LOAD_STALE_TIME,
});

const widgetLoading = computed<boolean>(() => queryResult.isLoading.value || queryResult.isRefetching.value);
const widgetLoading = computed<boolean>(() => queryResult.isFetching.value || queryResult.isPending.value);
const errorMessage = computed<string|undefined>(() => {
if (!state.dataTable) return i18n.t('COMMON.WIDGETS.NO_DATA_TABLE_ERROR_MESSAGE');
return queryResult.error?.value?.message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ const queryResult = useQuery({
staleTime: WIDGET_LOAD_STALE_TIME,
});

const widgetLoading = computed<boolean>(() => queryResult.isLoading.value || queryResult.isRefetching.value);
const widgetLoading = computed<boolean>(() => queryResult.isFetching.value || queryResult.isPending.value);
const errorMessage = computed<string|undefined>(() => {
if (!state.dataTable) return i18n.t('COMMON.WIDGETS.NO_DATA_TABLE_ERROR_MESSAGE');
return queryResult.error?.value?.message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ const queryResult = useQuery({
staleTime: WIDGET_LOAD_STALE_TIME,
});

const widgetLoading = computed<boolean>(() => queryResult.isLoading.value || queryResult.isRefetching.value);
const widgetLoading = computed<boolean>(() => queryResult.isFetching.value || queryResult.isPending.value);
const errorMessage = computed<string>(() => {
if (!state.dataTable) return i18n.t('COMMON.WIDGETS.NO_DATA_TABLE_ERROR_MESSAGE');
return queryResult.error?.value?.message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ const queryResult = useQuery({
staleTime: WIDGET_LOAD_STALE_TIME,
});

const widgetLoading = computed<boolean>(() => queryResult.isLoading.value || queryResult.isRefetching.value);
const widgetLoading = computed<boolean>(() => queryResult.isFetching.value || queryResult.isPending.value);
const errorMessage = computed<string>(() => {
if (!state.dataTable) return i18n.t('COMMON.WIDGETS.NO_DATA_TABLE_ERROR_MESSAGE');
return queryResult.error?.value?.message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ const queryResult = useQuery({
staleTime: WIDGET_LOAD_STALE_TIME,
});

const widgetLoading = computed<boolean>(() => queryResult.isLoading.value || queryResult.isRefetching.value);
const widgetLoading = computed<boolean>(() => queryResult.isFetching.value || queryResult.isPending.value);
const errorMessage = computed<string|undefined>(() => {
if (!state.dataTable) return i18n.t('COMMON.WIDGETS.NO_DATA_TABLE_ERROR_MESSAGE');
return queryResult.error?.value?.message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ const queryResults = useQueries({
],
});

const widgetLoading = computed<boolean>(() => queryResults.value?.[0].isLoading || queryResults.value?.[0].isRefetching);
const widgetLoading = computed<boolean>(() => queryResults.value?.[0].isPending || queryResults.value?.[0].isFetching);
const previousLoading = computed<string>(() => queryResults.value?.[1].isLoading);
const errorMessage = computed<string>(() => {
if (!state.dataTable) return i18n.t('COMMON.WIDGETS.NO_DATA_TABLE_ERROR_MESSAGE');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ const queryResult = useQuery({
staleTime: WIDGET_LOAD_STALE_TIME,
});

const widgetLoading = computed<boolean>(() => queryResult.isLoading.value || queryResult.isRefetching.value);
const widgetLoading = computed<boolean>(() => queryResult.isFetching.value || queryResult.isPending.value);
const errorMessage = computed<string>(() => {
if (!state.dataTable) return i18n.t('COMMON.WIDGETS.NO_DATA_TABLE_ERROR_MESSAGE');
return queryResult.error?.value?.message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ const queryResult = useQuery({
staleTime: WIDGET_LOAD_STALE_TIME,
});

const widgetLoading = computed<boolean>(() => queryResult.isLoading.value || queryResult.isRefetching.value);
const widgetLoading = computed<boolean>(() => queryResult.isFetching.value || queryResult.isPending.value);
const errorMessage = computed<string>(() => {
if (!state.dataTable) return i18n.t('COMMON.WIDGETS.NO_DATA_TABLE_ERROR_MESSAGE');
return queryResult.error?.value?.message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const sankeyChart: WidgetConfig = {
widgetName: 'sankeyChart',
meta: {
title: 'Sankey Chart',
sizes: ['md'],
sizes: ['md', 'full'],
defaultValidationConfig: {
defaultMaxCount: 1,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ const queryResult = useQuery({
staleTime: WIDGET_LOAD_STALE_TIME,
});

const widgetLoading = computed<boolean>(() => queryResult.isLoading.value || queryResult.isRefetching.value);
const widgetLoading = computed<boolean>(() => queryResult.isFetching.value || queryResult.isPending.value);
const errorMessage = computed<string|undefined>(() => {
if (!state.dataTable) return i18n.t('COMMON.WIDGETS.NO_DATA_TABLE_ERROR_MESSAGE');
return queryResult.error?.value?.message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ const queryResult = useQuery({
staleTime: WIDGET_LOAD_STALE_TIME,
});

const widgetLoading = computed<boolean>(() => queryResult.isLoading.value || queryResult.isRefetching.value);
const widgetLoading = computed<boolean>(() => queryResult.isFetching.value || queryResult.isPending.value);
const errorMessage = computed<string|undefined>(() => {
if (!state.dataTable) return i18n.t('COMMON.WIDGETS.NO_DATA_TABLE_ERROR_MESSAGE');
return queryResult.error?.value?.message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ const queryResults = useQueries({
],
});

const widgetLoading = computed<boolean>(() => queryResults.value?.[0].isLoading || queryResults.value?.[0].isRefetching);
const widgetLoading = computed<boolean>(() => queryResults.value?.[0].isFetching || queryResults.value?.[0].isPending);
const errorMessage = computed<string>(() => {
if (!state.dataTable) return i18n.t('COMMON.WIDGETS.NO_DATA_TABLE_ERROR_MESSAGE');
return queryResults.value?.[0].error?.message as string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ const queryResult = useQuery({
staleTime: WIDGET_LOAD_STALE_TIME,
});

const widgetLoading = computed<boolean>(() => queryResult.isLoading.value || queryResult.isRefetching.value);
const widgetLoading = computed<boolean>(() => queryResult.isFetching.value || queryResult.isPending.value);
const errorMessage = computed<string>(() => {
if (!state.dataTable) return i18n.t('COMMON.WIDGETS.NO_DATA_TABLE_ERROR_MESSAGE');
return queryResult.error?.value?.message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ interface VariableMenuItem extends MenuItem {
interface Props {
isManageable?: boolean;
disabled?: boolean;
widgetMode?: boolean;
}

const props = defineProps<Props>();
Expand Down Expand Up @@ -180,7 +181,7 @@ const {
@select="handleSelectVariable"
@update:search-text="handleUpdateSearchText"
>
<template v-if="!dashboardDetailGetters.isDeprecatedDashboard"
<template v-if="!dashboardDetailGetters.isDeprecatedDashboard && !props.widgetMode"
#bottom
>
<p-button class="manage-variable-button"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ const handleResetVariables = () => {
>
{{ $t('DASHBOARDS.CUSTOMIZE.SAVE') }}
</p-text-button>
<dashboard-variables-more-button v-if="!state.isSharedDashboard" />
<dashboard-variables-more-button v-if="!state.isSharedDashboard"
:widget-mode="props.widgetMode"
/>
<portal to="dashboard-detail-page">
<dashboard-manage-variable-overlay :visible="state.showOverlay" />
</portal>
Expand Down
Loading