diff --git a/docs/source/installation/settings.html b/docs/source/installation/settings.html index 973a1e0..832938d 100644 --- a/docs/source/installation/settings.html +++ b/docs/source/installation/settings.html @@ -1,17 +1,4 @@ - - - - - - - - - - Auto Archiver Settings - - - +`)})})]}),t.configs&&v!="cli_feeder"&&$.jsx(Y3,{module:t,open:S,setOpen:k,configValues:o})]})};function K3({config_value:e,module:t,configValues:n}){function i(d,p){n[t.name][d]=p}const o=t.configs[e],u=e.replace(/_/g," ").capitalize(),f=n[t.name][e]||o.default;return $.jsxs(Pr,{children:[$.jsxs(dn,{variant:"body1",style:{fontWeight:"bold"},children:[u," ",o.required&&"(required)"," "]}),$.jsxs(tx,{size:"small",children:[o.type==="bool"?$.jsx(nx,{control:$.jsx(Yw,{defaultChecked:f,size:"small",id:`${t}.${e}`,onChange:d=>{i(e,d.target.checked)}}),label:o.help.capitalize()}):o.choices!==void 0?$.jsx(ag,{size:"small",id:`${t}.${e}`,defaultValue:f,onChange:d=>{i(e,d.target.value)},children:o.choices.map(d=>$.jsx(VN,{value:d,children:d},`${t}.${e}.${d}`))}):o.type==="json_loader"?$.jsx(zS,{multiline:!0,size:"small",id:`${t}.${e}`,defaultValue:JSON.stringify(f,null,2),rows:6,onChange:d=>{try{let p=JSON.parse(d.target.value);i(e,p)}catch(p){console.log(p)}}}):$.jsx(zS,{size:"small",id:`${t}.${e}`,defaultValue:f,type:o.type==="int"?"number":"text",onChange:d=>{i(e,d.target.value)},required:o.required}),o.type!=="bool"&&$.jsx(rx,{children:o.help.capitalize()})]})]})}function Y3({module:e,open:t,setOpen:n,configValues:i}){return $.jsx($.Fragment,{children:$.jsxs(Zw,{open:t,onClose:()=>n(!1),maxWidth:"lg",children:[$.jsx(ex,{children:e.display_name}),$.jsx(Jw,{children:$.jsx(cx,{direction:"column",spacing:1,children:Object.keys(e.configs).map(o=>$.jsx(K3,{config_value:o,module:e,configValues:i},o))})})]})})}function X3({setYamlFile:e}){const[t,n]=T.useState(!1),[i,o]=T.useState("Drag and drop your orchestration.yaml file here, or click to select a file.");function l(u){let f=u.target.files[0];if(f.type!=="application/x-yaml"){n(!0),o("Invalid type, only YAML files are accepted.");return}let d=new FileReader;d.onload=function(p){let m=p.target?p.target.result:"";try{let g=Cz(m);if(g.errors.length>0){n(!0),o("Invalid file. Make sure your Orchestration is a valid YAML file with a 'steps' section in it.");return}else n(!1),o("File loaded successfully.");e(g)}catch(g){console.error(g)}},d.readAsText(f)}return $.jsx($.Fragment,{children:$.jsxs("div",{style:{width:"100%",border:"dashed",textAlign:"center",borderWidth:"1px",padding:"20px"},children:[$.jsx("input",{name:"file",type:"file",accept:".yaml",onChange:l}),$.jsx(dn,{style:{marginTop:"20px"},variant:"body1",color:t?"error":"",children:i})]})})}function W3({stepType:e,setEnabledModules:t,enabledModules:n,configValues:i}){const[o,l]=T.useState(!1),[u,f]=T.useState(),[d,p]=T.useState([]);T.useEffect(()=>{p(n[e].map(([w,S])=>w))},[n]);const m=w=>{let S=w.target.id,k=w.target.checked;(e==="feeders"||e==="formatters")&&n[e].filter(([_,O])=>_!==S&&O||k&&_===S).length>1?l(!0):l(!1);let A=Object.fromEntries(Object.keys(n).map(N=>[N,n[N].map(([_,O])=>_===S?[_,k]:[_,O])]));t(A)},g=DD(IS(fg),IS(ug,{coordinateGetter:c5})),v=w=>{f(w.active.id)},b=w=>{f(void 0);const{active:S,over:k}=w;if(S.id!==(k==null?void 0:k.id)){const A=d.indexOf(S.id),N=d.indexOf(k==null?void 0:k.id);let _=pg(d,A,N),O={...n};O[e]=n[e].sort((R,M)=>_.indexOf(R[0])-_.indexOf(M[0])),t(O)}};return $.jsxs($.Fragment,{children:[$.jsxs(Pr,{sx:{my:4},children:[$.jsx(dn,{id:e,variant:"h6",style:{textTransform:"capitalize"},children:e}),$.jsxs(dn,{variant:"body1",children:["Select the ",e," you wish to enable. You can drag and move to reorder. Learn more about ",e," ",$.jsx("a",{href:`https://auto-archiver.readthedocs.io/en/latest/modules/${e.slice(0,-1)}.html`,target:"_blank",children:"here"}),"."]})]}),o?$.jsxs(dn,{variant:"body1",color:"error",children:["Only one ",e.slice(0,-1)," can be enabled at a time."]}):null,$.jsx(ML,{sensors:g,collisionDetection:BD,onDragEnd:b,onDragStart:v,children:$.jsx(ix,{container:!0,spacing:1,children:$.jsxs(e5,{items:d,strategy:hg,children:[d.map(w=>{let S=Dc[w];return $.jsx(G3,{type:e,module:S,toggleModule:m,enabledModules:n,configValues:i},w)}),$.jsx(WL,{children:u?$.jsx("div",{style:{width:"100%",height:"100%",backgroundColor:"grey",opacity:.1}}):null})]})},e)})]})}function Q3(){const[e,t]=T.useState(new qo),[n,i]=T.useState(Object.fromEntries(Object.keys(xo).map(f=>[f,xo[f].map(d=>[d,!1])]))),[o,l]=T.useState(Object.keys(Dc).reduce((f,d)=>(f[d]={},f),{})),u=function(f=!1){let d=n;const p={steps:Object.keys(xo).reduce((g,v)=>(g[v]=d[v].filter(([b,w])=>w).map(([b,w])=>b),g),{})};Object.keys(o).map(g=>{let v=o[g];v&&(p[g]=v)});let m=new qo(p);if(f)navigator.clipboard.writeText(String(m)).then(()=>{alert("Settings copied to clipboard.")});else{const g=new Blob([String(m)],{type:"application/x-yaml"}),v=URL.createObjectURL(g),b=document.createElement("a");b.href=v,b.download="orchestration.yaml",b.click()}};return T.useEffect(()=>{let f={};Object.keys(Dc).map(d=>{let m=Dc[d].configs;m&&(f[d]={},Object.keys(m).map(g=>{let v=m[g];v.default!==void 0&&(f[d][g]=v.default)}))}),l(f)},[]),T.useEffect(()=>{if(!e||e.contents==null)return;let d=e.toJS().steps,p=Object.fromEntries(Object.keys(xo).map(m=>[m,xo[m].map(g=>[g,d[m].indexOf(g)!==-1]).sort((g,v)=>{let b=d[m].indexOf(g[0]),w=d[m].indexOf(v[0]);return b===-1&&w===-1?g-v:w===-1?-1:b===-1?1:b-w})]).sort((m,g)=>QS.indexOf(m[0])-QS.indexOf(g[0])));i(p)},[e]),$.jsx(hM,{maxWidth:"lg",children:$.jsxs(Pr,{sx:{my:4},children:[$.jsxs(Pr,{sx:{my:4},children:[$.jsx(dn,{variant:"h5",children:"1. Select your orchestration.yaml settings file."}),$.jsx(X3,{setYamlFile:t})]}),$.jsxs(Pr,{sx:{my:4},children:[$.jsx(dn,{variant:"h5",children:"2. Choose the Modules you wish to enable/disable"}),Object.keys(xo).map(f=>$.jsx(Pr,{sx:{my:4},children:$.jsx(W3,{stepType:f,setEnabledModules:i,enabledModules:n,configValues:o})},f))]}),$.jsxs(Pr,{sx:{my:4},children:[$.jsx(dn,{variant:"h5",children:"3. Configure your Enabled Modules"}),$.jsx(dn,{variant:"body1",children:"Next to each module you've enabled, you can click 'Configure' to set the module's settings."})]}),$.jsxs(Pr,{sx:{my:4},children:[$.jsx(dn,{variant:"h5",children:"4. Save your settings"}),$.jsxs(cx,{direction:"row",spacing:2,sx:{my:2},children:[$.jsx(rm,{variant:"contained",color:"primary",onClick:()=>u(!0),children:"Copy Settings to Clipboard"}),$.jsx(rm,{variant:"contained",color:"primary",onClick:()=>u(),children:"Save Settings to File"})]})]})]})})}wT.createRoot(document.getElementById("root")).render($.jsx(T.StrictMode,{children:$.jsxs(bR,{theme:bD,children:[$.jsx(vM,{}),$.jsx(Q3,{})]})})); +
- - diff --git a/scripts/settings/index.html b/scripts/settings/index.html index b0cfa48..22ff169 100644 --- a/scripts/settings/index.html +++ b/scripts/settings/index.html @@ -1,19 +1,3 @@ - - - - - - - - - - Auto Archiver Settings - - +
- - diff --git a/scripts/settings/src/App.tsx b/scripts/settings/src/App.tsx index 26d306b..bc5ee21 100644 --- a/scripts/settings/src/App.tsx +++ b/scripts/settings/src/App.tsx @@ -154,7 +154,7 @@ function ModuleTypes({ stepType, setEnabledModules, enabledModules, configValues {stepType} - Select the {stepType} you wish to enable. You can drag and move to reorder. + Select the {stepType} you wish to enable. Drag to re-order. Learn more about {stepType} here.