auspice
Version:
Web app for visualizing pathogen evolution
1 lines • 6.1 kB
JavaScript
;(self.webpackChunkauspice=self.webpackChunkauspice||[]).push([[978],{45978:(t,e,n)=>{n.r(e),n.d(e,{default:()=>w});var o=n(82684),r=n(4667),a=n(70570),c=n(6862),i=n(69568);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 o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function l(t,e){return l=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},l(t,e)}function f(t){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},f(t)}const p=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}}),e&&l(t,e)}(d,t);var e,n,r,p,y=(r=d,p=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=f(r);if(p){var n=f(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.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,t)});function d(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,d),(e=y.call(this,t)).state={status:"loading",backgroundColor:"#ffffbf",minDate:void 0,maxDate:void 0,numTips:void 0,lastUpdated:void 0},e}return e=d,(n=[{key:"componentDidMount",value:function(){var t=this;(0,i.Z)("".concat((0,a.qh)(),"/getDataset?prefix=").concat(this.props.path)).then((function(e){var n=(0,c.f0)({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 o.createElement("div",{style:{display:"flex",justifyContent:"space-around",backgroundColor:this.state.backgroundColor,margin:"10px 10px 10px 10px",textAlign:"center"}},o.createElement("h3",{style:t},this.props.path),o.createElement("h3",{style:t},this.state.status),"loaded"===this.state.status?[o.createElement("h3",{style:{flex:"0 0 30%"},key:"tips"},"".concat(this.state.numTips," tips span ").concat(this.state.minDate," to ").concat(this.state.maxDate)),o.createElement("h3",{style:t,key:"updated"},"Last updated: ".concat(this.state.lastUpdated))]:null)}}])&&s(e.prototype,n),d}(o.Component);var y,d=n(2011);function h(t){return h="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},h(t)}function b(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function m(t,e){return m=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},m(t,e)}function v(t){return v=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},v(t)}const w=(0,r.$j)()(y=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}}),e&&m(t,e)}(s,t);var e,n,r,c,u=(r=s,c=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=v(r);if(c){var n=v(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===h(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,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(e=u.call(this,t)).state={available:void 0},e}return e=s,(n=[{key:"componentDidMount",value:function(){var t=this;(0,i.Z)("".concat((0,a.qh)(),"/getAvailable?prefix=").concat(window.location.pathname)).then((function(e){t.setState({available:e})})).catch((function(e){console.warn(e),t.props.dispatch((0,d.PM)("Error getting available datasets"))}))}},{key:"renderHeader",value:function(){return o.createElement("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"space-between",alignItems:"center",minHeight:"50px"}},o.createElement("div",{style:{flex:1}}),o.createElement("div",{style:{fontSize:18}},'Status of available datasets for URL prefix "'.concat(window.location.pathname,'"')),o.createElement("div",{style:{flex:1}}))}},{key:"render",value:function(){return this.state.available&&this.state.available.datasets?o.createElement("div",{style:{maxWidth:1020,marginLeft:"auto",marginRight:"auto"}},this.renderHeader(),this.state.available.datasets.map((function(t){return o.createElement(p,{key:t.request,path:t.request})}))):null}}])&&b(e.prototype,n),s}(o.Component))||y}}]);