|
@@ -1,16 +1,16 @@
|
|
|
<script setup lang="ts">
|
|
|
-import { useStore } from '@/util/store'
|
|
|
-import { computed, ref, watch } from 'vue';
|
|
|
+import { useStore } from '@/store'
|
|
|
+import { ref, watch } from 'vue';
|
|
|
import TheTreeDialog from './TheTreeDialog.vue';
|
|
|
+import VCollaps from './VCollaps.vue';
|
|
|
import { UABaseNode } from '@/ua/UABaseNode';
|
|
|
import { ReferenceTypeIds } from '@/ua/opcua_node_ids';
|
|
|
import type { UAReferenceType } from '@/ua/UAReferenceType';
|
|
|
+import { storeToRefs } from 'pinia';
|
|
|
const store = useStore()
|
|
|
|
|
|
const parentDialogOpen = ref(false);
|
|
|
-const node = computed(() => {
|
|
|
- return store.selectedNode;
|
|
|
-});
|
|
|
+const { selectedNode } = storeToRefs(store)
|
|
|
const selectedRefType = ref('')
|
|
|
const selectedParent = ref(UABaseNode.nullBaseNode);
|
|
|
|
|
@@ -19,7 +19,7 @@ function clickNode(clickedNode: UABaseNode) {
|
|
|
parentDialogOpen.value=false;
|
|
|
}
|
|
|
|
|
|
-watch(node, async (newNode, _oldNode) => {
|
|
|
+watch(selectedNode, async (newNode, _oldNode) => {
|
|
|
selectedRefType.value=newNode?.getParentRef()?.referenceType||"";
|
|
|
selectedParent.value=newNode?.getParent()||UABaseNode.nullBaseNode;
|
|
|
|
|
@@ -27,12 +27,12 @@ watch(node, async (newNode, _oldNode) => {
|
|
|
|
|
|
function okPressed() {
|
|
|
//TODO: check if valid
|
|
|
- node.value?.setParent(selectedParent.value, selectedRefType.value);
|
|
|
+ selectedNode.value?.setParent(selectedParent.value, selectedRefType.value);
|
|
|
}
|
|
|
defineExpose({ okPressed })
|
|
|
|
|
|
function filter(fnode: UABaseNode) {
|
|
|
- if(node.value?.nodeClass==="Variable") {
|
|
|
+ if(selectedNode.value?.nodeClass==="Variable") {
|
|
|
if(fnode.nodeClass!="Object")
|
|
|
return true;
|
|
|
}
|
|
@@ -46,32 +46,29 @@ function getRefTypes():UABaseNode[] {
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
- <div class="card">
|
|
|
- <div class="card-body" v-if="node != null">
|
|
|
- <h5 class="card-title">Parent</h5>
|
|
|
- <div class="card-text">
|
|
|
- <div class="input-group mb-3">
|
|
|
- <div class="input-group-prepend">
|
|
|
- <span class="input-group-text" id="inputGroup-sizing-default">Name</span>
|
|
|
- </div>
|
|
|
- <input readonly type="text" class="form-control" aria-label="Default"
|
|
|
- aria-describedby="inputGroup-sizing-default" :value="selectedParent.displayName">
|
|
|
- <button class="btn btn-light" @click="parentDialogOpen = true">...</button>
|
|
|
-
|
|
|
+ <VCollaps :selected=false name="Parent">
|
|
|
+ <div class="card-text" v-if="selectedNode">
|
|
|
+ <div class="input-group mb-3">
|
|
|
+ <div class="input-group-prepend">
|
|
|
+ <span class="input-group-text" id="inputGroup-sizing-default">Name</span>
|
|
|
</div>
|
|
|
- <div class="input-group mb-3">
|
|
|
- <div class="input-group-prepend">
|
|
|
- <span class="input-group-text" id="inputGroup-sizing-default">Reference</span>
|
|
|
- </div>
|
|
|
- <select class="form-select" aria-label="Selected ref. type" v-model="selectedRefType" >
|
|
|
- <option v-for="option in getRefTypes()" :value="option.browseName" v-bind:key="option.browseName">
|
|
|
- {{ option.displayName }}
|
|
|
- </option>
|
|
|
- </select>
|
|
|
+ <input readonly type="text" class="form-control" aria-label="Default"
|
|
|
+ aria-describedby="inputGroup-sizing-default" :value="selectedParent.displayName">
|
|
|
+ <button class="btn btn-light" @click="parentDialogOpen = true">...</button>
|
|
|
+
|
|
|
+ </div>
|
|
|
+ <div class="input-group mb-3">
|
|
|
+ <div class="input-group-prepend">
|
|
|
+ <span class="input-group-text" id="inputGroup-sizing-default">Reference</span>
|
|
|
</div>
|
|
|
+ <select class="form-select" aria-label="Selected ref. type" v-model="selectedRefType" >
|
|
|
+ <option v-for="option in getRefTypes()" :value="option.browseName" v-bind:key="option.browseName">
|
|
|
+ {{ option.displayName }}
|
|
|
+ </option>
|
|
|
+ </select>
|
|
|
</div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
+ </VCollaps>
|
|
|
<TheTreeDialog
|
|
|
:open="parentDialogOpen"
|
|
|
:filter-func="(node: UABaseNode) => filter(node)"
|
|
@@ -81,4 +78,4 @@ function getRefTypes():UABaseNode[] {
|
|
|
</template>
|
|
|
|
|
|
|
|
|
-<style scoped></style>
|
|
|
+<style scoped></style>@/store
|