eef3ac987538affd38eb38ccddf6ce6721f4c6f4 jcasper Sun Nov 23 22:03:29 2025 -0800 Removing bigCompositeUpdate CGI (folded into cartDump), and some kent-ifying of the remaining code. refs #36320 diff --git src/hg/js/facetedComposite.js src/hg/js/facetedComposite.js index 2585e875abd..edd3a5dcd4d 100644 --- src/hg/js/facetedComposite.js +++ src/hg/js/facetedComposite.js @@ -1,30 +1,30 @@ // SPDX-License-Identifier: MIT; (c) 2025 Andrew D Smith (author) /* jshint esversion: 11 */ $(function() { /* ADS: Uncomment below to force confirm on unload/reload */ // window.addEventListener("beforeunload", function (e) { // e.preventDefault(); e.returnValue = ""; }); const DEFAULT_MAX_CHECKBOXES = 20; // ADS: without default, can get crazy // ADS: need "matching" versions for the plugins const DATATABLES_URL = "https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"; const DATATABLES_SELECT_URL = "https://cdn.datatables.net/select/1.7.0/js/dataTables.select.min.js"; const CSS_URLS = [ "https://cdn.datatables.net/1.13.6/css/jquery.dataTables.min.css", // dataTables CSS "https://cdn.datatables.net/select/1.7.0/css/select.dataTables.min.css", // dataTables Select CSS - "/style/bigComposite.css", // Local metadata table CSS + "../style/facetedComposite.css", // Local metadata table CSS ]; const isValidColorMap = obj => // check the whole thing and ignore if invalid typeof obj === "object" && obj !== null && !Array.isArray(obj) && Object.values(obj).every(x => typeof x === "object" && x !== null && !Array.isArray(x) && Object.values(x).every(value => typeof value === "string")); const loadOptional = url => // load if possible otherwise carry on url ? fetch(url).then(r => r.ok ? r.json() : null).catch(() => null) : Promise.resolve(null); const loadIfMissing = (condition, url, callback) => // for missing plugins condition ? @@ -55,31 +55,31 @@ <table id="theMetaDataTable"> <thead></thead> <tfoot></tfoot> </table> </div> `; // Instead of appending to body, append into the placeholder div document.getElementById("metadata-placeholder").appendChild(container); } function updateVisibilities(uriForUpdate, submitBtnEvent) { // get query params from URL const paramsFromUrl = new URLSearchParams(window.location.search); const db = paramsFromUrl.get("db"); const hgsid = paramsFromUrl.get("hgsid"); - fetch("/cgi-bin/bigCompositeUpdate", { + fetch("/cgi-bin/cartDump", { method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded" }, body: `hgsid=${hgsid}&db=${db}&${uriForUpdate}`, }).then(() => { // 'disable' any CSS named elements here to them keep out of cart const dtLength = submitBtnEvent. target.form.querySelector("select[name$='_length']"); if (dtLength) { dtLength.disabled = true; } submitBtnEvent.target.form.submit(); // release submit event }); } function initDataTypeSelector() { @@ -314,35 +314,35 @@ return table; // to chain calls } // end initFilters function initSubmit(table) { // logic for the submit event const { mdid, primaryKey } = embeddedData; // mdid: metadata identifier document.getElementById("Submit").addEventListener("click", (submitBtnEvent) => { submitBtnEvent.preventDefault(); // hold the submit button event const selectedRows = table.rows({selected: true}).data().toArray(); const selectedDataTypes = []; document.querySelectorAll("input.cbgroup").forEach(cb => { if (cb.checked) { selectedDataTypes.push(cb.value); } }); - const uriForUpdate = new URLSearchParams({ mdid: mdid }); + const uriForUpdate = new URLSearchParams({ "cartDump.metaDataId": mdid, "noDisplay": 1 }); selectedRows.forEach(obj => // 'de' for data element - uriForUpdate.append(`${mdid}_de`, obj[primaryKey])); + uriForUpdate.append(`${mdid}.de`, obj[primaryKey])); selectedDataTypes.forEach(dat => // 'dt' for data type - uriForUpdate.append(`${mdid}_dt`, dat)); + uriForUpdate.append(`${mdid}.dt`, dat)); updateVisibilities(uriForUpdate, submitBtnEvent); }); } // end initSubmit function initAll(dataForTable) { initDataTypeSelector(); const table = initTable(dataForTable); initFilters(table, dataForTable); initSubmit(table); } function loadDataAndInit() { // load data and call init functions const { mdid, primaryKey, metadataUrl, colorSettingsUrl } = embeddedData; const CACHE_KEY = mdid;