Files
mattermost/webapp/channels/src/components/admin_console/license_settings/index.ts
Harshil Sharma b4a1b33d39 Added post limit warning (#26793)
* Renamed user limit API to app limit API

* Added post warning limit

* Added tests

* Fixed types

* Renamed AppLimits to ServerLimits

* Fixed tests and review fixes

* Updated generated code

* Updated server i18n

* Fixed TestCreateUserOrGuest test

* Exclude deleted posts from post count for liims

* Reduced limits for ease of testing

* Restored original limts
2024-04-18 11:50:30 +05:30

52 lines
1.8 KiB
TypeScript

// 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 type {Dispatch} from 'redux';
import {uploadLicense, removeLicense, getPrevTrialLicense} from 'mattermost-redux/actions/admin';
import {getLicenseConfig} from 'mattermost-redux/actions/general';
import {getServerLimits} from 'mattermost-redux/actions/limits';
import {getFilteredUsersStats} from 'mattermost-redux/actions/users';
import {getConfig} from 'mattermost-redux/selectors/entities/general';
import {getFilteredUsersStats as selectFilteredUserStats} from 'mattermost-redux/selectors/entities/users';
import {requestTrialLicense, upgradeToE0Status, upgradeToE0, restartServer, ping} from 'actions/admin_actions';
import {openModal} from 'actions/views/modals';
import type {GlobalState} from 'types/store';
import LicenseSettings from './license_settings';
function mapStateToProps(state: GlobalState) {
const config = getConfig(state);
return {
totalUsers: selectFilteredUserStats(state)?.total_users_count || 0,
upgradedFromTE: config.UpgradedFromTE === 'true',
prevTrialLicense: state.entities.admin.prevTrialLicense,
};
}
function mapDispatchToProps(dispatch: Dispatch) {
return {
actions: bindActionCreators({
getLicenseConfig,
uploadLicense,
removeLicense,
getPrevTrialLicense,
upgradeToE0,
upgradeToE0Status,
restartServer,
ping,
requestTrialLicense,
openModal,
getFilteredUsersStats,
getServerLimits,
}, dispatch),
};
}
export default connect(mapStateToProps, mapDispatchToProps)(LicenseSettings);