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
10 changes: 8 additions & 2 deletions src/api/dimensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ const recommendedDimensionsQuery = {

export const dataItemsQuery = {
resource: 'dataItems',
params: ({ nameProp, filter, searchTerm, page }) => {
let fields = `id,${nameProp}~rename(name),dimensionItemType,expression,optionSetId`
params: ({ nameProp, filter, searchTerm, page, supportsOptionSetId }) => {
let fields = `id,${nameProp}~rename(name),dimensionItemType,expression${
supportsOptionSetId ? ',optionSetId' : ''
}`
const filters = []

// TODO: Extract all of this logic out of the query?
Expand Down Expand Up @@ -289,6 +291,7 @@ export const apiFetchOptions = ({
filter,
searchTerm,
page,
supportsOptionSetId,
}) => {
switch (filter?.dataType) {
case DIMENSION_TYPE_INDICATOR: {
Expand Down Expand Up @@ -335,6 +338,7 @@ export const apiFetchOptions = ({
filter,
searchTerm,
page,
supportsOptionSetId,
})
}
}
Expand Down Expand Up @@ -433,6 +437,7 @@ const fetchDataItems = async ({
filter,
searchTerm,
page,
supportsOptionSetId,
}) => {
const dataItemsData = await dataEngine.query(
{ dataItems: dataItemsQuery },
Expand All @@ -442,6 +447,7 @@ const fetchDataItems = async ({
filter,
searchTerm,
page,
supportsOptionSetId,
},
onError,
}
Expand Down
2 changes: 2 additions & 0 deletions src/components/DataDimension/DataDimension.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const DataDimension = ({
const supportsEDI = dataTypes
.map(({ id }) => id)
.includes(DIMENSION_TYPE_EXPRESSION_DIMENSION_ITEM)
const supportsOptionSetId = serverVersion.minor >= 42

const [currentCalculation, setCurrentCalculation] = useState()
const [currentDataItem, setCurrentDataItem] = useState()
Expand Down Expand Up @@ -126,6 +127,7 @@ const DataDimension = ({
dataTypes={dataTypes}
itemsRef={itemsRef}
supportsEDI={supportsEDI}
supportsOptionSetId={supportsOptionSetId}
onEDISave={onCalculationSave}
isOptionViewMode={Boolean(currentDataItem)}
currentCalculation={currentCalculation}
Expand Down
3 changes: 3 additions & 0 deletions src/components/DataDimension/ItemSelector/ItemSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ const ItemSelector = ({
onEditClick,
isOptionViewMode,
supportsEDI,
supportsOptionSetId,
height = TRANSFER_HEIGHT,
heightCalculation,
maxSelections,
Expand Down Expand Up @@ -176,6 +177,7 @@ const ItemSelector = ({
page,
filter: state.filter,
searchTerm: state.searchTerm,
supportsOptionSetId,
})
const newOptions = []
result.dimensionItems?.forEach((item) => {
Expand Down Expand Up @@ -492,6 +494,7 @@ ItemSelector.propTypes = {
setCurrentCalculation: PropTypes.func,
setInfoDataItem: PropTypes.func,
supportsEDI: PropTypes.bool,
supportsOptionSetId: PropTypes.bool,
onEDISave: PropTypes.func,
onEditClick: PropTypes.func,
}
Expand Down
Loading