fixed permission issue causing problems with simple export

This commit is contained in:
csawatzky 2025-04-24 14:10:55 -06:00
parent 7c5332662d
commit b7e21a8fa1
3 changed files with 20 additions and 17 deletions

View file

@ -78,7 +78,7 @@ export default function ArcGISDeviceData(props: Props) {
const getMeasurements = () => {
if (useFlat) {
deviceAPI.listSimpleJSON(device.id()).then(resp => {
deviceAPI.listSimpleJSON(device.id(), as).then(resp => {
downloadJSON(resp.data, "Device" + device.id() + ".json");
});
} else {

View file

@ -360,12 +360,21 @@ export default function Device(props: Props) {
// } else {
return (
<Box padding={1}>
<Grid container direction="row" alignItems="center">
<Grid style={{ order: 5 }}>
<Grid container direction="row" justifyContent="space-between" alignItems="center" width="100%">
<Grid size={12}>
<DeviceOverview
device={device}
components={[...components.values()]}
usage={getUsage()}
loading={isLoading}
/>
</Grid>
<Grid size={12}>
<DeviceActions
device={device}
isPaused={isPaused()}
components={getOrderedComponents()}
components={[...components.values()]}
//components={getOrderedComponents()}
interactions={interactions}
availablePositions={availablePositions}
availableOffsets={availableOffsets}
@ -374,18 +383,10 @@ export default function Device(props: Props) {
preferences={preferences}
toggleNotificationPreference={toggleNotificationPreference}
isLoading={isLoading}
/>
</Grid>
<Grid style={{ order: 4 }}>
<DeviceOverview
device={device}
components={[...components.values()]}
usage={getUsage()}
loading={isLoading}
/>
/>
</Grid>
{componentsTab()}
</Grid>
{componentsTab()}
</Box>
);
//}

View file

@ -131,7 +131,7 @@ export interface IDeviceAPIContext {
orderBy: string,
as?: string
) => Promise<AxiosResponse<pond.ListDeviceExportedMeasurementsResponse>>;
listSimpleJSON: (device: number) => Promise<any>;
listSimpleJSON: (device: number, as?: string) => Promise<any>;
resetQuackCount: (id: number) => Promise<any>;
resetQuackCountTx: (id: number) => Promise<any>;
resetQuackCountTx1000: (id: number) => Promise<any>;
@ -832,9 +832,11 @@ export default function DeviceProvider(props: PropsWithChildren<Props>) {
);
};
const listSimpleJSON = (device: number) => {
const listSimpleJSON = (device: number, as?: string) => {
let url = "/devices/" + device + "/measurements/exportSimple"
if(as) url = url + "?as=" + as
return new Promise<AxiosResponse>((resolve, reject) => {
get(pondURL("/devices/" + device + "/measurements/exportSimple")).then(resp => {
get(pondURL(url)).then(resp => {
return resolve(resp)
}).catch(err => {
return reject(err)