mirror of
https://github.com/bwssytems/ha-bridge.git
synced 2025-12-19 08:28:46 +00:00
Add testing and error pop ups where needed.
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<groupId>com.bwssystems.HABridge</groupId>
|
<groupId>com.bwssystems.HABridge</groupId>
|
||||||
<artifactId>ha-bridge</artifactId>
|
<artifactId>ha-bridge</artifactId>
|
||||||
<version>0.4.6</version>
|
<version>0.4.7</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>HA Bridge</name>
|
<name>HA Bridge</name>
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
|
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
|
||||||
<li><a href="http://www.bwssystems.com" target="_blank">Developed by BWS Systems</a></li>
|
<li><a href="http://www.bwssystems.com" target="_blank">Developed by BWS Systems</a></li>
|
||||||
<li><a href="http://www.amazon.com/echo" target="_blank">Amazon Echo</a></li>
|
<li><a href="http://www.amazon.com/echo" target="_blank">Amazon Echo</a></li>
|
||||||
<li><a href="">HA Bridge Version 0.4.6</a></li>
|
<li><a href="">HA Bridge Version 0.4.7</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ app.factory('BridgeSettings', function() {
|
|||||||
return BridgeSettings;
|
return BridgeSettings;
|
||||||
});
|
});
|
||||||
|
|
||||||
app.service('bridgeService', function ($http, BridgeSettings) {
|
app.service('bridgeService', function ($http, $window, BridgeSettings) {
|
||||||
var self = this;
|
var self = this;
|
||||||
self.BridgeSettings = BridgeSettings;
|
self.BridgeSettings = BridgeSettings;
|
||||||
this.state = {base: window.location.origin + "/api/devices", upnpbase: window.location.origin + "/upnp/settings", devices: [], device: [], error: ""};
|
this.state = {base: window.location.origin + "/api/devices", upnpbase: window.location.origin + "/upnp/settings", devices: [], device: [], error: ""};
|
||||||
@@ -110,10 +110,9 @@ app.service('bridgeService', function ($http, BridgeSettings) {
|
|||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
if (error.data) {
|
if (error.data) {
|
||||||
self.state.error = error.data.message;
|
$window.alert("Load Bridge Settings Error: " + error.data.message);
|
||||||
} else {
|
} else {
|
||||||
self.state.error = "If you're not seeing any settings, you may be running into problems with CORS. " +
|
$window.alert("Load Bridge Settings Error: unknown");
|
||||||
"You can work around this by running a fresh launch of Chrome with the --disable-web-security flag.";
|
|
||||||
}
|
}
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
@@ -128,12 +127,10 @@ app.service('bridgeService', function ($http, BridgeSettings) {
|
|||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
if (error.data) {
|
if (error.data) {
|
||||||
self.state.error = error.data.message;
|
$window.alert("Get Vera Devices Error: " + error.data.message);
|
||||||
} else {
|
} else {
|
||||||
self.state.error = "If you're not seeing any address, you may be running into problems with CORS. " +
|
$window.alert("Get Vera Devices Error: unknown");
|
||||||
"You can work around this by running a fresh launch of Chrome with the --disable-web-security flag.";
|
|
||||||
}
|
}
|
||||||
console.log(error);
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -146,12 +143,10 @@ app.service('bridgeService', function ($http, BridgeSettings) {
|
|||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
if (error.data) {
|
if (error.data) {
|
||||||
self.state.error = error.data.message;
|
$window.alert("Get Vera Scenes Error: " + error.data.message);
|
||||||
} else {
|
} else {
|
||||||
self.state.error = "If you're not seeing any address, you may be running into problems with CORS. " +
|
$window.alert("Get Vera Scenes Error: unknown");
|
||||||
"You can work around this by running a fresh launch of Chrome with the --disable-web-security flag.";
|
|
||||||
}
|
}
|
||||||
console.log(error);
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -176,9 +171,9 @@ app.service('bridgeService', function ($http, BridgeSettings) {
|
|||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
if (error.data) {
|
if (error.data) {
|
||||||
self.state.error = error.data.message;
|
$window.alert("Edit Device Error: " + error.data.message);
|
||||||
}
|
}
|
||||||
console.log(error);
|
$window.alert("Edit Device Error: unknown");
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@@ -199,9 +194,9 @@ app.service('bridgeService', function ($http, BridgeSettings) {
|
|||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
if (error.data) {
|
if (error.data) {
|
||||||
self.state.error = error.data.message;
|
$window.alert("Add new Device Error: " + error.data.message);
|
||||||
}
|
}
|
||||||
console.log(error);
|
$window.alert("Add new Device Error: unknown");
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -217,7 +212,7 @@ app.service('bridgeService', function ($http, BridgeSettings) {
|
|||||||
if (error.data) {
|
if (error.data) {
|
||||||
self.state.error = error.data.message;
|
self.state.error = error.data.message;
|
||||||
}
|
}
|
||||||
console.log(error);
|
$window.alert("Delete Device Error: unknown");
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -227,7 +222,7 @@ app.service('bridgeService', function ($http, BridgeSettings) {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
app.controller('ViewingController', function ($scope, $location, $http, bridgeService, BridgeSettings) {
|
app.controller('ViewingController', function ($scope, $location, $http, $window, bridgeService, BridgeSettings) {
|
||||||
|
|
||||||
$scope.BridgeSettings = bridgeService.BridgeSettings;
|
$scope.BridgeSettings = bridgeService.BridgeSettings;
|
||||||
bridgeService.viewDevices();
|
bridgeService.viewDevices();
|
||||||
@@ -246,19 +241,19 @@ app.controller('ViewingController', function ($scope, $location, $http, bridgeSe
|
|||||||
if(device.httpVerb == "PUT")
|
if(device.httpVerb == "PUT")
|
||||||
$http.put(device.onUrl, device.contentBody).then(
|
$http.put(device.onUrl, device.contentBody).then(
|
||||||
function (response) {
|
function (response) {
|
||||||
$scope.responsedata = response.data;
|
$window.alert("Request Exceuted: " + response.statusText);
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
console.log(error);
|
$window.alert("Request Error: " + error.data.message);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
else if(device.httpVerb == "POST")
|
else if(device.httpVerb == "POST")
|
||||||
$http.post(device.onUrl, device.contentBody).then(
|
$http.post(device.onUrl, device.contentBody).then(
|
||||||
function (response) {
|
function (response) {
|
||||||
$scope.responsedata = response.data;
|
$window.alert("Request Exceuted: " + response.statusText);
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
console.log(error);
|
$window.alert("Request Error: " + error.data.message);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
else
|
else
|
||||||
@@ -268,19 +263,19 @@ app.controller('ViewingController', function ($scope, $location, $http, bridgeSe
|
|||||||
if(device.httpVerb == "PUT")
|
if(device.httpVerb == "PUT")
|
||||||
$http.put(device.offUrl, device.contentBodyOff).then(
|
$http.put(device.offUrl, device.contentBodyOff).then(
|
||||||
function (response) {
|
function (response) {
|
||||||
$scope.responsedata = response.data;
|
$window.alert("Request Exceuted: " + response.statusText);
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
console.log(error);
|
$window.alert("Request Error: " + error.data.message);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
else if(device.httpVerb == "POST")
|
else if(device.httpVerb == "POST")
|
||||||
$http.post(device.offUrl, device.contentBody).then(
|
$http.post(device.offUrl, device.contentBody).then(
|
||||||
function (response) {
|
function (response) {
|
||||||
$scope.responsedata = response.data;
|
$window.alert("Request Exceuted: " + response.statusText);
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
console.log(error);
|
$window.alert("Request Error: " + error.data.message);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
else
|
else
|
||||||
@@ -372,19 +367,19 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer
|
|||||||
if(device.httpVerb == "PUT")
|
if(device.httpVerb == "PUT")
|
||||||
$http.put(device.onUrl, device.contentBody).then(
|
$http.put(device.onUrl, device.contentBody).then(
|
||||||
function (response) {
|
function (response) {
|
||||||
$scope.responsedata = response.data;
|
$window.alert("Request Exceuted: " + response.statusText);
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
console.log(error);
|
$window.alert("Request Error: " + error.data.message);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
else if(device.httpVerb == "POST")
|
else if(device.httpVerb == "POST")
|
||||||
$http.post(device.onUrl, device.contentBody).then(
|
$http.post(device.onUrl, device.contentBody).then(
|
||||||
function (response) {
|
function (response) {
|
||||||
$scope.responsedata = response.data;
|
$window.alert("Request Exceuted: " + response.statusText);
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
console.log(error);
|
$window.alert("Request Error: " + error.data.message);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
else
|
else
|
||||||
@@ -394,19 +389,19 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer
|
|||||||
if(device.httpVerb == "PUT")
|
if(device.httpVerb == "PUT")
|
||||||
$http.put(device.offUrl, device.contentBodyOff).then(
|
$http.put(device.offUrl, device.contentBodyOff).then(
|
||||||
function (response) {
|
function (response) {
|
||||||
$scope.responsedata = response.data;
|
$window.alert("Request Exceuted: " + response.statusText);
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
console.log(error);
|
$window.alert("Request Error: " + error.data.message);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
else if(device.httpVerb == "POST")
|
else if(device.httpVerb == "POST")
|
||||||
$http.post(device.offUrl, device.contentBody).then(
|
$http.post(device.offUrl, device.contentBody).then(
|
||||||
function (response) {
|
function (response) {
|
||||||
$scope.responsedata = response.data;
|
$window.alert("Request Exceuted: " + response.statusText);
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
console.log(error);
|
$window.alert("Request Error: " + error.data.message);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user