1 line
24 KiB
JavaScript
1 line
24 KiB
JavaScript
!function(e){var t={};function n(o){if(t[o])return t[o].exports;var i=t[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(o,i,function(t){return e[t]}.bind(null,i));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=0)}([function(e,t,n){"use strict";n.r(t);var o=function(e,t){var n=new a(e,t);return function(){return n.current()}};Object.defineProperty(o,"default",{value:o});var i=o;o.root=function(e){var t=m,n=0===e.length?y:new a(null,null),o=void 0,i=0===e.length?null:function(){null!==g?p.disposes.add(n):O(n)};return m=n,null===g?o=function(e,t,n){try{return null===t?e():e(t)}finally{m=n}}(e,i,t):(o=null===i?e():e(i),m=t),o},o.on=function(e,t,n,i){var l;return Array.isArray(e)&&(l=e,e=function(){for(var e=0;e<l.length;e++)l[e]()}),i=!!i,o(r,n);function r(n){var o=v;return e(),i?i=!1:(v=null,n=t(n),v=o),n}},o.effect=function(e,t){new a(e,t)},o.data=function(e){var t=new s(e);return function(e){return 0===arguments.length?t.current():t.next(e)}},o.value=function(e,t){var n=o.data(e),i=-1;return function(o){if(0===arguments.length)return n();if(!(t?t(e,o):e===o)){var l=p.time;if(i===l)throw new Error("conflicting values: "+o+" is not the same as "+e);i=l,e=o,n(o)}return o}},o.freeze=function(e){var t=void 0;if(null!==g)t=e();else{(g=p).changes.reset();try{t=e(),S()}finally{g=null}}return t},o.sample=function(e){var t,n=v;return null!==n?(v=null,t=e(),v=n):t=e(),t},o.cleanup=function(e){null!==m?null===m.cleanups?m.cleanups=[e]:m.cleanups.push(e):console.warn("cleanups created without a root or parent will never be run")},o.makeDataNode=function(e){return new s(e)},o.makeComputationNode=function(e,t){return new a(e,t)},o.isFrozen=function(){return null!==g},o.isListening=function(){return null!==v};var l=function(){return function(){this.time=0,this.changes=new c,this.updates=new c,this.disposes=new c}}(),r={time:function(){return p.time}},s=function(){function e(e){this.value=e,this.pending=d,this.log=null}return e.prototype.current=function(){return null!==v&&function(e,t){null===e.log&&(e.log=new u);x(e.log,t)}(this,v),this.value},e.prototype.next=function(e){if(null!==g)if(this.pending!==d){if(e!==this.pending)throw new Error("conflicting changes: "+e+" !== "+this.pending)}else this.pending=e,p.changes.add(this);else null!==this.log?(this.pending=e,p.changes.add(this),S()):this.value=e;return e},e.prototype.clock=function(){return r},e}(),a=function(){function e(e,t){if(this.state=f,this.source1=null,this.source1slot=0,this.sources=null,this.sourceslots=null,this.log=null,this.owned=null,this.cleanups=null,this.fn=e,this.value=t,this.age=p.time,null!==e){var n=m,o=v;null===n&&console.warn("computations created without a root or parent will never be disposed"),m=v=this,null===g?function(e){g=p,p.changes.reset(),p.updates.reset();try{e.value=e.fn(e.value),(p.changes.count>0||p.updates.count>0)&&(p.time++,C(p))}finally{g=m=v=null}}(this):this.value=this.fn(this.value),n&&n!==y&&(null===n.owned?n.owned=[this]:n.owned.push(this)),m=n,v=o}}return e.prototype.current=function(){if(null!==v){if(this.age===p.time){if(this.state===h)throw new Error("circular dependency");N(this)}!function(e,t){null===e.log&&(e.log=new u);x(e.log,t)}(this,v)}return this.value},e.prototype.clock=function(){return r},e}(),u=function(){return function(){this.node1=null,this.node1slot=0,this.nodes=null,this.nodeslots=null}}(),c=function(){function e(){this.items=[],this.count=0}return e.prototype.reset=function(){this.count=0},e.prototype.add=function(e){this.items[this.count++]=e},e.prototype.run=function(e){for(var t=this.items,n=0;n<this.count;n++)e(t[n]),t[n]=null;this.count=0},e}(),d={},f=0,b=1,h=2,p=new l,g=null,v=null,m=null,y=new a(null,null);function x(e,t){var n,o=null===t.source1?-1:null===t.sources?0:t.sources.length;null===e.node1?(e.node1=t,e.node1slot=o,n=-1):null===e.nodes?(e.nodes=[t],e.nodeslots=[o],n=0):(n=e.nodes.length,e.nodes.push(t),e.nodeslots.push(o)),null===t.source1?(t.source1=e,t.source1slot=n):null===t.sources?(t.sources=[e],t.sourceslots=[n]):(t.sources.push(e),t.sourceslots.push(n))}function S(){var e=m;p.updates.reset(),p.time++;try{C(p)}finally{g=v=null,m=e}}function C(e){var t=g,n=0;for(g=e,e.disposes.reset();0!==e.changes.count||0!==e.updates.count||0!==e.disposes.count;)if(n>0&&e.time++,e.changes.run(k),e.updates.run(N),e.disposes.run(O),n++>1e5)throw new Error("Runaway clock detected");g=t}function k(e){e.value=e.pending,e.pending=d,e.log&&_(e.log)}function _(e){var t=e.node1,n=e.nodes;if(null!==t&&w(t),null!==n)for(var o=0,i=n.length;o<i;o++)w(n[o])}function w(e){var t=p.time;e.age<t&&(e.age=t,e.state=b,p.updates.add(e),null!==e.owned&&function e(t){for(var n=0;n<t.length;n++){var o=t[n];o.age=p.time,o.state=f,null!==o.owned&&e(o.owned)}}(e.owned),null!==e.log&&_(e.log))}function N(e){if(e.state===b){var t=m,n=v;m=v=e,e.state=h,A(e,!1),e.value=e.fn(e.value),e.state=f,m=t,v=n}}function A(e,t){var n,o,i=e.source1,l=e.sources,r=e.sourceslots,s=e.cleanups,a=e.owned;if(null!==s){for(n=0;n<s.length;n++)s[n](t);e.cleanups=null}if(null!==a){for(n=0;n<a.length;n++)O(a[n]);e.owned=null}if(null!==i&&(j(i,e.source1slot),e.source1=null),null!==l)for(n=0,o=l.length;n<o;n++)j(l.pop(),r.pop())}function j(e,t){var n,o,i=e.nodes,l=e.nodeslots;-1===t?e.node1=null:(n=i.pop(),o=l.pop(),t!==i.length&&(i[t]=n,l[t]=o,-1===o?n.source1slot=t:n.sourceslots[o]=t))}function O(e){e.fn=null,e.log=null,A(e,!0)}const M=i,T=i.root,P=i.sample,E=i.cleanup,L="__rGroup",z="nextSibling",H="previousSibling";let B=0;function D(e,t,n,o){if(Array.isArray(t)){if(!t.length)return;let i=(t=function e(t,n){for(let o=0,i=n.length;o<i;o++){let i=n[o];i instanceof Node?11===i.nodeType?e(t,i.childNodes):t.push(i):null==i||!0===i||!1===i||(Array.isArray(i)?e(t,i):"string"==typeof i?t.push(document.createTextNode(i)):t.push(document.createTextNode(i.toString())))}return t}([],t))[0];1!==t.length&&(i[L]=t[t.length-1][L]=o);for(let o=0;o<t.length;o++)n?e.insertBefore(t[o],n):e.appendChild(t[o]);return i}let i,l=typeof t;return"string"===l||"number"===l?t=document.createTextNode(t):11===t.nodeType&&(i=t.firstChild)&&i!==t.lastChild&&(i[L]=t.lastChild[L]=o),n?e.insertBefore(t,n):e.appendChild(t),i||t}function F(e,t,n){const o=e[L];if(o)for(e=e[t];e&&e[L]!==o;)e=e[t];return n?e:e[t]}function q(e,t,n){let o;for(;t!==n;)o=t.nextSibling,e.removeChild(t),t=o}function R(e,t,n,o){return n?(Array.isArray(t)?o=t[0]:null!=t&&""!=t&&void 0===o&&(o=F(n.previousSibling,H,!0)),o&&q(e,o,n),""):e.textContent=""}function I(e,t,n,o){if(t===n)return n;e=o&&o.parentNode||e;const i=typeof t;if("string"===i||"number"===i)if("number"===i&&(t=t.toString()),o){if(""===t)R(e,n,o);else if(""!==n&&"string"==typeof n)o.previousSibling.data=t;else{const i=document.createTextNode(t);""!==n&&null!=n?e.replaceChild(i,o.previousSibling):e.insertBefore(i,o)}n=t}else n=""!==n&&"string"==typeof n?e.firstChild.data=t:e.textContent=t;else if(null==t||"boolean"===i)n=R(e,n,o);else if("function"===i)M(function(){n=I(e,t(),n,o)});else{if(!(t instanceof Node||Array.isArray(t)))throw new Error("content must be Node, stringable, or array of same");R(e,n,o),D(e,t,o,++B),n=t}return n}function J(e,t,n,o){if("function"!=typeof t)return I(e,t,n,o);M((i=n)=>I(e,t(),i,o))}const $=new Set;function G(e){return e&&(e.model||G(e.host||e.parentNode))}function X(e){const t=`__${e.type}`;let n=e.composedPath&&e.composedPath()[0]||e.target;for(e.target!==n&&Object.defineProperty(e,"target",{configurable:!0,value:n}),Object.defineProperty(e,"currentTarget",{configurable:!0,get:()=>n});null!==n;){const o=n[t];if(o){if(o(e,o.length>1?G(n):void 0),e.cancelBubble)return}n=n.host||n.parentNode}}function K(e,t,n,o,i){let l,r,s;const{afterRender:a,fallback:u}=o;i&&(l=i.previousSibling),E(function(){s&&s()}),M(o=>{const c=t();return c===o?o:P(()=>(e=i&&i.parentNode||e,s&&s(),null==c||!1===c?(R(e,r,i,l?l.nextSibling:e.firstChild),r=null,a&&a(r,i),u&&T(t=>{s=t,r=I(e,u(),r,i)}),c):(T(t=>{s=t,r=I(e,n(c),r,i)}),a&&a(r,i),c)))})}function Q(e,t,n,o){let i;for(;t!==n;)i=t.nextSibling,e.insertBefore(t,o),t=i}function U(e,t){let n;(n=e.get(t))&&n(),e.delete(t)}function V(e,t){let n=-1,o=e.length;if(o>0&&e[o-1]<=t)return o-1;for(;o-n>1;){let i=Math.floor((n+o)/2);e[i]>t?o=i:n=i}return n}function W(e,t,n,o,i){let l=new Map,r=!1,s=i?i.previousSibling:null;const{afterRender:a,fallback:u}=o;function c(t,o,i){return T(r=>{const s=D(e,n(t,o),i,++B);return l.set(s,r),s})}function d(){a&&a(s?s.nextSibling:e.firstChild,i)}E(function(){for(let e of l.keys())l.get(e)();l.clear()}),M((n=[])=>{const o=t()||[];return P(()=>{e=i&&i.parentNode||e;const t=o.length;if(r){if(void 0!==s||void 0!==i){let t=null!=s?s.nextSibling:e.firstChild;q(e,t,void 0===i?null:i)}else e.textContent="";for(let e of l.keys())l.get(e)();l.clear(),r=!1}if(0===t){if(void 0!==s||void 0!==i){let t=null!=s?s.nextSibling:e.firstChild;q(e,t,void 0===i?null:i)}else e.textContent="";for(let e of l.keys())l.get(e)();return l.clear(),d(),u&&(r=!0,T(t=>{const n=D(e,u(),i,++B);l.set(n,t)})),[]}if(0===n.length){let e=new Array(t);for(let n=0;n<t;n++)c(e[n]=o[n],n,i);return d(),e}let a,f,b=0,h=0,p=!0,g=n.length-1,v=t-1,m=s?s.nextSibling:e.firstChild,y=m,x=i?i.previousSibling:e.lastChild,S=i;e:for(;p;){let t;for(p=!1,a=n[b],f=o[h];a===f;){if(b++,h++,y=m=F(m,z),g<b||v<h)break e;a=n[b],f=o[h]}for(a=n[g],f=o[v];a===f;){if(g--,v--,x=(S=F(x,H,!0)).previousSibling,g<b||v<h)break e;a=n[g],f=o[v]}for(a=n[g],f=o[h];a===f;){p=!0;let i=(t=F(x,H)).nextSibling;if(y!==i&&(Q(e,i,x.nextSibling,y),x=t),h++,--g<b||v<h)break e;a=n[g],f=o[h]}for(a=n[b],f=o[v];a===f;){if(p=!0,t=F(m,z),m!==S){let n=t.previousSibling;Q(e,m,t,S),S=n,m=t}if(v--,g<++b||v<h)break e;a=n[b],f=o[v]}}if(v<h){if(b<=g){let t,n;for(;b<=g;)t=(n=F(x,H,!0)).previousSibling,q(e,n,x.nextSibling),U(l,n),x=t,g--}return d(),o.slice(0)}if(g<b){if(h<=v)for(;h<=v;)c(o[h],h,S),h++;return d(),o.slice(0)}const C=new Array(v+1-h);for(let e=h;e<=v;e++)C[e]=-1;const k=new Map;for(let e=h;e<=v;e++)k.set(o[e],e);let _=0,w=[];for(let e=b;e<=g;e++)k.has(n[e])?(C[k.get(n[e])]=e,_++):w.push(e);if(0===_){const t=m!==e.firstChild||x!==e.lastChild;let n,i=m;for(S=x.nextSibling;i!==S;)n=F(i,z),U(l,i),t&&q(e,i,n),i=n,b++;!t&&(e.textContent="");for(let e=h;e<=v;e++)c(o[e],e,S);return d(),o.slice(0)}const N=function(e,t){let n=[],o=[],i=-1,l=new Array(e.length);for(let r=t,s=e.length;r<s;r++){let t=e[r];if(t<0)continue;let s=V(n,t);-1!==s&&(l[r]=o[s]),s===i?(n[++i]=t,o[i]=r):t<n[s+1]&&(n[s+1]=t,o[s+1]=r)}for(let e=o[i];i>=0;e=l[e],i--)n[i]=e;return n}(C,h),A=[];let j,O=m,M=N.length-1;for(let e=b;e<=g;e++)A[e]=O,O=F(O,z);for(let t=0;t<w.length;t++){let n=A[w[t]];q(e,n,F(n,z)),U(l,n)}for(let t=v;t>=h;t--)N[M]===t?(S=A[C[N[M]]],M--):(-1===C[t]?j=c(o[t],t,S):(j=A[C[t]],Q(e,j,F(j,z),S)),S=j);return d(),o.slice(0)})})}const Y=Symbol("solid-node"),Z=Symbol("solid-proxy");function ee(e){return e[Z]||(e[Z]=new Proxy(e,ie))}function te(e){return null!==e&&"object"==typeof e&&(e.__proto__===Object.prototype||Array.isArray(e))}function ne(e){let t,n,o;if(t=null!=e&&e._state)return t;if(!te(e))return e;if(Array.isArray(e)){Object.isFrozen(e)&&(e=e.slice(0));for(let t=0,i=e.length;t<i;t++)(n=ne(o=e[t]))!==o&&(e[t]=n)}else{Object.isFrozen(e)&&(e=Object.assign({},e));let t=Object.keys(e);for(let i=0,l=t.length;i<l;i++)(n=ne(o=e[t[i]]))!==o&&(e[t[i]]=n)}return e}function oe(e){let t=e[Y];return t||(e[Y]=t={}),t}const ie={get(e,t){if("_state"===t)return e;if(t===Z||t===Y)return;const n=e[t],o=te(n);if(i.isListening()&&"function"!=typeof n){let l,r;o&&(l=oe(n))&&(r=l._self||(l._self=i.makeDataNode(void 0))).current(),(r=(l=oe(e))[t]||(l[t]=i.makeDataNode(void 0))).current()}return o?ee(n):n},set:()=>!0,deleteProperty:()=>!0};function le(e,t,n){if(n=ne(n),e[t]===n)return;const o=Array.isArray(e)||!(t in e);void 0===n?delete e[t]:e[t]=n;let i,l=oe(e);(i=l[t])&&i.next(),o&&(i=l._self)&&i.next()}function re(e,t){const n=Object.keys(t);for(let o=0;o<n.length;o+=1){const i=n[o];le(e,i,t[i])}}function se(e,t,n=[]){if(1===t.length){let o=t[0];if("function"==typeof o&&void 0===(o=o(ee(e),n)))return;return void re(e,o)}const o=t.shift(),i=typeof o,l=Array.isArray(e);if(Array.isArray(o))for(let i=0;i<o.length;i++)se(e,[o[i]].concat(t),n.concat([o[i]]));else if(l&&"function"===i)for(let i=0;i<e.length;i++)o(e[i],i)&&se(e,[i].concat(t),n.concat([i]));else if(l&&"object"===i){const{from:i=0,to:l=e.length-1,by:r=1}=o;for(let o=i;o<=l;o+=r)se(e,[o].concat(t),n.concat([o]))}else if(l&&"*"===o)for(let o=0;o<e.length;o++)se(e,[o].concat(t),n.concat([o]));else if(1===t.length){let i=t[0];if("function"==typeof i){const t=e[o];i=i(te(t)?ee(t):t,n.concat([o]))}te(e[o])&&te(i)&&!Array.isArray(i)?re(e[o],i):le(e,o,i)}else se(e[o],t,n.concat([o]))}function ae(e,t){const n=i.makeDataNode(e);let o;if(t){let i=-1;o=(o=>{if(!t(e,o)){const t=n.clock().time();if(t===i)throw new Error(`Conflicting value update: ${o} is not the same as ${e}`);i=t,e=o,n.next(o)}})}else o=n.next.bind(n);return[n.current.bind(n),o]}const{root:ue,cleanup:ce,sample:de,freeze:fe}=i,be=document.createElement("template"),he=document.createElement("template"),pe=document.createElement("template"),ge=document.createElement("template"),ve=document.createElement("template"),me=document.createElement("template"),ye=document.createElement("template");function xe(e){const[t,n]=function(e){return[ee(e=ne(e||{})),function(){const t=arguments;i.freeze(()=>{if(Array.isArray(t[0]))for(let n=0;n<t.length;n+=1)se(e,t[n]);else se(e,Array.prototype.slice.call(t))})}]}(e);var o,l,r;return localStorage.odoodockerssh&&n(JSON.parse(localStorage.odoodockerssh)),o=(()=>localStorage.odoodockerssh=JSON.stringify(t)),l?i.on(l,o,void 0,r):i.makeComputationNode(o),[t,n]}be.innerHTML="<div><h2>🛠 Configuration<span style='margin-left: 0.5em;'>\x3c!--5--\x3e\x3c!--6--\x3e</span></h2><form name='configuration-form'><div class='row'><div class='col-4'><label for='address'>Hôte / Adressse IP</label><input name='address' type='text' required/><label for='port'>Port</label><input name='port' type='text' pattern='\\d+' placeholder='Exemple : 22'/></div><div class='col-4'><label for='username'>Identifiant</label><input name='username' type='text' required/></div><div class='col-4'><label for='key'>Clé privée</label><textarea name='key' placeholder='Please paste your private key'></textarea><label for='password'>Mot de passe clé</label><input name='password' type='password' required/></div></div><button type='button' class='button outline primary'>🔗 Connecter</button><button type='button' class='button outline secondary'>🔴 Déconnecter</button></form></div>",he.innerHTML="<div><h2>📙 Bases de données</h2><p>Merci de renseigner toutes les bases de votre domaine ici. Pour effectuer une installation ou mise à jour de module, sélectionnez les bases sur lesquelles agir.</p><div class='row'><div class='col-12'><button type='button' class='button outline'>☑ Inverser la sélection</button><button type='button' class='button dark'>☑ Sélectionner tout</button><button type='button' class='button dark'>◻ Sélectionner aucun</button><ul class='database-list'></ul></div></div><div class='row'><div class='col-12'><form name='database-form'><div class='row'><div class='col-8'><input type='text' name='database' placeholder='Nom de la base de données'/></div><div class='col-4'><button type='submit' class='button outline primary'>➕ Ajouter</button></div></div></form></div></div></div>",pe.innerHTML="<li><input type='checkbox'/><span></span><button type='button' class='button outline'>X</button></li>",ge.innerHTML="<div><h2>🚩 Actions</h2><div class='row'><div class='col'><button type='button' class='button clear'>⏩ Odoo : démarrer</button></div><div class='col'><button type='button' class='button clear'>⏹ Odoo : arrêter</button></div><div class='col'><button type='button' class='button clear'>🔄 Odoo : redémarrer</button></div></div><div class='row'><div class='col'><button type='button' class='button clear'>⏩ Frontal : démarrer</button></div><div class='col'><button type='button' class='button clear'>⏹ Frontal : arrêter</button></div><div class='col'><button type='button' class='button clear'>🔄 Frontal : redémarrer</button></div></div><div class='row'><div class='col'><button type='button' class='button clear'>⏩ Moteur de base de données : démarrer</button></div><div class='col'><button type='button' class='button clear'>⏹ Moteur de base de données : arrêter</button></div><div class='col'><button type='button' class='button clear'>🔄 Moteur de base de données : redémarrer</button></div></div></div>",ve.innerHTML="<div><h2>🗄 Modules</h2><form name='modules-form'><p>Bases sélectionnées : \x3c!--73--\x3e</p><div class='row'><div class='col-6'><label for='modules'>Liste de modules, séparés par des virgules</label><input name='modules' type='text' required placeholder='account,crm'/></div><div class='col-6'><label for='stop'>❗ Arrêt serveur préalable ?</label><input type='checkbox' name='stop'/></div></div><button type='button' class='button primary outline'>Installer</button><button type='button' class='button primary'>Mettre à jour</button></form></div>",me.innerHTML="<div><h2>🖥 Retour serveur</h2><div class='row'><div class='col-11'><textarea name='serverlog' class='serverlog' rows='20' readonly></textarea></div><div class='col-1'><button type='button'>💢 Nettoyer</button></div></div></div>",ye.innerHTML="<h1>Odoo Docker SSH Admin</h1><nav class='tabs is-full'><a>🛠 Configuration</a><a>🚩 Actions</a><a>📙 Bases de données</a><a>🗄 Modules</a><a>🖥 Retour serveur</a></nav>\x3c!--98--\x3e\x3c!--99--\x3e\x3c!--100--\x3e\x3c!--101--\x3e\x3c!--102--\x3e";const Se={address:"",port:"",username:"",key:"",database:"",databases:[],modules:"",serverlog:"",connected:!1,stop:!1},[Ce,ke]=ae(!1),_e=()=>{const[e,t]=xe(Se),n=({target:e})=>t(e.name,e.value),o=n=>{if(n.preventDefault(),e.database){let n={name:e.database,checked:!1};t(["databases",[...e.databases,n]],["database",""])}},i=()=>{let n=e.databases.map(e=>Object.assign({},e));t("databases",n.map(e=>Object.assign(e,{checked:!e.checked})))},l=()=>{let n=e.databases.map(e=>Object.assign({},e));t("databases",n.map(e=>Object.assign(e,{checked:!0})))},r=()=>{let n=e.databases.map(e=>Object.assign({},e));t("databases",n.map(e=>Object.assign(e,{checked:!1})))};return function(){const s=he.content.firstChild.cloneNode(!0),a=s.firstChild.nextSibling.nextSibling,u=a.firstChild.firstChild,c=u.nextSibling,d=c.nextSibling,f=d.nextSibling,b=a.nextSibling.firstChild.firstChild.firstChild.firstChild,h=b.firstChild,p=b.nextSibling.firstChild;return u.__click=i,c.__click=l,d.__click=r,W(f,()=>e.databases,(n,o)=>(function(){const o=pe.content.firstChild.cloneNode(!0),i=o.firstChild,l=i.nextSibling,r=l.nextSibling;return i.__click=(e=>(({target:{checked:e}},n)=>{t("databases",e=>e.name===n,{name:n,checked:e})})(e,n.name)),M(()=>i.checked=n.checked),J(l,()=>n.name),r.__click=(()=>(n=>{t("databases",e.databases.filter(e=>e.name!==n))})(n.name)),o})(),{}),h.__input=n,M(()=>h.value=e.database),p.__click=o,M(()=>p.disabled=!e.database),s}()},we=()=>{const[e,t]=ae("configuration"),n=t=>e()===t?"active":"";return function(){const o=ye.content.cloneNode(!0),i=o.firstChild.nextSibling,l=i.firstChild,r=l.nextSibling,s=r.nextSibling,a=s.nextSibling,u=a.nextSibling,c=i.nextSibling,d=c.nextSibling,f=d.nextSibling,b=f.nextSibling,h=b.nextSibling;return l.__click=(()=>t("configuration")),M(()=>l.className=n("configuration")),r.__click=(()=>t("actions")),M(()=>r.className=n("actions")),s.__click=(()=>t("databases")),M(()=>s.className=n("databases")),a.__click=(()=>t("modules")),M(()=>a.className=n("modules")),u.__click=(()=>t("serverlog")),M(()=>u.className=n("serverlog")),K(o,()=>"configuration"===e(),()=>(()=>{const[e,t]=xe(Se),[n,o]=ae(""),i=({target:e})=>t(e.name,e.value);e.address&&e.username&&e.key&&e.port;const l=()=>{fetch("/connect",{method:"POST",body:JSON.stringify({address:e.address,port:e.port,username:e.username,key:e.key,password:n()}),headers:{"Content-Type":"application/json"}}).then(e=>(ke(200==e.status),e.json())).then(e=>humane.log(e))},r=()=>{fetch("/disconnect").then(e=>(ke(!(200==e.status)),e.json())).then(e=>humane.log(e))};return function(){const t=be.content.firstChild.cloneNode(!0),s=t.firstChild,a=s.firstChild.nextSibling,u=a.firstChild,c=u.nextSibling,d=s.nextSibling.firstChild,f=d.firstChild,b=f.firstChild.nextSibling,h=b.nextSibling.nextSibling,p=f.nextSibling,g=p.firstChild.nextSibling,v=p.nextSibling.firstChild.nextSibling,m=v.nextSibling.nextSibling,y=d.nextSibling,x=y.nextSibling;return K(a,()=>Ce(),()=>"🔵",{},u),K(a,()=>!Ce(),()=>"🔴",{},c),b.onchange=i,M(()=>b.value=e.address),h.onchange=i,M(()=>h.value=e.port),g.onchange=i,M(()=>g.value=e.username),v.onchange=i,M(()=>v.value=e.key),m.__input=(({target:e})=>o(e.value)),M(()=>m.value=n()),y.__click=l,x.__click=r,t}()})(),{},c),K(o,()=>"databases"===e(),()=>_e(),{},d),K(o,()=>"modules"===e(),()=>(()=>{const[e,t]=xe(Se),n=({target:e})=>t(e.name,e.value),o=n=>()=>{Ce()?(humane.log("Commande lancée, veuillez patienter."),fetch("/odooaction",{method:"POST",body:JSON.stringify({stop:e.stop,databases:e.databases.filter(e=>e.checked).map(e=>e.name),modules:e.modules,action:n}),headers:{"Content-Type":"application/json"}}).then(e=>(200!=e.status&&humane.log("Erreur : voyez le retour serveur"),e.json())).then(n=>{humane.log("Commande terminée."),t("serverlog",e.serverlog+n)})):humane.log("Non connecté : impossible de lancer une commande Odoo.")};return function(){const i=ve.content.firstChild.cloneNode(!0),l=i.firstChild.nextSibling.firstChild,r=l.firstChild.nextSibling,s=l.nextSibling,a=s.firstChild,u=a.firstChild.nextSibling,c=a.nextSibling.firstChild.nextSibling,d=s.nextSibling,f=d.nextSibling;return J(l,(e=>{let t=e.filter(e=>e.checked).map(e=>e.name);return t.length?t.join(", "):"Aucune base sélectionnée"})(e.databases),null,r),u.__input=n,M(()=>u.value=e.modules),c.onchange=(e=>t("stop",e.target.checked)),M(()=>c.checked=e.stop),d.__click=o("install"),f.__click=o("update"),i}()})(),{},f),K(o,()=>"actions"===e(),()=>(()=>{const[e,t]=xe(Se),n=n=>()=>{Ce()?(humane.log("Commande lancée, veuillez patienter."),fetch("/cmd/"+n).then(e=>e.json()).then(n=>{humane.log("Commande terminée."),t("serverlog",e.serverlog+n)})):humane.log("Non connecté : impossible de lancer une commande.")},o=n("webstart"),i=n("webstop"),l=n("webrestart"),r=n("odoostart"),s=n("odoostop"),a=n("odoorestart"),u=n("dbstart"),c=n("dbstop"),d=n("dbrestart");return function(){const e=ge.content.firstChild.cloneNode(!0),t=e.firstChild.nextSibling,n=t.firstChild,f=n.firstChild,b=n.nextSibling,h=b.firstChild,p=b.nextSibling.firstChild,g=t.nextSibling,v=g.firstChild,m=v.firstChild,y=v.nextSibling,x=y.firstChild,S=y.nextSibling.firstChild,C=g.nextSibling.firstChild,k=C.firstChild,_=C.nextSibling,w=_.firstChild,N=_.nextSibling.firstChild;return f.__click=r,h.__click=s,p.__click=a,m.__click=o,x.__click=i,S.__click=l,k.__click=u,w.__click=c,N.__click=d,e}()})(),{},b),K(o,()=>"serverlog"===e(),()=>(()=>{const[e,t]=xe(Se),n=()=>t("serverlog","");return function(){const t=me.content.firstChild.cloneNode(!0),o=t.firstChild.nextSibling.firstChild,i=o.firstChild,l=o.nextSibling.firstChild;return J(i,()=>e.serverlog),l.__click=n,t}()})(),{},h),o}()};ue(()=>document.body.appendChild(we())),function(e){for(let t=0,n=e.length;t<n;t++){const n=e[t];$.has(n)||($.add(n),document.addEventListener(n,X))}}(["input","click"])}]); |