|
@@ -1,4 +1,5 @@
|
|
|
const BACKEND = "http://localhost:5000";
|
|
|
+const EXPECTED_BACKEND_VERSION = 1; // expected backend version
|
|
|
const SPARQL_SERVER = "http://localhost:3030"
|
|
|
const SPARQL_ENDPOINT = "/SystemDesignOntology2Layers/sparql"
|
|
|
|
|
@@ -120,6 +121,20 @@ const defaultSettings = {
|
|
|
|
|
|
Draw.loadPlugin(function(ui) {
|
|
|
|
|
|
+fetch(BACKEND+"/version")
|
|
|
+.then(response => response.json())
|
|
|
+.catch(() => 0) // parsing failed - probably backend doesn't even have a version
|
|
|
+.then(version => {
|
|
|
+
|
|
|
+ if (version != EXPECTED_BACKEND_VERSION) {
|
|
|
+ alert("Incorrect DTDesign Python backend version.\nExpected: " + EXPECTED_BACKEND_VERSION + ", got: " + version + ".\nRefusing to load plugin. Please upgrade :)");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ console.log("Backend version is ", version);
|
|
|
+ console.log("All good.")
|
|
|
+ }
|
|
|
+
|
|
|
executeSPARQL(getSubClassRelations)
|
|
|
.then(results => {
|
|
|
for (const {subclass, superclass} of results) {
|
|
@@ -484,4 +499,6 @@ Draw.loadPlugin(function(ui) {
|
|
|
})
|
|
|
|
|
|
wnd.show();
|
|
|
+
|
|
|
+}) // end of promise that checks the backend version.
|
|
|
})
|