aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/app/_services
diff options
context:
space:
mode:
authorDanijel Anđelković <adanijel99@gmail.com>2022-06-06 05:24:26 +0200
committerDanijel Anđelković <adanijel99@gmail.com>2022-06-06 05:24:26 +0200
commit5dc30c02319ba9fa8e8ddb33e9574272f05598fe (patch)
treee514ed32fe74b2b47dd04cd78e796daa4e28d6a1 /frontend/src/app/_services
parentd1763481d6c08c955885ed490a284e634a56296b (diff)
parentec46487761e888935411cf4daa9e740913f2ee9b (diff)
Merge branch 'redesign' of http://gitlab.pmf.kg.ac.rs/igrannonica/neuronstellar
Diffstat (limited to 'frontend/src/app/_services')
-rw-r--r--frontend/src/app/_services/datasets.service.ts37
-rw-r--r--frontend/src/app/_services/models.service.ts23
-rw-r--r--frontend/src/app/_services/predictors.service.ts4
3 files changed, 42 insertions, 22 deletions
diff --git a/frontend/src/app/_services/datasets.service.ts b/frontend/src/app/_services/datasets.service.ts
index 2775613c..11838b1d 100644
--- a/frontend/src/app/_services/datasets.service.ts
+++ b/frontend/src/app/_services/datasets.service.ts
@@ -1,4 +1,4 @@
-import { HttpClient } from '@angular/common/http';
+import { HttpClient, HttpParams } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { Configuration } from './configuration.service';
@@ -12,6 +12,21 @@ export class DatasetsService {
constructor(private http: HttpClient, private authService: AuthService) { }
+ uploadData(file: File): Observable<any> {
+ let formData = new FormData();
+ formData.append('file', file, file.name);
+
+ let params = new HttpParams();
+
+ const options = {
+ params: params,
+ reportProgress: false,
+ headers: this.authService.authHeader()
+ };
+
+ return this.http.post(`${Configuration.settings.apiURL}/file/csv`, formData, options);
+ }
+
getPublicDatasets(): Observable<Dataset[]> {
return this.http.get<Dataset[]>(`${Configuration.settings.apiURL}/dataset/publicdatasets`, { headers: this.authService.authHeader() });
}
@@ -31,10 +46,10 @@ export class DatasetsService {
getDatasetFile(fileId: any): any {
return this.http.get(`${Configuration.settings.apiURL}/file/csvRead/${fileId}/-1/11`, { headers: this.authService.authHeader(), responseType: 'text' });
}
- getDatasetFilePaging(fileId:any,begin:any,end:any){
+ getDatasetFilePaging(fileId: any, begin: any, end: any) {
return this.http.get(`${Configuration.settings.apiURL}/file/csvRead/${fileId}/${begin}/${end}`, { headers: this.authService.authHeader(), responseType: 'text' });
}
- getDatasetHeader(fileId:any){
+ getDatasetHeader(fileId: any) {
return this.http.get(`${Configuration.settings.apiURL}/file/csvRead/${fileId}/-1/1`, { headers: this.authService.authHeader(), responseType: 'text' });
}
getDatasetFilePartial(fileId: any, startRow: number, rowNum: number): Observable<any> {
@@ -44,15 +59,23 @@ export class DatasetsService {
return this.http.get<Dataset>(`${Configuration.settings.apiURL}/dataset/get/${datasetId}`, { headers: this.authService.authHeader() });
}
- editDataset(dataset: Dataset){
- return this.http.put(`${Configuration.settings.apiURL}/dataset/` + dataset._id, dataset, { headers: this.authService.authHeader() ,responseType:'text'});
+ editDataset(dataset: Dataset) {
+ return this.http.put(`${Configuration.settings.apiURL}/dataset/` + dataset._id, dataset, { headers: this.authService.authHeader(), responseType: 'text' });
}
deleteDataset(dataset: Dataset) {
return this.http.delete(`${Configuration.settings.apiURL}/dataset/` + dataset._id, { headers: this.authService.authHeader(), responseType: "text" });
}
- downloadFile(id:string):Observable<Blob>{
- return this.http.get(`${Configuration.settings.apiURL}/file/Download?id=`+id, { headers: this.authService.authHeader(), responseType: 'blob' });
+ downloadFile(id: string): Observable<Blob> {
+ return this.http.get(`${Configuration.settings.apiURL}/file/Download?id=` + id, { headers: this.authService.authHeader(), responseType: 'blob' });
+ }
+
+ updateDatasetAccessibleByLink(id: string, acessibleByLink: boolean) {
+ return this.http.put(`${Configuration.settings.apiURL}/dataset/updateAccessibleByLink/` + id, acessibleByLink, { headers: this.authService.authHeader(), responseType: 'text' });
+ }
+
+ updateDatasetIsPublic(id: string, isPublic: boolean) {
+ return this.http.put(`${Configuration.settings.apiURL}/dataset/updateIsPublic/` + id, isPublic, { headers: this.authService.authHeader(), responseType: 'text' });
}
}
diff --git a/frontend/src/app/_services/models.service.ts b/frontend/src/app/_services/models.service.ts
index 2b8fe8f2..398c7813 100644
--- a/frontend/src/app/_services/models.service.ts
+++ b/frontend/src/app/_services/models.service.ts
@@ -13,21 +13,6 @@ export class ModelsService {
constructor(private http: HttpClient, private authService: AuthService) { }
- uploadData(file: File): Observable<any> {
- let formData = new FormData();
- formData.append('file', file, file.name);
-
- let params = new HttpParams();
-
- const options = {
- params: params,
- reportProgress: false,
- headers: this.authService.authHeader()
- };
-
- return this.http.post(`${Configuration.settings.apiURL}/file/csv`, formData, options);
- }
-
addModel(model: Model): Observable<any> {
return this.http.post(`${Configuration.settings.apiURL}/model/add`, model, { headers: this.authService.authHeader() });
}
@@ -66,4 +51,12 @@ export class ModelsService {
return this.http.get<Model>(`${Configuration.settings.apiURL}/model/byid/${modelId}`, { headers: this.authService.authHeader() });
}
+ updateModelAccessibleByLink(id: string, acessibleByLink: boolean) {
+ return this.http.put(`${Configuration.settings.apiURL}/model/updateAccessibleByLink/` + id, acessibleByLink, { headers: this.authService.authHeader(), responseType: 'text' });
+ }
+
+ updateModelIsPublic(id: string, isPublic: boolean) {
+ return this.http.put(`${Configuration.settings.apiURL}/model/updateIsPublic/` + id, isPublic, { headers: this.authService.authHeader(), responseType: 'text' });
+ }
+
}
diff --git a/frontend/src/app/_services/predictors.service.ts b/frontend/src/app/_services/predictors.service.ts
index e2033e3e..5859634d 100644
--- a/frontend/src/app/_services/predictors.service.ts
+++ b/frontend/src/app/_services/predictors.service.ts
@@ -29,6 +29,10 @@ export class PredictorsService {
getMyPredictors(): Observable<Predictor[]> {
return this.http.get<Predictor[]>(`${Configuration.settings.apiURL}/predictor/mypredictors`, { headers: this.authService.authHeader() });
}
+
+ downloadH5(id: string): Observable<Blob> {
+ return this.http.get(`${Configuration.settings.apiURL}/file/Download?id=` + id, { headers: this.authService.authHeader(), responseType: 'blob' });
+ }
}
export class Column {