Merge branch 'drager_i2c' into i2c_detect
This commit is contained in:
commit
412e96c568
58 changed files with 400 additions and 131678 deletions
|
|
@ -181,11 +181,11 @@ export default function ComponentSettings(props: Props) {
|
|||
setTabVal(newValue);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (deviceComponentPrefs) {
|
||||
setExcludedNodes(deviceComponentPrefs.excludedNodes);
|
||||
}
|
||||
}, [deviceComponentPrefs]);
|
||||
// useEffect(() => {
|
||||
// if (deviceComponentPrefs) {
|
||||
// setExcludedNodes(deviceComponentPrefs.excludedNodes);
|
||||
// }
|
||||
// }, [deviceComponentPrefs]);
|
||||
|
||||
const init = useCallback(() => {
|
||||
let component = props.component;
|
||||
|
|
@ -208,6 +208,7 @@ export default function ComponentSettings(props: Props) {
|
|||
)
|
||||
);
|
||||
setFormComponent(initComponent);
|
||||
setExcludedNodes(initComponent.settings.excludedNodes)
|
||||
}, [props.component, componentTypeOptions]);
|
||||
|
||||
useEffect(() => {
|
||||
|
|
@ -324,20 +325,21 @@ export default function ComponentSettings(props: Props) {
|
|||
|
||||
const updateComponent = () => {
|
||||
const component = formComponent;
|
||||
component.settings.excludedNodes = excludedNodes
|
||||
componentAPI
|
||||
.update(device.id(), component.settings, getContextKeys(), getContextTypes(), as)
|
||||
.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 => {
|
||||
console.log("Preferences updated");
|
||||
})
|
||||
.catch(_err => {
|
||||
console.log("Preferences failed to update");
|
||||
});
|
||||
// let updatedPrefs = pond.DeviceComponentPreferences.create();
|
||||
// updatedPrefs.excludedNodes = excludedNodes;
|
||||
// deviceAPI
|
||||
// .updateComponentPreferences(device.id(), component.key(), updatedPrefs, undefined, undefined, as)
|
||||
// .then(_resp => {
|
||||
// console.log("Preferences updated");
|
||||
// })
|
||||
// .catch(_err => {
|
||||
// console.log("Preferences failed to update");
|
||||
// });
|
||||
refresh();
|
||||
})
|
||||
.catch((_err: any) => {
|
||||
|
|
@ -929,11 +931,11 @@ export default function ComponentSettings(props: Props) {
|
|||
let nodes;
|
||||
if (
|
||||
prevComponent &&
|
||||
prevComponent.lastMeasurement[0] &&
|
||||
prevComponent.lastMeasurement[0].values[0] &&
|
||||
prevComponent.lastMeasurement[0].values[0].values
|
||||
prevComponent.status.measurement[0] &&
|
||||
prevComponent.status.measurement[0].values[0] &&
|
||||
prevComponent.status.measurement[0].values[0].values
|
||||
) {
|
||||
nodes = prevComponent.lastMeasurement[0].values[0].values;
|
||||
nodes = prevComponent.status.measurement[0].values[0].values;
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
@ -1018,24 +1020,6 @@ export default function ComponentSettings(props: Props) {
|
|||
}}>
|
||||
Clear Excluded Nodes
|
||||
</Button>
|
||||
{/* button for testing the pref update */}
|
||||
{/* {prevComponent && (
|
||||
<Button
|
||||
onClick={() => {
|
||||
let pref = pond.DeviceComponentPreferences.create();
|
||||
pref.excludedNodes = excludedNodes;
|
||||
deviceAPI
|
||||
.updateComponentPreferences(device.id(), prevComponent.key(), pref)
|
||||
.then(resp => {
|
||||
console.log("no errors");
|
||||
})
|
||||
.catch(err => {
|
||||
console.log("errors");
|
||||
});
|
||||
}}>
|
||||
Update Prefs
|
||||
</Button>
|
||||
)} */}
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
|
@ -1061,7 +1045,7 @@ export default function ComponentSettings(props: Props) {
|
|||
onChange={handleChange}>
|
||||
<Tab label="General" />
|
||||
<Tab label="Overlays" />
|
||||
<Tab label="Preferences" disabled={!prevComponent} />
|
||||
<Tab label="Nodes" disabled={!prevComponent} />
|
||||
</Tabs>
|
||||
)}
|
||||
<TabPanelMine value={tabVal} index={0}>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue