1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8061],{79837:function(t,e,n){n.d(e,{Z:function(){return rt}});var r=n(14416),a=n(11163),o=n(80353),c=n(92777),i=n(82262),u=n(10748),s=n(45959),l=n(63553),f=n(37247),p=n(59499),d=n(67294),h=n(23279),v=n.n(h),y=(n(94184),n(77913)),m=n(78386),Z=n(52202),g=n(53967),b=n(30087),R=n(90540),j=n(41664),O=n.n(j),P=n(85893);function x(t){var e=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}}();return function(){var n,r=(0,f.Z)(t);if(e){var a=(0,f.Z)(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return(0,l.Z)(this,n)}}var w=function(t){(0,s.Z)(n,t);var e=x(n);function n(){return(0,c.Z)(this,n),e.apply(this,arguments)}return(0,i.Z)(n,[{key:"render",value:function(){var t=this.props,e=t.row,n=e.id,r=e.dataset,a=t.value;return(0,P.jsx)("td",{className:"main",children:(0,P.jsx)(O(),{href:"/admin/data/layers/".concat(n,"/edit?dataset=").concat(r),children:(0,P.jsx)("a",{children:a})})})}}]),n}(d.PureComponent),k=w;function C(t){var e=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}}();return function(){var n,r=(0,f.Z)(t);if(e){var a=(0,f.Z)(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return(0,l.Z)(this,n)}}var S=function(t){(0,s.Z)(n,t);var e=C(n);function n(){return(0,c.Z)(this,n),e.apply(this,arguments)}return(0,i.Z)(n,[{key:"render",value:function(){var t=this.props.row.owner;return(0,P.jsx)("td",{children:t})}}]),n}(d.PureComponent),N=S;function B(t){var e=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}}();return function(){var n,r=(0,f.Z)(t);if(e){var a=(0,f.Z)(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return(0,l.Z)(this,n)}}var D=function(t){(0,s.Z)(n,t);var e=B(n);function n(){return(0,c.Z)(this,n),e.apply(this,arguments)}return(0,i.Z)(n,[{key:"render",value:function(){var t=this.props,e=t.index,n=t.value;return(0,P.jsx)("td",{children:n},e)}}]),n}(d.PureComponent);(0,p.Z)(D,"defaultProps",{value:null,index:null});var A=D;function E(t){var e=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}}();return function(){var n,r=(0,f.Z)(t);if(e){var a=(0,f.Z)(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return(0,l.Z)(this,n)}}var L=function(t){(0,s.Z)(n,t);var e=E(n);function n(){return(0,c.Z)(this,n),e.apply(this,arguments)}return(0,i.Z)(n,[{key:"render",value:function(){var t=this.props.value;return(0,P.jsx)("td",{children:new Date(t).toLocaleString()})}}]),n}(d.PureComponent),M=L,I=n(91851);function W(t){var e=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}}();return function(){var n,r=(0,f.Z)(t);if(e){var a=(0,f.Z)(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return(0,l.Z)(this,n)}}var T=function(t){(0,s.Z)(n,t);var e=W(n);function n(){return(0,c.Z)(this,n),e.apply(this,arguments)}return(0,i.Z)(n,[{key:"getParsedParams",value:function(){var t=this.props,e=t.data.id,n=t.action.params;return JSON.parse((0,I.Gj)(JSON.stringify(n),[{key:"id",value:e}]))}},{key:"render",value:function(){var t=this.getParsedParams(),e=t.tab,n=t.subtab,r=t.id,a=t.dataset;return(0,P.jsx)(O(),{href:"/admin/data/".concat(e,"/").concat(r,"/").concat(n,"?dataset=").concat(a),children:(0,P.jsx)("a",{className:"c-btn",children:"Edit"})})}}]),n}
1(d.PureComponent);(0,p.Z)(T,"defaultProps",{data:{}});var z=T,F=n(16938);function _(t){var e=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}}();return function(){var n,r=(0,f.Z)(t);if(e){var a=(0,f.Z)(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return(0,l.Z)(this,n)}}var G=function(t){(0,s.Z)(n,t);var e=_(n);function n(){var t;(0,c.Z)(this,n);for(var r=arguments.length,a=new Array(r),o=0;o<r;o++)a[o]=arguments[o];return t=e.call.apply(e,[this].concat(a)),(0,p.Z)((0,u.Z)(t),"handleOnClickDelete",(function(){var e=t.props,n=e.data,r=n.id,a=n.name,o=n.dataset,c=e.token,i=e.onRowDelete;F.Rt.confirm('Are you sure that you want to delete: "'.concat(a,'"'),{onOk:function(){(0,y.Q)(r,o,"Bearer ".concat(c)).then((function(){i(r),F.Rt.success("Success",'The layer "'.concat(r,'" - "').concat(a,'" has been removed correctly'))})).catch((function(t){F.Rt.error("Error",'The layer "'.concat(r,'" - "').concat(a,'" was not deleted. Try again. ').concat(t.message))}))}})})),t}return(0,i.Z)(n,[{key:"render",value:function(){return(0,P.jsx)("button",{type:"button",className:"c-btn",onClick:this.handleOnClickDelete,children:"Remove"})}}]),n}(d.PureComponent);G.defaultProps={data:{}};var J=G,U=(0,o.ns)(J);function q(t){var e=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}}();return function(){var n,r=(0,f.Z)(t);if(e){var a=(0,f.Z)(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return(0,l.Z)(this,n)}}var Y=function(t){(0,s.Z)(n,t);var e=q(n);function n(){return(0,c.Z)(this,n),e.apply(this,arguments)}return(0,i.Z)(n,[{key:"getParsedParams",value:function(){var t=this.props,e=t.data.dataset,n=t.action.params;return JSON.parse((0,I.Gj)(JSON.stringify(n),[{key:"id",value:e}]))}},{key:"render",value:function(){var t=this.getParsedParams(),e=t.tab,n=t.subtab,r=t.id;return(0,P.jsx)(O(),{href:"/admin/data/".concat(e,"/").concat(r,"/").concat(n),children:(0,P.jsx)("a",{className:"c-btn",children:"Go to dataset"})})}}]),n}(d.PureComponent);(0,p.Z)(Y,"defaultProps",{data:{}});var H=Y,K={enabled:!0,limit:20,page:1,pages:null,size:null},Q=n(14604);function V(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function $(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?V(Object(n),!0).forEach((function(e){(0,p.Z)(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):V(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function X(t){var e=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}}();return function(){var n,r=(0,f.Z)(t);if(e){var a=(0,f.Z)(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return(0,l.Z)(this,n)}}var tt=function(t){(0,s.Z)(n,t);var e=X(n);function n(){var t;(0,c.Z)(this,n);for(var r=arguments.length,a=new Array(r),o=0;o<r;o++)a[o]=arguments[o];return t=e.call.apply(e,[this].concat(a)),(0,p.Z)((0,u.Z)(t),"state",{pagination:K,loading:!0,dataset:null,layers:[],filters:{name:null,"user.role":"ADMIN"}}),(0,p.Z)((0,u.Z)(t),"onFiltersChange",(function(e){var n=t.state.filters;t.setState({filters:$($($({},n),e.value===Q.W.ADMIN&&{"user.role":e.value}),e.value===Q.W.ALL&&{"user.role":null})},(function(){return t.loadLayers()}))})),(0,p.Z)((0,u.Z)(t),"onSearch",v()((function(e){var n=t.state.filters;e.length>0&&e.length<3||t.setState({loading:!0,filters:$($({},n),{},{name:e}),pagination:K},(function(){return t.loadLayers()}))}),250)),(0,p.Z)((0,u.Z)(t),"loadDataset",(function(){var e=t.props.dataset;(0,m.Kb)(e).then((function(e){t.setState({dataset:e})})).catch((function(e){t.setState({error:e})}))})),(0,p.Z)((0,u.Z)(t),"onChangePage",(function(e){var n=t.state.pagination;t.setState({loading:!0,pagination:$($({},n),{},{page:e})},(function(){return t.loadLayers()}))})),(0,p.Z)((0,u.Z)(t),"onRemoveLayer",(function(){t.setState({loading:!0}),t.loadLayers()})),(0,p.Z)((0,u.Z)(t),"loadLayers",(function(){var e=t.props,n=e.dataset,r=e.token,a=t.state,o=a.pagination,c=a.filters;t.setState({loading:!0}),(0,y.PN)($($($({includes:"user","page[number]":o.page,"page[size]":o.limit,application:"rw"},n&&{dataset:n}),c),{},{env:"production"}),{Authorization:"Bearer ".concat(r)},!0).then((function(e){var n=e.layers,r=e.meta,a=r["total-pages"],c=r["total-items"],i=$($({},o),{},{size:c,pages:a});t.setState({loading:!1,pagination:i,layers:n.map((function(t){return $($({},t),{},{owner:t.user?t.user.name||(t.user.email||"").split("@")[0]:"",role:t.user&&t.user.role||"",disabled:"production".split(",").findIndex((function(e){return e===t.env}))<0})}))})})).catch((function(e){var n=e.message;t.setState({error:n})}))})),t}return(0,i.Z)(n,[{key:"UNSAFE_componentWillMount",value:function(){var t=this.props.dataset;this.loadLayers(),t&&this.loadDataset()}},{key:"render",value:function(){var t=this.state,e=t.loading,n=t.pagination,r=t.layers,a=t.error,o=t.dataset,c=this.props.dataset,i=o&&"production".split(",").findIndex((function(t){return t===o.env}))<0;return(0,P.jsxs)("div",{className:"c-layer-table",children:[(0,P.jsx)(Z.Z,{className:"-light",isLoading:e}),a&&(0,P.jsxs)("p",{children:["Error:",a]}),(0,P.jsx)(R.Z,{filtersChange:this.onFiltersChange}),(0,P.jsx)(b.Z,{input:{placeholder:"Search layer"},link:{label:"New layer",route:"/admin/data/layers/new?dataset=".concat(c)},onSearch:this.onSearch,disableButton:i}),!a&&(0,P.jsx)(g.Z,{columns:[{label:"Name",value:"name",td:k},{label:"Provider",value:"provider"},{label:"Owner",value:"owner",td:N},{label:"Role",value:"role",td:A},{label:"Updated at",value:"updatedAt",td:M},{label:"Environment",value:"env"}],actions:{show:!0,list:[{name:"Edit",route:"/admin/data/layers/{{id}}/edit",params:{tab:"layers",subtab:"edit",id:"{{id}}",datasetID:c},show:!0,component:z},{name:"Remove",route:"/admin/data/layers/{{id}}/remove",params:{tab:"layers",subtab:"remove",id:"{{id}}"},component:U},{name:"Go to dataset",route:"/admin/data/:tab/:id/:subtab",params:{tab:"datasets",subtab:"edit",id:"{{id}}"},component:H}]},sort:{field:"updatedAt",value:-1},filters:!1,data:r,onRowDelete:this.onRemoveLayer,onChangePage:this.onChangePage,pagination:n})]})}}]),n}
1(d.PureComponent);tt.defaultProps={dataset:null};var et=tt,nt=(0,o.ns)(et);var rt=(0,r.connect)((function(t){return{user:t.user}}),null)((function(t){var e=t.user,n=(0,a.useRouter)().query.params,r=(null===n||void 0===n?void 0:n[1])||null;return(0,P.jsx)("div",{className:"c-layers-index",children:(0,P.jsx)(nt,{application:["rw"],dataset:r,authorization:e.token})})}))},82815:function(t,e,n){n.d(e,{Z:function(){return nt}});var r=n(14416),a=n(92777),o=n(82262),c=n(45959),i=n(63553),u=n(37247),s=n(59499),l=n(67294),f=n(80353),p=n(10748),d=n(23279),h=n.n(d),v=(n(94184),n(6442)),y=n(78386),m=n(52202),Z=n(53967),g=n(30087),b=n(90540),R=n(14604),j=n(41664),O=n.n(j),P=n(85893);function x(t){var e=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}}();return function(){var n,r=(0,u.Z)(t);if(e){var a=(0,u.Z)(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return(0,i.Z)(this,n)}}var w=function(t){(0,c.Z)(n,t);var e=x(n);function n(){return(0,a.Z)(this,n),e.apply(this,arguments)}return(0,o.Z)(n,[{key:"render",value:function(){var t=this.props,e=t.row,n=e.id,r=e.dataset,a=t.value;return(0,P.jsx)("td",{className:"main",children:(0,P.jsx)(O(),{href:"/admin/data/widgets/".concat(n,"/edit?dataset=").concat(r),children:(0,P.jsx)("a",{children:a})})})}}]),n}(l.PureComponent),k=w;function C(t){var e=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}}();return function(){var n,r=(0,u.Z)(t);if(e){var a=(0,u.Z)(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return(0,i.Z)(this,n)}}var S=function(t){(0,c.Z)(n,t);var e=C(n);function n(){return(0,a.Z)(this,n),e.apply(this,arguments)}return(0,o.Z)(n,[{key:"render",value:function(){var t=this.props.value;return(0,P.jsx)("td",{className:"boolean",children:(0,P.jsx)("span",{children:t?"Yes":"No"})})}}]),n}(l.PureComponent),N=S;function B(t){var e=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}}();return function(){var n,r=(0,u.Z)(t);if(e){var a=(0,u.Z)(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return(0,i.Z)(this,n)}}var D=function(t){(0,c.Z)(n,t);var e=B(n);function n(){return(0,a.Z)(this,n),e.apply(this,arguments)}return(0,o.Z)(n,[{key:"render",value:function(){var t=this.props.row.owner;return(0,P.jsx)("td",{children:t})}}]),n}(l.PureComponent),A=D;function E(t){var e=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}}();return function(){var n,r=(0,u.Z)(t);if(e){var a=(0,u.Z)(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return(0,i.Z)(this,n)}}var L=function(t){(0,c.Z)(n,t);var e=E(n);function n(){return(0,a.Z)(this,n),e.apply(this,arguments)}return(0,o.Z)(n,[{key:"render",value:function(){var t=this.props,e=t.index,n=t.value;return(0,P.jsx)("td",{children:n},e)}}]),n}(l.PureComponent);(0,s.Z)(L,"defaultProps",{value:null,index:null});var M=L,I=n(91851);function W(t){var e=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}}();return function(){var n,r=(0,u.Z)(t);if(e){var a=(0,u.Z)(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return(0,i.Z)(this,n)}}var T=function(t){(0,c.Z)(n,t);var e=W(n);function n(){return(0,a.Z)(this,n),e.apply(this,arguments)}return(0,o.Z)(n,[{key:"getParsedParams",value:function(){var t=this.props,e=t.data.id,n=t.action.params;return JSON.parse((0,I.Gj)(JSON.stringify(n),[{key:"id",value:e}]))}},{key:"render",value:function(){var t=this.getParsedParams(),e=t.tab,n=t.subtab,r=t.id,a=t.dataset;return(0,P.jsx)(O(),{href:"/admin/data/".concat(e,"/").concat(r,"/").concat(n,"?dataset=").concat(a),children:(0,P.jsx)("a",{className:"c-btn",children:"Edit"})})}}]),n}(l.PureComponent),z=T,F=n(16938);function _(t){var e=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}}();return function(){var n,r=(0,u.Z)(t);if(e){var a=(0,u.Z)(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return(0,i.Z)(this,n)}}var G=function(t){(0,c.Z)(n,t);var e=_(n);function n(){var t;(0,a.Z)(this,n);for(var r=arguments.length,o=new Array(r),c=0;c<r;c++)o[c]=arguments[c];return t=e.call.apply(e,[this].concat(o)),(0,s.Z)((0,p.Z)(t),"handleOnClickDelete",(function(){var e=t.props,n=e.data,r=n.id,a=n.name,o=n.dataset,c=e.user.token;F.Rt.confirm('Are you sure that you want to delete: "'.concat(a,'"'),{onOk:function(){(0,v.E9)(r,o,c).then((function(){t.props.onRowDelete(r),F.Rt.success("Success",'The widget "'.concat(r,'" - "').concat(a,'" has been removed correctly'))})).catch((function(t){F.Rt.error("Error",'The widget "'.concat(r,'" - "').concat(a,'" was not deleted. Try again. ').concat(t))}))}})})),t}return(0,o.Z)(n,[{key:"render",value:function(){return(0,P.jsx)("span",{children:(0,P.jsx)("button",{className:"c-btn",onClick:this.handleOnClickDelete,children:"Remove"})})}}]),n}(l.PureComponent),J=G,U=(0,r.connect)((function(t){return{user:t.user}}),null)(J),q={enabled:!0,limit:20,page:1,pages:null,size:null};function Y(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function H(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};
1e%2?Y(Object(n),!0).forEach((function(e){(0,s.Z)(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Y(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function K(t){var e=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}}();return function(){var n,r=(0,u.Z)(t);if(e){var a=(0,u.Z)(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return(0,i.Z)(this,n)}}var Q=function(t){(0,c.Z)(n,t);var e=K(n);function n(){var t;(0,a.Z)(this,n);for(var r=arguments.length,o=new Array(r),c=0;c<r;c++)o[c]=arguments[c];return t=e.call.apply(e,[this].concat(o)),(0,s.Z)((0,p.Z)(t),"state",{pagination:q,loading:!0,dataset:null,widgets:[],filters:{name:null,"user.role":"ADMIN"}}),(0,s.Z)((0,p.Z)(t),"onFiltersChange",(function(e){var n=t.state.filters;t.setState({filters:H(H({name:n.name},e.value===R.W.ADMIN&&{"user.role":e.value}),e.value===R.W.ALL&&{"user.role":null})},(function(){return t.loadWidgets()}))})),(0,s.Z)((0,p.Z)(t),"onSearch",h()((function(e){var n=t.state.filters;e.length>0&&e.length<3||t.setState({loading:!0,filters:H(H({},n),{},{name:e}),pagination:q},(function(){return t.loadWidgets()}))}),250)),(0,s.Z)((0,p.Z)(t),"loadDataset",(function(){var e=t.props.dataset;(0,y.Kb)(e).then((function(e){t.setState({dataset:e})})).catch((function(e){t.setState({error:e})}))})),(0,s.Z)((0,p.Z)(t),"onChangePage",(function(e){var n=t.state.pagination;t.setState({loading:!0,pagination:H(H({},n),{},{page:e})},(function(){return t.loadWidgets()}))})),(0,s.Z)((0,p.Z)(t),"onRemoveWidget",(function(){t.setState({loading:!0}),t.loadWidgets()})),(0,s.Z)((0,p.Z)(t),"loadWidgets",(function(){var e=t.props,n=e.dataset,r=e.token,a=t.state,o=a.pagination,c=a.filters;t.setState({loading:!0}),(0,v.Cp)(H(H({includes:"user","page[number]":o.page,"page[size]":o.limit,application:"rw",env:"production"},n&&{dataset:n}),c),{Authorization:"Bearer ".concat(r)},!0).then((function(e){var n=e.widgets,r=e.meta,a=r["total-pages"],c=r["total-items"],i=H(H({},o),{},{size:c,pages:a});t.setState({loading:!1,pagination:i,widgets:n.map((function(t){return H(H({},t),{},{owner:t.user?t.user.name||(t.user.email||"").split("@")[0]:"",role:t.user&&t.user.role||"",disabled:"production".split(",").findIndex((function(e){return e===t.env}))<0})}))})})).catch((function(e){t.setState({error:e})}))})),t}return(0,o.Z)(n,[{key:"componentDidMount",value:function(){var t=this.props.dataset;this.loadWidgets(),t&&this.loadDataset()}},{key:"render",value:function(){var t=this.state,e=t.loading,n=t.pagination,r=t.widgets,a=t.error,o=t.dataset,c=this.props.dataset,i=o&&"production".split(",").findIndex((function(t){return t===o.env}))<0;return(0,P.jsxs)("div",{className:"c-widgets-table",children:[(0,P.jsx)(m.Z,{className:"-light",isLoading:e}),a&&(0,P.jsxs)("p",{children:["Error:",a]}),(0,P.jsx)(b.Z,{filtersChange:this.onFiltersChange}),(0,P.jsx)(g.Z,{input:{placeholder:"Search widget"},link:{label:"New widget",route:"/admin/data/widgets/new?dataset=".concat(c)},onSearch:this.onSearch,disableButton:i}),!a&&(0,P.jsx)(Z.Z,{columns:[{label:"Title",value:"name",td:k},{label:"Published",value:"published",td:N},{label:"Owner",value:"owner",td:A},{label:"Role",value:"role",td:M},{label:"Environment",value:"env"}],actions:{show:!0,list:[{name:"Edit",params:{tab:"widgets",subtab:"edit",id:"{{id}}",datasetID:c},show:!0,component:z},{name:"Remove",params:{tab:"widgets",subtab:"remove",id:"{{id}}"},component:U}]},sort:{field:"name",value:1},filters:!1,data:r,onChangePage:this.onChangePage,pagination:n,onRowDelete:this.onRemoveWidget})]})}}]),n}(l.PureComponent);Q.defaultProps={dataset:null};var V=Q,$=(0,f.ns)(V);function X(t){var e=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}}();return function(){var n,r=(0,u.Z)(t);if(e){var a=(0,u.Z)(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return(0,i.Z)(this,n)}}var tt=function(t){(0,c.Z)(n,t);var e=X(n);function n(){return(0,a.Z)(this,n),e.apply(this,arguments)}return(0,o.Z)(n,[{key:"render",value:function(){var t=this.props.dataset;return(0,P.jsx)("div",{className:"c-widgets-index",children:(0,P.jsx)($,{dataset:t})})}}]),n}(l.PureComponent);(0,s.Z)(tt,"defaultProps",{dataset:null});var et=tt,nt=(0,r.connect)((function(t){return{user:t.user}}),null)(et)},14604:function(t,e,n){n.d(e,{N:function(){return a},W:function(){return r}});var r={ADMIN:"ADMIN",USER:"USER",MANAGER:"MANAGER",ALL:"ALL"},a=[{value:r.ALL,label:"All content"},{value:r.ADMIN,label:"Admin content"}]},90540:function(t,e,n){n.d(e,{Z:function(){return Z}});var r=n(92777),a=n(82262),o=n(10748),c=n(45959),i=n(63553),u=n(37247),s=n(59499),l=n(67294),f=n(94184),p=n.n(f),d=n(80769),h=n(14604),v=n(85893);function y(t){var e=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}}();return function(){var n,r=(0,u.Z)(t);if(e){var a=(0,u.Z)(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return(0,i.Z)(this,n)}}var m=function(t){(0,c.Z)(n,t);var e=y(n);function n(){var t;(0,r.Z)(this,n);for(var a=arguments.length,c=new Array(a),i=0;i<a;i++)c[i]=arguments[i];return t=e.call.apply(e,[this].concat(c)),(0,s.Z)((0,o.Z)(t),"onOwnerChange",(function(e){t.props.filtersChange({key:"user.role",value:e})})),t}return(0,a.Z)(n,[{key:"render",value:function(){var t=this.props.className,e=p()((0,s.Z)({"c-filters":!0},t,!!t));return(0,v.jsx)("div",{className:e,children:(0,v.jsx)(d.Z,{name:"owner-filter",properties:{default:h.W.ADMIN},options:h.N,onChange:this.onOwnerChange})})}}]),n}(l.PureComponent);(0,s.Z)(m,"defaultProps",{className:null});var Z=m},80769:function(t,e,n){var r=n(92777),a=n(82262),o=n(10748),c=n(45959),i=n(63553),u=n(37247),s=n(59499),l=(n(67294),n(45697)),f=n.n(l),p=n(12654),d=n(85893);function h(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function v(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};
1e%2?h(Object(n),!0).forEach((function(e){(0,s.Z)(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function y(t){var e=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}}();return function(){var n,r=(0,u.Z)(t);if(e){var a=(0,u.Z)(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return(0,i.Z)(this,n)}}var m=function(t){(0,c.Z)(n,t);var e=y(n);function n(){var t;(0,r.Z)(this,n);for(var a=arguments.length,c=new Array(a),i=0;i<a;i++)c[i]=arguments[i];return t=e.call.apply(e,[this].concat(c)),(0,s.Z)((0,o.Z)(t),"state",{value:t.props.properties.default}),t}return(0,a.Z)(n,[{key:"triggerChange",value:function(t){var e=this;this.setState({value:t.currentTarget.value},(function(){e.triggerValidate(),e.props.onChange&&e.props.onChange(e.state.value)}))}},{key:"render",value:function(){var t=this,e=this.props,n=e.name,r=e.properties,a=e.options,o=this.state.value;return(0,d.jsx)("div",{className:"c-radio-box ".concat(this.props.className),children:a.map((function(e){return(0,d.jsxs)("div",{className:"c-radio",children:[(0,d.jsx)("input",v(v({},r),{},{type:"radio",name:n,id:"radio-".concat(n,"-").concat(e.value),value:e.value,checked:e.value===o,onChange:t.triggerChange})),(0,d.jsxs)("label",{htmlFor:"radio-".concat(n,"-").concat(e.value),children:[(0,d.jsx)("span",{}),e.label]})]},"".concat(e.value))}))})}}]),n}(p.Z);m.propTypes={name:f().string.isRequired,options:f().array.isRequired,properties:f().object.isRequired,className:f().string,onChange:f().func},e.Z=m},80353:function(t,e,n){n.d(e,{ns:function(){return f}});var r=n(16835),a=n(59499),o=(n(87794),n(48633)),c=n(88767),i=n(7301),u=(n(69885),n(31137),n(37629),n(85893));function s(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function l(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?s(Object(n),!0).forEach((function(e){(0,a.Z)(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}new c.QueryClient;var f=function(t){return function(e){var n=(0,i.P)().data,a=(0,o.kP)(),c=(0,r.Z)(a,2),s=c[0],f=c[1];if(f)return null;if(t.prototype.render)return(0,u.jsx)(t,l({session:s,loading:f,user:n,token:null===s||void 0===s?void 0:s.accessToken},e));throw new Error(["You passed a function component, `withSession` is not needed.","You can `useSession` directly in your component."].join("\n"))}}},17481:function(t,e,n){n.d(e,{Z:function(){return M}});var r=n(14416),a=n(52411),o=n(73698),c=n(89640),i=n(11180),u=n(92777),s=n(82262),l=n(10748),f=n(45959),p=n(63553),d=n(37247),h=n(59499),v=n(67294),y=n(94184),m=n.n(y),Z=n(11163),g=n(82189),b=n(96602),R=n(58350),j=n(9008),O=n.n(j),P=n(85893);function x(t){var e=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}}();return function(){var n,r=(0,d.Z)(t);if(e){var a=(0,d.Z)(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return(0,p.Z)(this,n)}}var w=function(t){(0,f.Z)(n,t);var e=x(n);function n(){return(0,u.Z)(this,n),e.apply(this,arguments)}return(0,s.Z)(n,[{key:"render",value:function(){var t=this.props,e=t.title,n=t.description;return(0,P.jsxs)(O(),{children:[(0,P.jsxs)("title",{children:[e," | RW Content Manager"]}),(0,P.jsx)("meta",{name:"description",content:n}),(0,P.jsx)("meta",{name:"viewport",content:"width=device-width, initial-scale=1"}),(0,P.jsx)("meta",{name:"author",content:"Vizzuality"}),(0,P.jsx)("link",{rel:"icon",href:"/favicon.ico"}),(0,P.jsx)("link",{rel:"stylesheet",media:"screen",href:"https://fonts.googleapis.com/css?family=Lato:400,300,700",display:"swap"}),(0,P.jsx)("meta",{name:"theme-color",content:"#A5177E"}),(0,P.jsx)("meta",{name:"msapplication-navbutton-color",content:"#A5177E"}),(0,P.jsx)("meta",{name:"apple-mobile-web-app-capable",content:"yes"}),(0,P.jsx)("meta",{name:"apple-mobile-web-app-status-bar-style",content:"black-translucent"})]})}}]),n}(v.Component),k=n(15956),C=n(60679),S=n(75100),N=n(16938),B=n(61638),D=n(62674);function A(t){var e=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}}();return function(){var n,r=(0,d.Z)(t);if(e){var a=(0,d.Z)(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return(0,p.Z)(this,n)}}var E=function(t){(0,f.Z)(n,t);var e=A(n);function n(){var t;(0,u.Z)(this,n);for(var r=arguments.length,a=new Array(r),o=0;o<r;o++)a[o]=arguments[o];return t=e.call.apply(e,[this].concat(a)),(0,h.Z)((0,l.Z)(t),"state",{modalOpen:!1}),t}return(0,s.Z)(n,[{key:"UNSAFE_componentWillMount",value:function(){this.props.toggleTooltip(!1)}},{key:"componentDidMount",value:function(){var t=this.props,e=t.router,n=t.updateIsLoading;
1e.events.on("routeChangeStart",(function(){n(!0),g.Z&&g.Z.Component.instance&&g.Z.show()})),e.events.on("routeChangeComplete",(function(){n(!1),g.Z&&g.Z.Component.instance&&g.Z.hideAll()}))}},{key:"UNSAFE_componentWillReceiveProps",value:function(t){this.state.modalOpen!==t.modal.open&&this.setState({modalOpen:t.modal.open})}},{key:"render",value:function(){var t=this.props,e=t.title,n=t.description,r=t.pageHeader,a=t.modal,o=t.className,c=t.toggleModal,i=t.setModalOptions,u=this.state.modalOpen,s=m()("l-page",(0,h.Z)({},o,!!o));return(0,P.jsxs)("div",{id:"#main",className:s,children:[(0,P.jsx)(w,{title:e,description:n}),(0,P.jsx)(D.Z,{}),(0,P.jsx)(R.Icons,{}),(0,P.jsx)(b.Z,{}),(0,P.jsx)(g.Z.Component,{}),(0,P.jsx)(k.ZP,{pageHeader:r}),this.props.children,(0,P.jsx)(C.Z,{}),(0,P.jsx)(B.Z,{}),(0,P.jsx)(S.Z,{open:u,options:a.options,loading:a.loading,toggleModal:c,setModalOptions:i}),(0,P.jsx)(N.ZP,{preventDuplicates:!0,transitionIn:"fadeIn",transitionOut:"fadeOut"})]})}}]),n}(v.PureComponent);(0,h.Z)(E,"defaultProps",{className:null});var L=(0,Z.withRouter)(E),M=(0,r.connect)((function(t){return{modal:t.modal}}),{toggleModal:a.$J,setModalOptions:a.o9,toggleTooltip:o.Zm,updateIsLoading:c.B,setLocale:i.i_})(L)}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.