implemented new tag method
This commit is contained in:
parent
eb5fd127e3
commit
6439d217e9
6 changed files with 48 additions and 48 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { Button, Checkbox, Divider, FormControlLabel, List, ListItem, Typography } from "@mui/material";
|
||||
import { Button, Divider, List, ListItem, Typography } from "@mui/material";
|
||||
import Grid from '@mui/material/Grid2';
|
||||
import { Component, Device, Interaction, User } from "models";
|
||||
import { getContextKeys, getContextTypes } from "pbHelpers/Context";
|
||||
|
|
@ -33,7 +33,7 @@ export default function DevicePage() {
|
|||
const [loading, setLoading] = useState(false)
|
||||
const [permissions, setPermissions] = useState<pond.Permission[]>([])
|
||||
const [preferences, setPreferences] = useState<pond.DevicePreferences>(pond.DevicePreferences.create())
|
||||
const [tags, setTags] = useState<pond.Tag[]>([]);
|
||||
// const [tags, setTags] = useState<pond.Tag[]>([]);
|
||||
const [interactions, setInteractions] = useState<Interaction[]>([]);
|
||||
const [prefsMap, setPrefsMap] = useState<Map<string, pond.DeviceComponentPreferences>>(new Map());
|
||||
|
||||
|
|
@ -52,10 +52,10 @@ export default function DevicePage() {
|
|||
|
||||
const loadDevice = () => {
|
||||
if (loading) return
|
||||
|
||||
setLoading(true)
|
||||
deviceAPI.getPageData(deviceID, getContextKeys(), getContextTypes()).then(resp => {
|
||||
let device = Device.any(resp.data.device)
|
||||
// console.log(resp.data.device)
|
||||
setDevice(device)
|
||||
let newPermissions: pond.Permission[] = []
|
||||
resp.data.permissions.forEach(perm => {
|
||||
|
|
@ -69,7 +69,8 @@ export default function DevicePage() {
|
|||
setPermissions(newPermissions)
|
||||
let u = User.any(resp.data.user);
|
||||
setPreferences(u.preferences)
|
||||
setTags(resp.data.tags)
|
||||
// setTags(resp.data.tags)
|
||||
resp.data.device?.status?.tagNames
|
||||
let newComps: Component[] = []
|
||||
resp.data.components.forEach(comp => {
|
||||
newComps.push(Component.create(comp))
|
||||
|
|
@ -290,8 +291,8 @@ export default function DevicePage() {
|
|||
<Divider component="li" />
|
||||
<ListItem>
|
||||
<Grid width={"100%"} container justifyContent="flex-start" direction="row" spacing={2}>
|
||||
{sensorComponents.map(card => (
|
||||
<Grid size={{
|
||||
{sensorComponents.map((card, index) => (
|
||||
<Grid key={"sensor-components-"+index} size={{
|
||||
xs: 12,
|
||||
sm: isMobile ? 12 : 6,
|
||||
md: isMobile ? 12 : 6,
|
||||
|
|
@ -311,8 +312,8 @@ export default function DevicePage() {
|
|||
<Divider component="li" />
|
||||
<ListItem>
|
||||
<Grid width={"100%"} container justifyContent="flex-start" direction="row" spacing={2}>
|
||||
{controllerComponents.map(card => (
|
||||
<Grid size={{
|
||||
{controllerComponents.map((card, index) => (
|
||||
<Grid key={"sensor-components-"+index} size={{
|
||||
xs: 12,
|
||||
sm: isMobile ? 12 : 6,
|
||||
md: isMobile ? 12 : 6,
|
||||
|
|
@ -422,9 +423,11 @@ export default function DevicePage() {
|
|||
open={addComponentManualDialogOpen}
|
||||
onClose={() => setAddComponentManualDialogOpen(false)}
|
||||
/>
|
||||
<Button onClick={() => setAddComponentManualDialogOpen(true)}>
|
||||
Manual Comp
|
||||
</Button>
|
||||
{user.hasFeature("developer") === true &&
|
||||
<Button onClick={() => setAddComponentManualDialogOpen(true)}>
|
||||
Manual Comp
|
||||
</Button>
|
||||
}
|
||||
<DeviceActions
|
||||
device={device}
|
||||
isPaused={false}
|
||||
|
|
@ -445,7 +448,6 @@ export default function DevicePage() {
|
|||
// components={components}
|
||||
usage={getUsage()}
|
||||
loading={loading}
|
||||
tags={tags}
|
||||
groupID={parseInt(groupID)}
|
||||
/>
|
||||
{componentCards()}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue