Skip to content

Commit

Permalink
Merge branch 'dev' into fix/item-copies-rendering-issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jenniferarnesen authored Mar 20, 2024
2 parents d4b3f4d + 854a653 commit 9396429
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 25 deletions.
18 changes: 9 additions & 9 deletions cypress/integration/edit/edit_dashboard.feature
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ Feature: Creating, editing and deleting dashboard
Then the dashboard is not starred


@mutating
Scenario: I toggle show description
Given I open existing dashboard
# And the description is not shown
And the dashboard description is not displayed
When I click to show description
Then the dashboard description is displayed
When I click to hide the description
Then the dashboard description is not displayed
# @mutating
# Scenario: I toggle show description
# Given I open existing dashboard
# # And the description is not shown
# And the dashboard description is not displayed
# When I click to show description
# Then the dashboard description is displayed
# When I click to hide the description
# Then the dashboard description is not displayed

# FIXME
# @nonmutating
Expand Down
10 changes: 8 additions & 2 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2024-02-26T14:42:02.563Z\n"
"PO-Revision-Date: 2024-02-26T14:42:02.563Z\n"
"POT-Creation-Date: 2024-03-19T12:31:03.302Z\n"
"PO-Revision-Date: 2024-03-19T12:31:03.302Z\n"

msgid "Untitled dashboard"
msgstr "Untitled dashboard"
Expand Down Expand Up @@ -71,6 +71,12 @@ msgstr "Filters are not applied to line list dashboard items"
msgid "Filters not applied"
msgstr "Filters not applied"

msgid "Only Period and Organisation unit filters can be applied to this item"
msgstr "Only Period and Organisation unit filters can be applied to this item"

msgid "Some filters not applied"
msgstr "Some filters not applied"

msgid "There was a problem loading this dashboard item"
msgstr "There was a problem loading this dashboard item"

Expand Down
54 changes: 40 additions & 14 deletions src/components/Item/VisualizationItem/Item.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { VIS_TYPE_OUTLIER_TABLE } from '@dhis2/analytics'
import i18n from '@dhis2/d2-i18n'
import { Tag, Tooltip } from '@dhis2/ui'
import PropTypes from 'prop-types'
Expand All @@ -20,7 +21,9 @@ import {
import {
getDataStatisticsName,
getItemTypeForVis,
CHART,
EVENT_VISUALIZATION,
VISUALIZATION,
} from '../../../modules/itemTypes.js'
import { sGetIsEditing } from '../../../reducers/editDashboard.js'
import { sGetItemActiveType } from '../../../reducers/itemActiveTypes.js'
Expand Down Expand Up @@ -207,19 +210,42 @@ class Item extends Component {
/>
) : null

const tags =
isViewMode(dashboardMode) &&
Object.keys(itemFilters).length &&
!showNoFiltersOverlay &&
activeType === EVENT_VISUALIZATION ? (
<Tooltip
content={i18n.t(
'Filters are not applied to line list dashboard items'
)}
>
<Tag negative>{i18n.t('Filters not applied')}</Tag>
</Tooltip>
) : null
const getTags = (item) => {
if (isViewMode(dashboardMode) && Object.keys(itemFilters).length) {
switch (activeType) {
case EVENT_VISUALIZATION: {
return !showNoFiltersOverlay ? (
<Tooltip
content={i18n.t(
'Filters are not applied to line list dashboard items'
)}
>
<Tag negative>
{i18n.t('Filters not applied')}
</Tag>
</Tooltip>
) : null
}
case CHART:
case VISUALIZATION: {
return item.visualization.type ===
VIS_TYPE_OUTLIER_TABLE ? (
<Tooltip
content={i18n.t(
'Only Period and Organisation unit filters can be applied to this item'
)}
>
<Tag negative>
{i18n.t('Some filters not applied')}
</Tag>
</Tooltip>
) : null
}
}
}

return null
}

return (
<>
Expand All @@ -230,7 +256,7 @@ class Item extends Component {
ref={this.headerRef}
dashboardMode={dashboardMode}
isShortened={item.shortened}
tags={tags}
tags={getTags(item)}
/>
<FatalErrorBoundary
message={i18n.t(
Expand Down

0 comments on commit 9396429

Please sign in to comment.