1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-09 02:42:47 +00:00

fix warning

This commit is contained in:
ilearnit
2018-12-21 06:25:15 +00:00
parent e035f2a381
commit afc16b3f5d
4 changed files with 60 additions and 48 deletions

View File

@@ -1,10 +1,14 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { Link } from '@reach/router'; import { Button, Modal, Input, ModalBody, Form, FormGroup } from 'reactstrap';
import { Button, Modal, Input, ModalBody, Form, FormGroup, Label } from 'reactstrap';
import { gettext, siteRoot } from '../../utils/constants'; import { gettext, siteRoot } from '../../utils/constants';
import { seafileAPI } from '../../utils/seafile-api'; import { seafileAPI } from '../../utils/seafile-api';
const propTypes = {
repoID: PropTypes.string.isRequired,
onLibDecryptDialog: PropTypes.string.isRequired
};
class LibDecryptDialog extends React.Component { class LibDecryptDialog extends React.Component {
constructor(props) { constructor(props) {
@@ -24,7 +28,8 @@ class LibDecryptDialog extends React.Component {
this.setState({ this.setState({
showError: true showError: true
}); });
}) });
e.preventDefault(); e.preventDefault();
} }
@@ -49,25 +54,27 @@ class LibDecryptDialog extends React.Component {
return ( return (
<Modal isOpen={true} centered={true}> <Modal isOpen={true} centered={true}>
<ModalBody> <ModalBody>
<button type="button" className="close" onClick={this.toggle}><span aria-hidden="true">×</span></button> <button type="button" className="close" onClick={this.toggle}><span aria-hidden="true">×</span></button>
<Form className="lib-decrypt-form text-center"> <Form className="lib-decrypt-form text-center">
<img src={siteRoot + 'media/img/lock.png'} alt=""/> <img src={siteRoot + 'media/img/lock.png'} alt=""/>
<p>{gettext('This library is password protected')}</p> <p>{gettext('This library is password protected')}</p>
{this.state.showError && {this.state.showError &&
<p className="error">{gettext('Wrong password')}</p> <p className="error">{gettext('Wrong password')}</p>
} }
<FormGroup> <FormGroup>
<Input type="password" name="password" onKeyPress={this.handleKeyPress} placeholder={gettext('Password')} onChange={this.handleChange}/> <Input type="password" name="password" onKeyPress={this.handleKeyPress} placeholder={gettext('Password')} onChange={this.handleChange}/>
</FormGroup> </FormGroup>
<FormGroup> <FormGroup>
<Button type="submit" value="Submit" onClick={this.handleSubmit}>{gettext('Submit')}</Button> <Button type="submit" value="Submit" onClick={this.handleSubmit}>{gettext('Submit')}</Button>
</FormGroup> </FormGroup>
<p className="tip">{'* '}{gettext('The password will be kept in the server for only 1 hour.')}</p> <p className="tip">{'* '}{gettext('The password will be kept in the server for only 1 hour.')}</p>
</Form> </Form>
</ModalBody> </ModalBody>
</Modal> </Modal>
); );
} }
} }
LibDecryptDialog.propTypes = propTypes;
export default LibDecryptDialog; export default LibDecryptDialog;

View File

