Skip to content

Commit

Permalink
added product url param to required signoffs page (#3030)
Browse files Browse the repository at this point in the history
* added product url param to required signoffs page

* fixed lint issues
  • Loading branch information
nazarenegena authored Oct 27, 2023
1 parent 994bd6a commit ca55f9a
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions ui/src/views/RequiredSignoffs/ListSignoffs/index.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { Fragment, useEffect, useState } from 'react';
import { capitalCase } from 'change-case';
import classNames from 'classnames';
import { stringify, parse } from 'qs';
import { clone, view, lensPath } from 'ramda';
import Spinner from '@mozilla-frontend-infra/components/Spinner';
import { makeStyles } from '@material-ui/styles';
Expand Down Expand Up @@ -61,11 +62,15 @@ const useStyles = makeStyles(theme => ({
},
}));

function ListSignoffs({ user }) {
function ListSignoffs({ user, ...props }) {
const username = user.email;
const classes = useStyles();
const { search } = props.location;
const query = parse(search.slice(1));
const [requiredSignoffs, setRequiredSignoffs] = useState(null);
const [product, setProduct] = useState('Firefox');
const [product, setProduct] = useState(
query.product ? query.product : 'Firefox'
);
const [roles, setRoles] = useState([]);
const [signoffRole, setSignoffRole] = useState('');
const [dialogState, setDialogState] = useState(DIALOG_ACTION_INITIAL_STATE);
Expand All @@ -82,7 +87,18 @@ function ListSignoffs({ user }) {
rolesAction.error ||
// If there's more than one role, this error is shown inside of the dialog
(roles.length === 1 && signoffAction.error);
const handleFilterChange = ({ target: { value } }) => setProduct(value);
const handleFilterChange = ({ target: { value } }) => {
const qs = {
...query,
product: value,
};

props.history.push(
`/required-signoffs${stringify(qs, { addQueryPrefix: true })}`
);
setProduct(value);
};

const handleSignoffRoleChange = ({ target: { value } }) =>
setSignoffRole(value);
const permissionChanges = view(
Expand Down

0 comments on commit ca55f9a

Please sign in to comment.