Skip to content
Snippets Groups Projects
Commit 6e727a22 authored by Erkan Karabulut's avatar Erkan Karabulut
Browse files

add react-native reducer method to remove all observations that contains data...

add react-native reducer method to remove all observations that contains data from a specific device
parent 6b50fb84
No related branches found
No related tags found
No related merge requests found
......@@ -12,9 +12,16 @@ export const addObservation = observation => (
}
);
export const removeAllObservations = observation => (
export const removeObservations = observation => (
{
type: 'REMOVE_OBSERVATION',
observation: observation
}
);
export const removeAllObservations = deviceId => (
{
type: 'REMOVE_DEVICE_OBSERVATIONS',
deviceId: deviceId
}
);
......@@ -27,6 +27,12 @@ const observation = (state = initialState, action) => {
}
});
break;
case 'REMOVE_DEVICE_OBSERVATIONS':
state.observationList.forEach(function (observation) {
if (observation.sensorIds.includes(action.deviceId)){
state.observationList.splice(state.observationList.indexOf(observation), 1);
}
})
}
return {observationList: state.observationList};
......
......@@ -245,7 +245,7 @@ let styles = EStyleSheet.create({
},
modalView: {
width: "300rem",
height: "190rem",
height: "200rem",
alignSelf: "center",
top: "25%",
borderRadius: "10rem",
......@@ -271,7 +271,8 @@ let styles = EStyleSheet.create({
},
text: {
fontSize: "12rem",
color: Colors.blue
color: Colors.blue,
width: "220rem"
},
modalCloseButton: {
padding: "10rem",
......
......@@ -169,7 +169,8 @@ let styles = EStyleSheet.create({
marginTop: '10rem',
fontSize: '15rem',
fontWeight: 'bold',
color: Colors.blue
color: Colors.blue,
marginHorizontal: "10rem"
},
graph: {
flexDirection: "row",
......
......@@ -48,8 +48,8 @@ export default class DeviceService {
let locationString = "";
locationString += "Building: " + device.location.building.name + ": " + device.location.building.address;
locationString += "\nFloor: " + device.location.floor;
locationString += "\nRoom: " + device.location.room;
locationString += " Floor: " + device.location.floor;
locationString += " Room: " + device.location.room;
return locationString;
}
......
......@@ -165,7 +165,7 @@ export default class MQTTClientService {
console.log("Device de-advertised: ", device.name, " - ", device.objectId);
// remove device and all it's observation from react-redux
store.dispatch({type: "REMOVE_DEVICE", device: device});
store.dispatch({type: "REMOVE_OBSERVATION", objectId: device.objectId});
store.dispatch({type: "REMOVE_DEVICE_OBSERVATIONS", deviceId: device.objectId});
store.getState().response.responseList.forEach(response => {
Object.keys(response.grouping).forEach(requestId => {
......
......@@ -18,7 +18,7 @@
"@coaty/core": "^2.0.0",
"dotenv": "^8.2.0",
"natural": "^2.1.5",
"pg": "^7.18.2",
"pg": "^8.7.3",
"rxjs": "^6.5.4",
"string-similarity": "^4.0.2",
"run-parallel": "^1.2.0",
......
......@@ -18,7 +18,7 @@ export class OntologyRepository {
*/
public static getListOfSynonyms(ontologyNodeList, dbContext: DbContext): Promise<any> {
return dbContext.callExtension("runQuery",
`match (s:Taxonomy) where any(item in $ontologyNodeList where item = s.name)
`match (s:Ontology) where any(item in $ontologyNodeList where item = s.name)
return s.name, s.synonyms`, {
ontologyNodeList: ontologyNodeList
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment