Skip to content

Commit 33f6928

Browse files
Merge pull request #172 from OS2iot/feature/IoT-1545_RedirectFromDatatarget
Feature/IoT-1545 - redirect from datatarget
2 parents cb1fff8 + 3125092 commit 33f6928

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

src/app/applications/datatarget/fiware/fiware-edit/fiware-edit.component.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ export class FiwareEditComponent implements DatatargetEdit, OnInit, OnDestroy {
226226
this.datatargetid = response.id;
227227
this.datatarget = response;
228228
this.showSavedSnack();
229+
this.routeToCreatedDatatarget();
229230
},
230231
(error: HttpErrorResponse) => {
231232
this.handleError(error);
@@ -271,10 +272,15 @@ export class FiwareEditComponent implements DatatargetEdit, OnInit, OnDestroy {
271272
this.scrollToTopService.scrollToTop();
272273
}
273274

274-
routeToDatatargets(): void {
275-
this.router.navigate(["applications", this.applicationId.toString()]);
275+
routeToDatatargets() {
276+
this.router.navigate(["applications", this.applicationId, "data-targets"]);
276277
}
277278

279+
routeToCreatedDatatarget() {
280+
this.router.navigate(["applications", this.applicationId, "datatarget", this.datatarget.id], {
281+
replaceUrl: true,
282+
});
283+
}
278284
onCoordinateKey(event: any) {
279285
if (event.target.value.length > event.target.maxLength) {
280286
event.target.value = event.target.value.slice(0, event.target.maxLength);

src/app/applications/datatarget/httppush/httppush-edit/httppush-edit.component.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,11 +282,15 @@ export class HttppushEditComponent implements DatatargetEdit, OnInit, OnDestroy
282282
this.scrollToTopService.scrollToTop();
283283
}
284284

285-
routeToDatatargets = () => this.router.navigate(["applications", this.applicationId, "data-targets"]);
286-
routeToCreatedDatatarget = () =>
285+
routeToDatatargets() {
286+
this.router.navigate(["applications", this.applicationId, "data-targets"]);
287+
}
288+
289+
routeToCreatedDatatarget() {
287290
this.router.navigate(["applications", this.applicationId, "datatarget", this.datatarget.id], {
288291
replaceUrl: true,
289292
});
293+
}
290294

291295
onCoordinateKey(event: any) {
292296
if (event.target.value.length > event.target.maxLength) {

src/app/applications/datatarget/mqtt-edit/mqtt-edit.component.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,14 @@ export class MqttEditComponent implements DatatargetEdit, OnInit, OnDestroy {
9090
this.errorMessages = errors.errorMessages;
9191
this.scrollToTopService.scrollToTop();
9292
}
93+
routeToDatatargets() {
94+
this.router.navigate(["applications", this.applicationId, "data-targets"]);
95+
}
9396

94-
routeToDatatargets(): void {
95-
this.router.navigate(["applications", this.applicationId.toString()]);
97+
routeToCreatedDatatarget() {
98+
this.router.navigate(["applications", this.applicationId, "datatarget", this.datatarget.id], {
99+
replaceUrl: true,
100+
});
96101
}
97102

98103
getDatatarget(id: number) {
@@ -214,7 +219,7 @@ export class MqttEditComponent implements DatatargetEdit, OnInit, OnDestroy {
214219
this.datatargetId = response.id;
215220
this.datatarget = response;
216221
this.snackService.showSavedSnack();
217-
this.routeToDatatargets();
222+
this.routeToCreatedDatatarget();
218223
},
219224
(error: HttpErrorResponse) => {
220225
this.handleError(error);

0 commit comments

Comments
 (0)