aboutsummaryrefslogtreecommitdiffstats
path: root/graphgraph-fe
diff options
context:
space:
mode:
authorPavel Paroulek <pavel.paroulek@orange.com>2019-09-19 14:16:46 +0200
committerPavel Paroulek <pavel.paroulek@orange.com>2019-09-19 14:16:46 +0200
commit978bcaf8d8319633ae0532d0449e93384a6d912c (patch)
treef80d683d9f6384437677915f8902cad121d91837 /graphgraph-fe
parent0a6fb2e8a9e0df82035e8e23c79db79757ace25b (diff)
Adding validations
Adding schema validation rule and export button Change-Id: Id30787cb5c5b98318fa0bd1c34baa31d530e1a58 Issue-ID: AAI-2583 Signed-off-by: Pavel Paroulek <pavel.paroulek@orange.com>
Diffstat (limited to 'graphgraph-fe')
-rw-r--r--graphgraph-fe/src/DownloadExport.js29
-rw-r--r--graphgraph-fe/src/GraphSettings.js8
-rw-r--r--graphgraph-fe/src/requests.js4
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}`
}