Преглед на файлове

removed component TheServerConfig.vue, added server config to TheModels.vue

dstrutzenberger преди 9 месеца
родител
ревизия
11eaaa101e
променени са 4 файла, в които са добавени 78 реда и са изтрити 106 реда
  1. 1 2
      src/App.vue
  2. 76 0
      src/components/TheModels.vue
  3. 0 95
      src/components/TheServerConfig.vue
  4. 1 9
      src/util/sconfig.ts

+ 1 - 2
src/App.vue

@@ -4,7 +4,6 @@ import TheDetail from './components/TheDetail.vue'
 import TheParent from './components/TheParent.vue'
 import TheEditor from './components/TheEditor.vue'
 import TheDynamics from './components/TheDynamics.vue'
-import TheServerConfig from './components/TheServerConfig.vue'
 import { ServerConfig } from '@/util/sconfig'
 
 
@@ -40,7 +39,7 @@ async function load(): Promise<AddressSpace> {
   <div class="container text-left">
     <div class="row align-items-start">
       <div class="col col-6">
-        <TheServerConfig />
+        
         <TheModels />
         <TheModeler />
         

+ 76 - 0
src/components/TheModels.vue

@@ -10,9 +10,13 @@ import YAML from 'yaml'
 
 const store = useStore()
 const newDialogOpen = ref(false);
+const newServerConfigOpen = ref(false);
 const newDialogDisabled = ref(false); //Disables buttons while loading project
 const projectType = ref("ua");
 
+
+let sconfig = store.sConfig;
+
 async function exportProject() {
   const blob = await store.addressSpace?.exportProject();
   if (blob)
@@ -28,6 +32,12 @@ function downloadBlob(blob: Blob, filename: string) {
   document.body.removeChild(link);
 }
 
+async function exportConf() {
+  const blob = await sconfig?.exportConfig();
+  if (blob)
+    downloadBlob(blob, "config.zip");
+}
+
 async function newProject() {
   newDialogDisabled.value = true;
   store.addressSpace = new AddressSpace([] as UANodeSet[])
@@ -93,6 +103,7 @@ async function  loadZip(file: File){
         <div class="btn-group">
           <button class="btn btn-light" @click.prevent="exportProject()">Export</button>
           <button class="btn btn-light" @click="newDialogOpen = true">New project</button>
+          <button class="btn btn-light" @click="newServerConfigOpen = true">Server Config</button>
         </div>
         </div>
         <p class="card-text">
@@ -138,6 +149,71 @@ async function  loadZip(file: File){
     <button @click="newProject()" :disabled="newDialogDisabled">OK</button>
     <button @click="newDialogOpen = false" :disabled="newDialogDisabled">Cancel</button>
   </v-dialog>
+
+
+
+  <v-dialog :open="newServerConfigOpen" @cancel="newServerConfigOpen = false">
+    <p>Server Configuration</p>
+    <div v-if="sconfig">
+        <div class="input-group mb-3">
+          <div class="input-group-prepend">
+            <span class="input-group-text" id="inputGroup-sizing-default">Manufacturer Name</span>
+            </div>
+            <input type="text" class="form-control" aria-label="Default" aria-describedby="inputGroup-sizing-default" v-model="sconfig.manufacturerName" v-bind:key="'...'">
+        </div>
+        <div class="input-group mb-3">
+          <div class="input-group-prepend">
+            <span class="input-group-text" id="inputGroup-sizing-default">Product Name</span>
+            </div>
+            <input type="text" class="form-control" aria-label="Default" aria-describedby="inputGroup-sizing-default" v-model="sconfig.productName" v-bind:key="'...'">
+        </div>
+        <div class="input-group mb-3">
+          <div class="input-group-prepend">
+            <span class="input-group-text" id="inputGroup-sizing-default">Software Version</span>
+            </div>
+            <input type="text" class="form-control" aria-label="Default" aria-describedby="inputGroup-sizing-default" v-model="sconfig.softwareVersion" v-bind:key="'...'">
+        </div>
+        <div class="input-group mb-3">
+          <div class="input-group-prepend">
+            <span class="input-group-text" id="inputGroup-sizing-default">Application Name</span>
+            </div>
+            <input type="text" class="form-control" aria-label="Default" aria-describedby="inputGroup-sizing-default" v-model="sconfig.applicationName" v-bind:key="'...'">
+        </div>
+        <div class="input-group mb-3">
+          <div class="input-group-prepend">
+            <span class="input-group-text" id="inputGroup-sizing-default">Application Uri</span>
+            </div>
+            <input type="text" class="form-control" aria-label="Default" aria-describedby="inputGroup-sizing-default" v-model="sconfig.applicationUri" v-bind:key="'...'">
+        </div>
+        <div class="input-group mb-3">
+          <div class="input-group-prepend">
+            <span class="input-group-text" id="inputGroup-sizing-default">Product Uri</span>
+            </div>
+            <input type="text" class="form-control" aria-label="Default" aria-describedby="inputGroup-sizing-default" v-model="sconfig.productUri" v-bind:key="'...'">
+        </div>
+        <div class="input-group mb-3">
+          <div class="input-group-prepend">
+            <span class="input-group-text" id="inputGroup-sizing-default">Port</span>
+            </div>
+            <input type="text" class="form-control" aria-label="Default" aria-describedby="inputGroup-sizing-default" v-model="sconfig.port" v-bind:key="4840">
+        </div>
+        <div class="input-group mb-3">
+          <div class="input-group-prepend">
+            <span class="input-group-text" id="inputGroup-sizing-default">Max Connections Per Endpoint</span>
+            </div>
+            <input type="text" class="form-control" aria-label="Default" aria-describedby="inputGroup-sizing-default" v-model="sconfig.maxConnections" v-bind:key="100">
+        </div>
+        <div class="input-group mb-3">
+          <div class="input-group-prepend">
+            <input type="checkbox" id="checkbox" v-model="sconfig.allowAnonymous" />
+            <label for="checkbox"> Allow Anonymous</label>
+          </div>
+        </div>
+       
+      </div>
+    <button @click="exportConf()"> Export</button>
+    <button @click="newServerConfigOpen = false" :disabled="newDialogDisabled">Close</button>
+  </v-dialog>
 </template>
 
 

+ 0 - 95
src/components/TheServerConfig.vue

@@ -1,95 +0,0 @@
-<script setup lang="ts">
-import { useStore } from '@/util/store'
-import { ServerConfig } from '@/util/sconfig'
-
-const store = useStore()
-let sconfig = store.sConfig;
-
-function downloadBlob(blob: Blob, filename: string) {
-  let link = document.createElement('a')
-  link.href = window.URL.createObjectURL(blob)
-  link.download = filename
-  document.body.appendChild(link);
-  link.click()
-  document.body.removeChild(link);
-}
-
-async function exportConf() {
-  const blob = await sconfig?.exportConfig();
-  if (blob)
-    downloadBlob(blob, "config.zip");
-}
-
-
-</script>
-
-<template>
-  <div class="card">
-    <div class="card-body" v-if="sconfig != null">
-      <h5 class="card-title">Server Configuration</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">Manufacturer Name</span>
-            </div>
-            <input type="text" class="form-control" aria-label="Default" aria-describedby="inputGroup-sizing-default" v-model="sconfig.manufacturerName" v-bind:key="'...'">
-        </div>
-        <div class="input-group mb-3">
-          <div class="input-group-prepend">
-            <span class="input-group-text" id="inputGroup-sizing-default">Product Name</span>
-            </div>
-            <input type="text" class="form-control" aria-label="Default" aria-describedby="inputGroup-sizing-default" v-model="sconfig.productName" v-bind:key="'...'">
-        </div>
-        <div class="input-group mb-3">
-          <div class="input-group-prepend">
-            <span class="input-group-text" id="inputGroup-sizing-default">Software Version</span>
-            </div>
-            <input type="text" class="form-control" aria-label="Default" aria-describedby="inputGroup-sizing-default" v-model="sconfig.softwareVersion" v-bind:key="'...'">
-        </div>
-        <div class="input-group mb-3">
-          <div class="input-group-prepend">
-            <span class="input-group-text" id="inputGroup-sizing-default">Application Name</span>
-            </div>
-            <input type="text" class="form-control" aria-label="Default" aria-describedby="inputGroup-sizing-default" v-model="sconfig.applicationName" v-bind:key="'...'">
-        </div>
-        <div class="input-group mb-3">
-          <div class="input-group-prepend">
-            <span class="input-group-text" id="inputGroup-sizing-default">Application Uri</span>
-            </div>
-            <input type="text" class="form-control" aria-label="Default" aria-describedby="inputGroup-sizing-default" v-model="sconfig.applicationUri" v-bind:key="'...'">
-        </div>
-        <div class="input-group mb-3">
-          <div class="input-group-prepend">
-            <span class="input-group-text" id="inputGroup-sizing-default">Product Uri</span>
-            </div>
-            <input type="text" class="form-control" aria-label="Default" aria-describedby="inputGroup-sizing-default" v-model="sconfig.productUri" v-bind:key="'...'">
-        </div>
-        <div class="input-group mb-3">
-          <div class="input-group-prepend">
-            <span class="input-group-text" id="inputGroup-sizing-default">Port</span>
-            </div>
-            <input type="text" class="form-control" aria-label="Default" aria-describedby="inputGroup-sizing-default" v-model="sconfig.port" v-bind:key="4840">
-        </div>
-        <div class="input-group mb-3">
-          <div class="input-group-prepend">
-            <span class="input-group-text" id="inputGroup-sizing-default">Max Connections Per Endpoint</span>
-            </div>
-            <input type="text" class="form-control" aria-label="Default" aria-describedby="inputGroup-sizing-default" v-model="sconfig.maxConnections" v-bind:key="100">
-        </div>
-        <div class="input-group mb-3">
-          <div class="input-group-prepend">
-            <input type="checkbox" id="checkbox" v-model="sconfig.allowAnonymous" />
-            <label for="checkbox"> Allow Anonymous</label>
-          </div>
-        </div>
-        <div>
-          <button class="btn btn-light" @click.prevent="exportConf()">OK</button>
-        </div>
-      </div>
-    </div>
-  </div>
-</template>
-
-
-<style scoped></style>
-

+ 1 - 9
src/util/sconfig.ts

@@ -16,15 +16,7 @@ export class ServerConfig {
     public dynamics?:DynamicNode[]=[];
     public nodesets?:string[]=[];
 
-    /*constructor(options: ServerConfigOptions) {
-        this.buildInfo = options.buildInfo || "...";
-        this.manufacturerName =  options.manufacturerName || "...";
-        this.productName = options.productName || "...";
-        this.softwareVersion = options.softwareVersion || "...";
-        this.applicationUri= options.applicationUri || "...";
-        this.productUri = options.productUri || "...";
-        this.applicationName = options.applicationName || "...";
-    }*/
+
 
     constructor() {
         this.buildInfo =  "...";