mediacms/static/js/manage-users.js

1 line
5.1 KiB
JavaScript

!function(){"use strict";var e={6266:function(e,t,n){var r=n(2667),o=(n(5101),n(5466)),u=n(3074),s=n.n(u),i=n(8204),a=n(4426),l=n(8349),c=n(9174),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,u,s=(r=i,u=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(u){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=s.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:s().string.isRequired,api_url:s().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.x=function(){},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(){},o=function(o,u){for(var s,i,a=u[0],l=u[1],c=u[2],f=u[3],p=0,h=[];p<a.length;p++)i=a[p],n.o(e,i)&&e[i]&&h.push(e[i][0]),e[i]=0;for(s in l)n.o(l,s)&&(n.m[s]=l[s]);for(c&&c(n),o&&o(u);h.length;)h.shift()();return f&&t.push.apply(t,f),r()},u=self.webpackChunk_mediacms_frontend=self.webpackChunk_mediacms_frontend||[];function s(){for(var r,o=0;o<t.length;o++){for(var u=t[o],s=!0,i=1;i<u.length;i++){var a=u[i];0!==e[a]&&(s=!1)}s&&(t.splice(o--,1),r=n(n.s=u[0]))}return 0===t.length&&(n.x(),n.x=function(){}),r}u.forEach(o.bind(null,0)),u.push=o.bind(null,u.push.bind(u));var i=n.x;n.x=function(){return n.x=i||function(){},(r=s)()}}(),n.x()}();