Return-Path: X-Original-To: apmail-felix-commits-archive@www.apache.org Delivered-To: apmail-felix-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0680598FF for ; Wed, 4 Apr 2012 14:18:51 +0000 (UTC) Received: (qmail 1914 invoked by uid 500); 4 Apr 2012 14:18:50 -0000 Delivered-To: apmail-felix-commits-archive@felix.apache.org Received: (qmail 1885 invoked by uid 500); 4 Apr 2012 14:18:50 -0000 Mailing-List: contact commits-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list commits@felix.apache.org Received: (qmail 1871 invoked by uid 99); 4 Apr 2012 14:18:50 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Apr 2012 14:18:50 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Apr 2012 14:18:49 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id B8B7F2388847 for ; Wed, 4 Apr 2012 14:18:29 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1309402 - /felix/trunk/webconsole-plugins/upnp/src/main/resources/res/upnp.js Date: Wed, 04 Apr 2012 14:18:29 -0000 To: commits@felix.apache.org From: vvalchev@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120404141829.B8B7F2388847@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: vvalchev Date: Wed Apr 4 14:18:29 2012 New Revision: 1309402 URL: http://svn.apache.org/viewvc?rev=1309402&view=rev Log: Fixed FELIX-3432 UPnP plugin should provide better device property representation https://issues.apache.org/jira/browse/FELIX-3432 Modified: felix/trunk/webconsole-plugins/upnp/src/main/resources/res/upnp.js Modified: felix/trunk/webconsole-plugins/upnp/src/main/resources/res/upnp.js URL: http://svn.apache.org/viewvc/felix/trunk/webconsole-plugins/upnp/src/main/resources/res/upnp.js?rev=1309402&r1=1309401&r2=1309402&view=diff ============================================================================== --- felix/trunk/webconsole-plugins/upnp/src/main/resources/res/upnp.js (original) +++ felix/trunk/webconsole-plugins/upnp/src/main/resources/res/upnp.js Wed Apr 4 14:18:29 2012 @@ -121,8 +121,11 @@ function addDevice(device) { return node; } /* fills in the list of state variables */ +function sortVarNm(a) { return typeof a != 'undefined' && typeof a.name != undefined ? a.name.toLowerCase() : '' } +function namedObjectSorter(a,b) { return sortVarNm(a) > sortVarNm(b) ? 1 : -1 } function renderVars(data) { serviceDataVars.empty(); + data.variables.sort(namedObjectSorter); for(i in data.variables) { var _var = data.variables[i]; var _tr = tr(null, null, [ @@ -141,8 +144,17 @@ var selectedDevice = false; // the LI el function renderDevice(device) { // generate content var table = ''; - for(var key in device.props) { - table += '' + key + '' + _val(device.props[key]) + ''; + var sortedKeys = []; + for(var key in device.props) sortedKeys.push(key); + sortedKeys.sort(); + for(var x in sortedKeys) { + var key = sortedKeys[x]; + var xvalue = _val(device.props[key]); + if ('objectClass' == key) continue; + if ('service.id' == key) { + xvalue = '' + xvalue + ''; + } + table += '' + key + '' + xvalue + ''; } // update the UI @@ -175,6 +187,7 @@ function renderService(udn, urn, data) { if (data.actions) { var html = ''; var x = data.actions; + x.sort(namedObjectSorter); for (var a in x) html += ''; actionsSelect.html(html).unbind('change').change(function() { var index = $(this).val();