|
@@ -12,7 +12,7 @@ const newDialogDisabled = ref(false);
|
|
|
const projectType = ref("ua");
|
|
|
|
|
|
async function exportProject() {
|
|
|
- const blob = await store.addressSpace?.export();
|
|
|
+ const blob = await store.addressSpace?.exportProject();
|
|
|
if (blob)
|
|
|
downloadBlob(blob, "proj.zip");
|
|
|
}
|
|
@@ -27,10 +27,10 @@ function downloadBlob(blob: Blob, filename: string) {
|
|
|
}
|
|
|
|
|
|
async function newProject() {
|
|
|
- newDialogDisabled.value=true;
|
|
|
+ newDialogDisabled.value = true;
|
|
|
store.addressSpace = new AddressSpace([] as UANodeSet[])
|
|
|
- let nodesets:string[]=[];
|
|
|
- switch(projectType.value) {
|
|
|
+ let nodesets: string[] = [];
|
|
|
+ switch (projectType.value) {
|
|
|
case "emco":
|
|
|
nodesets.push("nodesets/emco_machine_tools.xml");
|
|
|
case "machinetool":
|
|
@@ -43,25 +43,25 @@ async function newProject() {
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
- let as= await AddressSpace.load(nodesets.reverse());
|
|
|
+ let as = await AddressSpace.load(nodesets.reverse());
|
|
|
store.setAddressSpace(as);
|
|
|
- newDialogOpen.value=false;
|
|
|
- newDialogDisabled.value=false;
|
|
|
+ newDialogOpen.value = false;
|
|
|
+ newDialogDisabled.value = false;
|
|
|
}
|
|
|
|
|
|
-async function handleDrop(e:DragEvent) {
|
|
|
- if(!e.dataTransfer)
|
|
|
+async function handleDrop(e: DragEvent) {
|
|
|
+ if (!e.dataTransfer)
|
|
|
return;
|
|
|
- for(let file of e.dataTransfer.files) {
|
|
|
- let xmlString= await file.text();
|
|
|
- store.addNodeset(await UANodeSet.parse(xmlString, file.name));
|
|
|
+ for (let file of e.dataTransfer.files) {
|
|
|
+ let xmlString = await file.text();
|
|
|
+ store.addNodeset(await UANodeSet.parse(xmlString, file.name));
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
- <div v-if="store.addressSpace" >
|
|
|
- <div class="card" @drop.prevent="handleDrop($event)" dropzone="copy" @dragover="$event.preventDefault();">
|
|
|
+ <div v-if="store.addressSpace">
|
|
|
+ <div class="card">
|
|
|
<div class="card-body" v-if="store.addressSpace">
|
|
|
<h5 class="card-title">Models</h5>
|
|
|
<p class="card-text">
|
|
@@ -71,14 +71,22 @@ async function handleDrop(e:DragEvent) {
|
|
|
<li class="list-group-item">{{ model.modelUri }}</li>
|
|
|
</div>
|
|
|
</ul>
|
|
|
+ <ul class="list-group list-group-flush" @drop.prevent="handleDrop($event)" dropzone="copy"
|
|
|
+ @dragover="$event.preventDefault();">
|
|
|
+ <div>
|
|
|
+ <li class="list-group-item">(drop .xml nodeset or .zip project file here)</li>
|
|
|
+ </div>
|
|
|
+ </ul>
|
|
|
</p>
|
|
|
+ <button class="btn btn-light" @click.prevent="exportProject()">Export</button>
|
|
|
+ <button class="btn btn-light" @click="newDialogOpen = true">New project</button>
|
|
|
</div>
|
|
|
+
|
|
|
</div>
|
|
|
- <button class="btn btn-light" @click.prevent="exportProject()">Export</button>
|
|
|
- <button class="btn btn-light" @click="newDialogOpen = true">New project</button>
|
|
|
+
|
|
|
</div>
|
|
|
|
|
|
- <v-dialog :open="newDialogOpen" @cancel="newDialogOpen=false">
|
|
|
+ <v-dialog :open="newDialogOpen" @cancel="newDialogOpen = false">
|
|
|
<p>New project</p>
|
|
|
<div class="form-check">
|
|
|
<input class="form-check-input" type="radio" name="projectType" id="empty" value="empty" v-model="projectType">
|
|
@@ -89,7 +97,8 @@ async function handleDrop(e:DragEvent) {
|
|
|
<label class="form-check-label" for="ua">http://opcfoundation.org/UA/ Namespace</label>
|
|
|
</div>
|
|
|
<div class="form-check">
|
|
|
- <input class="form-check-input" type="radio" name="projectType" id="machinetool" value="machinetool" v-model="projectType">
|
|
|
+ <input class="form-check-input" type="radio" name="projectType" id="machinetool" value="machinetool"
|
|
|
+ v-model="projectType">
|
|
|
<label class="form-check-label" for="machinetool">Machinetool Namespace +dependencies</label>
|
|
|
</div>
|
|
|
<div class="form-check">
|