15 |18 | ); 19 | } 20 | 21 | Quote.propTypes = { 22 | text: PropTypes.node, 23 | author: PropTypes.node, 24 | }; 25 | -------------------------------------------------------------------------------- /client/src/Dashboard/components/Typography/Success.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import PropTypes from 'prop-types'; 3 | // @material-ui/core components 4 | import { makeStyles } from '@material-ui/core/styles'; 5 | // core components 6 | import styles from '../../assets/jss/material-dashboard-react/components/typographyStyle.js'; 7 | 8 | const useStyles = makeStyles(styles); 9 | 10 | export default function Success(props) { 11 | const classes = useStyles(); 12 | const { children } = props; 13 | return ( 14 |{text}
16 | {author} 17 |
Thank you for choosing Helios to monitor your serverless application!
From now on, your login will be associated with the new email you provided us.
`; 21 | mailOptions = { 22 | from: sender, 23 | to: recipient, 24 | subject: 'Your Email Has Been Updated', 25 | html: content, 26 | }; 27 | // email content for changing password 28 | } else if (type === 'passwordChange') { 29 | content = `Thank you for choosing Helios to monitor your serverless application!
From now on, your login will be associated with the new password you provided us.
`; 30 | mailOptions = { 31 | from: sender, 32 | to: recipient, 33 | subject: 'Your Password Has Been Updated', 34 | html: content, 35 | }; 36 | } else if (type === 'passwordReset') { 37 | content = `Thank you for choosing Helios to monitor your serverless application!
Please copy the below code to reset your account password:
${resetToken}
`; 38 | mailOptions = { 39 | from: sender, 40 | to: recipient, 41 | subject: 'Reset Your Password', 42 | html: content, 43 | }; 44 | } 45 | // send the email 46 | Transport.sendMail(mailOptions, function (error, response) { 47 | if (error) { 48 | console.error(error); 49 | return { status: false, error: error }; 50 | } else { 51 | console.log('Message Sent'); 52 | return { status: true }; 53 | } 54 | }); 55 | }; 56 | 57 | module.exports = sendEmail; 58 | -------------------------------------------------------------------------------- /server/routes/aws.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const router = express.Router(); 3 | 4 | //AWS specific details 5 | const getCredentials = require('../controllers/aws/Credentials/getCreds'); 6 | const getFunctions = require('../controllers/aws/Metrics/getLambdaFuncs'); 7 | const getMetricsAllFunc = require('../controllers/aws/Metrics/getMetricsAllFunc'); 8 | const getMetricsByFunc = require('../controllers/aws/Metrics/getMetricsByFunc'); 9 | const getLogs = require('../controllers/aws/Logs/getLogs'); 10 | const updateLogs = require('../controllers/aws/Logs/updateLogs'); 11 | const getAPIData = require('../controllers/aws/APIGateway/getAPI'); 12 | const getApiMetrics = require('../controllers/aws/APIGateway/getAPIMetrics'); 13 | const updateApiMetrics = require('../controllers/aws/APIGateway/updateAPIMetrics'); 14 | 15 | //AWS Assumed Role Credentials 16 | router.route('/getCreds').post(getCredentials, (req, res) => { 17 | res.status(200).json(res.locals.credentials); 18 | }); 19 | 20 | //Returing Lambda Functions List 21 | router.route('/getLambdaFunctions').post(getFunctions, (req, res) => { 22 | res.status(200).json(res.locals.functions); 23 | }); 24 | 25 | //Returing Lambda Functions Metric Totals (All functions): by metricName 26 | router 27 | .route('/getMetricsAllfunc/:metricName') 28 | .post(getMetricsAllFunc, (req, res) => { 29 | res.status(200).json(res.locals.metricAllFuncData); 30 | }); 31 | 32 | //Returing Lambda Functions Logs 33 | router.route('/getLogs').post(getLogs, (req, res) => { 34 | res.status(200).json(res.locals.functionLogs); 35 | }); 36 | 37 | //Updating Lambda Function Logs 38 | router.route('/updateLogs').post(updateLogs, (req, res) => { 39 | res.status(200).json(res.locals.updatedLogs); 40 | }); 41 | 42 | router 43 | .route('/getMetricsByFunc/:metricName') 44 | .post(getMetricsByFunc, (req, res) => { 45 | res.status(200).json(res.locals.metricByFuncData); 46 | }); 47 | 48 | // API Gateway data - list of APIs existing on user account 49 | router.route('/apiGateway').post(getAPIData, (req, res) => { 50 | res.status(200).json(res.locals.apiData); 51 | }); 52 | 53 | // handle getting an APIs metrics when requested 54 | router.route('/getApiMetrics').post(getApiMetrics, (req, res) => { 55 | res.status(200).json(res.locals.apiMetrics); 56 | }); 57 | 58 | // if time period is updated, fetches updated API metric data 59 | router.route('/updateApiMetrics').post(updateApiMetrics, (req, res) => { 60 | res.status(200).json(res.locals.apiMetrics); 61 | }); 62 | 63 | module.exports = router; 64 | -------------------------------------------------------------------------------- /server/routes/user.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const router = express.Router(); 3 | 4 | const userController = require('../controllers/userController'); 5 | 6 | // handle signup requests 7 | router.route('/signup').post(userController.createUser, (req, res) => { 8 | res.status(200).json(res.locals.confirmation); 9 | }); 10 | 11 | // handle login requests 12 | router.route('/login').post(userController.verifyUser, (req, res) => { 13 | res.status(200).json(res.locals.confirmation); 14 | }); 15 | 16 | // handle registration requests 17 | router.route('/register').post(userController.addArn, (req, res) => { 18 | res.sendStatus(200); 19 | }); 20 | 21 | // handle when a user requests to update their region 22 | router.route('/updateRegion').post(userController.updateRegion, (req, res) => { 23 | res.status(200).json(res.locals.confirmation); 24 | }); 25 | 26 | // handle when a user requests to update their ARN 27 | router.route('/updateArn').post(userController.updateArn, (req, res) => { 28 | res.status(200).json(res.locals.confirmation); 29 | }); 30 | 31 | // handle when a user requests to update their email 32 | router.route('/updateEmail').post(userController.updateEmail, (req, res) => { 33 | res.status(200).json(res.locals.confirmation); 34 | }); 35 | 36 | // handle when a user requests to change their email 37 | router 38 | .route('/updatePassword') 39 | .post(userController.updatePassword, (req, res) => { 40 | res.status(200).json(res.locals.confirmation); 41 | }); 42 | 43 | // handle when a user starts the "Forgot Password" process 44 | router 45 | .route('/forgotPassword') 46 | .post(userController.forgotPassword, (req, res) => { 47 | res.status(200).json(res.locals.confirmation); 48 | }); 49 | 50 | // handles accepting and verifying the verification code the user sends to continue changing password 51 | router 52 | .route('/verifyAccount') 53 | .post(userController.checkVerificationCode, (req, res) => { 54 | res.status(200).json(res.locals.confirmation); 55 | }); 56 | 57 | // handles actually resetting the user's password 58 | router 59 | .route('/resetPassword') 60 | .post(userController.resetPassword, (req, res) => { 61 | res.status(200).json(res.locals.confirmation); 62 | }); 63 | 64 | module.exports = router; 65 | -------------------------------------------------------------------------------- /server/server.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const app = express(); 3 | const path = require('path'); 4 | const mongoose = require('mongoose'); 5 | 6 | const awsRouter = require('./routes/aws.js'); 7 | const userRouter = require('./routes/user.js'); 8 | 9 | const PORT = 4242; 10 | 11 | app.use(express.json()); 12 | app.use(express.urlencoded({ extended: true })); 13 | 14 | app.use(express.static(path.resolve(__dirname, '../client/src/Dashboard'))); 15 | app.use(express.static(path.resolve(__dirname, '../client/src'))); 16 | 17 | app.use('/build', express.static(path.resolve(__dirname, '../build'))); 18 | //Route all User related requests to User Router 19 | app.use('/user', userRouter); 20 | 21 | //Route all AWS requests to AWS router 22 | app.use('/aws', awsRouter); 23 | 24 | //server index.html for the root call 25 | app.get('/', (req, res) => { 26 | return res 27 | .status(200) 28 | .sendFile(path.resolve(__dirname, '../public/index.html')); 29 | }); 30 | 31 | // catch-all route handler for any requests 32 | app.use((req, res) => { 33 | res.sendStatus(404); 34 | }); 35 | 36 | //global error handler 37 | app.use((err, req, res, next) => { 38 | const defaultErr = { 39 | log: 'Express error handler caught unknown middleware error', 40 | status: 400, 41 | message: { err: 'An error occurred' }, 42 | }; 43 | const errObj = Object.assign(defaultErr, err); 44 | console.error('Error: ', errObj.log); 45 | res.status(errObj.status).send(errObj.message); 46 | }); 47 | 48 | module.exports = app.listen(PORT, () => { 49 | console.log(`Listening on port ${PORT}`); 50 | }); 51 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const ImageMinimizerPlugin = require('image-minimizer-webpack-plugin'); 3 | 4 | module.exports = { 5 | entry: ['babel-polyfill', './client/src/index.js'], 6 | devServer: { 7 | // contentBase: __dirname + '/client/src/', 8 | publicPath: './build', 9 | proxy: { 10 | '/': 'http://localhost:4242', 11 | }, 12 | }, 13 | target: 'electron-main', 14 | mode: process.env.NODE_ENV, 15 | module: { 16 | rules: [ 17 | { 18 | test: /\.jsx?/, 19 | exclude: /(node_modules)/, 20 | use: { 21 | loader: 'babel-loader', 22 | options: { 23 | presets: ['@babel/preset-env', '@babel/preset-react'], 24 | plugins: [ 25 | '@babel/plugin-transform-runtime', 26 | '@babel/transform-async-to-generator', 27 | ], 28 | }, 29 | }, 30 | }, 31 | { 32 | test: /\.(scss|css|sass)$/i, 33 | use: ['style-loader', 'css-loader', 'sass-loader'], 34 | }, 35 | { 36 | test: /\.(png|svg|jpg|jpeg|gif)$/i, 37 | use: [ 38 | { 39 | loader: 'url-loader', 40 | options: { 41 | limit: 8192, 42 | }, 43 | }, 44 | ], 45 | }, 46 | ], 47 | }, 48 | output: { 49 | path: path.resolve(__dirname, 'build'), 50 | publicPath: '/build/', 51 | filename: 'bundle.js', 52 | }, 53 | plugins: [ 54 | new ImageMinimizerPlugin({ 55 | minimizerOptions: { 56 | // Lossless optimization with custom option 57 | // Feel free to experiment with options for better result for you 58 | plugins: [ 59 | ['gifsicle', { interlaced: true }], 60 | ['jpegtran', { progressive: true }], 61 | ['optipng', { optimizationLevel: 5 }], 62 | [ 63 | 'svgo', 64 | { 65 | plugins: [ 66 | { 67 | removeViewBox: false, 68 | }, 69 | ], 70 | }, 71 | ], 72 | ], 73 | }, 74 | }), 75 | ], 76 | resolve: { 77 | // Enable importing JS / JSX files without specifying their extension 78 | extensions: ['.js', '.jsx'], 79 | }, 80 | }; 81 | --------------------------------------------------------------------------------