@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import AsyncSelect from 'react-select/lib/Async'; import AsyncSelect from 'react-select/lib/Async';
import toaster from '../toast'; import toaster from '../toast';
import { gettext } from '../../utils/constants'; import { gettext } from '../../utils/constants';
import { Button, Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap'; import { Button, Modal, ModalHeader, ModalBody } from 'reactstrap';
import { seafileAPI } from '../../utils/seafile-api.js'; import { seafileAPI } from '../../utils/seafile-api.js';
const propTypes = { const propTypes = {
@@ -58,10 +58,10 @@ class TransferDialog extends React.Component {
this.props.submit(repoID); this.props.submit(repoID);
this.props.toggleDialog(); this.props.toggleDialog();
}).catch(res => { }).catch(res => {
let message = gettext('Failed. Please check the network.') let message = gettext('Failed. Please check the network.');
this.props.toggleDialog(); this.props.toggleDialog();
toaster.danger(message); toaster.danger(message);
}) });
} }
render() { render() {

View File

@@ -67,8 +67,8 @@ class DraftListItem extends React.Component {
</td> </td>
<td className="review"> <td className="review">
{(draft.review_id && draft.review_status === 'open') ? {(draft.review_id && draft.review_status === 'open') ?
<a href={reviewUrl} target="_blank">#{draft.review_id}</a> : <a href={reviewUrl} target="_blank">#{draft.review_id}</a> :
<span>--</span> <span>--</span>
} }
</td> </td>
<td className="update">{localTime}</td> <td className="update">{localTime}</td>

View File

@@ -1,7 +1,6 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import MarkdownViewer from '@seafile/seafile-editor/dist/viewer/markdown-viewer'; import MarkdownViewer from '@seafile/seafile-editor/dist/viewer/markdown-viewer';
import { Tooltip } from 'reactstrap';
const gettext = window.gettext; const gettext = window.gettext;
@@ -11,7 +10,13 @@ const viewerPropTypes = {
latestContributor: PropTypes.string, latestContributor: PropTypes.string,
markdownContent: PropTypes.string, markdownContent: PropTypes.string,
onContentRendered: PropTypes.func.isRequired, onContentRendered: PropTypes.func.isRequired,
activeTitleIndex: PropTypes.number activeTitleIndex: PropTypes.number,
onLinkClick: PropTypes.func,
reviewStatus: PropTypes.string,
goReviewPage: PropTypes.func,
isDraft: PropTypes.bool,
hasDraft: PropTypes.bool,
goDraftPage: PropTypes.func,
}; };
const contentClass = 'markdown-content'; const contentClass = 'markdown-content';
@@ -43,31 +48,31 @@ class MarkdownContentViewer extends React.Component {
); );
} }
return ( return (
<div className="markdown-content"> <div className="markdown-content">
{this.props.reviewStatus === 'open' && {this.props.reviewStatus === 'open' &&
<div className='seafile-btn-view-review text-center'> <div className='seafile-btn-view-review text-center'>
<div className='tag tag-green'> <div className='tag tag-green'>
{gettext('This file is in review stage')} {gettext('This file is in review stage')}
<a className="ml-2" onMouseDown={this.props.goReviewPage}>{gettext('View Review')}</a> <a className="ml-2" onMouseDown={this.props.goReviewPage}>{gettext('View Review')}</a>
</div>
</div> </div>
} </div>
}
{(!this.props.isDraft && this.props.hasDraft && this.props.reviewStatus !== 'open') && {(!this.props.isDraft && this.props.hasDraft && this.props.reviewStatus !== 'open') &&
<div className='seafile-btn-view-review text-center'> <div className='seafile-btn-view-review text-center'>
<div className='tag tag-green'> <div className='tag tag-green'>
{gettext('This file is in draft stage.')} {gettext('This file is in draft stage.')}
<a className="ml-2" onMouseDown={this.props.goDraftPage}>{gettext('Edit Draft')}</a> <a className="ml-2" onMouseDown={this.props.goDraftPage}>{gettext('Edit Draft')}</a>
</div>
</div> </div>
} </div>
}
<MarkdownViewer markdownContent={this.props.markdownContent} showTOC={true} <MarkdownViewer markdownContent={this.props.markdownContent} showTOC={true}
activeTitleIndex={this.props.activeTitleIndex} activeTitleIndex={this.props.activeTitleIndex}
onContentRendered={this.props.onContentRendered} onContentRendered={this.props.onContentRendered}
/> />
<p id="wiki-page-last-modified">{gettext('Last modified by')} {this.props.latestContributor}, <span>{this.props.lastModified}</span></p> <p id="wiki-page-last-modified">{gettext('Last modified by')} {this.props.latestContributor}, <span>{this.props.lastModified}</span></p>
</div> </div>
); );
} }
} }