Merge branch 'log-fix' into 'dev'
Cleaned logs across repository See merge request sa4-2020/the-sanmarinoes/frontend!112
This commit is contained in:
commit
2c298ec4bb
5 changed files with 2 additions and 22 deletions
|
@ -71,6 +71,7 @@ const Automation = ({ automation, devices, scenes, removeAutomation }) => {
|
||||||
const sceneData = scenes.filter(
|
const sceneData = scenes.filter(
|
||||||
(s) => s.id === sp.sceneId
|
(s) => s.id === sp.sceneId
|
||||||
)[0];
|
)[0];
|
||||||
|
if (!sceneData) return "";
|
||||||
return (
|
return (
|
||||||
<Menu key={sceneData.id} compact>
|
<Menu key={sceneData.id} compact>
|
||||||
<Menu.Item as="span">{sceneData.name}</Menu.Item>
|
<Menu.Item as="span">{sceneData.name}</Menu.Item>
|
||||||
|
|
|
@ -63,7 +63,6 @@ class NewSceneDevice extends Component {
|
||||||
|
|
||||||
createState() {
|
createState() {
|
||||||
for (let i = 0; i < this.state.devicesAttached.length; i++) {
|
for (let i = 0; i < this.state.devicesAttached.length; i++) {
|
||||||
console.log("DIOPORCO", i, this.state.devicesAttached[i]);
|
|
||||||
let device = this.props.devices.filter(
|
let device = this.props.devices.filter(
|
||||||
(e) => this.state.devicesAttached[i] === e.id
|
(e) => this.state.devicesAttached[i] === e.id
|
||||||
);
|
);
|
||||||
|
|
|
@ -12,7 +12,6 @@ class ScenesPanel extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
applyScene() {
|
applyScene() {
|
||||||
console.log(this.props.activeScene);
|
|
||||||
this.props
|
this.props
|
||||||
.sceneApply(this.props.activeScene)
|
.sceneApply(this.props.activeScene)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
|
|
@ -301,7 +301,6 @@ function reducer(previousState, action) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "AUTOMATION_SAVE":
|
case "AUTOMATION_SAVE":
|
||||||
console.log("ID: ", action.automation.id);
|
|
||||||
change = {
|
change = {
|
||||||
automations: { [action.automation.id]: { $set: action.automation } },
|
automations: { [action.automation.id]: { $set: action.automation } },
|
||||||
};
|
};
|
||||||
|
@ -316,7 +315,6 @@ function reducer(previousState, action) {
|
||||||
};
|
};
|
||||||
|
|
||||||
if (previousState.scenes[action.sceneState.sceneId]) {
|
if (previousState.scenes[action.sceneState.sceneId]) {
|
||||||
console.log("PREVSTATE", change, previousState);
|
|
||||||
change.scenes = {
|
change.scenes = {
|
||||||
[action.sceneState.sceneId]: {
|
[action.sceneState.sceneId]: {
|
||||||
sceneStates: {
|
sceneStates: {
|
||||||
|
@ -334,7 +332,6 @@ function reducer(previousState, action) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
newState = update(previousState, change);
|
newState = update(previousState, change);
|
||||||
console.log("NEWSTATE ", newState);
|
|
||||||
break;
|
break;
|
||||||
case "ROOM_DELETE":
|
case "ROOM_DELETE":
|
||||||
if (!(action.roomId in previousState.rooms)) {
|
if (!(action.roomId in previousState.rooms)) {
|
||||||
|
@ -365,13 +362,9 @@ function reducer(previousState, action) {
|
||||||
automations: { $unset: [action.id] },
|
automations: { $unset: [action.id] },
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log("CHANGE ", change);
|
|
||||||
console.log("Action id: ", action.id);
|
|
||||||
newState = update(previousState, change);
|
newState = update(previousState, change);
|
||||||
console.log("NEW STATE ", newState);
|
|
||||||
break;
|
break;
|
||||||
case "SCENE_DELETE":
|
case "SCENE_DELETE":
|
||||||
console.log("SCENE", action.sceneId);
|
|
||||||
if (!(action.sceneId in previousState.scenes)) {
|
if (!(action.sceneId in previousState.scenes)) {
|
||||||
console.warn(`Scene to delete ${action.sceneId} does not exist`);
|
console.warn(`Scene to delete ${action.sceneId} does not exist`);
|
||||||
break;
|
break;
|
||||||
|
@ -417,15 +410,6 @@ function reducer(previousState, action) {
|
||||||
newState = update(previousState, change);
|
newState = update(previousState, change);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "SCENE_APPLY":
|
|
||||||
console.log(action);
|
|
||||||
//checking that the scene actually exists
|
|
||||||
/*if (!(action.sceneId in previousState.scenes)) {
|
|
||||||
console.warn(`Scene ${action.sceneId} does not exist`);
|
|
||||||
break;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
break;
|
|
||||||
case "DEVICE_DELETE":
|
case "DEVICE_DELETE":
|
||||||
if (!(action.deviceId in previousState.devices)) {
|
if (!(action.deviceId in previousState.devices)) {
|
||||||
console.warn(`Device to delete ${action.deviceId} does not exist`);
|
console.warn(`Device to delete ${action.deviceId} does not exist`);
|
||||||
|
@ -487,6 +471,7 @@ function reducer(previousState, action) {
|
||||||
break;
|
break;
|
||||||
case "REDUX_WEBSOCKET::MESSAGE":
|
case "REDUX_WEBSOCKET::MESSAGE":
|
||||||
const devices = JSON.parse(action.payload.message);
|
const devices = JSON.parse(action.payload.message);
|
||||||
|
//console.log("socket", JSON.stringify(devices, null, 2));
|
||||||
|
|
||||||
newState = reducer(previousState, {
|
newState = reducer(previousState, {
|
||||||
type: "DEVICES_UPDATE",
|
type: "DEVICES_UPDATE",
|
||||||
|
|
|
@ -62,10 +62,6 @@ const actions = {
|
||||||
type: "STATE_DELETE",
|
type: "STATE_DELETE",
|
||||||
stateId,
|
stateId,
|
||||||
}),
|
}),
|
||||||
sceneApply: (sceneId) => ({
|
|
||||||
type: "SCENE_APPLY",
|
|
||||||
sceneId,
|
|
||||||
}),
|
|
||||||
deviceOperationUpdate: (devices) => ({
|
deviceOperationUpdate: (devices) => ({
|
||||||
type: "DEVICES_UPDATE",
|
type: "DEVICES_UPDATE",
|
||||||
devices,
|
devices,
|
||||||
|
|
Loading…
Reference in a new issue