hide menu

This commit is contained in:
Fuzi_fauzia 2024-06-22 01:56:05 +07:00
parent 024eb6bfc7
commit 169be42e81
2 changed files with 718 additions and 760 deletions

File diff suppressed because it is too large Load Diff

View File

@ -10,11 +10,8 @@ import videojs from "video.js";
styleUrls: ["./surveillance.component.css"],
})
export class SurveillanceComponent {
@ViewChild('videoPlayer', { static: false }) videoPlayer: ElementRef;
@ViewChild('videoIframe', { static: false }) videoIframe: ElementRef;
data: any;
totalOn: any;
totalOff: any;
filteredRows: any[];
searchTerm: string = "";
buildingSelected: any;
@ -28,12 +25,6 @@ export class SurveillanceComponent {
switchState: boolean;
public breadcrumb: any;
spinnerActive: boolean = false;
singlebasicSelected: any;
mainPlayer: any;
videos = "";
constructor(
private router: Router,
@ -77,8 +68,7 @@ export class SurveillanceComponent {
this.deviceService
.getDeviceData(buildingSelected, categorySelected, statusSelected)
.subscribe((res) => {
this.data = res;
this.filteredRows = this.data.results.data;
this.filteredRows = res.results.data;
console.log(this.filteredRows);
});
}
@ -116,38 +106,6 @@ export class SurveillanceComponent {
}, 3000);
}
filterRows() {
if (!this.searchTerm) {
this.filteredRows = [...this.data.results.data];
} else {
this.filteredRows = this.data.results.data.filter((row) =>
this.rowContainsSearchTerm(row)
);
}
}
rowContainsSearchTerm(row: any): boolean {
const searchTermLC = this.searchTerm.toLowerCase();
return Object.values(row).some(
(value) =>
value !== null && value.toString().toLowerCase().includes(searchTermLC)
);
}
switchChanged(ev, data) {
console.log(ev);
console.log(data);
const requestData = {
device_id: data.device_id,
switch: data.mapping[0].switch,
value: ev,
command_type: "on_off",
};
this.deviceService.deviceSwitch(requestData).subscribe((res) => {
console.log(res);
});
}
onClick(videoUrl: string) {
const iframe = this.videoIframe.nativeElement;
iframe.src = videoUrl;