Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified static/images/SCALE/Dashboard/GlobalSearchDocs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion static/includes/UsingGlobalSearch.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ TrueNAS SCALE indicates the selected element with a glowing blue outline.
Click **Search Documentation for <<*query*>>** to redirect the search to the TrueNAS Documentation Hub.
TrueNAS SCALE opens a new browser tab to display documentation search results for the query.

<!-- Update image with results from the 24.10 branch, after branching for 24.10 has been completed and the redirect is updated away from master/nightlies-->
{{< trueimage src="/images/SCALE/Dashboard/GlobalSearchDocs.png" alt="Search Documentation Results" id="Search Documentation Results" style="border:1px solid #0095d5" >}}

Use this option to search for tutorials and UI reference documentation for the feature, or to look for further information when the entered search term does not find any matching UI elements.
34 changes: 34 additions & 0 deletions static/js/search-multi-site.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ class MultiSiteSearch {
this.performSearch = this.performSearch.bind(this);
this.loadMoreResults = this.loadMoreResults.bind(this);
this.updateSearchIcon = this.updateSearchIcon.bind(this);
this.checkUrlQueryParameter = this.checkUrlQueryParameter.bind(this);

this.init();
}
Expand Down Expand Up @@ -238,6 +239,39 @@ class MultiSiteSearch {
} catch (error) {
// Could not pre-load docs index
}

// Check for URL query parameter and auto-execute search
this.checkUrlQueryParameter();
}

checkUrlQueryParameter() {
// Parse URL query parameters
const urlParams = new URLSearchParams(window.location.search);
const queryParam = urlParams.get('query');

if (queryParam && queryParam.trim() !== '') {
// Check if we're on the /search/ path and redirect to homepage with query
const currentPath = window.location.pathname;
if (currentPath === '/search/' || currentPath === '/search') {
// Redirect to homepage with query parameter preserved
window.location.href = `/${window.location.search}`;
return;
}

// Open the modal
this.openModal();

// Set the search input value
const searchInput = document.getElementById('search-input-enhanced');
if (searchInput) {
searchInput.value = queryParam.trim();
}

// Wait a short moment for modal to fully render, then perform search
setTimeout(() => {
this.performSearch();
}, 200);
}
}

async loadIndex(siteKey) {
Expand Down