From f0f9a128076f2f0deae8f597dd780527b54819dd Mon Sep 17 00:00:00 2001 From: TAMARA JERINIC Date: Sun, 17 Apr 2022 17:25:22 +0200 Subject: Izmenjen izgled item-predictor i my-predictors, dodata funkcija za brisanje prediktora u predictors.component.ts. --- .../item-predictor/item-predictor.component.html | 35 ++++++++++++-------- .../my-predictors/my-predictors.component.html | 27 +++++++++------ .../my-predictors/my-predictors.component.ts | 38 ++++++++++++---------- 3 files changed, 59 insertions(+), 41 deletions(-) diff --git a/frontend/src/app/_elements/item-predictor/item-predictor.component.html b/frontend/src/app/_elements/item-predictor/item-predictor.component.html index 7ae26fd3..3199dcc8 100644 --- a/frontend/src/app/_elements/item-predictor/item-predictor.component.html +++ b/frontend/src/app/_elements/item-predictor/item-predictor.component.html @@ -1,26 +1,35 @@
-
- {{predictor.name}} +
+ +
Prediktor
+
-
+
+ Opis

- {{predictor.description}} + {{predictor.description}}

-
- + + Ulazne kolone +
+ +
- +
{{column}}{{column}}
- arrow_downward -

- {{predictor.output}} -

+
+ Izlazna kolona: {{predictor.output}} +
+
+ + +
calendar_today Kreirano{{predictor.dateCreated |date}}
\ No newline at end of file diff --git a/frontend/src/app/_pages/my-predictors/my-predictors.component.html b/frontend/src/app/_pages/my-predictors/my-predictors.component.html index d38f93e4..31fa786c 100644 --- a/frontend/src/app/_pages/my-predictors/my-predictors.component.html +++ b/frontend/src/app/_pages/my-predictors/my-predictors.component.html @@ -1,16 +1,23 @@ -
-
-
- -
-
- -
- +
+
+
+ +
+
+
+
+ +
+ +
+
+
+
-
+ + diff --git a/frontend/src/app/_pages/my-predictors/my-predictors.component.ts b/frontend/src/app/_pages/my-predictors/my-predictors.component.ts index 17c496fd..4dc5300d 100644 --- a/frontend/src/app/_pages/my-predictors/my-predictors.component.ts +++ b/frontend/src/app/_pages/my-predictors/my-predictors.component.ts @@ -1,7 +1,7 @@ import { Component, OnInit } from '@angular/core'; import Predictor from 'src/app/_data/Predictor'; import { PredictorsService } from 'src/app/_services/predictors.service'; - +import shared from 'src/app/Shared'; @Component({ selector: 'app-my-predictors', templateUrl: './my-predictors.component.html', @@ -12,28 +12,30 @@ export class MyPredictorsComponent implements OnInit { constructor(private predictorsS : PredictorsService) { } ngOnInit(): void { - this.getAllMyPredictors(); - + this.predictorsS.getMyPredictors().subscribe((response) => { + this.predictors = response; + }, (error) => { + if (error.error == "Predictor with...") { + shared.openDialog("Greska", "Greska"); + } + }); } - delete(predictor: Predictor){ - if(window.confirm("IZABRANI MODEL ĆE BITI IZBRISAN")) - { - this.predictorsS.deletePredictor(predictor).subscribe((response) => { - this.getAllMyPredictors(); - }, (error) =>{ - if (error.error == "Predictor with name = {name} deleted") { - alert("Greška pri brisanju modela!"); - } - }); - } - - + deleteThisPredictor(predictor: Predictor): void{ + shared.openYesNoDialog('Brisanje prediktora','Da li ste sigurni da želite da obrišete prediktor?',() => { + this.predictorsS.deletePredictor(predictor).subscribe((response) => { + this.getAllMyPredictors(); + }, (error) =>{ + if (error.error == "Predictor with name = {name} deleted") { + shared.openDialog("Obaveštenje", "Greška prilikom brisanja prediktora."); + } + }); + }); } getAllMyPredictors(): void{ - this.predictorsS.getMyPredictors().subscribe(m => { - this.predictors = m; + this.predictorsS.getMyPredictors().subscribe(p => { + this.predictors = p; }); } -- cgit v1.2.3