First Commit
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@@ -0,0 +1,498 @@
|
||||
"use strict";
|
||||
(() => {
|
||||
var exports = {};
|
||||
exports.id = 1383;
|
||||
exports.ids = [1383];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 7650:
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
// ESM COMPAT FLAG
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
|
||||
// EXPORTS
|
||||
__webpack_require__.d(__webpack_exports__, {
|
||||
"SingleDatabaseUsersContext": () => (/* binding */ SingleDatabaseUsersContext),
|
||||
"default": () => (/* binding */ DatabaseUsersPage),
|
||||
"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: ./layouts/AdminLayout.jsx + 2 modules
|
||||
var AdminLayout = __webpack_require__(4858);
|
||||
// EXTERNAL MODULE: ./functions/backend/userAuth.js
|
||||
var userAuth = __webpack_require__(370);
|
||||
var userAuth_default = /*#__PURE__*/__webpack_require__.n(userAuth);
|
||||
// EXTERNAL MODULE: ./components/admin/users/TargetUserPreviewPopup.jsx
|
||||
var TargetUserPreviewPopup = __webpack_require__(9417);
|
||||
// EXTERNAL MODULE: ./components/general/Breadcrumbs.jsx
|
||||
var Breadcrumbs = __webpack_require__(424);
|
||||
// EXTERNAL MODULE: ./components/admin/users/UserListCard.jsx
|
||||
var UserListCard = __webpack_require__(3863);
|
||||
// EXTERNAL MODULE: ./components/general/BackButton.jsx
|
||||
var BackButton = __webpack_require__(1781);
|
||||
;// CONCATENATED MODULE: ./components/admin/users/SingleDatabaseUsersContent.jsx
|
||||
// @ts-check
|
||||
/**
|
||||
* ==============================================================================
|
||||
* Imports
|
||||
* ==============================================================================
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
|
||||
* ==============================================================================
|
||||
* Main Component { Functional }
|
||||
* ==============================================================================
|
||||
* @param {Object} props - Server props
|
||||
*/ function SingleDatabaseUsersContent(props) {
|
||||
/**
|
||||
* Get Contexts
|
||||
*
|
||||
* @abstract { React.useContext }
|
||||
*/ const { database , users , user } = external_react_default().useContext(SingleDatabaseUsersContext);
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
/**
|
||||
* Javascript Variables
|
||||
*
|
||||
* @abstract Non hook variables and functions
|
||||
*/ ////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
/**
|
||||
* React Hooks
|
||||
*
|
||||
* @abstract { useState, useEffect, useRef, etc ... }
|
||||
*/ ////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
/**
|
||||
* Function Return
|
||||
*
|
||||
* @abstract Main Function Return
|
||||
*/ return /*#__PURE__*/ (0,jsx_runtime_.jsxs)((external_react_default()).Fragment, {
|
||||
children: [
|
||||
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
|
||||
className: "flex-col items-start gap-0 w-full",
|
||||
children: [
|
||||
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
|
||||
className: "w-full justify-between flex-wrap",
|
||||
children: [
|
||||
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
|
||||
children: [
|
||||
/*#__PURE__*/ jsx_runtime_.jsx(BackButton/* default */.Z, {}),
|
||||
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("h1", {
|
||||
className: "text-3xl m-0",
|
||||
children: [
|
||||
database.db_name,
|
||||
" Users"
|
||||
]
|
||||
})
|
||||
]
|
||||
}),
|
||||
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("a", {
|
||||
href: `/admin/${user?.id}/users/add-user?db=${database.db_slug}`,
|
||||
className: "flex items-center gap-2 whitespace-normal button",
|
||||
children: [
|
||||
/*#__PURE__*/ jsx_runtime_.jsx("span", {
|
||||
className: "symbol",
|
||||
children: "+"
|
||||
}),
|
||||
/*#__PURE__*/ jsx_runtime_.jsx("span", {
|
||||
children: "Add New User"
|
||||
})
|
||||
]
|
||||
})
|
||||
]
|
||||
}),
|
||||
/*#__PURE__*/ jsx_runtime_.jsx(Breadcrumbs/* default */.Z, {
|
||||
user: user
|
||||
})
|
||||
]
|
||||
}),
|
||||
/*#__PURE__*/ jsx_runtime_.jsx("div", {
|
||||
className: "paper w-full flex-col items-stretch",
|
||||
children: users && users[0] ? users.map((userObject)=>{
|
||||
return /*#__PURE__*/ (0,jsx_runtime_.jsxs)("a", {
|
||||
href: `/admin/${user?.id}/users/databases/${database.db_slug}/${userObject.id}`,
|
||||
className: "w-full flex items-center gap-2 p-4 border border-solid border-slate-200 rounded cursor-pointer hover:border-slate-400 flex-wrap",
|
||||
onClick: (e)=>{
|
||||
// @ts-ignore
|
||||
if (e.target.closest("button")) return e.preventDefault();
|
||||
// setTargetUser(userObject)
|
||||
// openPopup("target-media-popup")
|
||||
},
|
||||
children: [
|
||||
/*#__PURE__*/ jsx_runtime_.jsx("img", {
|
||||
src: userObject.image_thumbnail,
|
||||
alt: "",
|
||||
className: "w-10 h-10 rounded-full object-cover bg-slate-200"
|
||||
}),
|
||||
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
|
||||
className: "flex-col items-start gap-1",
|
||||
children: [
|
||||
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("span", {
|
||||
className: "font-bold",
|
||||
children: [
|
||||
userObject.first_name,
|
||||
" ",
|
||||
userObject.last_name
|
||||
]
|
||||
}),
|
||||
/*#__PURE__*/ jsx_runtime_.jsx("span", {
|
||||
className: "text-xs text-slate-500",
|
||||
children: userObject.date_created?.substring(0, 16)
|
||||
})
|
||||
]
|
||||
}),
|
||||
/*#__PURE__*/ jsx_runtime_.jsx("button", {
|
||||
className: "ml-auto outlined gray pointer-events-none",
|
||||
children: "Edit User"
|
||||
})
|
||||
]
|
||||
});
|
||||
}) : /*#__PURE__*/ jsx_runtime_.jsx("span", {
|
||||
children: "No Users for this database yet"
|
||||
})
|
||||
})
|
||||
]
|
||||
});
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
} /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */
|
||||
|
||||
// EXTERNAL MODULE: ./package-shared/utils/backend/global-db/DB_HANDLER.js
|
||||
var DB_HANDLER = __webpack_require__(9395);
|
||||
var DB_HANDLER_default = /*#__PURE__*/__webpack_require__.n(DB_HANDLER);
|
||||
;// CONCATENATED MODULE: ./pages/admin/[user_id]/users/databases/[database]/index.jsx
|
||||
// @ts-check
|
||||
/**
|
||||
* ==============================================================================
|
||||
* Imports
|
||||
* ==============================================================================
|
||||
*/
|
||||
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** ****************************************************************************** */ /** @type {import("@/package-shared/types").DelegatedDbContextType} */ // @ts-ignore
|
||||
const init = {};
|
||||
const SingleDatabaseUsersContext = /*#__PURE__*/ external_react_default().createContext(init);
|
||||
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
|
||||
* ==============================================================================
|
||||
* Main Component { Functional }
|
||||
* ==============================================================================
|
||||
* @param {Object} props - Server props
|
||||
* @param {import("@/package-shared/types").UserType} props.user
|
||||
* @param {import("@/package-shared/types").MYSQL_user_users_table_def[]} props.users
|
||||
* @param {import("@/package-shared/types").DSQL_MYSQL_user_databases_Type} props.database
|
||||
*/ function DatabaseUsersPage({ user , users , database }) {
|
||||
/**
|
||||
* Get Contexts
|
||||
*
|
||||
* @abstract { React.useContext }
|
||||
*/ ////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
/**
|
||||
* Javascript Variables
|
||||
*
|
||||
* @abstract Non hook variables and functions
|
||||
*/ const pageTitle = `${database.db_name} Users | Datasquirel"`;
|
||||
const pageDescription = "Welcome to your data app";
|
||||
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 ... }
|
||||
*/ const [newUser, setNewUser] = external_react_default().useState(null);
|
||||
/** @type {[ targetUser: import("@/package-shared/types").MYSQL_user_users_table_def | null, setTargetUser: React.Dispatch<React.SetStateAction<import("@/package-shared/types").MYSQL_user_users_table_def | null>> ]} */ // @ts-ignore
|
||||
const [targetUser, setTargetUser] = external_react_default().useState(null);
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
/**
|
||||
* Function Return
|
||||
*
|
||||
* @abstract Main Function Return
|
||||
*/ return /*#__PURE__*/ jsx_runtime_.jsx(AdminLayout/* default */.Z, {
|
||||
head: head,
|
||||
user: user,
|
||||
children: /*#__PURE__*/ (0,jsx_runtime_.jsxs)(SingleDatabaseUsersContext.Provider, {
|
||||
value: {
|
||||
user,
|
||||
users,
|
||||
targetUser,
|
||||
setTargetUser,
|
||||
database
|
||||
},
|
||||
children: [
|
||||
/*#__PURE__*/ jsx_runtime_.jsx(SingleDatabaseUsersContent, {}),
|
||||
/*#__PURE__*/ jsx_runtime_.jsx(TargetUserPreviewPopup/* default */.Z, {
|
||||
targetUser: targetUser,
|
||||
user: user,
|
||||
setTargetUser: setTargetUser
|
||||
})
|
||||
]
|
||||
})
|
||||
});
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
}
|
||||
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
|
||||
* ==============================================================================
|
||||
* Server Side Props or Static Props
|
||||
* ==============================================================================
|
||||
* @type {import("next").GetServerSideProps}
|
||||
*/ async function getServerSideProps({ req , res , query }) {
|
||||
/**
|
||||
* User Auth
|
||||
*
|
||||
* @description User Auth
|
||||
*/ const user = await userAuth_default()(req, res);
|
||||
if (!user?.logged_in_status) {
|
||||
return {
|
||||
redirect: {
|
||||
destination: "/logout",
|
||||
permanent: false
|
||||
}
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Page/Site Data Data Fetching
|
||||
*
|
||||
* @description Fetch data on the server before returning
|
||||
*/ const users = await DB_HANDLER_default()(`SELECT * FROM user_users WHERE user_id='${user.id}' AND \`database\`='${query.database}'`);
|
||||
const database = await DB_HANDLER_default()(`SELECT db_name,db_slug,db_image FROM user_databases WHERE user_id='${user.id}' AND db_slug='${query.database}'`);
|
||||
if (!database || !database[0]) {
|
||||
return {
|
||||
redirect: {
|
||||
destination: `/admin/${user?.id}/users`,
|
||||
permanent: false
|
||||
}
|
||||
};
|
||||
}
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
/**
|
||||
* Server props return
|
||||
*
|
||||
* @description Return data fetched on the server side
|
||||
*/ return {
|
||||
props: {
|
||||
user: user,
|
||||
users: users,
|
||||
database: database[0]
|
||||
}
|
||||
};
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4003:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/AdminPanelSettingsTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3257:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/ArrowBackIosRounded");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 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");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 386:
|
||||
/***/ ((module) => {
|
||||
|
||||
module.exports = require("@mui/icons-material/CottageTwoTone");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 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");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 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,5304,913,9395,370,424,4858,5472,1781,4114,9486,9417,3863], () => (__webpack_exec__(7650)));
|
||||
module.exports = __webpack_exports__;
|
||||
|
||||
})();
|
||||
+1
File diff suppressed because one or more lines are too long
+647
File diff suppressed because it is too large
Load Diff
+1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user