1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/web/ synced 2025-03-09 00:00:01 +01:00

merge with master

This commit is contained in:
irismarie 2021-02-16 19:13:13 +01:00
commit af8b9ab033
5 changed files with 46 additions and 40 deletions

View file

@ -52,6 +52,13 @@ class CustomTable extends Component {
break;
}
}
} else if ('data' in child.props && 'dataKey' in child.props) {
content = new Map();
let keys = _.get(data, child.props.dataKey);
let filteredData = child.props.data.filter(data => keys.includes(data.id))
filteredData.forEach(file => {
content.set(_.get(file, 'id'), _.get(file, 'name'));
})
} else if ('dataKey' in child.props) {
content = _.get(data, child.props.dataKey);
}
@ -63,8 +70,6 @@ class CustomTable extends Component {
let cell = [];
if (content != null) {
//content = content.toString();
// check if cell should be a link
const linkKey = child.props.linkKey;
if (linkKey && data[linkKey] != null) {
@ -72,9 +77,9 @@ class CustomTable extends Component {
} else if (child.props.clickable) {
cell.push(<Button variant="link" onClick={() => child.props.onClick(index)}>{content}</Button>);
} else if (linkKey === 'filebuttons') {
content.forEach(element => {
cell.push(<OverlayTrigger key={element} placement={'bottom'} overlay={<Tooltip id={`tooltip-${"export"}`}>Download {element}</Tooltip>} >
<Button variant='table-control-button' onClick={() => child.props.onDownload(element)} disabled={child.props.onDownload == null}>{element + ' ' }
content.forEach((contentvalue, contentkey) => {
cell.push(<OverlayTrigger key={contentkey} placement={'bottom'} overlay={<Tooltip id={`tooltip-${"export"}`}>Download {contentvalue}</Tooltip>} >
<Button variant='table-control-button' onClick={() => child.props.onDownload(contentkey)} disabled={child.props.onDownload == null}>{contentkey + ' ' }
<Icon icon='file-download' /></Button></OverlayTrigger>);
});
} else {

View file

@ -53,7 +53,7 @@ class EditResultDialog extends React.Component {
isEmpty(val) {
return (val === undefined || val == null || val.length <= 0);
};
};
componentDidUpdate(prevProps, prevState) {
if (this.props.resultId != prevProps.resultId || this.props.results != prevProps.results) {
@ -75,7 +75,7 @@ class EditResultDialog extends React.Component {
})
}
}
}
}
};
selectUploadFile(event) {
@ -118,7 +118,7 @@ class EditResultDialog extends React.Component {
}
submitDescription() {
submitDescription() {
let result = this.props.results[this.props.resultId];
if (!this.isEmpty(result)) {
result.description = this.state.description;
@ -143,16 +143,15 @@ class EditResultDialog extends React.Component {
<div>
<FormGroup as={Col} controlId='description'>
<Row style={{ float: 'center' }} >
<Col xs="auto">
<Col xs lg="2">
<FormLabel>Description</FormLabel>
</Col>
<Col xs="auto">
<Col xs lg="4">
<FormControl type='text' placeholder={this.state.description} value={this.state.description} onChange={this.handleChange} />
<FormControl.Feedback />
</Col>
<Col xs="auto">
<Col xs lg="2">
<Button
type="submit"
onClick={() => this.submitDescription()}>
@ -160,8 +159,6 @@ class EditResultDialog extends React.Component {
</Button>
</Col>
</Row>
</FormGroup>
<Table data={this.state.files}>
@ -176,19 +173,23 @@ class EditResultDialog extends React.Component {
/>
</Table>
<FormGroup controlId='resultfile'>
<FormLabel>Add Result File</FormLabel>
<FormControl type='file' onChange={(event) => this.selectUploadFile(event)} />
</FormGroup>
<FormGroup as={Col} >
<Button
disabled={this.state.uploadFile === null}
onClick={() => this.startFileUpload()}>
Upload
<div style={{ float: 'center' }}>
<h5>Add result file</h5>
<Row>
<Col xs lg="4">
<FormControl type='file' onChange={(event) => this.selectUploadFile(event)} />
</Col>
<Col xs lg="2">
<Button
disabled={this.state.uploadFile === null}
onClick={() => this.startFileUpload()}>
Upload
</Button>
</FormGroup>
</Col>
</Row>
</div>
<br></br>
<FormGroup as={Col} >
<ProgressBar

View file

@ -181,7 +181,7 @@ class Scenario extends React.Component {
filesToDownload.forEach(file => {
zip.file(file.name, file.data);
});
let zipname = "result_" + this.state.resultNodl + "_" + Date.now();
let zipname = "result_" + this.state.resultNodl + "_" + (new Date()).toISOString();
zip.generateAsync({ type: "blob" }).then(function (content) {
saveAs(content, zipname);
});
@ -791,6 +791,7 @@ class Scenario extends React.Component {
title='Files/Data'
dataKey='resultFileIDs'
linkKey='filebuttons'
data={this.state.files}
width='300'
onDownload={(index) => this.downloadResultData(index)}
/>
@ -905,18 +906,18 @@ class Scenario extends React.Component {
/>
</Table>
{ this.state.ExternalICInUse ? (
{this.state.ExternalICInUse ? (
<div style={{ float: 'left' }}>
<ICAction
runDisabled={this.state.selectedConfigs.length === 0}
runAction={(action, when) => this.runAction(action, when)}
actions={[
{id: '-1', title: 'Action', data: {action: 'none'}},
{id: '0', title: 'Start', data: {action: 'start'}},
{id: '1', title: 'Stop', data: {action: 'stop'}},
{id: '2', title: 'Pause', data: {action: 'pause'}},
{id: '3', title: 'Resume', data: {action: 'resume'}}
]}/>
{ id: '-1', title: 'Action', data: { action: 'none' } },
{ id: '0', title: 'Start', data: { action: 'start' } },
{ id: '1', title: 'Stop', data: { action: 'stop' } },
{ id: '2', title: 'Pause', data: { action: 'pause' } },
{ id: '3', title: 'Resume', data: { action: 'resume' } }
]} />
</div>
) : (<div />)
}

View file

@ -200,10 +200,10 @@ class WidgetFactory {
break;
case 'TimeOffset':
widget.minWidth = 20;
widget.minHeight = 20;
widget.width = 100;
widget.height = 40;
widget.minWidth = 200;
widget.minHeight = 80;
widget.width = 200;
widget.height = 80;
widget.customProperties.threshold_yellow = 1;
widget.customProperties.threshold_red = 2;
widget.customProperties.icID = -1;

View file

@ -66,7 +66,6 @@ class WidgetTimeOffset extends Component {
} else if (this.props.widget.customProperties.showOffset){
icSelected = this.state.timeOffset + 's';
}
return (
<div className="time-offset">
{this.props.widget.customProperties.icID !== -1 ?
@ -81,7 +80,7 @@ class WidgetTimeOffset extends Component {
:
(<span>Please select Infrastructure Component</span>)}
</Tooltip>}>
<TrafficLight Horizontal={this.props.widget.customProperties.horizontal} width={this.props.widget.width} height={this.props.widget.height}
<TrafficLight Horizontal={this.props.widget.customProperties.horizontal} width={this.props.widget.width - 40} height={this.props.widget.height - 40}
RedOn={(this.props.widget.customProperties.threshold_red <= this.state.timeOffset) || !this.state.websocketOpen}
YellowOn={(this.props.widget.customProperties.threshold_yellow <= this.state.timeOffset) && (this.state.timeOffset < this.props.widget.customProperties.threshold_red) && this.state.websocketOpen}
GreenOn={(this.state.timeOffset < this.props.widget.customProperties.threshold_yellow) && this.state.websocketOpen}