don't show lookup until data is fetched

This commit is contained in:
Jake McDermott
2019-03-05 10:28:08 -05:00
parent 736bd2ed67
commit 6d0f2948aa
3 changed files with 14 additions and 3 deletions

View File

@@ -1,14 +1,22 @@
const templateUrl = require('~features/credentials/input-source-lookup.partial.html'); const templateUrl = require('~features/credentials/input-source-lookup.partial.html');
function InputSourceLookupController (strings) { function InputSourceLookupController (strings, wait) {
const vm = this || {}; const vm = this || {};
vm.strings = strings; vm.strings = strings;
vm.title = strings.get('inputSources.TITLE'); vm.title = strings.get('inputSources.TITLE');
vm.$onInit = () => wait('start');
vm.onReady = () => {
vm.isReady = true;
wait('stop');
};
} }
InputSourceLookupController.$inject = [ InputSourceLookupController.$inject = [
'CredentialsStrings', 'CredentialsStrings',
'Wait',
]; ];
export default { export default {

View File

@@ -1,4 +1,4 @@
<at-easy-modal title="vm.title" on-close="vm.onClose"> <at-easy-modal title="vm.title" on-close="vm.onClose" ng-show="vm.isReady">
<at-tab-group> <at-tab-group>
<at-tab <at-tab
state="vm.tabs.credential" state="vm.tabs.credential"
@@ -23,6 +23,7 @@
}" }"
results-filter="vm.resultsFilter" results-filter="vm.resultsFilter"
selected-id="vm.selectedId" selected-id="vm.selectedId"
on-ready="vm.onReady"
on-select="vm.onSelect" on-select="vm.onSelect"
on-row-click="vm.onRowClick" on-row-click="vm.onRowClick"
/> />

View File

@@ -15,7 +15,8 @@ function LookupListController (GetBasePath, Rest, strings) {
Rest.get({ params }) Rest.get({ params })
.then(({ data }) => { .then(({ data }) => {
setData(resultsFilter(data)); setData(resultsFilter(data));
}); })
.finally(() => vm.onReady());
}; };
function setData ({ results, count }) { function setData ({ results, count }) {
@@ -43,6 +44,7 @@ export default {
bindings: { bindings: {
onSelect: '=', onSelect: '=',
onRowClick: '=', onRowClick: '=',
onReady: '=',
selectedId: '=', selectedId: '=',
resourceName: '@', resourceName: '@',
baseParams: '=', baseParams: '=',