Revize d51166e8
Přidáno uživatelem Tomáš Ballák před více než 4 roky(ů)
website/public/css/style.css | ||
---|---|---|
1026 | 1026 |
display: flex; |
1027 | 1027 |
justify-content: center; |
1028 | 1028 |
align-items: center; |
1029 |
width: 64px; |
|
1030 | 1029 |
font-size: 15px; |
1031 | 1030 |
padding: 3px 0 4px 0; |
1032 | 1031 |
z-index: 1000; |
1033 | 1032 |
border-radius: 15px; |
1034 | 1033 |
background: #0b155a; |
1034 |
width: 64px; |
|
1035 |
} |
|
1036 |
|
|
1037 |
.player .time .custom-spinner-border { |
|
1038 |
margin: 3px 0 4px 0; |
|
1035 | 1039 |
} |
1036 | 1040 |
|
1037 | 1041 |
@media (min-width: 992px) { |
website/public/css/style.scss | ||
---|---|---|
974 | 974 |
display: flex; |
975 | 975 |
justify-content: center; |
976 | 976 |
align-items: center; |
977 |
width: 64px; |
|
978 | 977 |
font-size: 15px; |
979 | 978 |
padding: 3px 0 4px 0; |
980 | 979 |
z-index: 1000; |
981 | 980 |
border-radius: 15px; |
982 | 981 |
background: $secondary-bg-color; |
982 |
width: 64px; |
|
983 |
|
|
984 |
.custom-spinner-border { |
|
985 |
margin: 3px 0 4px 0; |
|
986 |
} |
|
983 | 987 |
|
984 | 988 |
@include media-breakpoint-up(lg) { |
985 | 989 |
position: absolute; |
website/public/js/zcu-heatmap.js | ||
---|---|---|
23 | 23 |
var info = [] |
24 | 24 |
let currentInfo = 0 |
25 | 25 |
|
26 |
// dictionary for names of datasets |
|
26 | 27 |
const datasetDictNameDisplayName = {} |
27 | 28 |
var datasetSelected = [] |
28 | 29 |
|
29 | 30 |
// data only for one day |
30 | 31 |
let lockedDay = false |
31 | 32 |
|
33 |
// loading information for async operations |
|
32 | 34 |
let loading = 0 |
33 | 35 |
|
36 |
// default loader showup delay |
|
37 |
const defaultLoaderDelay = 1000 |
|
38 |
|
|
34 | 39 |
// marks for all datasets |
35 | 40 |
const dataSourceMarks = {} |
36 | 41 |
|
... | ... | |
40 | 45 |
// key: x and y, x + '' + y string |
41 | 46 |
let globalMarkersChanged = {} |
42 | 47 |
|
43 |
const loadingY = () => { |
|
48 |
const loadingCallbackNested = (func, delay) => { |
|
49 |
setTimeout(() => { |
|
50 |
func(loading) |
|
51 |
if (loading) { |
|
52 |
loadingCallbackNested(func, delay) |
|
53 |
} |
|
54 |
}, delay) |
|
55 |
} |
|
56 |
const loadingY = (delay = defaultLoaderDelay) => { |
|
44 | 57 |
loading++ |
58 |
// check after nms if there is something that is loading |
|
59 |
loadingCallbackNested(() => loadingCallbackNested((isLoading) => loadingTimeline(isLoading), delay)) |
|
45 | 60 |
} |
46 |
const loadingN = () => { |
|
61 |
const loadingN = (delay = defaultLoaderDelay) => {
|
|
47 | 62 |
loading-- |
63 |
loadingCallbackNested(() => loadingCallbackNested((isLoading) => loadingTimeline(isLoading)), delay) |
|
48 | 64 |
} |
49 | 65 |
|
50 | 66 |
const changeCurrentTime = (time = null) => { |
... | ... | |
152 | 168 |
|
153 | 169 |
const onCheckboxClicked = async (checkbox) => { |
154 | 170 |
if ($(checkbox).prop('checked')) { |
155 |
loadCurrentTimeHeatmap(dataSourceRoute, positionsSourceRoute) |
|
171 |
loadCurrentTimeHeatmap(dataSourceRoute, positionsSourceRoute, 0)
|
|
156 | 172 |
changeUrl() |
157 | 173 |
} else { |
158 | 174 |
loadCheckboxDatasetNameData() |
... | ... | |
183 | 199 |
const onValueChangeRegister = () => { |
184 | 200 |
$('#date').change(function () { |
185 | 201 |
changeCurrentDate($(this).val()) |
186 |
loadCurrentTimeHeatmap(dataSourceRoute, positionsSourceRoute) |
|
202 |
loadCurrentTimeHeatmap(dataSourceRoute, positionsSourceRoute, 0)
|
|
187 | 203 |
changeUrl() |
188 | 204 |
}) |
189 | 205 |
|
... | ... | |
424 | 440 |
} |
425 | 441 |
|
426 | 442 |
function setTimeline () { |
427 |
$('#player-time').text(currentTime + ':00') |
|
443 |
$('#player-time > span').text(currentTime + ':00')
|
|
428 | 444 |
$('#player-time').attr('class', 'time hour-' + currentTime) |
429 | 445 |
} |
430 |
|
|
446 |
const loadingTimeline = (isLoading) => { |
|
447 |
if (isLoading) { |
|
448 |
loadingYTimeline() |
|
449 |
} else { |
|
450 |
loadingNTimeline() |
|
451 |
} |
|
452 |
} |
|
453 |
const loadingYTimeline = () => { |
|
454 |
$('#player-time > .spinner-border').removeClass('d-none') |
|
455 |
$('#player-time > span').text('') |
|
456 |
} |
|
457 |
const loadingNTimeline = () => { |
|
458 |
$('#player-time > .spinner-border').addClass('d-none') |
|
459 |
setTimeline() |
|
460 |
} |
|
431 | 461 |
const onChangeHour = (hour) => { |
432 | 462 |
changeHour(hour) |
433 | 463 |
drawHeatmap(data[currentTime]) |
... | ... | |
446 | 476 |
* @param {string} positionsRoute route to dataset postitions source |
447 | 477 |
*/ |
448 | 478 |
// eslint-disable-next-line no-unused-vars |
449 |
async function loadCurrentTimeHeatmap (opendataRoute, positionsRoute) { |
|
479 |
async function loadCurrentTimeHeatmap (opendataRoute, positionsRoute, loaderDelay = defaultLoaderDelay) {
|
|
450 | 480 |
loadCheckboxDatasetNameData() |
451 | 481 |
|
452 | 482 |
dataSourceRoute = opendataRoute |
... | ... | |
465 | 495 |
allPromises.push(dataSelectedHandler(datasetName)) |
466 | 496 |
}) |
467 | 497 |
|
468 |
loadingY() |
|
498 |
loadingY(loaderDelay)
|
|
469 | 499 |
Promise.all(allPromises).then( |
470 | 500 |
() => { |
471 |
loadingN() |
|
501 |
loadingN(0)
|
|
472 | 502 |
drawDataSourceMarks(dataSourceMarks) |
473 | 503 |
drawHeatmap(data[currentTime]) |
474 | 504 |
preload(currentTime, 1, currentDateToString()) |
... | ... | |
662 | 692 |
|
663 | 693 |
$('#btn-update-heatmap').prop('name', '') |
664 | 694 |
changeCurrentTime() |
665 |
setTimeline() |
|
666 | 695 |
changeCurrentDate() |
667 | 696 |
onValueChangeRegister() |
668 | 697 |
} |
website/src/Controller/HeatmapController.php | ||
---|---|---|
55 | 55 |
'submitted' => $isSubmitted, |
56 | 56 |
'data_to_display' => $dataSet, |
57 | 57 |
'dataset_colors' => Utils::prepareDatasetsColors($manager->getAvailableCollections()), |
58 |
'current_time' => $dataSet->getFormattedTime(), |
|
58 |
'formated_current_time' => $dataSet->getFormattedTime(), |
|
59 |
'current_time' => $dataSet->getTime(), |
|
59 | 60 |
] |
60 | 61 |
); |
61 | 62 |
} |
website/templates/heatmap.html.twig | ||
---|---|---|
45 | 45 |
<label class="font-weight-bold">Vyberte čas</label> |
46 | 46 |
<div class="dropdown"> |
47 | 47 |
<button type="button" class="btn dropdown-toggle" id="dropdownMenuButtonTime" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> |
48 |
{{ current_time }} |
|
48 |
{{ formated_current_time }}
|
|
49 | 49 |
</button> |
50 | 50 |
<div id="dropdown-time" class="dropdown-menu" aria-labelledby="dropdownMenuButtonTime"> |
51 | 51 |
{% for hour in form.time.children %} |
... | ... | |
124 | 124 |
{% endif %} |
125 | 125 |
|
126 | 126 |
<div class="timeline"> |
127 |
<div class="time hour-0" id="player-time">0:00</div> |
|
127 |
<div class="time hour-{{ current_time }}" id="player-time"> |
|
128 |
<span></span> |
|
129 |
<div class="spinner-border spinner-border-sm custom-spinner-border" role="status"> |
|
130 |
<span class="sr-only">Loading...</span> |
|
131 |
</div> |
|
128 | 132 |
|
133 |
</div> |
|
129 | 134 |
{% for i in 0..23 %} |
130 | 135 |
<div class="hour" title="{{ i }}:00" onclick="onChangeHour('{{ i }}')"></div> |
131 | 136 |
{% endfor %} |
Také k dispozici: Unified diff
Re #8186 loader + start on the current-time with player