Browse Source

parent dialog: use computed prop for reftypes

Martin Kunz 10 months ago
parent
commit
28697b98a2
1 changed files with 5 additions and 6 deletions
  1. 5 6
      src/components/TheParent.vue

+ 5 - 6
src/components/TheParent.vue

@@ -1,6 +1,6 @@
 <script setup lang="ts">
 import { useStore } from '@/store'
-import { ref, watch } from 'vue';
+import { computed, ref, watch } from 'vue';
 import TheTreeDialog from './TheTreeDialog.vue';
 import VCollaps from './VCollaps.vue';
 import { UABaseNode } from '@/ua/UABaseNode';
@@ -37,11 +37,10 @@ function filter(fnode: UABaseNode) {
   }
   return false;
 }
-
-function getRefTypes():UABaseNode[] {
-  let list=(store.addressSpace?.getSubTreeAsList("ns=0;i="+ReferenceTypeIds.HierarchicalReferences)) as UAReferenceType[];
+const refTypes = computed(():UABaseNode[]  => {
+  const list=(store.addressSpace?.getSubTreeAsList("ns=0;i="+ReferenceTypeIds.HierarchicalReferences)) as UAReferenceType[];
   return list.filter((node) => node.isAbstract==false);
-}
+})
 </script>
 
 <template>
@@ -60,7 +59,7 @@ function getRefTypes():UABaseNode[] {
           <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 v-for="option in refTypes" :value="option.browseName" v-bind:key="option.browseName">
             {{ option.displayName }}
           </option>
         </select>