summaryrefslogtreecommitdiffstats
path: root/web/react/components/about_build_modal.jsx
blob: fe48bb48ef17b0c1ebdc818ef94947b42e781ea7 (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.

var Modal = ReactBootstrap.Modal;

import {FormattedMessage} from 'mm-intl';

export default class AboutBuildModal extends React.Component {
    constructor(props) {
        super(props);
        this.doHide = this.doHide.bind(this);
    }

    doHide() {
        this.props.onModalDismissed();
    }

    render() {
        const config = global.window.mm_config;
        const license = global.window.mm_license;

        let title = (
            <FormattedMessage
                id='about.teamEdtion'
                defaultMessage='Team Edition'
            />
        );
        let licensee;
        if (config.BuildEnterpriseReady === 'true' && license.IsLicensed === 'true') {
            title = (
                <FormattedMessage
                    id='about.enterpriseEdition'
                    defaultMessage='Enterprise Edition'
                />
            );
            licensee = (
                <div className='row form-group'>
                    <div className='col-sm-3 info__label'>
                        <FormattedMessage
                            id='about.licensed'
                            defaultMessage='Licensed by:'
                        />
                    </div>
                    <div className='col-sm-9'>{license.Company}</div>
                </div>
            );
        }

        return (
            <Modal
                show={this.props.show}
                onHide={this.doHide}
            >
                <Modal.Header closeButton={true}>
                    <Modal.Title>
                        <FormattedMessage
                            id='about.title'
                            defaultMessage='About Mattermost'
                        />
                    </Modal.Title>
                </Modal.Header>
                <Modal.Body>
                    <h4>{'Mattermost'} {title}</h4>
                    {licensee}
                    <div className='row form-group'>
                        <div className='col-sm-3 info__label'>
                            <FormattedMessage
                                id='about.version'
                                defaultMessage='Version:'
                            />
                        </div>
                        <div className='col-sm-9'>{config.Version}</div>
                    </div>
                    <div className='row form-group'>
                        <div className='col-sm-3 info__label'>
                            <FormattedMessage
                                id='about.number'
                                defaultMessage='Build Number:'
                            />
                        </div>
                        <div className='col-sm-9'>{config.BuildNumber}</div>
                    </div>
                    <div className='row form-group'>
                        <div className='col-sm-3 info__label'>
                            <FormattedMessage
                                id='about.date'
                                defaultMessage='Build Date:'
                            />
                        </div>
                        <div className='col-sm-9'>{config.BuildDate}</div>
                    </div>
                    <div className='row form-group'>
                        <div className='col-sm-3 info__label'>
                            <FormattedMessage
                                id='about.hash'
                                defaultMessage='Build Hash:'
                            />
                        </div>
                        <div className='col-sm-9'>{config.BuildHash}</div>
                    </div>
                </Modal.Body>
                <Modal.Footer>
                    <button
                        type='button'
                        className='btn btn-default'
                        onClick={this.doHide}
                    >
                        <FormattedMessage
                            id='about.close'
                            defaultMessage='Close'
                        />
                    </button>
                </Modal.Footer>
            </Modal>
        );
    }
}

AboutBuildModal.defaultProps = {
    show: false
};

AboutBuildModal.propTypes = {
    show: React.PropTypes.bool.isRequired,
    onModalDismissed: React.PropTypes.func.isRequired
};