This repository has been archived by the owner on Oct 30, 2019. It is now read-only.
/
OrgContainer.jsx
72 lines (62 loc) · 1.8 KB
/
OrgContainer.jsx
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import React, {Component, PropTypes} from 'react';
import PageContainer from '../shared/PageContainer.jsx';
import UIGrid from '../shared/grid/UIGrid.jsx';
import UIGridItem from '../shared/grid/UIGridItem.jsx';
import Headline from '../shared/headline/Headline.jsx';
import HeadlineDetail from '../shared/headline/HeadlineDetail.jsx';
import ReposTable from './ReposTable.jsx';
import Icon from '../shared/Icon.jsx';
import OrgActions from '../../actions/orgActions';
import OrgStore from '../../stores/orgStore';
class OrgContainer extends Component {
constructor() {
this.state = {
repos: [],
loading: true
};
}
componentDidMount() {
this.unsubscribeFromOrg = OrgStore.listen(this.onStatusChange.bind(this));
OrgActions.loadRepos(this.props.params);
}
componentWillReceiveProps(nextprops) {
this.setState({
loading: true
});
OrgActions.loadRepos(nextprops.params);
}
componentWillUnmount() {
OrgActions.loadRepos(false);
this.unsubscribeFromOrg();
}
onStatusChange(state) {
this.setState(state);
}
render() {
return (
<PageContainer>
<UIGrid>
<UIGridItem size={12}>
<Headline>
<Icon type="octicon" name="organization" classNames="headline-icon" />
<span>{this.props.params.org}</span>
<HeadlineDetail>
Repositories
</HeadlineDetail>
</Headline>
<ReposTable
repos={this.state.repos}
org={this.props.params.org}
host={this.props.params.host}
loading={this.state.loading}
/>
</UIGridItem>
</UIGrid>
</PageContainer>
);
}
}
OrgContainer.propTypes = {
params: PropTypes.object.isRequired
};
export default OrgContainer;