summaryrefslogtreecommitdiffstats
path: root/web/react/components/admin_console/admin_controller.jsx
blob: 68984c9e0febf1122f7593920681f1151b211163 (plain)
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
// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
// See License.txt for license information.

var AdminSidebar = require('./admin_sidebar.jsx');
var EmailTab = require('./email_settings.jsx');
var JobsTab = require('./jobs_settings.jsx');
var LogsTab = require('./logs.jsx');
var Navbar = require('../../components/navbar.jsx');

export default class AdminController extends React.Component {
    constructor(props) {
        super(props);

        this.selectTab = this.selectTab.bind(this);

        this.state = {
            selected: 'email_settings'
        };
    }

    selectTab(tab) {
        this.setState({selected: tab});
    }

    render() {
        var tab = '';

        if (this.state.selected === 'email_settings') {
            tab = <EmailTab />;
        } else if (this.state.selected === 'job_settings') {
            tab = <JobsTab />;
        } else if (this.state.selected === 'logs') {
            tab = <LogsTab />;
        }

        return (
            <div className='container-fluid'>
                <div
                    className='sidebar--menu'
                    id='sidebar-menu'
                />
                <AdminSidebar
                    selected={this.state.selected}
                    selectTab={this.selectTab}
                />
                <div className='inner__wrap channel__wrap'>
                    <div className='row header'>
                        <Navbar teamDisplayName='Admin Console' />
                    </div>
                    <div className='row main'>
                        <div
                            id='app-content'
                            className='app__content admin'
                        >
                        {tab}
                        </div>
                    </div>
                </div>
            </div>
        );
    }
}