UNPKG

auspice

Version:

Web app for visualizing pathogen evolution

2 lines 5.23 kB
(window.webpackJsonp=window.webpackJsonp||[]).push([[10],{688:function(t,e,n){"use strict";n.r(e);var o=n(3),r=n.n(o),a=n(50),i=n(2),c=n(69),s=n(89);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})(t)}function l(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 f(t,e){return!e||"object"!==u(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function y(t,e){return(y=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var b,d="#ffffbf",h=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=f(this,p(e).call(this,t))).state={status:"loading",backgroundColor:d,minDate:void 0,maxDate:void 0,numTips:void 0,lastUpdated:void 0},n}var n,o,a;return 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&&y(t,e)}(e,t),n=e,(o=[{key:"componentDidMount",value:function(){var t=this;Object(s.fetchJSON)("".concat(Object(i.getServerAddress)(),"/getDataset?prefix=").concat(this.props.path)).then((function(e){var n=Object(c.a)({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.log(e),t.setState({status:"Error fetching / processing JSONs",backgroundColor:"#fc8d59"})}))}},{key:"render",value:function(){var t={flex:"0 0 15%"};return r.a.createElement("div",{style:{display:"flex",justifyContent:"space-around",backgroundColor:this.state.backgroundColor,margin:"10px 10px 10px 10px",textAlign:"center"}},r.a.createElement("h3",{style:t},this.props.path),r.a.createElement("h3",{style:t},this.state.status),"loaded"===this.state.status?[r.a.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.a.createElement("h3",{style:t,key:"updated"},"Last updated: ".concat(this.state.lastUpdated))]:null)}}])&&l(n.prototype,o),a&&l(n,a),e}(r.a.Component),m=n(67);function v(t){return(v="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})(t)}function g(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 O(t,e){return!e||"object"!==v(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function w(t){return(w=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function j(t,e){return(j=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var x=Object(a.b)()(b=function(t){function e(t){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=O(this,w(e).call(this,t))).state={available:void 0},n}var n,o,a;return 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&&j(t,e)}(e,t),n=e,(o=[{key:"componentDidMount",value:function(){var t=this;Object(s.fetchJSON)("".concat(Object(i.getServerAddress)(),"/getAvailable?prefix=").concat(window.location.pathname)).then((function(e){t.setState({available:e})})).catch((function(e){console.warn(e),t.props.dispatch(Object(m.c)("Error getting available datasets"))}))}},{key:"renderHeader",value:function(){return r.a.createElement("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"space-between",alignItems:"center",minHeight:"50px"}},r.a.createElement("div",{style:{flex:1}}),r.a.createElement("div",{style:{fontSize:18}},'Status of available datasets for URL prefix "'.concat(window.location.pathname,'"')),r.a.createElement("div",{style:{flex:1}}))}},{key:"render",value:function(){return this.state.available&&this.state.available.datasets?r.a.createElement("div",{style:{maxWidth:1020,marginLeft:"auto",marginRight:"auto"}},this.renderHeader(),this.state.available.datasets.map((function(t){return r.a.createElement(h,{key:t.request,path:t.request})}))):null}}])&&g(n.prototype,o),a&&g(n,a),e}(r.a.Component))||b;e.default=x}}]); //# sourceMappingURL=auspice.chunk.10.bundle.js.map