|
@@ -17,6 +17,7 @@ import {AuthService} from '../../auth/services/auth.service';
|
|
|
import {User} from '../../auth/models/user';
|
|
import {User} from '../../auth/models/user';
|
|
|
import {SensorType} from '../../shared/api/endpoints/models/sensor-type';
|
|
import {SensorType} from '../../shared/api/endpoints/models/sensor-type';
|
|
|
import {Subscription} from 'rxjs';
|
|
import {Subscription} from 'rxjs';
|
|
|
|
|
+import {ActivatedRoute} from '@angular/router';
|
|
|
|
|
|
|
|
@Component({
|
|
@Component({
|
|
|
selector: 'app-dashboard',
|
|
selector: 'app-dashboard',
|
|
@@ -33,23 +34,31 @@ export class DashboardComponent implements OnInit, OnDestroy {
|
|
|
showEditUnitPopup = false;
|
|
showEditUnitPopup = false;
|
|
|
showInsertSensorPopup = false;
|
|
showInsertSensorPopup = false;
|
|
|
showInsertPositionPopup = false;
|
|
showInsertPositionPopup = false;
|
|
|
- //phenomenons: Phenomenon[];
|
|
|
|
|
|
|
+ // phenomenons: Phenomenon[];
|
|
|
sensorTypes: SensorType[];
|
|
sensorTypes: SensorType[];
|
|
|
subscription: Subscription[] = [];
|
|
subscription: Subscription[] = [];
|
|
|
|
|
|
|
|
|
|
+ // 0 = Dashboard, 1 = Map view
|
|
|
|
|
+ selectedTabIndex = 0; // <-- set the default here
|
|
|
|
|
+
|
|
|
constructor(
|
|
constructor(
|
|
|
private dataService: DataService,
|
|
private dataService: DataService,
|
|
|
private sensorService: SensorsService,
|
|
private sensorService: SensorsService,
|
|
|
- //private confirmationService: ConfirmationService,
|
|
|
|
|
- //private messageService: MessageService,
|
|
|
|
|
- //private managementService: ManagementService,
|
|
|
|
|
|
|
+ // private confirmationService: ConfirmationService,
|
|
|
|
|
+ // private messageService: MessageService,
|
|
|
|
|
+ // private managementService: ManagementService,
|
|
|
private toastService: ToastService,
|
|
private toastService: ToastService,
|
|
|
- private authService: AuthService
|
|
|
|
|
|
|
+ private authService: AuthService,
|
|
|
|
|
+ private route: ActivatedRoute
|
|
|
) {
|
|
) {
|
|
|
this.initData();
|
|
this.initData();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
ngOnInit(): void {
|
|
ngOnInit(): void {
|
|
|
|
|
+ const tab = this.route.snapshot.queryParamMap.get('tab');
|
|
|
|
|
+ if (tab === 'map') {
|
|
|
|
|
+ this.selectedTabIndex = 1; // show Map view
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -63,9 +72,9 @@ export class DashboardComponent implements OnInit, OnDestroy {
|
|
|
* Get necessary data from backend
|
|
* Get necessary data from backend
|
|
|
*/
|
|
*/
|
|
|
initData() {
|
|
initData() {
|
|
|
- //this.sensorService.getPhenomenons().subscribe(
|
|
|
|
|
- // response => this.phenomenons = response
|
|
|
|
|
- //);
|
|
|
|
|
|
|
+ // this.sensorService.getPhenomenons().subscribe(
|
|
|
|
|
+ // response => this.phenomenons = response
|
|
|
|
|
+ // );
|
|
|
this.sensorService.getSensorTypes().subscribe(
|
|
this.sensorService.getSensorTypes().subscribe(
|
|
|
response => this.sensorTypes = response
|
|
response => this.sensorTypes = response
|
|
|
);
|
|
);
|
|
@@ -118,4 +127,5 @@ export class DashboardComponent implements OnInit, OnDestroy {
|
|
|
sensors
|
|
sensors
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
}
|
|
}
|