From abaf2a928377782f379d82edfdd38e2d62145acf Mon Sep 17 00:00:00 2001 From: Roman Hergenreder Date: Sat, 27 Jun 2020 01:32:32 +0200 Subject: [PATCH] CSRF bugfix + ACL frontend started --- core/Api/Request.class.php | 19 +++++++------- js/admin.min.js | 18 ++++++++++--- src/src/index.js | 2 ++ src/src/views/logs.js | 2 +- src/src/views/permissions.js | 49 ++++++++++++++++++++++++++++++++++++ src/src/views/users.js | 8 ++++++ 6 files changed, 84 insertions(+), 14 deletions(-) create mode 100644 src/src/views/permissions.js diff --git a/core/Api/Request.class.php b/core/Api/Request.class.php index 0e0f55d..dd712ec 100644 --- a/core/Api/Request.class.php +++ b/core/Api/Request.class.php @@ -120,7 +120,6 @@ class Request { return false; } - // TODO: Check this! if($this->externalCall) { $apiKeyAuthorized = false; @@ -136,16 +135,16 @@ class Request { header('HTTP 1.1 401 Unauthorized'); return false; } - } - // CSRF Token - if($this->csrfTokenRequired && !$apiKeyAuthorized) { - // csrf token required + external call - // if it's not a call with API_KEY, check for csrf_token - if (!isset($values["csrf_token"]) || strcmp($values["csrf_token"], $this->user->getSession()->getCsrfToken()) !== 0) { - $this->lastError = "CSRF-Token mismatch"; - header('HTTP 1.1 403 Forbidden'); - return false; + // CSRF Token + if($this->csrfTokenRequired && !$apiKeyAuthorized) { + // csrf token required + external call + // if it's not a call with API_KEY, check for csrf_token + if (!isset($values["csrf_token"]) || strcmp($values["csrf_token"], $this->user->getSession()->getCsrfToken()) !== 0) { + $this->lastError = "CSRF-Token mismatch"; + header('HTTP 1.1 403 Forbidden'); + return false; + } } } diff --git a/js/admin.min.js b/js/admin.min.js index fd26012..df17473 100644 --- a/js/admin.min.js +++ b/js/admin.min.js @@ -11343,7 +11343,7 @@ eval("\nvar content = __webpack_require__(/*! !../../node_modules/css-loader/dis /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ \"./node_modules/react-dom/index.js\");\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _include_adminlte_min_css__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./include/adminlte.min.css */ \"./src/include/adminlte.min.css\");\n/* harmony import */ var _include_adminlte_min_css__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_include_adminlte_min_css__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _include_index_css__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./include/index.css */ \"./src/include/index.css\");\n/* harmony import */ var _include_index_css__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_include_index_css__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _api_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./api.js */ \"./src/api.js\");\n/* harmony import */ var _header_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./header.js */ \"./src/header.js\");\n/* harmony import */ var _sidebar_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./sidebar.js */ \"./src/sidebar.js\");\n/* harmony import */ var _views_users_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./views/users.js */ \"./src/views/users.js\");\n/* harmony import */ var _views_overview_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./views/overview.js */ \"./src/views/overview.js\");\n/* harmony import */ var _views_adduser__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./views/adduser */ \"./src/views/adduser.js\");\n/* harmony import */ var _elements_icon__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./elements/icon */ \"./src/elements/icon.js\");\n/* harmony import */ var _elements_dialog__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./elements/dialog */ \"./src/elements/dialog.js\");\n/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! react-router-dom */ \"./node_modules/react-router-dom/esm/react-router-dom.js\");\n/* harmony import */ var _404__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./404 */ \"./src/404.js\");\n/* harmony import */ var _views_logs__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./views/logs */ \"./src/views/logs.js\");\n/* harmony import */ var _views_pages__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./views/pages */ \"./src/views/pages.js\");\n/* harmony import */ var _views_help__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./views/help */ \"./src/views/help.js\");\n/* harmony import */ var _footer__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./footer */ \"./src/footer.js\");\n/* harmony import */ var _views_edituser__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./views/edituser */ \"./src/views/edituser.js\");\n/* harmony import */ var _views_addgroup__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./views/addgroup */ \"./src/views/addgroup.js\");\n/* harmony import */ var _views_settings__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./views/settings */ \"./src/views/settings.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvar AdminDashboard = /*#__PURE__*/function (_React$Component) {\n _inherits(AdminDashboard, _React$Component);\n\n var _super = _createSuper(AdminDashboard);\n\n function AdminDashboard(props) {\n var _this;\n\n _classCallCheck(this, AdminDashboard);\n\n _this = _super.call(this, props);\n _this.api = new _api_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]();\n _this.state = {\n loaded: false,\n dialog: {\n onClose: function onClose() {\n return _this.hideDialog();\n }\n },\n notifications: []\n };\n return _this;\n }\n\n _createClass(AdminDashboard, [{\n key: \"onUpdate\",\n value: function onUpdate() {\n this.fetchNotifications();\n }\n }, {\n key: \"showDialog\",\n value: function showDialog(message, title) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [\"Close\"];\n var onOption = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;\n var props = {\n show: true,\n message: message,\n title: title,\n options: options,\n onOption: onOption\n };\n this.setState(_objectSpread(_objectSpread({}, this.state), {}, {\n dialog: _objectSpread(_objectSpread({}, this.state.dialog), props)\n }));\n }\n }, {\n key: \"hideDialog\",\n value: function hideDialog() {\n this.setState(_objectSpread(_objectSpread({}, this.state), {}, {\n dialog: _objectSpread(_objectSpread({}, this.state.dialog), {}, {\n show: false\n })\n }));\n }\n }, {\n key: \"fetchNotifications\",\n value: function fetchNotifications() {\n var _this2 = this;\n\n this.api.getNotifications().then(function (res) {\n if (!res.success) {\n _this2.showDialog(\"Error fetching notifications: \" + res.msg, \"Error fetching notifications\");\n } else {\n _this2.setState(_objectSpread(_objectSpread({}, _this2.state), {}, {\n notifications: res.notifications\n }));\n }\n });\n }\n }, {\n key: \"componentDidMount\",\n value: function componentDidMount() {\n var _this3 = this;\n\n this.api.fetchUser().then(function (Success) {\n if (!Success) {\n document.location = \"/admin\";\n } else {\n _this3.fetchNotifications();\n\n setInterval(_this3.onUpdate.bind(_this3), 60 * 1000);\n\n _this3.setState(_objectSpread(_objectSpread({}, _this3.state), {}, {\n loaded: true\n }));\n }\n });\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this4 = this;\n\n if (!this.state.loaded) {\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"b\", null, \"Loading\\u2026 \", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_elements_icon__WEBPACK_IMPORTED_MODULE_10__[\"default\"], {\n icon: \"spinner\"\n }));\n }\n\n this.controlObj = {\n showDialog: this.showDialog.bind(this),\n fetchNotifications: this.fetchNotifications.bind(this),\n api: this.api\n };\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_12__[\"BrowserRouter\"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_header_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"], _extends({}, this.controlObj, {\n notifications: this.state.notifications\n })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_sidebar_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"], _extends({}, this.controlObj, {\n notifications: this.state.notifications\n })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n className: \"content-wrapper p-2\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"section\", {\n className: \"content\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_12__[\"Switch\"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_12__[\"Route\"], {\n path: \"/admin/dashboard\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_views_overview_js__WEBPACK_IMPORTED_MODULE_8__[\"default\"], _extends({}, this.controlObj, {\n notifications: this.state.notifications\n }))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_12__[\"Route\"], {\n exact: true,\n path: \"/admin/users\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_views_users_js__WEBPACK_IMPORTED_MODULE_7__[\"default\"], this.controlObj)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_12__[\"Route\"], {\n path: \"/admin/user/add\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_views_adduser__WEBPACK_IMPORTED_MODULE_9__[\"default\"], this.controlObj)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_12__[\"Route\"], {\n path: \"/admin/user/edit/:userId\",\n render: function render(props) {\n var newProps = _objectSpread(_objectSpread({}, props), _this4.controlObj);\n\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_views_edituser__WEBPACK_IMPORTED_MODULE_18__[\"default\"], newProps);\n }\n }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_12__[\"Route\"], {\n path: \"/admin/group/add\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_views_addgroup__WEBPACK_IMPORTED_MODULE_19__[\"default\"], this.controlObj)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_12__[\"Route\"], {\n path: \"/admin/logs\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_views_logs__WEBPACK_IMPORTED_MODULE_14__[\"default\"], _extends({}, this.controlObj, {\n notifications: this.state.notifications\n }))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_12__[\"Route\"], {\n path: \"/admin/settings\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_views_settings__WEBPACK_IMPORTED_MODULE_20__[\"default\"], this.controlObj)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_12__[\"Route\"], {\n path: \"/admin/pages\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_views_pages__WEBPACK_IMPORTED_MODULE_15__[\"default\"], this.controlObj)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_12__[\"Route\"], {\n path: \"/admin/help\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_views_help__WEBPACK_IMPORTED_MODULE_16__[\"default\"], this.controlObj)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_12__[\"Route\"], {\n path: \"*\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_404__WEBPACK_IMPORTED_MODULE_13__[\"default\"], null))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_elements_dialog__WEBPACK_IMPORTED_MODULE_11__[\"default\"], this.state.dialog))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_footer__WEBPACK_IMPORTED_MODULE_17__[\"default\"], null));\n }\n }]);\n\n return AdminDashboard;\n}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component);\n\nreact_dom__WEBPACK_IMPORTED_MODULE_1___default.a.render( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(AdminDashboard, null), document.getElementById('root'));\n\n//# sourceURL=webpack:///./src/index.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ \"./node_modules/react-dom/index.js\");\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _include_adminlte_min_css__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./include/adminlte.min.css */ \"./src/include/adminlte.min.css\");\n/* harmony import */ var _include_adminlte_min_css__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_include_adminlte_min_css__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _include_index_css__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./include/index.css */ \"./src/include/index.css\");\n/* harmony import */ var _include_index_css__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_include_index_css__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _api_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./api.js */ \"./src/api.js\");\n/* harmony import */ var _header_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./header.js */ \"./src/header.js\");\n/* harmony import */ var _sidebar_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./sidebar.js */ \"./src/sidebar.js\");\n/* harmony import */ var _views_users_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./views/users.js */ \"./src/views/users.js\");\n/* harmony import */ var _views_overview_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./views/overview.js */ \"./src/views/overview.js\");\n/* harmony import */ var _views_adduser__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./views/adduser */ \"./src/views/adduser.js\");\n/* harmony import */ var _elements_icon__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./elements/icon */ \"./src/elements/icon.js\");\n/* harmony import */ var _elements_dialog__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./elements/dialog */ \"./src/elements/dialog.js\");\n/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! react-router-dom */ \"./node_modules/react-router-dom/esm/react-router-dom.js\");\n/* harmony import */ var _404__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./404 */ \"./src/404.js\");\n/* harmony import */ var _views_logs__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./views/logs */ \"./src/views/logs.js\");\n/* harmony import */ var _views_pages__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./views/pages */ \"./src/views/pages.js\");\n/* harmony import */ var _views_help__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./views/help */ \"./src/views/help.js\");\n/* harmony import */ var _footer__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./footer */ \"./src/footer.js\");\n/* harmony import */ var _views_edituser__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./views/edituser */ \"./src/views/edituser.js\");\n/* harmony import */ var _views_addgroup__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./views/addgroup */ \"./src/views/addgroup.js\");\n/* harmony import */ var _views_settings__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./views/settings */ \"./src/views/settings.js\");\n/* harmony import */ var _views_permissions__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./views/permissions */ \"./src/views/permissions.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvar AdminDashboard = /*#__PURE__*/function (_React$Component) {\n _inherits(AdminDashboard, _React$Component);\n\n var _super = _createSuper(AdminDashboard);\n\n function AdminDashboard(props) {\n var _this;\n\n _classCallCheck(this, AdminDashboard);\n\n _this = _super.call(this, props);\n _this.api = new _api_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]();\n _this.state = {\n loaded: false,\n dialog: {\n onClose: function onClose() {\n return _this.hideDialog();\n }\n },\n notifications: []\n };\n return _this;\n }\n\n _createClass(AdminDashboard, [{\n key: \"onUpdate\",\n value: function onUpdate() {\n this.fetchNotifications();\n }\n }, {\n key: \"showDialog\",\n value: function showDialog(message, title) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [\"Close\"];\n var onOption = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;\n var props = {\n show: true,\n message: message,\n title: title,\n options: options,\n onOption: onOption\n };\n this.setState(_objectSpread(_objectSpread({}, this.state), {}, {\n dialog: _objectSpread(_objectSpread({}, this.state.dialog), props)\n }));\n }\n }, {\n key: \"hideDialog\",\n value: function hideDialog() {\n this.setState(_objectSpread(_objectSpread({}, this.state), {}, {\n dialog: _objectSpread(_objectSpread({}, this.state.dialog), {}, {\n show: false\n })\n }));\n }\n }, {\n key: \"fetchNotifications\",\n value: function fetchNotifications() {\n var _this2 = this;\n\n this.api.getNotifications().then(function (res) {\n if (!res.success) {\n _this2.showDialog(\"Error fetching notifications: \" + res.msg, \"Error fetching notifications\");\n } else {\n _this2.setState(_objectSpread(_objectSpread({}, _this2.state), {}, {\n notifications: res.notifications\n }));\n }\n });\n }\n }, {\n key: \"componentDidMount\",\n value: function componentDidMount() {\n var _this3 = this;\n\n this.api.fetchUser().then(function (Success) {\n if (!Success) {\n document.location = \"/admin\";\n } else {\n _this3.fetchNotifications();\n\n setInterval(_this3.onUpdate.bind(_this3), 60 * 1000);\n\n _this3.setState(_objectSpread(_objectSpread({}, _this3.state), {}, {\n loaded: true\n }));\n }\n });\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this4 = this;\n\n if (!this.state.loaded) {\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"b\", null, \"Loading\\u2026 \", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_elements_icon__WEBPACK_IMPORTED_MODULE_10__[\"default\"], {\n icon: \"spinner\"\n }));\n }\n\n this.controlObj = {\n showDialog: this.showDialog.bind(this),\n fetchNotifications: this.fetchNotifications.bind(this),\n api: this.api\n };\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_12__[\"BrowserRouter\"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_header_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"], _extends({}, this.controlObj, {\n notifications: this.state.notifications\n })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_sidebar_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"], _extends({}, this.controlObj, {\n notifications: this.state.notifications\n })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", {\n className: \"content-wrapper p-2\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"section\", {\n className: \"content\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_12__[\"Switch\"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_12__[\"Route\"], {\n path: \"/admin/dashboard\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_views_overview_js__WEBPACK_IMPORTED_MODULE_8__[\"default\"], _extends({}, this.controlObj, {\n notifications: this.state.notifications\n }))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_12__[\"Route\"], {\n exact: true,\n path: \"/admin/users\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_views_users_js__WEBPACK_IMPORTED_MODULE_7__[\"default\"], this.controlObj)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_12__[\"Route\"], {\n path: \"/admin/user/add\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_views_adduser__WEBPACK_IMPORTED_MODULE_9__[\"default\"], this.controlObj)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_12__[\"Route\"], {\n path: \"/admin/user/edit/:userId\",\n render: function render(props) {\n var newProps = _objectSpread(_objectSpread({}, props), _this4.controlObj);\n\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_views_edituser__WEBPACK_IMPORTED_MODULE_18__[\"default\"], newProps);\n }\n }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_12__[\"Route\"], {\n path: \"/admin/user/permissions\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_views_permissions__WEBPACK_IMPORTED_MODULE_21__[\"default\"], this.controlObj)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_12__[\"Route\"], {\n path: \"/admin/group/add\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_views_addgroup__WEBPACK_IMPORTED_MODULE_19__[\"default\"], this.controlObj)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_12__[\"Route\"], {\n path: \"/admin/logs\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_views_logs__WEBPACK_IMPORTED_MODULE_14__[\"default\"], _extends({}, this.controlObj, {\n notifications: this.state.notifications\n }))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_12__[\"Route\"], {\n path: \"/admin/settings\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_views_settings__WEBPACK_IMPORTED_MODULE_20__[\"default\"], this.controlObj)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_12__[\"Route\"], {\n path: \"/admin/pages\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_views_pages__WEBPACK_IMPORTED_MODULE_15__[\"default\"], this.controlObj)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_12__[\"Route\"], {\n path: \"/admin/help\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_views_help__WEBPACK_IMPORTED_MODULE_16__[\"default\"], this.controlObj)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react_router_dom__WEBPACK_IMPORTED_MODULE_12__[\"Route\"], {\n path: \"*\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_404__WEBPACK_IMPORTED_MODULE_13__[\"default\"], null))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_elements_dialog__WEBPACK_IMPORTED_MODULE_11__[\"default\"], this.state.dialog))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_footer__WEBPACK_IMPORTED_MODULE_17__[\"default\"], null));\n }\n }]);\n\n return AdminDashboard;\n}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component);\n\nreact_dom__WEBPACK_IMPORTED_MODULE_1___default.a.render( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(AdminDashboard, null), document.getElementById('root'));\n\n//# sourceURL=webpack:///./src/index.js?"); /***/ }), @@ -11415,7 +11415,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) * /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return Logs; });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-router-dom */ \"./node_modules/react-router-dom/esm/react-router-dom.js\");\n/* harmony import */ var _elements_icon__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../elements/icon */ \"./src/elements/icon.js\");\n/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! moment */ \"./node_modules/moment/moment.js\");\n/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(moment__WEBPACK_IMPORTED_MODULE_3__);\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === \"undefined\" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\n\n\n\n\nvar Logs = /*#__PURE__*/function (_React$Component) {\n _inherits(Logs, _React$Component);\n\n var _super = _createSuper(Logs);\n\n function Logs(props) {\n var _this;\n\n _classCallCheck(this, Logs);\n\n _this = _super.call(this, props);\n _this.state = {\n alerts: [],\n notifications: []\n };\n _this.parent = {\n api: props.api,\n fetchNotifications: props.fetchNotifications\n };\n return _this;\n }\n\n _createClass(Logs, [{\n key: \"removeError\",\n value: function removeError(i) {\n if (i >= 0 && i < this.state.alerts.length) {\n var alerts = this.state.alerts.slice();\n alerts.splice(i, 1);\n this.setState(_objectSpread(_objectSpread({}, this.state), {}, {\n alerts: alerts\n }));\n }\n }\n }, {\n key: \"componentDidMount\",\n value: function componentDidMount() {\n var _this2 = this;\n\n this.parent.api.getNotifications(false).then(function (res) {\n if (!res.success) {\n var alerts = _this2.state.alerts.slice();\n\n alerts.push({\n message: res.msg,\n title: \"Error fetching Notifications\"\n });\n\n _this2.setState(_objectSpread(_objectSpread({}, _this2.state), {}, {\n alerts: alerts\n }));\n } else {\n _this2.setState(_objectSpread(_objectSpread({}, _this2.state), {}, {\n notifications: res.notifications\n }));\n }\n\n _this2.parent.api.markNotificationsSeen().then(function (res) {\n if (!res.success) {\n var _alerts = _this2.state.alerts.slice();\n\n _alerts.push({\n message: res.msg,\n title: \"Error fetching Notifications\"\n });\n\n _this2.setState(_objectSpread(_objectSpread({}, _this2.state), {}, {\n alerts: _alerts\n }));\n }\n\n _this2.parent.fetchNotifications();\n });\n });\n }\n }, {\n key: \"render\",\n value: function render() {\n var colors = [\"red\", \"green\", \"blue\", \"purple\", \"maroon\"];\n var dates = {};\n\n var _iterator = _createForOfIteratorHelper(this.state.notifications),\n _step;\n\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var notification = _step.value;\n var day = moment__WEBPACK_IMPORTED_MODULE_3___default()(notification[\"created_at\"]).format('ll');\n\n if (!dates.hasOwnProperty(day)) {\n dates[day] = [];\n }\n\n var icon = \"bell\";\n\n if (notification.type === \"message\") {\n icon = \"envelope\";\n } else if (notification.type === \"warning\") {\n icon = \"exclamation-triangle\";\n }\n\n dates[day].push(_objectSpread(_objectSpread({}, notification), {}, {\n icon: icon,\n timestamp: notification[\"created_at\"]\n }));\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n\n var elements = [];\n\n for (var date in dates) {\n var color = colors[Math.floor(Math.random() * colors.length)];\n elements.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"time-label\",\n key: \"time-label-\" + date\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"span\", {\n className: \"bg-\" + color\n }, date)));\n\n var _iterator2 = _createForOfIteratorHelper(dates[date]),\n _step2;\n\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var event = _step2.value;\n var timeString = moment__WEBPACK_IMPORTED_MODULE_3___default()(event.timestamp).fromNow();\n elements.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](_elements_icon__WEBPACK_IMPORTED_MODULE_2__[\"default\"], {\n icon: event.icon,\n className: \"bg-\" + color\n }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"timeline-item\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"span\", {\n className: \"time\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](_elements_icon__WEBPACK_IMPORTED_MODULE_2__[\"default\"], {\n icon: \"clock\"\n }), \" \", timeString), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"h3\", {\n className: \"timeline-header\"\n }, event.title), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"timeline-body\"\n }, event.message))));\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n }\n\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](react__WEBPACK_IMPORTED_MODULE_0__[\"Fragment\"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"content-header\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"container-fluid\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"row mb-2\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"col-sm-6\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"h1\", {\n className: \"m-0 text-dark\"\n }, \"Logs & Notifications\")), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"col-sm-6\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"ol\", {\n className: \"breadcrumb float-sm-right\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"li\", {\n className: \"breadcrumb-item\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](react_router_dom__WEBPACK_IMPORTED_MODULE_1__[\"Link\"], {\n to: \"/admin/dashboard\"\n }, \"Home\")), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"li\", {\n className: \"breadcrumb-item active\"\n }, \"Logs\")))))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"content\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"container-fluid\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"row\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"col-lg-8 col-12\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"timeline\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"time-label\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"span\", {\n className: \"bg-blue\"\n }, \"Today\")), elements, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](_elements_icon__WEBPACK_IMPORTED_MODULE_2__[\"default\"], {\n icon: \"clock\",\n className: \"bg-gray\"\n }))))))));\n }\n }]);\n\n return Logs;\n}(react__WEBPACK_IMPORTED_MODULE_0__[\"Component\"]);\n\n\n\n//# sourceURL=webpack:///./src/views/logs.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return Logs; });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-router-dom */ \"./node_modules/react-router-dom/esm/react-router-dom.js\");\n/* harmony import */ var _elements_icon__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../elements/icon */ \"./src/elements/icon.js\");\n/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! moment */ \"./node_modules/moment/moment.js\");\n/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(moment__WEBPACK_IMPORTED_MODULE_3__);\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === \"undefined\" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\n\n\n\n\nvar Logs = /*#__PURE__*/function (_React$Component) {\n _inherits(Logs, _React$Component);\n\n var _super = _createSuper(Logs);\n\n function Logs(props) {\n var _this;\n\n _classCallCheck(this, Logs);\n\n _this = _super.call(this, props);\n _this.state = {\n alerts: [],\n notifications: []\n };\n _this.parent = {\n api: props.api,\n fetchNotifications: props.fetchNotifications\n };\n return _this;\n }\n\n _createClass(Logs, [{\n key: \"removeError\",\n value: function removeError(i) {\n if (i >= 0 && i < this.state.alerts.length) {\n var alerts = this.state.alerts.slice();\n alerts.splice(i, 1);\n this.setState(_objectSpread(_objectSpread({}, this.state), {}, {\n alerts: alerts\n }));\n }\n }\n }, {\n key: \"componentDidMount\",\n value: function componentDidMount() {\n var _this2 = this;\n\n this.parent.api.getNotifications(false).then(function (res) {\n if (!res.success) {\n var alerts = _this2.state.alerts.slice();\n\n alerts.push({\n message: res.msg,\n title: \"Error fetching Notifications\"\n });\n\n _this2.setState(_objectSpread(_objectSpread({}, _this2.state), {}, {\n alerts: alerts\n }));\n } else {\n _this2.setState(_objectSpread(_objectSpread({}, _this2.state), {}, {\n notifications: res.notifications\n }));\n }\n\n _this2.parent.api.markNotificationsSeen().then(function (res) {\n if (!res.success) {\n var _alerts = _this2.state.alerts.slice();\n\n _alerts.push({\n message: res.msg,\n title: \"Error fetching Notifications\"\n });\n\n _this2.setState(_objectSpread(_objectSpread({}, _this2.state), {}, {\n alerts: _alerts\n }));\n }\n\n _this2.parent.fetchNotifications();\n });\n });\n }\n }, {\n key: \"render\",\n value: function render() {\n var colors = [\"red\", \"green\", \"blue\", \"purple\", \"maroon\"];\n var dates = {};\n\n var _iterator = _createForOfIteratorHelper(this.state.notifications),\n _step;\n\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var notification = _step.value;\n var day = moment__WEBPACK_IMPORTED_MODULE_3___default()(notification[\"created_at\"]).format('ll');\n\n if (!dates.hasOwnProperty(day)) {\n dates[day] = [];\n }\n\n var icon = \"bell\";\n\n if (notification.type === \"message\") {\n icon = \"envelope\";\n } else if (notification.type === \"warning\") {\n icon = \"exclamation-triangle\";\n }\n\n dates[day].push(_objectSpread(_objectSpread({}, notification), {}, {\n icon: icon,\n timestamp: notification[\"created_at\"]\n }));\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n\n var elements = [];\n\n for (var date in dates) {\n var color = colors[Math.floor(Math.random() * colors.length)];\n elements.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"time-label\",\n key: \"time-label-\" + date\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"span\", {\n className: \"bg-\" + color\n }, date)));\n\n var _iterator2 = _createForOfIteratorHelper(dates[date]),\n _step2;\n\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var event = _step2.value;\n var timeString = moment__WEBPACK_IMPORTED_MODULE_3___default()(event.timestamp).fromNow();\n elements.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n key: \"time-entry-\" + event.uid\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](_elements_icon__WEBPACK_IMPORTED_MODULE_2__[\"default\"], {\n icon: event.icon,\n className: \"bg-\" + color\n }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"timeline-item\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"span\", {\n className: \"time\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](_elements_icon__WEBPACK_IMPORTED_MODULE_2__[\"default\"], {\n icon: \"clock\"\n }), \" \", timeString), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"h3\", {\n className: \"timeline-header\"\n }, event.title), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"timeline-body\"\n }, event.message))));\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n }\n\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](react__WEBPACK_IMPORTED_MODULE_0__[\"Fragment\"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"content-header\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"container-fluid\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"row mb-2\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"col-sm-6\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"h1\", {\n className: \"m-0 text-dark\"\n }, \"Logs & Notifications\")), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"col-sm-6\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"ol\", {\n className: \"breadcrumb float-sm-right\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"li\", {\n className: \"breadcrumb-item\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](react_router_dom__WEBPACK_IMPORTED_MODULE_1__[\"Link\"], {\n to: \"/admin/dashboard\"\n }, \"Home\")), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"li\", {\n className: \"breadcrumb-item active\"\n }, \"Logs\")))))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"content\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"container-fluid\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"row\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"col-lg-8 col-12\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"timeline\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"time-label\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"span\", {\n className: \"bg-blue\"\n }, \"Today\")), elements, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](_elements_icon__WEBPACK_IMPORTED_MODULE_2__[\"default\"], {\n icon: \"clock\",\n className: \"bg-gray\"\n }))))))));\n }\n }]);\n\n return Logs;\n}(react__WEBPACK_IMPORTED_MODULE_0__[\"Component\"]);\n\n\n\n//# sourceURL=webpack:///./src/views/logs.js?"); /***/ }), @@ -11443,6 +11443,18 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) * /***/ }), +/***/ "./src/views/permissions.js": +/*!**********************************!*\ + !*** ./src/views/permissions.js ***! + \**********************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return PermissionSettings; });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-router-dom */ \"./node_modules/react-router-dom/esm/react-router-dom.js\");\n/* harmony import */ var _elements_icon__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../elements/icon */ \"./src/elements/icon.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\n\n\n\nvar PermissionSettings = /*#__PURE__*/function (_React$Component) {\n _inherits(PermissionSettings, _React$Component);\n\n var _super = _createSuper(PermissionSettings);\n\n function PermissionSettings(props) {\n var _this;\n\n _classCallCheck(this, PermissionSettings);\n\n _this = _super.call(this, props);\n _this.state = {\n alerts: [],\n permissions: [],\n groups: {}\n };\n return _this;\n }\n\n _createClass(PermissionSettings, [{\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](react__WEBPACK_IMPORTED_MODULE_0__[\"Fragment\"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"content-header\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"container-fluid\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"row mb-2\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"col-sm-6\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"h1\", {\n className: \"m-0 text-dark\"\n }, \"API Access Control\")), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"col-sm-6\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"ol\", {\n className: \"breadcrumb float-sm-right\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"li\", {\n className: \"breadcrumb-item\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](react_router_dom__WEBPACK_IMPORTED_MODULE_1__[\"Link\"], {\n to: \"/admin/dashboard\"\n }, \"Home\")), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"li\", {\n className: \"breadcrumb-item\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](react_router_dom__WEBPACK_IMPORTED_MODULE_1__[\"Link\"], {\n to: \"/admin/users\"\n }, \"Users\")), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"li\", {\n className: \"breadcrumb-item active\"\n }, \"Permissions\")))))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"content\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"row\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"col-lg-6 pl-5 pr-5\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"form\", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](react_router_dom__WEBPACK_IMPORTED_MODULE_1__[\"Link\"], {\n to: \"/admin/users\",\n className: \"btn btn-info mt-2 mr-2\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](_elements_icon__WEBPACK_IMPORTED_MODULE_2__[\"default\"], {\n icon: \"arrow-left\"\n }), \"\\xA0Back\"))))));\n }\n }]);\n\n return PermissionSettings;\n}(react__WEBPACK_IMPORTED_MODULE_0__[\"Component\"]);\n\n\n;\n\n//# sourceURL=webpack:///./src/views/permissions.js?"); + +/***/ }), + /***/ "./src/views/settings.js": /*!*******************************!*\ !*** ./src/views/settings.js ***! @@ -11463,7 +11475,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) * /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return UserOverview; });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _elements_icon__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../elements/icon */ \"./src/elements/icon.js\");\n/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-router-dom */ \"./node_modules/react-router-dom/esm/react-router-dom.js\");\n/* harmony import */ var _global__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../global */ \"./src/global.js\");\n/* harmony import */ var _elements_alert__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../elements/alert */ \"./src/elements/alert.js\");\n/* harmony import */ var react_tooltip__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react-tooltip */ \"./node_modules/react-tooltip/dist/index.es.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\n\n\n\n\n\nvar TABLE_SIZE = 10;\n\nvar UserOverview = /*#__PURE__*/function (_React$Component) {\n _inherits(UserOverview, _React$Component);\n\n var _super = _createSuper(UserOverview);\n\n function UserOverview(props) {\n var _this;\n\n _classCallCheck(this, UserOverview);\n\n _this = _super.call(this, props);\n _this.parent = {\n showDialog: props.showDialog || function () {},\n api: props.api\n };\n _this.state = {\n loaded: false,\n users: {\n data: {},\n page: 1,\n pageCount: 1,\n totalCount: 0\n },\n groups: {\n data: {},\n page: 1,\n pageCount: 1,\n totalCount: 0\n },\n errors: [],\n rowCount: 0\n };\n return _this;\n }\n\n _createClass(UserOverview, [{\n key: \"fetchGroups\",\n value: function fetchGroups(page) {\n var _this2 = this;\n\n page = page || this.state.groups.page;\n this.setState(_objectSpread(_objectSpread({}, this.state), {}, {\n groups: _objectSpread(_objectSpread({}, this.state.groups), {}, {\n data: {},\n page: 1,\n totalCount: 0\n })\n }));\n this.parent.api.fetchGroups(page, TABLE_SIZE).then(function (res) {\n if (res.success) {\n _this2.setState(_objectSpread(_objectSpread({}, _this2.state), {}, {\n groups: {\n data: res.groups,\n pageCount: res.pageCount,\n page: page,\n totalCount: res.totalCount\n },\n rowCount: Math.max(_this2.state.rowCount, Object.keys(res.groups).length)\n }));\n } else {\n var errors = _this2.state.errors.slice();\n\n errors.push({\n title: \"Error fetching groups\",\n message: res.msg\n });\n\n _this2.setState(_objectSpread(_objectSpread({}, _this2.state), {}, {\n errors: errors\n }));\n }\n\n if (!_this2.state.loaded) {\n _this2.fetchUsers(1);\n }\n });\n }\n }, {\n key: \"fetchUsers\",\n value: function fetchUsers(page) {\n var _this3 = this;\n\n page = page || this.state.users.page;\n this.setState(_objectSpread(_objectSpread({}, this.state), {}, {\n users: _objectSpread(_objectSpread({}, this.state.users), {}, {\n data: {},\n pageCount: 1,\n totalCount: 0\n })\n }));\n this.parent.api.fetchUsers(page, TABLE_SIZE).then(function (res) {\n if (res.success) {\n _this3.setState(_objectSpread(_objectSpread({}, _this3.state), {}, {\n loaded: true,\n users: {\n data: res.users,\n pageCount: res.pageCount,\n page: page,\n totalCount: res.totalCount\n },\n rowCount: Math.max(_this3.state.rowCount, Object.keys(res.users).length)\n }));\n } else {\n var errors = _this3.state.errors.slice();\n\n errors.push({\n title: \"Error fetching users\",\n message: res.msg\n });\n\n _this3.setState(_objectSpread(_objectSpread({}, _this3.state), {}, {\n loaded: true,\n errors: errors\n }));\n }\n });\n }\n }, {\n key: \"componentDidMount\",\n value: function componentDidMount() {\n this.setState(_objectSpread(_objectSpread({}, this.state), {}, {\n loaded: false\n }));\n this.fetchGroups(1);\n }\n }, {\n key: \"removeError\",\n value: function removeError(i) {\n if (i >= 0 && i < this.state.errors.length) {\n var errors = this.state.errors.slice();\n errors.splice(i, 1);\n this.setState(_objectSpread(_objectSpread({}, this.state), {}, {\n errors: errors\n }));\n }\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this4 = this;\n\n if (!this.state.loaded) {\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"text-center mt-4\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"h3\", null, \"Loading\\u2026\\xA0\", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](_elements_icon__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n icon: \"spinner\"\n })));\n }\n\n var errors = [];\n\n var _loop = function _loop(i) {\n errors.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](_elements_alert__WEBPACK_IMPORTED_MODULE_4__[\"default\"], _extends({\n key: \"error-\" + i,\n onClose: function onClose() {\n return _this4.removeError(i);\n }\n }, _this4.state.errors[i])));\n };\n\n for (var i = 0; i < this.state.errors.length; i++) {\n _loop(i);\n }\n\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](react__WEBPACK_IMPORTED_MODULE_0__[\"Fragment\"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"content-header\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"container-fluid\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"row mb-2\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"col-sm-6\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"h1\", {\n className: \"m-0 text-dark\"\n }, \"Users & Groups\")), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"col-sm-6\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"ol\", {\n className: \"breadcrumb float-sm-right\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"li\", {\n className: \"breadcrumb-item\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](react_router_dom__WEBPACK_IMPORTED_MODULE_2__[\"Link\"], {\n to: \"/admin/dashboard\"\n }, \"Home\")), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"li\", {\n className: \"breadcrumb-item active\"\n }, \"Users\")))))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"content\"\n }, errors, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"content-fluid\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"row\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"col-lg-6\"\n }, this.createUserCard()), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"col-lg-6\"\n }, this.createGroupCard())))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](react_tooltip__WEBPACK_IMPORTED_MODULE_5__[\"default\"], null));\n }\n }, {\n key: \"createUserCard\",\n value: function createUserCard() {\n var _this5 = this;\n\n var userRows = [];\n\n for (var uid in this.state.users.data) {\n if (!this.state.users.data.hasOwnProperty(uid)) {\n continue;\n }\n\n var user = this.state.users.data[uid];\n var groups = [];\n\n for (var groupId in user.groups) {\n if (user.groups.hasOwnProperty(groupId)) {\n var groupName = user.groups[groupId].name;\n var groupColor = user.groups[groupId].color;\n groups.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"span\", {\n key: \"group-\" + groupId,\n className: \"mr-1 badge text-white\",\n style: {\n backgroundColor: groupColor\n }\n }, groupName));\n }\n }\n\n userRows.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"tr\", {\n key: \"user-\" + uid\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"td\", null, user.name), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"td\", null, user.email), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"td\", null, groups), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"td\", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"span\", {\n \"data-effect\": \"solid\",\n \"data-tip\": user[\"registered_at\"],\n \"data-place\": \"bottom\"\n }, Object(_global__WEBPACK_IMPORTED_MODULE_3__[\"getPeriodString\"])(user[\"registered_at\"]))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"td\", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](react_router_dom__WEBPACK_IMPORTED_MODULE_2__[\"Link\"], {\n to: \"/admin/user/edit/\" + uid,\n className: \"text-reset\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](_elements_icon__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n icon: \"pencil-alt\",\n \"data-effect\": \"solid\",\n \"data-tip\": \"Modify user details & group membership\",\n \"data-type\": \"info\",\n \"data-place\": \"right\"\n })))));\n }\n\n while (userRows.length < this.state.rowCount) {\n userRows.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"tr\", {\n key: \"empty-row-\" + userRows.length\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"td\", null, \"\\xA0\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"td\", null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"td\", null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"td\", null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"td\", null)));\n }\n\n var pages = [];\n var previousDisabled = this.state.users.page === 1 ? \" disabled\" : \"\";\n var nextDisabled = this.state.users.page >= this.state.users.pageCount ? \" disabled\" : \"\";\n\n var _loop2 = function _loop2(i) {\n var active = _this5.state.users.page === i ? \" active\" : \"\";\n pages.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"li\", {\n key: \"page-\" + i,\n className: \"page-item\" + active\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"a\", {\n className: \"page-link\",\n href: \"#\",\n onClick: function onClick() {\n if (_this5.state.users.page !== i) _this5.fetchUsers(i);\n }\n }, i)));\n };\n\n for (var i = 1; i <= this.state.users.pageCount; i++) {\n _loop2(i);\n }\n\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"card\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"card-header border-0\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"h3\", {\n className: \"card-title\"\n }, \"Users\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"card-tools\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](react_router_dom__WEBPACK_IMPORTED_MODULE_2__[\"Link\"], {\n href: \"#\",\n className: \"btn btn-tool btn-sm\",\n to: \"/admin/user/add\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](_elements_icon__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n icon: \"plus\"\n })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"a\", {\n href: \"#\",\n className: \"btn btn-tool btn-sm\",\n onClick: function onClick() {\n return _this5.fetchUsers();\n }\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](_elements_icon__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n icon: \"sync\"\n })))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"card-body table-responsive p-0\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"table\", {\n className: \"table table-striped table-valign-middle\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"thead\", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"tr\", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"th\", null, \"Username\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"th\", null, \"Email\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"th\", null, \"Groups\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"th\", null, \"Registered\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"th\", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](_elements_icon__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n icon: \"tools\"\n })))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"tbody\", null, userRows)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"nav\", {\n className: \"row m-0\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"col-6 pl-3 pt-3 pb-3 text-muted\"\n }, \"Total: \", this.state.users.totalCount), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"col-6 p-0\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"ul\", {\n className: \"pagination p-2 m-0 justify-content-end\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"li\", {\n className: \"page-item\" + previousDisabled\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"a\", {\n className: \"page-link\",\n href: \"#\",\n onClick: function onClick() {\n return _this5.fetchUsers(_this5.state.users.page - 1);\n }\n }, \"Previous\")), pages, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"li\", {\n className: \"page-item\" + nextDisabled\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"a\", {\n className: \"page-link\",\n href: \"#\",\n onClick: function onClick() {\n return _this5.fetchUsers(_this5.state.users.page + 1);\n }\n }, \"Next\")))))));\n }\n }, {\n key: \"createGroupCard\",\n value: function createGroupCard() {\n var _this6 = this;\n\n var groupRows = [];\n\n var _loop3 = function _loop3(uid) {\n if (!_this6.state.groups.data.hasOwnProperty(uid)) {\n return \"continue\";\n }\n\n var group = _this6.state.groups.data[uid];\n groupRows.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"tr\", {\n key: \"group-\" + uid\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"td\", null, group.name), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"td\", {\n className: \"text-center\"\n }, group[\"memberCount\"]), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"td\", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"span\", {\n className: \"badge text-white mr-1\",\n style: {\n backgroundColor: group.color,\n fontFamily: \"monospace\"\n }\n }, group.color)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"td\", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](_elements_icon__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n icon: \"trash\",\n style: {\n color: \"red\",\n cursor: \"pointer\"\n },\n onClick: function onClick(e) {\n return _this6.onDeleteGroup(e, uid);\n },\n \"data-effect\": \"solid\",\n \"data-tip\": \"Delete\",\n \"data-type\": \"error\",\n \"data-place\": \"bottom\"\n }))));\n };\n\n for (var uid in this.state.groups.data) {\n var _ret = _loop3(uid);\n\n if (_ret === \"continue\") continue;\n }\n\n while (groupRows.length < this.state.rowCount) {\n groupRows.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"tr\", {\n key: \"empty-row-\" + groupRows.length\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"td\", null, \"\\xA0\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"td\", null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"td\", null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"td\", null)));\n }\n\n var pages = [];\n var previousDisabled = this.state.groups.page === 1 ? \" disabled\" : \"\";\n var nextDisabled = this.state.groups.page >= this.state.groups.pageCount ? \" disabled\" : \"\";\n\n var _loop4 = function _loop4(i) {\n var active = _this6.state.groups.page === i ? \" active\" : \"\";\n pages.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"li\", {\n key: \"page-\" + i,\n className: \"page-item\" + active\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"a\", {\n className: \"page-link\",\n href: \"#\",\n onClick: function onClick() {\n if (_this6.state.groups.page !== i) _this6.fetchGroups(i);\n }\n }, i)));\n };\n\n for (var i = 1; i <= this.state.groups.pageCount; i++) {\n _loop4(i);\n }\n\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"card\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"card-header border-0\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"h3\", {\n className: \"card-title\"\n }, \"Groups\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"card-tools\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](react_router_dom__WEBPACK_IMPORTED_MODULE_2__[\"Link\"], {\n href: \"#\",\n className: \"btn btn-tool btn-sm\",\n to: \"/admin/group/add\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](_elements_icon__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n icon: \"plus\"\n })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"a\", {\n href: \"#\",\n className: \"btn btn-tool btn-sm\",\n onClick: function onClick() {\n return _this6.fetchGroups();\n }\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](_elements_icon__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n icon: \"sync\"\n })))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"card-body table-responsive p-0\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"table\", {\n className: \"table table-striped table-valign-middle\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"thead\", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"tr\", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"th\", null, \"Name\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"th\", {\n className: \"text-center\"\n }, \"Members\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"th\", null, \"Color\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"th\", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](_elements_icon__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n icon: \"tools\"\n })))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"tbody\", null, groupRows)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"nav\", {\n className: \"row m-0\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"col-6 pl-3 pt-3 pb-3 text-muted\"\n }, \"Total: \", this.state.groups.totalCount), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"col-6 p-0\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"ul\", {\n className: \"pagination p-2 m-0 justify-content-end\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"li\", {\n className: \"page-item\" + previousDisabled\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"a\", {\n className: \"page-link\",\n href: \"#\",\n onClick: function onClick() {\n return _this6.fetchGroups(_this6.state.groups.page - 1);\n }\n }, \"Previous\")), pages, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"li\", {\n className: \"page-item\" + nextDisabled\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"a\", {\n className: \"page-link\",\n href: \"#\",\n onClick: function onClick() {\n return _this6.fetchGroups(_this6.state.groups.page + 1);\n }\n }, \"Next\")))))));\n }\n }, {\n key: \"onDeleteGroup\",\n value: function onDeleteGroup(e, uid) {\n var _this7 = this;\n\n e.stopPropagation();\n this.parent.showDialog(\"Are you really sure you want to delete this group?\", \"Delete Group?\", [\"Yes\", \"No\"], function (btn) {\n if (btn === \"Yes\") {\n _this7.parent.api.deleteGroup(uid).then(function (res) {\n if (!res.success) {\n var errors = _this7.state.errors.slice();\n\n errors.push({\n title: \"Error deleting group\",\n message: res.msg\n });\n\n _this7.setState(_objectSpread(_objectSpread({}, _this7.state), {}, {\n errors: errors\n }));\n } else {\n _this7.setState(_objectSpread(_objectSpread({}, _this7.state), {}, {\n loaded: false\n }));\n\n _this7.fetchGroups();\n }\n });\n }\n });\n }\n }]);\n\n return UserOverview;\n}(react__WEBPACK_IMPORTED_MODULE_0__[\"Component\"]);\n\n\n\n//# sourceURL=webpack:///./src/views/users.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return UserOverview; });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _elements_icon__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../elements/icon */ \"./src/elements/icon.js\");\n/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-router-dom */ \"./node_modules/react-router-dom/esm/react-router-dom.js\");\n/* harmony import */ var _global__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../global */ \"./src/global.js\");\n/* harmony import */ var _elements_alert__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../elements/alert */ \"./src/elements/alert.js\");\n/* harmony import */ var react_tooltip__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react-tooltip */ \"./node_modules/react-tooltip/dist/index.es.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\n\n\n\n\n\nvar TABLE_SIZE = 10;\n\nvar UserOverview = /*#__PURE__*/function (_React$Component) {\n _inherits(UserOverview, _React$Component);\n\n var _super = _createSuper(UserOverview);\n\n function UserOverview(props) {\n var _this;\n\n _classCallCheck(this, UserOverview);\n\n _this = _super.call(this, props);\n _this.parent = {\n showDialog: props.showDialog || function () {},\n api: props.api\n };\n _this.state = {\n loaded: false,\n users: {\n data: {},\n page: 1,\n pageCount: 1,\n totalCount: 0\n },\n groups: {\n data: {},\n page: 1,\n pageCount: 1,\n totalCount: 0\n },\n errors: [],\n rowCount: 0\n };\n return _this;\n }\n\n _createClass(UserOverview, [{\n key: \"fetchGroups\",\n value: function fetchGroups(page) {\n var _this2 = this;\n\n page = page || this.state.groups.page;\n this.setState(_objectSpread(_objectSpread({}, this.state), {}, {\n groups: _objectSpread(_objectSpread({}, this.state.groups), {}, {\n data: {},\n page: 1,\n totalCount: 0\n })\n }));\n this.parent.api.fetchGroups(page, TABLE_SIZE).then(function (res) {\n if (res.success) {\n _this2.setState(_objectSpread(_objectSpread({}, _this2.state), {}, {\n groups: {\n data: res.groups,\n pageCount: res.pageCount,\n page: page,\n totalCount: res.totalCount\n },\n rowCount: Math.max(_this2.state.rowCount, Object.keys(res.groups).length)\n }));\n } else {\n var errors = _this2.state.errors.slice();\n\n errors.push({\n title: \"Error fetching groups\",\n message: res.msg\n });\n\n _this2.setState(_objectSpread(_objectSpread({}, _this2.state), {}, {\n errors: errors\n }));\n }\n\n if (!_this2.state.loaded) {\n _this2.fetchUsers(1);\n }\n });\n }\n }, {\n key: \"fetchUsers\",\n value: function fetchUsers(page) {\n var _this3 = this;\n\n page = page || this.state.users.page;\n this.setState(_objectSpread(_objectSpread({}, this.state), {}, {\n users: _objectSpread(_objectSpread({}, this.state.users), {}, {\n data: {},\n pageCount: 1,\n totalCount: 0\n })\n }));\n this.parent.api.fetchUsers(page, TABLE_SIZE).then(function (res) {\n if (res.success) {\n _this3.setState(_objectSpread(_objectSpread({}, _this3.state), {}, {\n loaded: true,\n users: {\n data: res.users,\n pageCount: res.pageCount,\n page: page,\n totalCount: res.totalCount\n },\n rowCount: Math.max(_this3.state.rowCount, Object.keys(res.users).length)\n }));\n } else {\n var errors = _this3.state.errors.slice();\n\n errors.push({\n title: \"Error fetching users\",\n message: res.msg\n });\n\n _this3.setState(_objectSpread(_objectSpread({}, _this3.state), {}, {\n loaded: true,\n errors: errors\n }));\n }\n });\n }\n }, {\n key: \"componentDidMount\",\n value: function componentDidMount() {\n this.setState(_objectSpread(_objectSpread({}, this.state), {}, {\n loaded: false\n }));\n this.fetchGroups(1);\n }\n }, {\n key: \"removeError\",\n value: function removeError(i) {\n if (i >= 0 && i < this.state.errors.length) {\n var errors = this.state.errors.slice();\n errors.splice(i, 1);\n this.setState(_objectSpread(_objectSpread({}, this.state), {}, {\n errors: errors\n }));\n }\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this4 = this;\n\n if (!this.state.loaded) {\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"text-center mt-4\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"h3\", null, \"Loading\\u2026\\xA0\", /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](_elements_icon__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n icon: \"spinner\"\n })));\n }\n\n var errors = [];\n\n var _loop = function _loop(i) {\n errors.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](_elements_alert__WEBPACK_IMPORTED_MODULE_4__[\"default\"], _extends({\n key: \"error-\" + i,\n onClose: function onClose() {\n return _this4.removeError(i);\n }\n }, _this4.state.errors[i])));\n };\n\n for (var i = 0; i < this.state.errors.length; i++) {\n _loop(i);\n }\n\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](react__WEBPACK_IMPORTED_MODULE_0__[\"Fragment\"], null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"content-header\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"container-fluid\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"row mb-2\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"col-sm-6\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"h1\", {\n className: \"m-0 text-dark\"\n }, \"Users & Groups\")), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"col-sm-6\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"ol\", {\n className: \"breadcrumb float-sm-right\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"li\", {\n className: \"breadcrumb-item\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](react_router_dom__WEBPACK_IMPORTED_MODULE_2__[\"Link\"], {\n to: \"/admin/dashboard\"\n }, \"Home\")), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"li\", {\n className: \"breadcrumb-item active\"\n }, \"Users\")))))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"content\"\n }, errors, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"content-fluid\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"row\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"col-lg-6\"\n }, this.createUserCard()), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"col-lg-6\"\n }, this.createGroupCard())), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"row\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"col-12\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](react_router_dom__WEBPACK_IMPORTED_MODULE_2__[\"Link\"], {\n to: \"/admin/user/permissions\",\n className: \"btn btn-primary\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](_elements_icon__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n icon: \"user-check\",\n className: \"mr-2\"\n }), \"Edit Permissions\"))))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](react_tooltip__WEBPACK_IMPORTED_MODULE_5__[\"default\"], null));\n }\n }, {\n key: \"createUserCard\",\n value: function createUserCard() {\n var _this5 = this;\n\n var userRows = [];\n\n for (var uid in this.state.users.data) {\n if (!this.state.users.data.hasOwnProperty(uid)) {\n continue;\n }\n\n var user = this.state.users.data[uid];\n var groups = [];\n\n for (var groupId in user.groups) {\n if (user.groups.hasOwnProperty(groupId)) {\n var groupName = user.groups[groupId].name;\n var groupColor = user.groups[groupId].color;\n groups.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"span\", {\n key: \"group-\" + groupId,\n className: \"mr-1 badge text-white\",\n style: {\n backgroundColor: groupColor\n }\n }, groupName));\n }\n }\n\n userRows.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"tr\", {\n key: \"user-\" + uid\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"td\", null, user.name), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"td\", null, user.email), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"td\", null, groups), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"td\", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"span\", {\n \"data-effect\": \"solid\",\n \"data-tip\": user[\"registered_at\"],\n \"data-place\": \"bottom\"\n }, Object(_global__WEBPACK_IMPORTED_MODULE_3__[\"getPeriodString\"])(user[\"registered_at\"]))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"td\", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](react_router_dom__WEBPACK_IMPORTED_MODULE_2__[\"Link\"], {\n to: \"/admin/user/edit/\" + uid,\n className: \"text-reset\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](_elements_icon__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n icon: \"pencil-alt\",\n \"data-effect\": \"solid\",\n \"data-tip\": \"Modify user details & group membership\",\n \"data-type\": \"info\",\n \"data-place\": \"right\"\n })))));\n }\n\n while (userRows.length < this.state.rowCount) {\n userRows.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"tr\", {\n key: \"empty-row-\" + userRows.length\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"td\", null, \"\\xA0\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"td\", null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"td\", null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"td\", null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"td\", null)));\n }\n\n var pages = [];\n var previousDisabled = this.state.users.page === 1 ? \" disabled\" : \"\";\n var nextDisabled = this.state.users.page >= this.state.users.pageCount ? \" disabled\" : \"\";\n\n var _loop2 = function _loop2(i) {\n var active = _this5.state.users.page === i ? \" active\" : \"\";\n pages.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"li\", {\n key: \"page-\" + i,\n className: \"page-item\" + active\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"a\", {\n className: \"page-link\",\n href: \"#\",\n onClick: function onClick() {\n if (_this5.state.users.page !== i) _this5.fetchUsers(i);\n }\n }, i)));\n };\n\n for (var i = 1; i <= this.state.users.pageCount; i++) {\n _loop2(i);\n }\n\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"card\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"card-header border-0\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"h3\", {\n className: \"card-title\"\n }, \"Users\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"card-tools\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](react_router_dom__WEBPACK_IMPORTED_MODULE_2__[\"Link\"], {\n href: \"#\",\n className: \"btn btn-tool btn-sm\",\n to: \"/admin/user/add\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](_elements_icon__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n icon: \"plus\"\n })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"a\", {\n href: \"#\",\n className: \"btn btn-tool btn-sm\",\n onClick: function onClick() {\n return _this5.fetchUsers();\n }\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](_elements_icon__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n icon: \"sync\"\n })))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"card-body table-responsive p-0\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"table\", {\n className: \"table table-striped table-valign-middle\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"thead\", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"tr\", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"th\", null, \"Username\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"th\", null, \"Email\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"th\", null, \"Groups\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"th\", null, \"Registered\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"th\", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](_elements_icon__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n icon: \"tools\"\n })))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"tbody\", null, userRows)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"nav\", {\n className: \"row m-0\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"col-6 pl-3 pt-3 pb-3 text-muted\"\n }, \"Total: \", this.state.users.totalCount), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"col-6 p-0\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"ul\", {\n className: \"pagination p-2 m-0 justify-content-end\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"li\", {\n className: \"page-item\" + previousDisabled\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"a\", {\n className: \"page-link\",\n href: \"#\",\n onClick: function onClick() {\n return _this5.fetchUsers(_this5.state.users.page - 1);\n }\n }, \"Previous\")), pages, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"li\", {\n className: \"page-item\" + nextDisabled\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"a\", {\n className: \"page-link\",\n href: \"#\",\n onClick: function onClick() {\n return _this5.fetchUsers(_this5.state.users.page + 1);\n }\n }, \"Next\")))))));\n }\n }, {\n key: \"createGroupCard\",\n value: function createGroupCard() {\n var _this6 = this;\n\n var groupRows = [];\n\n var _loop3 = function _loop3(uid) {\n if (!_this6.state.groups.data.hasOwnProperty(uid)) {\n return \"continue\";\n }\n\n var group = _this6.state.groups.data[uid];\n groupRows.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"tr\", {\n key: \"group-\" + uid\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"td\", null, group.name), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"td\", {\n className: \"text-center\"\n }, group[\"memberCount\"]), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"td\", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"span\", {\n className: \"badge text-white mr-1\",\n style: {\n backgroundColor: group.color,\n fontFamily: \"monospace\"\n }\n }, group.color)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"td\", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](_elements_icon__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n icon: \"trash\",\n style: {\n color: \"red\",\n cursor: \"pointer\"\n },\n onClick: function onClick(e) {\n return _this6.onDeleteGroup(e, uid);\n },\n \"data-effect\": \"solid\",\n \"data-tip\": \"Delete\",\n \"data-type\": \"error\",\n \"data-place\": \"bottom\"\n }))));\n };\n\n for (var uid in this.state.groups.data) {\n var _ret = _loop3(uid);\n\n if (_ret === \"continue\") continue;\n }\n\n while (groupRows.length < this.state.rowCount) {\n groupRows.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"tr\", {\n key: \"empty-row-\" + groupRows.length\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"td\", null, \"\\xA0\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"td\", null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"td\", null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"td\", null)));\n }\n\n var pages = [];\n var previousDisabled = this.state.groups.page === 1 ? \" disabled\" : \"\";\n var nextDisabled = this.state.groups.page >= this.state.groups.pageCount ? \" disabled\" : \"\";\n\n var _loop4 = function _loop4(i) {\n var active = _this6.state.groups.page === i ? \" active\" : \"\";\n pages.push( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"li\", {\n key: \"page-\" + i,\n className: \"page-item\" + active\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"a\", {\n className: \"page-link\",\n href: \"#\",\n onClick: function onClick() {\n if (_this6.state.groups.page !== i) _this6.fetchGroups(i);\n }\n }, i)));\n };\n\n for (var i = 1; i <= this.state.groups.pageCount; i++) {\n _loop4(i);\n }\n\n return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"card\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"card-header border-0\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"h3\", {\n className: \"card-title\"\n }, \"Groups\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"card-tools\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](react_router_dom__WEBPACK_IMPORTED_MODULE_2__[\"Link\"], {\n href: \"#\",\n className: \"btn btn-tool btn-sm\",\n to: \"/admin/group/add\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](_elements_icon__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n icon: \"plus\"\n })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"a\", {\n href: \"#\",\n className: \"btn btn-tool btn-sm\",\n onClick: function onClick() {\n return _this6.fetchGroups();\n }\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](_elements_icon__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n icon: \"sync\"\n })))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"card-body table-responsive p-0\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"table\", {\n className: \"table table-striped table-valign-middle\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"thead\", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"tr\", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"th\", null, \"Name\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"th\", {\n className: \"text-center\"\n }, \"Members\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"th\", null, \"Color\"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"th\", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](_elements_icon__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n icon: \"tools\"\n })))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"tbody\", null, groupRows)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"nav\", {\n className: \"row m-0\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"col-6 pl-3 pt-3 pb-3 text-muted\"\n }, \"Total: \", this.state.groups.totalCount), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"div\", {\n className: \"col-6 p-0\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"ul\", {\n className: \"pagination p-2 m-0 justify-content-end\"\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"li\", {\n className: \"page-item\" + previousDisabled\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"a\", {\n className: \"page-link\",\n href: \"#\",\n onClick: function onClick() {\n return _this6.fetchGroups(_this6.state.groups.page - 1);\n }\n }, \"Previous\")), pages, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"li\", {\n className: \"page-item\" + nextDisabled\n }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__[\"createElement\"](\"a\", {\n className: \"page-link\",\n href: \"#\",\n onClick: function onClick() {\n return _this6.fetchGroups(_this6.state.groups.page + 1);\n }\n }, \"Next\")))))));\n }\n }, {\n key: \"onDeleteGroup\",\n value: function onDeleteGroup(e, uid) {\n var _this7 = this;\n\n e.stopPropagation();\n this.parent.showDialog(\"Are you really sure you want to delete this group?\", \"Delete Group?\", [\"Yes\", \"No\"], function (btn) {\n if (btn === \"Yes\") {\n _this7.parent.api.deleteGroup(uid).then(function (res) {\n if (!res.success) {\n var errors = _this7.state.errors.slice();\n\n errors.push({\n title: \"Error deleting group\",\n message: res.msg\n });\n\n _this7.setState(_objectSpread(_objectSpread({}, _this7.state), {}, {\n errors: errors\n }));\n } else {\n _this7.setState(_objectSpread(_objectSpread({}, _this7.state), {}, {\n loaded: false\n }));\n\n _this7.fetchGroups();\n }\n });\n }\n });\n }\n }]);\n\n return UserOverview;\n}(react__WEBPACK_IMPORTED_MODULE_0__[\"Component\"]);\n\n\n\n//# sourceURL=webpack:///./src/views/users.js?"); /***/ }) diff --git a/src/src/index.js b/src/src/index.js index 5fd9ad2..48c1318 100644 --- a/src/src/index.js +++ b/src/src/index.js @@ -19,6 +19,7 @@ import Footer from "./footer"; import EditUser from "./views/edituser"; import CreateGroup from "./views/addgroup"; import Settings from "./views/settings"; +import PermissionSettings from "./views/permissions"; class AdminDashboard extends React.Component { @@ -92,6 +93,7 @@ class AdminDashboard extends React.Component { let newProps = {...props, ...this.controlObj}; return }}/> + diff --git a/src/src/views/logs.js b/src/src/views/logs.js index 7568f67..2cd12d1 100644 --- a/src/src/views/logs.js +++ b/src/src/views/logs.js @@ -83,7 +83,7 @@ export default class Logs extends React.Component { for (let event of dates[date]) { let timeString = moment(event.timestamp).fromNow(); elements.push( -
+
{timeString} diff --git a/src/src/views/permissions.js b/src/src/views/permissions.js new file mode 100644 index 0000000..6685194 --- /dev/null +++ b/src/src/views/permissions.js @@ -0,0 +1,49 @@ +import * as React from "react"; +import {Link} from "react-router-dom"; +import Icon from "../elements/icon"; + +export default class PermissionSettings extends React.Component { + + constructor(props) { + super(props); + + this.state = { + alerts: [], + permissions: [], + groups: {} + } + } + + render() { + return <> +
+
+
+
+

API Access Control

+
+
+
    +
  1. Home
  2. +
  3. Users
  4. +
  5. Permissions
  6. +
+
+
+
+
+
+
+
+
+ + +  Back + + +
+
+
+ ; + } +}; \ No newline at end of file diff --git a/src/src/views/users.js b/src/src/views/users.js index 7d98df2..aee3104 100644 --- a/src/src/views/users.js +++ b/src/src/views/users.js @@ -144,6 +144,14 @@ export default class UserOverview extends React.Component { {this.createGroupCard()}
+
+
+ + + Edit Permissions + +
+