diff --git a/src/common/SmartBreadcrumb.tsx b/src/common/SmartBreadcrumb.tsx index aa0202c..b61efb9 100644 --- a/src/common/SmartBreadcrumb.tsx +++ b/src/common/SmartBreadcrumb.tsx @@ -219,6 +219,10 @@ export default function SmartBreadcrumb(props: Props) { return binsPath() + "/" + binID(); }; + const teamsPath = (): string => { + return "/teams"; + } + const getBreadcrumbMap = (): { [key: string]: string } => { const { groupName, deviceName, componentName, reportTarget, binName } = props; const deviceLabel: string = deviceName ? deviceName : "Device " + deviceID(); @@ -248,7 +252,8 @@ export default function SmartBreadcrumb(props: Props) { [firmwarePath()]: "Firmware", [usersPath()]: "Users", [binsPath()]: "Bins", - [binPath()]: binLabel + [binPath()]: binLabel, + [teamsPath()]: "Teams" }; }; @@ -258,7 +263,7 @@ export default function SmartBreadcrumb(props: Props) { const breadcrumbLinks = (): ReactNode[] => { const breadcrumbMap = getBreadcrumbMap(); - // console.log(breadcrumbMap) + //console.log(breadcrumbMap) let links: ReactNode[] = []; let pathnames = location.pathname.split("/").filter((x: any) => x); @@ -277,10 +282,13 @@ export default function SmartBreadcrumb(props: Props) { const lastPath = index === pathnames.length - 1; //console.log(lastPath) const to = `/${pathnames.slice(0, index + 1).join("/")}`; - + //console.log("to: " + to) let label = breadcrumbMap[to]; + //console.log("label: "+label) let result = to.split("/").filter(str => str !== ""); + //console.log("result: " + result.toString()) if (!label) { + //console.log("no label") if (result.length > 1) { if (result[result.length - 1] !== "components") { label = breadcrumbMap["/" + result[result.length - 1]]; @@ -292,11 +300,12 @@ export default function SmartBreadcrumb(props: Props) { } if (!blacklist.includes(to) && label) { + //console.log("push link") links.push(linkComponent(to, label, lastPath)); } }); - + //console.log(links) return links; }; diff --git a/src/pages/DeviceComponent.tsx b/src/pages/DeviceComponent.tsx index 117d8b7..5c1f2fa 100644 --- a/src/pages/DeviceComponent.tsx +++ b/src/pages/DeviceComponent.tsx @@ -219,7 +219,7 @@ export default function DeviceComponent() { true ); let userPromise = userAPI.getUser(user.settings.id, deviceScope(deviceID.toString())); - let prefPromise = deviceAPI.listDeviceComponentPreferences(deviceID); + let prefPromise = deviceAPI.listDeviceComponentPreferences(deviceID, getContextKeys().slice(0, -1), getContextTypes().slice(0, -1)); Promise.all([componentsPromise, userPromise, prefPromise]) .then((responses: any) => { const rawComponents: Array = or(responses[0].data.components, []).sort( diff --git a/src/providers/pond/deviceAPI.tsx b/src/providers/pond/deviceAPI.tsx index 7b2550e..6cc6cad 100644 --- a/src/providers/pond/deviceAPI.tsx +++ b/src/providers/pond/deviceAPI.tsx @@ -173,11 +173,20 @@ export default function DeviceProvider(props: PropsWithChildren) { let url = pondURL( "/devices/" + id + - "?as=" + as + - (keys ? "&keys=" + keys.toString() : "") + + (keys ? "?keys=" + keys.toString() : "") + (types ? "&types=" + types.toString() : ""), demo ); + if (as) { + url = pondURL( + "/devices/" + + id + + "?as=" + as + + (keys ? "&keys=" + keys.toString() : "") + + (types ? "&types=" + types.toString() : ""), + demo + ); + } return new Promise>((resolve, reject) => { get(url).then(resp => { resp.data = pond.Device.fromObject(resp.data) @@ -498,11 +507,19 @@ export default function DeviceProvider(props: PropsWithChildren) { let url = pondURL( "/devices/" + id + - "/componentPreferences?as=" + - as + - (keys ? "&keys=" + keys.toString() : "") + + "/componentPreferences" + + (keys ? "?keys=" + keys.toString() : "") + (types ? "&types=" + types.toString() : "") ) + if (as) { + url = pondURL( + "/devices/" + + id + + "/componentPreferences?as=" + as + + (keys ? "&keys=" + keys.toString() : "") + + (types ? "&types=" + types.toString() : "") + ) + } return new Promise>((resolve, reject) => { get(url).then(resp => { resp.data = pond.ListDeviceComponentPreferencesResponse.fromObject(resp.data)