text: // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
  // See LICENSE.txt for license information.
  
  import {connect} from 'react-redux';
  import {bindActionCreators} from 'redux';
  import {getConfig, getEnvironmentConfig} from 'mattermost-redux/actions/admin';
  import {loadRolesIfNeeded, editRole} from 'mattermost-redux/actions/roles';
  import * as Selectors from 'mattermost-redux/selectors/entities/admin';
  import {withRouter} from 'react-router-dom';
  import {getConfig as getGeneralConfig, getLicense} from 'mattermost-redux/selectors/entities/general';
  import {getRoles} from 'mattermost-redux/selectors/entities/roles';
  import {isCurrentUserSystemAdmin} from 'mattermost-redux/selectors/entities/users';
  
  import {setNavigationBlocked, deferNavigation, cancelNavigation, confirmNavigation} from 'actions/admin_actions.jsx';
  import {getNavigationBlocked, showNavigationPrompt} from 'selectors/views/admin';
  import {getAdminDefinition} from 'selectors/admin_console';
  
  import AdminConsole from './admin_console.jsx';
  
  function mapStateToProps(state) {
      const generalConfig = getGeneralConfig(state);
      const buildEnterpriseReady = generalConfig.BuildEnterpriseReady === 'true';
      const adminDefinition = getAdminDefinition(state);
  
      return {
          config: Selectors.getConfig(state),
          environmentConfig: Selectors.getEnvironmentConfig(state),
          license: getLicense(state),
          buildEnterpriseReady,
          navigationBlocked: getNavigationBlocked(state),
          showNavigationPrompt: showNavigationPrompt(state),
          isCurrentUserSystemAdmin: isCurrentUserSystemAdmin(state),
          roles: getRoles(state),
          adminDefinition,
      };
  }
  
  function mapDispatchToProps(dispatch) {
      return {
          actions: bindActionCreators({
              getConfig,
              getEnvironmentConfig,
              setNavigationBlocked,
              deferNavigation,
              cancelNavigation,
              confirmNavigation,
              loadRolesIfNeeded,
              editRole,
          }, dispatch),
      };
  }
  
  export default withRouter(connect(mapStateToProps, mapDispatchToProps)(AdminConsole));
  