Skip to content

Commit

Permalink
fix(ui): Restore download of decided affiliations
Browse files Browse the repository at this point in the history
  • Loading branch information
annelhote committed Feb 12, 2024
1 parent 9270a0d commit 3867ade
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion client/src/components/button-dropdown/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import PropTypes from 'prop-types';

import Button from '../button';
import { export2Csv, export2FosmCsv, export2jsonl } from '../../utils/file';
import { export2Csv, export2FosmCsv, export2jsonl } from '../../utils/files';

import './index.scss';

Expand Down
4 changes: 2 additions & 2 deletions client/src/pages/actions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Tooltip } from 'react-tooltip';

import Button from '../components/button';
import ButtonDropdown from '../components/button-dropdown';
import { export2json, importJson } from '../utils/file';
import { export2json, importJson } from '../utils/files';
import { status } from '../config';

export default function Actions({
Expand All @@ -31,7 +31,7 @@ export default function Actions({
data-tooltip-id="save-affiliations-button"
disabled={!decidedAffiliations.length}
icon="ri-save-line"
onClick={() => export2json({ decidedAffiliations })}
onClick={() => export2json({ decidedAffiliations, label: 'affiliations', searchParams })}
size="sm"
>
Save decided affiliations
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/datasetsTab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function DatasetsTab({ datasets, publishers, selectedDatasets, se
const [filteredAffiliationName, setFilteredAffiliationName] = useState('');
const [filteredDatasets, setFilteredDatasets] = useState([]);
const [filteredDatasources, setFilteredDatasources] = useState(datasources.map((datasource) => datasource.key));
const [filteredStatus, setFilteredStatus] = useState([status.tobedecided.id]);
const [filteredStatus, setFilteredStatus] = useState([status.validated.id]);
const [filteredPublishers, setFilteredPublishers] = useState([]);
const [filteredTypes, setFilteredTypes] = useState([]);
const [filteredYears, setFilteredYears] = useState([]);
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/filters.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { useSearchParams } from 'react-router-dom';
import TagInput from '../components/tag-input';

const START_YEAR = 2010;
const years = [...Array(new Date().getFullYear() - START_YEAR).keys()].map((item) => (item + START_YEAR).toString());
const years = [...Array(new Date().getFullYear() - START_YEAR).keys()].map((year) => (year + START_YEAR).toString()).map((year) => ({ label: year, value: year }));

export default function Filters({ sendQuery }) {
const [searchParams, setSearchParams] = useSearchParams();
Expand Down
3 changes: 3 additions & 0 deletions client/src/utils/file.js → client/src/utils/files.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ const hashCode = (str) => {
};

const getFileName = ({ extension, label, searchParams }) => {
console.log(extension);
console.log(label);
console.log(searchParams);
let fileName = 'works_finder';
fileName += label ? `_${label}` : '';
fileName += `_${hashCode(searchParams.get('affiliations'))}`;
Expand Down

0 comments on commit 3867ade

Please sign in to comment.