|
|
|
@ -5,6 +5,8 @@
@@ -5,6 +5,8 @@
|
|
|
|
|
|
|
|
|
|
const DB_FILE = 'kconfig.json'; |
|
|
|
|
const RESULTS_PER_PAGE_OPTIONS = [10, 25, 50]; |
|
|
|
|
let zephyr_gh_base_url; |
|
|
|
|
let zephyr_version; |
|
|
|
|
|
|
|
|
|
/* search state */ |
|
|
|
|
let db; |
|
|
|
@ -57,13 +59,38 @@ function showProgress(message) {
@@ -57,13 +59,38 @@ function showProgress(message) {
|
|
|
|
|
p.appendChild(pText); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Generate a GitHub link for a given file path in the Zephyr repository. |
|
|
|
|
* @param {string} path - The file path in the repository. |
|
|
|
|
* @param {number} [line] - Optional line number to link to. |
|
|
|
|
* @param {string} [mode=blob] - The mode (blob or edit). Defaults to 'blob'. |
|
|
|
|
* @param {string} [revision=main] - The branch, tag, or commit hash. Defaults to 'main'. |
|
|
|
|
* @returns {string} - The generated GitHub URL. |
|
|
|
|
*/ |
|
|
|
|
function getGithubLink(path, line, mode = "blob", revision = "main") { |
|
|
|
|
let url = [ |
|
|
|
|
zephyr_gh_base_url, |
|
|
|
|
mode, |
|
|
|
|
revision, |
|
|
|
|
path |
|
|
|
|
].join("/"); |
|
|
|
|
|
|
|
|
|
if (line !== undefined){ |
|
|
|
|
url += `#L${line}`; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return url; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Render a Kconfig literal property. |
|
|
|
|
* @param {Element} parent Parent element. |
|
|
|
|
* @param {String} title Title. |
|
|
|
|
* @param {String} content Content. |
|
|
|
|
* @param {Element} contentElement Content Element. |
|
|
|
|
*/ |
|
|
|
|
function renderKconfigPropLiteral(parent, title, content) { |
|
|
|
|
function renderKconfigPropLiteralElement(parent, title, contentElement) |
|
|
|
|
{ |
|
|
|
|
const term = document.createElement('dt'); |
|
|
|
|
parent.appendChild(term); |
|
|
|
|
|
|
|
|
@ -81,8 +108,18 @@ function renderKconfigPropLiteral(parent, title, content) {
@@ -81,8 +108,18 @@ function renderKconfigPropLiteral(parent, title, content) {
|
|
|
|
|
literal.className = 'pre'; |
|
|
|
|
code.appendChild(literal); |
|
|
|
|
|
|
|
|
|
const literalText = document.createTextNode(content); |
|
|
|
|
literal.appendChild(literalText); |
|
|
|
|
literal.appendChild(contentElement); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Render a Kconfig literal property. |
|
|
|
|
* @param {Element} parent Parent element. |
|
|
|
|
* @param {String} title Title. |
|
|
|
|
* @param {String} content Content. |
|
|
|
|
*/ |
|
|
|
|
function renderKconfigPropLiteral(parent, title, content) { |
|
|
|
|
const contentElement = document.createTextNode(content); |
|
|
|
|
renderKconfigPropLiteralElement(parent, title, contentElement); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -268,7 +305,17 @@ function renderKconfigEntry(entry) {
@@ -268,7 +305,17 @@ function renderKconfigEntry(entry) {
|
|
|
|
|
renderKconfigPropList(props, 'Implied by', entry.implied_by, true); |
|
|
|
|
renderKconfigPropList(props, 'Ranges', entry.ranges, false); |
|
|
|
|
renderKconfigPropList(props, 'Choices', entry.choices, false); |
|
|
|
|
renderKconfigPropLiteral(props, 'Location', `${entry.filename}:${entry.linenr}`); |
|
|
|
|
|
|
|
|
|
/* symbol location with permalink */ |
|
|
|
|
const locationPermalink = document.createElement('a'); |
|
|
|
|
locationPermalink.href = getGithubLink(entry.filename, entry.linenr, "blob", zephyr_version); |
|
|
|
|
|
|
|
|
|
const locationElement = document.createTextNode(`${entry.filename}:${entry.linenr}`); |
|
|
|
|
locationElement.class = "pre"; |
|
|
|
|
locationPermalink.appendChild(locationElement); |
|
|
|
|
|
|
|
|
|
renderKconfigPropLiteralElement(props, 'Location', locationPermalink); |
|
|
|
|
|
|
|
|
|
renderKconfigPropLiteral(props, 'Menu path', entry.menupath); |
|
|
|
|
|
|
|
|
|
return container; |
|
|
|
@ -483,7 +530,9 @@ function setupKconfigSearch() {
@@ -483,7 +530,9 @@ function setupKconfigSearch() {
|
|
|
|
|
fetch(DB_FILE) |
|
|
|
|
.then(response => response.json()) |
|
|
|
|
.then(json => { |
|
|
|
|
db = json; |
|
|
|
|
db = json["symbols"]; |
|
|
|
|
zephyr_gh_base_url = json["gh_base_url"]; |
|
|
|
|
zephyr_version = json["zephyr_version"]; |
|
|
|
|
|
|
|
|
|
results.replaceChildren(); |
|
|
|
|
|
|
|
|
|