|
|
@@ -8,9 +8,27 @@ import {IrrigationService} from './irrigation.service';
|
|
|
styleUrls: ['../app.component.scss'],
|
|
|
})
|
|
|
export class IrrigationInfoComponent implements OnInit {
|
|
|
+ dataLoaded = false;
|
|
|
+ currentReservoirData: {
|
|
|
+ area: number;
|
|
|
+ timestamp: string;
|
|
|
+ elevation: number;
|
|
|
+ volume: number;
|
|
|
+ };
|
|
|
+
|
|
|
constructor(private irrigationService: IrrigationService) {}
|
|
|
|
|
|
ngOnInit() {
|
|
|
- this.irrigationService.getValues();
|
|
|
+ this.irrigationService.getValues().subscribe((data: any) => {
|
|
|
+ console.log(data);
|
|
|
+ const reservoirProps = data.features[0]?.properties;
|
|
|
+ this.currentReservoirData = {
|
|
|
+ area: reservoirProps.area,
|
|
|
+ timestamp: reservoirProps.datetime,
|
|
|
+ elevation: reservoirProps.elevation,
|
|
|
+ volume: reservoirProps.volume,
|
|
|
+ };
|
|
|
+ this.dataLoaded = true;
|
|
|
+ });
|
|
|
}
|
|
|
}
|