1 | <!doctype html> |
---|
2 | #import zoo |
---|
3 | #import html,os |
---|
4 | #set removeCacheFile=False |
---|
5 | #set strUrl=$inputs["tmpl"]["xlink:href"] |
---|
6 | #set currentUrl=$strUrl.replace($openapi["openapi"]["rootUrl"],"") |
---|
7 | #if $currentUrl=="/" |
---|
8 | #set currentKey="root" |
---|
9 | #set $currentUrl="/index" |
---|
10 | #else |
---|
11 | #set currentKey=$currentUrl |
---|
12 | #end if |
---|
13 | #set urlCompnents=$currentUrl.split('/') |
---|
14 | #* |
---|
15 | * Load the JSON content from the API |
---|
16 | *# |
---|
17 | #try |
---|
18 | #import json |
---|
19 | #if "cache_file" in $inputs["tmpl"] |
---|
20 | #set values=json.load(open($inputs["tmpl"]["cache_file"])) |
---|
21 | #else |
---|
22 | #set values=$inputs["tmpl"]["value"] |
---|
23 | #end if |
---|
24 | #except Exception as e |
---|
25 | $e |
---|
26 | #end try |
---|
27 | <html lang="en"> |
---|
28 | <head> |
---|
29 | <!-- Required meta tags --> |
---|
30 | <meta charset="utf-8"> |
---|
31 | <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> |
---|
32 | |
---|
33 | <!-- Bootstrap CSS --> |
---|
34 | <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous"> |
---|
35 | |
---|
36 | <!-- Custom styles for this template --> |
---|
37 | <link href="$openapi["openapi"]["rootUrl"]/../static/openapi.css" rel="stylesheet"> |
---|
38 | |
---|
39 | <title>#if "id" in $values#$values["id"]#else##if $currentKey in $openapi and "title" in $openapi[$currentKey]#$openapi[$currentKey]["title"]#else#Landing Page#end if##end if#</title> |
---|
40 | </head> |
---|
41 | <body itemscope itemtype="https://schema.org/DataCatalog"> |
---|
42 | <header> |
---|
43 | <!-- Fixed navbar --> |
---|
44 | <nav |
---|
45 | class="navbar navbar-expand-md navbar-dark fixed-top bg-dark" |
---|
46 | itemprop="creator" |
---|
47 | itemscope itemtype="https://schema.org/Organization" > |
---|
48 | <a class="navbar-brand" href="#"> |
---|
49 | <img itemprop="logo" src="http://zoo-project.org/img/zoo-sun-logo.png" width="55" height="30" class="d-inline-block align-top" alt=""> |
---|
50 | <span itemprop="name">$conf["provider"]["providerName"]</span> |
---|
51 | </a> |
---|
52 | <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation"> |
---|
53 | <span class="navbar-toggler-icon"></span> |
---|
54 | </button> |
---|
55 | <div class="collapse navbar-collapse" id="navbarCollapse"> |
---|
56 | <ul class="navbar-nav mr-auto" |
---|
57 | itemscope itemtype="https://schema.org/BreadcrumbList"> |
---|
58 | <li class="nav-item #if $currentKey=="root"# active#end if#" |
---|
59 | itemprop="itemListElement" itemscope |
---|
60 | itemtype="https://schema.org/ListItem"> |
---|
61 | <a itemprop="item" class="nav-link" |
---|
62 | href="$openapi["openapi"]["rootUrl"]/index.html"> |
---|
63 | <span itemprop="name">Home #if $currentKey=="root"# <span class="sr-only">(current)</span>#end if#</span> |
---|
64 | <meta itemprop="position" content="1" /> |
---|
65 | </a> |
---|
66 | </li> |
---|
67 | #if $currentKey!="root" |
---|
68 | #for i in range(1,len($urlCompnents)) |
---|
69 | <li |
---|
70 | itemprop="itemListElement" itemscope |
---|
71 | itemtype="https://schema.org/ListItem" |
---|
72 | class="nav-item #if $i+1==len($urlCompnents)#active#end if#"> |
---|
73 | #set prefix="" |
---|
74 | #for j in range(1,$i) |
---|
75 | #set $prefix+="/"+$urlCompnents[$j] |
---|
76 | #end for |
---|
77 | <a itemprop="item" class="nav-link" href="$openapi["openapi"]["rootUrl"]$(prefix)/$(urlCompnents[$i]).html"> |
---|
78 | <span itemprop="name"> |
---|
79 | #if $i==2 |
---|
80 | $(urlCompnents[$i]) |
---|
81 | #else |
---|
82 | $(urlCompnents[$i].title()) |
---|
83 | #end if |
---|
84 | #if $i+1==len($urlCompnents) |
---|
85 | <span class="sr-only">(current)</span> |
---|
86 | #end if |
---|
87 | <meta itemprop="position" content="$(i+1)" /> |
---|
88 | </span> |
---|
89 | </a> |
---|
90 | </li> |
---|
91 | #end for |
---|
92 | #end if |
---|
93 | </ul> |
---|
94 | </div> |
---|
95 | </nav> |
---|
96 | </header> |
---|
97 | <script> |
---|
98 | var System={}; |
---|
99 | </script> |
---|
100 | |
---|
101 | #def printRel($o,$v) |
---|
102 | #if $v in $o |
---|
103 | $o[$v] |
---|
104 | #else |
---|
105 | View default (no title found for $v). |
---|
106 | #end if |
---|
107 | #end def |
---|
108 | #* |
---|
109 | |
---|
110 | *# |
---|
111 | #def printControl(obj) |
---|
112 | #if "type" not in $obj |
---|
113 | #set oType="format" |
---|
114 | #else |
---|
115 | #set oType=$obj["type"] |
---|
116 | #end if |
---|
117 | <div class="input-group"> |
---|
118 | <div class="input-group-prepend"> |
---|
119 | <div class="input-group-text">$obj["title"]</div> |
---|
120 | </div> |
---|
121 | #if "ph" in $obj |
---|
122 | <input type="text" |
---|
123 | #if "value" in $obj#value="$obj["value"]""#end if# |
---|
124 | #if "id" in $obj#data-id="$obj["id"]"#end if# |
---|
125 | class="form-control" data-name="$obj["title"]" name="$(oType)_$obj["name"]" placeholder="$obj["ph"]" #if "required" in $obj#required#end if#/> |
---|
126 | #else |
---|
127 | <select name="$(oType)_$obj["name"]" class="form-control" #if "required" in $obj#required#end if#> |
---|
128 | #for i in range(len($obj["options"])) |
---|
129 | <option>$obj["options"][$i]</option> |
---|
130 | #end for |
---|
131 | </select> |
---|
132 | #end if |
---|
133 | #if "required" in $obj |
---|
134 | <div class="invalid-feedback"> |
---|
135 | Please set a value for $obj["id"]. |
---|
136 | </div> |
---|
137 | #end if |
---|
138 | </div> |
---|
139 | #end def |
---|
140 | #def printCard(obj) |
---|
141 | <div class="card" #if "attrs" in $obj#$obj["attrs"]#end if#> |
---|
142 | <div class="card-header" id="heading$(obj["id"])"> |
---|
143 | <h4 class="mb-0"> |
---|
144 | <button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#collapse$(obj["id"])" aria-expanded="true" aria-controls="collapse$(obj["id"])"> |
---|
145 | $obj["title"] |
---|
146 | </button> |
---|
147 | </h4> |
---|
148 | </div> |
---|
149 | <div id="collapse$(obj["id"])" class="collapse #if "class" in $obj#$obj["class"]#end if#" aria-labelledby="heading$(obj["id"])"> |
---|
150 | <div class="card-body"> |
---|
151 | $obj["content"] |
---|
152 | </div> |
---|
153 | </div> |
---|
154 | </div> |
---|
155 | #end def |
---|
156 | #def printInputContent($obj) |
---|
157 | #set cName=$obj["id"].replace(".","_") |
---|
158 | #if "formats" in $obj["input"] |
---|
159 | #set cFormats=[] |
---|
160 | #for j in range(len($obj["input"]["formats"])) |
---|
161 | #set $cFormats+=[$obj["input"]["formats"][$j]["mimeType"]] |
---|
162 | #end for |
---|
163 | $printControl({"title": "format","type": "input_format","name": $cName,"options":$cFormats}) |
---|
164 | #set largs={"id": $obj["id"],"title": "href","type": "input_value","name": $cName,"ph":"URL"} |
---|
165 | #if $obj["minOccurs"]>0 |
---|
166 | #set $largs["required"]=True |
---|
167 | #end if |
---|
168 | $printControl($largs) |
---|
169 | #else |
---|
170 | #if "literalDataDomains" in $obj["input"] |
---|
171 | #set cDataDomain=$obj["input"]["literalDataDomains"][0] |
---|
172 | #set largs={"id": $obj["id"],"title": $cDataDomain["dataType"]["name"],"type": "input_value", "name": $cName,} |
---|
173 | #if $obj["minOccurs"]>0 |
---|
174 | #set $largs["required"]=True |
---|
175 | #end if |
---|
176 | #if "anyValue" in $cDataDomain["valueDefinition"] |
---|
177 | #set $largs["ph"]="Value" |
---|
178 | $printControl($largs) |
---|
179 | #else |
---|
180 | #if "allowedValues" in $cDataDomain["valueDefinition"] |
---|
181 | #set $largs["options"]=$cDataDomain["valueDefinition"]["allowedValues"] |
---|
182 | $printControl($largs) |
---|
183 | #else |
---|
184 | ELSE |
---|
185 | $obj |
---|
186 | #end if |
---|
187 | #end if |
---|
188 | #if "defaultValue" in $cDataDomain |
---|
189 | <script> |
---|
190 | System["function_$cName"]=function(){ |
---|
191 | try{ |
---|
192 | jQuery("input[name='input_value_$cName'],select[name='input_value_$cName]']").val($cDataDomain["defaultValue"]); |
---|
193 | }catch(e){ |
---|
194 | jQuery("input[name='input_value_$cName'],select[name='input_value_$cName']").val("$cDataDomain["defaultValue"]"); |
---|
195 | } |
---|
196 | } |
---|
197 | </script> |
---|
198 | #end if |
---|
199 | #else |
---|
200 | $obj |
---|
201 | ELSE |
---|
202 | #end if |
---|
203 | #end if |
---|
204 | #end def |
---|
205 | #def printProvider(conf) |
---|
206 | #set provider=$conf["provider"] |
---|
207 | <b itemprop="name">$provider["providerName"]</b> |
---|
208 | <p><a itemprop="url" href="$provider["providerSite"]">$provider["providerSite"]</a></p> |
---|
209 | #end def |
---|
210 | #def printContact(conf) |
---|
211 | #set provider=$conf["provider"] |
---|
212 | #set alt=$openapi["provider_alt"] |
---|
213 | #set elements=list($alt.keys()) |
---|
214 | <b>Address</b> |
---|
215 | #for i in ["addressDeliveryPoint","addressCity","addressAdministrativeArea","addressPostalCode","addressCountry","addressElectronicMailAddress","phoneVoice","phoneFacsimile"] |
---|
216 | #if i!="addressElectronicMailAddress" and $provider[$i]!="False" |
---|
217 | <p itemprop="$(alt[$i.lower()])"> |
---|
218 | #if i=="phoneVoice" |
---|
219 | Phone |
---|
220 | <svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-telephone" fill="currentColor" xmlns="http://www.w3.org/2000/svg"> |
---|
221 | <path fill-rule="evenodd" d="M3.654 1.328a.678.678 0 0 0-1.015-.063L1.605 2.3c-.483.484-.661 1.169-.45 1.77a17.568 17.568 0 0 0 4.168 6.608 17.569 17.569 0 0 0 6.608 4.168c.601.211 1.286.033 1.77-.45l1.034-1.034a.678.678 0 0 0-.063-1.015l-2.307-1.794a.678.678 0 0 0-.58-.122l-2.19.547a1.745 1.745 0 0 1-1.657-.459L5.482 8.062a1.745 1.745 0 0 1-.46-1.657l.548-2.19a.678.678 0 0 0-.122-.58L3.654 1.328zM1.884.511a1.745 1.745 0 0 1 2.612.163L6.29 2.98c.329.423.445.974.315 1.494l-.547 2.19a.678.678 0 0 0 .178.643l2.457 2.457a.678.678 0 0 0 .644.178l2.189-.547a1.745 1.745 0 0 1 1.494.315l2.306 1.794c.829.645.905 1.87.163 2.611l-1.034 1.034c-.74.74-1.846 1.065-2.877.702a18.634 18.634 0 0 1-7.01-4.42 18.634 18.634 0 0 1-4.42-7.009c-.362-1.03-.037-2.137.703-2.877L1.885.511z"/> |
---|
222 | </svg> |
---|
223 | #end if |
---|
224 | $provider[$i] |
---|
225 | </p> |
---|
226 | #else |
---|
227 | #if i=="addressElectronicMailAddress" |
---|
228 | <b>Email</b> |
---|
229 | <p itemprop="$(alt[$i.lower()])"> |
---|
230 | $provider[$i] |
---|
231 | </p> |
---|
232 | #end if |
---|
233 | #end if |
---|
234 | #end for |
---|
235 | #end def |
---|
236 | #def printIndentification(conf) |
---|
237 | #set provider=$conf["provider"] |
---|
238 | $printCard({"id": "provider","title": "Provider","content": $printProvider($conf),"class": "show"}) |
---|
239 | $printCard({"id": "contact","title": "Contact","content": $printContact($conf),"class": "show","attrs":'itemprop="address" itemscope itemtype="https://schema.org/PostalAddress"'}) |
---|
240 | #end def |
---|
241 | |
---|
242 | #if $currentKey=="root" |
---|
243 | <div class="container-fluid"> |
---|
244 | <div class="row"> |
---|
245 | <div class="col-sm-8"> |
---|
246 | #end if |
---|
247 | <!-- $currentUrl --> |
---|
248 | <!-- Begin page content --> |
---|
249 | <main #if $currentKey!="root"#class="container-fluid"#end if#> |
---|
250 | <h1 itemprop="name">#if "id" in $values#$values["id"]: #end if##if "title" in $values#$html.escape($values["title"])#else##if len($urlCompnents)==2#$currentUrl[1:].title()#else#$currentUrl[1:]#end if##end if#</h1> |
---|
251 | #if "description" in $values#<p itemprop="description">$html.escape($values["description"])</p>#end if# |
---|
252 | #if $currentKey=="root" |
---|
253 | <div class="keywords"> |
---|
254 | #for i in $conf["identification"]["keywords"].split(',') |
---|
255 | <button type="button" |
---|
256 | class="btn btn-outline-info">$i</button> |
---|
257 | #end for |
---|
258 | </div> |
---|
259 | License: |
---|
260 | <a itemprop="license" href="$openapi["openapi"]["license_url"]">$openapi["openapi"]["license_name"]</a> |
---|
261 | #end if |
---|
262 | #if "inputs" in $values |
---|
263 | #set $cid="JOBSOCKET-"+$conf["lenv"]["usid"] |
---|
264 | <form class="needs-validation" data-id="$cid" novalidate> |
---|
265 | <h3>Inputs</h3> |
---|
266 | <div class="accordion" id="accordionInputExample"> |
---|
267 | #for i in range(len(values["inputs"])) |
---|
268 | #set cInput=$values["inputs"][$i] |
---|
269 | #set cName=$cInput["id"].replace(".","_") |
---|
270 | $printCard({"id": $cName, "title": $cInput["id"],"content":'<p>'+$cInput["description"]+'</p>'+$printInputContent($cInput)}) |
---|
271 | #end for |
---|
272 | </div> |
---|
273 | |
---|
274 | <h3>Outputs</h3> |
---|
275 | <div class="accordion" id="accordionOutputExample"> |
---|
276 | #for i in range(len(values["outputs"])) |
---|
277 | #set cOutput=$values["outputs"][$i] |
---|
278 | #set cName=$cOutput["id"].replace(".","_") |
---|
279 | #set cFormats=[] |
---|
280 | #if "formats" in $cOutput["output"] |
---|
281 | #for j in range(len($cOutput["output"]["formats"])) |
---|
282 | #set cFormats+=[$cOutput["output"]["formats"][$j]["mimeType"]] |
---|
283 | #end for |
---|
284 | #end if |
---|
285 | #set cTransmissions=[] |
---|
286 | #for j in range(len($values["outputTransmission"])) |
---|
287 | #set cTransmissions+=[$values["outputTransmission"][$j]] |
---|
288 | #end for |
---|
289 | #set cContent="<p>"+$cOutput["description"]+"</p>" |
---|
290 | #if len(cFormats)>0 |
---|
291 | #set $cContent+=$printControl({"id": $cOutput["id"], "title": "format","type": "format","name": $cName,"options":$cFormats}) |
---|
292 | #end if |
---|
293 | #if len(cTransmissions)>0 |
---|
294 | #set $cContent+=$printControl({"id": $cOutput["id"], "title": "transmission","type": "transmission","name": $cName,"options":$cTransmissions}) |
---|
295 | #end if |
---|
296 | $printCard({"id": $cName+"_"+str($i),"title": $cOutput["id"],"content": $cContent}) |
---|
297 | #end for |
---|
298 | </div> |
---|
299 | |
---|
300 | <h3>Execution options</h3> |
---|
301 | <div class="accordion" id="accordionExampleExecutionMode"> |
---|
302 | #set cContent="" |
---|
303 | #set cUrl=$openapi["openapi"]["publisherurl"]+cid+"&type=" |
---|
304 | #for a in ["successUri","inProgressUri","failedUri"] |
---|
305 | #set $cContent+=$printControl({"title": $a,"type": "main_value","name": $a,"ph":"URL","value":$cUrl+$a.replace("Uri","")}) |
---|
306 | #end for |
---|
307 | $printCard({"id":"ModeOne","title":"Subscribers","content": $cContent}) |
---|
308 | $printCard({"id":"ModeTwo","title":"Response","content": $printControl({"title":"format","type": "main_value","name": "format","options":["document","raw"]})}) |
---|
309 | $printCard({"id":"ModeThree","title":"Mode","content": $printControl({"title":"mode","type": "main_value","name": "mode","options":["async","sync"]})}) |
---|
310 | </div> |
---|
311 | <button type="submit" class="btn btn-primary" >Submit</button> |
---|
312 | </form> |
---|
313 | <div class="modal" tabindex="-1" id="exampleModal"> |
---|
314 | <div class="modal-dialog modal-xl"> |
---|
315 | <div class="modal-content"> |
---|
316 | <div class="modal-header"> |
---|
317 | <h5 class="modal-title">Your request</h5> |
---|
318 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
---|
319 | <span aria-hidden="true">×</span> |
---|
320 | </button> |
---|
321 | </div> |
---|
322 | <div class="modal-body"> |
---|
323 | <textarea name="modalText" class="form-control" style="min-height:300px"></textarea> |
---|
324 | <pre id="result"></pre> |
---|
325 | <div id="progress_details" style="display:none"> |
---|
326 | <p id="prgress_description"></p> |
---|
327 | <div class="progress"> |
---|
328 | <div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%"></div> |
---|
329 | </div> |
---|
330 | </div> |
---|
331 | </div> |
---|
332 | <div class="modal-footer"> |
---|
333 | <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> |
---|
334 | <button type="button" class="btn btn-primary">Submit Job</button> |
---|
335 | </div> |
---|
336 | </div> |
---|
337 | </div> |
---|
338 | </div> |
---|
339 | <script> |
---|
340 | var socket; |
---|
341 | function loadRequest(){ |
---|
342 | var requestObject={ |
---|
343 | "inputs":[], |
---|
344 | "outputs":[], |
---|
345 | "subscriber":{}, |
---|
346 | "mode": \$("select[name='main_value_mode']").val(), |
---|
347 | "response": \$("select[name='main_value_format']").val() |
---|
348 | } |
---|
349 | for(var i=0;i < System["JSON_STR"]["inputs"].length;i++){ |
---|
350 | var cInput={"id": System["JSON_STR"]["inputs"][i]["id"]}; |
---|
351 | var cName=System["JSON_STR"]["inputs"][i]["id"].replace(".","_"); |
---|
352 | var selector="input[name='input_value_"+cName+"'],"+ |
---|
353 | "select[name='input_value_"+cName+"']"; |
---|
354 | if(\$(selector).val()!=""){ |
---|
355 | cInput["input"]={}; |
---|
356 | if(System["JSON_STR"]["inputs"][i]["input"]["formats"]){ |
---|
357 | var selector1="input[name='input_format_"+cName+"'],"+ |
---|
358 | "select[name='input_format_"+cName+"']"; |
---|
359 | cInput["input"]["format"]={ |
---|
360 | "mimeType": \$(selector1).val() |
---|
361 | }; |
---|
362 | cInput["input"]["value"]={ |
---|
363 | "href": \$(selector).val() |
---|
364 | }; |
---|
365 | } |
---|
366 | else{ |
---|
367 | if(System["JSON_STR"]["inputs"][i]["input"]["literalDataDomains"]){ |
---|
368 | console.log(System["JSON_STR"]["inputs"][i]["input"]["literalDataDomains"]); |
---|
369 | cInput["input"]["dataType"]={ |
---|
370 | "name": System["JSON_STR"]["inputs"][i]["input"]["literalDataDomains"][0]["dataType"]["name"] |
---|
371 | }; |
---|
372 | cInput["input"]["value"]=\$(selector).val(); |
---|
373 | } |
---|
374 | } |
---|
375 | requestObject["inputs"].push(cInput); |
---|
376 | } |
---|
377 | } |
---|
378 | console.log(System["JSON_STR"]["outputs"]); |
---|
379 | for(var i=0;i < System["JSON_STR"]["outputs"].length;i++){ |
---|
380 | var cOutput={"id": System["JSON_STR"]["outputs"][i]["id"]}; |
---|
381 | var cName=System["JSON_STR"]["outputs"][i]["id"].replace(/\./g,"_"); |
---|
382 | if(System["JSON_STR"]["outputs"][i]["output"]["formats"]){ |
---|
383 | var selector="select[name='format_"+cName+"']"; |
---|
384 | cOutput["format"]={ |
---|
385 | "mimeType": \$(selector).val() |
---|
386 | }; |
---|
387 | } |
---|
388 | else{ |
---|
389 | if(System["JSON_STR"]["outputs"][i]["output"]["literalDataDomains"]){ |
---|
390 | cOutput["dataType"]={ |
---|
391 | "name": System["JSON_STR"]["outputs"][i]["output"]["literalDataDomains"][0]["dataType"]["name"] |
---|
392 | }; |
---|
393 | } |
---|
394 | } |
---|
395 | var selector1="select[name='transmission_"+cName+"']"; |
---|
396 | cOutput["transmissionMode"]=\$(selector1).val(); |
---|
397 | requestObject["outputs"].push(cOutput); |
---|
398 | } |
---|
399 | if(\$("input[name='main_value_successUri']").val()!="") |
---|
400 | requestObject["subscriber"]["successUri"]=\$("input[name='main_value_successUri']").val(); |
---|
401 | if(\$("input[name='main_value_inProgressUri']").val()!="") |
---|
402 | requestObject["subscriber"]["inProgressUri"]=\$("input[name='main_value_inProgressUri']").val(); |
---|
403 | if(\$("input[name='main_value_failedUri']").val()!="") |
---|
404 | requestObject["subscriber"]["failedUri"]=\$("input[name='main_value_failedUri']").val(); |
---|
405 | \$(".modal").find("textarea").first().val(js_beautify(JSON.stringify(requestObject))); |
---|
406 | \$("#exampleModal").modal('toggle'); |
---|
407 | \$('#result').html(""); |
---|
408 | \$("#exampleModal").find(".btn-primary").off('click'); |
---|
409 | \$("#exampleModal").find(".btn-primary").click(function(){ |
---|
410 | \$('#result').html(""); |
---|
411 | if(!socket && requestObject["mode"]!="sync") |
---|
412 | socket = new WebSocket("$openapi["openapi"]["wsurl"]"); |
---|
413 | else |
---|
414 | \$.ajax({ |
---|
415 | contentType: "application/json", |
---|
416 | data: \$("textarea").val(), |
---|
417 | type: "POST", |
---|
418 | url: "$openapi["openapi"]["rootUrl"]$(currentUrl)/jobs", |
---|
419 | success: function (msg) { |
---|
420 | console.log(msg); |
---|
421 | var cObj=msg; |
---|
422 | \$('#result').html(js_beautify(JSON.stringify(msg["outputs"]))); |
---|
423 | }, |
---|
424 | error: function(){ |
---|
425 | console.log(arguments); |
---|
426 | }, |
---|
427 | }); |
---|
428 | if(requestObject["mode"]=="sync"){ |
---|
429 | return; |
---|
430 | } |
---|
431 | socket.onopen = function () { |
---|
432 | console.log('Connected!'); |
---|
433 | socket.send("SUB $cid"); |
---|
434 | }; |
---|
435 | socket.onmessage = function(event) { |
---|
436 | console.log('MESSAGE: ' + event.data); |
---|
437 | if(event.data=="1") |
---|
438 | \$.ajax({ |
---|
439 | contentType: "application/json", |
---|
440 | data: \$("textarea").val(), |
---|
441 | type: "POST", |
---|
442 | url: "$openapi["openapi"]["rootUrl"]$(currentUrl)/jobs", |
---|
443 | success: function (msg) { |
---|
444 | console.log(msg); |
---|
445 | }, |
---|
446 | error: function(){ |
---|
447 | console.log(arguments); |
---|
448 | }, |
---|
449 | }); |
---|
450 | else{ |
---|
451 | //progressBar |
---|
452 | \$("#progress_details").show(); |
---|
453 | var cObj=JSON.parse(event.data); |
---|
454 | if(cObj["jobID"]){ |
---|
455 | \$("#prgress_description").html(cObj["jobID"]+": "+cObj["message"]); |
---|
456 | \$(".progress-bar").attr("aria-valuenow",cObj["progress"]); |
---|
457 | \$(".progress-bar").css("width",cObj["progress"]+"%"); |
---|
458 | }else{ |
---|
459 | \$("#progress_details").hide(); |
---|
460 | if(cObj["outputs"]) |
---|
461 | \$('#result').html(js_beautify(JSON.stringify(cObj["outputs"]))); |
---|
462 | else |
---|
463 | \$('#result').html(cObj["message"]); |
---|
464 | } |
---|
465 | } |
---|
466 | }; |
---|
467 | }); |
---|
468 | } |
---|
469 | </script> |
---|
470 | #end if |
---|
471 | |
---|
472 | #try |
---|
473 | #if "links" in $values |
---|
474 | #for i in range(len($values["links"])) |
---|
475 | #if $i%2==0 |
---|
476 | <h2>$values["links"][$i]["title"]</h2> |
---|
477 | <p> |
---|
478 | <a href="$values["links"][$i]["href"]">$printRel($openapi["links_title"],$values["links"][$i]["rel"])</a> |
---|
479 | </p> |
---|
480 | #if $i+1<=len($values["links"]) and len($values["links"])>1 and not($values["links"][$i+1]["rel"]=="alternate" and $openapi["openapi"]["full_html_support"]=="true") |
---|
481 | <p><a href="$values["links"][$i+1]["href"]">$printRel($openapi["links_title"],$values["links"][$i+1]["rel"])</a></p> |
---|
482 | #end if |
---|
483 | #end if |
---|
484 | #end for |
---|
485 | #end if |
---|
486 | #except Exception as e |
---|
487 | $e |
---|
488 | #end try |
---|
489 | #if "conformsTo" in $values |
---|
490 | <ul> |
---|
491 | #for i in range(len($values["conformsTo"])) |
---|
492 | <li> |
---|
493 | <a href="$values["conformsTo"][$i]">$values["conformsTo"][$i]</a> |
---|
494 | </li> |
---|
495 | #end for |
---|
496 | </ul> |
---|
497 | #end if |
---|
498 | #if "jobs" in $urlCompnents |
---|
499 | #set $removeCacheFile=True |
---|
500 | #end if |
---|
501 | #if hasattr($values, "__len__") and isinstance($values,list) and len($values)>0 |
---|
502 | <table class="table table-striped"> |
---|
503 | <thead> |
---|
504 | <tr> |
---|
505 | #if "jobs" not in $urlCompnents |
---|
506 | #* |
---|
507 | * Processes list |
---|
508 | *# |
---|
509 | <th scope="col">#</th> |
---|
510 | <th scope="col">Title</th> |
---|
511 | <th scope="col">Version</th> |
---|
512 | #else |
---|
513 | #* |
---|
514 | * Jobs list |
---|
515 | *# |
---|
516 | <th scope="col">#</th> |
---|
517 | <th scope="col">Message</th> |
---|
518 | <th scope="col">Links</th> |
---|
519 | #end if |
---|
520 | </tr> |
---|
521 | </thead> |
---|
522 | <tbody> |
---|
523 | #for i in range(len($values)) |
---|
524 | <tr> |
---|
525 | #if "jobs" not in $urlCompnents |
---|
526 | #* |
---|
527 | * Processes list |
---|
528 | *# |
---|
529 | <th scope="row"> |
---|
530 | <a href="$(values[$i]["links"][0]["href"][:-1]).html"> |
---|
531 | <svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-link-45deg" fill="currentColor" xmlns="http://www.w3.org/2000/svg"> |
---|
532 | <path d="M4.715 6.542L3.343 7.914a3 3 0 1 0 4.243 4.243l1.828-1.829A3 3 0 0 0 8.586 5.5L8 6.086a1.001 1.001 0 0 0-.154.199 2 2 0 0 1 .861 3.337L6.88 11.45a2 2 0 1 1-2.83-2.83l.793-.792a4.018 4.018 0 0 1-.128-1.287z"/> |
---|
533 | <path d="M6.586 4.672A3 3 0 0 0 7.414 9.5l.775-.776a2 2 0 0 1-.896-3.346L9.12 3.55a2 2 0 0 1 2.83 2.83l-.793.792c.112.42.155.855.128 1.287l1.372-1.372a3 3 0 0 0-4.243-4.243L6.586 4.672z"/> |
---|
534 | </svg> |
---|
535 | $values[$i]["id"] |
---|
536 | </a> |
---|
537 | </th> |
---|
538 | <td>$values[$i]["title"]</td> |
---|
539 | <td>#if "version" in $values[$i]#$values[$i]["version"]#else#1.0.0#end if#</td> |
---|
540 | #else |
---|
541 | #* |
---|
542 | * Jobs list |
---|
543 | *# |
---|
544 | #set cValue=$values[$i]["infos"] |
---|
545 | <th scope="row"> |
---|
546 | #if "status" in $cValue and $cValue["status"]=="successful" |
---|
547 | <svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-check-circle-fill text-success" fill="currentColor" xmlns="http://www.w3.org/2000/svg"> |
---|
548 | <path fill-rule="evenodd" d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zm-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z"/> |
---|
549 | </svg> |
---|
550 | #else |
---|
551 | #if "status" in $cValue and $cValue["status"]=="failed" |
---|
552 | <svg width="1.0625em" height="1em" viewBox="0 0 17 16" class="bi bi-exclamation-triangle-fill text-error" fill="currentColor" xmlns="http://www.w3.org/2000/svg"> |
---|
553 | <path fill-rule="evenodd" d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5a.905.905 0 0 0-.9.995l.35 3.507a.552.552 0 0 0 1.1 0l.35-3.507A.905.905 0 0 0 8 5zm.002 6a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/> |
---|
554 | </svg> |
---|
555 | #end if |
---|
556 | #end if |
---|
557 | $cValue["jobID"] |
---|
558 | </th> |
---|
559 | <td>$cValue["message"]</td> |
---|
560 | <td> |
---|
561 | <div class="dropdown"> |
---|
562 | <button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> |
---|
563 | Action |
---|
564 | </button> |
---|
565 | <div class="dropdown-menu" aria-labelledby="dropdownMenuButton"> |
---|
566 | #for j in range(len($cValue["links"])) |
---|
567 | #set $cValueLink=$cValue["links"][$j] |
---|
568 | #if $cValueLink["href"].count("result")==0 |
---|
569 | <a class="dropdown-item delete" |
---|
570 | href="#" |
---|
571 | data-value="$(cValueLink["href"])">Delete</a> |
---|
572 | #end if |
---|
573 | <a class="dropdown-item" href="$(cValueLink["href"]).html">$cValueLink["title"]</a> |
---|
574 | #end for |
---|
575 | </div> |
---|
576 | </div> |
---|
577 | </td> |
---|
578 | #end if |
---|
579 | </tr> |
---|
580 | #end for |
---|
581 | </tbody> |
---|
582 | </table> |
---|
583 | <script> |
---|
584 | System["jobListDelete"]=function(){ |
---|
585 | \$(".delete").each(function(){ |
---|
586 | \$(this).off("click"); |
---|
587 | \$(this).click(function(){ |
---|
588 | console.log("OK"); |
---|
589 | \$.ajax({ |
---|
590 | url: \$(this).data("value"), |
---|
591 | type: "DELETE", |
---|
592 | success: function(){ |
---|
593 | console.log(arguments); |
---|
594 | } |
---|
595 | }); |
---|
596 | }); |
---|
597 | }); |
---|
598 | } |
---|
599 | </script> |
---|
600 | #end if |
---|
601 | |
---|
602 | <div class="microlight">$json.dumps(values)</div> |
---|
603 | <textarea class="form-control" style="height: 300px;"></textarea> |
---|
604 | <script> |
---|
605 | window.onload = function(){ |
---|
606 | var jsContent=\$(".microlight").html(); |
---|
607 | var tmpStr=js_beautify(jsContent); |
---|
608 | \$("textarea").last().val(tmpStr); |
---|
609 | \$(".microlight").remove(); |
---|
610 | for(var i in System){ |
---|
611 | System[i](); |
---|
612 | } |
---|
613 | System["JSON_STR"]=JSON.parse(tmpStr); |
---|
614 | var forms = document.getElementsByClassName('needs-validation'); |
---|
615 | // Loop over them and prevent submission |
---|
616 | var validation = Array.prototype.filter.call(forms, function(form) { |
---|
617 | form.addEventListener('submit', function(event) { |
---|
618 | event.preventDefault(); |
---|
619 | event.stopPropagation(); |
---|
620 | if (form.checkValidity() === false) { |
---|
621 | event.preventDefault(); |
---|
622 | event.stopPropagation(); |
---|
623 | for(var i=0;i<System["JSON_STR"]["inputs"].length;i++){ |
---|
624 | var cName=System["JSON_STR"]["inputs"][i]["id"].replace(/\./g,"_"); |
---|
625 | var selector= |
---|
626 | 'input[name="input_value_'+cName+'"]:invalid,'+ |
---|
627 | 'select[name="input_value_'+cName+'"]:invalid'; |
---|
628 | if(\$(selector).length>0){ |
---|
629 | \$(selector).each(function(){ |
---|
630 | \$(this).parent().parent().parent().parent().find(".btn").first().click(); |
---|
631 | }); |
---|
632 | console.log(System["JSON_STR"]["inputs"][i]["id"]); |
---|
633 | } |
---|
634 | } |
---|
635 | }else{ |
---|
636 | loadRequest(); |
---|
637 | } |
---|
638 | form.classList.add('was-validated'); |
---|
639 | }, false); |
---|
640 | }); |
---|
641 | |
---|
642 | } |
---|
643 | </script> |
---|
644 | <hr> |
---|
645 | <address>$openapi["openapi"]["rootUrl"]$(currentUrl).html</address> |
---|
646 | <!-- hhmts start -->Last modified: Thu Oct 22 14:21:02 CEST 2020 <!-- hhmts end --> |
---|
647 | </main> |
---|
648 | #if $currentKey=="root" |
---|
649 | </div> |
---|
650 | <div class="col-sm-4" |
---|
651 | itemprop="provider" |
---|
652 | itemscope itemtype="https://schema.org/Organization"> |
---|
653 | $printIndentification($conf) |
---|
654 | </div> |
---|
655 | </div> |
---|
656 | </div> |
---|
657 | #end if |
---|
658 | |
---|
659 | |
---|
660 | <footer class="footer" itemscope itemtype="https://schema.org/SoftwareApplication"> |
---|
661 | <div class="container-fluid"> |
---|
662 | <span class="text-muted"> |
---|
663 | Powered by |
---|
664 | <a target="_blank" itemprop="url" |
---|
665 | href="http://www.zoo-project.org/"><span itemprop="name">ZOO-Project</span></a> |
---|
666 | <span itemprop="version">$zoo.VERSION</span>. |
---|
667 | <meta itemprop="applicationCategory" content="WebService" /> |
---|
668 | #try |
---|
669 | #set sysname=$os.uname() |
---|
670 | #except Exception as e |
---|
671 | #set sysname=["Unknown"] |
---|
672 | #end try |
---|
673 | <meta itemprop="operatingSystem" content="$sysname[0]" /> |
---|
674 | </span> |
---|
675 | </div> |
---|
676 | </footer> |
---|
677 | |
---|
678 | <!-- JS, Popper.js, and jQuery --> |
---|
679 | <script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script> |
---|
680 | <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script> |
---|
681 | <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script> |
---|
682 | <script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.13.0/beautify.min.js" integrity="sha512-84xqGKD+OW9ElGeIq5RkXhsKveQx+kAjahn9r7f/Vm9J0bDrwEabW3MQNgYdTzLBnwfrTGs0nuPx3pZxh6itNg==" crossorigin="anonymous"></script> |
---|
683 | </body> |
---|
684 | </html> |
---|
685 | #if "cache_file" in $inputs["tmpl"] and $removeCacheFile |
---|
686 | <!-- REMOVED ! --> |
---|
687 | #import os |
---|
688 | $(os.remove($inputs["tmpl"]["cache_file"])) |
---|
689 | #end if |
---|