Skip to content
Merged
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
30 changes: 27 additions & 3 deletions web-ui/src/pages/SkillReportPage.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import React, { useContext, useState } from 'react';
import React, { useContext, useRef, useState } from 'react';

import { Button, TextField } from '@mui/material';
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor import reordering.

import Autocomplete from '@mui/material/Autocomplete';

import { AppContext } from '../context/AppContext';
import { reportSkills } from '../api/memberskill.js';
Expand All @@ -11,8 +14,7 @@ import {
selectCurrentMemberIds
} from '../context/selectors';

import { Button, TextField } from '@mui/material';
import Autocomplete from '@mui/material/Autocomplete';
import { useQueryParameters } from '../helpers/query-parameters';

import './SkillReportPage.css';

Expand All @@ -27,6 +29,28 @@ const SkillReportPage = props => {
const [editedSearchRequest, setEditedSearchRequest] =
useState(searchRequestDTO);

const processedQPs = useRef(false);
useQueryParameters(
[
{
name: 'skills',
default: [],
value: searchSkills,
setter(ids) {
const searchSkills = ids.map(id =>
skills.find(skill => skill.id === id)
);
setSearchSkills(searchSkills);
},
toQP() {
return searchSkills.map(skill => skill.id).join(',');
}
}
],
[skills],
processedQPs
);

const handleSearch = async searchRequestDTO => {
let res = await reportSkills(searchRequestDTO, csrf);
let memberSkillsFound;
Expand Down