diff --git a/src/software/js-samples/importDevices.html b/src/software/js-samples/importDevices.html index 8c9cda455..515767071 100644 --- a/src/software/js-samples/importDevices.html +++ b/src/software/js-samples/importDevices.html @@ -1,4 +1,4 @@ - + @@ -39,7 +39,7 @@

Import devices

on its own line as follows:

-
SerialNumber,Name1,GroupName
SerialNumber,Name2,GroupName
SerialNumber,Name3,GroupName
+
SerialNumber,Name1,GroupName,VIN
SerialNumber,Name2,GroupName,VIN
SerialNumber,Name3,GroupName,VIN

@@ -109,8 +109,8 @@

Help

// Split up the device properties var split = devices[i].split(","); - // Each imported device can only have 3 properties - if (split.length !== 3) { + // Each imported device can only have 4 properties + if (split.length !== 4) { alert("There is an error on line " + (i + 1) + ": " + devices[i]); return; } @@ -124,7 +124,10 @@

Help

alert("Group name on line " + (i + 1) + " exceeds 255 characters"); return; } - + if (split[3].length > 255) { + alert("Group name on line " + (i + 1) + " exceeds 255 characters"); + return; + } // If create groups is enabled, queue up the new groups to be created if (!groupCache.hasOwnProperty(split[2])) { if (createGroups) { @@ -176,7 +179,7 @@

Help

}); - function addDevice(serialNumber, name, groupId) { + function addDevice(serialNumber, name, groupId, vin) { api.call("Add", { typeName: "Device", entity: { @@ -184,8 +187,9 @@

Help

name: name, groups: [{ id: groupId - }] - } + }], + vin: vin + } }, function (result) { console.log("Successfully imported " + name + " (" + result + ")"); }, function (error) {