Skip to content

Sc 115 add pagination to all tables that do not have it#873

Open
nbeatty-gpa wants to merge 65 commits into
masterfrom
SC-115-Add-pagination-to-all-tables-that-do-not-have-it
Open

Sc 115 add pagination to all tables that do not have it#873
nbeatty-gpa wants to merge 65 commits into
masterfrom
SC-115-Add-pagination-to-all-tables-that-do-not-have-it

Conversation

@nbeatty-gpa

@nbeatty-gpa nbeatty-gpa commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Adds pagination to tables, especially in "info" tabs


Jira Work Item(s)

  • SC-115

@nbeatty-gpa nbeatty-gpa requested a review from elwills June 10, 2026 19:59
@nbeatty-gpa nbeatty-gpa force-pushed the SC-115-Add-pagination-to-all-tables-that-do-not-have-it branch 3 times, most recently from 9b18228 to de09c01 Compare June 15, 2026 14:44
@elwills elwills requested a review from Copilot June 18, 2026 19:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds pagination support across multiple SystemCenter UI tables (especially “info”/detail tabs) by wiring table views to paged search endpoints and introducing/using paged APIs on the backend where needed.

Changes:

  • Add <Paging /> controls to many TSX table views and update sorting/page state handling.
  • Introduce/extend paged API endpoints for several resources (e.g., security group users, asset group members, asset connections/channels, location images).
  • Extend Redux/EventChannel slice state to support paged results and update store typing setup.

Reviewed changes

