diff --git a/next/components/atoms/ObservationLevelTable.js b/next/components/atoms/ObservationLevelTable.js index f1f04f21..8d2bda79 100644 --- a/next/components/atoms/ObservationLevelTable.js +++ b/next/components/atoms/ObservationLevelTable.js @@ -18,16 +18,25 @@ export default function ObservationLevel({ resource }) { const headers = [t('observationLevelTable.entityHeader'), t('observationLevelTable.columnsHeader')]; - let array = [] - const keys = Object.keys(resource?.observationLevels) + function sortElements(a, b) { + if (a.order < b.order) { + return -1; + } + if (a.order > b.order) { + return 1; + } + return 0; + } - keys.forEach((elm) => { - const value = resource?.observationLevels[elm] + let array = []; + const keys = Object.keys(resource?.observationLevels); + const sortedLevels = Object.values(resource?.observationLevels).sort(sortElements); + sortedLevels.forEach((value) => { const valueEntity = () => { - if(value.entity[`name${capitalize(locale)}`]) return value.entity[`name${capitalize(locale)}`] - if(value.entity.name) return value.entity.name - return t('observationLevelTable.notProvided') + if(value.entity[`name${capitalize(locale)}`]) return value.entity[`name${capitalize(locale)}`]; + if(value.entity.name) return value.entity.name; + return t('observationLevelTable.notProvided'); } const valueColumns = () => { diff --git a/next/pages/api/rawDataSources/getRawDataSource.js b/next/pages/api/rawDataSources/getRawDataSource.js index cadc8bdb..4b9fc868 100644 --- a/next/pages/api/rawDataSources/getRawDataSource.js +++ b/next/pages/api/rawDataSources/getRawDataSource.js @@ -61,6 +61,7 @@ async function getRawDataSource(id, locale = 'pt') { edges { node { _id + order columns { edges { node { diff --git a/next/pages/api/tables/getTable.js b/next/pages/api/tables/getTable.js index daf68df4..ead6eb75 100644 --- a/next/pages/api/tables/getTable.js +++ b/next/pages/api/tables/getTable.js @@ -46,6 +46,11 @@ async function getTable(id, locale='pt') { } } version + status { + _id + slug + } + isDeprecated temporalCoverage spatialCoverage fullTemporalCoverage @@ -107,6 +112,7 @@ async function getTable(id, locale='pt') { edges { node { _id + order columns { edges { node {