Merge branch 'airflow' into node_exclusion_update

This commit is contained in:
csawatzky 2025-07-28 15:30:14 -06:00
commit 25fc5021fe
13 changed files with 107 additions and 31 deletions

View file

@ -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={[
{

View file

@ -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}>
@ -237,6 +246,7 @@ export default function TeamPage() {
isDialogOpen={userDialog}
closeDialogCallback={() => setUserDialog(false)}
refreshCallback={() => {}}
useImitation={false}
/>
<Grid2 container spacing={1}>
<Grid2 size={{ xs: 12, sm: 4 }}>
@ -255,6 +265,14 @@ export default function TeamPage() {
<ListItemButton onClick={toGroups}>
Groups
</ListItemButton>
{((isAg || isStreamline) || user.hasFeature("admin")) &&
<>
<Divider />
<ListItemButton onClick={toBins}>
Bins
</ListItemButton>
</>
}
<Divider />
</List>
</Card>