changeset 2912:7b6cdd27f3ee

Completed #222
author Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk>
date Tue, 01 Aug 2017 14:07:10 +0100
parents bcb741f60298
children b7347521a226
files test_create.html test_create/test_core.js
diffstat 2 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/test_create.html	Tue Aug 01 11:57:16 2017 +0100
+++ b/test_create.html	Tue Aug 01 14:07:10 2017 +0100
@@ -46,7 +46,9 @@
             <div class="attributes">
                 <div class="attribute">
                     <span>Interface: </span>
-                    <input type="text" ng-model="specification.interface" required/>
+                    <select type="text" ng-model="specification.interface" required>
+                        <option value="{{i.name}}" ng-repeat="i in availableInterfaceModules">{{i.name}}</option>
+                    </select>
                 </div>
                 <div class="attribute" data-container="body" data-toggle="popover" data-placement="bottom" data-trigger="hover" data-content="If you would like to save to a server other than your hosting server, you can place the full WAET URL here">
                     <span>Save URL: </span>
--- a/test_create/test_core.js	Tue Aug 01 11:57:16 2017 +0100
+++ b/test_create/test_core.js	Tue Aug 01 14:07:10 2017 +0100
@@ -86,6 +86,11 @@
         specification.processSchema(text);
         $s.globalSchema = specification.getSchema();
     });
+    $s.availableInterfaceModules = [];
+    get("interfaces/interfaces.json").then(JSON.parse).then(function (d) {
+        $s.availableInterfaceModules = d.interfaces;
+        $s.$apply();
+    });
     $s.specification = specification;
     $s.selectedTestPrototype = undefined;
     $s.setTestPrototype = function (obj) {
@@ -276,8 +281,8 @@
         if ($s.schema) {
             var spec = $s.schema.querySelector("attribute[name=\"" + name + "\"]") || $w.specification.schema.querySelector("attribute[name=\"" + name + "\"]");
             var attr = spec.getAttribute("default");
-            if (attr === undefined) {
-                return "";
+            if (attr === null) {
+                return "Not set";
             }
             return attr;
         }
@@ -498,8 +503,8 @@
     $s.placeholder = function (name) {
         var spec = $s.schema.querySelector("attribute[name=\"" + name + "\"]") || $w.specification.schema.querySelector("attribute[name=\"" + name + "\"]");
         var attr = spec.getAttribute("default");
-        if (attr === undefined) {
-            return "";
+        if (attr === null) {
+            return "Not set";
         }
         return attr;
     }