Add missing code

This commit is contained in:
grossmj 2022-07-23 00:01:17 +02:00
parent 714db5e399
commit ff1b991d2a

View File

@ -25,11 +25,10 @@ export class DefaultLayoutComponent implements OnInit, OnDestroy {
controllerStatusSubscription: Subscription; controllerStatusSubscription: Subscription;
shouldStopControllersOnClosing = true; shouldStopControllersOnClosing = true;
recentlyOpenedcontrollerId: string; recentlyOpenedcontrollerId: string;
recentlyOpenedProjectId: string; recentlyOpenedProjectId: string;
controllerIdProjectList: string; controllerIdProjectList: string;
controllerId: string | undefined | null;
constructor( constructor(
private electronService: ElectronService, private electronService: ElectronService,
@ -38,8 +37,15 @@ export class DefaultLayoutComponent implements OnInit, OnDestroy {
private toasterService: ToasterService, private toasterService: ToasterService,
private progressService: ProgressService, private progressService: ProgressService,
public router: Router, public router: Router,
private route: ActivatedRoute,
private controllerService: ControllerService private controllerService: ControllerService
) {} ) {
this.router.events.subscribe((data) => {
if (data instanceof NavigationEnd) {
this.controllerId = this.route.children[0].snapshot.paramMap.get("controller_id");
}
});
}
ngOnInit() { ngOnInit() {
@ -70,16 +76,8 @@ export class DefaultLayoutComponent implements OnInit, OnDestroy {
this.shouldStopControllersOnClosing = this.electronService.isElectronApp; this.shouldStopControllersOnClosing = this.electronService.isElectronApp;
} }
goToUserInfo() {
let controllerId = this.router.url.split("/controller/")[1].split("/")[0];
this.controllerService.get(+controllerId).then((controller:Controller ) => {
this.router.navigate(['/controller', controller.id, 'loggeduser']);
});
}
goToDocumentation() { goToDocumentation() {
let controllerId = this.router.url.split("/controller/")[1].split("/")[0]; this.controllerService.get(+this.controllerId).then((controller: Controller) => {
this.controllerService.get(+controllerId).then((controller:Controller ) => {
(window as any).open(`http://${controller.host}:${controller.port}/docs`); (window as any).open(`http://${controller.host}:${controller.port}/docs`);
}); });
} }
@ -93,8 +91,7 @@ export class DefaultLayoutComponent implements OnInit, OnDestroy {
} }
logout() { logout() {
let controllerId = this.router.url.split("/controller/")[1].split("/")[0]; this.controllerService.get(+this.controllerId).then((controller: Controller) => {
this.controllerService.get(+controllerId).then((controller:Controller ) => {
controller.authToken = null; controller.authToken = null;
this.controllerService.update(controller).then(val => this.router.navigate(['/controller', controller.id, 'login'])); this.controllerService.update(controller).then(val => this.router.navigate(['/controller', controller.id, 'login']));
}); });