Commit df63ef63 authored by Johan Ström's avatar Johan Ström

html: fix edit of room name

parent fd96d1d5
......@@ -16,7 +16,7 @@ function DeviceConfig(agocontrol)
for ( var i = 0; i < self.agocontrol.devices().length; i++)
{
var dev = self.agocontrol.devices()[i];
if (dev.room)
if (dev.roomUID)
{
if( !tagMap["room_" + dev.room] )
{
......
......@@ -580,6 +580,7 @@ Agocontrol.prototype = {
{
var room = inv.rooms[uuid];
room.uuid = uuid;
room.name = ko.observable(room.name);
room.action = ''; //dummy for datatables
self.rooms.push(room);
}
......@@ -615,7 +616,7 @@ Agocontrol.prototype = {
dev.roomUID = dev.room;
var room = this.findRoom(dev.room);
if (room) {
dev.room = room.name;
dev.room = room.name();
return;
}
}
......@@ -958,7 +959,7 @@ Agocontrol.prototype = {
{
var uuid = result.uuid;
if( self.inventory && self.inventory.rooms && self.inventory.rooms[uuid]!==undefined ) {
self.inventory.rooms[uuid].name = result.name;
self.inventory.rooms[uuid].name(result.name);
// refresh devices with this room
for (var devUuid in self.inventory.devices) {
......
......@@ -71,7 +71,7 @@ Agocontrol.prototype.makeFieldDeviceRoomEditable = function(el, device, extraOpt
var rooms = self.rooms();
for( var i=0; i < rooms.length; i++ )
{
list[rooms[i].uuid] = rooms[i].name;
list[rooms[i].uuid] = rooms[i].name();
}
return list;
},
......@@ -95,7 +95,8 @@ Agocontrol.prototype.makeFieldDeviceRoomEditable = function(el, device, extraOpt
notif.success("Device room updated");
//update local inventory; there is no roomchanged event right now.
if (value === "") {
device.room = device.roomUID = "";
device.room = "";
device.roomUID = null;
self.inventory.devices[device.uuid].room = "";
self.inventory.devices[device.uuid].roomUID = "";
}
......@@ -105,8 +106,8 @@ Agocontrol.prototype.makeFieldDeviceRoomEditable = function(el, device, extraOpt
var room = self.findRoom(value);
if (room) {
device.room = room.name;
self.inventory.devices[device.uuid].room = room.name;
device.room = room.name();
self.inventory.devices[device.uuid].room = room.name();
}
}
})
......@@ -123,7 +124,7 @@ Agocontrol.prototype.makeFieldDeviceRoomEditable = function(el, device, extraOpt
else
{
var room = self.findRoom(value);
return room.name;
return room.name();
}
},
options);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment