got sen5x overlays working

This commit is contained in:
Carter 2025-05-01 11:03:43 -06:00
parent deb8983b1e
commit bfd3b6bb5f
2 changed files with 77 additions and 98 deletions

View file

@ -307,11 +307,11 @@ export default function ComponentSettings(props: Props) {
if (cableID > 0) component.settings.addressType = cableID + 8;
componentAPI
.add(device.id(), component.settings, as)
.then((response: any) => {
.then((_response: any) => {
success(component.name() + " was successfully added!");
refresh();
})
.catch((err: any) => {
.catch((_err: any) => {
error("Error occured while adding " + component.name() + ".");
})
.finally(() => close());
@ -321,21 +321,21 @@ export default function ComponentSettings(props: Props) {
const component = formComponent;
componentAPI
.update(device.id(), component.settings, getContextKeys(), getContextTypes(), as)
.then((response: any) => {
.then((_response: any) => {
success(component.name() + " was successfully updated!");
let updatedPrefs = pond.DeviceComponentPreferences.create();
updatedPrefs.excludedNodes = excludedNodes;
deviceAPI
.updateComponentPreferences(device.id(), component.key(), updatedPrefs, undefined, undefined, as)
.then(resp => {
.then(_resp => {
console.log("Preferences updated");
})
.catch(err => {
.catch(_err => {
console.log("Preferences failed to update");
});
refresh();
})
.catch((err: any) => {
.catch((_err: any) => {
error("Error occured while updating " + component.name() + ".");
})
.finally(() => {
@ -346,7 +346,7 @@ export default function ComponentSettings(props: Props) {
const removeComponent = () => {
componentAPI
.remove(device.id(), formComponent.key(), getContextKeys(), getContextTypes(), as)
.then((response: any) => {
.then((_response: any) => {
success(formComponent.name() + " was successfully removed!");
refresh();
})
@ -826,16 +826,16 @@ export default function ComponentSettings(props: Props) {
Back
</Button>
) : (
<DeleteButton onClick={() => setRemoveDialogOpen(true)}>Delete</DeleteButton>
<DeleteButton disabled={!canEdit} onClick={() => setRemoveDialogOpen(true)}>Delete</DeleteButton>
)}
</Grid>
<Grid size={{ xs: 7 }} container justifyContent="flex-end">
{mode === "add" ? (
<React.Fragment>
<Button onClick={close} color="primary">
<Typography variant="subtitle2" color="textPrimary">
Cancel
</Typography>
<Typography variant="subtitle2" color="textPrimary">
Cancel
</Typography>
</Button>
{activeStep === steps.length - 1 ? (
<Button color="primary" onClick={addComponent} disabled={!formValid}>
@ -850,14 +850,6 @@ export default function ComponentSettings(props: Props) {
) : (
<React.Fragment>
<CancelSubmit onSubmit={updateComponent} onCancel={close} submitDisabled={!canEdit || !formValid}/>
{/* <Button onClick={close} color="primary">
Cancel
</Button>
{canEdit && (
<Button onClick={updateComponent} color="primary" disabled={!formValid}>
Submit
</Button>
)} */}
</React.Fragment>
)}
</Grid>