diff --git a/easy-docs/public/build/elements/vm.wc.js b/easy-docs/public/build/elements/vm.wc.js index 7295f620..4ec6f15b 100644 --- a/easy-docs/public/build/elements/vm.wc.js +++ b/easy-docs/public/build/elements/vm.wc.js @@ -1,4 +1,4 @@ -!function(){"use strict";function t(){}function e(t){return t()}function n(){return Object.create(null)}function l(t){t.forEach(e)}function o(t){return"function"==typeof t}function i(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function s(e,n,l){e.$$.on_destroy.push(function(e,...n){if(null==e)return t;const l=e.subscribe(...n);return l.unsubscribe?()=>l.unsubscribe():l}(n,l))}function r(t,e){t.appendChild(e)}function c(t,e,n){t.insertBefore(e,n||null)}function u(t){t.parentNode.removeChild(t)}function a(t){return document.createElement(t)}function d(t){return document.createTextNode(t)}function f(){return d(" ")}function p(){return d("")}function m(t,e,n,l){return t.addEventListener(e,n,l),()=>t.removeEventListener(e,n,l)}function h(t){return function(e){return e.preventDefault(),t.call(this,e)}}function y(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function b(t){return""===t?null:+t}function v(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function g(t,e){t.value=null==e?"":e}function k(t,e,n,l){t.style.setProperty(e,n,l?"important":"")}function w(t,e){for(let n=0;nv.get(o)?(k.add(l),w(e)):(g.add(o),f--):(c(n,s),f--)}for(;f--;){const e=t[f];b.has(e.key)||c(e,s)}for(;p;)w(y[p-1]);return y}function F(t,e){-1===t.$$.dirty[0]&&(M.push(t),N||(N=!0,E.then(z)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const l=n.length?n[0]:e;return h.ctx&&a(h.ctx[t],h.ctx[t]=l)&&(!h.skip_bound&&h.bound[t]&&h.bound[t](l),y&&F(i,t)),e})):[],h.update(),y=!0,l(h.before_update),h.fragment=!!c&&c(h.ctx),s.target){if(s.hydrate){const t=function(t){return Array.from(t.childNodes)}(s.target);h.fragment&&h.fragment.l(t),t.forEach(u)}else h.fragment&&h.fragment.c();s.intro&&T(i.$$.fragment),function(t,n,i,s){const{fragment:r,on_mount:c,on_destroy:u,after_update:a}=t.$$;r&&r.m(n,i),s||A((()=>{const n=c.map(e).filter(o);u?u.push(...n):l(n),t.$$.on_mount=[]})),a.forEach(A)}(i,s.target,s.anchor,s.customElement),z()}$(m)}let U;var Y;"function"==typeof HTMLElement&&(U=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){const{on_mount:t}=this.$$;this.$$.on_disconnect=t.map(e).filter(o);for(const t in this.$$.slotted)this.appendChild(this.$$.slotted[t])}attributeChangedCallback(t,e,n){this[t]=n}disconnectedCallback(){l(this.$$.on_disconnect)}$destroy(){!function(t,e){const n=t.$$;null!==n.fragment&&(l(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}(this,1),this.$destroy=t}$on(t,e){const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}});var R=new Uint8Array(16);function B(){if(!Y&&!(Y="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Y(R)}var K=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function q(t){return"string"==typeof t&&K.test(t)}for(var J,W,G=[],Q=0;Q<256;++Q)G.push((Q+256).toString(16).substr(1));function X(t,e,n){var l=(t=t||{}).random||(t.rng||B)();if(l[6]=15&l[6]|64,l[8]=63&l[8]|128,e){n=n||0;for(var o=0;o<16;++o)e[n+o]=l[o];return e}return function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(G[t[e+0]]+G[t[e+1]]+G[t[e+2]]+G[t[e+3]]+"-"+G[t[e+4]]+G[t[e+5]]+"-"+G[t[e+6]]+G[t[e+7]]+"-"+G[t[e+8]]+G[t[e+9]]+"-"+G[t[e+10]]+G[t[e+11]]+G[t[e+12]]+G[t[e+13]]+G[t[e+14]]+G[t[e+15]]).toLowerCase();if(!q(n))throw TypeError("Stringified UUID is invalid");return n}(l)}function Z(t){const e=+t;return"number"==typeof e&&!isNaN(e)&&e>=0&&e.toFixed(0)===e.toString()}class tt{constructor(t="nw_"+X().split("-")[0],e="10.20.0.0/16"){this.name=t,this.ipRange=e}get valid(){const{name:t,ipRange:e}=this;return""!==t&&""!==e}}class et{constructor(t=X(),e="SSH_KEY",n="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDTwULSsUubOq3VPWL6cdrDvexDmjfznGydFPyaNcn7gAL9lRxwFbCDPMj7MbhNSpxxHV2+/iJPQOTVJu4oc1N7bPP3gBCnF51rPrhTpGCt5pBbTzeyNweanhedkKDsCO2mIEh/92Od5Hg512dX4j7Zw6ipRWYSaepapfyoRnNSriW/s3DH/uewezVtL5EuypMdfNngV/u2KZYWoeiwhrY/yEUykQVUwDysW/xUJNP5o+KSTAvNSJatr3FbuCFuCjBSvageOLHePTeUwu6qjqe+Xs4piF1ByO/6cOJ8bt5Vcx0bAtI8/MPApplUU/JWevsPNApvnA/ntffI+u8DCwgP"){this.id=t,this.key=e,this.value=n}get valid(){const{key:t,value:e}=this;return""!==t&&""!==e}}class nt{constructor(t=X(),e="disk_"+t.split("-")[0],n=50,l="/opt/"){this.id=t,this.name=e,this.size=n,this.mountpoint=l}get valid(){const{name:t,size:e,mountpoint:n}=this;return""!==t&&Z(e)&&""!==n}}class lt{constructor(t=X(),e="vm_"+t.split("-")[0],n="https://hub.grid.tf/tf-official-apps/base:latest.flist",l=4,o=8192,i="/sbin/zinit init",s=!0,r=1,c=25,u=new tt,a=[],d=[],f=!1){this.id=t,this.name=e,this.flist=n,this.cpu=l,this.memory=o,this.entrypoint=i,this.planetary=s,this.nodeId=r,this.rootFsSize=c,this.network=u,this.envs=a,this.disks=d,this.publicIp=f}get valid(){const{name:t,flist:e,cpu:n,memory:l,entrypoint:o,nodeId:i}=this,{rootFsSize:s,network:r,envs:c,disks:u}=this;return""!==t&&""!==e&&""!==o&&Z(n)&&Z(l)&&Z(i)&&Z(s)&&r.valid&&c.reduce(((t,e)=>t&&e.valid),!0)&&u.reduce(((t,e)=>t&&e.valid),!0)}} +!function(){"use strict";function t(){}function e(t){return t()}function n(){return Object.create(null)}function l(t){t.forEach(e)}function o(t){return"function"==typeof t}function i(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function s(e,n,l){e.$$.on_destroy.push(function(e,...n){if(null==e)return t;const l=e.subscribe(...n);return l.unsubscribe?()=>l.unsubscribe():l}(n,l))}function r(t,e){t.appendChild(e)}function c(t,e,n){t.insertBefore(e,n||null)}function a(t){t.parentNode.removeChild(t)}function u(t){return document.createElement(t)}function d(t){return document.createTextNode(t)}function p(){return d(" ")}function f(){return d("")}function m(t,e,n,l){return t.addEventListener(e,n,l),()=>t.removeEventListener(e,n,l)}function h(t){return function(e){return e.preventDefault(),t.call(this,e)}}function b(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function y(t){return""===t?null:+t}function g(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function v(t,e){t.value=null==e?"":e}function w(t,e,n,l){t.style.setProperty(e,n,l?"important":"")}function k(t,e){for(let n=0;ng.get(o)?(w.add(l),k(e)):(v.add(o),p--):(c(n,s),p--)}for(;p--;){const e=t[p];y.has(e.key)||c(e,s)}for(;f;)k(b[f-1]);return b}function U(t,e){-1===t.$$.dirty[0]&&(M.push(t),E||(E=!0,P.then(D)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const l=n.length?n[0]:e;return h.ctx&&u(h.ctx[t],h.ctx[t]=l)&&(!h.skip_bound&&h.bound[t]&&h.bound[t](l),b&&U(i,t)),e})):[],h.update(),b=!0,l(h.before_update),h.fragment=!!c&&c(h.ctx),s.target){if(s.hydrate){const t=function(t){return Array.from(t.childNodes)}(s.target);h.fragment&&h.fragment.l(t),t.forEach(a)}else h.fragment&&h.fragment.c();s.intro&&O(i.$$.fragment),function(t,n,i,s){const{fragment:r,on_mount:c,on_destroy:a,after_update:u}=t.$$;r&&r.m(n,i),s||A((()=>{const n=c.map(e).filter(o);a?a.push(...n):l(n),t.$$.on_mount=[]})),u.forEach(A)}(i,s.target,s.anchor,s.customElement),D()}$(m)}let R;var H;"function"==typeof HTMLElement&&(R=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){const{on_mount:t}=this.$$;this.$$.on_disconnect=t.map(e).filter(o);for(const t in this.$$.slotted)this.appendChild(this.$$.slotted[t])}attributeChangedCallback(t,e,n){this[t]=n}disconnectedCallback(){l(this.$$.on_disconnect)}$destroy(){!function(t,e){const n=t.$$;null!==n.fragment&&(l(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}(this,1),this.$destroy=t}$on(t,e){const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}});var Y=new Uint8Array(16);function B(){if(!H&&!(H="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return H(Y)}var q=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function K(t){return"string"==typeof t&&q.test(t)}for(var G,J,W=[],X=0;X<256;++X)W.push((X+256).toString(16).substr(1));function Q(t,e,n){var l=(t=t||{}).random||(t.rng||B)();if(l[6]=15&l[6]|64,l[8]=63&l[8]|128,e){n=n||0;for(var o=0;o<16;++o)e[n+o]=l[o];return e}return function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(W[t[e+0]]+W[t[e+1]]+W[t[e+2]]+W[t[e+3]]+"-"+W[t[e+4]]+W[t[e+5]]+"-"+W[t[e+6]]+W[t[e+7]]+"-"+W[t[e+8]]+W[t[e+9]]+"-"+W[t[e+10]]+W[t[e+11]]+W[t[e+12]]+W[t[e+13]]+W[t[e+14]]+W[t[e+15]]).toLowerCase();if(!K(n))throw TypeError("Stringified UUID is invalid");return n}(l)}function Z(t){const e=+t;return"number"==typeof e&&!isNaN(e)&&e>=0&&e.toFixed(0)===e.toString()}class tt{constructor(t="nw_"+Q().split("-")[0],e="10.20.0.0/16"){this.name=t,this.ipRange=e}get valid(){const{name:t,ipRange:e}=this;return""!==t&&""!==e}}class et{constructor(t=Q(),e="SSH_KEY",n="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDTwULSsUubOq3VPWL6cdrDvexDmjfznGydFPyaNcn7gAL9lRxwFbCDPMj7MbhNSpxxHV2+/iJPQOTVJu4oc1N7bPP3gBCnF51rPrhTpGCt5pBbTzeyNweanhedkKDsCO2mIEh/92Od5Hg512dX4j7Zw6ipRWYSaepapfyoRnNSriW/s3DH/uewezVtL5EuypMdfNngV/u2KZYWoeiwhrY/yEUykQVUwDysW/xUJNP5o+KSTAvNSJatr3FbuCFuCjBSvageOLHePTeUwu6qjqe+Xs4piF1ByO/6cOJ8bt5Vcx0bAtI8/MPApplUU/JWevsPNApvnA/ntffI+u8DCwgP"){this.id=t,this.key=e,this.value=n}get valid(){const{key:t,value:e}=this;return""!==t&&""!==e}}class nt{constructor(t=Q(),e="disk_"+t.split("-")[0],n=50,l="/opt/"){this.id=t,this.name=e,this.size=n,this.mountpoint=l}get valid(){const{name:t,size:e,mountpoint:n}=this;return""!==t&&Z(e)&&""!==n}}class lt{constructor(t=Q(),e="vm_"+t.split("-")[0],n="https://hub.grid.tf/tf-official-apps/base:latest.flist",l=4,o=8192,i="/sbin/zinit init",s=!0,r=1,c=25,a=new tt,u=[],d=[],p=!1){this.id=t,this.name=e,this.flist=n,this.cpu=l,this.memory=o,this.entrypoint=i,this.planetary=s,this.nodeId=r,this.rootFsSize=c,this.network=a,this.envs=u,this.disks=d,this.publicIp=p}get valid(){const{name:t,flist:e,cpu:n,memory:l,entrypoint:o,nodeId:i}=this,{rootFsSize:s,network:r,envs:c,disks:a}=this;return""!==t&&""!==e&&""!==o&&Z(n)&&Z(l)&&Z(i)&&Z(s)&&r.valid&&c.reduce(((t,e)=>t&&e.valid),!0)&&a.reduce(((t,e)=>t&&e.valid),!0)}} /*! ***************************************************************************** Copyright (c) Microsoft Corporation. @@ -12,4 +12,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */const{NetworkModel:ot}=null!==(W=null===(J=window.configs)||void 0===J?void 0:J.grid3_client)&&void 0!==W?W:{};var it,st,rt,ct;const{HTTPMessageBusClient:ut}=null!==(st=null===(it=window.configs)||void 0===it?void 0:it.client)&&void 0!==st?st:{},{DiskModel:at,MachineModel:dt,MachinesModel:ft,GridClient:pt}=null!==(ct=null===(rt=window.configs)||void 0===rt?void 0:rt.grid3_client)&&void 0!==ct?ct:{};async function mt(t,e){const{envs:n,disks:l}=t,o=function(t,e){var n={};for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&e.indexOf(l)<0&&(n[l]=t[l]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(l=Object.getOwnPropertySymbols(t);o(t[e.key]=e.value,t)),{})}(n);const w=new ft;return w.name=i,w.network=function(t){const e=new ot;return e.name=t.name,e.ip_range=t.ipRange,e}(a),w.machines=[k],g.connect().then((()=>g.machines.deploy(w)))}function ht({name:t,size:e,mountpoint:n}){const l=new at;return l.name=t,l.size=e,l.mountpoint=n,l}function yt(t,e,n){const l=t.slice();return l[41]=e[n],l[42]=e,l[43]=n,l}function bt(t,e,n){const l=t.slice();return l[44]=e[n],l[45]=e,l[46]=n,l}function vt(t,e,n){const l=t.slice();return l[47]=e[n],l[48]=e,l[43]=n,l}function gt(t,e,n){const l=t.slice();return l[44]=e[n],l[49]=e,l[50]=n,l}function kt(t,e,n){const l=t.slice();return l[44]=e[n],l[51]=e,l[52]=n,l}function wt(t,e,n){const l=t.slice();return l[44]=e[n],l[53]=e,l[54]=n,l}function _t(t,e,n){const l=t.slice();return l[55]=e[n],l[57]=n,l}function xt(t,e,n){const l=t.slice();return l[58]=e[n],l}function $t(t,e,n){const l=t.slice();return l[8]=e[n],l[57]=n,l}function Mt(t){let e,n,l,o,i,s,d,h,b,v,g,w=[],_=new Map,x=[],$=new Map,M=t[7];const C=t=>t[57];for(let e=0;et[58].label;for(let e=0;e\n "),i.c(),y(e,"class","notification is-danger")},m(t,l){c(t,e,l),r(e,n),i.m(e,null)},p(t,n){o===(o=l(t))&&i?i.p(t,n):(i.d(1),i=o(t),i&&(i.c(),i.m(e,null)))},d(t){t&&u(e),i.d()}}}function Pt(e){let n;return{c(){n=a("div"),n.textContent="> Successfully deployed VM.",y(n,"class","notification is-success")},m(t,e){c(t,n,e)},p:t,d(t){t&&u(n)}}}function St(t){let e;function n(t,e){return t[5]?Gt:Wt}let l=n(t),o=l(t);return{c(){e=a("div"),o.c(),y(e,"class","notification is-info")},m(t,n){c(t,e,n),o.m(e,null)},p(t,i){l===(l=n(t))&&o?o.p(t,i):(o.d(1),o=l(t),o&&(o.c(),o.m(e,null)))},d(t){t&&u(e),o.d()}}}function Et(t){let e,n,l,o=t[57]+1+"";return{c(){e=d("Profile "),n=d(o),l=f()},m(t,o){c(t,e,o),c(t,n,o),c(t,l,o)},p(t,e){128&e[0]&&o!==(o=t[57]+1+"")&&v(n,o)},d(t){t&&u(e),t&&u(n),t&&u(l)}}}function Nt(t){let e,n,l=t[8].name+"";return{c(){e=d(l),n=f()},m(t,l){c(t,e,l),c(t,n,l)},p(t,n){128&n[0]&&l!==(l=t[8].name+"")&&v(e,l)},d(t){t&&u(e),t&&u(n)}}}function At(t,e){let n,l;function o(t,e){return t[8].name?Nt:Et}let i=o(e),s=i(e);return{key:t,first:null,c(){n=a("option"),s.c(),n.__value=l=e[57],n.value=n.__value,this.first=n},m(t,e){c(t,n,e),s.m(n,null)},p(t,r){i===(i=o(e=t))&&s?s.p(e,r):(s.d(1),s=i(e),s&&(s.c(),s.m(n,null))),128&r[0]&&l!==(l=e[57])&&(n.__value=l,n.value=n.__value)},d(t){t&&u(n),s.d()}}}function Dt(t,e){let n,l,o,i,s,p,b,v,g=e[58].label+"";function k(){return e[21](e[58])}return{key:t,first:null,c(){n=a("li"),l=a("a"),o=a("span"),i=d(g),s=f(),y(l,"href","#!"),y(n,"class",p=e[0]===e[58].label?"is-active":""),this.first=n},m(t,e){c(t,n,e),r(n,l),r(l,o),r(o,i),r(n,s),b||(v=m(l,"click",h(k)),b=!0)},p(t,l){e=t,1&l[0]&&p!==(p=e[0]===e[58].label?"is-active":"")&&y(n,"class",p)},d(t){t&&u(n),b=!1,v()}}}function Vt(t){let e,n,o,i,s,d,h,b,v,_,x,$,M,C,P,S,E,N=[],D=new Map,V=[],z=new Map,O=t[16];const L=t=>t[55].url;for(let e=0;et[44].symbol;for(let e=0;et[23].call(_))),y(v,"class","select mb-2"),k(v,"width","100%")},m(l,u){c(l,e,u),r(e,n),r(e,o),r(e,i),r(i,s),g(s,t[4].name),c(l,d,u),c(l,h,u),c(l,b,u),c(l,v,u),r(v,_),r(_,x);for(let t=0;tt[44].symbol;for(let e=0;et[47].id;for(let e=0;e+",l=f(),o=a("div");for(let t=0;tt[44].symbol;for(let t=0;t-",h=f();for(let t=0;t<_.length;t+=1)_[t].c();b=f(),y(o,"class","is-size-5 has-text-weight-bold"),y(p,"type","button"),y(p,"class","button is-danger"),y(l,"class","vm-header"),y(n,"class","box"),this.first=n},m(t,e){c(t,n,e),r(n,l),r(l,o),r(o,i),r(l,s),r(l,p),r(n,h);for(let t=0;t<_.length;t+=1)_[t].m(n,null);r(n,b),g||(k=m(p,"click",$),g=!0)},p(t,l){e=t,16&l[0]&&w!==(w=e[47].key+"")&&v(i,w),8208&l[0]&&(M=e[13],_=I(_,l,C,1,e,M,x,n,j,Ut,b,gt))},d(t){t&&u(n);for(let t=0;t<_.length;t+=1)_[t].d();g=!1,k()}}}function Rt(t){let e,n,l,o,i,s,d=[],p=new Map,h=t[4].disks;const b=t=>t[41].id;for(let e=0;e+",l=f(),o=a("div");for(let t=0;tt[44].symbol;for(let t=0;t-",h=f();for(let t=0;t<_.length;t+=1)_[t].c();b=f(),y(o,"class","is-size-5 has-text-weight-bold"),y(p,"type","button"),y(p,"class","button is-danger"),y(l,"class","vm-header"),y(n,"class","box"),this.first=n},m(t,e){c(t,n,e),r(n,l),r(l,o),r(o,i),r(l,s),r(l,p),r(n,h);for(let t=0;t<_.length;t+=1)_[t].m(n,null);r(n,b),g||(k=m(p,"click",$),g=!0)},p(t,l){e=t,16&l[0]&&w!==(w=e[41].name+"")&&v(i,w),16400&l[0]&&(M=e[14],_=I(_,l,C,1,e,M,x,n,j,Bt,b,bt))},d(t){t&&u(n);for(let t=0;t<_.length;t+=1)_[t].d();g=!1,k()}}}function qt(e){let n;return{c(){n=d("Failed to deploy VM.")},m(t,e){c(t,n,e)},p:t,d(t){t&&u(n)}}}function Jt(t){let e;return{c(){e=d(t[5])},m(t,n){c(t,e,n)},p(t,n){32&n[0]&&v(e,t[5])},d(t){t&&u(e)}}}function Wt(e){let n;return{c(){n=d("> Loading...")},m(t,e){c(t,n,e)},p:t,d(t){t&&u(n)}}}function Gt(t){let e,n,l;return{c(){e=d("> "),n=d(t[5]),l=d(".")},m(t,o){c(t,e,o),c(t,n,o),c(t,l,o)},p(t,e){32&e[0]&&v(n,t[5])},d(t){t&&u(e),t&&u(n),t&&u(l)}}}function Qt(t){let e;return{c(){e=d("Deploy")},m(t,n){c(t,e,n)},d(t){t&&u(e)}}}function Xt(t){let e;return{c(){e=d("Back")},m(t,n){c(t,e,n)},d(t){t&&u(e)}}}function Zt(e){let n,o,i,s,d,p,b,v,g,w,_,x,$;function M(t,e){return t[1]?St:t[2]?Pt:t[3]?Ct:Mt}let C=M(e),P=C(e);function S(t,e){return t[2]||t[3]?Xt:Qt}let E=S(e),N=E(e);return{c(){n=a("div"),o=a("form"),i=a("h4"),i.textContent="Deploy a Virtual Machine",s=f(),d=a("hr"),p=f(),P.c(),b=f(),v=a("div"),g=a("button"),N.c(),this.c=t,y(i,"class","is-size-4"),y(g,"class",w="button is-primary "+(e[1]?"is-loading":"")),y(g,"type","submit"),g.disabled=_=(e[1]||!e[4].valid)&&!(e[2]||e[3])||!e[8]||""===e[8].mnemonics||""===e[8].storeSecret,y(v,"class","actions"),y(o,"class","box"),k(n,"padding","15px")},m(t,l){c(t,n,l),r(n,o),r(o,i),r(o,s),r(o,d),r(o,p),P.m(o,null),r(o,b),r(o,v),r(v,g),N.m(g,null),x||($=[m(g,"click",e[34]),m(o,"submit",h(e[15]))],x=!0)},p(t,e){C===(C=M(t))&&P?P.p(t,e):(P.d(1),P=C(t),P&&(P.c(),P.m(o,b))),E!==(E=S(t))&&(N.d(1),N=E(t),N&&(N.c(),N.m(g,null))),2&e[0]&&w!==(w="button is-primary "+(t[1]?"is-loading":""))&&y(g,"class",w),286&e[0]&&_!==(_=(t[1]||!t[4].valid)&&!(t[2]||t[3])||!t[8]||""===t[8].mnemonics||""===t[8].storeSecret)&&(g.disabled=_)},i:t,o:t,d(t){t&&u(n),P.d(),N.d(),x=!1,l($)}}}function te(t,e,n){let l,o,i;var r,c,u,a;const{events:d}=null!==(c=null===(r=window.configs)||void 0===r?void 0:r.grid3_client)&&void 0!==c?c:{},f=null===(u=window.configs)||void 0===u?void 0:u.baseConfig;s(t,f,(t=>n(20,i=t)));const p=null===(a=window.configs)||void 0===a?void 0:a.deploymentStore;let m="Config",h=!1,y=!1,v=!1,g=0;const k=new lt;requestAnimationFrame((()=>{n(4,k.envs=[new et(void 0,"SSH_KEY",null==o?void 0:o.sshKey)],k)}));const w=[{label:"CPU",symbol:"cpu",placeholder:"Your CPU",type:"number"},{label:"Memory",symbol:"memory",placeholder:"Your Memory in MB",type:"number"},{label:"Public IP",symbol:"publicIp",placeholder:"",type:"checkbox"},{label:"Planetary Network",symbol:"planetary",placeholder:"",type:"checkbox"},{label:"Node ID",symbol:"nodeId",placeholder:"Your Node ID",type:"number",link:{label:"Grid Explorer",url:"https://library.threefold.me/info/threefold#/manual_tfgrid3/threefold__grid3_explorer"}}],_=[{label:"FList",symbol:"flist",placeholder:"Your flist"},{label:"Entry Point",symbol:"entrypoint",placeholder:"Your Entrypoint"}],x=[{label:"Key",symbol:"key",placeholder:"Your Env Key"},{label:"Value",symbol:"value",placeholder:"Your Env Value"}],$=[{label:"Name",symbol:"name",placeholder:"Your Disk Name"},{label:"Size",symbol:"size",placeholder:"Disk size in GB",type:"number"},{label:"Mount Point",symbol:"mountpoint",placeholder:"Your Disk Mount Point"}];let M;const C=[{name:"Alpine",url:"https://hub.grid.tf/tf-official-apps/base:latest.flist",entryPoint:"/sbin/zinit init"},{name:"Ubuntu",url:"https://hub.grid.tf/omar0.3bot/omarelawady-ubuntu-20.04.flist",entryPoint:"/init.sh"}];let P;return t.$$.update=()=>{1048576&t.$$.dirty[0]&&n(7,l=i),1572864&t.$$.dirty[0]&&n(8,o=i[g])},[m,h,y,v,k,M,P,l,o,f,[{label:"Config"},{label:"Environment Variables"},{label:"Disks"}],w,_,x,$,function(){function t(t){"string"==typeof t&&n(5,M=t)}n(1,h=!0),n(2,y=!1),n(3,v=!1),n(5,M=void 0),d.addListener("logs",t),mt(k,o).then((()=>{p.set(0),n(2,y=!0)})).catch((t=>{n(3,v=!0),n(5,M="string"==typeof t?t:t.message)})).finally((()=>{n(1,h=!1),d.removeListener("logs",t)}))},C,function(){P&&+P<=C.length&&(n(4,k.flist=C[P].url,k),n(4,k.entrypoint=C[P].entryPoint,k))},t=>n(19,g=t.target.selectedIndex),g,i,t=>n(0,m=t.label),function(){k.name=this.value,n(4,k)},function(){P=function(t){const e=t.querySelector(":checked")||t.options[0];return e&&e.__value}(this),n(6,P),n(16,C)},function(t){k[t.symbol]=this.value,n(4,k),n(12,_)},function(t){k[t.symbol]=b(this.value),n(4,k),n(11,w)},t=>n(4,k[t.symbol]=!k[t.symbol],k),function(t){k[t.symbol]=this.value,n(4,k),n(11,w)},()=>n(4,k.envs=[...k.envs,new et],k),t=>n(4,k.envs=k.envs.filter(((e,n)=>t!==n)),k),function(t,e,l){e[l][t.symbol]=this.value,n(4,k),n(13,x)},()=>n(4,k.disks=[...k.disks,new nt],k),t=>n(4,k.disks=k.disks.filter(((e,n)=>t!==n)),k),function(t,e,l){e[l][t.symbol]=this.value,n(4,k),n(14,$)},t=>{(y||v)&&(t.preventDefault(),n(2,y=!1),n(3,v=!1),n(1,h=!1))}]}!function(t,e){try{customElements.define(`tf-${t}`,e)}catch(e){console.warn(`Element with name '${t}' already defined.`)}}("vm",class extends U{constructor(t){super(),this.shadowRoot.innerHTML='',H(this,{target:this.shadowRoot,props:_(this.attributes),customElement:!0},te,Zt,i,{},null,[-1,-1]),t&&t.target&&c(t.target,this,t.anchor)}})}(); + ***************************************************************************** */const{NetworkModel:ot}=null!==(J=null===(G=window.configs)||void 0===G?void 0:G.grid3_client)&&void 0!==J?J:{};var it,st,rt,ct;const{HTTPMessageBusClient:at}=null!==(st=null===(it=window.configs)||void 0===it?void 0:it.client)&&void 0!==st?st:{},{DiskModel:ut,MachineModel:dt,MachinesModel:pt,GridClient:ft}=null!==(ct=null===(rt=window.configs)||void 0===rt?void 0:rt.grid3_client)&&void 0!==ct?ct:{};async function mt(t,e){const{envs:n,disks:l}=t,o=function(t,e){var n={};for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&e.indexOf(l)<0&&(n[l]=t[l]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(l=Object.getOwnPropertySymbols(t);o(t[e.key]=e.value,t)),{})}(n);const k=new pt;return k.name=i,k.network=function(t){const e=new ot;return e.name=t.name,e.ip_range=t.ipRange,e}(u),k.machines=[w],v.connect().then((()=>v.machines.deploy(k)))}function ht({name:t,size:e,mountpoint:n}){const l=new ut;return l.name=t,l.size=e,l.mountpoint=n,l}var bt,yt;const{GridClient:gt,Nodes:vt}=null!==(yt=null===(bt=window.configs)||void 0===bt?void 0:bt.grid3_client)&&void 0!==yt?yt:{};function wt(t,e,n){const l=t.slice();return l[47]=e[n],l[48]=e,l[49]=n,l}function kt(t,e,n){const l=t.slice();return l[50]=e[n],l[51]=e,l[52]=n,l}function xt(t,e,n){const l=t.slice();return l[53]=e[n],l[54]=e,l[49]=n,l}function _t(t,e,n){const l=t.slice();return l[50]=e[n],l[55]=e,l[56]=n,l}function $t(t,e,n){const l=t.slice();return l[50]=e[n],l[57]=e,l[58]=n,l}function Mt(t,e,n){const l=t.slice();return l[50]=e[n],l[59]=e,l[60]=n,l}function Ct(t,e,n){const l=t.slice();return l[50]=e[n],l[61]=e,l[62]=n,l}function Nt(t,e,n){const l=t.slice();return l[63]=e[n],l[65]=n,l}function St(t,e,n){const l=t.slice();return l[66]=e[n],l}function Pt(t,e,n){const l=t.slice();return l[9]=e[n],l[65]=n,l}function Et(t){let e,n,l,o,i,s,d,h,y,g,v,k=[],x=new Map,_=[],$=new Map,M=t[8];const C=t=>t[65];for(let e=0;et[66].label;for(let e=0;e\n "),i.c(),b(e,"class","notification is-danger")},m(t,l){c(t,e,l),r(e,n),i.m(e,null)},p(t,n){o===(o=l(t))&&i?i.p(t,n):(i.d(1),i=o(t),i&&(i.c(),i.m(e,null)))},d(t){t&&a(e),i.d()}}}function Vt(e){let n;return{c(){n=u("div"),n.textContent="> Successfully deployed VM.",b(n,"class","notification is-success")},m(t,e){c(t,n,e)},p:t,d(t){t&&a(n)}}}function Ft(t){let e;function n(t,e){return t[5]?ne:ee}let l=n(t),o=l(t);return{c(){e=u("div"),o.c(),b(e,"class","notification is-info")},m(t,n){c(t,e,n),o.m(e,null)},p(t,i){l===(l=n(t))&&o?o.p(t,i):(o.d(1),o=l(t),o&&(o.c(),o.m(e,null)))},d(t){t&&a(e),o.d()}}}function Dt(t){let e,n,l,o=t[65]+1+"";return{c(){e=d("Profile "),n=d(o),l=p()},m(t,o){c(t,e,o),c(t,n,o),c(t,l,o)},p(t,e){256&e[0]&&o!==(o=t[65]+1+"")&&g(n,o)},d(t){t&&a(e),t&&a(n),t&&a(l)}}}function zt(t){let e,n,l=t[9].name+"";return{c(){e=d(l),n=p()},m(t,l){c(t,e,l),c(t,n,l)},p(t,n){256&n[0]&&l!==(l=t[9].name+"")&&g(e,l)},d(t){t&&a(e),t&&a(n)}}}function It(t,e){let n,l;function o(t,e){return t[9].name?zt:Dt}let i=o(e),s=i(e);return{key:t,first:null,c(){n=u("option"),s.c(),n.__value=l=e[65],n.value=n.__value,this.first=n},m(t,e){c(t,n,e),s.m(n,null)},p(t,r){i===(i=o(e=t))&&s?s.p(e,r):(s.d(1),s=i(e),s&&(s.c(),s.m(n,null))),256&r[0]&&l!==(l=e[65])&&(n.__value=l,n.value=n.__value)},d(t){t&&a(n),s.d()}}}function Ot(t,e){let n,l,o,i,s,f,y,g,v=e[66].label+"";function w(){return e[23](e[66])}return{key:t,first:null,c(){n=u("li"),l=u("a"),o=u("span"),i=d(v),s=p(),b(l,"href","#!"),b(n,"class",f=e[0]===e[66].label?"is-active":""),this.first=n},m(t,e){c(t,n,e),r(n,l),r(l,o),r(o,i),r(n,s),y||(g=m(l,"click",h(w)),y=!0)},p(t,l){e=t,1&l[0]&&f!==(f=e[0]===e[66].label?"is-active":"")&&b(n,"class",f)},d(t){t&&a(n),y=!1,g()}}}function Lt(t){let e,n,o,i,s,d,f,h,y,g,x,_,$,M,C,N,S,P,E,V,F=[],D=new Map,z=[],I=new Map,O=[],U=new Map,j=t[17];const R=t=>t[63].url;for(let e=0;et[50].symbol;for(let e=0;et[50].symbol;for(let e=0;et[25].call(g))),b(y,"class","select mb-2"),w(y,"width","100%"),w(N,"width","50%"),b(P,"class","button is-primary mt-4"),b(P,"type","button")},m(l,a){c(l,e,a),r(e,n),r(e,o),r(e,i),r(i,s),v(s,t[4].name),c(l,d,a),c(l,f,a),c(l,h,a),c(l,y,a),r(y,g),r(g,x);for(let t=0;tt[50].symbol;for(let e=0;et[53].id;for(let e=0;e+",l=p(),o=u("div");for(let t=0;tt[50].symbol;for(let t=0;t-",h=p();for(let t=0;tt[47].id;for(let e=0;e+",l=p(),o=u("div");for(let t=0;tt[50].symbol;for(let t=0;t-",h=p();for(let t=0;t Loading...")},m(t,e){c(t,n,e)},p:t,d(t){t&&a(n)}}}function ne(t){let e,n,l;return{c(){e=d("> "),n=d(t[5]),l=d(".")},m(t,o){c(t,e,o),c(t,n,o),c(t,l,o)},p(t,e){32&e[0]&&g(n,t[5])},d(t){t&&a(e),t&&a(n),t&&a(l)}}}function le(t){let e;return{c(){e=d("Deploy")},m(t,n){c(t,e,n)},d(t){t&&a(e)}}}function oe(t){let e;return{c(){e=d("Back")},m(t,n){c(t,e,n)},d(t){t&&a(e)}}}function ie(e){let n,o,i,s,d,f,y,g,v,k,x,_,$;function M(t,e){return t[1]?Ft:t[2]?Vt:t[3]?At:Et}let C=M(e),N=C(e);function S(t,e){return t[2]||t[3]?oe:le}let P=S(e),E=P(e);return{c(){n=u("div"),o=u("form"),i=u("h4"),i.textContent="Deploy a Virtual Machine",s=p(),d=u("hr"),f=p(),N.c(),y=p(),g=u("div"),v=u("button"),E.c(),this.c=t,b(i,"class","is-size-4"),b(v,"class",k="button is-primary "+(e[1]?"is-loading":"")),b(v,"type","submit"),v.disabled=x=(e[1]||!e[4].valid)&&!(e[2]||e[3])||!e[9]||""===e[9].mnemonics||""===e[9].storeSecret,b(g,"class","actions"),b(o,"class","box"),w(n,"padding","15px")},m(t,l){c(t,n,l),r(n,o),r(o,i),r(o,s),r(o,d),r(o,f),N.m(o,null),r(o,y),r(o,g),r(g,v),E.m(v,null),_||($=[m(v,"click",e[40]),m(o,"submit",h(e[16]))],_=!0)},p(t,e){C===(C=M(t))&&N?N.p(t,e):(N.d(1),N=C(t),N&&(N.c(),N.m(o,y))),P!==(P=S(t))&&(E.d(1),E=P(t),E&&(E.c(),E.m(v,null))),2&e[0]&&k!==(k="button is-primary "+(t[1]?"is-loading":""))&&b(v,"class",k),542&e[0]&&x!==(x=(t[1]||!t[4].valid)&&!(t[2]||t[3])||!t[9]||""===t[9].mnemonics||""===t[9].storeSecret)&&(v.disabled=x)},i:t,o:t,d(t){t&&a(n),N.d(),E.d(),_=!1,l($)}}}function se(t,e,n){let l,o,i;var r,c,a,u;const{events:d}=null!==(c=null===(r=window.configs)||void 0===r?void 0:r.grid3_client)&&void 0!==c?c:{},p=null===(a=window.configs)||void 0===a?void 0:a.baseConfig;s(t,p,(t=>n(22,i=t)));const f=null===(u=window.configs)||void 0===u?void 0:u.deploymentStore;let m="Config",h=!1,b=!1,g=!1,v=0;const w=new lt;requestAnimationFrame((()=>{n(4,w.envs=[new et(void 0,"SSH_KEY",null==o?void 0:o.sshKey)],w)}));const k=[{label:"CPU",symbol:"cpu",placeholder:"Your CPU",type:"number"},{label:"Memory",symbol:"memory",placeholder:"Your Memory in MB",type:"number"},{label:"Public IP",symbol:"publicIp",placeholder:"",type:"checkbox"},{label:"Planetary Network",symbol:"planetary",placeholder:"",type:"checkbox"},{label:"Node ID",symbol:"nodeId",placeholder:"Your Node ID",type:"number",link:{label:"Grid Explorer",url:"https://library.threefold.me/info/threefold#/manual_tfgrid3/threefold__grid3_explorer"}}],x=[{label:"FList",symbol:"flist",placeholder:"Your flist"},{label:"Entry Point",symbol:"entrypoint",placeholder:"Your Entrypoint"}],_=[{label:"Key",symbol:"key",placeholder:"Your Env Key"},{label:"Value",symbol:"value",placeholder:"Your Env Value"}],$=[{label:"Name",symbol:"name",placeholder:"Your Disk Name"},{label:"Size",symbol:"size",placeholder:"Disk size in GB",type:"number"},{label:"Mount Point",symbol:"mountpoint",placeholder:"Your Disk Mount Point"}];let M;const C=[{name:"Alpine",url:"https://hub.grid.tf/tf-official-apps/base:latest.flist",entryPoint:"/sbin/zinit init"},{name:"Ubuntu",url:"https://hub.grid.tf/omar0.3bot/omarelawady-ubuntu-20.04.flist",entryPoint:"/init.sh"}];let N;const S={accessNodeV4:!1,accessNodeV6:!0,gateway:!1,city:"",country:"",farmId:null,cru:null,hru:null,mru:null,sru:null},P=[{label:"Access Node V4 Filter",symbol:"accessNodeV4",type:"checkbox"},{label:"Access Node V6 Filter",symbol:"accessNodeV6",type:"checkbox"},{label:"Gateway Filter",symbol:"gateway",type:"checkbox"},{label:"City Filter",symbol:"city",type:"text"},{label:"Country Filter",symbol:"country",type:"text"},{label:"Farm ID Filter",symbol:"farmId",type:"number"},{label:"CRU Filter",symbol:"cru",type:"number"},{label:"HRU Filter",symbol:"hru",type:"number"},{label:"MRU Filter",symbol:"mru",type:"number"},{label:"SRU Filter",symbol:"sru",type:"number"}];return t.$$.update=()=>{4194304&t.$$.dirty[0]&&n(8,l=i),6291456&t.$$.dirty[0]&&n(9,o=i[v])},[m,h,b,g,w,M,N,S,l,o,p,[{label:"Config"},{label:"Environment Variables"},{label:"Disks"}],k,x,_,$,function(){function t(t){"string"==typeof t&&n(5,M=t)}n(1,h=!0),n(2,b=!1),n(3,g=!1),n(5,M=void 0),d.addListener("logs",t),mt(w,o).then((()=>{f.set(0),n(2,b=!0)})).catch((t=>{n(3,g=!0),n(5,M="string"==typeof t?t:t.message)})).finally((()=>{n(1,h=!1),d.removeListener("logs",t)}))},C,function(){N&&+N<=C.length&&(n(4,w.flist=C[N].url,w),n(4,w.entrypoint=C[N].entryPoint,w))},t=>n(21,v=t.target.selectedIndex),P,v,i,t=>n(0,m=t.label),function(){w.name=this.value,n(4,w)},function(){N=function(t){const e=t.querySelector(":checked")||t.options[0];return e&&e.__value}(this),n(6,N),n(17,C)},function(t){w[t.symbol]=this.value,n(4,w),n(13,x)},function(t){w[t.symbol]=y(this.value),n(4,w),n(12,k)},t=>n(4,w[t.symbol]=!w[t.symbol],w),function(t){w[t.symbol]=this.value,n(4,w),n(12,k)},function(t){S[t.symbol]=this.checked,n(7,S),n(20,P)},function(t){S[t.symbol]=this.value,n(7,S),n(20,P)},function(t){S[t.symbol]=y(this.value),n(7,S),n(20,P)},()=>{var t;(t=S,new vt("https://graphql.dev.grid.tf/graphql","https://gridproxy.dev.grid.tf").filterNodes(t)).then((t=>{console.log(t)}))},()=>n(4,w.envs=[...w.envs,new et],w),t=>n(4,w.envs=w.envs.filter(((e,n)=>t!==n)),w),function(t,e,l){e[l][t.symbol]=this.value,n(4,w),n(14,_)},()=>n(4,w.disks=[...w.disks,new nt],w),t=>n(4,w.disks=w.disks.filter(((e,n)=>t!==n)),w),function(t,e,l){e[l][t.symbol]=this.value,n(4,w),n(15,$)},t=>{(b||g)&&(t.preventDefault(),n(2,b=!1),n(3,g=!1),n(1,h=!1))}]}!function(t,e){try{customElements.define(`tf-${t}`,e)}catch(e){console.warn(`Element with name '${t}' already defined.`)}}("vm",class extends R{constructor(t){super(),this.shadowRoot.innerHTML='',j(this,{target:this.shadowRoot,props:x(this.attributes),customElement:!0},se,ie,i,{},null,[-1,-1,-1]),t&&t.target&&c(t.target,this,t.anchor)}})}(); diff --git a/rollup.config.js b/rollup.config.js index b9e1b57b..fd89ded1 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -65,7 +65,7 @@ function buildElements() { const outDir = `.build/build/elements/`; // return fs // .readdirSync(dir) - return ["base"] + return ["vm"] .map(f => { const name = f.replace(".wc.svelte", "").toLocaleLowerCase(); return build({ diff --git a/src/App.svelte b/src/App.svelte index 32c6a9f5..0fe3ee5a 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -1,11 +1,10 @@ + -
diff --git a/src/elements/vm/Vm.wc.svelte b/src/elements/vm/Vm.wc.svelte index 5467b203..fc35f0a7 100644 --- a/src/elements/vm/Vm.wc.svelte +++ b/src/elements/vm/Vm.wc.svelte @@ -5,6 +5,7 @@ import type { IFlist, IFormField } from "../../types"; const { events } = window.configs?.grid3_client ?? {}; import deployVM from "../../utils/deployVM"; + import findNodes from "../../utils/findNodes"; const configs = window.configs?.baseConfig; const deploymentStore = window.configs?.deploymentStore; @@ -102,6 +103,33 @@ } const onSelectProfile = (e: Event) => profileIdx = (e.target as any).selectedIndex; // prettier-ignore + + const nodeFilters = { + accessNodeV4: false, + accessNodeV6: true, + gateway: false, + city: "", + country: "", + farmId: null, + cru: null, + hru: null, + mru: null, + sru: null, + }; + + // prettier-ignore + const filtersFields = [ + { label: "Access Node V4 Filter", symbol: "accessNodeV4", type: "checkbox" }, + { label: "Access Node V6 Filter", symbol: "accessNodeV6", type: "checkbox" }, + { label: "Gateway Filter", symbol: "gateway", type: "checkbox" }, + { label: "City Filter", symbol: "city", type: "text" }, + { label: "Country Filter", symbol: "country", type: "text" }, + { label: "Farm ID Filter", symbol: "farmId", type: "number" }, + { label: "CRU Filter", symbol: "cru", type: "number" }, + { label: "HRU Filter", symbol: "hru", type: "number" }, + { label: "MRU Filter", symbol: "mru", type: "number" }, + { label: "SRU Filter", symbol: "sru", type: "number" }, + ];
@@ -238,6 +266,70 @@
{/each} + +
+ {#each filtersFields as field (field.symbol)} + {#if field.type === "checkbox"} +
+ + +
+ {/if} + + {#if field.type === "text"} +
+

{field.label}

+
+ +
+
+ {/if} + + {#if field.type === "number"} +
+

{field.label}

+
+ +
+
+ {/if} + {/each} +
+ + {/if} {#if active === "Environment Variables"} @@ -375,4 +467,58 @@ align-items: center; justify-content: space-between; } + + /* Switch */ + .switch { + position: relative; + display: inline-block; + width: 60px; + height: 34px; + + input { + opacity: 0; + width: 0; + height: 0; + } + + .slider { + position: absolute; + cursor: pointer; + top: 0; + left: 0; + right: 0; + bottom: 0; + background-color: #ccc; + -webkit-transition: 0.4s; + transition: 0.4s; + border-radius: 34px; + } + + .slider:before { + position: absolute; + content: ""; + height: 26px; + width: 26px; + left: 4px; + bottom: 4px; + background-color: white; + -webkit-transition: 0.4s; + transition: 0.4s; + border-radius: 50%; + } + + input:checked + .slider { + background-color: #2196f3; + } + + input:checked + .slider { + box-shadow: 0 0 1px #2196f3; + } + + input:checked + .slider:before { + -webkit-transform: translateX(26px); + -ms-transform: translateX(26px); + transform: translateX(26px); + } + } diff --git a/src/utils/findNodes.ts b/src/utils/findNodes.ts index fba9b5f8..f47b82de 100644 --- a/src/utils/findNodes.ts +++ b/src/utils/findNodes.ts @@ -1,21 +1,10 @@ const { GridClient, Nodes } = window.configs?.grid3_client ?? {}; -export default function findNodes() { +export default function findNodes(filters: any) { const nodes = new Nodes( - GridClient.config.graphqlURL, - GridClient.config.rmbClient["proxyURL"] + "https://graphql.dev.grid.tf/graphql", + "https://gridproxy.dev.grid.tf" ); - return nodes.filterNodes({ - accessNodeV4: false, - accessNodeV6: false, - city: "", - country: "", - cru: 0, - farmId: 0, - gateway: false, - hru: 0, - mru: 0, - sru: 0, - }); + return nodes.filterNodes(filters); }