system_settings 0.6.2 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/frontend/build/asset-manifest.json +17 -7
- data/frontend/build/index.html +1 -1
- data/frontend/build/precache-manifest.797e3712a2c4d9798fbd0aa0c90a743f.js +22 -0
- data/frontend/build/service-worker.js +1 -1
- data/frontend/build/static/css/{main.879d159f.chunk.css → main.04fc5f62.chunk.css} +2 -1
- data/frontend/build/static/css/main.04fc5f62.chunk.css.map +1 -0
- data/frontend/build/static/js/2.78beccc6.chunk.js +2 -0
- data/frontend/build/static/js/2.78beccc6.chunk.js.map +1 -0
- data/frontend/build/static/js/main.4c7bae4f.chunk.js +2 -0
- data/frontend/build/static/js/main.4c7bae4f.chunk.js.map +1 -0
- data/frontend/build/static/js/{runtime~main.ea5ad98e.js → runtime-main.ffc5e8a3.js} +2 -1
- data/frontend/build/static/js/runtime-main.ffc5e8a3.js.map +1 -0
- data/lib/system_settings/version.rb +1 -1
- metadata +11 -7
- data/frontend/build/precache-manifest.c31853abffc7c301755b0e5b8443e875.js +0 -22
- data/frontend/build/static/js/2.8729aa12.chunk.js +0 -1
- data/frontend/build/static/js/main.99494978.chunk.js +0 -1
@@ -1 +0,0 @@
|
|
1
|
-
(window.webpackJsonpsystem_settings_frontend=window.webpackJsonpsystem_settings_frontend||[]).push([[0],{117:function(e,t,a){e.exports={container:"NotFoundPage_container__2g6QR"}},120:function(e,t,a){},121:function(e,t,a){e.exports={container:"ButtonBar_container__phfXp"}},122:function(e,t,a){e.exports={wrap:"ClassicSpinner_wrap__3gt1R"}},124:function(e,t,a){e.exports=a(239)},196:function(e,t,a){},22:function(e,t,a){e.exports={table:"ListPage_table__3BJUy","empty-tr":"ListPage_empty-tr__Z37SG",name:"ListPage_name__3WwZr",description:"ListPage_description__31PRS",value:"ListPage_value__1VJLD",actions:"ListPage_actions__1GibV"}},238:function(e,t,a){},239:function(e,t,a){"use strict";a.r(t);var n=a(0),r=a.n(n),s=a(60),c=a(11),i=a(18),o=a(15),u=a(243),l=a(19),p=a(12),m=a.n(p),f=a(23),h=a(46),g=a(114),b=a.n(g),d=a(115);function y(e){var t=new b.a(window.__SYSTEM_SETTINGS_BASENAME__),a=Object(d.join)(t.pathname,"api",e);return t.set("pathname",a),t.href}function v(e,t){var a=new Promise(function(t){return window.setTimeout(function(){return t(e)},e)});return new Promise(function(e,n){t.then(function(t){return a.then(function(){return e(t)})},function(e){return a.then(function(){return n(e)})})})}var E="LIST_FETCH_IN_PROGRESS",O="LIST_FETCH_SUCCESSFUL",_="LIST_FETCH_FAILED";function S(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),a.push.apply(a,n)}return a}function j(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?S(a,!0).forEach(function(t){Object(l.a)(e,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):S(a).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}var w={fetching:!0,fetchErrorMessage:null,fetchSuccessful:null,page:0,items:[],totalCount:0},k=a(123),N="SETTING_FETCH_IN_PROGRESS",P="SETTING_FETCH_SUCCESSFUL",T="SETTING_FETCH_FAILED",C="SETTING_SAVE_IN_PROGRESS",x="SETTING_SAVE_SUCCESSFUL",L="SETTING_SAVE_FAILED";function I(e){return function(){var t=Object(f.a)(m.a.mark(function t(a){var n,r,s,c,i;return m.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=y("settings/".concat(e)),t.prev=1,a({type:N}),t.next=5,v(50,h.a.get(n));case 5:if((r=t.sent).ok){t.next=8;break}throw new Error(r.statusText);case 8:return s=r.headers.get("Authenticity-Token"),t.next=11,r.json();case 11:c=t.sent,a({type:P,authenticityToken:s,attributes:c}),t.next=20;break;case 15:throw t.prev=15,t.t0=t.catch(1),i="HTTPError"===t.t0.name?"Network request status: ".concat(t.t0.response.status," ").concat(t.t0.message):t.t0.message,a({type:T,errorMessage:i}),t.t0;case 20:case"end":return t.stop()}},t,null,[[1,15]])}));return function(e){return t.apply(this,arguments)}}()}function M(e){return function(t,a){return a.headers.set("X-CSRF-Token",e)}}function D(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),a.push.apply(a,n)}return a}function A(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?D(a,!0).forEach(function(t){Object(l.a)(e,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):D(a).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}var F={attributes:{},authenticityToken:null,fetching:!0,fetchErrorMessage:null,fetchSuccessful:null,saving:!1,lastSaveSuccessful:null,saveErrorMessage:null},R=Object(c.b)({list:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:w,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case E:return j({},e,{fetching:!0});case O:return j({},e,{fetching:!1,fetchSuccessful:!0,items:t.data.items.map(function(e){return{id:e.id,type:e.type,name:e.name,value:e.value,description:e.description}}),page:t.page,totalCount:t.data.total_count});case _:return j({},e,{fetching:!1,fetchSuccessful:!1,items:[],fetchErrorMessage:t.errorMessage,page:t.page});default:return e}},setting:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:F,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case N:return A({},e,{fetching:!0,fetchSuccessful:null,fetchErrorMessage:null});case P:return A({},e,{fetching:!1,fetchSuccessful:!0,attributes:t.attributes,authenticityToken:t.authenticityToken});case T:return A({},e,{fetching:!1,fetchSuccessful:!1,fetchErrorMessage:t.errorMessage});case C:return A({},e,{saving:!0,lastSaveSuccessful:null,saveErrorMessage:null});case x:return A({},e,{saving:!1,lastSaveSuccessful:!0});case L:return A({},e,{saving:!1,lastSaveSuccessful:!1,saveErrorMessage:t.errorMessage});default:return e}},form:u.a}),B=a(6),q=a(10),G=a(8),V=a(4),H=a(7),U=a(21),z=a(33),J=a(30),Y=a.n(J),W=a(117),X=a.n(W),Z=function(e){function t(){return Object(B.a)(this,t),Object(G.a)(this,Object(V.a)(t).apply(this,arguments))}return Object(H.a)(t,e),Object(q.a)(t,[{key:"render",value:function(){return r.a.createElement("div",{className:X.a.container},"Page not found")}}]),t}(n.Component),Q=a(22),K=a.n(Q),$=a(41),ee=a.n($),te=a(49),ae=a.n(te),ne=function(e){function t(){return Object(B.a)(this,t),Object(G.a)(this,Object(V.a)(t).apply(this,arguments))}return Object(H.a)(t,e),Object(q.a)(t,[{key:"render",value:function(){var e=this.props.description;return r.a.createElement("div",{className:ae.a.wrap},r.a.createElement("div",{className:ae.a.container},r.a.createElement("div",{className:ae.a["error-large"]},"An error occurred while loading the page"),r.a.createElement("div",{className:ae.a["error-small"]},e)))}}]),t}(r.a.Component),re=(a(196),a(64)),se=a.n(re),ce=se.a.start,ie=se.a.done,oe=(se.a.inc,a(1)),ue=a.n(oe),le=a(65),pe=a.n(le),me=function(e){function t(){return Object(B.a)(this,t),Object(G.a)(this,Object(V.a)(t).apply(this,arguments))}return Object(H.a)(t,e),Object(q.a)(t,[{key:"formattedValue",value:function(){var e=this.props,t=e.type,a=e.value;switch(t){case"SystemSettings::StringListSetting":case"SystemSettings::IntegerListSetting":return a?a.map(function(e,t){return r.a.createElement("span",{key:t,className:pe.a.section},e.toString())}):null;default:return r.a.createElement("span",{className:pe.a.section},a.toString())}}},{key:"render",value:function(){return r.a.createElement("span",{className:pe.a.wrap},this.formattedValue())}}]),t}(r.a.Component),fe=(ue.a.string.isRequired,ue.a.any.isRequired,a(118)),he=a.n(fe),ge=function(e){function t(){var e,a;Object(B.a)(this,t);for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return(a=Object(G.a)(this,(e=Object(V.a)(t)).call.apply(e,[this].concat(r)))).columnCount=4,a}return Object(H.a)(t,e),Object(q.a)(t,[{key:"componentDidMount",value:function(){this.initFetch()}},{key:"initFetch",value:function(){this.props.fetch(this.activePage(),25),ce()}},{key:"activePage",value:function(){return parseInt(this.props.match.params.page)}},{key:"componentDidUpdate",value:function(e,t,a){this.props.location!==e.location&&this.initFetch(),!this.props.fetching&&e.fetching&&ie()}},{key:"handlePageChange",value:function(e){var t=Object(U.f)(this.props.match.path,{page:e});this.props.history.push(t)}},{key:"pagination",value:function(){var e=this.props.itemsCount;if(!(e<=25))return r.a.createElement(he.a,{key:"pagination",innerClass:ee.a.pagination,itemClass:ee.a.item,disabledClass:ee.a["item--disabled"],activeClass:ee.a["item--active"],linkClass:ee.a.link,hideFirstLastPages:!0,activePage:this.activePage(),itemsCountPerPage:25,totalItemsCount:e,pageRangeDisplayed:5,onChange:this.handlePageChange.bind(this)})}},{key:"render",value:function(){var e=this.props,t=e.fetching,a=e.fetchSuccessful,n=e.fetchErrorMessage,s=e.items;return t?null:a?[r.a.createElement("table",{key:"table",className:K.a.table},r.a.createElement("thead",null,r.a.createElement("tr",null,r.a.createElement("th",{className:K.a.name},"Name"),r.a.createElement("th",{className:K.a.description},"Description"),r.a.createElement("th",{className:K.a.value},"Value"),r.a.createElement("th",{className:K.a.actions}))),r.a.createElement("tbody",null,0===s.length&&r.a.createElement("tr",{className:K.a["empty-tr"]},r.a.createElement("td",{colSpan:this.columnCount},"No settings")),s.length>0&&s.map(function(e){return r.a.createElement("tr",{key:e.id},r.a.createElement("td",{className:K.a.name},r.a.createElement(z.a,{className:"sysname",to:"/settings/".concat(e.id)},e.name)),r.a.createElement("td",{className:K.a.description},e.description),r.a.createElement("td",{className:K.a.value},r.a.createElement(me,{type:e.type,value:e.value})),r.a.createElement("td",{className:K.a.actions},r.a.createElement(z.a,{className:K.a["primary-action"],to:"/settings/".concat(e.id,"/edit")},"Edit")))}))),this.pagination()]:r.a.createElement(ne,{description:n})}}]),t}(n.Component),be=Object(o.b)(function(e){return{page:e.list.page,items:e.list.items,itemsCount:e.list.totalCount,fetching:e.list.fetching,fetchSuccessful:e.list.fetchSuccessful,fetchErrorMessage:e.list.fetchErrorMessage}},function(e){return{fetch:function(t,a){(function(e,t){return function(){var a=Object(f.a)(m.a.mark(function a(n){var r,s,c;return m.a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return r=y("settings"),a.prev=1,n({type:E}),a.next=5,v(50,h.a.get(r,{searchParams:{page:e,per:t}}).json());case 5:s=a.sent,n({type:O,data:s,page:e}),a.next=14;break;case 9:throw a.prev=9,a.t0=a.catch(1),c="HTTPError"===a.t0.name?"Network request status: ".concat(a.t0.response.status," ").concat(a.t0.message):a.t0.message,n({type:_,errorMessage:c,page:e}),a.t0;case 14:case"end":return a.stop()}},a,null,[[1,9]])}));return function(e){return a.apply(this,arguments)}}()})(t,a)(e).catch(function(){})}}})(ge),de=a(37),ye=";";function ve(e){switch(e){case"SystemSettings::StringSetting":return"String";case"SystemSettings::StringListSetting":return"List of strings";case"SystemSettings::IntegerSetting":return"Integer";case"SystemSettings::IntegerListSetting":return"List of integers";case"SystemSettings::BooleanSetting":return"Boolean";default:return"Unknown"}}function Ee(e,t){switch(e){case"SystemSettings::StringListSetting":return t.map(function(e){return e&&e.replace?e.replace(ye,"\\".concat(ye)):""}).join(ye);case"SystemSettings::IntegerListSetting":return t?t.join(ye):t;case"SystemSettings::BooleanSetting":default:return t}}var Oe=a(66),_e=a.n(Oe),Se=function(e){function t(){return Object(B.a)(this,t),Object(G.a)(this,Object(V.a)(t).apply(this,arguments))}return Object(H.a)(t,e),Object(q.a)(t,[{key:"render",value:function(){var e=this.props,t=e.name,a=e.children;return r.a.createElement("div",{className:_e.a.wrap},r.a.createElement("div",{className:_e.a.name},t),r.a.createElement("div",{className:_e.a.value},a))}}]),t}(n.PureComponent),je=(ue.a.string.isRequired,ue.a.any,a(120)),we=a.n(je),ke=a(121),Ne=a.n(ke),Pe=function(e){function t(){return Object(B.a)(this,t),Object(G.a)(this,Object(V.a)(t).apply(this,arguments))}return Object(H.a)(t,e),Object(q.a)(t,[{key:"render",value:function(){var e=this.props.children;return r.a.createElement("div",{className:Ne.a.container},e)}}]),t}(r.a.Component),Te=function(e){function t(e){var a;return Object(B.a)(this,t),(a=Object(G.a)(this,Object(V.a)(t).call(this,e))).goBack=a.goBack.bind(Object(de.a)(a)),a}return Object(H.a)(t,e),Object(q.a)(t,[{key:"componentDidMount",value:function(){var e=this.props.match.params.id;ce(),this.props.fetch(e)}},{key:"componentDidUpdate",value:function(e,t,a){!this.props.fetching&&e.fetching&&ie()}},{key:"goBack",value:function(){var e=this.props.history;"POP"===e.action?e.push("/"):e.goBack()}},{key:"render",value:function(){var e=this.props,t=e.fetching,a=e.fetchSuccessful,n=e.fetchErrorMessage,s=e.attributes,c=s.id,i=s.name,o=s.type,u=s.description,l=s.value;return t?null:a?r.a.createElement("div",{className:we.a.wrap},r.a.createElement(Se,{name:"Name"},r.a.createElement("span",{className:"sysname"},i)),r.a.createElement(Se,{name:"Type",children:ve(o)}),r.a.createElement(Se,{name:"Description",children:u}),r.a.createElement(Se,{name:"Value"},r.a.createElement(me,{type:o,value:l})),r.a.createElement(Pe,null,r.a.createElement(z.a,{className:"button primary",to:"/settings/".concat(c,"/edit")},"Edit"),r.a.createElement("button",{className:"link",onClick:this.goBack},"Back"))):r.a.createElement(ne,{description:n})}}]),t}(n.Component),Ce=Object(o.b)(function(e){return{attributes:e.setting.attributes,fetching:e.setting.fetching,fetchSuccessful:e.setting.fetchSuccessful,fetchErrorMessage:e.setting.fetchErrorMessage}},function(e,t){return{fetch:function(t){return I(t)(e)}}})(Te),xe=a(242),Le=a(240),Ie=a(34),Me=a.n(Ie);function De(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),a.push.apply(a,n)}return a}var Ae=function(e){function t(){return Object(B.a)(this,t),Object(G.a)(this,Object(V.a)(t).apply(this,arguments))}return Object(H.a)(t,e),Object(q.a)(t,[{key:"render",value:function(){var e=this.props,t=e.id,a=e.type,n=e.label,s=e.hint,c=e.placeholder,i=e.input,o=e.meta,u=o.touched,l=o.error,p=Array.isArray(l)?l.join("; "):l;return r.a.createElement("div",{className:Me.a.wrap},r.a.createElement("label",{className:Me.a.label,htmlFor:t},n),r.a.createElement("div",{className:Me.a["input-and-error-wrap"]},r.a.createElement("input",Object.assign({id:t,type:a,placeholder:c},i,{className:Me.a.input,style:{width:"".concat(i.value.length,"ch")}})),u&&p&&r.a.createElement("span",{className:Me.a.error},p)),s&&r.a.createElement("div",{className:Me.a.hint},s))}}]),t}(r.a.Component);Ae.defaultProps={type:"text"};!function(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?De(a,!0).forEach(function(t){Object(l.a)(e,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):De(a).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}}({},Le.a,{id:ue.a.string.isRequired,type:ue.a.string.isRequired,label:ue.a.string.isRequired,hint:ue.a.oneOfType([ue.a.string,ue.a.element]),placeholder:ue.a.string});var Fe=a(50),Re=a.n(Fe),Be=a(61),qe=a(122),Ge=a.n(qe);function Ve(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),a.push.apply(a,n)}return a}function He(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?Ve(a,!0).forEach(function(t){Object(l.a)(e,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):Ve(a).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}var Ue=function(e){function t(){return Object(B.a)(this,t),Object(G.a)(this,Object(V.a)(t).apply(this,arguments))}return Object(H.a)(t,e),Object(q.a)(t,[{key:"render",value:function(){var e=this.props,t=e.size,a=e.color,n=e.title,s=e.wrapperStyle,c=Object(Be.a)(e,["size","color","title","wrapperStyle"]);return r.a.createElement("span",{className:Ge.a.wrap,style:He({},s,{width:t,height:t})},r.a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg"},c,{width:t,height:t,viewBox:"0 0 64 64",fill:"none",stroke:a,"aria-labelledby":"title"}),r.a.createElement("title",{id:"title"},n),r.a.createElement("g",{strokeWidth:"4",strokeLinecap:"round"},r.a.createElement("line",{y1:"12",y2:"20",transform:"translate(32,32) rotate(180)"},r.a.createElement("animate",{attributeName:"stroke-opacity",dur:"750ms",values:"1;.85;.7;.65;.55;.45;.35;.25;.15;.1;0;1",repeatCount:"indefinite"})),r.a.createElement("line",{y1:"12",y2:"20",transform:"translate(32,32) rotate(210)"},r.a.createElement("animate",{attributeName:"stroke-opacity",dur:"750ms",values:"0;1;.85;.7;.65;.55;.45;.35;.25;.15;.1;0",repeatCount:"indefinite"})),r.a.createElement("line",{y1:"12",y2:"20",transform:"translate(32,32) rotate(240)"},r.a.createElement("animate",{attributeName:"stroke-opacity",dur:"750ms",values:".1;0;1;.85;.7;.65;.55;.45;.35;.25;.15;.1",repeatCount:"indefinite"})),r.a.createElement("line",{y1:"12",y2:"20",transform:"translate(32,32) rotate(270)"},r.a.createElement("animate",{attributeName:"stroke-opacity",dur:"750ms",values:".15;.1;0;1;.85;.7;.65;.55;.45;.35;.25;.15",repeatCount:"indefinite"})),r.a.createElement("line",{y1:"12",y2:"20",transform:"translate(32,32) rotate(300)"},r.a.createElement("animate",{attributeName:"stroke-opacity",dur:"750ms",values:".25;.15;.1;0;1;.85;.7;.65;.55;.45;.35;.25",repeatCount:"indefinite"})),r.a.createElement("line",{y1:"12",y2:"20",transform:"translate(32,32) rotate(330)"},r.a.createElement("animate",{attributeName:"stroke-opacity",dur:"750ms",values:".35;.25;.15;.1;0;1;.85;.7;.65;.55;.45;.35",repeatCount:"indefinite"})),r.a.createElement("line",{y1:"12",y2:"20",transform:"translate(32,32) rotate(0)"},r.a.createElement("animate",{attributeName:"stroke-opacity",dur:"750ms",values:".45;.35;.25;.15;.1;0;1;.85;.7;.65;.55;.45",repeatCount:"indefinite"})),r.a.createElement("line",{y1:"12",y2:"20",transform:"translate(32,32) rotate(30)"},r.a.createElement("animate",{attributeName:"stroke-opacity",dur:"750ms",values:".55;.45;.35;.25;.15;.1;0;1;.85;.7;.65;.55",repeatCount:"indefinite"})),r.a.createElement("line",{y1:"12",y2:"20",transform:"translate(32,32) rotate(60)"},r.a.createElement("animate",{attributeName:"stroke-opacity",dur:"750ms",values:".65;.55;.45;.35;.25;.15;.1;0;1;.85;.7;.65",repeatCount:"indefinite"})),r.a.createElement("line",{y1:"12",y2:"20",transform:"translate(32,32) rotate(90)"},r.a.createElement("animate",{attributeName:"stroke-opacity",dur:"750ms",values:".7;.65;.55;.45;.35;.25;.15;.1;0;1;.85;.7",repeatCount:"indefinite"})),r.a.createElement("line",{y1:"12",y2:"20",transform:"translate(32,32) rotate(120)"},r.a.createElement("animate",{attributeName:"stroke-opacity",dur:"750ms",values:".85;.7;.65;.55;.45;.35;.25;.15;.1;0;1;.85",repeatCount:"indefinite"})),r.a.createElement("line",{y1:"12",y2:"20",transform:"translate(32,32) rotate(150)"},r.a.createElement("animate",{attributeName:"stroke-opacity",dur:"750ms",values:"1;.85;.7;.65;.55;.45;.35;.25;.15;.1;0;1",repeatCount:"indefinite"})))))}}]),t}(r.a.Component);Ue.defaultProps={color:"currentColor",size:"1rem",title:"Loading\u2026"};var ze=Ue,Je=function(e){function t(){return Object(B.a)(this,t),Object(G.a)(this,Object(V.a)(t).apply(this,arguments))}return Object(H.a)(t,e),Object(q.a)(t,[{key:"render",value:function(){var e=this.props,t=e.hint,a=e.handleSubmit,n=e.myHandleSubmit,s=e.error,c=e.pristine,i=e.submitting,o=e.valueInputType,u=e.backFn;return r.a.createElement("form",{onSubmit:a(n)},r.a.createElement("div",{className:Re.a.fields},r.a.createElement(xe.a,{name:"value",label:"Value",id:"secret_value",type:o,component:Ae,hint:t})),s&&r.a.createElement("div",{className:Re.a["error-wrap"]},r.a.createElement("div",{className:Re.a["error-message"]},r.a.createElement("div",null,"An error occurred while saving the data"),r.a.createElement("div",{className:Re.a["error-small"]},"Network request status: ",s))),r.a.createElement(Pe,null,r.a.createElement("button",{className:"primary",type:"submit",disabled:c||i},r.a.createElement("span",{className:"button-wrap"},r.a.createElement("span",{className:"button-text"},"Save"),i&&r.a.createElement(ze,{wrapperStyle:{marginLeft:"5px"},size:"1.5em"}))),r.a.createElement("button",{className:"link",onClick:u},"Back")))}}]),t}(r.a.Component);Je.defaultProps={};ue.a.number.isRequired,ue.a.string.isRequired,ue.a.string,ue.a.oneOfType([ue.a.string,ue.a.element]),ue.a.string.isRequired,ue.a.func.isRequired,ue.a.func.isRequired,ue.a.bool,ue.a.bool,ue.a.string,ue.a.object,ue.a.string,ue.a.func.isRequired;var Ye=a(241);function We(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),a.push.apply(a,n)}return a}function Xe(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?We(a,!0).forEach(function(t){Object(l.a)(e,t,a[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):We(a).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))})}return e}var Ze=Object(o.b)(function(e){var t=e.setting,a=t.fetchSuccessful,n=t.attributes;return{initialValues:Xe({},n,{value:a?Ee(n.type,n.value):n.value})}},function(e,t){return{myHandleSubmit:function(a){return(n=t.id,r=t.authenticityToken,s={value:a.value},function(){var e=Object(f.a)(m.a.mark(function e(t){var a,c,i,o,u;return m.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=y("settings/".concat(n)),t({type:C}),e.prev=2,e.next=5,v(300,h.a.put(a,{json:s,hooks:{beforeRequest:[M(r)]}}));case 5:return c=e.sent,e.next=8,c.json();case 8:i=e.sent,t({type:x,attributes:i}),e.next=34;break;case 12:if(e.prev=12,e.t0=e.catch(2),t({type:L,errorMessage:e.t0.name}),"HTTPError"!==e.t0.name){e.next=33;break}if(422!==e.t0.response.status){e.next=29;break}return e.prev=17,e.next=20,e.t0.response.json();case 20:o=e.sent,e.next=26;break;case 23:throw e.prev=23,e.t1=e.catch(17),new k.a({_error:e.t0.message});case 26:throw new k.a(o.errors);case 29:throw u="".concat(e.t0.response.status," ").concat(e.t0.message),new k.a({_error:u});case 31:e.next=34;break;case 33:throw new k.a({_error:e.t0.message});case 34:case"end":return e.stop()}},e,null,[[2,12],[17,23]])}));return function(t){return e.apply(this,arguments)}}())(e);var n,r,s}}})(Object(Ye.a)({form:"edit-setting"})(Je)),Qe=function(e){function t(e){var a;return Object(B.a)(this,t),(a=Object(G.a)(this,Object(V.a)(t).call(this,e))).goBack=a.goBack.bind(Object(de.a)(a)),a}return Object(H.a)(t,e),Object(q.a)(t,[{key:"componentDidMount",value:function(){var e=this.props.match.params.id;ce(),this.props.fetch(e)}},{key:"componentDidUpdate",value:function(e,t,a){!this.props.fetching&&e.fetching&&ie()}},{key:"hint",value:function(e){switch(e){case"SystemSettings::StringListSetting":case"SystemSettings::IntegerListSetting":return r.a.createElement(r.a.Fragment,null,"Separate values by ",r.a.createElement("code",null,";")," character.");default:return null}}},{key:"valueInputType",value:function(e){switch(e){case"SystemSettings::BooleanSetting":return"checkbox";default:return"text"}}},{key:"goBack",value:function(){var e=this.props.history;"POP"===e.action?e.push("/"):e.goBack()}},{key:"render",value:function(){var e=this.props,t=e.fetching,a=e.fetchSuccessful,n=e.fetchErrorMessage,s=e.authenticityToken,c=e.attributes,i=c.id,o=c.name,u=c.description,l=c.type;return t?null:a?r.a.createElement("div",null,r.a.createElement(Se,{name:"Name"},r.a.createElement("span",{className:"sysname"},o)),r.a.createElement(Se,{name:"Type"},ve(l)),r.a.createElement(Se,{name:"Description"},u),r.a.createElement(Ze,{id:i,authenticityToken:s,hint:this.hint(l),valueInputType:this.valueInputType(l),backFn:this.goBack})):r.a.createElement(ne,{description:n})}}]),t}(n.Component),Ke=Object(o.b)(function(e){return{attributes:e.setting.attributes,authenticityToken:e.setting.authenticityToken,fetching:e.setting.fetching,fetchSuccessful:e.setting.fetchSuccessful,fetchErrorMessage:e.setting.fetchErrorMessage}},function(e){return{fetch:function(t){I(t)(e).catch(function(){})}}})(Qe),$e=function(e){function t(){return Object(B.a)(this,t),Object(G.a)(this,Object(V.a)(t).apply(this,arguments))}return Object(H.a)(t,e),Object(q.a)(t,[{key:"render",value:function(){return r.a.createElement(U.c,{history:this.props.history},r.a.createElement("div",{className:Y.a.container},r.a.createElement("div",{className:Y.a["header-wrap"]},r.a.createElement("div",{className:Y.a.header},r.a.createElement(z.a,{to:"/",className:Y.a["header-name"]},this.props.name))),r.a.createElement("div",{className:Y.a["header-spacer"]}),r.a.createElement("div",{className:Y.a["content-wrap"]},r.a.createElement("div",{className:Y.a.content},r.a.createElement(U.d,null,r.a.createElement(U.b,{exact:!0,path:"/"},r.a.createElement(U.a,{to:Object(U.f)("/list/:page",{page:1})})),r.a.createElement(U.b,{path:"/list/:page",component:be}),r.a.createElement(U.b,{path:"/settings/:id/edit",component:Ke}),r.a.createElement(U.b,{path:"/settings/:id",component:Ce}),r.a.createElement(U.b,{component:Z}))))))}}]),t}(n.Component);$e.defaultProps={name:"System Settings"};var et=$e,tt=(a(238),Object(c.c)(R)),at=document.getElementById("root");window.__SYSTEM_SETTINGS_BASENAME__||(window.__SYSTEM_SETTINGS_BASENAME__="/system_settings");var nt=Object(i.a)({basename:window.__SYSTEM_SETTINGS_BASENAME__});nt.listen(function(e,t){console.log("The current URL is ".concat(e.pathname).concat(e.search).concat(e.hash)),console.log("The last navigation action was ".concat(t))}),Object(s.render)(r.a.createElement(o.a,{store:tt},r.a.createElement(et,{history:nt})),at)},30:function(e,t,a){e.exports={container:"App_container__6j1zw","header-wrap":"App_header-wrap__3CTKH",header:"App_header__14Wxn","header-name":"App_header-name__XmVJQ","header-spacer":"App_header-spacer__2nhtg","content-wrap":"App_content-wrap__V8jPR",content:"App_content__1dlDM"}},34:function(e,t,a){e.exports={wrap:"LabeledInput_wrap__29803",label:"LabeledInput_label__3s0me","input-and-error-wrap":"LabeledInput_input-and-error-wrap__1WE7-",error:"LabeledInput_error__3HfEM",hint:"LabeledInput_hint__1uKYN"}},41:function(e,t,a){e.exports={pagination:"Pagination_pagination__NJj9X",item:"Pagination_item__2fgd5","item--disabled":"Pagination_item--disabled__27--j","item--active":"Pagination_item--active__1nTy1",link:"Pagination_link__3Iz6l"}},49:function(e,t,a){e.exports={wrap:"PageLoadError_wrap__2WGP9",container:"PageLoadError_container__1vEsn","error-small":"PageLoadError_error-small__243N5"}},50:function(e,t,a){e.exports={"error-wrap":"SettingForm_error-wrap__2mrUQ","error-message":"SettingForm_error-message__2SoFD","error-small":"SettingForm_error-small__2DqG8"}},65:function(e,t,a){e.exports={wrap:"Value_wrap__uZ29f",section:"Value_section__36uaM"}},66:function(e,t,a){e.exports={wrap:"Attribute_wrap__3nYMg",name:"Attribute_name__2w8Tg",value:"Attribute_value__3P12Z"}}},[[124,1,2]]]);
|