dsql-admin/dsql-app/.local_dist/server/pages/admin.js
Benjamin Toby d2d599dae3 Updates
2024-11-06 08:50:19 +01:00

346 lines
11 KiB
JavaScript

"use strict";
(() => {
var exports = {};
exports.id = 6964;
exports.ids = [6964,4135,133];
exports.modules = {
/***/ 1174:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "DashboardContext": () => (/* binding */ DashboardContext),
/* harmony export */ "default": () => (/* binding */ Dashboard),
/* harmony export */ "getServerSideProps": () => (/* binding */ getServerSideProps)
/* harmony export */ });
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(997);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6689);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _layouts_AdminLayout__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4858);
/* harmony import */ var _functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(370);
/* harmony import */ var _functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _components_admin_dashboard_DashboardContent__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(8124);
/* harmony import */ var _components_admin_databases_DeleteDatabaseConfirmationPopup__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(5012);
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/** ****************************************************************************** */ /** @type {import("@/package-shared/types").DashboardContextType} */ let DashboardContextObject = {};
const DashboardContext = /*#__PURE__*/ react__WEBPACK_IMPORTED_MODULE_1___default().createContext(DashboardContextObject);
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ==============================================================================
* Main Component { Functional }
* ==============================================================================
* @param {Object} props - Server props
* @param {import("@/package-shared/types").UserType} props.user - Server props
* @param {import("@/package-shared/types").DSQL_MYSQL_user_databases_Type[]} props.databases - Server props
* @param {import("@/package-shared/types").MetricsType} props.metrics - Server props
*/ function Dashboard({ user , databases , metrics }) {
/**
* Get Contexts
*
* @abstract { React.useContext }
*/ ////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Javascript Variables
*
* @abstract Non hook variables and functions
*/ const pageTitle = "User Dashboard | Datasquirel";
const pageDescription = "Welcome to your data app";
let head = /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("title", {
children: pageTitle
}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("meta", {
name: "description",
content: pageDescription
})
]
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* React Hooks
*
* @abstract { useState, useEffect, useRef, etc ... }
*/ /** @type {*} */ const targetDbState = react__WEBPACK_IMPORTED_MODULE_1___default().useState(null);
/** @type { [ targetDatabase: import("@/package-shared/types").DSQL_MYSQL_user_databases_Type | undefined, setTargetDatabase: React.Dispatch<React.SetStateAction<import("@/package-shared/types").DSQL_MYSQL_user_databases_Type>> ] } */ const [targetDatabase, setTargetDatabase] = targetDbState;
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/**
* Function Return
*
* @abstract Main Function Return
*/ return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_layouts_AdminLayout__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, {
head: head,
user: user,
children: /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(DashboardContext.Provider, {
value: {
user,
databases,
targetDatabase,
setTargetDatabase,
metrics
},
children: [
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_components_admin_dashboard_DashboardContent__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, {}),
/*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_components_admin_databases_DeleteDatabaseConfirmationPopup__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z, {
targetDatabase: targetDatabase
})
]
})
});
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
}
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* ==============================================================================
* Server Side Props or Static Props
* ==============================================================================
* @type {import("next").GetServerSideProps}
*/ async function getServerSideProps({ req , res , query }) {
/**
* User Auth
*
* @description User Auth
*/ const user = await _functions_backend_userAuth__WEBPACK_IMPORTED_MODULE_3___default()(req, res);
if (!user?.logged_in_status) {
return {
redirect: {
destination: "/login",
permanent: false
}
};
}
return {
redirect: {
destination: `/admin/${user.id}`,
permanent: false
}
};
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
}
/***/ }),
/***/ 4003:
/***/ ((module) => {
module.exports = require("@mui/icons-material/AdminPanelSettingsTwoTone");
/***/ }),
/***/ 69:
/***/ ((module) => {
module.exports = require("@mui/icons-material/CloudOffTwoTone");
/***/ }),
/***/ 4008:
/***/ ((module) => {
module.exports = require("@mui/icons-material/CloudQueueRounded");
/***/ }),
/***/ 7306:
/***/ ((module) => {
module.exports = require("@mui/icons-material/CollectionsTwoTone");
/***/ }),
/***/ 5050:
/***/ ((module) => {
module.exports = require("@mui/icons-material/CopyAllTwoTone");
/***/ }),
/***/ 386:
/***/ ((module) => {
module.exports = require("@mui/icons-material/CottageTwoTone");
/***/ }),
/***/ 7039:
/***/ ((module) => {
module.exports = require("@mui/icons-material/DeleteForeverTwoTone");
/***/ }),
/***/ 930:
/***/ ((module) => {
module.exports = require("@mui/icons-material/DifferenceTwoTone");
/***/ }),
/***/ 8193:
/***/ ((module) => {
module.exports = require("@mui/icons-material/DriveFileRenameOutlineTwoTone");
/***/ }),
/***/ 8979:
/***/ ((module) => {
module.exports = require("@mui/icons-material/DynamicFormTwoTone");
/***/ }),
/***/ 300:
/***/ ((module) => {
module.exports = require("@mui/icons-material/LanguageOutlined");
/***/ }),
/***/ 2814:
/***/ ((module) => {
module.exports = require("@mui/icons-material/LockTwoTone");
/***/ }),
/***/ 5557:
/***/ ((module) => {
module.exports = require("@mui/icons-material/MenuBookTwoTone");
/***/ }),
/***/ 9806:
/***/ ((module) => {
module.exports = require("@mui/icons-material/PeopleOutlineTwoTone");
/***/ }),
/***/ 36:
/***/ ((module) => {
module.exports = require("@mui/icons-material/RefreshRounded");
/***/ }),
/***/ 1799:
/***/ ((module) => {
module.exports = require("@mui/icons-material/SchemaTwoTone");
/***/ }),
/***/ 4063:
/***/ ((module) => {
module.exports = require("@mui/icons-material/StorageTwoTone");
/***/ }),
/***/ 2423:
/***/ ((module) => {
module.exports = require("lucide-react");
/***/ }),
/***/ 968:
/***/ ((module) => {
module.exports = require("next/head");
/***/ }),
/***/ 6689:
/***/ ((module) => {
module.exports = require("react");
/***/ }),
/***/ 997:
/***/ ((module) => {
module.exports = require("react/jsx-runtime");
/***/ }),
/***/ 2261:
/***/ ((module) => {
module.exports = require("serverless-mysql");
/***/ }),
/***/ 4300:
/***/ ((module) => {
module.exports = require("buffer");
/***/ }),
/***/ 6113:
/***/ ((module) => {
module.exports = require("crypto");
/***/ }),
/***/ 7147:
/***/ ((module) => {
module.exports = require("fs");
/***/ }),
/***/ 3685:
/***/ ((module) => {
module.exports = require("http");
/***/ }),
/***/ 1017:
/***/ ((module) => {
module.exports = require("path");
/***/ })
};
;
// load runtime
var __webpack_require__ = require("../webpack-runtime.js");
__webpack_require__.C(exports);
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
var __webpack_exports__ = __webpack_require__.X(0, [4017,8313,5264,6729,5449,913,4480,370,424,4858,5472,7946,1500,75,9282,7926], () => (__webpack_exec__(1174)));
module.exports = __webpack_exports__;
})();