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 | #if $obj["maxOccurs"]>1 |
---|
205 | <div class="btn-group" role="group" aria-label="Basic example"> |
---|
206 | <button type="button" class="btn btn-secondary" onclick="addElementToList(\$(this));">Add</button> |
---|
207 | <button type="button" class="btn btn-secondary" onclick="delElementToList(\$(this));">Delete</button> |
---|
208 | </div> |
---|
209 | #end if |
---|
210 | #end def |
---|
211 | #def printProvider(conf) |
---|
212 | #set provider=$conf["provider"] |
---|
213 | <b itemprop="name">$provider["providerName"]</b> |
---|
214 | <p><a itemprop="url" href="$provider["providerSite"]">$provider["providerSite"]</a></p> |
---|
215 | #end def |
---|
216 | #def printContact(conf) |
---|
217 | #set provider=$conf["provider"] |
---|
218 | #set alt=$openapi["provider_alt"] |
---|
219 | #set elements=list($alt.keys()) |
---|
220 | <b>Address</b> |
---|
221 | #for i in ["addressDeliveryPoint","addressCity","addressAdministrativeArea","addressPostalCode","addressCountry","addressElectronicMailAddress","phoneVoice","phoneFacsimile"] |
---|
222 | #if i!="addressElectronicMailAddress" and $provider[$i]!="False" |
---|
223 | <p itemprop="$(alt[$i.lower()])"> |
---|
224 | #if i=="phoneVoice" |
---|
225 | Phone |
---|
226 | <svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-telephone" fill="currentColor" xmlns="http://www.w3.org/2000/svg"> |
---|
227 | <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"/> |
---|
228 | </svg> |
---|
229 | #end if |
---|
230 | $provider[$i] |
---|
231 | </p> |
---|
232 | #else |
---|
233 | #if i=="addressElectronicMailAddress" |
---|
234 | <b>Email</b> |
---|
235 | <p itemprop="$(alt[$i.lower()])"> |
---|
236 | $provider[$i] |
---|
237 | </p> |
---|
238 | #end if |
---|
239 | #end if |
---|
240 | #end for |
---|
241 | #end def |
---|
242 | #def printIndentification(conf) |
---|
243 | #set provider=$conf["provider"] |
---|
244 | $printCard({"id": "provider","title": "Provider","content": $printProvider($conf),"class": "show"}) |
---|
245 | $printCard({"id": "contact","title": "Contact","content": $printContact($conf),"class": "show","attrs":'itemprop="address" itemscope itemtype="https://schema.org/PostalAddress"'}) |
---|
246 | #end def |
---|
247 | |
---|
248 | #if $currentKey=="root" |
---|
249 | <div class="container-fluid"> |
---|
250 | <div class="row"> |
---|
251 | <div class="col-sm-8"> |
---|
252 | #end if |
---|
253 | <!-- $currentUrl --> |
---|
254 | <!-- Begin page content --> |
---|
255 | <main #if $currentKey!="root"#class="container-fluid"#end if#> |
---|
256 | <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> |
---|
257 | #if "description" in $values#<p itemprop="description">$html.escape($values["description"])</p>#end if# |
---|
258 | #if $currentKey=="root" |
---|
259 | <div class="keywords"> |
---|
260 | #for i in $conf["identification"]["keywords"].split(',') |
---|
261 | <button type="button" |
---|
262 | class="btn btn-outline-info">$i</button> |
---|
263 | #end for |
---|
264 | </div> |
---|
265 | License: |
---|
266 | <a itemprop="license" href="$openapi["openapi"]["license_url"]">$openapi["openapi"]["license_name"]</a> |
---|
267 | #end if |
---|
268 | #if "inputs" in $values |
---|
269 | #set $cid="JOBSOCKET-"+$conf["lenv"]["usid"] |
---|
270 | <form class="needs-validation" data-id="$cid" novalidate> |
---|
271 | <h3>Inputs</h3> |
---|
272 | <div class="accordion" id="accordionInputExample"> |
---|
273 | #for i in range(len(values["inputs"])) |
---|
274 | #set cInput=$values["inputs"][$i] |
---|
275 | #set cName=$cInput["id"].replace(".","_") |
---|
276 | $printCard({"id": $cName, "title": $cInput["id"],"content":'<p>'+$cInput["description"]+'</p>'+$printInputContent($cInput)}) |
---|
277 | #end for |
---|
278 | </div> |
---|
279 | |
---|
280 | <h3>Outputs</h3> |
---|
281 | <div class="accordion" id="accordionOutputExample"> |
---|
282 | #for i in range(len(values["outputs"])) |
---|
283 | #set cOutput=$values["outputs"][$i] |
---|
284 | #set cName=$cOutput["id"].replace(".","_") |
---|
285 | #set cFormats=[] |
---|
286 | #if "formats" in $cOutput["output"] |
---|
287 | #for j in range(len($cOutput["output"]["formats"])) |
---|
288 | #set cFormats+=[$cOutput["output"]["formats"][$j]["mimeType"]] |
---|
289 | #end for |
---|
290 | #end if |
---|
291 | #set cTransmissions=[] |
---|
292 | #for j in range(len($values["outputTransmission"])) |
---|
293 | #set cTransmissions+=[$values["outputTransmission"][$j]] |
---|
294 | #end for |
---|
295 | #set cContent="<p>"+$cOutput["description"]+"</p>" |
---|
296 | #if len(cFormats)>0 |
---|
297 | #set $cContent+=$printControl({"id": $cOutput["id"], "title": "format","type": "format","name": $cName,"options":$cFormats}) |
---|
298 | #end if |
---|
299 | #if len(cTransmissions)>0 |
---|
300 | #set $cContent+=$printControl({"id": $cOutput["id"], "title": "transmission","type": "transmission","name": $cName,"options":$cTransmissions}) |
---|
301 | #end if |
---|
302 | $printCard({"id": $cName+"_"+str($i),"title": $cOutput["id"],"content": $cContent}) |
---|
303 | #end for |
---|
304 | </div> |
---|
305 | |
---|
306 | <h3>Execution options</h3> |
---|
307 | <div class="accordion" id="accordionExampleExecutionMode"> |
---|
308 | #set cContent="" |
---|
309 | #set cUrl=$openapi["openapi"]["publisherurl"]+cid+"&type=" |
---|
310 | #for a in ["successUri","inProgressUri","failedUri"] |
---|
311 | #set $cContent+=$printControl({"title": $a,"type": "main_value","name": $a,"ph":"URL","value":$cUrl+$a.replace("Uri","")}) |
---|
312 | #end for |
---|
313 | $printCard({"id":"ModeOne","title":"Subscribers","content": $cContent}) |
---|
314 | $printCard({"id":"ModeTwo","title":"Response","content": $printControl({"title":"format","type": "main_value","name": "format","options":["document","raw"]})}) |
---|
315 | $printCard({"id":"ModeThree","title":"Mode","content": $printControl({"title":"mode","type": "main_value","name": "mode","options":["async","sync"]})}) |
---|
316 | </div> |
---|
317 | <button type="submit" class="btn btn-primary" >Submit</button> |
---|
318 | </form> |
---|
319 | <div class="modal" tabindex="-1" id="exampleModal"> |
---|
320 | <div class="modal-dialog modal-xl"> |
---|
321 | <div class="modal-content"> |
---|
322 | <div class="modal-header"> |
---|
323 | <h5 class="modal-title">Your request</h5> |
---|
324 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"> |
---|
325 | <span aria-hidden="true">×</span> |
---|
326 | </button> |
---|
327 | </div> |
---|
328 | <div class="modal-body"> |
---|
329 | <textarea name="modalText" class="form-control" style="min-height:300px"></textarea> |
---|
330 | <pre id="result"></pre> |
---|
331 | <div id="progress_details" style="display:none"> |
---|
332 | <p id="prgress_description"></p> |
---|
333 | <div class="progress"> |
---|
334 | <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> |
---|
335 | </div> |
---|
336 | </div> |
---|
337 | </div> |
---|
338 | <div class="modal-footer"> |
---|
339 | <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> |
---|
340 | <button type="button" class="btn btn-primary">Submit Job</button> |
---|
341 | </div> |
---|
342 | </div> |
---|
343 | </div> |
---|
344 | </div> |
---|
345 | <script> |
---|
346 | var socket; |
---|
347 | function addElementToList(){ |
---|
348 | var lClosure=arguments[0]; |
---|
349 | var isOver=false; |
---|
350 | var cnt=0; |
---|
351 | lClosure.parent().parent().find("div").each(function(){ |
---|
352 | if(isOver) return; |
---|
353 | if(\$(this).hasClass("btn-group")) isOver=true; |
---|
354 | if(\$(this).hasClass("input-group")){ |
---|
355 | lClosure.parent().parent().append(\$(this)[0].outerHTML); |
---|
356 | cnt++; |
---|
357 | } |
---|
358 | }); |
---|
359 | if(lClosure.parent().parent().find(".input-group").length>cnt) |
---|
360 | lClosure.next().attr("disabled",false); |
---|
361 | else |
---|
362 | lClosure.next().attr("disabled",true); |
---|
363 | } |
---|
364 | function delElementToList(){ |
---|
365 | var lClosure=arguments[0]; |
---|
366 | var isOver=false; |
---|
367 | var cnt=0; |
---|
368 | lClosure.parent().parent().find("div").each(function(){ |
---|
369 | if(isOver) return; |
---|
370 | if(\$(this).hasClass("btn-group")) isOver=true; |
---|
371 | if(\$(this).hasClass("input-group")) cnt++; |
---|
372 | }); |
---|
373 | if(lClosure.parent().parent().find(".input-group").length>cnt) |
---|
374 | for(var i=0;i<cnt;i++) |
---|
375 | lClosure.parent().parent().find(".input-group").last().remove(); |
---|
376 | if(lClosure.parent().parent().find(".input-group").length==cnt) |
---|
377 | lClosure.attr("disabled",true); |
---|
378 | else |
---|
379 | lClosure.attr("disabled",false); |
---|
380 | } |
---|
381 | |
---|
382 | function loadRequest(){ |
---|
383 | var requestObject={ |
---|
384 | "inputs":[], |
---|
385 | "outputs":[], |
---|
386 | "subscriber":{}, |
---|
387 | "mode": \$("select[name='main_value_mode']").val(), |
---|
388 | "response": \$("select[name='main_value_format']").val() |
---|
389 | } |
---|
390 | for(var i=0;i < System["JSON_STR"]["inputs"].length;i++){ |
---|
391 | var cName=System["JSON_STR"]["inputs"][i]["id"].replace(".","_"); |
---|
392 | var selector="input[name='input_value_"+cName+"'],"+ |
---|
393 | "select[name='input_value_"+cName+"']"; |
---|
394 | if(\$(selector).val()!=""){ |
---|
395 | \$(selector).each(function(){ |
---|
396 | var cInput={"id": System["JSON_STR"]["inputs"][i]["id"], "input": {}}; |
---|
397 | if(System["JSON_STR"]["inputs"][i]["input"]["formats"]){ |
---|
398 | var selector1="input[name='input_format_"+cName+"'],"+ |
---|
399 | "select[name='input_format_"+cName+"']"; |
---|
400 | console.log(\$(this).parent().prev().find("select").val()); |
---|
401 | cInput["input"]["format"]={ |
---|
402 | "mimeType": \$(this).parent().prev().find("select").val() |
---|
403 | }; |
---|
404 | cInput["input"]["value"]={ |
---|
405 | "href": \$(this).val() |
---|
406 | }; |
---|
407 | } |
---|
408 | else{ |
---|
409 | if(System["JSON_STR"]["inputs"][i]["input"]["literalDataDomains"]){ |
---|
410 | console.log(System["JSON_STR"]["inputs"][i]["input"]["literalDataDomains"]); |
---|
411 | cInput["input"]["dataType"]={ |
---|
412 | "name": System["JSON_STR"]["inputs"][i]["input"]["literalDataDomains"][0]["dataType"]["name"] |
---|
413 | }; |
---|
414 | cInput["input"]["value"]=\$(this).val(); |
---|
415 | } |
---|
416 | }console.log(cInput); |
---|
417 | requestObject["inputs"].push(cInput); |
---|
418 | }); |
---|
419 | } |
---|
420 | } |
---|
421 | console.log(System["JSON_STR"]["outputs"]); |
---|
422 | for(var i=0;i < System["JSON_STR"]["outputs"].length;i++){ |
---|
423 | var cOutput={"id": System["JSON_STR"]["outputs"][i]["id"]}; |
---|
424 | var cName=System["JSON_STR"]["outputs"][i]["id"].replace(/\./g,"_"); |
---|
425 | if(System["JSON_STR"]["outputs"][i]["output"]["formats"]){ |
---|
426 | var selector="select[name='format_"+cName+"']"; |
---|
427 | cOutput["format"]={ |
---|
428 | "mimeType": \$(selector).val() |
---|
429 | }; |
---|
430 | } |
---|
431 | else{ |
---|
432 | if(System["JSON_STR"]["outputs"][i]["output"]["literalDataDomains"]){ |
---|
433 | cOutput["dataType"]={ |
---|
434 | "name": System["JSON_STR"]["outputs"][i]["output"]["literalDataDomains"][0]["dataType"]["name"] |
---|
435 | }; |
---|
436 | } |
---|
437 | } |
---|
438 | var selector1="select[name='transmission_"+cName+"']"; |
---|
439 | cOutput["transmissionMode"]=\$(selector1).val(); |
---|
440 | requestObject["outputs"].push(cOutput); |
---|
441 | } |
---|
442 | if(\$("input[name='main_value_successUri']").val()!="") |
---|
443 | requestObject["subscriber"]["successUri"]=\$("input[name='main_value_successUri']").val(); |
---|
444 | if(\$("input[name='main_value_inProgressUri']").val()!="") |
---|
445 | requestObject["subscriber"]["inProgressUri"]=\$("input[name='main_value_inProgressUri']").val(); |
---|
446 | if(\$("input[name='main_value_failedUri']").val()!="") |
---|
447 | requestObject["subscriber"]["failedUri"]=\$("input[name='main_value_failedUri']").val(); |
---|
448 | \$(".modal").find("textarea").first().val(js_beautify(JSON.stringify(requestObject))); |
---|
449 | \$("#exampleModal").modal('toggle'); |
---|
450 | \$('#result').html(""); |
---|
451 | \$("#exampleModal").find(".btn-primary").off('click'); |
---|
452 | \$("#exampleModal").find(".btn-primary").click(function(){ |
---|
453 | \$('#result').html(""); |
---|
454 | if(!socket && requestObject["mode"]!="sync") |
---|
455 | socket = new WebSocket("$openapi["openapi"]["wsurl"]"); |
---|
456 | else |
---|
457 | \$.ajax({ |
---|
458 | contentType: "application/json", |
---|
459 | data: \$("textarea").val(), |
---|
460 | type: "POST", |
---|
461 | url: "$openapi["openapi"]["rootUrl"]$(currentUrl)/jobs", |
---|
462 | success: function (msg) { |
---|
463 | console.log(msg); |
---|
464 | var cObj=msg; |
---|
465 | \$('#result').html(js_beautify(JSON.stringify(msg["outputs"]))); |
---|
466 | }, |
---|
467 | error: function(){ |
---|
468 | console.log(arguments); |
---|
469 | }, |
---|
470 | }); |
---|
471 | if(requestObject["mode"]=="sync"){ |
---|
472 | return; |
---|
473 | } |
---|
474 | socket.onopen = function () { |
---|
475 | console.log('Connected!'); |
---|
476 | socket.send("SUB $cid"); |
---|
477 | }; |
---|
478 | socket.onmessage = function(event) { |
---|
479 | console.log('MESSAGE: ' + event.data); |
---|
480 | if(event.data=="1") |
---|
481 | \$.ajax({ |
---|
482 | contentType: "application/json", |
---|
483 | data: \$("textarea").val(), |
---|
484 | type: "POST", |
---|
485 | url: "$openapi["openapi"]["rootUrl"]$(currentUrl)/jobs", |
---|
486 | success: function (msg) { |
---|
487 | console.log(msg); |
---|
488 | }, |
---|
489 | error: function(){ |
---|
490 | console.log(arguments); |
---|
491 | }, |
---|
492 | }); |
---|
493 | else{ |
---|
494 | //progressBar |
---|
495 | \$("#progress_details").show(); |
---|
496 | var cObj=JSON.parse(event.data); |
---|
497 | if(cObj["jobID"]){ |
---|
498 | \$("#prgress_description").html(cObj["jobID"]+": "+cObj["message"]); |
---|
499 | \$(".progress-bar").attr("aria-valuenow",cObj["progress"]); |
---|
500 | \$(".progress-bar").css("width",cObj["progress"]+"%"); |
---|
501 | }else{ |
---|
502 | \$("#progress_details").hide(); |
---|
503 | if(cObj["outputs"]) |
---|
504 | \$('#result').html(js_beautify(JSON.stringify(cObj["outputs"]))); |
---|
505 | else |
---|
506 | \$('#result').html(cObj["message"]); |
---|
507 | } |
---|
508 | } |
---|
509 | }; |
---|
510 | }); |
---|
511 | } |
---|
512 | </script> |
---|
513 | #end if |
---|
514 | |
---|
515 | #try |
---|
516 | #if "links" in $values |
---|
517 | #for i in range(len($values["links"])) |
---|
518 | #if $i%2==0 |
---|
519 | <h2>$values["links"][$i]["title"]</h2> |
---|
520 | <p> |
---|
521 | <a href="$values["links"][$i]["href"]">$printRel($openapi["links_title"],$values["links"][$i]["rel"])</a> |
---|
522 | </p> |
---|
523 | #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") |
---|
524 | <p><a href="$values["links"][$i+1]["href"]">$printRel($openapi["links_title"],$values["links"][$i+1]["rel"])</a></p> |
---|
525 | #end if |
---|
526 | #end if |
---|
527 | #end for |
---|
528 | #end if |
---|
529 | #except Exception as e |
---|
530 | $e |
---|
531 | #end try |
---|
532 | #if "conformsTo" in $values |
---|
533 | <ul> |
---|
534 | #for i in range(len($values["conformsTo"])) |
---|
535 | <li> |
---|
536 | <a href="$values["conformsTo"][$i]">$values["conformsTo"][$i]</a> |
---|
537 | </li> |
---|
538 | #end for |
---|
539 | </ul> |
---|
540 | #end if |
---|
541 | #if "jobs" in $urlCompnents |
---|
542 | #set $removeCacheFile=True |
---|
543 | #end if |
---|
544 | #if hasattr($values, "__len__") and isinstance($values,list) and len($values)>0 |
---|
545 | <table class="table table-striped"> |
---|
546 | <thead> |
---|
547 | <tr> |
---|
548 | #if "jobs" not in $urlCompnents |
---|
549 | #* |
---|
550 | * Processes list |
---|
551 | *# |
---|
552 | <th scope="col">#</th> |
---|
553 | <th scope="col">Title</th> |
---|
554 | <th scope="col">Version</th> |
---|
555 | #else |
---|
556 | #* |
---|
557 | * Jobs list |
---|
558 | *# |
---|
559 | <th scope="col">#</th> |
---|
560 | <th scope="col">Message</th> |
---|
561 | <th scope="col">Links</th> |
---|
562 | #end if |
---|
563 | </tr> |
---|
564 | </thead> |
---|
565 | <tbody> |
---|
566 | #for i in range(len($values)) |
---|
567 | <tr> |
---|
568 | #if "jobs" not in $urlCompnents |
---|
569 | #* |
---|
570 | * Processes list |
---|
571 | *# |
---|
572 | <th scope="row"> |
---|
573 | <a href="$(values[$i]["links"][0]["href"][:-1]).html"> |
---|
574 | <svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-link-45deg" fill="currentColor" xmlns="http://www.w3.org/2000/svg"> |
---|
575 | <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"/> |
---|
576 | <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"/> |
---|
577 | </svg> |
---|
578 | $values[$i]["id"] |
---|
579 | </a> |
---|
580 | </th> |
---|
581 | <td>$values[$i]["title"]</td> |
---|
582 | <td>#if "version" in $values[$i]#$values[$i]["version"]#else#1.0.0#end if#</td> |
---|
583 | #else |
---|
584 | #* |
---|
585 | * Jobs list |
---|
586 | *# |
---|
587 | #set cValue=$values[$i]["infos"] |
---|
588 | <th scope="row"> |
---|
589 | #if "status" in $cValue and $cValue["status"]=="successful" |
---|
590 | <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"> |
---|
591 | <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"/> |
---|
592 | </svg> |
---|
593 | #else |
---|
594 | #if "status" in $cValue and $cValue["status"]=="failed" |
---|
595 | <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"> |
---|
596 | <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"/> |
---|
597 | </svg> |
---|
598 | #end if |
---|
599 | #end if |
---|
600 | $cValue["jobID"] |
---|
601 | </th> |
---|
602 | <td>$cValue["message"]</td> |
---|
603 | <td> |
---|
604 | <div class="dropdown"> |
---|
605 | <button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> |
---|
606 | Action |
---|
607 | </button> |
---|
608 | <div class="dropdown-menu" aria-labelledby="dropdownMenuButton"> |
---|
609 | #for j in range(len($cValue["links"])) |
---|
610 | #set $cValueLink=$cValue["links"][$j] |
---|
611 | #if $cValueLink["href"].count("result")==0 |
---|
612 | <a class="dropdown-item delete" |
---|
613 | href="#" |
---|
614 | data-value="$(cValueLink["href"])">Delete</a> |
---|
615 | #end if |
---|
616 | <a class="dropdown-item" href="$(cValueLink["href"]).html">$cValueLink["title"]</a> |
---|
617 | #end for |
---|
618 | </div> |
---|
619 | </div> |
---|
620 | </td> |
---|
621 | #end if |
---|
622 | </tr> |
---|
623 | #end for |
---|
624 | </tbody> |
---|
625 | </table> |
---|
626 | <script> |
---|
627 | System["jobListDelete"]=function(){ |
---|
628 | \$(".delete").each(function(){ |
---|
629 | \$(this).off("click"); |
---|
630 | \$(this).click(function(){ |
---|
631 | console.log("OK"); |
---|
632 | \$.ajax({ |
---|
633 | url: \$(this).data("value"), |
---|
634 | type: "DELETE", |
---|
635 | success: function(){ |
---|
636 | console.log(arguments); |
---|
637 | } |
---|
638 | }); |
---|
639 | }); |
---|
640 | }); |
---|
641 | } |
---|
642 | </script> |
---|
643 | #end if |
---|
644 | |
---|
645 | <div class="microlight">$json.dumps(values)</div> |
---|
646 | <textarea class="form-control" style="height: 300px;"></textarea> |
---|
647 | <script> |
---|
648 | window.onload = function(){ |
---|
649 | var jsContent=\$(".microlight").html(); |
---|
650 | var tmpStr=js_beautify(jsContent); |
---|
651 | \$("textarea").last().val(tmpStr); |
---|
652 | \$(".microlight").remove(); |
---|
653 | for(var i in System){ |
---|
654 | System[i](); |
---|
655 | } |
---|
656 | System["JSON_STR"]=JSON.parse(tmpStr); |
---|
657 | var forms = document.getElementsByClassName('needs-validation'); |
---|
658 | // Loop over them and prevent submission |
---|
659 | var validation = Array.prototype.filter.call(forms, function(form) { |
---|
660 | form.addEventListener('submit', function(event) { |
---|
661 | event.preventDefault(); |
---|
662 | event.stopPropagation(); |
---|
663 | if (form.checkValidity() === false) { |
---|
664 | event.preventDefault(); |
---|
665 | event.stopPropagation(); |
---|
666 | for(var i=0;i<System["JSON_STR"]["inputs"].length;i++){ |
---|
667 | var cName=System["JSON_STR"]["inputs"][i]["id"].replace(/\./g,"_"); |
---|
668 | var selector= |
---|
669 | 'input[name="input_value_'+cName+'"]:invalid,'+ |
---|
670 | 'select[name="input_value_'+cName+'"]:invalid'; |
---|
671 | if(\$(selector).length>0){ |
---|
672 | \$(selector).each(function(){ |
---|
673 | if(!\$(this).parent().parent().parent().hasClass("show")) |
---|
674 | \$(this).parent().parent().parent().parent().find(".btn").first().click(); |
---|
675 | }); |
---|
676 | } |
---|
677 | } |
---|
678 | }else{ |
---|
679 | loadRequest(); |
---|
680 | } |
---|
681 | form.classList.add('was-validated'); |
---|
682 | }, false); |
---|
683 | }); |
---|
684 | |
---|
685 | } |
---|
686 | </script> |
---|
687 | <hr> |
---|
688 | <address>$openapi["openapi"]["rootUrl"]$(currentUrl).html</address> |
---|
689 | <!-- hhmts start -->Last modified: Fri Oct 23 18:25:03 CEST 2020 <!-- hhmts end --> |
---|
690 | </main> |
---|
691 | #if $currentKey=="root" |
---|
692 | </div> |
---|
693 | <div class="col-sm-4" |
---|
694 | itemprop="provider" |
---|
695 | itemscope itemtype="https://schema.org/Organization"> |
---|
696 | $printIndentification($conf) |
---|
697 | </div> |
---|
698 | </div> |
---|
699 | </div> |
---|
700 | #end if |
---|
701 | |
---|
702 | |
---|
703 | <footer class="footer" itemscope itemtype="https://schema.org/SoftwareApplication"> |
---|
704 | <div class="container-fluid"> |
---|
705 | <span class="text-muted"> |
---|
706 | Powered by |
---|
707 | <a target="_blank" itemprop="url" |
---|
708 | href="http://www.zoo-project.org/"><span itemprop="name">ZOO-Project</span></a> |
---|
709 | <span itemprop="version">$zoo.VERSION</span>. |
---|
710 | <meta itemprop="applicationCategory" content="WebService" /> |
---|
711 | #try |
---|
712 | #set sysname=$os.uname() |
---|
713 | #except Exception as e |
---|
714 | #set sysname=["Unknown"] |
---|
715 | #end try |
---|
716 | <meta itemprop="operatingSystem" content="$sysname[0]" /> |
---|
717 | </span> |
---|
718 | </div> |
---|
719 | </footer> |
---|
720 | |
---|
721 | <!-- JS, Popper.js, and jQuery --> |
---|
722 | <script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script> |
---|
723 | <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> |
---|
724 | <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script> |
---|
725 | <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> |
---|
726 | </body> |
---|
727 | </html> |
---|
728 | #if "cache_file" in $inputs["tmpl"] and $removeCacheFile |
---|
729 | <!-- REMOVED ! --> |
---|
730 | #import os |
---|
731 | $(os.remove($inputs["tmpl"]["cache_file"])) |
---|
732 | #end if |
---|