mirror of
https://github.com/bwssytems/ha-bridge.git
synced 2025-12-19 00:20:26 +00:00
update ui components.
This commit is contained in:
4
pom.xml
4
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>1.3.8e</version>
|
<version>1.3.8f</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>HA Bridge</name>
|
<name>HA Bridge</name>
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.bwssytems</groupId>
|
<groupId>com.github.bwssytems</groupId>
|
||||||
<artifactId>nest-controller</artifactId>
|
<artifactId>nest-controller</artifactId>
|
||||||
<version>1.0.3</version>
|
<version>1.0.4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.sparkjava</groupId>
|
<groupId>com.sparkjava</groupId>
|
||||||
|
|||||||
@@ -41,38 +41,30 @@ app.run( function (bridgeService) {
|
|||||||
|
|
||||||
app.service('bridgeService', function ($http, $window, ngToast) {
|
app.service('bridgeService', function ($http, $window, ngToast) {
|
||||||
var self = this;
|
var self = this;
|
||||||
this.state = {base: window.location.origin + "/api/devices", systemsbase: window.location.origin + "/system", huebase: window.location.origin + "/api", configs: [], backups: [], devices: [], device: [], settings: [], olddevicename: "", error: "", showVera: false, showHarmony: false, showNest: false, habridgeversion: ""};
|
this.state = {base: window.location.origin + "/api/devices", bridgelocation: window.location.origin, systemsbase: window.location.origin + "/system", huebase: window.location.origin + "/api", configs: [], backups: [], devices: [], device: [], settings: [], myToastMsg: [], olddevicename: "", showVera: false, showHarmony: false, showNest: false, habridgeversion: ""};
|
||||||
|
|
||||||
this.viewDevices = function () {
|
this.viewDevices = function () {
|
||||||
this.state.error = "";
|
|
||||||
return $http.get(this.state.base).then(
|
return $http.get(this.state.base).then(
|
||||||
function (response) {
|
function (response) {
|
||||||
self.state.devices = response.data;
|
self.state.devices = response.data;
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
if (error.data) {
|
ngToast.create({
|
||||||
self.state.error = error.data.message;
|
className: "warning",
|
||||||
} else {
|
content:"Cannot get devices from habridge: " + "unknown error" || error.data.message + " with status: " + error.status});
|
||||||
self.state.error = "Some error occurred.";
|
|
||||||
}
|
|
||||||
console.log(error);
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getHABridgeVersion = function () {
|
this.getHABridgeVersion = function () {
|
||||||
this.state.error = "";
|
|
||||||
return $http.get(this.state.systemsbase + "/habridge/version").then(
|
return $http.get(this.state.systemsbase + "/habridge/version").then(
|
||||||
function (response) {
|
function (response) {
|
||||||
self.state.habridgeversion = response.data.version;
|
self.state.habridgeversion = response.data.version;
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
if (error.data) {
|
ngToast.create({
|
||||||
self.state.error = error.data.message;
|
className: "warning",
|
||||||
} else {
|
content:"Cannot get version" + "unknown error" || error.data.message + " with status: " + error.status});
|
||||||
self.state.error = "cannot get version";
|
|
||||||
}
|
|
||||||
console.log(error);
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -96,9 +88,7 @@ app.service('bridgeService', function ($http, $window, ngToast) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.loadBridgeSettings = function () {
|
this.loadBridgeSettings = function () {
|
||||||
this.state.error = "";
|
|
||||||
return $http.get(this.state.systemsbase + "/settings").then(
|
return $http.get(this.state.systemsbase + "/settings").then(
|
||||||
function (response) {
|
function (response) {
|
||||||
self.state.settings = response.data;
|
self.state.settings = response.data;
|
||||||
@@ -107,50 +97,40 @@ app.service('bridgeService', function ($http, $window, ngToast) {
|
|||||||
self.updateShowNest();
|
self.updateShowNest();
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
if (error.data) {
|
ngToast.create({
|
||||||
$window.alert("Load Bridge Settings Error: " + error.data.message);
|
className: "warning",
|
||||||
} else {
|
content:"Load Bridge Settings Error: " + "unknown error" || error.data.message + " with status: " + error.status});
|
||||||
$window.alert("Load Bridge Settings Error: unknown");
|
|
||||||
}
|
|
||||||
console.log(error);
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.viewBackups = function () {
|
this.viewBackups = function () {
|
||||||
this.state.error = "";
|
|
||||||
return $http.get(this.state.base + "/backup/available").then(
|
return $http.get(this.state.base + "/backup/available").then(
|
||||||
function (response) {
|
function (response) {
|
||||||
self.state.backups = response.data;
|
self.state.backups = response.data;
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
if (error.data) {
|
ngToast.create({
|
||||||
$window.alert("Get Backups Error: " + error.data.message);
|
className: "warning",
|
||||||
} else {
|
content:"Get Backups Error: " + "unknown error" || error.data.message + " with status: " + error.status});
|
||||||
$window.alert("Get Backups Error: unknown");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.viewConfigs = function () {
|
this.viewConfigs = function () {
|
||||||
this.state.error = "";
|
|
||||||
return $http.get(this.state.systemsbase + "/backup/available").then(
|
return $http.get(this.state.systemsbase + "/backup/available").then(
|
||||||
function (response) {
|
function (response) {
|
||||||
self.state.configs = response.data;
|
self.state.configs = response.data;
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
if (error.data) {
|
ngToast.create({
|
||||||
$window.alert("Get Configs Error: " + error.data.message);
|
className: "warning",
|
||||||
} else {
|
content:"Get Configs Error: " + "unknown error" || error.data.message + " with status: " + error.status});
|
||||||
$window.alert("Get Configs Error: unknown");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.viewNestItems = function () {
|
this.viewNestItems = function () {
|
||||||
this.state.error = "";
|
|
||||||
if(!this.state.showNest)
|
if(!this.state.showNest)
|
||||||
return;
|
return;
|
||||||
return $http.get(this.state.base + "/nest/items").then(
|
return $http.get(this.state.base + "/nest/items").then(
|
||||||
@@ -158,17 +138,14 @@ app.service('bridgeService', function ($http, $window, ngToast) {
|
|||||||
self.state.nestitems = response.data;
|
self.state.nestitems = response.data;
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
if (error.data) {
|
ngToast.create({
|
||||||
$window.alert("Get Nest Items Error: " + error.data.message);
|
className: "warning",
|
||||||
} else {
|
content:"Get Nest Items Error: " + "unknown error" || error.data.message + " with status: " + error.status});
|
||||||
$window.alert("Get Nest Items Error: unknown");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.viewVeraDevices = function () {
|
this.viewVeraDevices = function () {
|
||||||
this.state.error = "";
|
|
||||||
if(!this.state.showVera)
|
if(!this.state.showVera)
|
||||||
return;
|
return;
|
||||||
return $http.get(this.state.base + "/vera/devices").then(
|
return $http.get(this.state.base + "/vera/devices").then(
|
||||||
@@ -176,17 +153,14 @@ app.service('bridgeService', function ($http, $window, ngToast) {
|
|||||||
self.state.veradevices = response.data;
|
self.state.veradevices = response.data;
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
if (error.data) {
|
ngToast.create({
|
||||||
$window.alert("Get Vera Devices Error: " + error.data.message);
|
className: "warning",
|
||||||
} else {
|
content:"Get Vera Devices Error: " + "unknown error" || error.data.message + " with status: " + error.status});
|
||||||
$window.alert("Get Vera Devices Error: unknown");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.viewVeraScenes = function () {
|
this.viewVeraScenes = function () {
|
||||||
this.state.error = "";
|
|
||||||
if(!this.state.showVera)
|
if(!this.state.showVera)
|
||||||
return;
|
return;
|
||||||
return $http.get(this.state.base + "/vera/scenes").then(
|
return $http.get(this.state.base + "/vera/scenes").then(
|
||||||
@@ -194,17 +168,14 @@ app.service('bridgeService', function ($http, $window, ngToast) {
|
|||||||
self.state.verascenes = response.data;
|
self.state.verascenes = response.data;
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
if (error.data) {
|
ngToast.create({
|
||||||
$window.alert("Get Vera Scenes Error: " + error.data.message);
|
className: "warning",
|
||||||
} else {
|
content:"Get Vera Scenes Error: " + "unknown error" || error.data.message + " with status: " + error.status});
|
||||||
$window.alert("Get Vera Scenes Error: unknown");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.viewHarmonyActivities = function () {
|
this.viewHarmonyActivities = function () {
|
||||||
this.state.error = "";
|
|
||||||
if(!this.state.showHarmony)
|
if(!this.state.showHarmony)
|
||||||
return;
|
return;
|
||||||
return $http.get(this.state.base + "/harmony/activities").then(
|
return $http.get(this.state.base + "/harmony/activities").then(
|
||||||
@@ -212,17 +183,14 @@ app.service('bridgeService', function ($http, $window, ngToast) {
|
|||||||
self.state.harmonyactivities = response.data;
|
self.state.harmonyactivities = response.data;
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
if (error.data) {
|
ngToast.create({
|
||||||
$window.alert("Get Harmony Activities Error: " + error.data.message);
|
className: "warning",
|
||||||
} else {
|
content:"Get Harmony Activities Error: " + "unknown error" || error.data.message + " with status: " + error.status});
|
||||||
$window.alert("Get Harmony Activities Error: unknown");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.viewHarmonyDevices = function () {
|
this.viewHarmonyDevices = function () {
|
||||||
this.state.error = "";
|
|
||||||
if(!this.state.showHarmony)
|
if(!this.state.showHarmony)
|
||||||
return;
|
return;
|
||||||
return $http.get(this.state.base + "/harmony/devices").then(
|
return $http.get(this.state.base + "/harmony/devices").then(
|
||||||
@@ -230,11 +198,9 @@ app.service('bridgeService', function ($http, $window, ngToast) {
|
|||||||
self.state.harmonydevices = response.data;
|
self.state.harmonydevices = response.data;
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
if (error.data) {
|
ngToast.create({
|
||||||
$window.alert("Get Harmony Devices Error: " + error.data.message);
|
className: "warning",
|
||||||
} else {
|
content:"Get Harmony Devices Error: " + "unknown error" || error.data.message + " with status: " + error.status});
|
||||||
$window.alert("Get Harmony Devices Error: unknown");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -256,21 +222,18 @@ app.service('bridgeService', function ($http, $window, ngToast) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.bulkAddDevice = function (devices) {
|
this.bulkAddDevice = function (devices) {
|
||||||
this.state.error = "";
|
|
||||||
return $http.post(this.state.base, devices).then(
|
return $http.post(this.state.base, devices).then(
|
||||||
function (response) {
|
function (response) {
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
if (error.data) {
|
ngToast.create({
|
||||||
$window.alert("Bulk Add new Device Error: " + error.data.message);
|
className: "warning",
|
||||||
}
|
content:"Bulk Add new Device Error: " + "unknown error" || error.data.message + " with status: " + error.status});
|
||||||
self.state.error = "Bulk Add new Device Error: unknown";
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.addDevice = function (device) {
|
this.addDevice = function (device) {
|
||||||
this.state.error = "";
|
|
||||||
if(device.httpVerb != null && device.httpVerb != "")
|
if(device.httpVerb != null && device.httpVerb != "")
|
||||||
device.deviceType = "custom";
|
device.deviceType = "custom";
|
||||||
if(device.targetDevice == null || device.targetDevice == "")
|
if(device.targetDevice == null || device.targetDevice == "")
|
||||||
@@ -294,10 +257,9 @@ app.service('bridgeService', function ($http, $window, ngToast) {
|
|||||||
function (response) {
|
function (response) {
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
if (error.data) {
|
ngToast.create({
|
||||||
$window.alert("Edit Device Error: " + error.data.message);
|
className: "warning",
|
||||||
}
|
content:"Edit Device Error: " + "unknown error" || error.data.message + " with status: " + error.status});
|
||||||
$window.alert("Edit Device Error: unknown");
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@@ -319,17 +281,15 @@ app.service('bridgeService', function ($http, $window, ngToast) {
|
|||||||
function (response) {
|
function (response) {
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
if (error.data) {
|
ngToast.create({
|
||||||
$window.alert("Add new Device Error: " + error.data.message);
|
className: "warning",
|
||||||
}
|
content:"Add new Device Error: " + "unknown error" || error.data.message + " with status: " + error.status});
|
||||||
self.state.error = "Add new Device Error: unknown";
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.backupDeviceDb = function (afilename) {
|
this.backupDeviceDb = function (afilename) {
|
||||||
this.state.error = "";
|
|
||||||
return $http.put(this.state.base + "/backup/create", {
|
return $http.put(this.state.base + "/backup/create", {
|
||||||
filename: afilename
|
filename: afilename
|
||||||
}).then(
|
}).then(
|
||||||
@@ -337,16 +297,14 @@ app.service('bridgeService', function ($http, $window, ngToast) {
|
|||||||
self.viewBackups();
|
self.viewBackups();
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
if (error.data) {
|
ngToast.create({
|
||||||
self.state.error = error.data.message;
|
className: "warning",
|
||||||
}
|
content:"Backup Device Db Error: " + "unknown error" || error.data.message + " with status: " + error.status});
|
||||||
self.state.error = "Backup Device Db Error: unknown";
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.restoreBackup = function (afilename) {
|
this.restoreBackup = function (afilename) {
|
||||||
this.state.error = "";
|
|
||||||
return $http.post(this.state.base + "/backup/restore", {
|
return $http.post(this.state.base + "/backup/restore", {
|
||||||
filename: afilename
|
filename: afilename
|
||||||
}).then(
|
}).then(
|
||||||
@@ -355,16 +313,14 @@ app.service('bridgeService', function ($http, $window, ngToast) {
|
|||||||
self.viewDevices();
|
self.viewDevices();
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
if (error.data) {
|
ngToast.create({
|
||||||
self.state.error = error.data.message;
|
className: "warning",
|
||||||
}
|
content:"Backup Db Restore Error: " + "unknown error" || error.data.message + " with status: " + error.status});
|
||||||
self.state.error = "Backup Db Restore Error: unknown";
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.deleteBackup = function (afilename) {
|
this.deleteBackup = function (afilename) {
|
||||||
this.state.error = "";
|
|
||||||
return $http.post(this.state.base + "/backup/delete", {
|
return $http.post(this.state.base + "/backup/delete", {
|
||||||
filename: afilename
|
filename: afilename
|
||||||
}).then(
|
}).then(
|
||||||
@@ -372,32 +328,81 @@ app.service('bridgeService', function ($http, $window, ngToast) {
|
|||||||
self.viewBackups();
|
self.viewBackups();
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
if (error.data) {
|
ngToast.create({
|
||||||
self.state.error = error.data.message;
|
className: "warning",
|
||||||
|
content:"Delete Backup Db File Error:" + "unknown error" || error.data.message + " with status: " + error.status});
|
||||||
}
|
}
|
||||||
self.state.error = "Delete Backup Db File Error: unknown";
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.checkForBridge = function () {
|
||||||
|
return $http.get(this.state.bridgelocation + "/description.xml").then(
|
||||||
|
function (response) {
|
||||||
|
ngToast.dismiss(self.state.myToastMsg);
|
||||||
|
self.viewConfigs();
|
||||||
|
self.state.myToastMsg = null;
|
||||||
|
},
|
||||||
|
function (error) {
|
||||||
|
setTimeout(function(){
|
||||||
|
self.checkForBridge();
|
||||||
|
}, 2000);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
this.stop = function() {
|
||||||
|
return $http.put(this.state.systemsbase + "/control/stop").then(
|
||||||
|
function (response) {
|
||||||
|
ngToast.create({
|
||||||
|
className: "danger",
|
||||||
|
dismissButton: true,
|
||||||
|
dismissOnTimeout: false,
|
||||||
|
content:"HABridge is now stopped. Restart must occur from the server."});
|
||||||
|
},
|
||||||
|
function (error) {
|
||||||
|
ngToast.create({
|
||||||
|
className: "warning",
|
||||||
|
content:"HABRidge Stop Error: " + "unknown error" || error.data.message + " with status: " + error.status});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.reinit = function() {
|
||||||
|
return $http.put(this.state.systemsbase + "/control/reinit").then(
|
||||||
|
function (response) {
|
||||||
|
self.state.myToastMsg = ngToast.create({
|
||||||
|
className: "warning",
|
||||||
|
dismissButton: false,
|
||||||
|
dismissOnTimeout: false,
|
||||||
|
content:"HABridge is re-initializing, waiting for completion..."});
|
||||||
|
setTimeout(function(){
|
||||||
|
self.checkForBridge();
|
||||||
|
}, 2000);
|
||||||
|
},
|
||||||
|
function (error) {
|
||||||
|
ngToast.create({
|
||||||
|
className: "warning",
|
||||||
|
content:"HABRidge Reinit Error: " + "unknown error" || error.data.message + " with status: " + error.status});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.saveSettings = function () {
|
this.saveSettings = function () {
|
||||||
this.state.error = "";
|
|
||||||
return $http.put(this.state.systemsbase + "/settings", this.state.settings).then(
|
return $http.put(this.state.systemsbase + "/settings", this.state.settings).then(
|
||||||
function (response) {
|
function (response) {
|
||||||
self.viewConfigs();
|
self.reinit();
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
if (error.data) {
|
ngToast.create({
|
||||||
self.state.error = error.data.message;
|
className: "warning",
|
||||||
}
|
content:"Save Settings Error: " + "unknown error" || error.data.message + " with status: " + error.status});
|
||||||
self.state.error = "Save Settings Error: unknown";
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.backupSettings = function (afilename) {
|
this.backupSettings = function (afilename) {
|
||||||
this.state.error = "";
|
|
||||||
return $http.put(this.state.systemsbase + "/backup/create", {
|
return $http.put(this.state.systemsbase + "/backup/create", {
|
||||||
filename: afilename
|
filename: afilename
|
||||||
}).then(
|
}).then(
|
||||||
@@ -405,16 +410,14 @@ app.service('bridgeService', function ($http, $window, ngToast) {
|
|||||||
self.viewConfigs();
|
self.viewConfigs();
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
if (error.data) {
|
ngToast.create({
|
||||||
self.state.error = error.data.message;
|
className: "warning",
|
||||||
}
|
content:"Backup Settings Error: " + "unknown error" || error.data.message + " with status: " + error.status});
|
||||||
self.state.error = "Backup Settings Error: unknown";
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.restoreSettings = function (afilename) {
|
this.restoreSettings = function (afilename) {
|
||||||
this.state.error = "";
|
|
||||||
return $http.post(this.state.systemsbase + "/backup/restore", {
|
return $http.post(this.state.systemsbase + "/backup/restore", {
|
||||||
filename: afilename
|
filename: afilename
|
||||||
}).then(
|
}).then(
|
||||||
@@ -423,16 +426,14 @@ app.service('bridgeService', function ($http, $window, ngToast) {
|
|||||||
self.viewDevices();
|
self.viewDevices();
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
if (error.data) {
|
ngToast.create({
|
||||||
self.state.error = error.data.message;
|
className: "warning",
|
||||||
}
|
content:"Backup Settings Restore Error: " + "unknown error" || error.data.message + " with status: " + error.status});
|
||||||
self.state.error = "Backup Settings Restore Error: unknown";
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.deleteSettingsBackup = function (afilename) {
|
this.deleteSettingsBackup = function (afilename) {
|
||||||
this.state.error = "";
|
|
||||||
return $http.post(this.state.systemsbase + "/backup/delete", {
|
return $http.post(this.state.systemsbase + "/backup/delete", {
|
||||||
filename: afilename
|
filename: afilename
|
||||||
}).then(
|
}).then(
|
||||||
@@ -440,25 +441,22 @@ app.service('bridgeService', function ($http, $window, ngToast) {
|
|||||||
self.viewConfigs();
|
self.viewConfigs();
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
if (error.data) {
|
ngToast.create({
|
||||||
self.state.error = error.data.message;
|
className: "warning",
|
||||||
}
|
content:"Delete Backup Settings File Error: " + "unknown error" || error.data.message + " with status: " + error.status});
|
||||||
self.state.error = "Delete Backup Settings File Error: unknown";
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.deleteDevice = function (id) {
|
this.deleteDevice = function (id) {
|
||||||
this.state.error = "";
|
|
||||||
return $http.delete(this.state.base + "/" + id).then(
|
return $http.delete(this.state.base + "/" + id).then(
|
||||||
function (response) {
|
function (response) {
|
||||||
self.viewDevices();
|
self.viewDevices();
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
if (error.data) {
|
ngToast.create({
|
||||||
self.state.error = error.data.message;
|
className: "warning",
|
||||||
}
|
content:"Delete Device Error: " + "unknown error" || error.data.message + " with status: " + error.status});
|
||||||
self.state.error = "Delete Device Error: unknown";
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -521,8 +519,39 @@ app.controller('SystemController', function ($scope, $location, $http, $window,
|
|||||||
if($scope.bridge.settings.veraddress == null) {
|
if($scope.bridge.settings.veraddress == null) {
|
||||||
$scope.bridge.settings.veraddress = { devices: [] };
|
$scope.bridge.settings.veraddress = { devices: [] };
|
||||||
}
|
}
|
||||||
|
var newVera = {name: newveraname, ip: newveraip }
|
||||||
$scope.bridge.settings.veraaddress.devices.push("{" +"\"name\":\"" + newveraname +"\",\"ip\":\"" + newveraip + "\"}");
|
$scope.bridge.settings.veraaddress.devices.push(newVera);
|
||||||
|
$scope.newveraname = null;
|
||||||
|
$scope.newveraip = null;
|
||||||
|
};
|
||||||
|
$scope.removeVeratoSettings = function (veraname, veraip) {
|
||||||
|
for(var i = $scope.bridge.settings.veraaddress.devices.length - 1; i >= 0; i--) {
|
||||||
|
if($scope.bridge.settings.veraaddress.devices[i].name === veraname && $scope.bridge.settings.veraaddress.devices[i].ip === veraip) {
|
||||||
|
$scope.bridge.settings.veraaddress.devices.splice(i, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
$scope.addHarmonytoSettings = function (newharmonyname, newharmonyip) {
|
||||||
|
if($scope.bridge.settings.harmonyaddress == null) {
|
||||||
|
$scope.bridge.settings.harmonyaddress = { devices: [] };
|
||||||
|
}
|
||||||
|
var newharmony = {name: newharmonyname, ip: newharmonyip }
|
||||||
|
$scope.bridge.settings.harmonyaddress.devices.push(newharmony);
|
||||||
|
$scope.newharmonyname = null;
|
||||||
|
$scope.newharmonyip = null;
|
||||||
|
};
|
||||||
|
$scope.removeHarmonytoSettings = function (harmonyname, harmonyip) {
|
||||||
|
for(var i = $scope.bridge.settings.harmonyaddress.devices.length - 1; i >= 0; i--) {
|
||||||
|
if($scope.bridge.settings.harmonyaddress.devices[i].name === harmonyname && $scope.bridge.settings.harmonyaddress.devices[i].ip === harmonyip) {
|
||||||
|
$scope.bridge.settings.harmonyaddress.devices.splice(i, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
$scope.bridgeReinit = function () {
|
||||||
|
bridgeService.reinit();
|
||||||
|
};
|
||||||
|
$scope.bridgeStop = function () {
|
||||||
|
bridgeService.stop();
|
||||||
};
|
};
|
||||||
$scope.saveSettings = function() {
|
$scope.saveSettings = function() {
|
||||||
bridgeService.saveSettings();
|
bridgeService.saveSettings();
|
||||||
@@ -650,7 +679,7 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer
|
|||||||
$scope.device.contentBodyOff = null;
|
$scope.device.contentBodyOff = null;
|
||||||
$scope.bridge.olddevicename = "";
|
$scope.bridge.olddevicename = "";
|
||||||
};
|
};
|
||||||
|
$scope.clearDevice();
|
||||||
$scope.buildUrlsUsingDevice = function (dim_control) {
|
$scope.buildUrlsUsingDevice = function (dim_control) {
|
||||||
if ($scope.vera.base.indexOf("http") < 0) {
|
if ($scope.vera.base.indexOf("http") < 0) {
|
||||||
$scope.vera.base = "http://" + $scope.vera.base;
|
$scope.vera.base = "http://" + $scope.vera.base;
|
||||||
@@ -720,7 +749,7 @@ app.controller('AddingController', function ($scope, $location, $http, bridgeSer
|
|||||||
$scope.device.onUrl = "http://" + verascene.veraaddress + ":" + $scope.vera.port
|
$scope.device.onUrl = "http://" + verascene.veraaddress + ":" + $scope.vera.port
|
||||||
+ "/data_request?id=action&output_format=json&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=RunScene&SceneNum="
|
+ "/data_request?id=action&output_format=json&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=RunScene&SceneNum="
|
||||||
+ verascene.id;
|
+ verascene.id;
|
||||||
$scope.device.offUrl = "http://" + verascene.veraaddress + + ":" + $scope.vera.port
|
$scope.device.offUrl = "http://" + verascene.veraaddress + ":" + $scope.vera.port
|
||||||
+ "/data_request?id=action&output_format=json&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=RunScene&SceneNum="
|
+ "/data_request?id=action&output_format=json&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=RunScene&SceneNum="
|
||||||
+ verascene.id;
|
+ verascene.id;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -44,6 +44,14 @@
|
|||||||
ng-click="goBridgeUrl(bridge.base)">Go</button>
|
ng-click="goBridgeUrl(bridge.base)">Go</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
<p>
|
||||||
|
<button class="btn btn-success" type="submit"
|
||||||
|
ng-click="saveSettings()">Save</button>
|
||||||
|
<button class="btn btn-warning" type="submit"
|
||||||
|
ng-click="bridgeReinit()">Bridge Reinitialize</button>
|
||||||
|
<button class="btn btn-danger" type="submit"
|
||||||
|
ng-click="bridgeStop()">Bridge Stop</button>
|
||||||
|
</p>
|
||||||
<table class="table table-bordered table-striped table-hover">
|
<table class="table table-bordered table-striped table-hover">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -171,10 +179,6 @@
|
|||||||
ng-true-value=true ng-false-value=false> {{bridge.settings.devmode}}</td>
|
ng-true-value=true ng-false-value=false> {{bridge.settings.devmode}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<p>
|
|
||||||
<button class="btn btn-success" type="submit"
|
|
||||||
ng-click="saveSettings()">Save</button>
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel panel-default backup">
|
<div class="panel panel-default backup">
|
||||||
|
|||||||
Reference in New Issue
Block a user