Skip to content

Commit

Permalink
HPCC-33070 ECL Watch v9 use shimmered grids
Browse files Browse the repository at this point in the history
change the Grid component (used on WU, FIle & Query) list pages to
use FluentUI's shimmer animation to indicate when the grid's content
is being updated

Signed-off-by: Jeremy Clements <[email protected]>
  • Loading branch information
jeclrsg committed Dec 5, 2024
1 parent 2bca5ba commit ebb6de7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions esp/src/src-react/components/controls/Grid.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import { DetailsList, DetailsListLayoutMode, Dropdown, IColumn as _IColumn, ICommandBarItemProps, IDetailsHeaderProps, IDetailsListStyles, mergeStyleSets, Selection, Stack, TooltipHost, TooltipOverflowMode, IRenderFunction, IDetailsRowProps, SelectionMode, ConstrainMode, ISelection, ScrollablePane, Sticky } from "@fluentui/react";
import { DetailsListLayoutMode, Dropdown, IColumn as _IColumn, ICommandBarItemProps, IDetailsHeaderProps, IDetailsListStyles, mergeStyleSets, Selection, Stack, TooltipHost, TooltipOverflowMode, IRenderFunction, IDetailsRowProps, SelectionMode, ConstrainMode, ISelection, ScrollablePane, ShimmeredDetailsList, Sticky } from "@fluentui/react";
import { Pagination } from "@fluentui/react-experiments/lib/Pagination";
import { useConst } from "@fluentui/react-hooks";
import { BaseStore, Memory, QueryRequest, QuerySortItem } from "src/store/Memory";
Expand Down Expand Up @@ -227,6 +227,7 @@ const FluentStoreGrid: React.FunctionComponent<FluentStoreGridProps> = ({
const memoizedColumns = useDeepMemo(() => columns, [], [columns]);
const [sorted, setSorted] = React.useState<QuerySortItem>(sort);
const [items, setItems] = React.useState<any[]>([]);
const [loaded, setLoaded] = React.useState(false);
const [columnWidths] = useNonReactiveEphemeralPageStore("columnWidths");

const selectionHandler = useConst(() => {
Expand Down Expand Up @@ -257,6 +258,7 @@ const FluentStoreGrid: React.FunctionComponent<FluentStoreGridProps> = ({
});
storeQuery.then(items => {
const selectedIndices = selectionHandler.getSelectedIndices();
setLoaded(true);
setItems(items);
selectedIndices.forEach(index => selectionHandler.setIndexSelected(index, true, false));
});
Expand Down Expand Up @@ -319,8 +321,9 @@ const FluentStoreGrid: React.FunctionComponent<FluentStoreGridProps> = ({

return <div style={{ position: "relative", height: "100%" }}>
<ScrollablePane>
<DetailsList
<ShimmeredDetailsList
compact={true}
enableShimmer={!loaded}
items={items}
columns={fluentColumns}
layoutMode={DetailsListLayoutMode.fixedColumns}
Expand Down

0 comments on commit ebb6de7

Please sign in to comment.