From 6a35c38c35be891616da62f00ded2a8efe277f27 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Nov 2024 20:11:42 +0000 Subject: [PATCH 1/6] Bump happy-dom from 15.10.1 to 15.10.2 in /web-ui Bumps [happy-dom](https://github.com/capricorn86/happy-dom) from 15.10.1 to 15.10.2. - [Release notes](https://github.com/capricorn86/happy-dom/releases) - [Commits](https://github.com/capricorn86/happy-dom/compare/v15.10.1...v15.10.2) --- updated-dependencies: - dependency-name: happy-dom dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- web-ui/package.json | 2 +- web-ui/yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/web-ui/package.json b/web-ui/package.json index 4d178dd9ff..1aaa116a97 100644 --- a/web-ui/package.json +++ b/web-ui/package.json @@ -89,7 +89,7 @@ "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-vitest": "^0.5.4", "globals": "^15.0.0", - "happy-dom": "^15.10.1", + "happy-dom": "^15.10.2", "jest-fetch-mock": "^3.0.3", "jsdom": "^24.0.0", "msw": "^2.2.13", diff --git a/web-ui/yarn.lock b/web-ui/yarn.lock index 20f3a05566..bf909b472e 100644 --- a/web-ui/yarn.lock +++ b/web-ui/yarn.lock @@ -3797,10 +3797,10 @@ graphql@^16.8.1: resolved "https://registry.yarnpkg.com/graphql/-/graphql-16.9.0.tgz#1c310e63f16a49ce1fbb230bd0a000e99f6f115f" integrity sha512-GGTKBX4SD7Wdb8mqeDLni2oaRGYQWjWHGKPQ24ZMnUtKfcsVoiv4uX8+LJr1K6U5VW2Lu1BwJnj7uiori0YtRw== -happy-dom@^15.10.1: - version "15.10.1" - resolved "https://registry.yarnpkg.com/happy-dom/-/happy-dom-15.10.1.tgz#db49321a7af97d8c18c45622de2817b382ac7595" - integrity sha512-FuGnj/qIB4QnBL6fWmD7Wnh6STxevLgOVWB6+nopDGgWG1+t9CXkNB2ldZ+iqwD2UKxD2D0SU8el8A6AX6Q1+g== +happy-dom@^15.10.2: + version "15.10.2" + resolved "https://registry.yarnpkg.com/happy-dom/-/happy-dom-15.10.2.tgz#14ae6652d1a80d2611e3f5832cb61ab5e2d1b539" + integrity sha512-NbA5XrSovenJIIcfixCREX3ZnV7yHP4phhbfuxxf4CPn+LZpz/jIM9EqJ2DrPwgVDSMoAKH3pZwQvkbsSiCrUw== dependencies: entities "^4.5.0" webidl-conversions "^7.0.0" From dd61ed58f6eedfe254aab730e94bc38b9136a14d Mon Sep 17 00:00:00 2001 From: Chad Elliott Date: Wed, 6 Nov 2024 14:31:16 -0600 Subject: [PATCH 2/6] Remove the ability to delete a team. --- .../team-results/TeamSummaryCard.jsx | 55 +------------------ 1 file changed, 2 insertions(+), 53 deletions(-) diff --git a/web-ui/src/components/team-results/TeamSummaryCard.jsx b/web-ui/src/components/team-results/TeamSummaryCard.jsx index 7e7e0e3724..c60abe631a 100644 --- a/web-ui/src/components/team-results/TeamSummaryCard.jsx +++ b/web-ui/src/components/team-results/TeamSummaryCard.jsx @@ -19,7 +19,7 @@ import { Tooltip } from '@mui/material'; import PropTypes from 'prop-types'; -import { deleteTeam, updateTeam } from '../../api/team.js'; +import { updateTeam } from '../../api/team.js'; import SplitButton from '../split-button/SplitButton'; const PREFIX = 'TeamSummaryCard'; @@ -59,7 +59,6 @@ const displayName = 'TeamSummaryCard'; const TeamSummaryCard = ({ team, index, onTeamSelect, selectedTeamId }) => { const { state, dispatch } = useContext(AppContext); const { teams, userProfile, csrf } = state; - const [openDelete, setOpenDelete] = useState(false); const [openKudos, setOpenKudos] = useState(false); // const [selectedTeam, setSelectedTeam] = useState(null); const [tooltipIsOpen, setTooltipIsOpen] = useState(false); @@ -81,45 +80,16 @@ const TeamSummaryCard = ({ team, index, onTeamSelect, selectedTeamId }) => { ? false : leads.some(lead => lead.memberId === userProfile.memberProfile.id); - const handleOpenDeleteConfirmation = () => setOpenDelete(true); const handleOpenKudos = () => setOpenKudos(true); - - const handleCloseDeleteConfirmation = () => setOpenDelete(false); const handleCloseKudos = () => setOpenKudos(false); - const teamId = team?.id; - const deleteATeam = useCallback(async () => { - if (teamId && csrf) { - const result = await deleteTeam(teamId, csrf); - if (result && result.payload && result.payload.status === 200) { - window.snackDispatch({ - type: UPDATE_TOAST, - payload: { - severity: 'success', - toast: 'Team deleted' - } - }); - let newTeams = teams.filter(team => { - return team.id !== teamId; - }); - dispatch({ - type: UPDATE_TEAMS, - payload: newTeams - }); - } - } - }, [teamId, csrf, dispatch, teams]); - - const options = - isAdmin || isTeamLead ? ['Edit Team', 'Give Kudos', 'Delete Team'] : ['Edit Team', 'Give Kudos']; + const options = ['Edit Team', 'Give Kudos']; const handleAction = (e, index) => { if (index === 0) { onTeamSelect(team.id); } else if (index === 1) { handleOpenKudos(); - } else if (index === 2) { - handleOpenDeleteConfirmation(); } }; @@ -195,27 +165,6 @@ const TeamSummaryCard = ({ team, index, onTeamSelect, selectedTeamId }) => { {(isAdmin || isTeamLead) && ( <> - - Delete team? - - - Are you sure you want to delete the team? - - - - - - - Date: Wed, 6 Nov 2024 14:31:41 -0600 Subject: [PATCH 3/6] Added a switch to filter inactive teams (default). --- .../components/team-results/TeamResults.jsx | 48 ++++++++++++------- 1 file changed, 31 insertions(+), 17 deletions(-) diff --git a/web-ui/src/components/team-results/TeamResults.jsx b/web-ui/src/components/team-results/TeamResults.jsx index 427ac99695..bf6df701e7 100644 --- a/web-ui/src/components/team-results/TeamResults.jsx +++ b/web-ui/src/components/team-results/TeamResults.jsx @@ -8,7 +8,7 @@ import { } from '../../context/selectors'; import TeamsActions from './TeamsActions'; import PropTypes from 'prop-types'; -import { TextField } from '@mui/material'; +import { FormControlLabel, Switch, TextField } from '@mui/material'; import './TeamResults.css'; import SkeletonLoader from '../skeleton_loader/SkeletonLoader'; import { useQueryParameters } from '../../helpers/query-parameters'; @@ -40,22 +40,11 @@ const TeamResults = () => { const { state } = useContext(AppContext); const loading = selectTeamsLoading(state); const [addingTeam, setAddingTeam] = useState(false); + const [activeTeams, setActiveTeams] = useState(true); const [searchText, setSearchText] = useState(''); const [selectedTeamId, setSelectedTeamId] = useState(''); const teams = selectNormalizedTeams(state, searchText); - const teamCards = teams.map((team, index) => { - return ( - - ); - }); - useQueryParameters([ { name: 'addNew', @@ -89,16 +78,41 @@ const TeamResults = () => { setSearchText(e.target.value); }} /> - +
+ + { + const { checked } = event.target; + setActiveTeams(checked); + }} + /> + } + label="Active Teams Only" + /> +
{loading ? Array.from({ length: 20 }).map((_, index) => ( )) - : teams?.length && !loading - ? teamCards - : null} + : teams.filter((team) => !activeTeams || + (activeTeams && team.active)) + .map((team, index) => { + return ( + + ); + }) + }
); From a76cffe5adc6b12a8602ec2f8c363fd000fb9d42 Mon Sep 17 00:00:00 2001 From: Chad Elliott Date: Wed, 6 Nov 2024 14:32:18 -0600 Subject: [PATCH 4/6] Use a check box to mark guilds active/inactive to be consistent with the existing team edit functionality. --- .../guild-results/EditGuildModal.jsx | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/web-ui/src/components/guild-results/EditGuildModal.jsx b/web-ui/src/components/guild-results/EditGuildModal.jsx index 9e8ecebec2..79dfeef909 100644 --- a/web-ui/src/components/guild-results/EditGuildModal.jsx +++ b/web-ui/src/components/guild-results/EditGuildModal.jsx @@ -11,7 +11,8 @@ import { FormControlLabel, Modal, Switch, - TextField + TextField, + Checkbox, } from '@mui/material'; import Autocomplete from '@mui/material/Autocomplete'; import './EditGuildModal.css'; @@ -166,18 +167,18 @@ const EditGuildModal = ({ guild = {}, open, onSave, onClose, headerText }) => { value={editedGuild.name ? editedGuild.name : ''} onChange={e => setGuild({ ...editedGuild, name: e.target.value })} /> - {guild.id && { - const { checked } = event.target; - setGuild({ ...editedGuild, active: checked }); - }} - /> - } + {guild.id && (<>} + variant="outlined" + className="halfWidth" + checked={editedGuild.active} + onChange={event => { + const { checked } = event.target; + setGuild({ ...editedGuild, active: checked }); + }} + /> Active + )}
Date: Wed, 6 Nov 2024 14:39:42 -0600 Subject: [PATCH 5/6] For some reason, using just editedGuild.active in the checked prop for Checkbox did not work. --- web-ui/src/components/guild-results/EditGuildModal.jsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web-ui/src/components/guild-results/EditGuildModal.jsx b/web-ui/src/components/guild-results/EditGuildModal.jsx index 79dfeef909..953c5ccfb1 100644 --- a/web-ui/src/components/guild-results/EditGuildModal.jsx +++ b/web-ui/src/components/guild-results/EditGuildModal.jsx @@ -167,12 +167,13 @@ const EditGuildModal = ({ guild = {}, open, onSave, onClose, headerText }) => { value={editedGuild.name ? editedGuild.name : ''} onChange={e => setGuild({ ...editedGuild, name: e.target.value })} /> - {guild.id && (<> + { const { checked } = event.target; setGuild({ ...editedGuild, active: checked }); From fe5ba4915dd7ca0897d29c093c1a719f7d3f2127 Mon Sep 17 00:00:00 2001 From: Chad Elliott Date: Wed, 6 Nov 2024 14:45:14 -0600 Subject: [PATCH 6/6] Updated to reflect active teams switch. --- .../__snapshots__/TeamResults.test.jsx.snap | 142 +++++++++++++----- 1 file changed, 106 insertions(+), 36 deletions(-) diff --git a/web-ui/src/components/team-results/__snapshots__/TeamResults.test.jsx.snap b/web-ui/src/components/team-results/__snapshots__/TeamResults.test.jsx.snap index dc34d62844..85eb1e6ed8 100644 --- a/web-ui/src/components/team-results/__snapshots__/TeamResults.test.jsx.snap +++ b/web-ui/src/components/team-results/__snapshots__/TeamResults.test.jsx.snap @@ -47,31 +47,66 @@ exports[`renders correctly 1`] = `
- +
+
- +
+