Show durable reservation acquisition progress in download tasks

This commit is contained in:
Wyndham ARR committed 2026-10-08 23:42:31 +08:00
1 parent 698d91367c
commit db42a5e087
16 files changed
+757 -23

No files matched your search

+12 -3
View File
@@ -11,8 +11,17 @@ assert(source.endsWith(boot+'\n') || source.endsWith(boot));
function harness(respond) {
const elements=new Map(), storage=new Map(), storageReads=[], calls=[];
const element=selector => {
if (!elements.has(selector)) elements.set(selector,{value:'', disabled:false, hidden:false, textContent:'', innerHTML:'',style:{},
classList:{add(){},remove(){},toggle(){},contains(){return false;}},setAttribute(){},removeAttribute(){},querySelectorAll(){return [];},scrollIntoView(){},focus(){}});
if (!elements.has(selector)) {
const attributes=new Map(),classes=new Set();
elements.set(selector,{value:'', disabled:false, hidden:false, textContent:'', innerHTML:'',style:{},
classList:{add:value=>classes.add(value),remove:value=>classes.delete(value),toggle(value,force){
const enabled=force===undefined?!classes.has(value):force;
if(enabled) classes.add(value); else classes.delete(value);
return enabled;
},contains:value=>classes.has(value)},setAttribute:(key,value)=>attributes.set(key,String(value)),
removeAttribute:key=>attributes.delete(key),getAttribute:key=>attributes.get(key)??null,
querySelectorAll(){return [];},scrollIntoView(){},focus(){}});
}
return elements.get(selector);
};
const context=vm.createContext({Headers, console, Date, Intl, Uint8Array,
@@ -32,7 +41,7 @@ function harness(respond) {
const node={dataset:{arrDataReviewItemId:itemId},querySelector:()=>input};
return {input,button:{closest:()=>node}};
};
return {...subject,calls,storage,storageReads,element,row,submit:()=>subject.submitARRDownload({preventDefault(){}})};
return {...subject,calls,storage,storageReads,element,row,i18n:context.window.ARRI18n,submit:()=>subject.submitARRDownload({preventDefault(){}})};
}
const response=(status,data,code) => ({status,ok:status<400,json:async()=>code?{ok:false,error:{code}}:{ok:true,data}});
const scopedKey=(context='production',username='operator')=>`arr:last-download:v2:${encodeURIComponent(context)}:${encodeURIComponent(username)}`;