Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add isFetchingItems flag to disable the PromptForItems when fetching items in Visualize and Dashboard listing tables. #10381

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
<!-- PromptForItems -->
<div
class="kuiPanel kuiPanel--centered kuiPanel--withHeader"
ng-if="!listingController.items.length && !listingController.filter"
ng-if="!listingController.isFetchingItems && !listingController.items.length && !listingController.filter"
>
<div class="kuiPromptForItems">
<div class="kuiPromptForItems__message">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,12 @@ export function DashboardListingController($injector, $scope) {
this.pageOfItems = limitTo(this.items, this.pager.pageSize, this.pager.startIndex);
};

const fetchObjects = () => {
const fetchItems = () => {
this.isFetchingItems = true;

dashboardService.find(this.filter)
.then(result => {
this.isFetchingItems = false;
this.items = result.hits;
calculateItemsOnPage();
});
Expand All @@ -57,6 +60,7 @@ export function DashboardListingController($injector, $scope) {
selectedItems = this.pageOfItems.slice(0);
};

this.isFetchingItems = false;
this.items = [];
this.pageOfItems = [];
this.filter = '';
Expand All @@ -65,7 +69,7 @@ export function DashboardListingController($injector, $scope) {

$scope.$watch(() => this.filter, () => {
deselectAll();
fetchObjects();
fetchItems();
});

/**
Expand Down Expand Up @@ -115,7 +119,7 @@ export function DashboardListingController($injector, $scope) {
const selectedIds = selectedItems.map(item => item.id);

dashboardService.delete(selectedIds)
.then(fetchObjects)
.then(fetchItems)
.then(() => {
deselectAll();
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
<!-- PromptForItems -->
<div
class="kuiPanel kuiPanel--centered kuiPanel--withHeader"
ng-if="!listingController.items.length && !listingController.filter"
ng-if="!listingController.isFetchingItems && !listingController.items.length && !listingController.filter"
>
<div class="kuiPromptForItems">
<div class="kuiPromptForItems__message">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,15 @@ export function VisualizeListingController($injector, $scope) {
this.pageOfItems = limitTo(this.items, this.pager.pageSize, this.pager.startIndex);
};

const fetchObjects = () => {
const fetchItems = () => {
this.isFetchingItems = true;

visualizationService.find(this.filter)
.then(result => {
this.items = result.hits;
calculateItemsOnPage();
});
.then(result => {
this.isFetchingItems = false;
this.items = result.hits;
calculateItemsOnPage();
});
};

const deselectAll = () => {
Expand All @@ -58,6 +61,7 @@ export function VisualizeListingController($injector, $scope) {
selectedItems = this.pageOfItems.slice(0);
};

this.isFetchingItems = false;
this.items = [];
this.pageOfItems = [];
this.filter = '';
Expand All @@ -66,7 +70,7 @@ export function VisualizeListingController($injector, $scope) {

$scope.$watch(() => this.filter, () => {
deselectAll();
fetchObjects();
fetchItems();
});

/**
Expand Down Expand Up @@ -145,7 +149,7 @@ export function VisualizeListingController($injector, $scope) {
const selectedIds = selectedItems.map(item => item.id);

visualizationService.delete(selectedIds)
.then(fetchObjects)
.then(fetchItems)
.then(() => {
deselectAll();
})
Expand Down