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

Added pagination call on scroll in FF #1712

Merged
merged 9 commits into from
Jul 22, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
selectSortKey,
selectSortAs,
selectSearchString,
selectIsAllFlagsFetched,
} from './feature-flags.selectors';
import { DialogService } from '../../../shared/services/common-dialog.service';

Expand All @@ -36,9 +37,12 @@ export class FeatureFlagsEffects {
this.store$.pipe(select(selectTotalFlags)),
this.store$.pipe(select(selectSearchKey)),
this.store$.pipe(select(selectSortKey)),
this.store$.pipe(select(selectSortAs))
this.store$.pipe(select(selectSortAs)),
this.store$.pipe(select(selectIsAllFlagsFetched))
),
filter(([fromStarting, skip, total]) => skip < total || total === null || fromStarting),
filter(([fromStarting, skip, total, searchKey, sortKey, sortAs, isAllFlagsFetched]) => {
return !isAllFlagsFetched || skip < total || total === null || fromStarting;
}),
tap(() => {
this.store$.dispatch(FeatureFlagsActions.actionSetIsLoadingFeatureFlags({ isLoadingFeatureFlags: true }));
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ export const initialState: FeatureFlagState = adapter.getInitialState({

const reducer = createReducer(
initialState,
// Feature Flags Fetching Actions
on(FeatureFlagsActions.actionFetchFeatureFlags, (state) => ({
...state,
isLoadingFeatureFlags: true,
})),
on(FeatureFlagsActions.actionFetchFeatureFlagsSuccess, (state, { flags, totalFlags }) => {
const newState: FeatureFlagState = {
...state,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="flags-list-container">
<div scroll (scrolled)="fetchFlagsOnScroll()" class="flags-list-table-container" #tableContainer>
<div (wheel)="fetchFlagsOnScroll()" class="flags-list-table-container" #tableContainer>
<mat-progress-bar class="spinner" mode="indeterminate" *ngIf="isLoading$ | async"></mat-progress-bar>
<table
class="flags-list"
Expand All @@ -25,11 +25,7 @@
{{ flag.name }}
</a>
<ng-template #flagNameEllipsis>
<span
[matTooltip]="flag.name"
class="flag-name"
matTooltipPosition="above"
>
<span [matTooltip]="flag.name" class="flag-name" matTooltipPosition="above">
{{ flag.name | truncate: 30 }}
</span>
</ng-template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
margin-top: 8px;
overflow: auto;
width: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;

.spinner {
position: sticky;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { ChangeDetectionStrategy, Component, Input, OnInit, ViewChild } from '@angular/core';
import { Observable } from 'rxjs';

import { ChangeDetectionStrategy, Component, Input, OnInit, ViewChild } from '@angular/core';

import {
FLAG_ROOT_COLUMN_NAMES,
FLAG_ROOT_DISPLAYED_COLUMNS,
Expand All @@ -26,6 +28,7 @@ import { SharedModule } from '../../../../../../../../shared/shared.module';
UpperCasePipe,
RouterModule,
CommonStatusIndicatorChipComponent,
SharedModule,
],
templateUrl: './feature-flag-root-section-card-table.component.html',
styleUrl: './feature-flag-root-section-card-table.component.scss',
Expand Down Expand Up @@ -60,7 +63,7 @@ export class FeatureFlagRootSectionCardTableComponent implements OnInit {
}

fetchFlagsOnScroll() {
console.log('fetchFlagsOnScroll');
this.featureFlagsService.fetchFeatureFlags();
}

changeSorting(event) {
Expand Down
Loading