Merge branch 'dev_environment' of gitlab.com:brandx/bxt-app into dev_environment

This commit is contained in:
Carter 2025-03-06 14:34:56 -06:00
commit 2c859d9de9
3 changed files with 36 additions and 10 deletions

View file

@ -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;
};

View file

@ -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<any> = or(responses[0].data.components, []).sort(

View file

@ -173,11 +173,20 @@ export default function DeviceProvider(props: PropsWithChildren<Props>) {
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<AxiosResponse<pond.Device>>((resolve, reject) => {
get<pond.Device>(url).then(resp => {
resp.data = pond.Device.fromObject(resp.data)
@ -498,11 +507,19 @@ export default function DeviceProvider(props: PropsWithChildren<Props>) {
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<AxiosResponse<pond.ListDeviceComponentPreferencesResponse>>((resolve, reject) => {
get<pond.ListDeviceComponentPreferencesResponse>(url).then(resp => {
resp.data = pond.ListDeviceComponentPreferencesResponse.fromObject(resp.data)