Skip to content

Commit

Permalink
added checkbox for tcReady searching.
Browse files Browse the repository at this point in the history
  • Loading branch information
PhotoNomad0 committed Dec 10, 2024
1 parent 050159a commit 7503e44
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/js/actions/SourceContentUpdatesActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -436,9 +436,9 @@ export const deletePreReleaseResources = (resourcesFolder) => ((dispatch, getSta
* @param {function} closeSourceContentDialog - Hacky workaround to close the
* source content dialog in the AppMenu state.
* @param {boolean} preRelease - if true include pre-release content
* @param {boolean} notTcReady - if true include content not tcReady
* @param {boolean} tcReady - if true include only tcReady content
*/
export function getListOfSourceContentToUpdate(closeSourceContentDialog, preRelease = false, notTcReady = false) {
export function getListOfSourceContentToUpdate(closeSourceContentDialog, preRelease = false, tcReady = true) {
return (async (dispatch, getState) => {
const translate = getTranslate(getState());
dispatch(resetSourceContentUpdatesReducer());
Expand All @@ -454,7 +454,7 @@ export function getListOfSourceContentToUpdate(closeSourceContentDialog, preRele
DCS_BASE_URL,
};

if (!notTcReady) {
if (tcReady) {
config.ignoreDoor43Catalog = true;
config.topic = 'tc-ready';
}
Expand Down
27 changes: 24 additions & 3 deletions src/js/components/dialogComponents/SourceContentUpdateDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ class ContentUpdateDialog extends React.Component {
selectedLanguageResources,
preRelease,
togglePreRelease,
tcReady,
toggleTcReady,
deletePreReleasePrompt,
} = this.props;

Expand All @@ -95,6 +97,15 @@ class ContentUpdateDialog extends React.Component {
const allChecked =
JSON.stringify(availableLanguageIds) === JSON.stringify(languagesSelectedList);

const tcReadyStyle = {
...styles.checkboxContainer,
marginBottom: 0,
marginTop: '20px',
marginLeft: '20%',
width: '70%',
fontSize: '16px',
};

return (
<BaseDialog
open={open}
Expand All @@ -111,9 +122,17 @@ class ContentUpdateDialog extends React.Component {
<div style={styles.content}>
<div>
<h4 style={styles.header}>
{translate(
'updates.select_the_gateway_language_content_to_download',
)}
{translate('updates.select_the_gateway_language_content_to_download')}
<div style={tcReadyStyle}>
<Checkbox
label={translate('updates.show_recommended_resources')}
checked={tcReady}
onCheck={toggleTcReady}
style={styles.checkbox}
iconStyle={styles.checkboxIconStyle}
labelStyle={styles.boldCheckboxLabelStyle}
/>
</div>
</h4>
<Divider />
</div>
Expand Down Expand Up @@ -203,6 +222,8 @@ ContentUpdateDialog.propTypes = {
preRelease: PropTypes.bool.isRequired,
togglePreRelease: PropTypes.func.isRequired,
deletePreReleasePrompt: PropTypes.func.isRequired,
tcReady: PropTypes.bool.isRequired,
toggleTcReady: PropTypes.func.isRequired,
};

export default ContentUpdateDialog;
18 changes: 15 additions & 3 deletions src/js/containers/SourceContentUpdatesDialogContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,17 @@ export function getResourceDownloadsAlertMessage(translate, errorStr= '', feedba
class ContentUpdatesDialogContainer extends React.Component {
constructor(props) {
super(props);
this.state = { languages: {}, preRelease: false };
this.state = {
languages: {}, preRelease: false, tcReady: true,
};
this._handleClose = this._handleClose.bind(this);
this._startContentUpdateCheck = this._startContentUpdateCheck.bind(this);
this._handleDownload = this._handleDownload.bind(this);
this.handleSelectAll = this.handleSelectAll.bind(this);
this._handleListItemSelection = this._handleListItemSelection.bind(this);
this.onSubitemSelection = this.onSubitemSelection.bind(this);
this.togglePreRelease = this.togglePreRelease.bind(this);
this.toggleTcReady = this.toggleTcReady.bind(this);
this.handleDeletePreRelease = this.handleDeletePreRelease.bind(this);
}

Expand Down Expand Up @@ -149,10 +152,17 @@ class ContentUpdatesDialogContainer extends React.Component {
this.props.deletePreReleasePrompt(this.props.translate, this._handleClose);
}

toggleTcReady() {
const { getListOfSourceContentToUpdate, onClose } = this.props;
const tcReady = !this.state.tcReady;
getListOfSourceContentToUpdate(onClose, this.state.preRelease, tcReady);
this.setState({ tcReady });
}

togglePreRelease() {
const { getListOfSourceContentToUpdate, onClose } = this.props;
const preRelease = !this.state.preRelease;
getListOfSourceContentToUpdate(onClose, preRelease);
getListOfSourceContentToUpdate(onClose, preRelease, this.state.tcReady);
this.setState({ preRelease });
}

Expand Down Expand Up @@ -205,7 +215,7 @@ class ContentUpdatesDialogContainer extends React.Component {

_startContentUpdateCheck() {
const { getListOfSourceContentToUpdate, onClose } = this.props;
getListOfSourceContentToUpdate(onClose, this.state.preRelease);
getListOfSourceContentToUpdate(onClose, this.state.preRelease, this.state.tcReady);
}

_handleDownload() {
Expand Down Expand Up @@ -237,6 +247,8 @@ class ContentUpdatesDialogContainer extends React.Component {
preRelease={this.state.preRelease}
togglePreRelease={this.togglePreRelease}
deletePreReleasePrompt={this.handleDeletePreRelease}
tcReady={this.state.tcReady}
toggleTcReady={this.toggleTcReady}
/>
</div>
);
Expand Down
1 change: 1 addition & 0 deletions src/locale/English-en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
"source_label": "Source:",
"local_timestamp": "Local:",
"online_timestamp": "Online:",
"show_recommended_resources": "Show Only Recommended Resources",
"update_error_reason_parse": "parse error",
"update_error_reason_download": "download error",
"update_error_reason_missing_dependency": "missing dependency"
Expand Down

0 comments on commit 7503e44

Please sign in to comment.