diff --git a/public/assets/custom.css b/public/assets/custom.css index 2a31770..1a44573 100644 --- a/public/assets/custom.css +++ b/public/assets/custom.css @@ -33,3 +33,8 @@ .card-title { font-weight: var(--tblr-font-weight-bold) !important; } + +.auto-search-wrapper input { + padding: .5625rem .75rem !important; + font-size: .875rem !important; +} diff --git a/public/assets/js/autocomplete/autocomplete.min.css b/public/assets/js/autocomplete/autocomplete.min.css new file mode 100644 index 0000000..ebb6566 --- /dev/null +++ b/public/assets/js/autocomplete/autocomplete.min.css @@ -0,0 +1 @@ +:root{--close-button:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M18.984 6.422 13.406 12l5.578 5.578-1.406 1.406L12 13.406l-5.578 5.578-1.406-1.406L10.594 12 5.016 6.422l1.406-1.406L12 10.594l5.578-5.578z'/%3E%3C/svg%3E");--loupe-icon:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23929292' d='M16.041 15.856a.995.995 0 0 0-.186.186A6.97 6.97 0 0 1 11 18c-1.933 0-3.682-.782-4.95-2.05S4 12.933 4 11s.782-3.682 2.05-4.95S9.067 4 11 4s3.682.782 4.95 2.05S18 9.067 18 11a6.971 6.971 0 0 1-1.959 4.856zm5.666 4.437-3.675-3.675A8.967 8.967 0 0 0 20 11c0-2.485-1.008-4.736-2.636-6.364S13.485 2 11 2 6.264 3.008 4.636 4.636 2 8.515 2 11s1.008 4.736 2.636 6.364S8.515 20 11 20a8.967 8.967 0 0 0 5.618-1.968l3.675 3.675a.999.999 0 1 0 1.414-1.414z'/%3E%3C/svg%3E")}.auto-search-wrapper{display:block;position:relative;width:100%}.auto-search-wrapper input{border:1px solid #d7d7d7;box-shadow:none;box-sizing:border-box;font-size:16px;padding:12px 45px 12px 10px;width:100%}.auto-search-wrapper input:focus{border:1px solid #858585;outline:none}.auto-search-wrapper input::-ms-clear{display:none}.auto-search-wrapper ul{list-style:none;margin:0;overflow:auto;padding:0}.auto-search-wrapper ul li{cursor:pointer;margin:0;overflow:hidden;padding:10px;position:relative}.auto-search-wrapper ul li:not(:last-child){border-top:none}.auto-search-wrapper ul li[disabled]{background:#ececec;opacity:.5;pointer-events:none}.auto-search-wrapper .auto-expanded{border:1px solid #858585;outline:none}.auto-search-wrapper.loupe:before{filter:invert(60%)}.auto-is-loading:after{animation:auto-spinner .6s linear infinite;border-color:#d9d9d9 grey grey #d9d9d9;border-radius:50%;border-style:solid;border-width:2px;bottom:0;box-sizing:border-box;content:"";height:20px;margin:auto;position:absolute;right:10px;top:0;width:20px}.auto-is-loading .auto-clear{display:none}@keyframes auto-spinner{to{transform:rotate(1turn)}}li.loupe:before{bottom:auto;top:15px}.loupe input{padding:12px 45px 12px 35px}.loupe:before{background-image:var(--loupe-icon);bottom:0;content:"";height:17px;left:10px;margin:auto;position:absolute;top:0;width:17px}.auto-selected:before{opacity:1}.auto-clear{align-items:center;background-color:transparent;border:none;bottom:0;cursor:pointer;display:flex;height:auto;justify-content:center;margin:auto;position:absolute;right:0;top:0;width:40px}.auto-clear:before{content:var(--close-button);height:24px;line-height:100%;width:24px}.auto-clear span{display:none}.auto-results-wrapper{background-color:#fff;border:1px solid #858585;border-top:none;box-sizing:border-box;display:none;overflow:hidden}.auto-results-wrapper ul>.loupe{padding-left:40px}.auto-results-wrapper.auto-is-active{display:block;margin-top:-1px;position:absolute;width:100%;z-index:99999}.auto-selected{background-color:#e6e6e6}.auto-selected+li:before{border-top:none}.auto-error{border:1px solid #ff3838}.auto-error::-moz-placeholder{color:#f66;opacity:1}.auto-error::placeholder{color:#f66;opacity:1}.hidden{display:none} \ No newline at end of file diff --git a/public/assets/js/autocomplete/autocomplete.min.js b/public/assets/js/autocomplete/autocomplete.min.js new file mode 100644 index 0000000..6417639 --- /dev/null +++ b/public/assets/js/autocomplete/autocomplete.min.js @@ -0,0 +1,8 @@ +/*! +* @name autocomplete +* @version 1.9.0 +* @author Grzegorz Tomicki +* @link https://github.com/tomickigrzegorz/autocomplete +* @license MIT +*/ +var Autocomplete=function(){"use strict";const t=(t,s)=>{for(let i in s)"addClass"===i?e(t,"add",s[i]):"removeClass"===i?e(t,"remove",s[i]):t.setAttribute(i,s[i])},s=t=>(t.firstElementChild||t).textContent.trim(),i=(t,s)=>{t.scrollTop=t.offsetTop-s.offsetHeight},h=function(t,s){void 0===t&&(t=!1),t&&(e(t,"remove","hidden"),r(t,"click",s))},e=(t,s,i)=>t.classList[s](i),a=(s,i)=>{t(s,{"aria-activedescendant":i||""})},n=(t,s,i,h)=>{const e=h.previousSibling,a=e?e.offsetHeight:0;if("0"==t.getAttribute("aria-posinset")&&(h.scrollTop=t.offsetTop-((t,s)=>{const i=document.querySelectorAll(`#${t} > li:not(.${s})`);let h=0;return[].slice.call(i).map((t=>h+=t.offsetHeight)),h})(s,i)),t.offsetTop-ah.scrollTop+h.offsetHeight&&(h.scrollTop=s-h.offsetHeight)}},l=t=>document.createElement(t),o=t=>document.querySelector(t),r=(t,s,i)=>{t.addEventListener(s,i)},c=(t,s,i)=>{t.removeEventListener(s,i)},d=27,u=13,m=38,p=40,$=9;return class{constructor(v,b){let{delay:f=500,clearButton:x=!0,clearButtonOnInitial:C=!1,howManyCharacters:y=1,selectFirst:k=!1,insertToInput:w=!1,showAllValues:g=!1,cache:j=!1,disableCloseOnSelect:S=!1,preventScrollUp:V=!1,classGroup:O,classPreventClosing:I,classPrefix:A,ariaLabelClear:R,onSearch:B,onResults:P=(()=>{}),onSubmit:T=(()=>{}),onOpened:G=(()=>{}),onReset:J=(()=>{}),onRender:N=(()=>{}),onClose:q=(()=>{}),noResults:z=(()=>{}),onSelectedItem:E=(()=>{})}=b;var F;this.t=()=>{var s,i,e,a,n;this.i(),s=this.h,i=this.l,e=this.o,a=this.u,n=this.m,t(i,{id:e,tabIndex:"0",role:"listbox"}),t(a,{addClass:`${n}-results-wrapper`}),a.insertAdjacentElement("beforeend",i),s.parentNode.insertBefore(a,s.nextSibling),r(this.h,"input",this.p),this.$&&r(this.h,"click",this.p),this.v({element:this.h,results:this.l}),this.C&&h(this.k,this.destroy)},this.j=(t,s)=>{this.S&&("update"===t?this.h.setAttribute(this.V,s.value):"remove"===t?this.h.removeAttribute(this.V):this.h.value=this.h.getAttribute(this.V))},this.p=t=>{let{target:s,type:i}=t;if("true"===this.h.getAttribute("aria-expanded")&&"click"===i)return;const h=s.value.replace(this.O,"\\$&");this.j("update",s);const e=this.$?0:this.I;clearTimeout(this.A),this.A=setTimeout((()=>{this.R(h.trim())}),e)},this.B=()=>{var s;e(this.u,"remove",this.P);const i={"aria-owns":`${this.T}-list`,"aria-expanded":"false","aria-autocomplete":"list",role:"combobox",removeClass:"auto-expanded"},h=this.G?i:{...i,"aria-activedescendant":""};t(this.h,h),this.G||(this.J(o(`.${this.N}`)),this.q=this.F?0:-1),(0==(null==(s=this.L)?void 0:s.length)&&!this.M||this.$)&&(this.l.textContent=""),this.U()},this.R=t=>{this.D=t,this.H(!0),h(this.k,this.destroy),0==t.length&&this.K&&e(this.k,"add","hidden"),this.W>t.length&&!this.$?this.H():this.X({currentValue:t,element:this.h}).then((s=>{const i=this.h.value.length,h=s.length;this.L=Array.isArray(s)?s:JSON.parse(JSON.stringify(s)),this.H(),this.Y(),0==h&&0==i&&e(this.k,"add","hidden"),0==h&&i?(e(this.h,"remove","auto-expanded"),this.B(),this.Z({element:this.h,currentValue:t,template:this._}),this.tt()):(h>0||(t=>t&&"object"==typeof t&&t.constructor===Object)(s))&&(this.q=this.F?0:-1,this._(),this.tt())})).catch((()=>{this.H(),this.B()}))},this.H=t=>this.h.parentNode.classList[t?"add":"remove"](this.st),this.Y=()=>e(this.h,"remove",this.it),this.tt=()=>{r(this.h,"keydown",this.ht),r(this.h,"click",this.et),r(document,"click",this.nt),["mousemove","click"].map((t=>{r(this.l,t,this.lt)}))},this._=s=>{t(this.h,{"aria-expanded":"true",addClass:`${this.m}-expanded`}),this.l.textContent="";const h=0===this.L.length?this.ot({currentValue:this.D,matches:0,template:s}):this.ot({currentValue:this.D,matches:this.L,classGroup:this.rt});this.l.insertAdjacentHTML("afterbegin",h),e(this.u,"add",this.P);const a=this.rt?`:not(.${this.rt})`:"";this.ct=document.querySelectorAll(`#${this.o} > li${a}`),(s=>{for(let i=0;i{let{target:s}=t,i=null;(s.closest("ul")&&this.$t||s.closest(`.${this.vt}`))&&(i=!0),s.id===this.T||i||this.B()},this.ut=()=>{if(this.J(o(`.${this.N}`)),!this.F)return;const{firstElementChild:s}=this.l,i=this.rt&&this.L.length>0&&this.F?s.nextElementSibling:s;this.bt({index:this.q,element:this.h,object:this.L[this.q]}),t(i,{id:`${this.ft}-0`,addClass:this.N,"aria-selected":"true"}),a(this.h,`${this.ft}-0`)},this.et=()=>{if(this.l.textContent.length>0&&!e(this.u,"contains",this.P)){if(t(this.h,{"aria-expanded":"true",addClass:`${this.m}-expanded`}),e(this.u,"add",this.P),this.G||(i(this.l,this.u),this.ut()),this.dt({type:"showItems",element:this.h,results:this.l}),!this.S)return;this.j("update",this.h)}},this.lt=t=>{t.preventDefault();const{target:s,type:i}=t,h=s.closest("li"),a=null==h?void 0:h.hasAttribute("role"),n=this.N,l=o(`.${n}`);h&&a&&!s.closest(`.${this.vt}`)&&("click"===i&&this.xt(h),"mousemove"!==i||e(h,"contains",n)||(this.J(l),this.Ct(h),this.q=this.yt(h),this.bt({index:this.q,element:this.h,object:this.L[this.q]})))},this.xt=t=>{t&&0!==this.L.length?(this.K&&e(this.k,"remove","hidden"),this.h.value=s(t),this.kt({index:this.q,element:this.h,object:this.L[this.q],results:this.l}),this.$t||(this.G||this.J(t),this.B()),this.j("remove")):!this.$t&&this.B()},this.yt=t=>Array.prototype.indexOf.call(this.ct,t),this.ht=t=>{const{keyCode:i}=t,h=e(this.u,"contains",this.P),n=this.L.length+1;switch(this.wt=o(`.${this.N}`),i){case m:case p:if(t.preventDefault(),n<=1&&this.F||!h)return;if(i===m?(this.q<0&&(this.q=n-1),this.q-=1):(this.q+=1,this.q>=n&&(this.q=0)),this.J(this.wt),this.q>=0&&this.q{const i=`${this.ft}-${this.yt(s)}`;t(s,{id:i,"aria-selected":"true",addClass:this.N}),a(this.h,i),n(s,this.o,this.rt,this.l)},this.J=s=>{s&&t(s,{id:"",removeClass:this.N,"aria-selected":"false"})},this.i=()=>{this.K&&(t(this.k,{class:`${this.m}-clear hidden`,type:"button",title:this.gt,"aria-label":this.gt}),this.h.insertAdjacentElement("afterend",this.k))},this.rerender=t=>{const s=null!=t&&t.trim()?t.trim():this.h.value;null!=t&&t.trim()&&(this.h.value=t.trim(),this.j("update",this.h));const i=s.replace(this.O,"\\$&");this.R(i.trim())},this.destroy=()=>{this.K&&e(this.k,"add","hidden"),this.h.value="",this.h.focus(),this.l.textContent="",this.B(),this.Y(),this.jt(this.h),c(this.h,"keydown",this.ht),c(this.h,"click",this.et),c(document,"click",this.nt)},this.T=v,this.h=document.getElementById(v),this.X=(F=B,Boolean(F&&"function"==typeof F.then)?B:t=>{let{currentValue:s,element:i}=t;return Promise.resolve(B({currentValue:s,element:i}))}),this.ot=P,this.v=N,this.kt=T,this.bt=E,this.dt=G,this.jt=J,this.Z=z,this.U=q,this.I=f,this.W=y,this.K=x,this.C=C,this.F=k,this.M=w,this.$=g,this.rt=O,this.vt=I,this.gt=R||"clear the search query",this.m=A?`${A}-auto`:"auto",this.$t=S,this.G=V,this.S=j,this.o=`${this.m}-${this.T}-results`,this.V=`data-cache-auto-${this.T}`,this.st=`${this.m}-is-loading`,this.P=`${this.m}-is-active`,this.N=`${this.m}-selected`,this.ft=`${this.m}-selected-option`,this.it=`${this.m}-error`,this.O=/[|\\{}()[\]^$+*?.]/g,this.A=null,this.u=l("div"),this.l=l("ul"),this.k=l("button"),this.t()}}}(); diff --git a/public/assets/js/axios/axios.min.js b/public/assets/js/axios/axios.min.js new file mode 100644 index 0000000..b58abf2 --- /dev/null +++ b/public/assets/js/axios/axios.min.js @@ -0,0 +1,2 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).axios=t()}(this,(function(){"use strict";function e(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function t(t){for(var r=1;r=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(s&&u){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),S(r),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;S(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:A(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},e}function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t,r,n,o,i,a){try{var s=e[i](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,o)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r2&&void 0!==arguments[2]?arguments[2]:{},a=i.allOwnKeys,s=void 0!==a&&a;if(null!=e)if("object"!==n(e)&&(e=[e]),S(e))for(r=0,o=e.length;r0;)if(t===(r=n[o]).toLowerCase())return r;return null}var B="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,I=function(e){return!R(e)&&e!==B};var q,z=(q="undefined"!=typeof Uint8Array&&b(Uint8Array),function(e){return q&&e instanceof q}),M=E("HTMLFormElement"),H=function(e){var t=Object.prototype.hasOwnProperty;return function(e,r){return t.call(e,r)}}(),J=E("RegExp"),G=function(e,t){var r=Object.getOwnPropertyDescriptors(e),n={};U(r,(function(r,o){var i;!1!==(i=t(r,o,e))&&(n[o]=i||r)})),Object.defineProperties(e,n)},W="abcdefghijklmnopqrstuvwxyz",K="0123456789",V={DIGIT:K,ALPHA:W,ALPHA_DIGIT:W+W.toUpperCase()+K};var X=E("AsyncFunction"),$={isArray:S,isArrayBuffer:A,isBuffer:function(e){return null!==e&&!R(e)&&null!==e.constructor&&!R(e.constructor)&&x(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:function(e){var t;return e&&("function"==typeof FormData&&e instanceof FormData||x(e.append)&&("formdata"===(t=w(e))||"object"===t&&x(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&A(e.buffer)},isString:j,isNumber:T,isBoolean:function(e){return!0===e||!1===e},isObject:P,isPlainObject:N,isUndefined:R,isDate:k,isFile:_,isBlob:L,isRegExp:J,isFunction:x,isStream:function(e){return P(e)&&x(e.pipe)},isURLSearchParams:F,isTypedArray:z,isFileList:C,forEach:U,merge:function e(){for(var t=I(this)&&this||{},r=t.caseless,n={},o=function(t,o){var i=r&&D(n,o)||o;N(n[i])&&N(t)?n[i]=e(n[i],t):N(t)?n[i]=e({},t):S(t)?n[i]=t.slice():n[i]=t},i=0,a=arguments.length;i3&&void 0!==arguments[3]?arguments[3]:{},o=n.allOwnKeys;return U(t,(function(t,n){r&&x(t)?e[n]=y(t,r):e[n]=t}),{allOwnKeys:o}),e},trim:function(e){return e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e},inherits:function(e,t,r,n){e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:function(e,t,r,n){var o,i,a,s={};if(t=t||{},null==e)return t;do{for(i=(o=Object.getOwnPropertyNames(e)).length;i-- >0;)a=o[i],n&&!n(a,e,t)||s[a]||(t[a]=e[a],s[a]=!0);e=!1!==r&&b(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:w,kindOfTest:E,endsWith:function(e,t,r){e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;var n=e.indexOf(t,r);return-1!==n&&n===r},toArray:function(e){if(!e)return null;if(S(e))return e;var t=e.length;if(!T(t))return null;for(var r=new Array(t);t-- >0;)r[t]=e[t];return r},forEachEntry:function(e,t){for(var r,n=(e&&e[Symbol.iterator]).call(e);(r=n.next())&&!r.done;){var o=r.value;t.call(e,o[0],o[1])}},matchAll:function(e,t){for(var r,n=[];null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:M,hasOwnProperty:H,hasOwnProp:H,reduceDescriptors:G,freezeMethods:function(e){G(e,(function(t,r){if(x(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;var n=e[r];x(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=function(){throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:function(e,t){var r={},n=function(e){e.forEach((function(e){r[e]=!0}))};return S(e)?n(e):n(String(e).split(t)),r},toCamelCase:function(e){return e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r}))},noop:function(){},toFiniteNumber:function(e,t){return e=+e,Number.isFinite(e)?e:t},findKey:D,global:B,isContextDefined:I,ALPHABET:V,generateString:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:16,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:V.ALPHA_DIGIT,r="",n=t.length;e--;)r+=t[Math.random()*n|0];return r},isSpecCompliantForm:function(e){return!!(e&&x(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:function(e){var t=new Array(10);return function e(r,n){if(P(r)){if(t.indexOf(r)>=0)return;if(!("toJSON"in r)){t[n]=r;var o=S(r)?[]:{};return U(r,(function(t,r){var i=e(t,n+1);!R(i)&&(o[r]=i)})),t[n]=void 0,o}}return r}(e,0)},isAsyncFn:X,isThenable:function(e){return e&&(P(e)||x(e))&&x(e.then)&&x(e.catch)}};function Q(e,t,r,n,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),o&&(this.response=o)}$.inherits(Q,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:$.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var Y=Q.prototype,Z={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((function(e){Z[e]={value:e}})),Object.defineProperties(Q,Z),Object.defineProperty(Y,"isAxiosError",{value:!0}),Q.from=function(e,t,r,n,o,i){var a=Object.create(Y);return $.toFlatObject(e,a,(function(e){return e!==Error.prototype}),(function(e){return"isAxiosError"!==e})),Q.call(a,e.message,t,r,n,o),a.cause=e,a.name=e.name,i&&Object.assign(a,i),a};function ee(e){return $.isPlainObject(e)||$.isArray(e)}function te(e){return $.endsWith(e,"[]")?e.slice(0,-2):e}function re(e,t,r){return e?e.concat(t).map((function(e,t){return e=te(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}var ne=$.toFlatObject($,{},null,(function(e){return/^is[A-Z]/.test(e)}));function oe(e,t,r){if(!$.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;var o=(r=$.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!$.isUndefined(t[e])}))).metaTokens,i=r.visitor||f,a=r.dots,s=r.indexes,u=(r.Blob||"undefined"!=typeof Blob&&Blob)&&$.isSpecCompliantForm(t);if(!$.isFunction(i))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if($.isDate(e))return e.toISOString();if(!u&&$.isBlob(e))throw new Q("Blob is not supported. Use a Buffer instead.");return $.isArrayBuffer(e)||$.isTypedArray(e)?u&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function f(e,r,i){var u=e;if(e&&!i&&"object"===n(e))if($.endsWith(r,"{}"))r=o?r:r.slice(0,-2),e=JSON.stringify(e);else if($.isArray(e)&&function(e){return $.isArray(e)&&!e.some(ee)}(e)||($.isFileList(e)||$.endsWith(r,"[]"))&&(u=$.toArray(e)))return r=te(r),u.forEach((function(e,n){!$.isUndefined(e)&&null!==e&&t.append(!0===s?re([r],n,a):null===s?r:r+"[]",c(e))})),!1;return!!ee(e)||(t.append(re(i,r,a),c(e)),!1)}var l=[],h=Object.assign(ne,{defaultVisitor:f,convertValue:c,isVisitable:ee});if(!$.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!$.isUndefined(r)){if(-1!==l.indexOf(r))throw Error("Circular reference detected in "+n.join("."));l.push(r),$.forEach(r,(function(r,o){!0===(!($.isUndefined(r)||null===r)&&i.call(t,r,$.isString(o)?o.trim():o,n,h))&&e(r,n?n.concat(o):[o])})),l.pop()}}(e),t}function ie(e){var t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function ae(e,t){this._pairs=[],e&&oe(e,this,t)}var se=ae.prototype;function ue(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ce(e,t,r){if(!t)return e;var n,o=r&&r.encode||ue,i=r&&r.serialize;if(n=i?i(t,r):$.isURLSearchParams(t)?t.toString():new ae(t,r).toString(o)){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+n}return e}se.append=function(e,t){this._pairs.push([e,t])},se.toString=function(e){var t=e?function(t){return e.call(this,t,ie)}:ie;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var fe,le=function(){function e(){i(this,e),this.handlers=[]}return s(e,[{key:"use",value:function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}},{key:"eject",value:function(e){this.handlers[e]&&(this.handlers[e]=null)}},{key:"clear",value:function(){this.handlers&&(this.handlers=[])}},{key:"forEach",value:function(e){$.forEach(this.handlers,(function(t){null!==t&&e(t)}))}}]),e}(),he={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},de={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:ae,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},pe="undefined"!=typeof window&&"undefined"!=typeof document,ve=(fe="undefined"!=typeof navigator&&navigator.product,pe&&["ReactNative","NativeScript","NS"].indexOf(fe)<0),ye="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,me=t(t({},Object.freeze({__proto__:null,hasBrowserEnv:pe,hasStandardBrowserWebWorkerEnv:ye,hasStandardBrowserEnv:ve})),de);function ge(e){function t(e,r,n,o){var i=e[o++];if("__proto__"===i)return!0;var a=Number.isFinite(+i),s=o>=e.length;return i=!i&&$.isArray(n)?n.length:i,s?($.hasOwnProp(n,i)?n[i]=[n[i],r]:n[i]=r,!a):(n[i]&&$.isObject(n[i])||(n[i]=[]),t(e,r,n[i],o)&&$.isArray(n[i])&&(n[i]=function(e){var t,r,n={},o=Object.keys(e),i=o.length;for(t=0;t-1,i=$.isObject(e);if(i&&$.isHTMLForm(e)&&(e=new FormData(e)),$.isFormData(e))return o?JSON.stringify(ge(e)):e;if($.isArrayBuffer(e)||$.isBuffer(e)||$.isStream(e)||$.isFile(e)||$.isBlob(e))return e;if($.isArrayBufferView(e))return e.buffer;if($.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return oe(e,new me.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return me.isNode&&$.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((r=$.isFileList(e))||n.indexOf("multipart/form-data")>-1){var a=this.env&&this.env.FormData;return oe(r?{"files[]":e}:e,a&&new a,this.formSerializer)}}return i||o?(t.setContentType("application/json",!1),function(e,t,r){if($.isString(e))try{return(t||JSON.parse)(e),$.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||be.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(e&&$.isString(e)&&(r&&!this.responseType||n)){var o=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(e){if(o){if("SyntaxError"===e.name)throw Q.from(e,Q.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:me.classes.FormData,Blob:me.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};$.forEach(["delete","get","head","post","put","patch"],(function(e){be.headers[e]={}}));var we=be,Ee=$.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Oe=Symbol("internals");function Se(e){return e&&String(e).trim().toLowerCase()}function Re(e){return!1===e||null==e?e:$.isArray(e)?e.map(Re):String(e)}function Ae(e,t,r,n,o){return $.isFunction(n)?n.call(this,t,r):(o&&(t=r),$.isString(t)?$.isString(n)?-1!==t.indexOf(n):$.isRegExp(n)?n.test(t):void 0:void 0)}var je=function(e,t){function r(e){i(this,r),e&&this.set(e)}return s(r,[{key:"set",value:function(e,t,r){var n=this;function o(e,t,r){var o=Se(t);if(!o)throw new Error("header name must be a non-empty string");var i=$.findKey(n,o);(!i||void 0===n[i]||!0===r||void 0===r&&!1!==n[i])&&(n[i||t]=Re(e))}var i,a,s,u,c,f=function(e,t){return $.forEach(e,(function(e,r){return o(e,r,t)}))};return $.isPlainObject(e)||e instanceof this.constructor?f(e,t):$.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim())?f((c={},(i=e)&&i.split("\n").forEach((function(e){u=e.indexOf(":"),a=e.substring(0,u).trim().toLowerCase(),s=e.substring(u+1).trim(),!a||c[a]&&Ee[a]||("set-cookie"===a?c[a]?c[a].push(s):c[a]=[s]:c[a]=c[a]?c[a]+", "+s:s)})),c),t):null!=e&&o(t,e,r),this}},{key:"get",value:function(e,t){if(e=Se(e)){var r=$.findKey(this,e);if(r){var n=this[r];if(!t)return n;if(!0===t)return function(e){for(var t,r=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;t=n.exec(e);)r[t[1]]=t[2];return r}(n);if($.isFunction(t))return t.call(this,n,r);if($.isRegExp(t))return t.exec(n);throw new TypeError("parser must be boolean|regexp|function")}}}},{key:"has",value:function(e,t){if(e=Se(e)){var r=$.findKey(this,e);return!(!r||void 0===this[r]||t&&!Ae(0,this[r],r,t))}return!1}},{key:"delete",value:function(e,t){var r=this,n=!1;function o(e){if(e=Se(e)){var o=$.findKey(r,e);!o||t&&!Ae(0,r[o],o,t)||(delete r[o],n=!0)}}return $.isArray(e)?e.forEach(o):o(e),n}},{key:"clear",value:function(e){for(var t=Object.keys(this),r=t.length,n=!1;r--;){var o=t[r];e&&!Ae(0,this[o],o,e,!0)||(delete this[o],n=!0)}return n}},{key:"normalize",value:function(e){var t=this,r={};return $.forEach(this,(function(n,o){var i=$.findKey(r,o);if(i)return t[i]=Re(n),void delete t[o];var a=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r}))}(o):String(o).trim();a!==o&&delete t[o],t[a]=Re(n),r[a]=!0})),this}},{key:"concat",value:function(){for(var e,t=arguments.length,r=new Array(t),n=0;n1?r-1:0),o=1;o1?"since :\n"+s.map(Ue).join("\n"):" "+Ue(s[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return r};function Ie(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Ne(null,e)}function qe(e){return Ie(e),e.headers=xe.from(e.headers),e.data=Te.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Be(e.adapter||we.adapter)(e).then((function(t){return Ie(e),t.data=Te.call(e,e.transformResponse,t),t.headers=xe.from(t.headers),t}),(function(t){return Pe(t)||(Ie(e),t&&t.response&&(t.response.data=Te.call(e,e.transformResponse,t.response),t.response.headers=xe.from(t.response.headers))),Promise.reject(t)}))}var ze=function(e){return e instanceof xe?e.toJSON():e};function Me(e,t){t=t||{};var r={};function n(e,t,r){return $.isPlainObject(e)&&$.isPlainObject(t)?$.merge.call({caseless:r},e,t):$.isPlainObject(t)?$.merge({},t):$.isArray(t)?t.slice():t}function o(e,t,r){return $.isUndefined(t)?$.isUndefined(e)?void 0:n(void 0,e,r):n(e,t,r)}function i(e,t){if(!$.isUndefined(t))return n(void 0,t)}function a(e,t){return $.isUndefined(t)?$.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function s(r,o,i){return i in t?n(r,o):i in e?n(void 0,r):void 0}var u={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:s,headers:function(e,t){return o(ze(e),ze(t),!0)}};return $.forEach(Object.keys(Object.assign({},e,t)),(function(n){var i=u[n]||o,a=i(e[n],t[n],n);$.isUndefined(a)&&i!==s||(r[n]=a)})),r}var He="1.6.7",Je={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){Je[e]=function(r){return n(r)===e||"a"+(t<1?"n ":" ")+e}}));var Ge={};Je.transitional=function(e,t,r){function n(e,t){return"[Axios v1.6.7] Transitional option '"+e+"'"+t+(r?". "+r:"")}return function(r,o,i){if(!1===e)throw new Q(n(o," has been removed"+(t?" in "+t:"")),Q.ERR_DEPRECATED);return t&&!Ge[o]&&(Ge[o]=!0,console.warn(n(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,o,i)}};var We={assertOptions:function(e,t,r){if("object"!==n(e))throw new Q("options must be an object",Q.ERR_BAD_OPTION_VALUE);for(var o=Object.keys(e),i=o.length;i-- >0;){var a=o[i],s=t[a];if(s){var u=e[a],c=void 0===u||s(u,a,e);if(!0!==c)throw new Q("option "+a+" must be "+c,Q.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new Q("Unknown option "+a,Q.ERR_BAD_OPTION)}},validators:Je},Ke=We.validators,Ve=function(){function e(t){i(this,e),this.defaults=t,this.interceptors={request:new le,response:new le}}var t,n;return s(e,[{key:"request",value:(t=r().mark((function e(t,n){var o,i;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this._request(t,n);case 3:return e.abrupt("return",e.sent);case 6:throw e.prev=6,e.t0=e.catch(0),e.t0 instanceof Error&&(Error.captureStackTrace?Error.captureStackTrace(o={}):o=new Error,i=o.stack?o.stack.replace(/^.+\n/,""):"",e.t0.stack?i&&!String(e.t0.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(e.t0.stack+="\n"+i):e.t0.stack=i),e.t0;case 10:case"end":return e.stop()}}),e,this,[[0,6]])})),n=function(){var e=this,r=arguments;return new Promise((function(n,i){var a=t.apply(e,r);function s(e){o(a,n,i,s,u,"next",e)}function u(e){o(a,n,i,s,u,"throw",e)}s(void 0)}))},function(e,t){return n.apply(this,arguments)})},{key:"_request",value:function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{};var r=t=Me(this.defaults,t),n=r.transitional,o=r.paramsSerializer,i=r.headers;void 0!==n&&We.assertOptions(n,{silentJSONParsing:Ke.transitional(Ke.boolean),forcedJSONParsing:Ke.transitional(Ke.boolean),clarifyTimeoutError:Ke.transitional(Ke.boolean)},!1),null!=o&&($.isFunction(o)?t.paramsSerializer={serialize:o}:We.assertOptions(o,{encode:Ke.function,serialize:Ke.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();var a=i&&$.merge(i.common,i[t.method]);i&&$.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete i[e]})),t.headers=xe.concat(a,i);var s=[],u=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(u=u&&e.synchronous,s.unshift(e.fulfilled,e.rejected))}));var c,f=[];this.interceptors.response.forEach((function(e){f.push(e.fulfilled,e.rejected)}));var l,h=0;if(!u){var d=[qe.bind(this),void 0];for(d.unshift.apply(d,s),d.push.apply(d,f),l=d.length,c=Promise.resolve(t);h0;)n._listeners[t](e);n._listeners=null}})),this.promise.then=function(e){var t,r=new Promise((function(e){n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},t((function(e,t,o){n.reason||(n.reason=new Ne(e,t,o),r(n.reason))}))}return s(e,[{key:"throwIfRequested",value:function(){if(this.reason)throw this.reason}},{key:"subscribe",value:function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}},{key:"unsubscribe",value:function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}}}],[{key:"source",value:function(){var t;return{token:new e((function(e){t=e})),cancel:t}}}]),e}();var Qe={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Qe).forEach((function(e){var t=c(e,2),r=t[0],n=t[1];Qe[n]=r}));var Ye=Qe;var Ze=function e(t){var r=new Xe(t),n=y(Xe.prototype.request,r);return $.extend(n,Xe.prototype,r,{allOwnKeys:!0}),$.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(Me(t,r))},n}(we);return Ze.Axios=Xe,Ze.CanceledError=Ne,Ze.CancelToken=$e,Ze.isCancel=Pe,Ze.VERSION=He,Ze.toFormData=oe,Ze.AxiosError=Q,Ze.Cancel=Ze.CanceledError,Ze.all=function(e){return Promise.all(e)},Ze.spread=function(e){return function(t){return e.apply(null,t)}},Ze.isAxiosError=function(e){return $.isObject(e)&&!0===e.isAxiosError},Ze.mergeConfig=Me,Ze.AxiosHeaders=xe,Ze.formToJSON=function(e){return ge($.isHTMLForm(e)?new FormData(e):e)},Ze.getAdapter=Be,Ze.HttpStatusCode=Ye,Ze.default=Ze,Ze})); +//# sourceMappingURL=axios.min.js.map diff --git a/src/Controller/IXStatsController.php b/src/Controller/IXStatsController.php index 95c874b..d547480 100644 --- a/src/Controller/IXStatsController.php +++ b/src/Controller/IXStatsController.php @@ -13,7 +13,9 @@ use App\Repository\GetAsDataRepository; use App\Repository\KnowlinksRepository; use App\Repository\PeeringDBRepository; use App\Util\Annotation\Menu; +use App\Util\GetJsonParameters; use Doctrine\DBAL\Exception; +use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; @@ -93,6 +95,9 @@ class IXStatsController extends BaseController )] public function searchIX( Request $request, + PeeringDBRepository $peeringDBRepository, + GetAsDataRepository $asDataRepository, + ConfigApplication $Config, ): Response { $this->base_data['content_wrapper']['titre'] = 'Search IX Stats'; @@ -100,7 +105,35 @@ class IXStatsController extends BaseController $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { - $form->getData(); + $this->base_data['content_wrapper']['titre'] = \sprintf( + 'Top %s (%s)', + $this->base_data['top'], + '24 hours' + ); + + $this->base_data['content_wrapper']['small'] = $form->get('ix')->getData(); + + $this->data['data'] = $asDataRepository::get( + $this->base_data['top'], + '', + [], + $peeringDBRepository->getIXMembers((int) $form->get('ix_hidden')->getData()), + ); + + $this->data['start'] = time() - 24 * 3600; + $this->data['end'] = time(); + $this->data['graph_size'] = [ + 'width' => $Config::getAsStatsConfigGraph()['top_graph_width'], + 'height' => $Config::getAsStatsConfigGraph()['top_graph_height'], + ]; + $this->data['selectedLinks'] = []; + + return $this->render('pages/ix/search_ix/show.html.twig', [ + 'base_data' => $this->base_data, + 'data' => $this->data, + 'knownlinks' => KnowlinksRepository::get(), + 'form' => $form->createView(), + ]); } return $this->render('pages/ix/search_ix/index.html.twig', [ @@ -108,4 +141,40 @@ class IXStatsController extends BaseController 'form' => $form->createView(), ]); } + + #[Route( + path: '/search/get-ixname', + name: 'ix.search.get_ixname', + methods: ['POST'], + )] + public function getIXName( + Request $request, + PeeringDBRepository $peeringDBRepository, + ): JsonResponse { + $req = GetJsonParameters::getAll($request); + + if (!\array_key_exists('name', $req)) { + return new JsonResponse(['message' => 'Bad JSON request.'], Response::HTTP_BAD_REQUEST); + } + + try { + $data = $peeringDBRepository->getIXName($req['name']); + + if (200 !== $data['status_code']) { + throw new \Exception('No data from API.'); + } + + $return = []; + foreach ($data['response']['data'] as $value) { + $return[] = [ + 'id' => $value['id'], + 'name' => \sprintf('%s (%s / %s', $value['name'], $value['city'], $value['country']), + ]; + } + + return new JsonResponse($return); + } catch (\Exception $e) { + return new JsonResponse(['message' => $e->getMessage()], Response::HTTP_NOT_FOUND); + } + } } diff --git a/src/Form/SearchIXForm.php b/src/Form/SearchIXForm.php index c671312..f06e053 100644 --- a/src/Form/SearchIXForm.php +++ b/src/Form/SearchIXForm.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace App\Form; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -20,7 +21,8 @@ class SearchIXForm extends AbstractType ->add('ix', TextType::class, [ 'label' => false, 'translation_domain' => false, - ]); + ]) + ->add('ix_hidden', HiddenType::class); } public function configureOptions(OptionsResolver $resolver): void diff --git a/src/Repository/PeeringDBRepository.php b/src/Repository/PeeringDBRepository.php index fa832dd..6cedf87 100644 --- a/src/Repository/PeeringDBRepository.php +++ b/src/Repository/PeeringDBRepository.php @@ -41,4 +41,13 @@ class PeeringDBRepository return $data['response']['data'][0]; } + + public function getIXName(string $regex): array + { + if ('' === $regex || '0' === $regex) { + return []; + } + + return $this->peeringDbClient->get(\sprintf('ix?name__contains=%s', $regex)); + } } diff --git a/src/Util/GetJsonParameters.php b/src/Util/GetJsonParameters.php new file mode 100644 index 0000000..c622c0f --- /dev/null +++ b/src/Util/GetJsonParameters.php @@ -0,0 +1,20 @@ +headers->get('Content-Type')), 'application/json')) { + $data = json_decode($request->getContent(), true); + $request->request->replace(is_array($data) ? $data : []); + } + + return $request->request->all(); + } +} diff --git a/templates/pages/ix/my_ix/show.html.twig b/templates/pages/ix/my_ix/show.html.twig index adf6587..e573fce 100644 --- a/templates/pages/ix/my_ix/show.html.twig +++ b/templates/pages/ix/my_ix/show.html.twig @@ -29,13 +29,13 @@ {% endblock %} - {#% block customlinks %} + {% block customlinks %}
{{ custom_links_top(as)|raw }}
- {% endblock %#} + {% endblock %} {% endembed %} {% endfor %} diff --git a/templates/pages/ix/search_ix/_search.html.twig b/templates/pages/ix/search_ix/_search.html.twig index fe01a40..289303f 100644 --- a/templates/pages/ix/search_ix/_search.html.twig +++ b/templates/pages/ix/search_ix/_search.html.twig @@ -4,7 +4,9 @@

Search IX

- {{ form_widget(form.ix) }} +
+ {{ form_widget(form.ix) }} +
diff --git a/templates/pages/ix/search_ix/index.html.twig b/templates/pages/ix/search_ix/index.html.twig index acdf86f..144ede1 100644 --- a/templates/pages/ix/search_ix/index.html.twig +++ b/templates/pages/ix/search_ix/index.html.twig @@ -1,5 +1,11 @@ {% extends "base/_layout.html.twig" %} +{% block css %} + {{ parent() }} + + +{% endblock %} + {% block content %}
@@ -14,10 +20,46 @@ {% block js %} {{ parent() }} + + - {% endblock %} diff --git a/templates/pages/ix/search_ix/show.html.twig b/templates/pages/ix/search_ix/show.html.twig new file mode 100644 index 0000000..914448f --- /dev/null +++ b/templates/pages/ix/search_ix/show.html.twig @@ -0,0 +1,44 @@ +{% extends "pages/ix/search_ix/index.html.twig" %} + +{% set counter = 0 %} + +{% block legend %} + {% if knownlinks is defined %} + {% include 'core/legend_simple.html.twig' %} + {% endif %} +{% endblock %} + +{% block graph %} +
+
+
+ {% for as, as_data in data.data.asinfo %} + {% set counter = counter + 1 %} + {% embed 'core/card_top.html.twig' with {as: as, as_data: as_data, data: data, counter: counter, hours: hours|default('24 hours')} only %} + {% block rank %} +
+ # {{ counter }} +
+ {% endblock %} + + {% block title %} +

+ + AS{{ as }}: + {{ as_data.info.name|default(as_data.info.description) }} +

+ {% endblock %} + + {% block customlinks %} +
+
+ {{ custom_links_top(as)|raw }} +
+
+ {% endblock %} + {% endembed %} + {% endfor %} +
+
+
+{% endblock %}