diff --git a/www/cgi/add_display_to_layout.cgi b/www/cgi/add_display_to_layout.cgi index 22567eb0..fca408ef 100755 --- a/www/cgi/add_display_to_layout.cgi +++ b/www/cgi/add_display_to_layout.cgi @@ -27,6 +27,12 @@ def main(): user = geardb.get_user_from_session_id(session_id) layout = geardb.get_layout_by_share_id(share_id) + + if layout is None: + result['error'] = "Layout not found" + print(json.dumps(result)) + return + layout.load() if user is None: @@ -84,8 +90,13 @@ def main(): if col_to_insert > 12: # get grid height of the last row, first start column # Want to ensure that the new row starts below the span of the previous row - grid_height = [m.grid_height for m in members_to_use if m.start_row == row_to_insert and m.start_col == 1][0] - row_to_insert += grid_height + # However, if there are no start_col = 1 members, then we can start at the "row_to_insert" value + + start_col_grid_heights = [m.grid_height for m in members_to_use if m.start_row == row_to_insert and m.start_col == 1] + if len(start_col_grid_heights) > 0: + grid_height = start_col_grid_heights[0] + row_to_insert += grid_height + col_to_insert = 1 if user.id == layout.user_id: diff --git a/www/dataset_explorer.html b/www/dataset_explorer.html index 102f1d5d..facdfecc 100644 --- a/www/dataset_explorer.html +++ b/www/dataset_explorer.html @@ -273,6 +273,7 @@
Title | Visibility | Organism | @@ -284,6 +285,11 @@|
---|---|---|---|
+ + | diff --git a/www/js/dataset_explorer.js b/www/js/dataset_explorer.js index 3d80b04e..bba981aa 100644 --- a/www/js/dataset_explorer.js +++ b/www/js/dataset_explorer.js @@ -1818,6 +1818,7 @@ const processSearchResults = (data) => { // Set properties for multiple elements // TODO: Truncate titles with tooltip for full title + setElementProperties(tableResultsView, ".js-view-displays", { dataset: { datasetId, title: label, isPublic } }); setElementProperties(tableResultsView, ".js-display-title", { id: `${resultDatasetId}-table-title`, textContent: label }); setElementProperties(tableResultsView, ".js-display-visibility", { id: `${resultDatasetId}-table-visibility` }); setElementProperties(tableResultsView, ".js-display-organism", { id: `${resultDatasetId}-table-organism`, textContent: organism }); @@ -2005,6 +2006,23 @@ const processSearchResults = (data) => { applyTooltip(classElt, createActionTooltips(classElt), "bottom"); } + // Normally this is done in the datasetCollectionCallback but we also need it when searching + // to ensure the table-view button is shown/hid when filters are applied + let collection = null; + try { + collection = flatDatasetCollectionData.find((collection) => collection.share_id === selected_dc_share_id); + } catch (error) { + // pass + } + const viewDisplayButtons = document.getElementsByClassName("js-view-displays"); + for (const classElt of viewDisplayButtons) { + disableAndHideElement(classElt); + if (collection?.is_owner) { + enableAndShowElement(classElt); + } + } + + // Hide/Remove some buttons if user is not owner updateDatasetListButtons(); @@ -2763,21 +2781,6 @@ const handlePageSpecificLoginUIUpdates = async (event) => { initializeDatasetCollectionSelection(); document.getElementById("dropdown-dc").classList.remove("is-right"); // Cannot see the dropdown if it is right aligned - // Normally this is done in the datasetCollectionCallback but we need to wait for the search to complete. - let collection = null; - try { - collection = flatDatasetCollectionData.find((collection) => collection.share_id === selected_dc_share_id); - } catch (error) { - // pass - } - const viewDisplayButtons = document.getElementsByClassName("js-view-displays"); - for (const classElt of viewDisplayButtons) { - disableAndHideElement(classElt); - if (collection?.is_owner) { - enableAndShowElement(classElt); - } - } - // Settings for selected facets for (const elt of document.querySelectorAll("ul.js-expandable-target li")) { elt.addEventListener("click", async (e) => { |