diff --git a/cypress/elements/pivotTable.js b/cypress/elements/pivotTable.js index 3b41d3982d..4463645e36 100644 --- a/cypress/elements/pivotTable.js +++ b/cypress/elements/pivotTable.js @@ -1,6 +1,9 @@ const valueCellEl = 'visualization-value-cell' const headerCellEl = 'visualization-column-header' +export const expectTableToBeVisible = () => + cy.get('.pivot-table-container').should('have.length', 1).and('be.visible') + export const clickTableValueCell = (index) => cy.getBySel(valueCellEl).eq(index).click() diff --git a/cypress/integration/options/totals.cy.js b/cypress/integration/options/totals.cy.js new file mode 100644 index 0000000000..81d5adfe8e --- /dev/null +++ b/cypress/integration/options/totals.cy.js @@ -0,0 +1,82 @@ +import { + AXIS_ID_COLUMNS, + AXIS_ID_ROWS, + DIMENSION_ID_DATA, + DIMENSION_ID_PERIOD, + VIS_TYPE_PIVOT_TABLE, + visTypeDisplayNames, +} from '@dhis2/analytics' +import { checkCheckbox } from '../../elements/common.js' +import { + clickDimensionModalHideButton, + clickDimensionModalUpdateButton, + expectDimensionModalToBeVisible, + selectAllItemsByButton, + selectDataElements, + selectFixedPeriods, + unselectAllItemsByButton, +} from '../../elements/dimensionModal/index.js' +import { + clickContextMenuAdd, + openContextMenu as openDimPanelContextMenu, + openDimension, +} from '../../elements/dimensionsPanel.js' +import { clickContextMenuMove, openContextMenu } from '../../elements/layout.js' +import { openOptionsModal } from '../../elements/menuBar.js' +import { + OPTIONS_TAB_DATA, + clickOptionsModalHideButton, +} from '../../elements/optionsModal/index.js' +import { + colTotalsOptionEl, + expectColumnsTotalsToBeChecked, +} from '../../elements/optionsModal/totals.js' +import { expectTableToBeVisible } from '../../elements/pivotTable.js' +import { goToStartPage } from '../../elements/startScreen.js' +import { changeVisType } from '../../elements/visualizationTypeSelector.js' +import { TEST_CUSTOM_DIMENSIONS } from '../../utils/data.js' + +const AREA_DIMENSION = TEST_CUSTOM_DIMENSIONS.find((dim) => dim.name === 'Area') + +describe('Options - Column totals', () => { + describe('Regression test for DHIS2-17297', () => { + it('does not crash', () => { + goToStartPage() + changeVisType(visTypeDisplayNames[VIS_TYPE_PIVOT_TABLE]) + + openOptionsModal(OPTIONS_TAB_DATA) + checkCheckbox(colTotalsOptionEl) + + expectColumnsTotalsToBeChecked() + + clickOptionsModalHideButton() + + openContextMenu(DIMENSION_ID_DATA) + clickContextMenuMove(DIMENSION_ID_DATA, AXIS_ID_ROWS) + openContextMenu(DIMENSION_ID_PERIOD) + clickContextMenuMove(DIMENSION_ID_PERIOD, AXIS_ID_COLUMNS) + + openDimension(DIMENSION_ID_DATA) + selectDataElements(['ART enrollment stage 1']) + clickDimensionModalHideButton() + + const year = new Date().getFullYear().toString() + openDimension(DIMENSION_ID_PERIOD) + unselectAllItemsByButton() + selectFixedPeriods( + [`May ${year}`, `June ${year}`, `July ${year}`], + 'Monthly' + ) + clickDimensionModalHideButton() + + openDimPanelContextMenu(AREA_DIMENSION.id) + clickContextMenuAdd(AREA_DIMENSION.id, AXIS_ID_ROWS) + expectDimensionModalToBeVisible(AREA_DIMENSION.id) + selectAllItemsByButton() + + clickDimensionModalUpdateButton() + + expectTableToBeVisible() + }) + }) +}) diff --git a/i18n/es.po b/i18n/es.po index 05ec53da56..f919e03f37 100644 --- a/i18n/es.po +++ b/i18n/es.po @@ -61,6 +61,8 @@ msgid "" "'{{visualizationType}}' is intended to show a single item for this type of " "dimension. Only the first item will be used and saved." msgstr "" +"'{{visualizationType}}' está destinado a mostrar un solo elemento para este " +"tipo de dimensión. Sólo se utilizará y guardará el primer elemento." msgid "" "'{{visualiationType}}' is intended to show maximum {{maxNumber}} number of " @@ -81,6 +83,8 @@ msgid "" "'Outlier table' shows values from data elements only. Only data elements " "will be used and saved." msgstr "" +"La 'tabla de valores atípicos' muestra valores de elementos de datos " +"únicamente. Sólo se utilizarán y guardarán elementos de datos." msgid "Vertical" msgstr "Vertical" @@ -203,13 +207,13 @@ msgid "None selected" msgstr "Ninguno seleccionado" msgid "None in use" -msgstr "" +msgstr "Ninguno en uso" msgid "Only '{{- name}}' in use" msgstr "Solo '{{- name}}' en uso" msgid "Only {{number}} in use" -msgstr "" +msgstr "Solo {{number}} en uso" msgid "All items are selected" msgstr "Todos los elementos están seleccionados" @@ -612,6 +616,8 @@ msgid "" "The maximum number of outlier values to show in the table. Must be between " "1-500." msgstr "" +"El número máximo de valores atípicos a mostrar en la tabla. Debe estar entre" +" 1-500." msgid "Organisation unit" msgstr "Unidad organizativa" @@ -740,10 +746,10 @@ msgid "{{level}} level in {{orgunit}}" msgstr "{{level}} nivel en {{orgunit}}" msgid "Sort ascending by {{columnName}} and update" -msgstr "" +msgstr "Ordenar de forma ascendente por {{columnName}} y actualizar" msgid "Sort descending by {{columnName}} and update" -msgstr "" +msgstr "Ordenar de forma descendente por {{columnName}} y actualizar" msgid "Open as Map" msgstr "Abrir como mapa" @@ -755,34 +761,44 @@ msgstr "" " capas de mapa separadas." msgid "Category option combination" -msgstr "" +msgstr "Category option combination" msgid "Absolute deviation" -msgstr "" +msgstr "Desviación absoluta" msgid "" "A measure of the absolute difference between each data point and a central " "value, usually the mean or median, providing a straightforward understanding" " of dispersion in the dataset." msgstr "" +"Una medida de la diferencia absoluta entre cada punto de datos y un valor " +"central, generalmente la media o mediana, que proporciona una comprensión " +"directa de la dispersión en el conjunto de datos." msgid "" "A measure of how far a data point deviates from the median, using the median" " absolute deviation instead of the standard deviation, making it robust " "against outliers." msgstr "" +"Una medida de qué tan lejos se desvía un punto de datos de la mediana, " +"utilizando la desviación absoluta de la mediana en lugar de la desviación " +"estándar, lo que la hace robusta frente a los valores atípicos." msgid "Median" -msgstr "" +msgstr "Mediana" msgid "" "The middle value in a dataset when the values are arranged in ascending or " "descending order. It's a robust measure of central tendency that is less " "affected by outliers compared to the mean." msgstr "" +"El valor medio de un conjunto de datos cuando los valores están ordenados de" +" forma ascendente o descendente. Es una medida robusta de tendencia central " +"que se ve menos afectada por los valores atípicos en comparación con la " +"media." msgid "Median absolute deviation" -msgstr "" +msgstr "Desviación absoluta mediana" msgid "" "A robust measure of variability, found by calculating the median of the " @@ -790,33 +806,44 @@ msgid "" "less influenced by outliers compared to other measures like the standard " "deviation." msgstr "" +"Una medida sólida de variabilidad, que se obtiene calculando la mediana de " +"las diferencias absolutas entre cada punto de datos y la mediana general. " +"Está menos influenciado por valores atípicos en comparación con otras " +"medidas como la desviación estándar." msgid "Z-score" -msgstr "" +msgstr "Puntuación Z" msgid "" "A measure of how many standard deviations a data point is from the mean of a" " dataset, providing insight into how unusual or typical that data point is " "relative to the rest of the distribution." msgstr "" +"Una medida de cuántas desviaciones estándar tiene un punto de datos de la " +"media de un conjunto de datos, proporcionando información sobre cuán inusual" +" o típico es ese punto de datos en relación con el resto de la distribución." msgid "Mean" -msgstr "" +msgstr "Media" msgid "Average of the value over time." -msgstr "" +msgstr "Promedio del valor en el tiempo." msgid "" "A measure of how dispersed the data is in relation to the mean. Low standard" " deviation indicates data are clustered tightly around the mean, and high " "standard deviation indicates data are more spread out." msgstr "" +"Una medida de cuán dispersos están los datos en relación con la media. Una " +"desviación estándar baja indica que los datos están agrupados estrechamente " +"alrededor de la media, y la desviación estándar alta indica que los datos " +"están más dispersos." msgid "Minimum score threshold" -msgstr "" +msgstr "Umbral de puntuación mínima" msgid "Maximum score threshold" -msgstr "" +msgstr "Umbral de puntuación máxima" msgid "Not supported when using cumulative values" msgstr "No es compatible cuando se utilizan valores acumulativos." @@ -973,10 +1000,12 @@ msgid "There's a syntax problem with the analytics request." msgstr "Hay un problema de sintaxis con la solicitud de análisis." msgid "No outliers found" -msgstr "" +msgstr "No se encontraron valores atípicos" msgid "There were no outliers found for the selected data items and options." msgstr "" +"No se encontraron valores atípicos para los elementos de datos y opciones " +"seleccionados." msgid "or" msgstr "o" @@ -1256,9 +1285,13 @@ msgid "" "Compare the relationship between two data items across multiple places. " "Recommended for visualizing outliers." msgstr "" +"Comparar la relación entre dos elementos de datos en varios lugares. " +"Recomendado para visualizar valores atípicos." msgid "Automatically identify extreme outliers based on historical data." msgstr "" +"Identificar automáticamente los valores atípicos extremos basándose en datos" +" históricos." msgid "Weeks per year" msgstr "Semanas por año" diff --git a/i18n/lo.po b/i18n/lo.po index 644680db45..c62069921a 100644 --- a/i18n/lo.po +++ b/i18n/lo.po @@ -5,13 +5,14 @@ # Viktor Varland , 2021 # Thuy Nguyen , 2022 # Saysamone Sibounma, 2022 +# Namwan Chanthavisouk, 2024 # msgid "" msgstr "" "Project-Id-Version: i18next-conv\n" -"POT-Creation-Date: 2023-05-30T12:32:59.044Z\n" +"POT-Creation-Date: 2024-03-01T08:28:43.727Z\n" "PO-Revision-Date: 2019-06-25 18:46+0000\n" -"Last-Translator: Saysamone Sibounma, 2022\n" +"Last-Translator: Namwan Chanthavisouk, 2024\n" "Language-Team: Lao (https://app.transifex.com/hisp-uio/teams/100509/lo/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -49,11 +50,11 @@ msgid "Yes, leave" msgstr "" msgid "Add to {{axisName}}" -msgstr "" +msgstr "ເພີ່ມໃສ່ {{axisName}}" msgid "" -"'{{visualizationType}}' is intended to show a single data item. Only the " -"first item will be used and saved." +"'{{visualizationType}}' is intended to show a single item for this type of " +"dimension. Only the first item will be used and saved." msgstr "" msgid "" @@ -66,6 +67,11 @@ msgid "" "item will be used and saved." msgstr "" +msgid "" +"'Outlier table' shows values from data elements only. Only data elements " +"will be used and saved." +msgstr "" + msgid "Vertical" msgstr "" @@ -172,7 +178,7 @@ msgid "Not available for Scatter" msgstr "" msgid "Add Assigned Categories" -msgstr "" +msgstr "ເພີ່ມກຸ່ມທີ່ຖືກມອບໝາຍ" msgid "Swap with {{axisName}} axis" msgstr "" @@ -186,10 +192,13 @@ msgstr "" msgid "None selected" msgstr "" +msgid "None in use" +msgstr "" + msgid "Only '{{- name}}' in use" msgstr "" -msgid "Only '{{number}}' in use" +msgid "Only {{number}} in use" msgstr "" msgid "All items are selected" @@ -378,6 +387,9 @@ msgstr "​ລວມ​ເອົາ​ທັງ​ການ​ສະ​ສົມ msgid "Cumulative values" msgstr "" +msgid "Accumulate cell values along rows" +msgstr "" + msgid "Show data item icon" msgstr "" @@ -477,10 +489,10 @@ msgstr "ຫວ່າງຂໍ້ມູນ" msgid "Legend type" msgstr "" -msgid "Use pre-defined legend per data item" +msgid "Use pre-defined legend by data item" msgstr "" -msgid "Select a single legend for the entire visualization" +msgid "Select a legend" msgstr "" msgid "Legend changes background color" @@ -565,6 +577,14 @@ msgstr "" msgid "Outlier detection method" msgstr "" +msgid "Max results" +msgstr "" + +msgid "" +"The maximum number of outlier values to show in the table. Must be between " +"1-500." +msgstr "" + msgid "Organisation unit" msgstr "​ຫົວ​ໜ່ວຍ​ການ​ຈັດ​ຕັ້ງ" @@ -686,6 +706,12 @@ msgstr "" msgid "{{level}} level in {{orgunit}}" msgstr "" +msgid "Sort ascending by {{columnName}} and update" +msgstr "" + +msgid "Sort descending by {{columnName}} and update" +msgstr "" + msgid "Open as Map" msgstr "" @@ -693,6 +719,73 @@ msgid "" "Visually plot data on a world map. Data elements use separate map layers." msgstr "" +msgid "Category option combination" +msgstr "" + +msgid "Absolute deviation" +msgstr "" + +msgid "" +"A measure of the absolute difference between each data point and a central " +"value, usually the mean or median, providing a straightforward understanding" +" of dispersion in the dataset." +msgstr "" + +msgid "" +"A measure of how far a data point deviates from the median, using the median" +" absolute deviation instead of the standard deviation, making it robust " +"against outliers." +msgstr "" + +msgid "Median" +msgstr "" + +msgid "" +"The middle value in a dataset when the values are arranged in ascending or " +"descending order. It's a robust measure of central tendency that is less " +"affected by outliers compared to the mean." +msgstr "" + +msgid "Median absolute deviation" +msgstr "" + +msgid "" +"A robust measure of variability, found by calculating the median of the " +"absolute differences between each data point and the overall median. It's " +"less influenced by outliers compared to other measures like the standard " +"deviation." +msgstr "" + +msgid "Z-score" +msgstr "" + +msgid "" +"A measure of how many standard deviations a data point is from the mean of a" +" dataset, providing insight into how unusual or typical that data point is " +"relative to the rest of the distribution." +msgstr "" + +msgid "Mean" +msgstr "" + +msgid "Average of the value over time." +msgstr "" + +msgid "" +"A measure of how dispersed the data is in relation to the mean. Low standard" +" deviation indicates data are clustered tightly around the mean, and high " +"standard deviation indicates data are more spread out." +msgstr "" + +msgid "Minimum score threshold" +msgstr "" + +msgid "Maximum score threshold" +msgstr "" + +msgid "Not supported when using cumulative values" +msgstr "" + msgid "No data available" msgstr "" @@ -811,6 +904,20 @@ msgstr "" msgid "Something went wrong" msgstr "ມີບາງຢ່າງຜິດພາດ" +msgid "" +"There's a problem with the generated analytics. Contact a system " +"administrator." +msgstr "" + +msgid "There's a syntax problem with the analytics request." +msgstr "" + +msgid "No outliers found" +msgstr "" + +msgid "There were no outliers found for the selected data items and options." +msgstr "" + msgid "or" msgstr "or" @@ -973,6 +1080,9 @@ msgstr "" msgid "Totals" msgstr "ລວມທັງໝົດ" +msgid "Totals are not supported when using cumulative values" +msgstr "" + msgid "Vertical (y) axis {{axisId}}" msgstr "" @@ -1055,8 +1165,11 @@ msgid "Display a single value. Recommend relative period to show latest data." msgstr "" msgid "" -"View the relationship between two data items at a place or time. Recommended" -" for finding outliers." +"Compare the relationship between two data items across multiple places. " +"Recommended for visualizing outliers." +msgstr "" + +msgid "Automatically identify extreme outliers based on historical data." msgstr "" msgid "Weeks per year" diff --git a/i18n/nb.po b/i18n/nb.po index afede6d099..21b97f3ebf 100644 --- a/i18n/nb.po +++ b/i18n/nb.po @@ -3,13 +3,14 @@ # Caroline Hesthagen Holen , 2022 # Jan Henrik Øverland, 2024 # Karoline Tufte Lien , 2024 +# Martin , 2024 # msgid "" msgstr "" "Project-Id-Version: i18next-conv\n" "POT-Creation-Date: 2024-03-01T08:28:43.727Z\n" "PO-Revision-Date: 2019-06-25 18:46+0000\n" -"Last-Translator: Karoline Tufte Lien , 2024\n" +"Last-Translator: Martin , 2024\n" "Language-Team: Norwegian Bokmål (https://app.transifex.com/hisp-uio/teams/100509/nb/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -937,9 +938,11 @@ msgid "" "There's a problem with the generated analytics. Contact a system " "administrator." msgstr "" +"Det er et problem med den genererte analysen. Kontakt en " +"systemadministrator." msgid "There's a syntax problem with the analytics request." -msgstr "" +msgstr "Det er et syntaksproblem med analyseforespørselen." msgid "No outliers found" msgstr "" diff --git a/i18n/sv.po b/i18n/sv.po index fa9ba47fb5..c69601b0a1 100644 --- a/i18n/sv.po +++ b/i18n/sv.po @@ -3,13 +3,14 @@ # Philip Larsen Donnelly, 2020 # Viktor Varland , 2021 # Jason Pickering , 2024 +# Martin , 2024 # msgid "" msgstr "" "Project-Id-Version: i18next-conv\n" -"POT-Creation-Date: 2023-11-13T12:11:28.959Z\n" +"POT-Creation-Date: 2024-03-01T08:28:43.727Z\n" "PO-Revision-Date: 2019-06-25 18:46+0000\n" -"Last-Translator: Jason Pickering , 2024\n" +"Last-Translator: Martin , 2024\n" "Language-Team: Swedish (https://app.transifex.com/hisp-uio/teams/100509/sv/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -47,11 +48,11 @@ msgid "Yes, leave" msgstr "" msgid "Add to {{axisName}}" -msgstr "" +msgstr "Lägg till i {{axisName}}" msgid "" -"'{{visualizationType}}' is intended to show a single data item. Only the " -"first item will be used and saved." +"'{{visualizationType}}' is intended to show a single item for this type of " +"dimension. Only the first item will be used and saved." msgstr "" msgid "" @@ -64,6 +65,11 @@ msgid "" "item will be used and saved." msgstr "" +msgid "" +"'Outlier table' shows values from data elements only. Only data elements " +"will be used and saved." +msgstr "" + msgid "Vertical" msgstr "" @@ -152,7 +158,7 @@ msgid "Download" msgstr "Ladda ner" msgid "Hide" -msgstr "" +msgstr "Göm" msgid "All" msgstr "Alla" @@ -184,10 +190,13 @@ msgstr "" msgid "None selected" msgstr "" +msgid "None in use" +msgstr "" + msgid "Only '{{- name}}' in use" msgstr "" -msgid "Only '{{number}}' in use" +msgid "Only {{number}} in use" msgstr "" msgid "All items are selected" @@ -566,6 +575,14 @@ msgstr "" msgid "Outlier detection method" msgstr "" +msgid "Max results" +msgstr "" + +msgid "" +"The maximum number of outlier values to show in the table. Must be between " +"1-500." +msgstr "" + msgid "Organisation unit" msgstr "Organisationsenhet" @@ -687,6 +704,12 @@ msgstr "" msgid "{{level}} level in {{orgunit}}" msgstr "" +msgid "Sort ascending by {{columnName}} and update" +msgstr "" + +msgid "Sort descending by {{columnName}} and update" +msgstr "" + msgid "Open as Map" msgstr "" @@ -694,6 +717,70 @@ msgid "" "Visually plot data on a world map. Data elements use separate map layers." msgstr "" +msgid "Category option combination" +msgstr "" + +msgid "Absolute deviation" +msgstr "" + +msgid "" +"A measure of the absolute difference between each data point and a central " +"value, usually the mean or median, providing a straightforward understanding" +" of dispersion in the dataset." +msgstr "" + +msgid "" +"A measure of how far a data point deviates from the median, using the median" +" absolute deviation instead of the standard deviation, making it robust " +"against outliers." +msgstr "" + +msgid "Median" +msgstr "" + +msgid "" +"The middle value in a dataset when the values are arranged in ascending or " +"descending order. It's a robust measure of central tendency that is less " +"affected by outliers compared to the mean." +msgstr "" + +msgid "Median absolute deviation" +msgstr "" + +msgid "" +"A robust measure of variability, found by calculating the median of the " +"absolute differences between each data point and the overall median. It's " +"less influenced by outliers compared to other measures like the standard " +"deviation." +msgstr "" + +msgid "Z-score" +msgstr "" + +msgid "" +"A measure of how many standard deviations a data point is from the mean of a" +" dataset, providing insight into how unusual or typical that data point is " +"relative to the rest of the distribution." +msgstr "" + +msgid "Mean" +msgstr "" + +msgid "Average of the value over time." +msgstr "" + +msgid "" +"A measure of how dispersed the data is in relation to the mean. Low standard" +" deviation indicates data are clustered tightly around the mean, and high " +"standard deviation indicates data are more spread out." +msgstr "" + +msgid "Minimum score threshold" +msgstr "" + +msgid "Maximum score threshold" +msgstr "" + msgid "Not supported when using cumulative values" msgstr "" @@ -813,14 +900,22 @@ msgid "" msgstr "" msgid "Something went wrong" -msgstr "" +msgstr "Något gick fel" msgid "" "There's a problem with the generated analytics. Contact a system " "administrator." msgstr "" +"Ett fel uppstod med den genererade analysdatan. Kontakta en " +"systemadministratör." msgid "There's a syntax problem with the analytics request." +msgstr "Det finns ett problem med syntaxen i analytics request." + +msgid "No outliers found" +msgstr "" + +msgid "There were no outliers found for the selected data items and options." msgstr "" msgid "or" @@ -938,7 +1033,7 @@ msgid "User sub-x2-units" msgstr "Användarunder x2-enheter" msgid "Table title" -msgstr "" +msgstr "Tabelltitel" msgid "Parameters" msgstr "" @@ -968,10 +1063,10 @@ msgid "Chart style" msgstr "" msgid "Display" -msgstr "" +msgstr "Visa" msgid "Empty data" -msgstr "" +msgstr "Tom data" msgid "Horizontal (x) axis {{axisId}}" msgstr "" @@ -1004,13 +1099,13 @@ msgid "Data" msgstr "Data" msgid "Limit values" -msgstr "" +msgstr "Begränsningsvärden" msgid "Limit number of values" -msgstr "" +msgstr "Begränsa antal värden" msgid "Limit minimum/maximum values" -msgstr "" +msgstr "Begränsa min/max-värden" msgid "Outliers" msgstr "" @@ -1070,8 +1165,11 @@ msgid "Display a single value. Recommend relative period to show latest data." msgstr "" msgid "" -"View the relationship between two data items at a place or time. Recommended" -" for finding outliers." +"Compare the relationship between two data items across multiple places. " +"Recommended for visualizing outliers." +msgstr "" + +msgid "Automatically identify extreme outliers based on historical data." msgstr "" msgid "Weeks per year" diff --git a/package.json b/package.json index 2ff9121ea5..d0f56dd4f2 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "typescript": "^4.8.4" }, "dependencies": { - "@dhis2/analytics": "^26.6.5", + "@dhis2/analytics": "^26.6.8", "@dhis2/app-runtime": "^3.7.0", "@dhis2/app-runtime-adapter-d2": "^1.1.0", "@dhis2/app-service-datastore": "^1.0.0-beta.3", diff --git a/src/components/VisualizationPlugin/VisualizationPlugin.js b/src/components/VisualizationPlugin/VisualizationPlugin.js index eded3ef3bc..ef87dbac82 100644 --- a/src/components/VisualizationPlugin/VisualizationPlugin.js +++ b/src/components/VisualizationPlugin/VisualizationPlugin.js @@ -43,7 +43,7 @@ export const VisualizationPlugin = ({ onDrill, }) => { const engine = useDataEngine() - const [visualization, setVisualization] = useState(undefined) + const [visualization, setVisualization] = useState(null) const [ouLevels, setOuLevels] = useState(undefined) const [fetchResult, setFetchResult] = useState(null) const [contextualMenuRef, setContextualMenuRef] = useState(undefined) @@ -173,6 +173,7 @@ export const VisualizationPlugin = ({ useEffect(() => { setFetchResult(null) + setVisualization(null) // filter out disabled options const disabledOptions = getDisabledOptions({ @@ -186,8 +187,6 @@ export const VisualizationPlugin = ({ (option) => delete filteredVisualization[option] ) - setVisualization(filteredVisualization) - const doFetchAll = async () => { const { responses, extraOptions } = await doFetchData( filteredVisualization, @@ -254,6 +253,7 @@ export const VisualizationPlugin = ({ extraOptions, }) setShowLegendKey(filteredVisualization.legend?.showKey) + onLoadingComplete() } @@ -264,7 +264,15 @@ export const VisualizationPlugin = ({ /* eslint-disable-next-line react-hooks/exhaustive-deps */ }, [originalVisualization, filters, forDashboard]) - if (!fetchResult || !ouLevels) { + useEffect(() => { + if (fetchResult?.visualization && ouLevels) { + setVisualization( + convertOuLevelsToUids(ouLevels, fetchResult.visualization) + ) + } + }, [fetchResult?.visualization, ouLevels]) + + if (!fetchResult || !visualization || !ouLevels) { return null } @@ -406,10 +414,7 @@ export const VisualizationPlugin = ({ ) { return (