Fix array/map param values as JSON, v1.0.31
This commit is contained in:
+1
-1
@@ -6,7 +6,7 @@ from routes.main import bp as main_bp
|
||||
from routes.api import bp as api_bp
|
||||
from routes.api_test import bp as api_test_bp
|
||||
|
||||
VERSION = "1.0.30"
|
||||
VERSION = "1.0.31"
|
||||
|
||||
app = Flask(__name__, template_folder="templates", static_folder="static")
|
||||
app.config["NUBES_API_ENDPOINT"] = os.getenv("NUBES_API_ENDPOINT", "https://lk-api-gateway-dev.ngcloud.ru/api/v1/svc")
|
||||
|
||||
@@ -154,9 +154,9 @@ async function selectOperation(opId,opName,svcId){
|
||||
const vl=p.valueList;
|
||||
let input;
|
||||
if(vl&&Array.isArray(vl)){
|
||||
input=`<select name="p_${p.svcOperationCfsParamId}">${vl.map(v=>`<option value="${v}" ${v==dfl?'selected':''}>${v}</option>`).join('')}</select>`;
|
||||
input=`<select name="p_${p.svcOperationCfsParamId}" data-type="${p.dataType}">${vl.map(v=>`<option value="${v}" ${v==dfl?'selected':''}>${v}</option>`).join('')}</select>`;
|
||||
}else if(p.dataType==='boolean'){
|
||||
input=`<select name="p_${p.svcOperationCfsParamId}"><option value="true" ${dfl==='true'||dfl===true?'selected':''}>true</option><option value="false" ${dfl==='false'||dfl===false?'selected':''}>false</option></select>`;
|
||||
input=`<select name="p_${p.svcOperationCfsParamId}" data-type="boolean"><option value="true" ${dfl==='true'||dfl===true?'selected':''}>true</option><option value="false" ${dfl==='false'||dfl===false?'selected':''}>false</option></select>`;
|
||||
}else{
|
||||
input=`<input type="text" name="p_${p.svcOperationCfsParamId}" value="${dfl}" placeholder="${req&&!hasDfl?'обязательно':''}">`;
|
||||
}
|
||||
@@ -174,7 +174,11 @@ async function runTest(){
|
||||
|
||||
const params={};
|
||||
document.querySelectorAll('#params-form [name^="p_"]').forEach(el=>{
|
||||
params[el.name.replace('p_','')]=el.value;
|
||||
let v=el.value;
|
||||
const dt=el.dataset.type||'';
|
||||
if(dt==='array'||dt.startsWith('array')) v=JSON.stringify([v]);
|
||||
if(dt==='map'||dt==='map-fixed') v=v||'{}';
|
||||
params[el.name.replace('p_','')]=v;
|
||||
});
|
||||
|
||||
let instUid='';
|
||||
|
||||
Reference in New Issue
Block a user