From 03cdc22c940e82199c2afa8b4a69708237ee0a7a Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Mon, 6 May 2013 17:10:56 +0200 Subject: Resolve SIDs in Web UI Introduce new command, 'trust-resolve', to aid resolving SIDs to names in the Web UI. The command uses new SSSD interface, nss_idmap, to resolve actual SIDs. SSSD caches resolved data so that future requests to resolve same SIDs are returned from a memory cache. Web UI code is using Dojo/Deferred to deliver result of SID resolution out of band. Once resolved names are available, they replace SID values. Since Web UI only shows ~20 records per page, up to 20 SIDs are resolved at the same time. They all sent within the single request to the server. https://fedorahosted.org/freeipa/ticket/3302 --- install/ui/src/freeipa/widget.js | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) (limited to 'install/ui/src/freeipa/widget.js') diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js index 0fe046e4..8f1208e0 100644 --- a/install/ui/src/freeipa/widget.js +++ b/install/ui/src/freeipa/widget.js @@ -1404,9 +1404,6 @@ IPA.column = function (spec) { } that.setup = function(container, record, suppress_link) { - - container.empty(); - var value = record[that.name]; var type; if (that.formatter) { @@ -1414,7 +1411,34 @@ IPA.column = function (spec) { value = that.formatter.format(value); type = that.formatter.type; } + + var promise, temp = ''; + if (value && typeof value.then === 'function') promise = value; + if (value && value.promise && typeof value.promise.then === 'function') { + promise = value.promise; + temp = value.temp || ''; + } + + if (promise) { + var fulfilled = false; + promise.then(function(val) { + fulfilled = true; + that.set_value(container, val, type, suppress_link); + }); + + if (fulfilled) return; + // val obj can contain temporal value which is displayed + // until promise is fulfilled + value = temp; + } + + that.set_value(container, value, type, suppress_link); + }; + + that.set_value = function(container, value, type, suppress_link) { + value = value ? value.toString() : ''; + container.empty(); var c; if (that.link && !suppress_link) { -- cgit