support page caches page data to the bread crumbs for quick navigation back to device page
This commit is contained in:
parent
61bdff0cef
commit
e588feff92
3 changed files with 61 additions and 14 deletions
|
|
@ -48,7 +48,7 @@ import { Component, Device, deviceScope, Interaction } from "models";
|
|||
// import { isShareableLink } from "pbHelpers/Device";
|
||||
import { pond } from "protobuf-ts/pond";
|
||||
import { useGlobalState } from "providers";
|
||||
import React, { useState } from "react";
|
||||
import React, { useEffect, useState } from "react";
|
||||
// import { useHistory, useRouteMatch } from "react-router";
|
||||
import { isOffline } from "utils/environment";
|
||||
import { or } from "utils/types";
|
||||
|
|
@ -72,6 +72,7 @@ import Connection from "./Connection";
|
|||
import ComponentOrder from "component/ComponentOrder";
|
||||
import ArcGISDeviceData from "./ArcGISDeviceData";
|
||||
import UpgradeDevice from "./UpgradeDevice";
|
||||
import { DevicePageData } from "pages/Device";
|
||||
|
||||
const useStyles = makeStyles((_theme: Theme) => {
|
||||
// const isMobile = useMobile()
|
||||
|
|
@ -170,6 +171,19 @@ export default function DeviceActions(props: Props) {
|
|||
isJsonDataDialogOpen: false
|
||||
});
|
||||
|
||||
const [devicePageData, setDevicePageData] = useState<DevicePageData | undefined>(undefined);
|
||||
|
||||
useEffect(() => {
|
||||
let newPageData: DevicePageData = {
|
||||
device: device,
|
||||
components: components,
|
||||
interactions: interactions,
|
||||
preferences: preferences,
|
||||
permissions: permissions,
|
||||
}
|
||||
setDevicePageData(newPageData)
|
||||
}, [device, components, interactions, preferences, permissions])
|
||||
|
||||
const openDialog = (target: keyof DialogState) => {
|
||||
let updatedDialogState = cloneDeep(dialogState);
|
||||
updatedDialogState[target] = true;
|
||||
|
|
@ -500,7 +514,7 @@ export default function DeviceActions(props: Props) {
|
|||
return (
|
||||
<React.Fragment>
|
||||
{user.allowedTo("provision") && <Tooltip title="Support">
|
||||
<IconButton onClick={() => navigate("support", { state: {device: device} })}>
|
||||
<IconButton onClick={() => navigate("support", { state: {device: device, devicePageData: devicePageData }})}>
|
||||
<Visibility />
|
||||
</IconButton>
|
||||
</Tooltip>}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue