Ondemand popup graphs (#15050)

* Only load popup graphs when popup is shown
Might cause a small delay, but pre-loading all the graphs was causing a lot of un-needed work. Slowing down page loading.

fixes #343

* remove extra div
This commit is contained in:
Tony Murray 2023-05-19 10:23:37 -05:00 committed by GitHub
parent da94ac5a85
commit 7390c0b0a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,10 +17,14 @@
</span>
</x-slot>
<x-slot name="body">
@foreach($graphs as $graph)
@isset($graph['text'], $graph['graph'])
<x-graph-row loading="lazy" :device="$device" :type="$graph['graph']" :title="$graph['text']" :graphs="[['from' => '-1d'], ['from' => '-7d']]"></x-graph-row>
@endisset
@endforeach
<template x-if="loadGraphs" x-data="{loadGraphs: false}" x-init="$watch('popupShow', shown => {if(shown) loadGraphs = true})">
<div>
@foreach($graphs as $graph)
@isset($graph['text'], $graph['graph'])
<x-graph-row loading="lazy" :device="$device" :type="$graph['graph']" :title="$graph['text']" :graphs="[['from' => '-1d'], ['from' => '-7d']]"></x-graph-row>
@endisset
@endforeach
</div>
</template>
</x-slot>
</x-popup>