UNPKG

cluedin-widget

Version:
1 lines 3.31 kB
(window.webpackJsonp=window.webpackJsonp||[]).push([[6],{1778:function(e,n,t){"use strict";var a=t(20);t.d(n,"b",function(){return r}),t.d(n,"c",function(){return o}),t.d(n,"a",function(){return c});var r=function(){return Object(a.a)("GET","api/v1/clean/getprojects").then(a.e).then(function(e){return e.map(function(e){var n=e.name,t=e.id,a=e.rowCount,r=e.created,o=e.modified,c=e.importOptionMetadata,i=void 0===c?[]:c;return{name:n,id:t,rowCount:a,created:r,modified:o,fileSource:i&&i[0]&&i[0].fileSource||null}})})},o=function(e){return Object(a.a)("POST","api/v1/clean/saveproject?projectId=".concat(e))},c=function(e){return Object(a.a)("POST","api/v1/clean/createprojects",e)}},2204:function(e,n,t){"use strict";t.r(n);var a=t(2),r=t.n(a),o=t(11),c=t.n(o),i=t(12),s=t.n(i),u=t(13),v=t.n(u),l=t(14),p=t.n(l),d=t(15),h=t.n(d),g=t(26),f=t.n(g),S=t(3),m=t.n(S),b=t(0),w=t.n(b),y=t(8),j=t(396),E=t(54),O=t(17),k=t(9),T=t(138),C=t(575),x=t(10),I=t(1778),B=x.j.cluedInCleanUrl,q={border:0,margin:"-1px",width:"100%",height:"calc(100vh - 158px)",transition:"all 450ms cubic-bezier(0.23, 1, 0.32, 1) "},H=function(e){function n(e){var t;return c()(this,n),t=v()(this,p()(n).call(this,e)),m()(f()(f()(t)),"handleSaveRequest",function(){var e=t.props,n=e.match,a=(n=void 0===n?{}:n).params.id,r=e.onSaveSuccess,o=e.onSaveError;Object(I.c)(a).catch(function(e){o(),t.setState({saved:!1,isSaving:!1,errorSaving:e||!0})}).then(function(e){var n={};n=200===e.status?{saved:!0,isSaving:!1,errorSaving:!1}:{saved:!1,isSaving:!1,errorSaving:!0},r(),t.setState(n)}).catch(function(e){o(),t.setState({saved:!1,isSaving:!1,errorSaving:e||!0})}),t.setState({isSaving:!0})}),t.state={changesHaveBeenSaved:!1,isSaving:!1,saved:!1,errorSaving:!1},t}return h()(n,e),s()(n,[{key:"render",value:function(){var e=this.props.match,n=(e=void 0===e?{}:e).params.id,t=this.state,a=t.changesHaveBeenSaved,o=t.isSaving;return w.a.createElement(C.a,{subTitle:w.a.createElement(E.Flex,{style:{marginLeft:"auto"}},w.a.createElement(O.Button,{icon:w.a.createElement(k.Upload,null),loading:o,type:"primary",text:"Save",disabled:o,onClick:this.handleSaveRequest}))},w.a.createElement("div",{style:{borderTop:"1px solid #cecece"}},w.a.createElement("iframe",{style:r()({},q,o?{opacity:.4,pointerEvents:"none"}:{opacity:1,pointerEvents:"all"}),src:"".concat(B,"project?project=").concat(n)})),w.a.createElement(j.a,{when:!a,message:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return["you are navigating to ".concat(e.pathname),"Do not forget to save your changes!","To save your changes,",'click "Cancel" on this popup, then click the save button (upper right corner)',"or,",'click "OK" to abandon all changes and navigate away to '.concat(e.pathname," (changes will not be persisted)")].join("\n")}}))}}]),n}(b.Component);n.default=Object(y.connect)(function(){return{}},function(e){return{onSaveSuccess:function(){return e(Object(T.showSuccess)({message:"Your changes have been saved on the server! It will take a bit of time to process. We will notify you once it is done."}))},onSaveError:function(){return e(Object(T.showError)({message:"An error occurred while attempting to save your changes. Try again in a few seconds. If the issue persists, please contact our support (support@cluedin.com)"}))}}})(H)}}]);