[arvados] created: 2.7.0-6668-g1c748824a9

git repository hosting git at public.arvados.org
Thu May 30 18:05:15 UTC 2024


        at  1c748824a9df111d738f79bbf1a824715b51ced5 (commit)


commit 1c748824a9df111d738f79bbf1a824715b51ced5
Author: Lisa Knox <lisaknox83 at gmail.com>
Date:   Thu May 30 13:29:07 2024 -0400

    21364: stopped itemsAvailable count from resetting on load more click
    
    Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox at curii.com>

diff --git a/services/workbench2/src/components/data-explorer/data-explorer.tsx b/services/workbench2/src/components/data-explorer/data-explorer.tsx
index 91ece48c3a..063e34cda7 100644
--- a/services/workbench2/src/components/data-explorer/data-explorer.tsx
+++ b/services/workbench2/src/components/data-explorer/data-explorer.tsx
@@ -107,6 +107,7 @@ interface DataExplorerDataProps<T> {
     isMSToolbarVisible: boolean;
     checkedList: TCheckedList;
     isNotFound: boolean;
+    searchBarValue: string;
 }
 
 interface DataExplorerActionProps<T> {
@@ -132,6 +133,7 @@ export const DataExplorer = withStyles(styles)(
     class DataExplorerGeneric<T> extends React.Component<DataExplorerProps<T>> {
 
         multiSelectToolbarInTitle = !this.props.title && !this.props.progressBar;
+        maxItemsAvailable = 0;
 
         componentDidMount() {
             if (this.props.onSetColumns) {
@@ -139,6 +141,15 @@ export const DataExplorer = withStyles(styles)(
             }
         }
 
+        componentDidUpdate( prevProps: Readonly<DataExplorerProps<T>>, prevState: Readonly<{}>, snapshot?: any ): void {
+            if (this.props.itemsAvailable !== prevProps.itemsAvailable) {
+                this.maxItemsAvailable = Math.max(this.maxItemsAvailable, this.props.itemsAvailable);
+            }
+            if (this.props.searchBarValue !== prevProps.searchBarValue) {
+                this.maxItemsAvailable = 0;
+            }
+        }
+
         render() {
             const {
                 columns,
@@ -326,7 +337,7 @@ export const DataExplorer = withStyles(styles)(
                                     ) : (
                                         <Grid className={classes.loadMoreContainer}>
                                             <Typography  className={classes.numResults}>
-                                                Showing {items.length} / {itemsAvailable} results
+                                                Showing {items.length} / {this.maxItemsAvailable} results
                                             </Typography>
                                             <Button
                                                 size="small"
diff --git a/services/workbench2/src/views-components/data-explorer/data-explorer.tsx b/services/workbench2/src/views-components/data-explorer/data-explorer.tsx
index c2cea62a8b..21818fac30 100644
--- a/services/workbench2/src/views-components/data-explorer/data-explorer.tsx
+++ b/services/workbench2/src/views-components/data-explorer/data-explorer.tsx
@@ -22,7 +22,7 @@ interface Props {
     working?: boolean;
 }
 
-const mapStateToProps = ({ progressIndicator, dataExplorer, router, multiselect, detailsPanel, properties}: RootState, { id }: Props) => {
+const mapStateToProps = ({ progressIndicator, dataExplorer, router, multiselect, detailsPanel, properties, searchBar}: RootState, { id }: Props) => {
     const working = !!progressIndicator.some(p => p.working);
     const dataExplorerState = getDataExplorer(dataExplorer, id);
     const currentRoute = router.location ? router.location.pathname : "";
@@ -39,6 +39,7 @@ const mapStateToProps = ({ progressIndicator, dataExplorer, router, multiselect,
         isMSToolbarVisible,
         checkedList: multiselect.checkedList,
         working,
+        searchBarValue: searchBar.searchValue,
     };
 };
 

commit 1d2c756a9f8d3a6de62091d45e2a62702317b504
Author: Lisa Knox <lisaknox83 at gmail.com>
Date:   Mon May 13 10:23:25 2024 -0400

    21364: css tweaks Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox at curii.com>

diff --git a/services/workbench2/src/components/data-explorer/data-explorer.tsx b/services/workbench2/src/components/data-explorer/data-explorer.tsx
index 0fb77a6a1b..91ece48c3a 100644
--- a/services/workbench2/src/components/data-explorer/data-explorer.tsx
+++ b/services/workbench2/src/components/data-explorer/data-explorer.tsx
@@ -36,7 +36,7 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
         overflow: "auto",
     },
     loadMoreContainer: {
-        display: "flex",
+        minWidth: '8rem',
     },
     root: {
         height: "100%",
@@ -45,9 +45,11 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
         padding: 0,
     },
     numResults: {
-        marginTop: "10px",
-        fontSize: "12px",
-        minWidth: "5rem",
+        marginTop: 0,
+        fontSize: "10px",
+        marginLeft: "10px",
+        marginBottom: '-0.5rem',
+        minWidth: '8.5rem',
     },
     title: {
         display: "inline-block",
@@ -323,8 +325,8 @@ export const DataExplorer = withStyles(styles)(
                                         />
                                     ) : (
                                         <Grid className={classes.loadMoreContainer}>
-                                            <Typography className={classes.numResults}>
-                                                Showing {items.length} of {itemsAvailable} results
+                                            <Typography  className={classes.numResults}>
+                                                Showing {items.length} / {itemsAvailable} results
                                             </Typography>
                                             <Button
                                                 size="small"

commit 6af02d6e6596f45ac761daa04a53b2466e86ea98
Author: Lisa Knox <lisaknox83 at gmail.com>
Date:   Fri May 10 15:06:32 2024 -0400

    21364: added search results tally Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox at curii.com>

diff --git a/services/workbench2/src/components/data-explorer/data-explorer.tsx b/services/workbench2/src/components/data-explorer/data-explorer.tsx
index 1a77dccf61..0fb77a6a1b 100644
--- a/services/workbench2/src/components/data-explorer/data-explorer.tsx
+++ b/services/workbench2/src/components/data-explorer/data-explorer.tsx
@@ -3,7 +3,7 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import React from "react";
-import { Grid, Paper, Toolbar, StyleRulesCallback, withStyles, WithStyles, TablePagination, IconButton, Tooltip, Button } from "@material-ui/core";
+import { Grid, Paper, Toolbar, StyleRulesCallback, withStyles, WithStyles, TablePagination, IconButton, Tooltip, Button, Typography } from "@material-ui/core";
 import { ColumnSelector } from "components/column-selector/column-selector";
 import { DataTable, DataColumns, DataTableFetchMode } from "components/data-table/data-table";
 import { DataColumn } from "components/data-table/data-column";
@@ -17,7 +17,7 @@ import { CloseIcon, IconType, MaximizeIcon, UnMaximizeIcon, MoreVerticalIcon } f
 import { PaperProps } from "@material-ui/core/Paper";
 import { MPVPanelProps } from "components/multi-panel-view/multi-panel-view";
 
-type CssRules = "titleWrapper" | "searchBox" | "headerMenu" | "toolbar" | "footer" | "root" | "moreOptionsButton" | "title" | 'subProcessTitle' | "dataTable" | "container";
+type CssRules = "titleWrapper" | "searchBox" | "headerMenu" | "toolbar" | "footer" | "loadMoreContainer" | "numResults" | "root" | "moreOptionsButton" | "title" | 'subProcessTitle' | "dataTable" | "container";
 
 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     titleWrapper: {
@@ -35,12 +35,20 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     footer: {
         overflow: "auto",
     },
+    loadMoreContainer: {
+        display: "flex",
+    },
     root: {
         height: "100%",
     },
     moreOptionsButton: {
         padding: 0,
     },
+    numResults: {
+        marginTop: "10px",
+        fontSize: "12px",
+        minWidth: "5rem",
+    },
     title: {
         display: "inline-block",
         paddingLeft: theme.spacing.unit * 2,
@@ -314,16 +322,21 @@ export const DataExplorer = withStyles(styles)(
                                             component="div"
                                         />
                                     ) : (
-                                        <Button
-                                            size="small"
-                                            onClick={this.loadMore}
-                                            variant="contained"
-                                            color="primary"  
-                                            style={{width: '100%', margin: '10px'}}
-                                            disabled={working || items.length >= itemsAvailable}
-                                        >
-                                            Load more
-                                        </Button>
+                                        <Grid className={classes.loadMoreContainer}>
+                                            <Typography className={classes.numResults}>
+                                                Showing {items.length} of {itemsAvailable} results
+                                            </Typography>
+                                            <Button
+                                                size="small"
+                                                onClick={this.loadMore}
+                                                variant="contained"
+                                                color="primary"  
+                                                style={{width: '100%', margin: '10px'}}
+                                                disabled={working || items.length >= itemsAvailable}
+                                            >
+                                                Load more
+                                            </Button>
+                                        </Grid>
                                     )}
                                 </Grid>
                             </Toolbar>

commit 1c9cbb14d4e9c7819b1c2eda89b15ca33b7118a3
Author: Lisa Knox <lisaknox83 at gmail.com>
Date:   Fri May 10 14:40:42 2024 -0400

    21364: added backup search when first search after f5 fails Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox at curii.com>

diff --git a/services/workbench2/src/components/data-explorer/data-explorer.tsx b/services/workbench2/src/components/data-explorer/data-explorer.tsx
index e29ff9c55e..1a77dccf61 100644
--- a/services/workbench2/src/components/data-explorer/data-explorer.tsx
+++ b/services/workbench2/src/components/data-explorer/data-explorer.tsx
@@ -169,7 +169,6 @@ export const DataExplorer = withStyles(styles)(
                 setCheckedListOnStore,
                 checkedList,
                 working,
-                page,
             } = this.props;
             return (
                 <Paper
diff --git a/services/workbench2/src/store/search-bar/search-bar-actions.ts b/services/workbench2/src/store/search-bar/search-bar-actions.ts
index 396c2dfaae..d624c917d9 100644
--- a/services/workbench2/src/store/search-bar/search-bar-actions.ts
+++ b/services/workbench2/src/store/search-bar/search-bar-actions.ts
@@ -39,6 +39,7 @@ export const searchBarActions = unionize({
     MOVE_UP: ofType<{}>(),
     MOVE_DOWN: ofType<{}>(),
     SELECT_FIRST_ITEM: ofType<{}>(),
+    SET_SEARCH_OFFSETS: ofType<Record<string, number>>(),
 });
 
 export type SearchBarActions = UnionOf<typeof searchBarActions>;
@@ -430,3 +431,9 @@ export const moveDown = () =>
     (dispatch: Dispatch) => {
         dispatch(searchBarActions.MOVE_DOWN());
     };
+
+export const setSearchOffsets = (sessionId: string, offset: number) => {
+    return (dispatch: Dispatch) => {
+        dispatch(searchBarActions.SET_SEARCH_OFFSETS({id:[sessionId], offset }));
+    };
+}
\ No newline at end of file
diff --git a/services/workbench2/src/store/search-bar/search-bar-reducer.ts b/services/workbench2/src/store/search-bar/search-bar-reducer.ts
index 05b75bf99c..84c17438a7 100644
--- a/services/workbench2/src/store/search-bar/search-bar-reducer.ts
+++ b/services/workbench2/src/store/search-bar/search-bar-reducer.ts
@@ -24,6 +24,7 @@ interface SearchBar {
     savedQueries: SearchBarAdvancedFormData[];
     recentQueries: string[];
     selectedItem: SearchBarSelectedItem;
+    searchOffsets: Record<string, number>;
 }
 
 export enum SearchView {
@@ -43,6 +44,7 @@ const initialState: SearchBar = {
         id: '',
         query: ''
     },
+    searchOffsets: {},
 };
 
 const makeSelectedItem = (id: string, query?: string): SearchBarSelectedItem => ({ id, query: query ? query : id });
@@ -143,5 +145,8 @@ export const searchBarReducer = (state = initialState, action: SearchBarActions)
                 selectedItem
             };
         },
+        SET_SEARCH_OFFSETS: ({id, offset}) => {
+            return {...state, searchOffsets: {...state.searchOffsets, [id]: offset}};
+        },
         default: () => state
     });
diff --git a/services/workbench2/src/store/search-results-panel/search-results-middleware-service.ts b/services/workbench2/src/store/search-results-panel/search-results-middleware-service.ts
index 11462c0618..2c444813a1 100644
--- a/services/workbench2/src/store/search-results-panel/search-results-middleware-service.ts
+++ b/services/workbench2/src/store/search-results-panel/search-results-middleware-service.ts
@@ -18,6 +18,7 @@ import {
     getSearchSessions,
     queryToFilters,
     getAdvancedDataFromQuery,
+    setSearchOffsets,
 } from 'store/search-bar/search-bar-actions';
 import { getSortColumn } from "store/data-explorer/data-explorer-reducer";
 import { FilterBuilder, joinFilters } from 'services/api/filter-builder';
@@ -28,6 +29,8 @@ import { ResourceKind } from 'models/resource';
 import { ContainerRequestResource } from 'models/container-request';
 import { progressIndicatorActions } from 'store/progress-indicator/progress-indicator-actions';
 import { dataExplorerActions } from 'store/data-explorer/data-explorer-action';
+import { Session } from 'models/session';
+import { SEARCH_RESULTS_PANEL_ID } from 'store/search-results-panel/search-results-panel-actions';
 
 export class SearchResultsMiddlewareService extends DataExplorerMiddlewareService {
     constructor(private services: ServiceRepository, id: string) {
@@ -50,7 +53,7 @@ export class SearchResultsMiddlewareService extends DataExplorerMiddlewareServic
             items: [] as GroupContentsResource[],
             kind: '',
             offset: 0,
-            limit: 10
+            limit: 50
         };
 
         if (criteriaChanged) {
@@ -69,6 +72,9 @@ export class SearchResultsMiddlewareService extends DataExplorerMiddlewareServic
 
         sessions.forEach(session => {
             const params = getParams(dataExplorer, searchValue, session.apiRevision);
+            //this prevents double fetching of the same search results when a new session is logged in
+            api.dispatch<any>(setSearchOffsets(session.clusterId, params.offset ));
+
             this.services.groupsService.contents('', params, session)
                 .then((response) => {
                     api.dispatch(updateResources(response.items));
@@ -100,6 +106,48 @@ export class SearchResultsMiddlewareService extends DataExplorerMiddlewareServic
     }
 }
 
+export const searchSingleCluster = (session: Session, searchValue: string) => 
+    (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
+        const state = getState();
+        const dataExplorer = getDataExplorer(state.dataExplorer, SEARCH_RESULTS_PANEL_ID);
+
+        if (searchValue.trim() === '') {
+            return;
+        }
+
+        const params = getParams(dataExplorer, searchValue, session.apiRevision);
+        
+        // If the clusterId & search offset has already been fetched, we don't need to fetch the results again
+        if(state.searchBar.searchOffsets[session.clusterId] === params.offset) {
+            return;
+        }
+
+        dispatch(progressIndicatorActions.START_WORKING(SEARCH_RESULTS_PANEL_ID))
+
+        services.groupsService.contents('', params, session)
+            .then((response) => {
+                dispatch<any>(setSearchOffsets(session.clusterId, params.offset ));
+                dispatch(updateResources(response.items));
+                dispatch(appendItems(response));
+                // Request all containers for process status to be available
+                const containerRequests = response.items.filter((item) => item.kind === ResourceKind.CONTAINER_REQUEST) as ContainerRequestResource[];
+                const containerUuids = containerRequests.map(container => container.containerUuid).filter(uuid => uuid !== null) as string[];
+                containerUuids.length && services.containerService
+                    .list({
+                        filters: new FilterBuilder()
+                            .addIn('uuid', containerUuids)
+                            .getFilters()
+                    }, false)
+                    .then((containers) => {
+                        dispatch(updateResources(containers.items));
+                    });
+                }).catch(() => {
+                    dispatch(couldNotFetchSearchResults(session.clusterId));
+                    dispatch(progressIndicatorActions.STOP_WORKING(SEARCH_RESULTS_PANEL_ID))
+                });
+        dispatch(progressIndicatorActions.STOP_WORKING(SEARCH_RESULTS_PANEL_ID))
+}
+
 const typeFilters = (columns: DataColumns<string, GroupContentsResource>) => serializeResourceTypeFilters(getDataExplorerColumnFilters(columns, ProjectPanelColumnNames.TYPE));
 
 export const getParams = (dataExplorer: DataExplorer, query: string, apiRevision: number) => ({
@@ -142,10 +190,6 @@ export const setItems = (listResults: ListResults<GroupContentsResource>) =>
 const resetItemsAvailable = () =>
     searchResultsPanelActions.RESET_ITEMS_AVAILABLE();
 
-const setItemsAvailable = (id: string, itemsAvailable: number) => {
-
-}
-
 export const appendItems = (listResults: ListResults<GroupContentsResource>) =>
     searchResultsPanelActions.APPEND_ITEMS({
         ...listResultsToDataExplorerItemsMeta(listResults),
diff --git a/services/workbench2/src/views-components/search-bar/search-bar-view.tsx b/services/workbench2/src/views-components/search-bar/search-bar-view.tsx
index eba281c9f0..0c08e38b7d 100644
--- a/services/workbench2/src/views-components/search-bar/search-bar-view.tsx
+++ b/services/workbench2/src/views-components/search-bar/search-bar-view.tsx
@@ -24,6 +24,7 @@ import { KEY_CODE_DOWN, KEY_CODE_ESC, KEY_CODE_UP, KEY_ENTER } from "common/code
 import { debounce } from "debounce";
 import { Vocabulary } from "models/vocabulary";
 import { connectVocabulary } from "../resource-properties-form/property-field-common";
+import { Session } from "models/session";
 
 type CssRules = "container" | "containerSearchViewOpened" | "input" | "view";
 
@@ -64,6 +65,7 @@ interface SearchBarViewDataProps {
     isPopoverOpen: boolean;
     debounce?: number;
     vocabulary?: Vocabulary;
+    sessions: Session[];
 }
 
 export type SearchBarActionProps = SearchBarViewActionProps &
@@ -81,6 +83,7 @@ interface SearchBarViewActionProps {
     moveUp: () => void;
     moveDown: () => void;
     setAdvancedDataFromSearchValue: (search: string, vocabulary?: Vocabulary) => void;
+    searchSingleCluster: (session: Session, searchValue: string) => any;
 }
 
 type SearchBarViewProps = SearchBarDataProps & SearchBarActionProps & WithStyles<CssRules>;
@@ -137,6 +140,10 @@ export const SearchBarView = compose(
     withStyles(styles)
 )(
     class extends React.Component<SearchBarViewProps> {
+        state={
+            loggedInSessions: [],
+        }
+
         debouncedSearch = debounce(() => {
             this.props.onSearch(this.props.searchValue);
         }, 1000);
@@ -151,6 +158,21 @@ export const SearchBarView = compose(
             this.props.onSubmit(event);
         };
 
+        componentDidMount(): void {
+            this.setState({ loggedInSessions: this.props.sessions.filter((ss) => ss.loggedIn && ss.userIsActive)});
+        }
+
+        componentDidUpdate( prevProps: Readonly<SearchBarViewProps>, prevState: Readonly<{loggedInSessions: Session[]}>, snapshot?: any ): void {
+            if (prevProps.sessions !== this.props.sessions) {
+                this.setState({ loggedInSessions: this.props.sessions.filter((ss) => ss.loggedIn)});
+            }
+            //if a new session is logged in after a search is started, search the new cluster and append those to the results
+            if(prevState.loggedInSessions.length !== this.state.loggedInSessions.length){
+                const newLogin = this.state.loggedInSessions.filter((ss) => !prevState.loggedInSessions.includes(ss));
+                this.props.searchSingleCluster(newLogin[0], this.props.searchValue);
+            }
+        }
+
         componentWillUnmount() {
             this.debouncedSearch.clear();
         }
diff --git a/services/workbench2/src/views-components/search-bar/search-bar.tsx b/services/workbench2/src/views-components/search-bar/search-bar.tsx
index 6a4d2a620e..92175b6ec4 100644
--- a/services/workbench2/src/views-components/search-bar/search-bar.tsx
+++ b/services/workbench2/src/views-components/search-bar/search-bar.tsx
@@ -21,8 +21,10 @@ import {
 import { SearchBarView, SearchBarActionProps, SearchBarDataProps } from 'views-components/search-bar/search-bar-view';
 import { SearchBarAdvancedFormData } from 'models/search-bar';
 import { Vocabulary } from 'models/vocabulary';
+import { searchSingleCluster } from 'store/search-results-panel/search-results-middleware-service';
+import { Session } from 'models/session';
 
-const mapStateToProps = ({ searchBar, form }: RootState): SearchBarDataProps => {
+const mapStateToProps = ({ searchBar, form , auth }: RootState): SearchBarDataProps => {
     return {
         searchValue: searchBar.searchValue,
         currentView: searchBar.currentView,
@@ -33,7 +35,8 @@ const mapStateToProps = ({ searchBar, form }: RootState): SearchBarDataProps =>
         tags: form[SEARCH_BAR_ADVANCED_FORM_NAME],
         saveQuery: form[SEARCH_BAR_ADVANCED_FORM_NAME] &&
             form[SEARCH_BAR_ADVANCED_FORM_NAME].values &&
-            form[SEARCH_BAR_ADVANCED_FORM_NAME].values!.saveQuery
+            form[SEARCH_BAR_ADVANCED_FORM_NAME].values!.saveQuery,
+        sessions: auth.sessions,
     };
 };
 
@@ -51,7 +54,8 @@ const mapDispatchToProps = (dispatch: Dispatch): SearchBarActionProps => ({
     editSavedQuery: (data: SearchBarAdvancedFormData) => dispatch<any>(editSavedQuery(data)),
     moveUp: () => dispatch<any>(moveUp()),
     moveDown: () => dispatch<any>(moveDown()),
-    setAdvancedDataFromSearchValue: (search: string, vocabulary: Vocabulary) => dispatch<any>(setAdvancedDataFromSearchValue(search, vocabulary))
+    setAdvancedDataFromSearchValue: (search: string, vocabulary: Vocabulary) => dispatch<any>(setAdvancedDataFromSearchValue(search, vocabulary)),
+    searchSingleCluster: (session: Session, searchValue: string) => {dispatch<any>(searchSingleCluster(session, searchValue))},
 });
 
 export const SearchBar = connect(mapStateToProps, mapDispatchToProps)(SearchBarView);

commit f15581587eff2700fa6f32f85c82ecbcb5af68e8
Author: Lisa Knox <lisaknox83 at gmail.com>
Date:   Tue May 7 11:05:09 2024 -0400

    21364: removed responseMap and lastQuery Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox at curii.com>

diff --git a/services/workbench2/src/store/search-results-panel/search-results-middleware-service.ts b/services/workbench2/src/store/search-results-panel/search-results-middleware-service.ts
index 866e148bcd..11462c0618 100644
--- a/services/workbench2/src/store/search-results-panel/search-results-middleware-service.ts
+++ b/services/workbench2/src/store/search-results-panel/search-results-middleware-service.ts
@@ -30,7 +30,7 @@ import { progressIndicatorActions } from 'store/progress-indicator/progress-indi
 import { dataExplorerActions } from 'store/data-explorer/data-explorer-action';
 
 export class SearchResultsMiddlewareService extends DataExplorerMiddlewareService {
-    constructor(private services: ServiceRepository, id: string, private responseMap: Record<string, number> = {}) {
+    constructor(private services: ServiceRepository, id: string) {
         super(id);
     }
 
@@ -40,11 +40,6 @@ export class SearchResultsMiddlewareService extends DataExplorerMiddlewareServic
         const searchValue = state.searchBar.searchValue;
         const { cluster: clusterId } = getAdvancedDataFromQuery(searchValue);
         const sessions = getSearchSessions(clusterId, state.auth.sessions);
-        const recentQueries = this.services.searchService.getRecentQueries();
-        //the last query is compared to the current query to check if the value has changed
-        //once the search button is clicked, the value is pushed to the recentQueries array
-        //therefore, the last query is the second to last element in the array 
-        const lastQuery = recentQueries[recentQueries.length - 2];
 
         if (searchValue.trim() === '') {
             return;
@@ -76,11 +71,6 @@ export class SearchResultsMiddlewareService extends DataExplorerMiddlewareServic
             const params = getParams(dataExplorer, searchValue, session.apiRevision);
             this.services.groupsService.contents('', params, session)
                 .then((response) => {
-                    //if items were added or deleted, we ignore them for "load more" button purposes
-                    if (lastQuery === searchValue && this.responseMap[session.clusterId] && this.responseMap[session.clusterId] !== response.itemsAvailable) {
-                        response.itemsAvailable = this.responseMap[session.clusterId];
-                    }
-                    this.responseMap[session.clusterId] = response.itemsAvailable;
                     api.dispatch(updateResources(response.items));
                     api.dispatch(appendItems(response));
                     numberOfResolvedResponses++;
@@ -149,9 +139,13 @@ export const setItems = (listResults: ListResults<GroupContentsResource>) =>
         items: listResults.items.map(resource => resource.uuid),
     });
 
-export const resetItemsAvailable = () =>
+const resetItemsAvailable = () =>
     searchResultsPanelActions.RESET_ITEMS_AVAILABLE();
 
+const setItemsAvailable = (id: string, itemsAvailable: number) => {
+
+}
+
 export const appendItems = (listResults: ListResults<GroupContentsResource>) =>
     searchResultsPanelActions.APPEND_ITEMS({
         ...listResultsToDataExplorerItemsMeta(listResults),

commit 18e6bbd6a0bb60b7f1137fab2dfb88ed7804a8ac
Author: Lisa Knox <lisaknox83 at gmail.com>
Date:   Mon May 6 15:05:53 2024 -0400

    21364: added comment for lastQuery var  Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox at curii.com>

diff --git a/services/workbench2/src/store/search-results-panel/search-results-middleware-service.ts b/services/workbench2/src/store/search-results-panel/search-results-middleware-service.ts
index 562b3126e8..866e148bcd 100644
--- a/services/workbench2/src/store/search-results-panel/search-results-middleware-service.ts
+++ b/services/workbench2/src/store/search-results-panel/search-results-middleware-service.ts
@@ -41,6 +41,9 @@ export class SearchResultsMiddlewareService extends DataExplorerMiddlewareServic
         const { cluster: clusterId } = getAdvancedDataFromQuery(searchValue);
         const sessions = getSearchSessions(clusterId, state.auth.sessions);
         const recentQueries = this.services.searchService.getRecentQueries();
+        //the last query is compared to the current query to check if the value has changed
+        //once the search button is clicked, the value is pushed to the recentQueries array
+        //therefore, the last query is the second to last element in the array 
         const lastQuery = recentQueries[recentQueries.length - 2];
 
         if (searchValue.trim() === '') {

commit 48f4ed31a9a20400e4f0707fdbf1c64ac6d04157
Author: Lisa Knox <lisaknox83 at gmail.com>
Date:   Mon Apr 8 14:39:47 2024 -0400

    21364: changed itemsAvailable to not change on loadMore Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox at curii.com>

diff --git a/services/workbench2/src/store/search-results-panel/search-results-middleware-service.ts b/services/workbench2/src/store/search-results-panel/search-results-middleware-service.ts
index 8e5ad1bec1..562b3126e8 100644
--- a/services/workbench2/src/store/search-results-panel/search-results-middleware-service.ts
+++ b/services/workbench2/src/store/search-results-panel/search-results-middleware-service.ts
@@ -30,7 +30,7 @@ import { progressIndicatorActions } from 'store/progress-indicator/progress-indi
 import { dataExplorerActions } from 'store/data-explorer/data-explorer-action';
 
 export class SearchResultsMiddlewareService extends DataExplorerMiddlewareService {
-    constructor(private services: ServiceRepository, id: string) {
+    constructor(private services: ServiceRepository, id: string, private responseMap: Record<string, number> = {}) {
         super(id);
     }
 
@@ -40,6 +40,8 @@ export class SearchResultsMiddlewareService extends DataExplorerMiddlewareServic
         const searchValue = state.searchBar.searchValue;
         const { cluster: clusterId } = getAdvancedDataFromQuery(searchValue);
         const sessions = getSearchSessions(clusterId, state.auth.sessions);
+        const recentQueries = this.services.searchService.getRecentQueries();
+        const lastQuery = recentQueries[recentQueries.length - 2];
 
         if (searchValue.trim() === '') {
             return;
@@ -63,16 +65,19 @@ export class SearchResultsMiddlewareService extends DataExplorerMiddlewareServic
         api.dispatch(progressIndicatorActions.START_WORKING(this.id))
         api.dispatch(dataExplorerActions.SET_IS_NOT_FOUND({ id: this.id, isNotFound: false }));
 
-        //In all other data tables, itemsAvailable will equal the number of returned items for a single session.
-        //In SearchResultsPanel, multiple sessions can be queried so items available needs to be
-        //reset in order to prevent adding the current value to the previous value every time 
-        //the 'load more' button is clicked.
+        //In SearchResultsPanel, if we don't reset the items available, the items available will
+        //will be added to the previous value every time the 'load more' button is clicked.
         api.dispatch(resetItemsAvailable());
 
         sessions.forEach(session => {
             const params = getParams(dataExplorer, searchValue, session.apiRevision);
             this.services.groupsService.contents('', params, session)
                 .then((response) => {
+                    //if items were added or deleted, we ignore them for "load more" button purposes
+                    if (lastQuery === searchValue && this.responseMap[session.clusterId] && this.responseMap[session.clusterId] !== response.itemsAvailable) {
+                        response.itemsAvailable = this.responseMap[session.clusterId];
+                    }
+                    this.responseMap[session.clusterId] = response.itemsAvailable;
                     api.dispatch(updateResources(response.items));
                     api.dispatch(appendItems(response));
                     numberOfResolvedResponses++;

commit 7a840279498805223af62491cb9b18fd1335bc9c
Author: Lisa Knox <lisaknox83 at gmail.com>
Date:   Fri Apr 5 11:45:15 2024 -0400

    21364: added commentary Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox at curii.com>

diff --git a/services/workbench2/src/store/search-results-panel/search-results-middleware-service.ts b/services/workbench2/src/store/search-results-panel/search-results-middleware-service.ts
index f21343819e..8e5ad1bec1 100644
--- a/services/workbench2/src/store/search-results-panel/search-results-middleware-service.ts
+++ b/services/workbench2/src/store/search-results-panel/search-results-middleware-service.ts
@@ -63,6 +63,10 @@ export class SearchResultsMiddlewareService extends DataExplorerMiddlewareServic
         api.dispatch(progressIndicatorActions.START_WORKING(this.id))
         api.dispatch(dataExplorerActions.SET_IS_NOT_FOUND({ id: this.id, isNotFound: false }));
 
+        //In all other data tables, itemsAvailable will equal the number of returned items for a single session.
+        //In SearchResultsPanel, multiple sessions can be queried so items available needs to be
+        //reset in order to prevent adding the current value to the previous value every time 
+        //the 'load more' button is clicked.
         api.dispatch(resetItemsAvailable());
 
         sessions.forEach(session => {

commit 14ea76bb7d708577c4ea59f6baafc1f6facaf91b
Author: Lisa Knox <lisaknox83 at gmail.com>
Date:   Fri Apr 5 10:20:41 2024 -0400

    21364: changed button disable to track itemsAvailable.length Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox at curii.com>

diff --git a/services/workbench2/src/components/data-explorer/data-explorer.tsx b/services/workbench2/src/components/data-explorer/data-explorer.tsx
index 9714a265a4..e29ff9c55e 100644
--- a/services/workbench2/src/components/data-explorer/data-explorer.tsx
+++ b/services/workbench2/src/components/data-explorer/data-explorer.tsx
@@ -321,7 +321,7 @@ export const DataExplorer = withStyles(styles)(
                                             variant="contained"
                                             color="primary"  
                                             style={{width: '100%', margin: '10px'}}
-                                            disabled={ working || (page + 1) * rowsPerPage >= itemsAvailable}
+                                            disabled={working || items.length >= itemsAvailable}
                                         >
                                             Load more
                                         </Button>

commit 5b7b834bcab1a32fe77851d78fd984e1c96465ee
Author: Lisa Knox <lisaknox83 at gmail.com>
Date:   Wed Apr 3 14:26:08 2024 -0400

    21364: added reset_items_available method Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox at curii.com>

diff --git a/services/workbench2/src/store/data-explorer/data-explorer-action.ts b/services/workbench2/src/store/data-explorer/data-explorer-action.ts
index a330b97426..9aa5e2e748 100644
--- a/services/workbench2/src/store/data-explorer/data-explorer-action.ts
+++ b/services/workbench2/src/store/data-explorer/data-explorer-action.ts
@@ -15,6 +15,7 @@ export enum DataTableRequestState {
 export const dataExplorerActions = unionize({
     CLEAR: ofType<{ id: string }>(),
     RESET_PAGINATION: ofType<{ id: string }>(),
+    RESET_ITEMS_AVAILABLE: ofType<{ id: string }>(),
     REQUEST_ITEMS: ofType<{ id: string; criteriaChanged?: boolean, background?: boolean }>(),
     REQUEST_STATE: ofType<{ id: string; criteriaChanged?: boolean }>(),
     SET_FETCH_MODE: ofType<{ id: string; fetchMode: DataTableFetchMode }>(),
@@ -37,6 +38,7 @@ export type DataExplorerAction = UnionOf<typeof dataExplorerActions>;
 export const bindDataExplorerActions = (id: string) => ({
     CLEAR: () => dataExplorerActions.CLEAR({ id }),
     RESET_PAGINATION: () => dataExplorerActions.RESET_PAGINATION({ id }),
+    RESET_ITEMS_AVAILABLE: () => dataExplorerActions.RESET_ITEMS_AVAILABLE({ id }),
     REQUEST_ITEMS: (criteriaChanged?: boolean, background?: boolean) => dataExplorerActions.REQUEST_ITEMS({ id, criteriaChanged, background }),
     SET_FETCH_MODE: (payload: { fetchMode: DataTableFetchMode }) => dataExplorerActions.SET_FETCH_MODE({ ...payload, id }),
     SET_COLUMNS: (payload: { columns: DataColumns<any, any> }) => dataExplorerActions.SET_COLUMNS({ ...payload, id }),
diff --git a/services/workbench2/src/store/data-explorer/data-explorer-reducer.ts b/services/workbench2/src/store/data-explorer/data-explorer-reducer.ts
index 41dca03b68..1c32891e52 100644
--- a/services/workbench2/src/store/data-explorer/data-explorer-reducer.ts
+++ b/services/workbench2/src/store/data-explorer/data-explorer-reducer.ts
@@ -91,11 +91,14 @@ export const dataExplorerReducer = (
             })
         ),
 
+        RESET_ITEMS_AVAILABLE: ({ id }) =>
+            update(state, id, (explorer) => ({ ...explorer, itemsAvailable: 0 })),
+
         APPEND_ITEMS: ({ id, items, itemsAvailable, page, rowsPerPage }) =>
             update(state, id, (explorer) => ({
                 ...explorer,
                 items: state[id].items.concat(items),
-                itemsAvailable: itemsAvailable,
+                itemsAvailable: state[id].itemsAvailable + itemsAvailable,
                 page,
                 rowsPerPage,
             })),
diff --git a/services/workbench2/src/store/search-results-panel/search-results-middleware-service.ts b/services/workbench2/src/store/search-results-panel/search-results-middleware-service.ts
index dab83e0114..f21343819e 100644
--- a/services/workbench2/src/store/search-results-panel/search-results-middleware-service.ts
+++ b/services/workbench2/src/store/search-results-panel/search-results-middleware-service.ts
@@ -63,6 +63,8 @@ export class SearchResultsMiddlewareService extends DataExplorerMiddlewareServic
         api.dispatch(progressIndicatorActions.START_WORKING(this.id))
         api.dispatch(dataExplorerActions.SET_IS_NOT_FOUND({ id: this.id, isNotFound: false }));
 
+        api.dispatch(resetItemsAvailable());
+
         sessions.forEach(session => {
             const params = getParams(dataExplorer, searchValue, session.apiRevision);
             this.services.groupsService.contents('', params, session)
@@ -135,6 +137,9 @@ export const setItems = (listResults: ListResults<GroupContentsResource>) =>
         items: listResults.items.map(resource => resource.uuid),
     });
 
+export const resetItemsAvailable = () =>
+    searchResultsPanelActions.RESET_ITEMS_AVAILABLE();
+
 export const appendItems = (listResults: ListResults<GroupContentsResource>) =>
     searchResultsPanelActions.APPEND_ITEMS({
         ...listResultsToDataExplorerItemsMeta(listResults),

commit 1406963ff0e93a3493333d9cc4ed3b3f7f3264d8
Author: Lisa Knox <lisaknox83 at gmail.com>
Date:   Tue Apr 2 10:08:05 2024 -0400

    21364: changed elementPath to only display if am elment is selected Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox at curii.com>

diff --git a/services/workbench2/src/components/data-explorer/data-explorer.tsx b/services/workbench2/src/components/data-explorer/data-explorer.tsx
index 13ad46286c..9714a265a4 100644
--- a/services/workbench2/src/components/data-explorer/data-explorer.tsx
+++ b/services/workbench2/src/components/data-explorer/data-explorer.tsx
@@ -295,7 +295,7 @@ export const DataExplorer = withStyles(styles)(
                             <Toolbar className={classes.footer}>
                                 {elementPath && (
                                     <Grid container>
-                                        <span data-cy="element-path">{elementPath}</span>
+                                        <span data-cy="element-path">{elementPath.length > 2 ? elementPath : ''}</span>
                                     </Grid>
                                 )}
                                 <Grid
@@ -321,7 +321,7 @@ export const DataExplorer = withStyles(styles)(
                                             variant="contained"
                                             color="primary"  
                                             style={{width: '100%', margin: '10px'}}
-                                            disabled={ working || (page + 1) * rowsPerPage >= itemsAvailable || (itemsAvailable === 0 && page === 0)}
+                                            disabled={ working || (page + 1) * rowsPerPage >= itemsAvailable}
                                         >
                                             Load more
                                         </Button>

commit fc1dd95eef3ad41a0bc73bdc1423cd6877e5eb8c
Author: Lisa Knox <lisaknox83 at gmail.com>
Date:   Mon Apr 1 15:27:58 2024 -0400

    21364: loadmore button now disables if it cant load more Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox at curii.com>

diff --git a/services/workbench2/src/components/data-explorer/data-explorer.tsx b/services/workbench2/src/components/data-explorer/data-explorer.tsx
index 83a71ab509..13ad46286c 100644
--- a/services/workbench2/src/components/data-explorer/data-explorer.tsx
+++ b/services/workbench2/src/components/data-explorer/data-explorer.tsx
@@ -169,6 +169,7 @@ export const DataExplorer = withStyles(styles)(
                 setCheckedListOnStore,
                 checkedList,
                 working,
+                page,
             } = this.props;
             return (
                 <Paper
@@ -319,7 +320,8 @@ export const DataExplorer = withStyles(styles)(
                                             onClick={this.loadMore}
                                             variant="contained"
                                             color="primary"  
-                                            style={{width: '100%', margin: '10px'}} 
+                                            style={{width: '100%', margin: '10px'}}
+                                            disabled={ working || (page + 1) * rowsPerPage >= itemsAvailable || (itemsAvailable === 0 && page === 0)}
                                         >
                                             Load more
                                         </Button>
diff --git a/services/workbench2/src/store/data-explorer/data-explorer-reducer.ts b/services/workbench2/src/store/data-explorer/data-explorer-reducer.ts
index 2bc8caad36..41dca03b68 100644
--- a/services/workbench2/src/store/data-explorer/data-explorer-reducer.ts
+++ b/services/workbench2/src/store/data-explorer/data-explorer-reducer.ts
@@ -95,7 +95,7 @@ export const dataExplorerReducer = (
             update(state, id, (explorer) => ({
                 ...explorer,
                 items: state[id].items.concat(items),
-                itemsAvailable: state[id].itemsAvailable + itemsAvailable,
+                itemsAvailable: itemsAvailable,
                 page,
                 rowsPerPage,
             })),
diff --git a/services/workbench2/src/views-components/data-explorer/data-explorer.tsx b/services/workbench2/src/views-components/data-explorer/data-explorer.tsx
index 643949a20e..c2cea62a8b 100644
--- a/services/workbench2/src/views-components/data-explorer/data-explorer.tsx
+++ b/services/workbench2/src/views-components/data-explorer/data-explorer.tsx
@@ -23,7 +23,7 @@ interface Props {
 }
 
 const mapStateToProps = ({ progressIndicator, dataExplorer, router, multiselect, detailsPanel, properties}: RootState, { id }: Props) => {
-    const working = !!progressIndicator.some(p => p.id === id && p.working);
+    const working = !!progressIndicator.some(p => p.working);
     const dataExplorerState = getDataExplorer(dataExplorer, id);
     const currentRoute = router.location ? router.location.pathname : "";
     const isDetailsResourceChecked = multiselect.checkedList[detailsPanel.resourceUuid]

commit 11f199f276312d4f73b7a80bd00abce337176917
Author: Lisa Knox <lisaknox83 at gmail.com>
Date:   Mon Apr 1 14:49:19 2024 -0400

    21364: fixed loadmore button css Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox at curii.com>

diff --git a/services/workbench2/src/components/data-explorer/data-explorer.tsx b/services/workbench2/src/components/data-explorer/data-explorer.tsx
index ba710bc783..83a71ab509 100644
--- a/services/workbench2/src/components/data-explorer/data-explorer.tsx
+++ b/services/workbench2/src/components/data-explorer/data-explorer.tsx
@@ -315,9 +315,11 @@ export const DataExplorer = withStyles(styles)(
                                         />
                                     ) : (
                                         <Button
-                                            variant="text"
-                                            size="medium"
+                                            size="small"
                                             onClick={this.loadMore}
+                                            variant="contained"
+                                            color="primary"  
+                                            style={{width: '100%', margin: '10px'}} 
                                         >
                                             Load more
                                         </Button>

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list