Merge branch 'master' of https://github.com/mattermost/platform into ui-improvements
Этот коммит содержится в:
@@ -18,6 +18,7 @@ var SqlSettingsTab = require('./sql_settings.jsx');
|
||||
var TeamSettingsTab = require('./team_settings.jsx');
|
||||
var ServiceSettingsTab = require('./service_settings.jsx');
|
||||
var TeamUsersTab = require('./team_users.jsx');
|
||||
var TeamAnalyticsTab = require('./team_analytics.jsx');
|
||||
|
||||
export default class AdminController extends React.Component {
|
||||
constructor(props) {
|
||||
@@ -149,6 +150,10 @@ export default class AdminController extends React.Component {
|
||||
if (this.state.teams) {
|
||||
tab = <TeamUsersTab team={this.state.teams[this.state.selectedTeam]} />;
|
||||
}
|
||||
} else if (this.state.selected === 'team_analytics') {
|
||||
if (this.state.teams) {
|
||||
tab = <TeamAnalyticsTab team={this.state.teams[this.state.selectedTeam]} />;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ export default class AdminSidebar extends React.Component {
|
||||
handleClick(name, teamId, e) {
|
||||
e.preventDefault();
|
||||
this.props.selectTab(name, teamId);
|
||||
history.pushState({name: name, teamId: teamId}, null, `/admin_console/${name}/${teamId || ''}`);
|
||||
history.pushState({name, teamId}, null, `/admin_console/${name}/${teamId || ''}`);
|
||||
}
|
||||
|
||||
isSelected(name, teamId) {
|
||||
@@ -121,6 +121,15 @@ export default class AdminSidebar extends React.Component {
|
||||
{'- Users'}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href='#'
|
||||
className={this.isSelected('team_analytics', team.id)}
|
||||
onClick={this.handleClick.bind(this, 'team_analytics', team.id)}
|
||||
>
|
||||
{'- Statistics'}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
50
web/react/components/admin_console/line_chart.jsx
Обычный файл
50
web/react/components/admin_console/line_chart.jsx
Обычный файл
@@ -0,0 +1,50 @@
|
||||
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
|
||||
// See License.txt for license information.
|
||||
|
||||
export default class LineChart extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.initChart = this.initChart.bind(this);
|
||||
this.chart = null;
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.initChart(this.props);
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
if (this.chart) {
|
||||
this.chart.destroy();
|
||||
this.initChart(nextProps);
|
||||
}
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
if (this.chart) {
|
||||
this.chart.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
initChart(props) {
|
||||
var el = ReactDOM.findDOMNode(this);
|
||||
var ctx = el.getContext('2d');
|
||||
this.chart = new Chart(ctx).Line(props.data, props.options || {}); //eslint-disable-line new-cap
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<canvas
|
||||
width={this.props.width}
|
||||
height={this.props.height}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
LineChart.propTypes = {
|
||||
width: React.PropTypes.string,
|
||||
height: React.PropTypes.string,
|
||||
data: React.PropTypes.object,
|
||||
options: React.PropTypes.object
|
||||
};
|
||||
357
web/react/components/admin_console/team_analytics.jsx
Обычный файл
357
web/react/components/admin_console/team_analytics.jsx
Обычный файл
@@ -0,0 +1,357 @@
|
||||
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
|
||||
// See License.txt for license information.
|
||||
|
||||
var Client = require('../../utils/client.jsx');
|
||||
var Utils = require('../../utils/utils.jsx');
|
||||
var LineChart = require('./line_chart.jsx');
|
||||
|
||||
export default class TeamAnalytics extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.getData = this.getData.bind(this);
|
||||
|
||||
this.state = {
|
||||
users: null,
|
||||
serverError: null,
|
||||
channel_open_count: null,
|
||||
channel_private_count: null,
|
||||
post_count: null,
|
||||
post_counts_day: null,
|
||||
user_counts_with_posts_day: null,
|
||||
recent_active_users: null,
|
||||
newly_created_users: null
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.getData(this.props.team.id);
|
||||
}
|
||||
|
||||
getData(teamId) {
|
||||
Client.getAnalytics(
|
||||
teamId,
|
||||
'standard',
|
||||
(data) => {
|
||||
for (var index in data) {
|
||||
if (data[index].name === 'channel_open_count') {
|
||||
this.setState({channel_open_count: data[index].value});
|
||||
}
|
||||
|
||||
if (data[index].name === 'channel_private_count') {
|
||||
this.setState({channel_private_count: data[index].value});
|
||||
}
|
||||
|
||||
if (data[index].name === 'post_count') {
|
||||
this.setState({post_count: data[index].value});
|
||||
}
|
||||
}
|
||||
},
|
||||
(err) => {
|
||||
this.setState({serverError: err.message});
|
||||
}
|
||||
);
|
||||
|
||||
Client.getAnalytics(
|
||||
teamId,
|
||||
'post_counts_day',
|
||||
(data) => {
|
||||
data.reverse();
|
||||
|
||||
var chartData = {
|
||||
labels: [],
|
||||
datasets: [{
|
||||
label: 'Total Posts',
|
||||
fillColor: 'rgba(151,187,205,0.2)',
|
||||
strokeColor: 'rgba(151,187,205,1)',
|
||||
pointColor: 'rgba(151,187,205,1)',
|
||||
pointStrokeColor: '#fff',
|
||||
pointHighlightFill: '#fff',
|
||||
pointHighlightStroke: 'rgba(151,187,205,1)',
|
||||
data: []
|
||||
}]
|
||||
};
|
||||
|
||||
for (var index in data) {
|
||||
if (data[index]) {
|
||||
var row = data[index];
|
||||
chartData.labels.push(row.name);
|
||||
chartData.datasets[0].data.push(row.value);
|
||||
}
|
||||
}
|
||||
|
||||
this.setState({post_counts_day: chartData});
|
||||
},
|
||||
(err) => {
|
||||
this.setState({serverError: err.message});
|
||||
}
|
||||
);
|
||||
|
||||
Client.getAnalytics(
|
||||
teamId,
|
||||
'user_counts_with_posts_day',
|
||||
(data) => {
|
||||
data.reverse();
|
||||
|
||||
var chartData = {
|
||||
labels: [],
|
||||
datasets: [{
|
||||
label: 'Active Users With Posts',
|
||||
fillColor: 'rgba(151,187,205,0.2)',
|
||||
strokeColor: 'rgba(151,187,205,1)',
|
||||
pointColor: 'rgba(151,187,205,1)',
|
||||
pointStrokeColor: '#fff',
|
||||
pointHighlightFill: '#fff',
|
||||
pointHighlightStroke: 'rgba(151,187,205,1)',
|
||||
data: []
|
||||
}]
|
||||
};
|
||||
|
||||
for (var index in data) {
|
||||
if (data[index]) {
|
||||
var row = data[index];
|
||||
chartData.labels.push(row.name);
|
||||
chartData.datasets[0].data.push(row.value);
|
||||
}
|
||||
}
|
||||
|
||||
this.setState({user_counts_with_posts_day: chartData});
|
||||
},
|
||||
(err) => {
|
||||
this.setState({serverError: err.message});
|
||||
}
|
||||
);
|
||||
|
||||
Client.getProfilesForTeam(
|
||||
teamId,
|
||||
(users) => {
|
||||
this.setState({users});
|
||||
|
||||
var usersList = [];
|
||||
for (var id in users) {
|
||||
if (users.hasOwnProperty(id)) {
|
||||
usersList.push(users[id]);
|
||||
}
|
||||
}
|
||||
|
||||
usersList.sort((a, b) => {
|
||||
if (a.last_activity_at < b.last_activity_at) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (a.last_activity_at > b.last_activity_at) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
});
|
||||
|
||||
var recentActive = [];
|
||||
for (let i = 0; i < usersList.length; i++) {
|
||||
recentActive.push(usersList[i]);
|
||||
if (i > 19) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this.setState({recent_active_users: recentActive});
|
||||
|
||||
usersList.sort((a, b) => {
|
||||
if (a.create_at < b.create_at) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (a.create_at > b.create_at) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
});
|
||||
|
||||
var newlyCreated = [];
|
||||
for (let i = 0; i < usersList.length; i++) {
|
||||
newlyCreated.push(usersList[i]);
|
||||
if (i > 19) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this.setState({newly_created_users: newlyCreated});
|
||||
},
|
||||
(err) => {
|
||||
this.setState({serverError: err.message});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
componentWillReceiveProps(newProps) {
|
||||
this.setState({
|
||||
users: null,
|
||||
serverError: null,
|
||||
channel_open_count: null,
|
||||
channel_private_count: null,
|
||||
post_count: null,
|
||||
post_counts_day: null,
|
||||
user_counts_with_posts_day: null,
|
||||
recent_active_users: null,
|
||||
newly_created_users: null
|
||||
});
|
||||
|
||||
this.getData(newProps.team.id);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
}
|
||||
|
||||
render() {
|
||||
var serverError = '';
|
||||
if (this.state.serverError) {
|
||||
serverError = <div className='form-group has-error'><label className='control-label'>{this.state.serverError}</label></div>;
|
||||
}
|
||||
|
||||
var totalCount = (
|
||||
<div className='total-count text-center'>
|
||||
<div>{'Total Users'}</div>
|
||||
<div>{this.state.users == null ? 'Loading...' : Object.keys(this.state.users).length}</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
var openChannelCount = (
|
||||
<div className='total-count text-center'>
|
||||
<div>{'Public Groups'}</div>
|
||||
<div>{this.state.channel_open_count == null ? 'Loading...' : this.state.channel_open_count}</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
var openPrivateCount = (
|
||||
<div className='total-count text-center'>
|
||||
<div>{'Private Groups'}</div>
|
||||
<div>{this.state.channel_private_count == null ? 'Loading...' : this.state.channel_private_count}</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
var postCount = (
|
||||
<div className='total-count text-center'>
|
||||
<div>{'Total Posts'}</div>
|
||||
<div>{this.state.post_count == null ? 'Loading...' : this.state.post_count}</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
var postCountsByDay = (
|
||||
<div className='total-count-by-day'>
|
||||
<div>{'Total Posts'}</div>
|
||||
<div>{'Loading...'}</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
if (this.state.post_counts_day != null) {
|
||||
postCountsByDay = (
|
||||
<div className='total-count-by-day'>
|
||||
<div>{'Total Posts'}</div>
|
||||
<LineChart
|
||||
data={this.state.post_counts_day}
|
||||
width='740'
|
||||
height='225'
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
var usersWithPostsByDay = (
|
||||
<div className='total-count-by-day'>
|
||||
<div>{'Total Posts'}</div>
|
||||
<div>{'Loading...'}</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
if (this.state.user_counts_with_posts_day != null) {
|
||||
usersWithPostsByDay = (
|
||||
<div className='total-count-by-day'>
|
||||
<div>{'Active Users With Posts'}</div>
|
||||
<LineChart
|
||||
data={this.state.user_counts_with_posts_day}
|
||||
width='740'
|
||||
height='225'
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
var recentActiveUser = (
|
||||
<div className='recent-active-users'>
|
||||
<div>{'Recent Active Users'}</div>
|
||||
<div>{'Loading...'}</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
if (this.state.recent_active_users != null) {
|
||||
recentActiveUser = (
|
||||
<div className='recent-active-users'>
|
||||
<div>{'Recent Active Users'}</div>
|
||||
<table width='90%'>
|
||||
<tbody>
|
||||
{
|
||||
this.state.recent_active_users.map((user) => {
|
||||
return (
|
||||
<tr key={user.id}>
|
||||
<td className='recent-active-users-td'>{user.email}</td>
|
||||
<td className='recent-active-users-td'>{Utils.displayDateTime(user.last_activity_at)}</td>
|
||||
</tr>
|
||||
);
|
||||
})
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
var newUsers = (
|
||||
<div className='recent-active-users'>
|
||||
<div>{'Newly Created Users'}</div>
|
||||
<div>{'Loading...'}</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
if (this.state.newly_created_users != null) {
|
||||
newUsers = (
|
||||
<div className='recent-active-users'>
|
||||
<div>{'Newly Created Users'}</div>
|
||||
<table width='90%'>
|
||||
<tbody>
|
||||
{
|
||||
this.state.newly_created_users.map((user) => {
|
||||
return (
|
||||
<tr key={user.id}>
|
||||
<td className='recent-active-users-td'>{user.email}</td>
|
||||
<td className='recent-active-users-td'>{Utils.displayDateTime(user.create_at)}</td>
|
||||
</tr>
|
||||
);
|
||||
})
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='wrapper--fixed'>
|
||||
<h2>{'Statistics for ' + this.props.team.name}</h2>
|
||||
{serverError}
|
||||
{totalCount}
|
||||
{postCount}
|
||||
{openChannelCount}
|
||||
{openPrivateCount}
|
||||
{postCountsByDay}
|
||||
{usersWithPostsByDay}
|
||||
{recentActiveUser}
|
||||
{newUsers}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
TeamAnalytics.propTypes = {
|
||||
team: React.PropTypes.object
|
||||
};
|
||||
@@ -33,14 +33,6 @@ export default class UserList extends React.Component {
|
||||
this.getTeamProfiles(this.props.team.id);
|
||||
}
|
||||
|
||||
// this.setState({
|
||||
// teamId: this.state.teamId,
|
||||
// users: this.state.users,
|
||||
// serverError: this.state.serverError,
|
||||
// showPasswordModal: this.state.showPasswordModal,
|
||||
// user: this.state.user
|
||||
// });
|
||||
|
||||
getTeamProfiles(teamId) {
|
||||
Client.getProfilesForTeam(
|
||||
teamId,
|
||||
@@ -95,8 +87,6 @@ export default class UserList extends React.Component {
|
||||
}
|
||||
|
||||
doPasswordResetDismiss() {
|
||||
this.state.showPasswordModal = false;
|
||||
this.state.user = null;
|
||||
this.setState({
|
||||
teamId: this.state.teamId,
|
||||
users: this.state.users,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
const ChannelStore = require('../stores/channel_store.jsx');
|
||||
const UserStore = require('../stores/user_store.jsx');
|
||||
const PostStore = require('../stores/post_store.jsx');
|
||||
const SearchStore = require('../stores/search_store.jsx');
|
||||
const NavbarSearchBox = require('./search_bar.jsx');
|
||||
const AsyncClient = require('../utils/async_client.jsx');
|
||||
const Client = require('../utils/client.jsx');
|
||||
@@ -35,19 +35,19 @@ export default class ChannelHeader extends React.Component {
|
||||
memberChannel: ChannelStore.getCurrentMember(),
|
||||
memberTeam: UserStore.getCurrentUser(),
|
||||
users: ChannelStore.getCurrentExtraInfo().members,
|
||||
searchVisible: PostStore.getSearchResults() !== null
|
||||
searchVisible: SearchStore.getSearchResults() !== null
|
||||
};
|
||||
}
|
||||
componentDidMount() {
|
||||
ChannelStore.addChangeListener(this.onListenerChange);
|
||||
ChannelStore.addExtraInfoChangeListener(this.onListenerChange);
|
||||
PostStore.addSearchChangeListener(this.onListenerChange);
|
||||
SearchStore.addSearchChangeListener(this.onListenerChange);
|
||||
UserStore.addChangeListener(this.onListenerChange);
|
||||
}
|
||||
componentWillUnmount() {
|
||||
ChannelStore.removeChangeListener(this.onListenerChange);
|
||||
ChannelStore.removeExtraInfoChangeListener(this.onListenerChange);
|
||||
PostStore.removeSearchChangeListener(this.onListenerChange);
|
||||
SearchStore.removeSearchChangeListener(this.onListenerChange);
|
||||
UserStore.addChangeListener(this.onListenerChange);
|
||||
}
|
||||
onListenerChange() {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// See License.txt for license information.
|
||||
|
||||
var UserStore = require('../stores/user_store.jsx');
|
||||
var PostStore = require('../stores/post_store.jsx');
|
||||
var SearchStore = require('../stores/search_store.jsx');
|
||||
var AppDispatcher = require('../dispatcher/app_dispatcher.jsx');
|
||||
var Mention = require('./mention.jsx');
|
||||
|
||||
@@ -66,7 +66,7 @@ export default class MentionList extends React.Component {
|
||||
}
|
||||
}
|
||||
componentDidMount() {
|
||||
PostStore.addMentionDataChangeListener(this.onListenerChange);
|
||||
SearchStore.addMentionDataChangeListener(this.onListenerChange);
|
||||
|
||||
$('.post-right__scroll').scroll(this.onScroll);
|
||||
|
||||
@@ -74,7 +74,7 @@ export default class MentionList extends React.Component {
|
||||
$(document).click(this.onClick);
|
||||
}
|
||||
componentWillUnmount() {
|
||||
PostStore.removeMentionDataChangeListener(this.onListenerChange);
|
||||
SearchStore.removeMentionDataChangeListener(this.onListenerChange);
|
||||
$('body').off('keydown.mentionlist', '#' + this.props.id);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
var client = require('../utils/client.jsx');
|
||||
var AsyncClient = require('../utils/async_client.jsx');
|
||||
var PostStore = require('../stores/post_store.jsx');
|
||||
var SearchStore = require('../stores/search_store.jsx');
|
||||
var AppDispatcher = require('../dispatcher/app_dispatcher.jsx');
|
||||
var utils = require('../utils/utils.jsx');
|
||||
var Constants = require('../utils/constants.jsx');
|
||||
@@ -30,17 +30,17 @@ export default class SearchBar extends React.Component {
|
||||
this.state = state;
|
||||
}
|
||||
getSearchTermStateFromStores() {
|
||||
var term = PostStore.getSearchTerm() || '';
|
||||
var term = SearchStore.getSearchTerm() || '';
|
||||
return {
|
||||
searchTerm: term
|
||||
};
|
||||
}
|
||||
componentDidMount() {
|
||||
PostStore.addSearchTermChangeListener(this.onListenerChange);
|
||||
SearchStore.addSearchTermChangeListener(this.onListenerChange);
|
||||
this.mounted = true;
|
||||
}
|
||||
componentWillUnmount() {
|
||||
PostStore.removeSearchTermChangeListener(this.onListenerChange);
|
||||
SearchStore.removeSearchTermChangeListener(this.onListenerChange);
|
||||
this.mounted = false;
|
||||
}
|
||||
onListenerChange(doSearch, isMentionSearch) {
|
||||
@@ -84,8 +84,8 @@ export default class SearchBar extends React.Component {
|
||||
}
|
||||
handleUserInput(e) {
|
||||
var term = e.target.value;
|
||||
PostStore.storeSearchTerm(term);
|
||||
PostStore.emitSearchTermChange(false);
|
||||
SearchStore.storeSearchTerm(term);
|
||||
SearchStore.emitSearchTermChange(false);
|
||||
this.setState({searchTerm: term});
|
||||
|
||||
this.refs.autocomplete.handleInputChange(e.target, term);
|
||||
@@ -150,8 +150,8 @@ export default class SearchBar extends React.Component {
|
||||
textbox.value = text;
|
||||
utils.setCaretPosition(textbox, preText.length + word.length);
|
||||
|
||||
PostStore.storeSearchTerm(text);
|
||||
PostStore.emitSearchTermChange(false);
|
||||
SearchStore.storeSearchTerm(text);
|
||||
SearchStore.emitSearchTermChange(false);
|
||||
this.setState({searchTerm: text});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
|
||||
// See License.txt for license information.
|
||||
|
||||
var PostStore = require('../stores/post_store.jsx');
|
||||
var SearchStore = require('../stores/search_store.jsx');
|
||||
var UserStore = require('../stores/user_store.jsx');
|
||||
var SearchBox = require('./search_bar.jsx');
|
||||
var Utils = require('../utils/utils.jsx');
|
||||
@@ -9,7 +9,7 @@ var SearchResultsHeader = require('./search_results_header.jsx');
|
||||
var SearchResultsItem = require('./search_results_item.jsx');
|
||||
|
||||
function getStateFromStores() {
|
||||
return {results: PostStore.getSearchResults()};
|
||||
return {results: SearchStore.getSearchResults()};
|
||||
}
|
||||
|
||||
export default class SearchResults extends React.Component {
|
||||
@@ -30,7 +30,7 @@ export default class SearchResults extends React.Component {
|
||||
|
||||
componentDidMount() {
|
||||
this.mounted = true;
|
||||
PostStore.addSearchChangeListener(this.onChange);
|
||||
SearchStore.addSearchChangeListener(this.onChange);
|
||||
this.resize();
|
||||
window.addEventListener('resize', this.handleResize);
|
||||
}
|
||||
@@ -40,7 +40,7 @@ export default class SearchResults extends React.Component {
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
PostStore.removeSearchChangeListener(this.onChange);
|
||||
SearchStore.removeSearchChangeListener(this.onChange);
|
||||
this.mounted = false;
|
||||
window.removeEventListener('resize', this.handleResize);
|
||||
}
|
||||
@@ -78,7 +78,7 @@ export default class SearchResults extends React.Component {
|
||||
searchForm = <SearchBox />;
|
||||
}
|
||||
var noResults = (!results || !results.order || !results.order.length);
|
||||
var searchTerm = PostStore.getSearchTerm();
|
||||
var searchTerm = SearchStore.getSearchTerm();
|
||||
|
||||
var ctls = null;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
|
||||
// See License.txt for license information.
|
||||
|
||||
var PostStore = require('../stores/post_store.jsx');
|
||||
var SearchStore = require('../stores/search_store.jsx');
|
||||
var ChannelStore = require('../stores/channel_store.jsx');
|
||||
var UserStore = require('../stores/user_store.jsx');
|
||||
var UserProfile = require('./user_profile.jsx');
|
||||
@@ -32,7 +32,7 @@ export default class SearchResultsItem extends React.Component {
|
||||
AppDispatcher.handleServerAction({
|
||||
type: ActionTypes.RECIEVED_POST_SELECTED,
|
||||
post_list: data,
|
||||
from_search: PostStore.getSearchTerm()
|
||||
from_search: SearchStore.getSearchTerm()
|
||||
});
|
||||
|
||||
AppDispatcher.handleServerAction({
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
|
||||
var SearchResults = require('./search_results.jsx');
|
||||
var RhsThread = require('./rhs_thread.jsx');
|
||||
var SearchStore = require('../stores/search_store.jsx');
|
||||
var PostStore = require('../stores/post_store.jsx');
|
||||
var Utils = require('../utils/utils.jsx');
|
||||
|
||||
function getStateFromStores() {
|
||||
return {search_visible: PostStore.getSearchResults() != null, post_right_visible: PostStore.getSelectedPost() != null, is_mention_search: PostStore.getIsMentionSearch()};
|
||||
return {search_visible: SearchStore.getSearchResults() != null, post_right_visible: PostStore.getSelectedPost() != null, is_mention_search: SearchStore.getIsMentionSearch()};
|
||||
}
|
||||
|
||||
export default class SidebarRight extends React.Component {
|
||||
@@ -22,11 +23,11 @@ export default class SidebarRight extends React.Component {
|
||||
this.state = getStateFromStores();
|
||||
}
|
||||
componentDidMount() {
|
||||
PostStore.addSearchChangeListener(this.onSearchChange);
|
||||
SearchStore.addSearchChangeListener(this.onSearchChange);
|
||||
PostStore.addSelectedPostChangeListener(this.onSelectedChange);
|
||||
}
|
||||
componentWillUnmount() {
|
||||
PostStore.removeSearchChangeListener(this.onSearchChange);
|
||||
SearchStore.removeSearchChangeListener(this.onSearchChange);
|
||||
PostStore.removeSelectedPostChangeListener(this.onSelectedChange);
|
||||
}
|
||||
componentDidUpdate() {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// See License.txt for license information.
|
||||
|
||||
const AppDispatcher = require('../dispatcher/app_dispatcher.jsx');
|
||||
const PostStore = require('../stores/post_store.jsx');
|
||||
const SearchStore = require('../stores/search_store.jsx');
|
||||
const CommandList = require('./command_list.jsx');
|
||||
const ErrorStore = require('../stores/error_store.jsx');
|
||||
|
||||
@@ -54,7 +54,7 @@ export default class Textbox extends React.Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
PostStore.addAddMentionListener(this.onListenerChange);
|
||||
SearchStore.addAddMentionListener(this.onListenerChange);
|
||||
ErrorStore.addChangeListener(this.onRecievedError);
|
||||
|
||||
this.resize();
|
||||
@@ -62,7 +62,7 @@ export default class Textbox extends React.Component {
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
PostStore.removeAddMentionListener(this.onListenerChange);
|
||||
SearchStore.removeAddMentionListener(this.onListenerChange);
|
||||
ErrorStore.removeChangeListener(this.onRecievedError);
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user