From a131056279c65146b4fb35bea0ca46e989927d4c Mon Sep 17 00:00:00 2001 From: aignatov-bio Date: Mon, 22 Feb 2021 12:51:04 +0100 Subject: [PATCH] Fix datetime for projects and experiments filters [SCI-5512] --- app/assets/javascripts/projects/index.js | 16 ++++++++++++---- app/assets/javascripts/projects/show.js | 20 ++++++++++++++------ app/assets/stylesheets/experiments.scss | 13 +++++++++---- 3 files changed, 35 insertions(+), 14 deletions(-) diff --git a/app/assets/javascripts/projects/index.js b/app/assets/javascripts/projects/index.js index 44b67d2cd..ef248cb9e 100644 --- a/app/assets/javascripts/projects/index.js +++ b/app/assets/javascripts/projects/index.js @@ -591,6 +591,14 @@ }); } + function selectDate($field) { + var datePicker = $field.data('DateTimePicker'); + if (datePicker && datePicker.date()) { + return datePicker.date()._d.toUTCString(); + } + return null; + } + function initProjectsFilters() { var $filterDropdown = filterDropdown.init(); let $projectsFilter = $('.projects-index .projects-filters'); @@ -631,12 +639,12 @@ }); $filterDropdown.on('filter:apply', function() { - createdOnFromFilter = $createdOnFromFilter.val(); - createdOnToFilter = $createdOnToFilter.val(); + createdOnFromFilter = selectDate($createdOnFromFilter); + createdOnToFilter = selectDate($createdOnToFilter); membersFilter = dropdownSelector.getValues($('.members-filter')); lookInsideFolders = $foldersCB.prop('checked') ? 'true' : ''; - archivedOnFromFilter = $archivedOnFromFilter.val(); - archivedOnToFilter = $archivedOnToFilter.val(); + archivedOnFromFilter = selectDate($archivedOnFromFilter); + archivedOnToFilter = selectDate($archivedOnToFilter); projectsViewSearch = $textFilter.val(); appliedFiltersMark(); diff --git a/app/assets/javascripts/projects/show.js b/app/assets/javascripts/projects/show.js index 115f6ce0c..d9737ab57 100644 --- a/app/assets/javascripts/projects/show.js +++ b/app/assets/javascripts/projects/show.js @@ -109,6 +109,14 @@ }); } + function selectDate($field) { + var datePicker = $field.data('DateTimePicker'); + if (datePicker && datePicker.date()) { + return datePicker.date()._d.toUTCString(); + } + return null; + } + function initExperimentsFilters() { var $filterDropdown = filterDropdown.init(); @@ -133,12 +141,12 @@ } $filterDropdown.on('filter:apply', function() { - startedOnFromFilter = $startedOnFromFilter.val(); - startedOnToFilter = $startedOnToFilter.val(); - modifiedOnFromFilter = $modifiedOnFromFilter.val(); - modifiedOnToFilter = $modifiedOnToFilter.val(); - archivedOnFromFilter = $archivedOnFromFilter.val(); - archivedOnToFilter = $archivedOnToFilter.val(); + startedOnFromFilter = selectDate($startedOnFromFilter); + startedOnToFilter = selectDate($startedOnToFilter); + modifiedOnFromFilter = selectDate($modifiedOnFromFilter); + modifiedOnToFilter = selectDate($modifiedOnToFilter); + archivedOnFromFilter = selectDate($archivedOnFromFilter); + archivedOnToFilter = selectDate($archivedOnToFilter); experimentsViewSearch = $textFilter.val(); appliedFiltersMark(); refreshCurrentView(); diff --git a/app/assets/stylesheets/experiments.scss b/app/assets/stylesheets/experiments.scss index ee1b4762e..79b3c1d8f 100644 --- a/app/assets/stylesheets/experiments.scss +++ b/app/assets/stylesheets/experiments.scss @@ -7,10 +7,6 @@ // New experiments page .projects-show { - .experiments-filters { - max-height: calc(100vh - var(--navbar-height) - var(--content-header-size)); - overflow: auto; - } .experiment-actions-menu { .dropdown-menu { a, @@ -351,3 +347,12 @@ } } } + +@media (max-height: 700px) { + .projects-show { + .experiments-filters { + max-height: calc(100vh - var(--navbar-height) - var(--content-header-size)); + overflow: auto; + } + } +}