v1.0.63: autotest namespace and duplicate prevention
This commit is contained in:
@@ -99,6 +99,7 @@
|
||||
<script>
|
||||
let svcInstances=[], selectedInst=null, selectedOp=null, pollTimer=null;
|
||||
const SVC_ID=1;
|
||||
const AUTOTEST_PREFIX='autotest-';
|
||||
|
||||
selectService(SVC_ID);
|
||||
|
||||
@@ -151,6 +152,18 @@ function startCreate(){
|
||||
showParams(18,'create');
|
||||
}
|
||||
|
||||
function makeCreateDisplayName(){
|
||||
const existing = new Set((svcInstances||[])
|
||||
.map(i => i.displayName || '')
|
||||
.filter(name => name.startsWith(AUTOTEST_PREFIX)));
|
||||
const suffix = Date.now().toString(36);
|
||||
let candidate = `${AUTOTEST_PREFIX}${suffix}`;
|
||||
while(existing.has(candidate)){
|
||||
candidate = `${AUTOTEST_PREFIX}${suffix}-${Math.random().toString(36).slice(2, 6)}`;
|
||||
}
|
||||
return candidate;
|
||||
}
|
||||
|
||||
function runOp(opName,opId){
|
||||
stopPoll();
|
||||
selectedOp={opId,opName,svcId:SVC_ID};
|
||||
@@ -176,7 +189,7 @@ function showParams(opId,opName){
|
||||
|
||||
fetch('/api/params/'+opId).then(r=>r.json()).then(params=>{
|
||||
const form=document.getElementById('params-form');
|
||||
const displayName=opName==='create'?('autotest-1-'+Date.now().toString(36)):'';
|
||||
const displayName=opName==='create'?makeCreateDisplayName():'';
|
||||
form.innerHTML=(opName==='create'?`<div class="param-row"><label class="req">displayName</label><input type="text" id="param-displayname" value="${displayName}"></div>`:'')
|
||||
+ params.map(p=>{
|
||||
const req=p.isRequired;
|
||||
|
||||
Reference in New Issue
Block a user