mirror of
https://git.rwth-aachen.de/acs/public/villas/web/
synced 2025-03-09 00:00:01 +01:00
cosmetic code cleanups
This commit is contained in:
parent
dd548af370
commit
35a8842de5
7 changed files with 49 additions and 53 deletions
|
@ -39,7 +39,7 @@ class CustomTable extends Component {
|
|||
};
|
||||
|
||||
onClick(event, row, column) {
|
||||
this.setState({ editCell: [column, row] }); // x, y
|
||||
this.setState({ editCell: [column, row] }); // x, y
|
||||
}
|
||||
|
||||
static addCell(data, index, child) {
|
||||
|
|
|
@ -27,7 +27,6 @@ import EditFileContent from "./edit-file-content";
|
|||
class EditFilesDialog extends React.Component {
|
||||
valid = true;
|
||||
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
|
@ -40,7 +39,6 @@ class EditFilesDialog extends React.Component {
|
|||
}
|
||||
|
||||
onClose() {
|
||||
|
||||
this.props.onClose();
|
||||
}
|
||||
|
||||
|
@ -71,29 +69,17 @@ class EditFilesDialog extends React.Component {
|
|||
} else {
|
||||
this.setState({ uploadProgress: 0 });
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
clearProgress = (newFileID) => {
|
||||
/*if (this.props.onChange != null) {
|
||||
let event = {}
|
||||
event["target"] = {}
|
||||
event.target["value"] = newFileID
|
||||
this.props.onChange(event);
|
||||
}
|
||||
*/
|
||||
this.setState({ uploadProgress: 0 });
|
||||
|
||||
|
||||
};
|
||||
|
||||
closeEditModal(){
|
||||
|
||||
this.setState({editModal: false});
|
||||
closeEditModal() {
|
||||
this.setState({editModal: false});
|
||||
}
|
||||
|
||||
deleteFile(index){
|
||||
|
||||
let file = this.props.files[index]
|
||||
AppDispatcher.dispatch({
|
||||
type: 'files/start-remove',
|
||||
|
@ -102,9 +88,7 @@ class EditFilesDialog extends React.Component {
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
render() {
|
||||
|
||||
let fileOptions = [];
|
||||
if (this.props.files.length > 0){
|
||||
fileOptions.push(
|
||||
|
@ -122,7 +106,6 @@ class EditFilesDialog extends React.Component {
|
|||
marginTop: '-40px'
|
||||
};
|
||||
|
||||
|
||||
return (
|
||||
<Dialog show={this.props.show} title="Edit Files of scenario" buttonTitle="Close" onClose={() => this.onClose()} blendOutCancel = {true} valid={true} size = 'lg'>
|
||||
<div>
|
||||
|
@ -135,9 +118,18 @@ class EditFilesDialog extends React.Component {
|
|||
/>
|
||||
: <></>
|
||||
}
|
||||
<TableColumn title='Name' dataKey='name'/>
|
||||
<TableColumn title='Size (bytes)' dataKey='size'/>
|
||||
<TableColumn title='Type' dataKey='type'/>
|
||||
<TableColumn
|
||||
title='Name'
|
||||
dataKey='name'
|
||||
/>
|
||||
<TableColumn
|
||||
title='Size (bytes)'
|
||||
dataKey='size'
|
||||
/>
|
||||
<TableColumn
|
||||
title='Type'
|
||||
dataKey='type'
|
||||
/>
|
||||
<TableColumn
|
||||
title=''
|
||||
deleteButton
|
||||
|
@ -151,18 +143,19 @@ class EditFilesDialog extends React.Component {
|
|||
<FormControl
|
||||
disabled={this.props.disabled}
|
||||
type='file'
|
||||
onChange={(event) => this.selectUploadFile(event)} />
|
||||
onChange={(event) => this.selectUploadFile(event)}
|
||||
/>
|
||||
</FormGroup>
|
||||
|
||||
<FormGroup as={Col} >
|
||||
<span className='solid-button'>
|
||||
<Button
|
||||
variant='secondary'
|
||||
disabled={this.state.uploadFile === null}
|
||||
onClick={() => this.startFileUpload()}>
|
||||
Upload
|
||||
</Button>
|
||||
</span>
|
||||
<span className='solid-button'>
|
||||
<Button
|
||||
variant='secondary'
|
||||
disabled={this.state.uploadFile === null}
|
||||
onClick={() => this.startFileUpload()}>
|
||||
Upload
|
||||
</Button>
|
||||
</span>
|
||||
</FormGroup>
|
||||
|
||||
<FormGroup as={Col} >
|
||||
|
@ -176,12 +169,14 @@ class EditFilesDialog extends React.Component {
|
|||
</FormGroup>
|
||||
<div style={{ clear: 'both' }} />
|
||||
|
||||
<EditFileContent show={this.state.editModal} onClose={(data) => this.closeEditModal(data)} sessionToken={this.props.sessionToken} file={this.state.modalFile} />
|
||||
|
||||
<EditFileContent
|
||||
show={this.state.editModal}
|
||||
onClose={(data) => this.closeEditModal(data)}
|
||||
sessionToken={this.props.sessionToken}
|
||||
file={this.state.modalFile}
|
||||
/>
|
||||
</div>
|
||||
</Dialog>
|
||||
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -228,12 +228,8 @@ class Scenarios extends Component {
|
|||
}
|
||||
|
||||
modifyRunningColumn(running){
|
||||
|
||||
if(running){
|
||||
return <Icon icon='check' />
|
||||
} else {
|
||||
return <Icon icon='times' />
|
||||
}
|
||||
return <Icon icon={ running ? 'check' : 'times' } />
|
||||
}
|
||||
|
||||
render() {
|
||||
return <div className='section'>
|
||||
|
|
|
@ -78,7 +78,7 @@ class EditOwnUserDialog extends React.Component {
|
|||
}
|
||||
|
||||
// form is valid if the following condition is met
|
||||
this.valid = username || mail || (oldPassword && pw && confirmPassword);
|
||||
this.valid = username || mail || (oldPassword && pw && confirmPassword);
|
||||
}
|
||||
|
||||
resetState() {
|
||||
|
|
|
@ -64,7 +64,7 @@ class EditUserDialog extends React.Component {
|
|||
username = false;
|
||||
}
|
||||
|
||||
if (this.state.role === ''){
|
||||
if (this.state.role === '') {
|
||||
role = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -94,8 +94,12 @@ class LoginComplete extends React.Component {
|
|||
this.stopTimer();
|
||||
return (<Redirect to="/login" />);
|
||||
} else {
|
||||
return (<div class="verticalhorizontal">
|
||||
<img style={{height: 300}}src={require('../img/dog-waiting-bw.jpg').default} alt="Waiting Dog" /></div>);
|
||||
return <div class="verticalhorizontal">
|
||||
<img
|
||||
style={{height: 300}}
|
||||
src={require('../img/dog-waiting-bw.jpg').default}
|
||||
alt="Waiting Dog" />
|
||||
</div>;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,8 +90,7 @@ class Users extends Component {
|
|||
this.setState({ editModal: false });
|
||||
|
||||
if (data) {
|
||||
if(data.password === data.confirmPassword) {
|
||||
|
||||
if (data.password === data.confirmPassword) {
|
||||
AppDispatcher.dispatch({
|
||||
type: 'users/start-edit',
|
||||
data: data,
|
||||
|
@ -129,16 +128,18 @@ class Users extends Component {
|
|||
</h1>
|
||||
|
||||
<Table data={this.state.users}>
|
||||
{this.state.currentUser.role === "Admin" ?
|
||||
<TableColumn
|
||||
title='ID'
|
||||
dataKey='id'
|
||||
/>
|
||||
: <></>
|
||||
}
|
||||
<TableColumn
|
||||
title='Username'
|
||||
width='150'
|
||||
dataKey='username'
|
||||
/>
|
||||
<TableColumn
|
||||
title='ID'
|
||||
width='150'
|
||||
dataKey='id'
|
||||
/>
|
||||
<TableColumn
|
||||
title='E-mail'
|
||||
dataKey='mail'
|
||||
|
|
Loading…
Add table
Reference in a new issue