Spaces:
Running
Running
Ahmad Shallouf
commited on
Commit
·
024b436
1
Parent(s):
17eace8
fixed authentication bug
Browse files
.DS_Store
CHANGED
Binary files a/.DS_Store and b/.DS_Store differ
|
|
src/app/components/body/about/about.component.html
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
<mat-card>
|
2 |
|
3 |
<mat-card-content *ngIf="whatAbout === 'general'">
|
|
|
4 |
<br>
|
5 |
<p>
|
6 |
This System was built in the process of the research conducted by the Author Ahmad Shallouf for his Master Thesis
|
@@ -34,6 +35,7 @@
|
|
34 |
<tr>
|
35 |
<td><button mat-button routerLink="/control" style="color: white">control panel</button></td>
|
36 |
</tr>
|
|
|
37 |
</table>
|
38 |
|
39 |
</mat-card-content>
|
|
|
1 |
<mat-card>
|
2 |
|
3 |
<mat-card-content *ngIf="whatAbout === 'general'">
|
4 |
+
|
5 |
<br>
|
6 |
<p>
|
7 |
This System was built in the process of the research conducted by the Author Ahmad Shallouf for his Master Thesis
|
|
|
35 |
<tr>
|
36 |
<td><button mat-button routerLink="/control" style="color: white">control panel</button></td>
|
37 |
</tr>
|
38 |
+
|
39 |
</table>
|
40 |
|
41 |
</mat-card-content>
|
src/app/components/body/submitting/submitting.component.ts
CHANGED
@@ -98,8 +98,6 @@ export class SubmittingComponent implements OnInit{
|
|
98 |
}
|
99 |
|
100 |
onFileSelected(event : any) {
|
101 |
-
console.log(event);
|
102 |
-
console.log(event.target.files[0]);
|
103 |
const file: File = event.target.files[0];
|
104 |
if (file) {
|
105 |
this.chosenFileName = file.name;
|
|
|
98 |
}
|
99 |
|
100 |
onFileSelected(event : any) {
|
|
|
|
|
101 |
const file: File = event.target.files[0];
|
102 |
if (file) {
|
103 |
this.chosenFileName = file.name;
|
src/app/state_management/services/app-state.service.ts
CHANGED
@@ -26,7 +26,6 @@ export class AppStateService {
|
|
26 |
|
27 |
constructor(public http: HttpClient,
|
28 |
public authService: AuthenticationService) {
|
29 |
-
console.log('AppStateService created');
|
30 |
console.log(this._apiUrl)
|
31 |
this.updateTasks();
|
32 |
this.updateDatasets();
|
@@ -60,7 +59,6 @@ export class AppStateService {
|
|
60 |
isPublic: boolean,
|
61 |
fileContent: string
|
62 |
) : Observable<Object> {
|
63 |
-
console.log(fileContent);
|
64 |
return this.http.post(this._apiUrl + '/submission/' + task + '/' + dataset, {
|
65 |
modelName: modelName,
|
66 |
modelLink: modelLink,
|
@@ -125,7 +123,16 @@ export class AppStateService {
|
|
125 |
|
126 |
public updateControlPanel() {
|
127 |
const headers = this.authService.getAuthHeaders();
|
128 |
-
this.http.get(`${this._apiUrl}/controlPanelSubmissions`, { headers }).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
(data: any) => {
|
130 |
this._setState({
|
131 |
...this.getState(),
|
@@ -137,19 +144,30 @@ export class AppStateService {
|
|
137 |
|
138 |
public forceUpdateSubmission(entry: any){
|
139 |
const headers = this.authService.getAuthHeaders();
|
140 |
-
this.http.put(`${this._apiUrl}/controlPanelSubmission/${entry.id}`, entry, { headers }).
|
141 |
-
(
|
142 |
-
|
143 |
-
|
144 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
}
|
146 |
|
147 |
public deleteSubmission(id: number){
|
148 |
const headers = this.authService.getAuthHeaders();
|
149 |
-
console.log('Deleting submission with id: ' + id);
|
150 |
this.http.delete(`${this._apiUrl}/controlPanelSubmission/` + id, { headers })
|
151 |
.pipe(
|
152 |
catchError(error => {
|
|
|
|
|
|
|
153 |
console.log(error);
|
154 |
return error;
|
155 |
}
|
|
|
26 |
|
27 |
constructor(public http: HttpClient,
|
28 |
public authService: AuthenticationService) {
|
|
|
29 |
console.log(this._apiUrl)
|
30 |
this.updateTasks();
|
31 |
this.updateDatasets();
|
|
|
59 |
isPublic: boolean,
|
60 |
fileContent: string
|
61 |
) : Observable<Object> {
|
|
|
62 |
return this.http.post(this._apiUrl + '/submission/' + task + '/' + dataset, {
|
63 |
modelName: modelName,
|
64 |
modelLink: modelLink,
|
|
|
123 |
|
124 |
public updateControlPanel() {
|
125 |
const headers = this.authService.getAuthHeaders();
|
126 |
+
this.http.get(`${this._apiUrl}/controlPanelSubmissions`, { headers }).pipe(
|
127 |
+
catchError(error => {
|
128 |
+
if (error.status === 401) {
|
129 |
+
this.authService.logout();
|
130 |
+
}
|
131 |
+
console.log(error);
|
132 |
+
return error;
|
133 |
+
}
|
134 |
+
))
|
135 |
+
.subscribe(
|
136 |
(data: any) => {
|
137 |
this._setState({
|
138 |
...this.getState(),
|
|
|
144 |
|
145 |
public forceUpdateSubmission(entry: any){
|
146 |
const headers = this.authService.getAuthHeaders();
|
147 |
+
this.http.put(`${this._apiUrl}/controlPanelSubmission/${entry.id}`, entry, { headers }).pipe(
|
148 |
+
catchError(error => {
|
149 |
+
if (error.status === 401) {
|
150 |
+
this.authService.logout();
|
151 |
+
}
|
152 |
+
console.log(error);
|
153 |
+
return error;
|
154 |
+
}
|
155 |
+
))
|
156 |
+
.subscribe(
|
157 |
+
() => {
|
158 |
+
this.updateControlPanel();
|
159 |
+
}
|
160 |
+
);
|
161 |
}
|
162 |
|
163 |
public deleteSubmission(id: number){
|
164 |
const headers = this.authService.getAuthHeaders();
|
|
|
165 |
this.http.delete(`${this._apiUrl}/controlPanelSubmission/` + id, { headers })
|
166 |
.pipe(
|
167 |
catchError(error => {
|
168 |
+
if (error.status === 401) {
|
169 |
+
this.authService.logout();
|
170 |
+
}
|
171 |
console.log(error);
|
172 |
return error;
|
173 |
}
|
src/app/state_management/services/authentication.service.ts
CHANGED
@@ -68,7 +68,10 @@ export class AuthenticationService {
|
|
68 |
);
|
69 |
}
|
70 |
|
71 |
-
|
72 |
-
|
|
|
|
|
|
|
73 |
}
|
74 |
}
|
|
|
68 |
);
|
69 |
}
|
70 |
|
71 |
+
|
72 |
+
public logout(): void {
|
73 |
+
this.token = null;
|
74 |
+
localStorage.removeItem('auth_token');
|
75 |
+
this.$authStatus.next('');
|
76 |
}
|
77 |
}
|