Copilot reviewed 31 out of 31 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
Source/Applications/SystemCenter/wwwroot/Scripts/TSX/SystemCenter/ValueListGroup/ValueListGroupItem.tsx Adds paging and server-side sort/page flow for value list items.
Source/Applications/SystemCenter/wwwroot/Scripts/TSX/SystemCenter/User/UserGroup/GroupUsers.tsx Switches group user listing to a paged backend endpoint and adds paging UI.
Source/Applications/SystemCenter/wwwroot/Scripts/TSX/SystemCenter/User/UserGroup/ByUserGroup.tsx Refactors to GenericController paged search and adds paging UI.
Source/Applications/SystemCenter/wwwroot/Scripts/TSX/SystemCenter/User/User/ByUser.tsx Refactors to GenericController paged search and adds paging UI.
Source/Applications/SystemCenter/wwwroot/Scripts/TSX/SystemCenter/Store/Store.ts Updates store typing and reducer composition structure.
Source/Applications/SystemCenter/wwwroot/Scripts/TSX/SystemCenter/Store/EventChannelSlice.ts Adds paged-search thunk/state/selectors for event channels.
Source/Applications/SystemCenter/wwwroot/Scripts/TSX/SystemCenter/RemoteXDA/RemoteMeterTab.tsx Adds paging support to remote meter table search results.
Source/Applications/SystemCenter/wwwroot/Scripts/TSX/SystemCenter/RemoteXDA/RemoteAssetTab.tsx Adds paging support to remote asset table search results.
Source/Applications/SystemCenter/wwwroot/Scripts/TSX/SystemCenter/Meter/MeterTrendChannel.tsx Adds paging to trend channel table.
Source/Applications/SystemCenter/wwwroot/Scripts/TSX/SystemCenter/Meter/MeterEventChannel.tsx Adds paging to event channel table using new paged slice data.
Source/Applications/SystemCenter/wwwroot/Scripts/TSX/SystemCenter/Meter/ChannelScaling/ChannelScalingForm.tsx Adds client-side paging for scaling wrappers table.
Source/Applications/SystemCenter/wwwroot/Scripts/TSX/SystemCenter/Location/LocationImages.tsx Adds paging UI for location image lists and updates API call shape.
Source/Applications/SystemCenter/wwwroot/Scripts/TSX/SystemCenter/ExternalDB/ExternalDBTables.tsx Adds paging UI and paged search for external DB tables listing.
Source/Applications/SystemCenter/wwwroot/Scripts/TSX/SystemCenter/ExternalDB/ExternalDBTableFields.tsx Moves additional-field table to paged backend query and adds paging UI.
Source/Applications/SystemCenter/wwwroot/Scripts/TSX/SystemCenter/Customer/CustomerMeter.tsx Switches customer meter listing to paged search and adds paging UI.
Source/Applications/SystemCenter/wwwroot/Scripts/TSX/SystemCenter/Customer/CustomerAsset.tsx Switches customer asset listing to paged search and adds paging UI.
Source/Applications/SystemCenter/wwwroot/Scripts/TSX/SystemCenter/CommonComponents/ExternalDBUpdate.tsx Updates UI message strings during external DB updates.
Source/Applications/SystemCenter/wwwroot/Scripts/TSX/SystemCenter/ChannelGroup/ChannelGroupItem.tsx Adds paging and server-side sort/page flow for channel group details.
Source/Applications/SystemCenter/wwwroot/Scripts/TSX/SystemCenter/AssetGroups/MeterAssetGroup.tsx Adds paging UI and paged backend calls for meters in an asset group.
Source/Applications/SystemCenter/wwwroot/Scripts/TSX/SystemCenter/AssetGroups/ByAssetGroup.tsx Adds paging UI and paged searching for asset group listing.
Source/Applications/SystemCenter/wwwroot/Scripts/TSX/SystemCenter/AssetGroups/AssetGroupAssetGroup.tsx Adds paging UI and paged backend calls for subgroups in an asset group.
Source/Applications/SystemCenter/wwwroot/Scripts/TSX/SystemCenter/AssetGroups/AssetAssetGroup.tsx Adds paging UI and paged backend calls for assets in an asset group.
Source/Applications/SystemCenter/wwwroot/Scripts/TSX/SystemCenter/Asset/AssetMeter.tsx Adds paging UI and paged backend calls for meters tied to an asset.
Source/Applications/SystemCenter/wwwroot/Scripts/TSX/SystemCenter/Asset/AssetLocation.tsx Adds paging UI and paged backend calls for locations tied to an asset.
Source/Applications/SystemCenter/wwwroot/Scripts/TSX/SystemCenter/Asset/AssetConnection.tsx Adds paging UI and paged backend calls for asset connections.
Source/Applications/SystemCenter/wwwroot/Scripts/TSX/SystemCenter/Asset/AssetChannel.tsx Adds paging UI and paged backend calls for connected channels.
Source/Applications/SystemCenter/wwwroot/Scripts/TSX/SystemCenter/AdditionalFields/ByAdditionalField.tsx Uses paged status/results and adds paging-aware sorting.
Source/Applications/SystemCenter/Model/Security/SecurityGroup.cs Adds paged users endpoint for security groups.
Source/Applications/SystemCenter/Controllers/OpenXDA/OpenXDALocationController.cs Adds paged location images endpoint and paging helper.
Source/Applications/SystemCenter/Controllers/OpenXDA/Assets/OpenXDAAssetController.cs Adds paged endpoints for asset locations/meters/connections/channels.
Source/Applications/SystemCenter/Controllers/OpenXDA/AssetGroups/OpenXDAAssetGroupsController.cs Adds paged endpoints for asset group members and subgroups.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@nbeatty-gpa nbeatty-gpa force-pushed the SC-115-Add-pagination-to-all-tables-that-do-not-have-it branch 2 times, most recently from 1b6cf70 to c9e499c Compare June 22, 2026 14:30
@elwills elwills requested a review from Copilot June 23, 2026 15:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 31 out of 31 changed files in this pull request and generated 8 comments.

@nbeatty-gpa nbeatty-gpa force-pushed the SC-115-Add-pagination-to-all-tables-that-do-not-have-it branch from 940fd43 to c8adc11 Compare June 24, 2026 19:07
@elwills elwills requested a review from Copilot June 25, 2026 15:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 31 out of 31 changed files in this pull request and generated 7 comments.

