Merge branch 'tags_fix' into staging_environment
This commit is contained in:
commit
2c1910d387
8 changed files with 34 additions and 18 deletions
2
package-lock.json
generated
2
package-lock.json
generated
|
|
@ -42,7 +42,7 @@
|
||||||
"mui-tel-input": "^7.0.0",
|
"mui-tel-input": "^7.0.0",
|
||||||
"notistack": "^3.0.1",
|
"notistack": "^3.0.1",
|
||||||
"openweathermap-ts": "^1.2.10",
|
"openweathermap-ts": "^1.2.10",
|
||||||
"protobuf-ts": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#staging",
|
"protobuf-ts": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#master",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
"react-beautiful-dnd": "^13.1.1",
|
"react-beautiful-dnd": "^13.1.1",
|
||||||
"react-color": "^2.19.3",
|
"react-color": "^2.19.3",
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@
|
||||||
"mui-tel-input": "^7.0.0",
|
"mui-tel-input": "^7.0.0",
|
||||||
"notistack": "^3.0.1",
|
"notistack": "^3.0.1",
|
||||||
"openweathermap-ts": "^1.2.10",
|
"openweathermap-ts": "^1.2.10",
|
||||||
"protobuf-ts": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#staging",
|
"protobuf-ts": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#master",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
"react-beautiful-dnd": "^13.1.1",
|
"react-beautiful-dnd": "^13.1.1",
|
||||||
"react-color": "^2.19.3",
|
"react-color": "^2.19.3",
|
||||||
|
|
|
||||||
|
|
@ -233,7 +233,7 @@ export default function DeviceOverview(props: Props) {
|
||||||
<StatusChip status="pending" />
|
<StatusChip status="pending" />
|
||||||
</Grid>
|
</Grid>
|
||||||
)}
|
)}
|
||||||
{user.allowedTo("provision") && <DeviceTags device={device} disableAdd={disableAddTag} />}
|
{<DeviceTags device={device} disableAdd={disableAddTag} />}
|
||||||
</Grid>
|
</Grid>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,7 @@ function AddDeviceTag(props: AddDeviceTagProps) {
|
||||||
<TagUI tag={tag} onClick={() => addTagToDevice(tag)} />
|
<TagUI tag={tag} onClick={() => addTagToDevice(tag)} />
|
||||||
</ListItem>
|
</ListItem>
|
||||||
));
|
));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<IconButton aria-label="add tag" onClick={() => setOpen(true)} size="small">
|
<IconButton aria-label="add tag" onClick={() => setOpen(true)} size="small">
|
||||||
|
|
|
||||||
|
|
@ -434,18 +434,20 @@ export default function SideNavigator(props: Props) {
|
||||||
</ListItemButton>
|
</ListItemButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
}
|
}
|
||||||
<Tooltip title="Marketplace" placement="right">
|
{isAg &&
|
||||||
<ListItemButton
|
<Tooltip title="Marketplace" placement="right">
|
||||||
id="tour-marketplace"
|
<ListItemButton
|
||||||
onClick={() => goTo("/marketplace")}
|
id="tour-marketplace"
|
||||||
classes={getClasses("/marketplace")}
|
onClick={() => goTo("/marketplace")}
|
||||||
>
|
classes={getClasses("/marketplace")}
|
||||||
<ListItemIcon>
|
>
|
||||||
<MarketplaceIcon />
|
<ListItemIcon>
|
||||||
</ListItemIcon>
|
<MarketplaceIcon />
|
||||||
{open && <ListItemText primary="Marketplace" />}
|
</ListItemIcon>
|
||||||
</ListItemButton>
|
{open && <ListItemText primary="Marketplace" />}
|
||||||
</Tooltip>
|
</ListItemButton>
|
||||||
|
</Tooltip>
|
||||||
|
}
|
||||||
{user.hasFeature("john-deere") &&
|
{user.hasFeature("john-deere") &&
|
||||||
<Tooltip title="John Deere" placement="right">
|
<Tooltip title="John Deere" placement="right">
|
||||||
<ListItemButton
|
<ListItemButton
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ export function dragerGasDongle(subtype: number = 0): ComponentTypeExtension {
|
||||||
excludedNodes?: number[]
|
excludedNodes?: number[]
|
||||||
): Summary[] => {
|
): Summary[] => {
|
||||||
//if it is O2 display percentage rather than ppm
|
//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[] = [];
|
let summaries: Summary[] = [];
|
||||||
measurements.measurementsFor.forEach(measurement => {
|
measurements.measurementsFor.forEach(measurement => {
|
||||||
let describer = describeMeasurement(
|
let describer = describeMeasurement(
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import { useGlobalState } from "providers";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import { or } from "utils/types";
|
import { or } from "utils/types";
|
||||||
import { dateRange } from "providers/http";
|
import { dateRange } from "providers/http";
|
||||||
|
import { getContextKeys, getContextTypes } from "pbHelpers/Context";
|
||||||
|
|
||||||
export interface IDeviceAPIContext {
|
export interface IDeviceAPIContext {
|
||||||
add: (name: string, description: string, backpack: pond.BackpackSettings, otherTeam?: string) => Promise<AxiosResponse<pond.AddDeviceResponse>>;
|
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 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) => {
|
return new Promise<AxiosResponse>((resolve, reject) => {
|
||||||
put(pondURL("/devices/" + id + "/tags/" + tag), {}).then(resp => {
|
put(pondURL(url), {}).then(resp => {
|
||||||
return resolve(resp)
|
return resolve(resp)
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
return reject(err)
|
return reject(err)
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,16 @@ export default function TagProvider(props: PropsWithChildren<Props>) {
|
||||||
const [{ as }] = useGlobalState()
|
const [{ as }] = useGlobalState()
|
||||||
|
|
||||||
const addTag = (tag: pond.TagSettings) => {
|
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) => {
|
return new Promise<AxiosResponse>((resolve, reject) => {
|
||||||
post(pondURL("/tags"), tag).then(resp => {
|
post(pondURL(url), tag).then(resp => {
|
||||||
return resolve(resp)
|
return resolve(resp)
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
return reject(err)
|
return reject(err)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue