|
@@ -1,24 +1,34 @@
|
|
|
<script setup lang="ts">
|
|
|
import { useStore } from '@/util/store'
|
|
|
-import { computed, ref } from 'vue';
|
|
|
+import { computed, ref, watch } from 'vue';
|
|
|
import TheTreeDialog from './TheTreeDialog.vue';
|
|
|
-import type { UABaseNode } from '@/ua/UABaseNode';
|
|
|
+import { UABaseNode } from '@/ua/UABaseNode';
|
|
|
import { ReferenceTypeIds } from '@/ua/opcua_node_ids';
|
|
|
import type { UAReferenceType } from '@/ua/UAReferenceType';
|
|
|
+import { NodeId } from '@/ua/NodeId';
|
|
|
const store = useStore()
|
|
|
|
|
|
const parentDialogOpen = ref(false);
|
|
|
const node = computed(() => {
|
|
|
return store.selectedNode;
|
|
|
-
|
|
|
});
|
|
|
+const selectedRefType = ref('')
|
|
|
+const selectedParent = ref(new UABaseNode({browseName: "", nodeId:NodeId.nullNodeId}));
|
|
|
|
|
|
-function clickNode(node: UABaseNode) {
|
|
|
- //TODO: replace parent references
|
|
|
- // node.value?.setParent(clickedNode, store.addressSpace?.findNode("ns=0;i="+ ReferenceTypeIds.HierarchicalReferences));
|
|
|
+function clickNode(clickedNode: UABaseNode) {
|
|
|
+ selectedParent.value=clickedNode;
|
|
|
parentDialogOpen.value=false;
|
|
|
}
|
|
|
|
|
|
+watch(node, async (newNode, _oldNode) => {
|
|
|
+ selectedRefType.value=newNode?.getParentRef()?.referenceType||"";
|
|
|
+})
|
|
|
+
|
|
|
+function okPressed() {
|
|
|
+ console.log('TODO: Handle OK Button');
|
|
|
+}
|
|
|
+defineExpose({ okPressed })
|
|
|
+
|
|
|
function filter(fnode: UABaseNode) {
|
|
|
if(node.value?.nodeClass==="Variable") {
|
|
|
if(fnode.nodeClass!="Object")
|
|
@@ -54,8 +64,8 @@ function getRefTypes():UABaseNode[] {
|
|
|
<div class="input-group-prepend">
|
|
|
<span class="input-group-text" id="inputGroup-sizing-default">Reference</span>
|
|
|
</div>
|
|
|
- <select class="form-select" aria-label="Default select example">
|
|
|
- <option v-for="option in getRefTypes()" :value="option.nodeId.toString()" v-bind:key="option.nodeId.toString()">
|
|
|
+ <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>
|