can now to npm run start-dev to run local front end with the development database

This commit is contained in:
Carter 2025-02-19 13:56:30 -06:00
parent b5fe74664c
commit c636737718
4 changed files with 11 additions and 12 deletions

View file

@ -6,7 +6,8 @@
"scripts": {
"start": "vite",
"start-local": "VITE_APP_API_URL=http://localhost:50052/v1 VITE_APP_WS_URL=ws://localhost:50052/v1/live VITE_APP_BILLING_URL=http://localhost:50053/v1 VITE_APP_RECLUSE_URL=http://localhost:50054/v1 VITE_APP_GITLAB_URL=http://localhost:50055/v1 vite",
"start-dev": "VITE_APP_API_URL=https://bxt-dev.adaptiveagriculture.ca/v1 VITE_APP_WS_URL=ws://bxt-dev.adapticeagriculture.ca/v1/live vite",
"start-dev": "VITE_AUTH0_CLIENT_DOMAIN=brandxtech.auth0.com VITE_AUTH0_AUDIENCE=bxt-dev.api.adaptiveagriculture.ca VITE_AUTH0_DEV_CLIENT_ID=dzJTpqIeMA4Rwk4xujtwPbAO3TY32bM1 vite",
"start-staging": "REACT_APP_API_URL=https://stagingapi.brandxtech.ca/v1 REACT_APP_WS_URL=ws://stagingapi.brandxtech.ca/v1/live REACT_APP_AUTH0_CLIENT_DOMAIN=adaptivestaging.us.auth0.com REACT_APP_AUTH0_AUDIENCE=stagingapi.brandxtech.ca react-scripts start",
"build": "tsc -b && vite build",
"lint": "eslint .",
"preview": "vite preview",

View file

@ -116,6 +116,7 @@ export default function GroupSettings(props: Props) {
}
if (prevTabIndex !== 1 && tabIndex === 1) {
console.log("loading?")
loadDevices();
}
}, [initialGroup, loadDevices, prevInitialGroup, prevTabIndex, props, tabIndex, groupDevices]);
@ -310,7 +311,8 @@ export default function GroupSettings(props: Props) {
<Checkbox
edge="end"
onChange={() => changeDevices(device.id())}
checked={group.settings.devices.includes(device.id())}
// checked={group.settings.devices.includes(device.id())}
checked={groupDevices?.some(dev => dev.id() === device.id())}
inputProps={{ "aria-labelledby": label }}
disabled={!canEdit}
/>
@ -331,12 +333,16 @@ export default function GroupSettings(props: Props) {
const addDevice = (device: number) => {
console.log("adding device?????")
groupAPI.addDevice(group.id(), device).then(() => {
console.log("successfully added")
refreshCallback();
}).catch(() => {
console.log("Error adding")
});
};
const removeDevice = (device: number) => {
groupAPI.removeDevice(group.id(), device).then(() => {
console.log("successfully removed")
refreshCallback();
});
};

View file

@ -42,15 +42,6 @@ export default function DevicePage() {
const loadDevice = () => {
if (loading) return
// if (state?.device && parseInt(state.device.settings.deviceId) === device.id()) return
// deviceAPI.get(deviceID, false, getContextKeys(), getContextTypes()).then(resp => {
// setDevice(Device.create(resp.data))
// console.log(resp.data)
// }).catch(() => {
// snackbar.error("Error loading device.")
// }).finally(() => {
// setLoading(false)
// })
setLoading(true)
deviceAPI.getPageData(deviceID, getContextKeys(), getContextTypes()).then(resp => {

View file

@ -182,6 +182,7 @@ export default function Devices() {
}
const loadDevices = () => {
console.log("loading devices")
setDevicesLoading(true)
deviceAPI.list(
limit,
@ -408,7 +409,7 @@ export default function Devices() {
mode={groupSettingsMode}
isDialogOpen={groupSettingsIsOpen}
closeDialogCallback={closeGroupSettings}
refreshCallback={loadGroups}
refreshCallback={loadDevices}
canEdit={true}
/>
</PageContainer>