Merge pull request #814 from bluewave-labs/feat/demo-features
Feat/demo features
This commit is contained in:
8 files changed
+44
-28
No files matched your search
@@ -90,6 +90,14 @@ function Sidebar() {
|
|||||||
const [open, setOpen] = useState({ Dashboard: false, Account: false });
|
const [open, setOpen] = useState({ Dashboard: false, Account: false });
|
||||||
const [anchorEl, setAnchorEl] = useState(null);
|
const [anchorEl, setAnchorEl] = useState(null);
|
||||||
const [popup, setPopup] = useState();
|
const [popup, setPopup] = useState();
|
||||||
|
const { user } = useSelector((state) => state.auth);
|
||||||
|
|
||||||
|
// Remove demo password if demo
|
||||||
|
if (user.role.includes("demo")) {
|
||||||
|
menu[3].nested = menu[3].nested.filter((item) => {
|
||||||
|
return item.name !== "Password";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const openPopup = (event, id) => {
|
const openPopup = (event, id) => {
|
||||||
setAnchorEl(event.currentTarget);
|
setAnchorEl(event.currentTarget);
|
||||||
|
|||||||
@@ -331,22 +331,24 @@ const ProfilePanel = () => {
|
|||||||
borderColor: theme.palette.border.light,
|
borderColor: theme.palette.border.light,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Box component="form" noValidate spellCheck="false">
|
{!user.role.includes("demo") && (
|
||||||
<Box mb={theme.spacing(6)}>
|
<Box component="form" noValidate spellCheck="false">
|
||||||
<Typography component="h1">Delete account</Typography>
|
<Box mb={theme.spacing(6)}>
|
||||||
<Typography component="p" sx={{ opacity: 0.6 }}>
|
<Typography component="h1">Delete account</Typography>
|
||||||
Note that deleting your account will remove all data from our
|
<Typography component="p" sx={{ opacity: 0.6 }}>
|
||||||
system. This is permanent and non-recoverable.
|
Note that deleting your account will remove all data from our
|
||||||
</Typography>
|
system. This is permanent and non-recoverable.
|
||||||
|
</Typography>
|
||||||
|
</Box>
|
||||||
|
<Button
|
||||||
|
variant="contained"
|
||||||
|
color="error"
|
||||||
|
onClick={() => setIsOpen("delete")}
|
||||||
|
>
|
||||||
|
Delete account
|
||||||
|
</Button>
|
||||||
</Box>
|
</Box>
|
||||||
<Button
|
)}
|
||||||
variant="contained"
|
|
||||||
color="error"
|
|
||||||
onClick={() => setIsOpen("delete")}
|
|
||||||
>
|
|
||||||
Delete account
|
|
||||||
</Button>
|
|
||||||
</Box>
|
|
||||||
{/* TODO - Update ModalPopup Component with @mui for reusability */}
|
{/* TODO - Update ModalPopup Component with @mui for reusability */}
|
||||||
<Modal
|
<Modal
|
||||||
aria-labelledby="modal-delete-account"
|
aria-labelledby="modal-delete-account"
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ const TeamPanel = () => {
|
|||||||
superadmin: "Super admin",
|
superadmin: "Super admin",
|
||||||
admin: "Admin",
|
admin: "Admin",
|
||||||
user: "Team member",
|
user: "Team member",
|
||||||
|
demo: "Demo User",
|
||||||
};
|
};
|
||||||
|
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
|||||||
@@ -22,15 +22,20 @@ const Account = ({ open = "profile" }) => {
|
|||||||
const handleTabChange = (event, newTab) => {
|
const handleTabChange = (event, newTab) => {
|
||||||
navigate(`/account/${newTab}`);
|
navigate(`/account/${newTab}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
let tabList = ["Profile", "Password", "Team"];
|
|
||||||
const { user } = useSelector((state) => state.auth);
|
const { user } = useSelector((state) => state.auth);
|
||||||
|
|
||||||
const requiredRoles = ["superadmin", "admin"];
|
const requiredRoles = ["superadmin", "admin"];
|
||||||
|
let tabList = ["Profile", "Team", "Password"];
|
||||||
const hideTeams = !requiredRoles.some((role) => user.role.includes(role));
|
const hideTeams = !requiredRoles.some((role) => user.role.includes(role));
|
||||||
if (hideTeams) {
|
if (hideTeams) {
|
||||||
tabList = ["Profile", "Password"];
|
tabList = ["Profile", "Password"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove password for demo
|
||||||
|
if (user.role.includes("demo")) {
|
||||||
|
tabList = ["Profile"];
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
className="account"
|
className="account"
|
||||||
@@ -74,7 +79,7 @@ const Account = ({ open = "profile" }) => {
|
|||||||
</TabList>
|
</TabList>
|
||||||
</Box>
|
</Box>
|
||||||
<ProfilePanel />
|
<ProfilePanel />
|
||||||
<PasswordPanel />
|
{user.role.includes("superadmin") && <PasswordPanel />}
|
||||||
{!hideTeams && <TeamPanel />}
|
{!hideTeams && <TeamPanel />}
|
||||||
</TabContext>
|
</TabContext>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import ArrowBackRoundedIcon from "@mui/icons-material/ArrowBackRounded";
|
|||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
import { logger } from "../../Utils/Logger";
|
import { logger } from "../../Utils/Logger";
|
||||||
import "./index.css";
|
import "./index.css";
|
||||||
|
const DEMO = import.meta.env.VITE_APP_DEMO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays the initial landing page.
|
* Displays the initial landing page.
|
||||||
@@ -327,8 +328,8 @@ const Login = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const [form, setForm] = useState({
|
const [form, setForm] = useState({
|
||||||
email: "",
|
email: DEMO !== undefined ? "uptimedemo@demo.com" : "",
|
||||||
password: "",
|
password: DEMO !== undefined ? "Demouser1!" : "",
|
||||||
});
|
});
|
||||||
const [errors, setErrors] = useState({});
|
const [errors, setErrors] = useState({});
|
||||||
const [step, setStep] = useState(0);
|
const [step, setStep] = useState(0);
|
||||||
|
|||||||
@@ -10,11 +10,9 @@
|
|||||||
|
|
||||||
<p align="center"><strong>An open source server monitoring application</strong></p>
|
<p align="center"><strong>An open source server monitoring application</strong></p>
|
||||||
|
|
||||||
|
|
||||||

|

|
||||||
(yes, we have a light theme as well, but this looks better on readme.md)
|
(yes, we have a light theme as well, but this looks better on readme.md)
|
||||||
|
|
||||||
|
|
||||||
BlueWave Uptime is an open source server monitoring application used to track the operational status and performance of servers and websites. It regularly checks whether a server/website is accessible and performs optimally, providing real-time alerts and reports on the monitored services' availability, downtime, and response time.
|
BlueWave Uptime is an open source server monitoring application used to track the operational status and performance of servers and websites. It regularly checks whether a server/website is accessible and performs optimally, providing real-time alerts and reports on the monitored services' availability, downtime, and response time.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
@@ -214,10 +212,11 @@ That's it, the application is ready to use on port 80.
|
|||||||
|
|
||||||
##### Environmental Variables <a id="env-vars-client"></a>
|
##### Environmental Variables <a id="env-vars-client"></a>
|
||||||
|
|
||||||
| ENV Variable Name | Required/Optional | Type | Description | Accepted Values |
|
| ENV Variable Name | Required/Optional | Type | Description | Accepted Values |
|
||||||
| --------------------- | ----------------- | -------- | ------------------ | ---------------------------------- |
|
| --------------------- | ----------------- | --------- | ------------------ | ---------------------------------- |
|
||||||
| VITE_APP_API_BASE_URL | Required | `string` | Base URL of server | {host}/api/v1 |
|
| VITE_APP_API_BASE_URL | Required | `string` | Base URL of server | {host}/api/v1 |
|
||||||
| VITE_APP_LOG_LEVEL | Optional | `string` | Log level | `"none"`\|`"error"` \| `"warn"` \| |
|
| VITE_APP_LOG_LEVEL | Optional | `string` | Log level | `"none"`\|`"error"` \| `"warn"` \| |
|
||||||
|
| VITE_APP_DEMO | Optional | `boolean` | Demo server or not | `true`\|`false` \| |
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ const UserSchema = mongoose.Schema(
|
|||||||
role: {
|
role: {
|
||||||
type: [String],
|
type: [String],
|
||||||
default: "user",
|
default: "user",
|
||||||
enum: ["user", "admin", "superadmin"],
|
enum: ["user", "admin", "superadmin", "demo"],
|
||||||
},
|
},
|
||||||
teamId: {
|
teamId: {
|
||||||
type: mongoose.Schema.Types.ObjectId,
|
type: mongoose.Schema.Types.ObjectId,
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ const registrationBodyValidation = joi.object({
|
|||||||
profileImage: joi.any(),
|
profileImage: joi.any(),
|
||||||
role: joi
|
role: joi
|
||||||
.array()
|
.array()
|
||||||
.items(joi.string().valid("superadmin", "admin", "user"))
|
.items(joi.string().valid("superadmin", "admin", "user", "demo"))
|
||||||
.min(1)
|
.min(1)
|
||||||
.required(),
|
.required(),
|
||||||
teamId: joi.string().allow("").required(),
|
teamId: joi.string().allow("").required(),
|
||||||
|
|||||||
Reference in new issue
Block a user