From e5c173de496fc99ca73e2da20152d11a3dd58018 Mon Sep 17 00:00:00 2001 From: Christian Klinger Date: Tue, 9 Aug 2016 11:28:54 +0200 Subject: loading & saving of roomconfig. --- modules-available/roomplanner/clientscript.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'modules-available/roomplanner/clientscript.js') diff --git a/modules-available/roomplanner/clientscript.js b/modules-available/roomplanner/clientscript.js index c19e63ec..25495995 100644 --- a/modules-available/roomplanner/clientscript.js +++ b/modules-available/roomplanner/clientscript.js @@ -9,14 +9,25 @@ machineCache = {}; selectMachinInitialized = false; +placedMachines = []; + function renderMachineEntry(item, escape) { machineCache[item.machineuuid] = item; - return '
' + // console.log('rendering ' + item.machineuuid); + // console.log('used uuids is '); + // console.log(placedMachines); + + var isUsed = $.inArray(item.machineuuid, placedMachines) > -1; + var extra = isUsed ? ' used ' : ''; + if (isUsed) { + console.log('rendering used'); + } + return '
' //+ ' ' + '
' - + '
' + escape(item.hostname) + '
' + + '
' + escape(item.hostname) + (isUsed ? ' (already placed)' : '') + '
' + ' ' + '' + '' @@ -51,9 +62,11 @@ function loadMachines(query, callback) { function clearSearchBox() { $selectizeSearch[0].selectize.setValue([], true); + $selectizeSearch[0].selectize.clearCache(); } function clearSubnetBox() { $selectizeSubnet[0].selectize.setValue([], true); + $selectizeSubnet[0].selectize.clearCache(); } function initSelectize() { @@ -120,6 +133,7 @@ function onBtnSelect() { function selectMachine(usedUuids, callback) { initSelectize(); currentCallback = callback; + placedMachines = usedUuids; $modal.modal('show'); } -- cgit v1.2.3-55-g7522
UUID: ' + escape(item.machineuuid) + '
MAC: ' + escape(item.macaddr) + '