import { Config } from 'common/config';
import { Session } from "models/session";
import { toggleOne, deselectAllOthers } from "store/multiselect/multiselect-actions";
-import { progressIndicatorActions } from 'store/progress-indicator/progress-indicator-actions';
-import { SEARCH_RESULTS_PANEL_ID } from 'store/search-results-panel/search-results-panel-actions';
export interface SearchResultsPanelDataProps {
data: SearchBarAdvancedFormData;
sessions: Session[];
remoteHostsConfig: { [key: string]: Config };
localCluster: string;
- numberOfItems: number;
}
export interface SearchResultsPanelActionProps {
onContextMenu: (event: React.MouseEvent<HTMLElement>, item: string) => void;
onDialogOpen: (ownerUuid: string) => void;
onItemDoubleClick: (item: string) => void;
- startSpinner: () => void;
- stopSpinner: () => void;
}
export type SearchResultsPanelProps = SearchResultsPanelDataProps & SearchResultsPanelActionProps;
const mapStateToProps = (rootState: RootState) => {
- const { dataExplorer } = rootState;
- const numberOfItems = dataExplorer[SEARCH_RESULTS_PANEL_ID].items.length;
return {
user: rootState.auth.user,
sessions: rootState.auth.sessions,
remoteHostsConfig: rootState.auth.remoteHostsConfig,
localCluster: rootState.auth.localCluster,
- numberOfItems,
};
};
},
onItemDoubleClick: uuid => {
dispatch<any>(navigateTo(uuid));
- },
- startSpinner: () => {
- dispatch<any>(progressIndicatorActions.START_WORKING(SEARCH_RESULTS_PANEL_ID));
- },
- stopSpinner: () => {
- dispatch<any>(progressIndicatorActions.STOP_WORKING(SEARCH_RESULTS_PANEL_ID));
- },
+ }
});
export const SearchResultsPanel = connect(mapStateToProps, mapDispatchToProps)(SearchResultsPanelView);