Remove unnecessary codes
This commit is contained in:
@@ -30,60 +30,58 @@ const errorPage = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class ErrorView extends React.Component {
|
function ErrorView(props) {
|
||||||
render() {
|
return (
|
||||||
return (
|
<Grid
|
||||||
<Grid
|
id={props.id}
|
||||||
id={this.props.id}
|
style={props.style}
|
||||||
style={this.props.style}
|
>
|
||||||
>
|
<div style={errorPage.tableStyle}>
|
||||||
<div style={errorPage.tableStyle}>
|
<div style={errorPage.cellStyle}>
|
||||||
<div style={errorPage.cellStyle}>
|
<Row>
|
||||||
<Row>
|
<Col
|
||||||
<Col
|
xs={0}
|
||||||
xs={0}
|
sm={1}
|
||||||
sm={1}
|
md={1}
|
||||||
md={1}
|
lg={2}
|
||||||
lg={2}
|
/>
|
||||||
/>
|
<Col
|
||||||
<Col
|
xs={12}
|
||||||
xs={12}
|
sm={10}
|
||||||
sm={10}
|
md={10}
|
||||||
md={10}
|
lg={8}
|
||||||
lg={8}
|
>
|
||||||
>
|
<h2>{'Cannot connect to Mattermost'}</h2>
|
||||||
<h2>{'Cannot connect to Mattermost'}</h2>
|
<hr/>
|
||||||
<hr/>
|
<p>{'We\'re having trouble connecting to Mattermost. If refreshing this page (Ctrl+R or Command+R) does not work please verify that:'}</p>
|
||||||
<p>{'We\'re having trouble connecting to Mattermost. If refreshing this page (Ctrl+R or Command+R) does not work please verify that:'}</p>
|
<br/>
|
||||||
<br/>
|
<ul style={errorPage.bullets}>
|
||||||
<ul style={errorPage.bullets}>
|
<li>{'Your computer is connected to the internet.'}</li>
|
||||||
<li>{'Your computer is connected to the internet.'}</li>
|
<li>{'The Mattermost URL '}
|
||||||
<li>{'The Mattermost URL '}
|
<a href={props.errorInfo.validatedURL}>
|
||||||
<a href={this.props.errorInfo.validatedURL}>
|
{props.errorInfo.validatedURL}
|
||||||
{this.props.errorInfo.validatedURL}
|
</a>{' is correct.'}</li>
|
||||||
</a>{' is correct.'}</li>
|
<li>{'You can reach '}
|
||||||
<li>{'You can reach '}
|
<a href={props.errorInfo.validatedURL}>
|
||||||
<a href={this.props.errorInfo.validatedURL}>
|
{props.errorInfo.validatedURL}
|
||||||
{this.props.errorInfo.validatedURL}
|
</a>{' from a browser window.'}</li>
|
||||||
</a>{' from a browser window.'}</li>
|
</ul>
|
||||||
</ul>
|
<br/>
|
||||||
<br/>
|
<div style={errorPage.techInfo}>
|
||||||
<div style={errorPage.techInfo}>
|
{props.errorInfo.errorDescription}{' ('}
|
||||||
{this.props.errorInfo.errorDescription}{' ('}
|
{props.errorInfo.errorCode }{')'}</div>
|
||||||
{this.props.errorInfo.errorCode }{')'}</div>
|
</Col>
|
||||||
</Col>
|
<Col
|
||||||
<Col
|
xs={0}
|
||||||
xs={0}
|
sm={1}
|
||||||
sm={1}
|
md={1}
|
||||||
md={1}
|
lg={2}
|
||||||
lg={2}
|
/>
|
||||||
/>
|
</Row>
|
||||||
</Row>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</Grid>
|
</div>
|
||||||
);
|
</Grid>
|
||||||
}
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorView.propTypes = {
|
ErrorView.propTypes = {
|
||||||
|
@@ -1,13 +1,11 @@
|
|||||||
const React = require('react');
|
const React = require('react');
|
||||||
|
|
||||||
class HoveringURL extends React.Component {
|
function HoveringURL(props) {
|
||||||
render() {
|
return (
|
||||||
return (
|
<div style={props.style}>
|
||||||
<div style={this.props.style}>
|
{props.targetURL}
|
||||||
{this.props.targetURL}
|
</div>
|
||||||
</div>
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HoveringURL.propTypes = {
|
HoveringURL.propTypes = {
|
||||||
|
@@ -1,148 +0,0 @@
|
|||||||
const React = require('react');
|
|
||||||
const {findDOMNode} = require('react-dom');
|
|
||||||
const {Button, HelpBlock, ListGroupItem} = require('react-bootstrap');
|
|
||||||
|
|
||||||
const TeamListItemNew = React.createClass({
|
|
||||||
propTypes: {
|
|
||||||
onTeamAdd: React.PropTypes.func,
|
|
||||||
teamIndex: React.PropTypes.number,
|
|
||||||
teamName: React.PropTypes.string,
|
|
||||||
teamUrl: React.PropTypes.string
|
|
||||||
},
|
|
||||||
|
|
||||||
getInitialState() {
|
|
||||||
return {
|
|
||||||
name: this.props.teamName,
|
|
||||||
url: this.props.teamUrl,
|
|
||||||
index: this.props.teamIndex,
|
|
||||||
errorMessage: null
|
|
||||||
};
|
|
||||||
},
|
|
||||||
handleSubmit(e) {
|
|
||||||
console.log('submit');
|
|
||||||
e.preventDefault();
|
|
||||||
const errorMessage = this.getValidationErrorMessage();
|
|
||||||
if (errorMessage) {
|
|
||||||
this.setState({
|
|
||||||
errorMessage
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.props.onTeamAdd({
|
|
||||||
name: this.state.name.trim(),
|
|
||||||
url: this.state.url.trim(),
|
|
||||||
index: this.state.index
|
|
||||||
});
|
|
||||||
|
|
||||||
this.setState({
|
|
||||||
name: '',
|
|
||||||
url: '',
|
|
||||||
index: '',
|
|
||||||
errorMessage: null
|
|
||||||
});
|
|
||||||
},
|
|
||||||
handleNameChange(e) {
|
|
||||||
console.log('name');
|
|
||||||
this.setState({
|
|
||||||
name: e.target.value
|
|
||||||
});
|
|
||||||
},
|
|
||||||
handleURLChange(e) {
|
|
||||||
console.log('url');
|
|
||||||
this.setState({
|
|
||||||
url: e.target.value
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
getValidationErrorMessage() {
|
|
||||||
if (this.state.name.trim() === '') {
|
|
||||||
return 'Name is required.';
|
|
||||||
} else if (this.state.url.trim() === '') {
|
|
||||||
return 'URL is required.';
|
|
||||||
} else if (!(/^https?:\/\/.*/).test(this.state.url.trim())) {
|
|
||||||
return 'URL should start with http:// or https://.';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
|
|
||||||
componentDidMount() {
|
|
||||||
const inputTeamName = findDOMNode(this.refs.inputTeamName);
|
|
||||||
const setErrorMessage = () => {
|
|
||||||
this.setState({
|
|
||||||
errorMessage: this.getValidationErrorMessage()
|
|
||||||
});
|
|
||||||
};
|
|
||||||
inputTeamName.addEventListener('invalid', setErrorMessage);
|
|
||||||
const inputTeamURL = findDOMNode(this.refs.inputTeamURL);
|
|
||||||
inputTeamURL.addEventListener('invalid', setErrorMessage);
|
|
||||||
},
|
|
||||||
|
|
||||||
render() {
|
|
||||||
var existingTeam = false;
|
|
||||||
if (this.state.name !== '' && this.state.url !== '') {
|
|
||||||
existingTeam = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
var btnAddText;
|
|
||||||
if (existingTeam) {
|
|
||||||
btnAddText = 'Save';
|
|
||||||
} else {
|
|
||||||
btnAddText = 'Add';
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<ListGroupItem>
|
|
||||||
<form
|
|
||||||
className='form-inline'
|
|
||||||
onSubmit={this.handleSubmit}
|
|
||||||
>
|
|
||||||
<div className='form-group'>
|
|
||||||
<label htmlFor='inputTeamName'>{'Name'}</label>
|
|
||||||
{ ' ' }
|
|
||||||
<input
|
|
||||||
type='text'
|
|
||||||
required={true}
|
|
||||||
className='form-control'
|
|
||||||
id='inputTeamName'
|
|
||||||
ref='inputTeamName'
|
|
||||||
placeholder='Example team'
|
|
||||||
value={this.state.name}
|
|
||||||
onChange={this.handleNameChange}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
{ ' ' }
|
|
||||||
<div className='form-group'>
|
|
||||||
<label htmlFor='inputTeamURL'>{'URL'}</label>
|
|
||||||
{ ' ' }
|
|
||||||
<input
|
|
||||||
type='url'
|
|
||||||
required={true}
|
|
||||||
className='form-control'
|
|
||||||
id='inputTeamURL'
|
|
||||||
ref='inputTeamURL'
|
|
||||||
placeholder='https://example.com/team'
|
|
||||||
value={this.state.url}
|
|
||||||
onChange={this.handleURLChange}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
{ ' ' }
|
|
||||||
<Button type='submit'>
|
|
||||||
{ btnAddText }
|
|
||||||
</Button>
|
|
||||||
</form>
|
|
||||||
{ (() => {
|
|
||||||
if (this.state.errorMessage !== null) {
|
|
||||||
return (
|
|
||||||
<HelpBlock style={{color: '#777777'}}>
|
|
||||||
{ this.state.errorMessage }
|
|
||||||
</HelpBlock>);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
})() }
|
|
||||||
</ListGroupItem>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = TeamListItemNew;
|
|
Reference in New Issue
Block a user