From 02d6e77bd180cbbf6f7f6e1a69c670e922d8204d Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sat, 31 Oct 2015 12:04:28 +0100 Subject: web: o Starting on edit button for device name. --- web/static/app/DillerRpc.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'web/static/app/DillerRpc.js') diff --git a/web/static/app/DillerRpc.js b/web/static/app/DillerRpc.js index de90aee..b1939f4 100644 --- a/web/static/app/DillerRpc.js +++ b/web/static/app/DillerRpc.js @@ -16,6 +16,15 @@ function DillerRpc($http, DillerConfig) { return $http(req); } + function patchDevice(deviceId, payload) { + var req = {}; + req.method = 'patch'; + req.url = baseUrl + '/api/device/:deviceId'; + req.url = req.url.replace(/:deviceId/, deviceId); + req.data = payload; + return $http(req); + } + function getValues(propertyId) { var req = {}; req.method = 'get'; @@ -27,6 +36,7 @@ function DillerRpc($http, DillerConfig) { return { getDevices: getDevices, getDevice: getDevice, + patchDevice: patchDevice, getValues: getValues }; } @@ -38,6 +48,9 @@ DillerRpcResolve.getDevices = function(DillerRpc) { DillerRpcResolve.getDevice = function(DillerRpc, $route) { return DillerRpc.getDevice($route.current.params.deviceId); }; +DillerRpcResolve.patchDevice = function(DillerRpc, $route) { + return DillerRpc.patchDevice($route.current.params.deviceId, $route.current.params.payload); +}; DillerRpcResolve.getValues = function(DillerRpc, $route) { return DillerRpc.getValues($route.current.params.propertyId); }; -- cgit v1.2.3