Comment on lines +86 to +88
React.useEffect(() => {
if (status == 'uninitiated' || status == 'changed' || parentID != props.Record.ID)
dispatch(ValueListSlice.Fetch(props.Record.ID));
}, [status, parentID, props.Record.ID]);
pagedSearch()
}, [pagedSearch, sortField, ascending, page, props.Record.ID]);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment makes sense but the suggestion is unrelated, which is... interesting

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually problemativ for another reason. IF pagedSearch ever change multiple Effects will fire off the same call, which is a potential problem. It also defeats the need for the cleanup function....

@nbeatty-gpa nbeatty-gpa force-pushed the SC-115-Add-pagination-to-all-tables-that-do-not-have-it branch from 47f6bcf to f155122 Compare June 26, 2026 20:31
elwills
elwills previously approved these changes Jun 26, 2026
@clackner-gpa clackner-gpa force-pushed the SC-115-Add-pagination-to-all-tables-that-do-not-have-it branch from f155122 to 2f0ba8c Compare June 29, 2026 01:56
Comment on lines +86 to +88
React.useEffect(() => {
if (status == 'uninitiated' || status == 'changed' || parentID != props.Record.ID)
dispatch(ValueListSlice.Fetch(props.Record.ID));
}, [status, parentID, props.Record.ID]);
pagedSearch()
}, [pagedSearch, sortField, ascending, page, props.Record.ID]);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually problemativ for another reason. IF pagedSearch ever change multiple Effects will fire off the same call, which is a potential problem. It also defeats the need for the cleanup function....

Comment on lines +59 to +73
const pagedSearch = React.useCallback(() => {
const filters = [{ FieldName: "GroupID", SearchText: props.Record.ID.toString(), Operator: "=" as Search.OperatorType, IsPivotColumn: false, Type: "number" as Search.FieldType }];
setStatus('loading')
const h = controller.PagedSearch(filters, sortField, ascending, page);
h.done((d) => {
setData(JSON.parse(d.Data as unknown as string))
setTotalPages(d.NumberOfPages)
setStatus('idle')
}).fail((d) => {
setStatus('error')
})
return () => {
if (h.abort != undefined) h.abort();
}
}, [props.Record.ID, sortField, ascending, page, controller.PagedSearch])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is problematic per comment below. You probably should feed these things into the function as parameter and drop the whole callBack

const parentID= useAppSelector(ValueListSlice.ParentID);

const [data, setData] = React.useState<SystemCenter.Types.ValueListItem[]>([])
const parentID = useAppSelector(ValueListSlice.ParentID);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ParentID is used to ensure the slice loads the correct dataset. With the slice gone, you should not be using this anymore.

import { useAppSelector, useAppDispatch } from '../hooks';
import { SystemCenter, Application } from '@gpa-gemstone/application-typings';
import { useAppSelector } from '../hooks';
import { ValueListSlice } from '../Store/Store';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

most likely a change to Controllers allows you to drop the Slice completely,. Mixing slice and controllers is a potential recipe for issues, so I would double check all files and make sure they are really still needed.

Comment on lines +80 to +78
setUsers(_.orderBy(d, [sortField], asc ? 'asc' : 'desc'));
setStatus('idle');
getUsers()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this defeats the use of cleanup functions.

{ ...newGroup, Name: ((newGroup.Name?.length ?? 0) > 0 ? newGroup.Name : newGroup.DisplayName) }
)
setStatus('changed')
pagedSearch()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

defeats the use of cleanup functions and most likely doesn't really grab the latest record since DBAction may not be done yet.

</div>;

useBoundPaging(currentPage, totalPages, setPage)
const pagedSearch = React.useCallback(() => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see other comments. This is not a great pattern to get into.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants