Merge branch 'auth_stuff' into staging_environment
This commit is contained in:
commit
49f1a4ea98
3 changed files with 35 additions and 6 deletions
|
|
@ -49,7 +49,7 @@ export default function BinsList(props: Props) {
|
|||
//const scrollRef = useRef<any>(null);
|
||||
|
||||
const goToBin = (i: number) => {
|
||||
let path = "/bins/" + bins[i].key();
|
||||
let path = bins[i].key();
|
||||
navigate(path, { state: {bin: bins[i]} });
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@ import GrainBagList from "grainBag/grainBagList";
|
|||
import BinYards from "bin/BinYards";
|
||||
import ButtonGroup from "common/ButtonGroup";
|
||||
import TeamDialog from "teams/TeamDialog";
|
||||
import { getContextKeys, getContextTypes } from "pbHelpers/Context";
|
||||
// import { useHistory } from "react-router";
|
||||
|
||||
const useStyles = makeStyles((theme: Theme) => {
|
||||
|
|
@ -311,6 +312,16 @@ export default function Bins(props: Props) {
|
|||
}
|
||||
}, [props.yardFilter]);
|
||||
|
||||
const getKeys = () => {
|
||||
if (as) return undefined
|
||||
return getContextKeys()
|
||||
}
|
||||
|
||||
const getTypes = () => {
|
||||
if (as) return undefined
|
||||
return getContextTypes()
|
||||
}
|
||||
|
||||
const loadBins = useCallback(() => {
|
||||
//let filter = grainFilter;
|
||||
let filter = yardFilter;
|
||||
|
|
@ -325,7 +336,7 @@ export default function Bins(props: Props) {
|
|||
setDisplayFert(false);
|
||||
|
||||
binAPI
|
||||
.listBinsAndData(binsLimit, 0, order, orderBy, filter, as, false)
|
||||
.listBinsAndData(binsLimit, 0, order, orderBy, filter, as, false, getKeys(), getTypes())
|
||||
.then(resp => {
|
||||
let grain: Bin[] = [];
|
||||
let empty: Bin[] = [];
|
||||
|
|
@ -623,8 +634,9 @@ export default function Bins(props: Props) {
|
|||
preLoadedData={paginatedBins.bins}
|
||||
rowClickFunction={data => {
|
||||
let bin = data as Bin;
|
||||
let path = "/bins/" + bin.key();
|
||||
navigate(path, { state: { bin: bin }});
|
||||
// let path = "bins/" + bin.key();
|
||||
// navigate(path, { state: { bin: bin }});
|
||||
navigate(bin.key(), { state: { bin: bin }, relative: "path"});
|
||||
}}
|
||||
customButtons={[
|
||||
{
|
||||
|
|
|
|||
|
|
@ -12,10 +12,10 @@ import { appendToUrl } from "navigation/Router";
|
|||
import PageContainer from "pages/PageContainer";
|
||||
import { getContextKeys, getContextTypes } from "pbHelpers/Context";
|
||||
import { pond } from "protobuf-ts/pond";
|
||||
import { useSnackbar, useTeamAPI, useUserAPI } from "providers";
|
||||
import { useGlobalState, useSnackbar, useTeamAPI, useUserAPI } from "providers";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useLocation, useNavigate, useParams } from 'react-router-dom';
|
||||
import { getSignatureAccentColour } from "services/whiteLabel";
|
||||
import { getSignatureAccentColour, IsAdaptiveAgriculture, IsStreamline } from "services/whiteLabel";
|
||||
import TeamActions from "teams/TeamActions";
|
||||
import TeamKeyManager from "teams/TeamKeyManager";
|
||||
import ObjectUsers from "user/ObjectUsers";
|
||||
|
|
@ -88,6 +88,7 @@ export default function TeamPage() {
|
|||
const [loadingUsers, setLoadingUsers] = useState(false)
|
||||
const [userDialog, setUserDialog] = useState(false)
|
||||
const teamKey = teamID ? teamID : "";
|
||||
const [{ user }] = useGlobalState()
|
||||
|
||||
|
||||
const getTeam = () => {
|
||||
|
|
@ -212,6 +213,14 @@ export default function TeamPage() {
|
|||
const toGroups = () => {
|
||||
navigate(appendToUrl("groups"))
|
||||
}
|
||||
|
||||
const toBins = () => {
|
||||
// navigate(appendToUrl("bins"))
|
||||
navigate("bins")
|
||||
}
|
||||
|
||||
const isAg = IsAdaptiveAgriculture()
|
||||
const isStreamline = IsStreamline()
|
||||
|
||||
return (
|
||||
<PageContainer spacing={isMobile ? 0 : 2}>
|
||||
|
|
@ -255,6 +264,14 @@ export default function TeamPage() {
|
|||
<ListItemButton onClick={toGroups}>
|
||||
Groups
|
||||
</ListItemButton>
|
||||
{((isAg || isStreamline) || user.hasFeature("admin")) &&
|
||||
<>
|
||||
<Divider />
|
||||
<ListItemButton onClick={toBins}>
|
||||
Bins
|
||||
</ListItemButton>
|
||||
</>
|
||||
}
|
||||
<Divider />
|
||||
</List>
|
||||
</Card>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue