1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { RootState } from 'store/store';
6 import { Dispatch } from 'redux';
7 import { connect } from 'react-redux';
9 SiteManagerPanelRoot, SiteManagerPanelRootActionProps,
10 SiteManagerPanelRootDataProps
11 } from "views/site-manager-panel/site-manager-panel-root";
12 import { Session } from "models/session";
13 import { toggleSession, removeSession } from "store/auth/auth-action-session";
15 const mapStateToProps = (state: RootState): SiteManagerPanelRootDataProps => {
17 sessions: state.auth.sessions,
18 remoteHostsConfig: state.auth.remoteHostsConfig,
19 localClusterConfig: state.auth.remoteHostsConfig[state.auth.localCluster]
23 const mapDispatchToProps = (dispatch: Dispatch): SiteManagerPanelRootActionProps => ({
24 toggleSession: (session: Session) => {
25 dispatch<any>(toggleSession(session));
27 removeSession: (session: Session) => {
28 dispatch<any>(removeSession(session.clusterId));
32 export const SiteManagerPanel = connect(mapStateToProps, mapDispatchToProps)(SiteManagerPanelRoot);