mediacms/static/js/manage-users.js

1 wiersz
5.1 KiB
JavaScript

!function(){"use strict";var e={6266:function(e,t,n){var r=n(2667),o=(n(5101),n(6394),n(3080),n(4669),n(5466)),s=n(3074),u=n.n(s),i=n(8204),a=n(4426),l=n(8349),c=n(1397),f=n(1784);function p(e){return(p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function h(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function g(e,t){return(g=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(e,t){return!t||"object"!==p(t)&&"function"!=typeof t?m(e):t}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function b(e,t,n){return e+"?"+t+(""===t?"":"&")+"page="+n}var v=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&g(e,t)}(i,e);var t,n,r,s,u=(r=i,s=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=d(r);if(s){var n=d(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return y(this,e)});function i(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),(t=u.call(this,e,"manage-users")).state={resultsCount:null,requestUrl:e.api_url,currentPage:1,sortingArgs:"",sortBy:"add_date",ordering:"desc",refresh:0},t.getCountFunc=t.getCountFunc.bind(m(t)),t.onTablePageChange=t.onTablePageChange.bind(m(t)),t.onColumnSortClick=t.onColumnSortClick.bind(m(t)),t.onItemsRemoval=t.onItemsRemoval.bind(m(t)),t.onItemsRemovalFail=t.onItemsRemovalFail.bind(m(t)),t}return t=i,(n=[{key:"onTablePageChange",value:function(e,t){this.setState({currentPage:t,requestUrl:b(this.props.api_url,this.state.sortingArgs,t)})}},{key:"getCountFunc",value:function(e){this.setState({resultsCount:e})}},{key:"onColumnSortClick",value:function(e,t){var n="sort_by="+e+"&ordering="+t;this.setState({sortBy:e,ordering:t,sortingArgs:n,requestUrl:b(this.props.api_url,n,this.state.currentPage)})}},{key:"onItemsRemoval",value:function(e){this.setState({resultsCount:null,refresh:this.state.refresh+1,requestUrl:this.props.api_url},(function(){e?l.wN("The users deleted successfully.","usersRemovalSucceed"):l.wN("The user deleted successfully.","userRemovalSucceed")}))}},{key:"onItemsRemovalFail",value:function(e){e?l.wN("The users removal failed. Please try again.","usersRemovalFailed"):l.wN("The user removal failed. Please try again.","userRemovalFailed")}},{key:"pageContent",value:function(){return o.createElement(c._,{title:this.props.title+(null===this.state.resultsCount?"":" ("+this.state.resultsCount+")"),className:"search-results-wrap items-list-hor"},o.createElement(f.x,{pageItems:50,manageType:"users",key:this.state.requestUrl+"["+this.state.refresh+"]",itemsCountCallback:this.getCountFunc,requestUrl:this.state.requestUrl,onPageChange:this.onTablePageChange,sortBy:this.state.sortBy,ordering:this.state.ordering,onRowsDelete:this.onItemsRemoval,onRowsDeleteFail:this.onItemsRemovalFail,onClickColumnSort:this.onColumnSortClick}))}}])&&h(t.prototype,n),i}(i.T);v.propTypes={title:u().string.isRequired,api_url:u().string.isRequired},v.defaultProps={title:"Manage users",api_url:a.Z.get("api-manage-users")},(0,r.X)("page-manage-users",v)}},t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={exports:{}};return e[r].call(o.exports,o,o.exports,n),o.exports}n.m=e,n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.j=611,function(){var e={611:0},t=[[6266,431]],r=function(){};function o(){for(var r,o=0;o<t.length;o++){for(var s=t[o],u=!0,i=1;i<s.length;i++){var a=s[i];0!==e[a]&&(u=!1)}u&&(t.splice(o--,1),r=n(n.s=s[0]))}return 0===t.length&&(n.x(),n.x=function(){}),r}n.x=function(){n.x=function(){},u=u.slice();for(var e=0;e<u.length;e++)s(u[e]);return(r=o)()};var s=function(o){for(var s,u,a=o[0],l=o[1],c=o[2],f=o[3],p=0,h=[];p<a.length;p++)u=a[p],n.o(e,u)&&e[u]&&h.push(e[u][0]),e[u]=0;for(s in l)n.o(l,s)&&(n.m[s]=l[s]);for(c&&c(n),i(o);h.length;)h.shift()();return f&&t.push.apply(t,f),r()},u=self.webpackChunk_mediacms_frontend=self.webpackChunk_mediacms_frontend||[],i=u.push.bind(u);u.push=s}(),n.x()}();