Skip to content

Commit 1c287e8

Browse files
committed
got eks running region us west
2 parents 1089aa6 + ded2b93 commit 1c287e8

File tree

19 files changed

+12743
-117
lines changed

19 files changed

+12743
-117
lines changed

app/components/Login.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ const Login = React.memo(() => {
2323
// eslint-disable-next-line no-return-assign
2424
// inputFields.forEach(input => (input.value = ''));
2525
const response: boolean | string = ipcRenderer.sendSync('login', { username, password });
26-
if (typeof(response) === 'string') {
26+
if (typeof (response) === 'string') {
27+
console.log('response', response)
2728
setUser(username);
2829
setMode(response);
2930
navigate('/');

app/components/SignUp.tsx

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ const SignUp:React.FC = React.memo(() => {
1010
const navigate = useNavigate();
1111
const { setUser } = useContext(DashboardContext);
1212
const [failedSignUp, setFailedSignUp] = useState<JSX.Element>(<>hey</>);
13+
const [username, setUsername] = useState('');
14+
const [email, setEmail] = useState('');
15+
const [password, setPassword] = useState('');
16+
const [confirmPassword, setConfirmPassword] = useState('');
1317

1418
function handleSubmit(e: any) {
1519
e.preventDefault();
@@ -18,6 +22,12 @@ const SignUp:React.FC = React.memo(() => {
1822
const email = inputFields[1].value;
1923
const password = inputFields[2].value;
2024
const confirmPassword = inputFields[3].value;
25+
// setUsername(inputFields[0].value);
26+
// setEmail(inputFields[1].value);
27+
// setPassword(inputFields[2].value);
28+
// setConfirmPassword(inputFields[3].value);
29+
30+
2131

2232
// eslint-disable-next-line no-return-assign
2333
inputFields.forEach(input => (input.value = ''));
@@ -33,12 +43,14 @@ const SignUp:React.FC = React.memo(() => {
3343

3444
ipcRenderer.invoke('addUser', { username, email, password})
3545
.then((message) => {
36-
if (message === true) {
37-
setUser(username);
38-
console.log(username)
39-
navigate('/');
40-
} else {
46+
console.log('message', message)
47+
if (message === false) {
4148
setFailedSignUp(<p>Sorry, your sign up failed. Please try a different username or email</p>)
49+
} else {
50+
console.log('in frontend', username)
51+
// setUser(username);
52+
navigate('/login');
53+
alert('USER CREATED: PLEASE LOG IN')
4254
}
4355
}).catch(error => {
4456
console.error('Failed to sign up:', error);
@@ -55,13 +67,13 @@ const SignUp:React.FC = React.memo(() => {
5567

5668
<form className="form" onSubmit={handleSubmit}>
5769
<label className="username">
58-
<input type="text" name="username" id="username" placeholder="enter username" />
70+
<input type="text" name="username" id="username" minLength={4} placeholder="enter username" />
5971
</label>
6072
<label className="email">
6173
<input type="email" name="email" id="email" placeholder="[email protected]" />
6274
</label>
6375
<label className="password">
64-
<input type="password" name="password" id="password" placeholder="enter password" />
76+
<input type="password" name="password" id="password" minLength={9} placeholder="enter password" />
6577
</label>
6678
<label className="passwordConfirm">
6779
<input type="password" name="passwordConfirm" id="passwordConfirm" placeholder="confirm password" />

app/components/Splash.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const Splash: React.FC = React.memo(props => {
66
const [visible, setVisible] = useState(true);
77

88
useEffect(() => {
9-
setTimeout(() => setVisible(false), 4000);
9+
setTimeout(() => setVisible(false), 1000);
1010
}, []);
1111

1212
return (

app/context/ApplicationContext.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,9 @@ const ApplicationContextProvider: React.FC<AppContextProps> = React.memo(props =
7070
});
7171
}, []);
7272

73-
/**
74-
* @function connectToDB - a function that ensure database is connected with passed-in `username` and `index`. After that, invoke `fetchServicesName`, passing in `application`
75-
* @param username -
76-
* @param index -
77-
* @param application - application name
78-
*/
79-
const connectToDB = useCallback((username: string, index: number, application: string) => {
73+
const connectToDB = useCallback((username: string, index: number, application: string, URI: string) => {
8074
ipcRenderer.removeAllListeners('databaseConnected');
81-
ipcRenderer.send('connect', username, index);
75+
ipcRenderer.send('connect', username, index, URI);
8276

8377
ipcRenderer.on('databaseConnected', (event: Electron.Event, data: any) => {
8478
fetchServicesNames(application);

app/modals/ServicesModal.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ interface IService {
1818
}
1919

2020
const ServicesModal: React.FC<ServicesModalProps> = React.memo(({ i, app }) => {
21-
const { user } = useContext(DashboardContext)
21+
const { user, applications } = useContext(DashboardContext)
22+
console.log('hereerer', useContext(DashboardContext))
23+
console.log('aappp', applications[i][2])
2224
const { servicesData, connectToDB } = useContext(ApplicationContext);
2325
const [services, setServices] = useState<Array<string>>([]);
2426

@@ -32,7 +34,7 @@ const ServicesModal: React.FC<ServicesModalProps> = React.memo(({ i, app }) => {
3234
};
3335

3436
useEffect(() => {
35-
connectToDB(user, i, app);
37+
connectToDB(user, i, app, applications[i][2]);
3638
}, [i]);
3739

3840
return (

electron/databases/mongo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import mongoose from 'mongoose';
22
// import { MongoError } from 'mongodb';
33

44
// Mongoose connection wrapped in function that takes the index of the selected database as the parameter. This index is used to target the correct database for querying.
5-
const connectMongoose = async (i: number, URI: string) => {
5+
const connectMongoose = async (i:number, URI: string) => {
66
try {
77
await mongoose.connection.close();
88
const db = await mongoose.connect(URI);

electron/databases/mongoDB.js

Whitespace-only changes.

electron/models/UserModel.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// import mongoose, { Schema, Document } from 'mongoose';
2+
3+
// export interface IService extends Document {
4+
// microservice: string;
5+
// interval: number;
6+
// }
7+
const mongoose = require('mongoose')
8+
9+
const userSchema = new mongoose.Schema({
10+
// User: {
11+
username: {type: String, required:true, unique: true},
12+
password: {type: String, required:true},
13+
email: String,
14+
services: [],
15+
mode: {type: String, default: 'light'}
16+
// },
17+
});
18+
19+
// export default mongoose.model<IService>('services', ServicesSchema);
20+
21+
// export default mongoose.model('User', userSchema);
22+
23+
module.exports = mongoose.model('users', userSchema)

0 commit comments

Comments
 (0)