merged tag fixes
This commit is contained in:
commit
9c8afb43cc
7 changed files with 35 additions and 19 deletions
|
|
@ -233,7 +233,7 @@ export default function DeviceOverview(props: Props) {
|
|||
<StatusChip status="pending" />
|
||||
</Grid>
|
||||
)}
|
||||
{user.allowedTo("provision") && <DeviceTags device={device} disableAdd={disableAddTag} />}
|
||||
{<DeviceTags device={device} disableAdd={disableAddTag} />}
|
||||
</Grid>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ function AddDeviceTag(props: AddDeviceTagProps) {
|
|||
<TagUI tag={tag} onClick={() => addTagToDevice(tag)} />
|
||||
</ListItem>
|
||||
));
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<IconButton aria-label="add tag" onClick={() => setOpen(true)} size="small">
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import {
|
|||
Check,
|
||||
PermScanWifi,
|
||||
} from "@mui/icons-material";
|
||||
import { Card, Grid2, Skeleton, Theme, Typography, useTheme } from "@mui/material";
|
||||
import { Card, Grid2, Theme, Typography } from "@mui/material";
|
||||
import { green } from "@mui/material/colors";
|
||||
import { makeStyles } from "@mui/styles";
|
||||
import classNames from "classnames";
|
||||
|
|
@ -41,7 +41,7 @@ interface Props {
|
|||
export default function DevicesSummary(props: Props) {
|
||||
const { setFieldContains, group } = props;
|
||||
const deviceAPI = useDeviceAPI()
|
||||
const theme = useTheme()
|
||||
// const theme = useTheme()
|
||||
const classes = useStyles()
|
||||
|
||||
const [stats, setStats] = useState<pond.DeviceStatistics>(pond.DeviceStatistics.create())
|
||||
|
|
@ -205,7 +205,7 @@ export default function DevicesSummary(props: Props) {
|
|||
<Grid2>
|
||||
<CircleGraphIcon
|
||||
sx={{ marginRight: 1, marginLeft: 1 }}
|
||||
progress={!loadingStats ? getPercent(stats.warning) : undefined}
|
||||
progress={!loadingStats ? getPercent(stats.offline) : undefined}
|
||||
color={green[50]}
|
||||
icon={<PermScanWifi />}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -434,18 +434,20 @@ export default function SideNavigator(props: Props) {
|
|||
</ListItemButton>
|
||||
</Tooltip>
|
||||
}
|
||||
<Tooltip title="Marketplace" placement="right">
|
||||
<ListItemButton
|
||||
id="tour-marketplace"
|
||||
onClick={() => goTo("/marketplace")}
|
||||
classes={getClasses("/marketplace")}
|
||||
>
|
||||
<ListItemIcon>
|
||||
<MarketplaceIcon />
|
||||
</ListItemIcon>
|
||||
{open && <ListItemText primary="Marketplace" />}
|
||||
</ListItemButton>
|
||||
</Tooltip>
|
||||
{isAg &&
|
||||
<Tooltip title="Marketplace" placement="right">
|
||||
<ListItemButton
|
||||
id="tour-marketplace"
|
||||
onClick={() => goTo("/marketplace")}
|
||||
classes={getClasses("/marketplace")}
|
||||
>
|
||||
<ListItemIcon>
|
||||
<MarketplaceIcon />
|
||||
</ListItemIcon>
|
||||
{open && <ListItemText primary="Marketplace" />}
|
||||
</ListItemButton>
|
||||
</Tooltip>
|
||||
}
|
||||
{user.hasFeature("john-deere") &&
|
||||
<Tooltip title="John Deere" placement="right">
|
||||
<ListItemButton
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ export function dragerGasDongle(subtype: number = 0): ComponentTypeExtension {
|
|||
excludedNodes?: number[]
|
||||
): Summary[] => {
|
||||
//if it is O2 display percentage rather than ppm
|
||||
if (subtype === quack.DragerGasDongleSubtype.DRAGER_GAS_DONGLE_SUBTYPE_O2) {
|
||||
if (subtype === quack.DragerGasDongleSubtype.DRAGER_GAS_DONGLE_SUBTYPE_O2 || subtype === quack.DragerGasDongleSubtype.DRAGER_GAS_DONGLE_SUBTYPE_LEL) {
|
||||
let summaries: Summary[] = [];
|
||||
measurements.measurementsFor.forEach(measurement => {
|
||||
let describer = describeMeasurement(
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import { useGlobalState } from "providers";
|
|||
import moment from "moment";
|
||||
import { or } from "utils/types";
|
||||
import { dateRange } from "providers/http";
|
||||
import { getContextKeys, getContextTypes } from "pbHelpers/Context";
|
||||
|
||||
export interface IDeviceAPIContext {
|
||||
add: (name: string, description: string, backpack: pond.BackpackSettings, otherTeam?: string) => Promise<AxiosResponse<pond.AddDeviceResponse>>;
|
||||
|
|
@ -725,8 +726,12 @@ export default function DeviceProvider(props: PropsWithChildren<Props>) {
|
|||
};
|
||||
|
||||
const tag = (id: number, tag: string) => {
|
||||
const keys = getContextKeys()
|
||||
const types = getContextTypes()
|
||||
let url = "/devices/" + id + "/tags/" + tag + "?keys=" + keys + "&types=" + types
|
||||
if (as && !keys.includes(as)) url += "&as=" + as
|
||||
return new Promise<AxiosResponse>((resolve, reject) => {
|
||||
put(pondURL("/devices/" + id + "/tags/" + tag), {}).then(resp => {
|
||||
put(pondURL(url), {}).then(resp => {
|
||||
return resolve(resp)
|
||||
}).catch(err => {
|
||||
return reject(err)
|
||||
|
|
|
|||
|
|
@ -33,8 +33,16 @@ export default function TagProvider(props: PropsWithChildren<Props>) {
|
|||
const [{ as }] = useGlobalState()
|
||||
|
||||
const addTag = (tag: pond.TagSettings) => {
|
||||
let keys = getContextKeys()
|
||||
let types = getContextTypes()
|
||||
let url = "/tags"
|
||||
if (keys.includes(as)) {
|
||||
url += "?keys=" + keys + "&types=" + types
|
||||
} else {
|
||||
url += "?as=" + as + "&keys=" + keys + "&types=" + types
|
||||
}
|
||||
return new Promise<AxiosResponse>((resolve, reject) => {
|
||||
post(pondURL("/tags"), tag).then(resp => {
|
||||
post(pondURL(url), tag).then(resp => {
|
||||
return resolve(resp)
|
||||
}).catch(err => {
|
||||
return reject(err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue