diff options
Diffstat (limited to 'graphgraph-fe')
-rw-r--r-- | graphgraph-fe/src/DownloadExport.js | 29 | ||||
-rw-r--r-- | graphgraph-fe/src/GraphSettings.js | 8 | ||||
-rw-r--r-- | graphgraph-fe/src/requests.js | 4 |
3 files changed, 40 insertions, 1 deletions
diff --git a/graphgraph-fe/src/DownloadExport.js b/graphgraph-fe/src/DownloadExport.js new file mode 100644 index 0000000..b031773 --- /dev/null +++ b/graphgraph-fe/src/DownloadExport.js @@ -0,0 +1,29 @@ +import React from 'react' +import { Button } from 'react-bootstrap' +import { exportSchema } from './requests' + + +class DownloadExport extends React.Component { + constructor (props, context) { + super(props, context) + this.download = this.download.bind(this) + } + + download() { + + setTimeout(() => { + const response = { + file: exportSchema(this.props.schemaVersion), + }; + window.open(response.file); + }, 100); + } + + render() { + return ( + <Button onClick={this.download}>Download as XMI</Button> + ); + } +} + +export default DownloadExport diff --git a/graphgraph-fe/src/GraphSettings.js b/graphgraph-fe/src/GraphSettings.js index 4d44aef..d511068 100644 --- a/graphgraph-fe/src/GraphSettings.js +++ b/graphgraph-fe/src/GraphSettings.js @@ -4,6 +4,7 @@ import { DropdownButton, MenuItem, Label } from 'react-bootstrap' import './GraphSettings.css' import Popup from './PopupSettings' import ValidationModal from './ValidationModal' +import DownloadExport from './DownloadExport' import { validateSchema, pathGraph, basicGraph, schemas, nodeNames } from './requests' var emptyState = { @@ -220,8 +221,13 @@ class GraphSettings extends React.Component { <Popup isDisabled={!this.state.showHops} edgeFilter={this.state.edgeFilter} parentHops={this.state.hops.parents} childHops={this.state.hops.child} cousinHops={this.state.hops.cousin} updateHops={this.updateHops}/> <div className="modal-button"> - <ValidationModal schemaProblems={this.state.schemaProblems}/> + <ValidationModal schemaProblems={this.state.schemaProblems}/> </div> + + <div className="modal-button"> + <DownloadExport schemaVersion={this.state.selectedSchema}/> + </div> + </div> </div> diff --git a/graphgraph-fe/src/requests.js b/graphgraph-fe/src/requests.js index cb23bd7..8a86e0c 100644 --- a/graphgraph-fe/src/requests.js +++ b/graphgraph-fe/src/requests.js @@ -10,6 +10,10 @@ export function validateSchema (schema) { return `${protocol}//${host}:${port}/schemas/${schema}/validation` } +export function exportSchema (schema) { + return `${protocol}//${host}:${port}/schemas/${schema}/xmiexport` +} + export function nodeNames (schema, edgeFilter) { return `${protocol}//${host}:${port}/schemas/${schema}/nodes?edgeFilter=${edgeFilter}` } |