402 lines
14 KiB
JavaScript
402 lines
14 KiB
JavaScript
"use strict";
|
|
(() => {
|
|
var exports = {};
|
|
exports.id = 3159;
|
|
exports.ids = [3159];
|
|
exports.modules = {
|
|
|
|
/***/ 8188:
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
// ESM COMPAT FLAG
|
|
__webpack_require__.r(__webpack_exports__);
|
|
|
|
// EXPORTS
|
|
__webpack_require__.d(__webpack_exports__, {
|
|
"default": () => (/* binding */ Backups),
|
|
"getServerSideProps": () => (/* binding */ getServerSideProps)
|
|
});
|
|
|
|
// EXTERNAL MODULE: external "react/jsx-runtime"
|
|
var jsx_runtime_ = __webpack_require__(997);
|
|
// EXTERNAL MODULE: external "react"
|
|
var external_react_ = __webpack_require__(6689);
|
|
var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_);
|
|
// EXTERNAL MODULE: ./functions/backend/suAdminUserAuth.js
|
|
var suAdminUserAuth = __webpack_require__(1503);
|
|
var suAdminUserAuth_default = /*#__PURE__*/__webpack_require__.n(suAdminUserAuth);
|
|
// EXTERNAL MODULE: ./layouts/SuAdminLayout.jsx + 2 modules
|
|
var SuAdminLayout = __webpack_require__(8282);
|
|
// EXTERNAL MODULE: ./components/su/SuErrorLogsContent.jsx
|
|
var SuErrorLogsContent = __webpack_require__(6251);
|
|
// EXTERNAL MODULE: ./functions/frontend/fetchApi.js
|
|
var fetchApi = __webpack_require__(6729);
|
|
// EXTERNAL MODULE: ./components/general/LoadingBlock.jsx
|
|
var LoadingBlock = __webpack_require__(5264);
|
|
// EXTERNAL MODULE: external "@mui/icons-material/StyleTwoTone"
|
|
var StyleTwoTone_ = __webpack_require__(723);
|
|
var StyleTwoTone_default = /*#__PURE__*/__webpack_require__.n(StyleTwoTone_);
|
|
;// CONCATENATED MODULE: ./components/su/SuBackupsContent.jsx
|
|
// @ts-check
|
|
/**
|
|
* ==============================================================================
|
|
* Imports
|
|
* ==============================================================================
|
|
*/
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////////////////////////////////////
|
|
/**
|
|
* ==============================================================================
|
|
* Main Component { Functional }
|
|
* ==============================================================================
|
|
* @param {Object} props - Server props
|
|
*/ function SuBackupsContent(props) {
|
|
/**
|
|
* Get Contexts
|
|
*
|
|
* @abstract { React.useContext }
|
|
*/ ////////////////////////////////////////////////
|
|
////////////////////////////////////////////////
|
|
////////////////////////////////////////////////
|
|
/**
|
|
* Javascript Variables
|
|
*
|
|
* @abstract Non hook variables and functions
|
|
*/ ////////////////////////////////////////////////
|
|
////////////////////////////////////////////////
|
|
////////////////////////////////////////////////
|
|
/**
|
|
* React Hooks
|
|
*
|
|
* @abstract { useState, useEffect, useRef, etc ... }
|
|
*/ const [loading, setLoading] = external_react_default().useState(false);
|
|
/** @type {[ backups: string[], setBackups: React.Dispatch<React.SetStateAction<string[]>> ]} */ // @ts-ignore
|
|
const [backups, setBackups] = external_react_default().useState([]);
|
|
const [refresh, setRefresh] = external_react_default().useState(0);
|
|
external_react_default().useEffect(()=>{
|
|
(0,fetchApi/* default */.Z)("/api/admin/grabBackups").then((res)=>{
|
|
setBackups(res.backups);
|
|
});
|
|
}, [
|
|
refresh
|
|
]);
|
|
////////////////////////////////////////////////
|
|
////////////////////////////////////////////////
|
|
////////////////////////////////////////////////
|
|
/**
|
|
* Function Return
|
|
*
|
|
* @description Main Function Return
|
|
*/ return /*#__PURE__*/ (0,jsx_runtime_.jsxs)((external_react_default()).Fragment, {
|
|
children: [
|
|
loading && /*#__PURE__*/ jsx_runtime_.jsx(LoadingBlock/* default */.Z, {}),
|
|
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
|
|
className: "w-full justify-between",
|
|
children: [
|
|
/*#__PURE__*/ jsx_runtime_.jsx("h2", {
|
|
className: "text-xl m-0",
|
|
children: "Backups"
|
|
}),
|
|
/*#__PURE__*/ jsx_runtime_.jsx("div", {
|
|
children: /*#__PURE__*/ jsx_runtime_.jsx("button", {
|
|
onClick: (e)=>{
|
|
if (window.confirm("Create new backup?")) {
|
|
setLoading(true);
|
|
(0,fetchApi/* default */.Z)("/api/admin/createNewBackup").then((res)=>{
|
|
setRefresh((prev)=>prev + 1);
|
|
setTimeout(()=>{
|
|
setLoading(false);
|
|
}, 2000);
|
|
});
|
|
}
|
|
},
|
|
className: "relative",
|
|
children: "Create New Backup"
|
|
})
|
|
})
|
|
]
|
|
}),
|
|
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("section", {
|
|
className: backups && backups[0] ? "p-0 gap-4" : "paper",
|
|
children: [
|
|
!backups && /*#__PURE__*/ jsx_runtime_.jsx(LoadingBlock/* default */.Z, {}),
|
|
backups && backups[0] && backups.sort((a, b)=>{
|
|
if (parseInt(a) > parseInt(b)) return -1;
|
|
return 1;
|
|
}).map((backup, index)=>{
|
|
const backupDate = new Date(parseInt(backup));
|
|
return /*#__PURE__*/ (0,jsx_runtime_.jsxs)("a", {
|
|
href: `/su/backups/${backup}`,
|
|
className: "card w-full items-center",
|
|
children: [
|
|
/*#__PURE__*/ jsx_runtime_.jsx((StyleTwoTone_default()), {
|
|
color: "inherit",
|
|
className: "opacity-40 text-slate-500"
|
|
}),
|
|
/*#__PURE__*/ jsx_runtime_.jsx("b", {
|
|
children: "Backup:"
|
|
}),
|
|
/*#__PURE__*/ jsx_runtime_.jsx("span", {
|
|
children: backupDate.toString()
|
|
})
|
|
]
|
|
}, backup);
|
|
}),
|
|
backups && !backups[0] && /*#__PURE__*/ jsx_runtime_.jsx("span", {
|
|
children: "No Backups Yet"
|
|
})
|
|
]
|
|
})
|
|
]
|
|
});
|
|
////////////////////////////////////////////////
|
|
////////////////////////////////////////////////
|
|
////////////////////////////////////////////////
|
|
} //////////////////////////////////////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////////////////////////////////////
|
|
|
|
;// CONCATENATED MODULE: ./pages/su/backups.jsx
|
|
// @ts-check
|
|
/**
|
|
* ==============================================================================
|
|
* Imports
|
|
* ==============================================================================
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
|
|
* ==============================================================================
|
|
* Main Component { Functional }
|
|
* ==============================================================================
|
|
* @param {Object} props - Server props
|
|
* @param {import("@/package-shared/types").UserType} props.user
|
|
* @param {any} [props.data]
|
|
*/ function Backups({ user , data }) {
|
|
/**
|
|
* Get Contexts
|
|
*
|
|
* @abstract { React.useContext }
|
|
*/ ////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
/**
|
|
* Javascript Variables
|
|
*
|
|
* @abstract Non hook variables and functions
|
|
*/ const pageTitle = "Backups | Datasquirel";
|
|
const pageDescription = "Databases backups";
|
|
let head = /*#__PURE__*/ (0,jsx_runtime_.jsxs)(jsx_runtime_.Fragment, {
|
|
children: [
|
|
/*#__PURE__*/ jsx_runtime_.jsx("title", {
|
|
children: pageTitle
|
|
}),
|
|
/*#__PURE__*/ jsx_runtime_.jsx("meta", {
|
|
name: "description",
|
|
content: pageDescription
|
|
})
|
|
]
|
|
});
|
|
////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
/**
|
|
* React Hooks
|
|
*
|
|
* @abstract { useState, useEffect, useRef, etc ... }
|
|
*/ ////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
/**
|
|
* Function Return
|
|
*
|
|
* @abstract Main Function Return
|
|
*/ return /*#__PURE__*/ jsx_runtime_.jsx(SuAdminLayout/* default */.Z, {
|
|
head: head,
|
|
user: user,
|
|
children: /*#__PURE__*/ jsx_runtime_.jsx(SuBackupsContent, {})
|
|
});
|
|
////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
}
|
|
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
|
|
* ==============================================================================
|
|
* Server Side Props or Static Props
|
|
* ==============================================================================
|
|
* @type {import("next").GetServerSideProps}
|
|
*/ async function getServerSideProps({ req , res , query }) {
|
|
/**
|
|
* User Auth
|
|
*
|
|
* @description User Auth
|
|
*/ const suAdminUser = await suAdminUserAuth_default()(req);
|
|
if (!suAdminUser?.logged_in_status) {
|
|
return {
|
|
redirect: {
|
|
destination: `/su/login`,
|
|
permanent: false
|
|
}
|
|
};
|
|
}
|
|
/**
|
|
* Page/Site Data Data Fetching
|
|
*
|
|
* @description Fetch data on the server before returning
|
|
*/ ////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
/**
|
|
* Server props return
|
|
*
|
|
* @description Return data fetched on the server side
|
|
*/ return {
|
|
props: {
|
|
user: suAdminUser
|
|
}
|
|
};
|
|
////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
////////////////////////////////////////
|
|
}
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 9318:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("@mui/icons-material/BackupTwoTone");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 386:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("@mui/icons-material/CottageTwoTone");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 6817:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("@mui/icons-material/DocumentScannerTwoTone");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 6094:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("@mui/icons-material/ErrorTwoTone");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 6547:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("@mui/icons-material/LockPersonTwoTone");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 5557:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("@mui/icons-material/MenuBookTwoTone");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 8245:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("@mui/icons-material/PeopleAltTwoTone");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 723:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("@mui/icons-material/StyleTwoTone");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 415:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("@mui/icons-material/TerminalTwoTone");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 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");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 4300:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("buffer");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 6113:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("crypto");
|
|
|
|
/***/ }),
|
|
|
|
/***/ 3685:
|
|
/***/ ((module) => {
|
|
|
|
module.exports = require("http");
|
|
|
|
/***/ })
|
|
|
|
};
|
|
;
|
|
|
|
// 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,5304,1503,5313,6251], () => (__webpack_exec__(8188)));
|
|
module.exports = __webpack_exports__;
|
|
|
|
})(); |