Skip to content

Commit

Permalink
fix: hide channels filter from index-page (#518)
Browse files Browse the repository at this point in the history
* fix: hide channels filter

* refactor: change channels feature to positive
  • Loading branch information
Birkbjo authored Jun 22, 2021
1 parent 13ccff9 commit 2eb0a91
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
3 changes: 3 additions & 0 deletions client/default.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,8 @@ module.exports = {
canary: 'Canary',
},
defaultAppChannel: 'stable',
feature: {
channels: false,
},
},
}
3 changes: 2 additions & 1 deletion client/src/pages/Apps/Apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const {
appChannelToDisplayName,
appTypeToDisplayName,
dhisVersions,
feature,
} = config.ui

const defaultChannelsFilter = new Set([defaultAppChannel])
Expand Down Expand Up @@ -66,7 +67,7 @@ const Apps = () => {

const params = useMemo(
() => ({
channels,
channels: feature.channels ? channels : undefined,
types,
dhis_version: dhisVersion,
query,
Expand Down
19 changes: 11 additions & 8 deletions client/src/pages/Apps/Filters/Filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
} from '@dhis2/ui'
import PropTypes from 'prop-types'
import styles from './Filters.module.css'
import config from 'config'

const CheckboxList = ({ checkboxes, selected, onChange }) =>
Object.entries(checkboxes).map(([value, label]) => (
Expand Down Expand Up @@ -67,14 +68,16 @@ const Filters = ({
onChange={onTypesFilterChange}
/>
</div>
<div className={styles.filterWrapper}>
<h3 className={styles.filterName}>Release Channels</h3>
<CheckboxList
checkboxes={channels}
selected={channelsFilter}
onChange={onChannelsFilterChange}
/>
</div>
{config.ui.feature.channels && (
<div className={styles.filterWrapper}>
<h3 className={styles.filterName}>Release Channels</h3>
<CheckboxList
checkboxes={channels}
selected={channelsFilter}
onChange={onChannelsFilterChange}
/>
</div>
)}
<div className={styles.filterWrapper}>
<h3 className={styles.filterName}>DHIS2 Version</h3>
<SingleSelect
Expand Down

0 comments on commit 2eb0a91

Please sign in to comment.