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 = () => { const getMeasurements = () => {
if (useFlat) { if (useFlat) {
deviceAPI.listSimpleJSON(device.id()).then(resp => { deviceAPI.listSimpleJSON(device.id(), as).then(resp => {
downloadJSON(resp.data, "Device" + device.id() + ".json"); downloadJSON(resp.data, "Device" + device.id() + ".json");
}); });
} else { } else {

View file

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

View file

@ -131,7 +131,7 @@ export interface IDeviceAPIContext {
orderBy: string, orderBy: string,
as?: string as?: string
) => Promise<AxiosResponse<pond.ListDeviceExportedMeasurementsResponse>>; ) => Promise<AxiosResponse<pond.ListDeviceExportedMeasurementsResponse>>;
listSimpleJSON: (device: number) => Promise<any>; listSimpleJSON: (device: number, as?: string) => Promise<any>;
resetQuackCount: (id: number) => Promise<any>; resetQuackCount: (id: number) => Promise<any>;
resetQuackCountTx: (id: number) => Promise<any>; resetQuackCountTx: (id: number) => Promise<any>;
resetQuackCountTx1000: (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) => { return new Promise<AxiosResponse>((resolve, reject) => {
get(pondURL("/devices/" + device + "/measurements/exportSimple")).then(resp => { get(pondURL(url)).then(resp => {
return resolve(resp) return resolve(resp)
}).catch(err => { }).catch(err => {
return reject(err) return reject(err)