mirror of
https://git.rwth-aachen.de/acs/public/villas/web/
synced 2025-03-09 00:00:01 +01:00
make graph downloadable #265
This commit is contained in:
parent
ddc9da537c
commit
0405ec82da
1 changed files with 8 additions and 6 deletions
|
@ -4,7 +4,7 @@ import Dialog from '../common/dialogs/dialog';
|
|||
import Icon from "../common/icon";
|
||||
import ConfirmCommand from './confirm-command';
|
||||
import JsonView from 'react-json-view';
|
||||
|
||||
import FileSaver from 'file-saver';
|
||||
|
||||
|
||||
class ICDialog extends React.Component {
|
||||
|
@ -53,6 +53,10 @@ class ICDialog extends React.Component {
|
|||
this.setState({confirmCommand: false, command: ''});
|
||||
}
|
||||
|
||||
downloadGraph(url){
|
||||
FileSaver.saveAs(url, this.props.ic.name + ".svg");
|
||||
}
|
||||
|
||||
|
||||
render() {
|
||||
|
||||
|
@ -63,11 +67,6 @@ class ICDialog extends React.Component {
|
|||
if(typeof this.props.icGraph !== "undefined") {
|
||||
objectURL = this.props.icGraph.objectURL
|
||||
}
|
||||
|
||||
let spanStyle = {
|
||||
display: 'inline-block',
|
||||
width: '130px'
|
||||
}
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
|
@ -96,6 +95,9 @@ class ICDialog extends React.Component {
|
|||
</Col>
|
||||
|
||||
<Col>
|
||||
<div className='section-buttons-group-right'>
|
||||
<Button style={{ margin: '5px' }} size='sm' onClick={() => this.downloadGraph(objectURL)}><Icon icon="download" /></Button>
|
||||
</div>
|
||||
<h5>Graph:</h5>
|
||||
<div>
|
||||
{objectURL !== '' ? (
|
||||
|
|
Loading…
Add table
Reference in a new issue