- Timestamp:
- Oct 23, 2020, 6:28:11 PM (4 years ago)
- Location:
- trunk/zoo-project
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/service_json.c
r963 r965 1375 1375 } 1376 1376 if (tok->char_offset < slen){ 1377 fprintf(stderr, "Error parsing json\n"); 1377 1378 return NULL; 1378 1379 } … … 1814 1815 json_object_array_add(cc,json_object_new_string(vMap->value)); 1815 1816 json_object_object_add(methodc,"tags",cc); 1817 json_object_object_add(methodc,"operationId",json_object_new_string(vMap->value)); 1818 1816 1819 } 1817 1820 json_object *responses=json_object_new_object(); … … 1924 1927 1925 1928 json_object *pajDescription=json_object_new_object(); 1926 if(pmTitle!=NULL) 1929 json_object *pajPost=json_object_new_object(); 1930 if(pmTitle!=NULL){ 1927 1931 json_object_object_add(pajDescription,"description",json_object_new_string(pmTitle->value)); 1932 json_object_object_add(pajPost,"summary",json_object_new_string(pmTitle->value)); 1933 } 1928 1934 json_object *pajResponse=json_object_new_object(); 1929 1935 json_object_object_add(pajResponse,"200",pajDescription); 1930 1936 1931 json_object *pajPost=json_object_new_object();1932 1937 json_object_object_add(pajPost,"requestBody",pajRBody); 1933 1938 json_object_object_add(pajPost,"responses",pajResponse); 1939 json_object_object_add(pajPost,"operationId",json_object_new_string(pmState->value)); 1934 1940 1935 1941 json_object *pajMethod=json_object_new_object(); … … 1942 1948 json_object *pajFinal=json_object_new_object(); 1943 1949 json_object_object_add(pajFinal,pacUri,pajMethod); 1944 1945 1950 json_object_object_add(pajRes,pmState->value,pajFinal); 1946 1951 -
trunk/zoo-project/zoo-services/utils/open-api/templates/index.html
r964 r965 202 202 #end if 203 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 204 210 #end def 205 211 #def printProvider(conf) … … 339 345 <script> 340 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 341 382 function loadRequest(){ 342 383 var requestObject={ … … 348 389 } 349 390 for(var i=0;i < System["JSON_STR"]["inputs"].length;i++){ 350 var cInput={"id": System["JSON_STR"]["inputs"][i]["id"]};351 391 var cName=System["JSON_STR"]["inputs"][i]["id"].replace(".","_"); 352 392 var selector="input[name='input_value_"+cName+"'],"+ 353 393 "select[name='input_value_"+cName+"']"; 354 394 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"] 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() 371 403 }; 372 cInput["input"]["value"]=\$(selector).val(); 404 cInput["input"]["value"]={ 405 "href": \$(this).val() 406 }; 373 407 } 374 } 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); 375 417 requestObject["inputs"].push(cInput); 418 }); 376 419 } 377 420 } … … 628 671 if(\$(selector).length>0){ 629 672 \$(selector).each(function(){ 630 \$(this).parent().parent().parent().parent().find(".btn").first().click(); 673 if(!\$(this).parent().parent().parent().hasClass("show")) 674 \$(this).parent().parent().parent().parent().find(".btn").first().click(); 631 675 }); 632 console.log(System["JSON_STR"]["inputs"][i]["id"]);633 676 } 634 677 } … … 644 687 <hr> 645 688 <address>$openapi["openapi"]["rootUrl"]$(currentUrl).html</address> 646 <!-- hhmts start -->Last modified: Thu Oct 22 14:21:02CEST 2020 <!-- hhmts end -->689 <!-- hhmts start -->Last modified: Fri Oct 23 18:25:03 CEST 2020 <!-- hhmts end --> 647 690 </main> 648 691 #if $currentKey=="root"
Note: See TracChangeset
for help on using the changeset viewer.