From 6d0f2948aadac241a5a3256b7c98a880ba92ef33 Mon Sep 17 00:00:00 2001 From: Jake McDermott Date: Tue, 5 Mar 2019 10:28:08 -0500 Subject: [PATCH] don't show lookup until data is fetched --- .../credentials/input-source-lookup.component.js | 10 +++++++++- .../credentials/input-source-lookup.partial.html | 3 ++- .../components/lookup-list/lookup-list.component.js | 4 +++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/awx/ui/client/features/credentials/input-source-lookup.component.js b/awx/ui/client/features/credentials/input-source-lookup.component.js index beea7e72ec..50f78abe38 100644 --- a/awx/ui/client/features/credentials/input-source-lookup.component.js +++ b/awx/ui/client/features/credentials/input-source-lookup.component.js @@ -1,14 +1,22 @@ const templateUrl = require('~features/credentials/input-source-lookup.partial.html'); -function InputSourceLookupController (strings) { +function InputSourceLookupController (strings, wait) { const vm = this || {}; vm.strings = strings; vm.title = strings.get('inputSources.TITLE'); + + vm.$onInit = () => wait('start'); + + vm.onReady = () => { + vm.isReady = true; + wait('stop'); + }; } InputSourceLookupController.$inject = [ 'CredentialsStrings', + 'Wait', ]; export default { diff --git a/awx/ui/client/features/credentials/input-source-lookup.partial.html b/awx/ui/client/features/credentials/input-source-lookup.partial.html index b7c420fcf0..0f5a0f8e94 100644 --- a/awx/ui/client/features/credentials/input-source-lookup.partial.html +++ b/awx/ui/client/features/credentials/input-source-lookup.partial.html @@ -1,4 +1,4 @@ - + diff --git a/awx/ui/client/lib/components/lookup-list/lookup-list.component.js b/awx/ui/client/lib/components/lookup-list/lookup-list.component.js index 207456ba84..4a78625414 100644 --- a/awx/ui/client/lib/components/lookup-list/lookup-list.component.js +++ b/awx/ui/client/lib/components/lookup-list/lookup-list.component.js @@ -15,7 +15,8 @@ function LookupListController (GetBasePath, Rest, strings) { Rest.get({ params }) .then(({ data }) => { setData(resultsFilter(data)); - }); + }) + .finally(() => vm.onReady()); }; function setData ({ results, count }) { @@ -43,6 +44,7 @@ export default { bindings: { onSelect: '=', onRowClick: '=', + onReady: '=', selectedId: '=', resourceName: '@', baseParams: '=',