auspice
Version:
Web app for visualizing pathogen evolution
1 lines • 6.74 kB
JavaScript
;(self.webpackChunkauspice=self.webpackChunkauspice||[]).push([[706],{10706(t,e,n){n.r(e),n.d(e,{default:()=>S});var r=n(78281),o=n(49633),a=n(40952),i=n(1092),c=n(58057);function u(t){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},u(t)}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,l(r.key),r)}}function l(t){var e=function(t){if("object"!=u(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=u(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==u(e)?e:e+""}function f(t,e){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},f(t,e)}function p(t){var e=y();return function(){var n,r=b(t);if(e){var o=b(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(t,e){if(e&&("object"==u(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,n)}}function y(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(y=function(){return!!t})()}function b(t){return b=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},b(t)}const d=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&f(t,e)}(u,t);var e,n,o=p(u);function u(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,u),(e=o.call(this,t)).state={status:"loading",backgroundColor:"#ffffbf",minDate:void 0,maxDate:void 0,numTips:void 0,lastUpdated:void 0},e}return e=u,(n=[{key:"componentDidMount",value:function(){var t=this;(0,c.h)("".concat((0,a.KG)(),"/getDataset?prefix=").concat(this.props.path)).then(function(e){var n=(0,i.UQ)({json:e,query:""});t.setState({status:"loaded",backgroundColor:"#91bfdb",minDate:n.controls.dateMin,maxDate:n.controls.dateMax,numTips:n.metadata.mainTreeNumTips,lastUpdated:e.meta.updated})}).catch(function(e){console.warn("Failed to fetch or process JSONs for",t.props.path,"ERR:",e.type),console.warn(e),t.setState({status:"Error fetching / processing JSONs",backgroundColor:"#fc8d59"})})}},{key:"render",value:function(){var t={flex:"0 0 15%"};return r.createElement("div",{style:{display:"flex",justifyContent:"space-around",backgroundColor:this.state.backgroundColor,margin:"10px 10px 10px 10px",textAlign:"center"}},r.createElement("h3",{style:t},this.props.path),r.createElement("h3",{style:t},this.state.status),"loaded"===this.state.status?[r.createElement("h3",{style:{flex:"0 0 30%"},key:"tips"},"".concat(this.state.numTips," tips span ").concat(this.state.minDate," to ").concat(this.state.maxDate)),r.createElement("h3",{style:t,key:"updated"},"Last updated: ".concat(this.state.lastUpdated))]:null)}}])&&s(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),u}(r.Component);var v,h=n(95401);function m(t){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},m(t)}function w(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,g(r.key),r)}}function g(t){var e=function(t){if("object"!=m(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=m(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==m(e)?e:e+""}function O(t,e){return O=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},O(t,e)}function j(t){var e=E();return function(){var n,r=x(t);if(e){var o=x(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(t,e){if(e&&("object"==m(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,n)}}function E(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(E=function(){return!!t})()}function x(t){return x=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},x(t)}const S=(0,o.Ng)()(v=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&O(t,e)}(i,t);var e,n,o=j(i);function i(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),(e=o.call(this,t)).state={available:void 0},e}return e=i,(n=[{key:"componentDidMount",value:function(){var t=this;(0,c.h)("".concat((0,a.KG)(),"/getAvailable?prefix=").concat(window.location.pathname)).then(function(e){t.setState({available:e})}).catch(function(e){console.warn(e),t.props.dispatch((0,h.IM)("Error getting available datasets"))})}},{key:"renderHeader",value:function(){return r.createElement("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"space-between",alignItems:"center",minHeight:"50px"}},r.createElement("div",{style:{flex:1}}),r.createElement("div",{style:{fontSize:18}},'Status of available datasets for URL prefix "'.concat(window.location.pathname,'"')),r.createElement("div",{style:{flex:1}}))}},{key:"render",value:function(){return this.state.available&&this.state.available.datasets?r.createElement("div",{style:{maxWidth:1020,marginLeft:"auto",marginRight:"auto"}},this.renderHeader(),this.state.available.datasets.map(function(t){return r.createElement(d,{key:t.request,path:t.request})})):null}}])&&w(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),i}(r.Component))||v}}]);