Skip to content

Commit 5b0a47e

Browse files
committed
Merge branch 'develop'
2 parents ca57775 + ab5659a commit 5b0a47e

24 files changed

Lines changed: 1121 additions & 97 deletions

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ captures/
153153
.idea/gradle.xml
154154
.idea/dictionaries
155155
.idea/libraries
156+
**/.idea
156157

157158
# External native build folder generated in Android Studio 2.2 and later
158159
.externalNativeBuild
@@ -282,5 +283,8 @@ src/client/build
282283
src/client/yarn.lock
283284
src/spring/target
284285

286+
# VSCode
287+
.vscode
288+
**/.vscode
285289

286290
# End of https://www.gitignore.io/api/node,java,vagrant,java-web,reactnative

install/install.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ print_help () {
2020

2121
export DEBIAN_FRONTEND=noninteractive
2222

23-
if ! grep -qF "sudo mount --bind $HOME_DIR/vagrant_node_modules $client/node_modules" /home/vagrant/.bashrc
24-
then
25-
echo "sudo mount --bind $HOME_DIR/vagrant_node_modules $client/node_modules" >> /home/vagrant/.bashrc
26-
fi
23+
# if ! grep -qF "sudo mount --bind $HOME_DIR/vagrant_node_modules $client/node_modules" /home/vagrant/.bashrc
24+
# then
25+
# echo "sudo mount --bind $HOME_DIR/vagrant_node_modules $client/node_modules" >> /home/vagrant/.bashrc
26+
# fi
2727

2828
if ! grep -qF "cd "$vagrant /home/vagrant/.bashrc
2929
then
@@ -144,15 +144,17 @@ docker run --name code-chill -dti ubuntu /bin/bash
144144
cd $client
145145
yarn global add create-react-app
146146
yarn global add serve
147+
yarn global add typescript
148+
yarn global add react-scripts-ts
147149

148150
# Fix error with shared folder and npm modules
149151
# https://medium.com/@dtinth/isolating-node-modules-in-vagrant-9e646067b36
150152
mkdir $HOME_DIR/vagrant_node_modules
151-
mkdir $client/node_modules
152-
sudo mount --bind $HOME_DIR/vagrant_node_modules $client/node_modules
153153
sudo chown -R vagrant:vagrant $HOME_DIR/vagrant_node_modules
154+
mkdir $client/node_modules
155+
# sudo mount --rbind $HOME_DIR/vagrant_node_modules $client/node_modules
154156

155157
# Install client dependencies
156-
sudo yarn install
158+
yarn install --no-bin-links
157159

158160
print_help

src/client/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"dependencies": {
66
"@types/lodash": "^4.14.104",
77
"@types/react-redux": "^5.0.14",
8+
"axios": "^0.18.0",
89
"jwt-decode": "^2.2.0",
910
"react": "^16.2.0",
1011
"react-bash": "^1.6.0",
@@ -14,7 +15,8 @@
1415
"react-scripts-ts": "2.12.0",
1516
"semantic-ui-css": "^2.2.14",
1617
"semantic-ui-react": "^0.78.2",
17-
"text-encoding": "^0.6.4"
18+
"text-encoding": "^0.6.4",
19+
"xterm": "^3.1.0"
1820
},
1921
"scripts": {
2022
"start": "react-scripts-ts start",

src/client/src/App.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,14 @@
2222
font-size: large;
2323
}
2424

25-
.menu .item a {
25+
.dropdown .menu .item a {
2626
color: rgba(0,0,0,.87) !important;
2727
}
2828

29+
.modals.visible.transition {
30+
display: flex !important;
31+
}
32+
2933
@keyframes App-logo-spin {
3034
from { transform: rotate(0deg); }
3135
to { transform: rotate(360deg); }

src/client/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class App extends React.Component<any, any> {
1313
render() {
1414
return (
1515
<div>
16-
Welcome {this.props.user.sub}
16+
Welcome {this.props.user.username}
1717
</div>
1818
);
1919
}

src/client/src/AuthService.ts

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@ import decode from "jwt-decode";
22
export default class AuthService {
33
// Initializing important variables
44

5+
user: Object;
56
domain: string;
67

78
constructor(domain?: string) {
89
this.domain = domain || "http://localhost:8080"; // API server domain
10+
this.user = Object;
911
this.fetch = this.fetch.bind(this); // React binding stuff
1012
this.login = this.login.bind(this);
1113
this.getProfile = this.getProfile.bind(this);
14+
this.getUserInfos = this.getUserInfos.bind(this);
1215
}
1316

1417
login(username: string, password: string) {
@@ -64,6 +67,66 @@ export default class AuthService {
6467
return decode(this.getToken());
6568
}
6669

70+
getUserInfos () {
71+
return this.fetch(`${this.domain}/user`, {
72+
method: "GET",
73+
}).then((res) => {
74+
return Promise.resolve(res);
75+
});
76+
}
77+
78+
editUser(user: Object) {
79+
return this.fetch(`${this.domain}/user`, {
80+
method: "PUT",
81+
body: JSON.stringify(user)
82+
}).then((res) => {
83+
return Promise.resolve(res);
84+
});
85+
}
86+
87+
deleteUser() {
88+
return this.fetch(`${this.domain}/user`, {
89+
method: "DELETE",
90+
}).then((res) => {
91+
return Promise.resolve(res);
92+
});
93+
}
94+
95+
createAccount(user: Object) {
96+
return this.fetch(`${this.domain}/user`, {
97+
method: "POST",
98+
body: JSON.stringify(user)
99+
}).then((res) => {
100+
return Promise.resolve(res);
101+
});
102+
}
103+
104+
forgotPassword(email: string) {
105+
return this.fetch(`${this.domain}/user/forgottenpassword`, {
106+
method: "POST",
107+
body: email
108+
}).then((res) => {
109+
return Promise.resolve(res);
110+
});
111+
}
112+
113+
checkTokenPassword(token: string) {
114+
return this.fetch(`${this.domain}/reset/${token}`, {
115+
method: "GET"
116+
}).then((res) => {
117+
return Promise.resolve(res);
118+
});
119+
}
120+
121+
resetPassword(token: string, password: string) {
122+
return this.fetch(`${this.domain}/reset`, {
123+
method: "POST",
124+
body: JSON.stringify({"token": token, "password": password})
125+
}).then((res) => {
126+
return Promise.resolve(res);
127+
});
128+
}
129+
67130
fetch(url: any, options: any) {
68131
// performs api calls sending the required authentication headers
69132
const headers = {

src/client/src/components/CodeChillRouter.tsx

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,24 @@ import * as React from "react";
22
// import { BrowserRouter as Router, Route } from "react-router-dom";
33
import { Route, Switch } from "react-router-dom";
44
import App from "../App";
5+
import CodeChillXterm from "./CodeChillXterm";
56
import Term, { Terminal } from "./Term";
67
import UserConnection from "./user/UserConnection";
8+
import UserSignUp from "./user/UserSignUp";
79
import Presentation from "./Presentation";
10+
import UserProfile from "./user/UserProfile";
811
import NotFound from "./NotFound";
912
import withAuth from "./withAuth";
13+
import UserForgotPassword from "./user/UserForgotPassword";
14+
import UserResetPassword from "./user/UserResetPassword";
1015

1116
export default class CodeChillRouter extends React.Component<any, any> {
1217

1318
Term = withAuth(Term);
14-
19+
1520
render() {
21+
const ccxterm = "CodeChillXterm";
22+
const url = "ws://localhost:2375/containers/code-chill/attach/ws?logs=0&stream=1&stdin=0&stdout=0&stderr=0";
1623
return (
1724
<main>
1825
<Switch>
@@ -31,12 +38,44 @@ export default class CodeChillRouter extends React.Component<any, any> {
3138
path="/term"
3239
render={(props) => <Term prefix="code@chill" theme={Terminal.Themes.DARK} />}
3340
/>
41+
<Route
42+
exact={true}
43+
path="/profile"
44+
component={UserProfile}
45+
/>
46+
<Route
47+
exact={true}
48+
path="/forgot"
49+
// render={(props) => <UserConnection props={...props} />}
50+
component={UserForgotPassword}
51+
/>
52+
<Route
53+
exact={true}
54+
path="/reset/:token"
55+
// render={(props) => <UserConnection props={...props} />}
56+
component={UserResetPassword}
57+
/>
3458
<Route
3559
exact={true}
3660
path="/login"
3761
// render={(props) => <UserConnection props={...props} />}
3862
component={UserConnection}
3963
/>
64+
<Route
65+
exact={true}
66+
path="/signup"
67+
// render={(props) => <UserConnection props={...props} />}
68+
component={UserSignUp}
69+
/>
70+
<Route
71+
exact={true}
72+
path="/xtermtest"
73+
render={(props) =>
74+
<CodeChillXterm
75+
ref={ccxterm}
76+
url={url}
77+
/>}
78+
/>
4079
<Route
4180
path="*"
4281
component={NotFound}

0 commit comments

Comments
 (0)