This repository has been archived by the owner on Mar 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
/
index.js
51 lines (44 loc) · 1.77 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// 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 {getCurrentUser} from 'mattermost-redux/selectors/entities/users';
import {haveISystemPermission} from 'mattermost-redux/selectors/entities/roles';
import {Permissions} from 'mattermost-redux/constants';
import {getConfig, getLicense} from 'mattermost-redux/selectors/entities/general';
import {getDisplayableErrors} from 'mattermost-redux/selectors/errors';
import {dismissError} from 'mattermost-redux/actions/errors';
import {getStandardAnalytics} from 'mattermost-redux/actions/admin';
import {dismissNotice} from 'actions/views/notice';
import AnnouncementBarController from './announcement_bar_controller.jsx';
function mapStateToProps(state) {
const canViewSystemErrors = haveISystemPermission(state, {permission: Permissions.MANAGE_SYSTEM});
const license = getLicense(state);
const config = getConfig(state);
const user = getCurrentUser(state);
const errors = getDisplayableErrors(state);
const totalUsers = state.entities.admin.analytics.TOTAL_USERS;
let latestError = null;
if (errors && errors.length >= 1) {
latestError = errors[0];
}
return {
license,
config,
user,
canViewSystemErrors,
latestError,
totalUsers,
};
}
function mapDispatchToProps(dispatch) {
const dismissFirstError = dismissError.bind(null, 0);
return {
actions: bindActionCreators({
getStandardAnalytics,
dismissError: dismissFirstError,
dismissNotice,
}, dispatch),
};
}
export default connect(mapStateToProps, mapDispatchToProps)(AnnouncementBarController);