Skip to content

Commit 4b586aa

Browse files
committed
Minor fixes, simplifications and unifications in build websites
- Fix/improve links to Downloads parent page - Replace all underscores in build-logs page - Unify use of single quotes - Use single elements instead of arrays where suitable
1 parent 02bf75c commit 4b586aa

File tree

8 files changed

+40
-40
lines changed

8 files changed

+40
-40
lines changed

sites/eclipse/build/buildlogs/logs.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ <h3 id="comparator">Comparator Logs</h3>
5858
if (beautifyText) {
5959
if (text.startsWith('s') && text.endsWith('.log')) {
6060
const firstDash = text.indexOf('_')
61-
text = text.substring(firstDash + 1, text.length - 4).replace('_', ' ')
61+
text = text.substring(firstDash + 1, text.length - 4).replaceAll('_', ' ')
6262
}
6363
}
6464
item.innerHTML = `<a href="${linkPrefix}${file.name}">${text}</a> (${file.size})`

sites/eclipse/build/gitLog.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<body>
1313
<div data-generate="generateDefaultBreadcrumb(this, eclipseBreadcrumbBase)">
14-
<a href="..">Downloads</a>
14+
<a href="../..">Downloads</a>
1515
<a class="data-ref" href=".">${label}</a>
1616
<span>GIT Log</span>
1717
</div>

sites/eclipse/build/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<body>
1313
<div data-generate="generateDefaultBreadcrumb(this, eclipseBreadcrumbBase)">
14-
<a href="..">Downloads</a>
14+
<a href="../..">Downloads</a>
1515
<span class="data-ref">${label}</span>
1616
</div>
1717

@@ -116,7 +116,7 @@ <h3 id="swt">SWT Binary and Source
116116
data.updatesP2RepositoryComposite += `-${buildType}-builds`
117117
}
118118
if (buildType == 'S') {
119-
data.updatesP2RepositoryComposite += `-I-builds`
119+
data.updatesP2RepositoryComposite += '-I-builds'
120120
const timestamp = buildID.substring(buildID.lastIndexOf('-') + 1, buildID.length)
121121
data.updatesP2Repository = `${data.updatesP2RepositoryComposite}/I${timestamp.substring(0, 8)}-${timestamp.substring(8, 12)}`
122122
} else {
@@ -133,7 +133,7 @@ <h3 id="swt">SWT Binary and Source
133133
const testJobsFolderURL = getJenkinsTestJobsFolderURL(build)
134134

135135
const testResultsOverview = fetchAllJSON(build.expectedTests.map(c => `testresults/${jobNamePrefix}-${c}.json`))
136-
const testResultsTable = document.getElementById("tests-overview-table")
136+
const testResultsTable = document.getElementById('tests-overview-table')
137137
const tBody = testResultsTable.createTBody()
138138
testResultsOverview.then(testResults => {
139139
let completedTests = 0
@@ -172,7 +172,7 @@ <h3 id="swt">SWT Binary and Source
172172
}
173173

174174
// Inject resource files
175-
const dataTables = Array.from(mainElement.getElementsByClassName("files-table"))
175+
const dataTables = Array.from(mainElement.getElementsByClassName('files-table'))
176176
for (const table of dataTables) {
177177
const dataPath = table.getAttribute('data-path')
178178
const filesData = getValue(build, dataPath)

sites/eclipse/build/tests.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<body>
1313
<div data-generate="generateDefaultBreadcrumb(this, eclipseBreadcrumbBase)">
14-
<a href="..">Downloads</a>
14+
<a href="../..">Downloads</a>
1515
<a class="data-ref" href=".">${label}</a>
1616
<span>Test Results</span>
1717
</div>
@@ -99,9 +99,9 @@ <h3>Plugins containing access errors or warnings</h3>
9999
const jobNamePrefix = getJenkinsTestJobNamePrefix(build)
100100

101101
const testResultsSummaries = fetchAllJSON(build.expectedTests.map(c => `testresults/${jobNamePrefix}-${c}-summary.json`))
102-
const testResultsTable = document.getElementById("test-results-summary")
103-
const testsHeadlineCell = document.getElementById("tests-header")
104-
const testConfigsHeadline = document.getElementById("test-configurations-headline")
102+
const testResultsTable = document.getElementById('test-results-summary')
103+
const testsHeadlineCell = document.getElementById('tests-header')
104+
const testConfigsHeadline = document.getElementById('test-configurations-headline')
105105
const expectedTestConfigsCount = build.expectedTests.length
106106
testsHeadlineCell.colSpan = expectedTestConfigsCount
107107
const expectedTestsLongNames = []
@@ -149,8 +149,8 @@ <h3>Plugins containing access errors or warnings</h3>
149149
}
150150

151151
function injectCompilerSummaryTable(compilerSummary) {
152-
const generalIssues = document.getElementById("compiler-warnings-summary")
153-
const accessIssues = document.getElementById("compiler-access-summary")
152+
const generalIssues = document.getElementById('compiler-warnings-summary')
153+
const accessIssues = document.getElementById('compiler-access-summary')
154154
for (const pluginName in compilerSummary) {
155155
const issues = compilerSummary[pluginName]
156156
const basicLink = `compilelogs/plugins/${issues.path}`

sites/eclipse/overview/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ <h3 id="beta-java-builds">Beta Java Builds</h3>
5151
TWENTYFOUR_HOURS_AGO.setTime(TWENTYFOUR_HOURS_AGO.getTime() - 24 * 60 * 60 * 1000)
5252

5353
contentPostProcessor = (mainElement, contentData) => {
54-
const dataTables = Array.from(mainElement.getElementsByClassName("builds-table"))
54+
const dataTables = Array.from(mainElement.getElementsByClassName('builds-table'))
5555
for (const table of dataTables) {
5656
const dataPath = table.getAttribute('data-path');
5757
const tableData = dataPath != 'latest'

sites/eclipse/page.js

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,15 @@ function getCPUArchLabel(name) {
9393
}
9494
}
9595

96-
const BUILD_DATE_FORMAT = new Intl.DateTimeFormat("en-GB", {
97-
timeZone: "UTC",
98-
year: "numeric",
99-
month: "short",
100-
day: "2-digit",
101-
weekday: "short",
96+
const BUILD_DATE_FORMAT = new Intl.DateTimeFormat('en-GB', {
97+
timeZone: 'UTC',
98+
year: 'numeric',
99+
month: 'short',
100+
day: '2-digit',
101+
weekday: 'short',
102102
hour12: false,
103-
hour: "2-digit",
104-
minute: "2-digit",
103+
hour: '2-digit',
104+
minute: '2-digit',
105105
})
106106

107107
function formatBuildDate(date) {
@@ -112,7 +112,7 @@ function formatBuildDate(date) {
112112
let runtimeFormat = null;
113113
if (typeof Intl.DurationFormat !== 'undefined') {
114114
try {
115-
runtimeFormat = new Intl.DurationFormat("en", { style: "short" });
115+
runtimeFormat = new Intl.DurationFormat('en', { style: 'short' });
116116
} catch (e) {
117117
// Intl.DurationFormat not available
118118
}
@@ -126,8 +126,8 @@ function formatRuntime(runtime) {
126126
try {
127127
const duration = Temporal.Duration.from({ seconds: totalSeconds });
128128
return runtimeFormat.format(duration.round({
129-
largestUnit: "hours",
130-
smallestUnit: totalSeconds >= 3600 ? "minutes" : "seconds"
129+
largestUnit: 'hours',
130+
smallestUnit: totalSeconds >= 3600 ? 'minutes' : 'seconds'
131131
}));
132132
} catch (e) {
133133
// Fall through to fallback implementation
@@ -161,12 +161,12 @@ function fetchAllJSON(urls) {
161161
return Promise.all(promises)
162162
}
163163

164-
let pageData = null
164+
let _pageData = null
165165

166166
function loadPageData(dataPath, dataGenerator = null) {
167-
pageData = fetch(dataPath).then(res => res.json())
167+
_pageData = fetch(dataPath).then(res => res.json())
168168
if (dataGenerator) {
169-
pageData = pageData.then(dataGenerator)
169+
_pageData = _pageData.then(dataGenerator)
170170
}
171171
}
172172

@@ -189,12 +189,12 @@ function generate() {
189189
}
190190

191191
const generatedBody = generateBody();
192-
document.body.replaceChildren(...generatedBody);
192+
document.body.replaceChildren(generatedBody);
193193

194194
generateTOCItems(document.body) // assume no headers (for the TOC) are generated dynamically
195195

196-
if (pageData) {
197-
pageData.then(data => {
196+
if (_pageData) {
197+
_pageData.then(data => {
198198
const mainElement = document.body.querySelector('main')
199199
const contentMain = mainElement.querySelector('main') // This is the main element of the calling html file
200200
resolveDataReferences(document, data)
@@ -221,12 +221,12 @@ function generateTOCItems(mainElement) {
221221
}
222222
}
223223

224-
const dataReferencePattern = /\${(?<path>[\w-\.]+)}/g
224+
const dataReferencePattern = /\${(?<path>[\w\-\.]+)}/g
225225

226226
function resolveDataReferences(contextElement, contextData) {
227-
const dataElements = Array.from(contextElement.getElementsByClassName("data-ref"))
227+
const dataElements = Array.from(contextElement.getElementsByClassName('data-ref'))
228228
for (const element of dataElements) {
229-
element.classList.remove("data-ref") // Prevent multiple processing in subsequent passes with different context (therefore a copy is created from the list)
229+
element.classList.remove('data-ref') // Prevent multiple processing in subsequent passes with different context (therefore a copy is created from the list)
230230
element.outerHTML = element.outerHTML.replaceAll(dataReferencePattern, (_match, pathGroup, _offset, _string) => {
231231
return getValue(contextData, pathGroup)
232232
})
@@ -245,14 +245,14 @@ function getValue(data, path) {
245245
}
246246

247247
function logException(message, loggedObject) {
248-
document.body.prepend(...toElements(`<span>Failed to generate content: <span><b style="color: FireBrick">${message}</b><br/>`));
248+
document.body.prepend(toElement(`<p>Failed to generate content: <b style="color: FireBrick">${message}</b></p>`));
249249
console.log(loggedObject);
250250
}
251251

252252
function generateBody() {
253253
const hasHeadersForTOC = document.querySelector('h1[id], h2[id], h3[id], h4[id]') !== null;
254254
const col = hasHeadersForTOC ? 'col-md-18' : ' col-md-24';
255-
return toElements(`
255+
return toElement(`
256256
<div>
257257
${generateHeader()}
258258
<main id="content">
@@ -345,7 +345,7 @@ function generateMainContent() {
345345
if (main != null) {
346346
return main.outerHTML
347347
}
348-
return "<main>The body specifies no content.</main>";
348+
return '<main>The body specifies no content.</main>';
349349
}
350350

351351
function generateHeader() {
@@ -444,7 +444,7 @@ function toElements(text) {
444444
function toElement(text) {
445445
const elements = toElements(text)
446446
if (elements.length != 1) {
447-
throw new Error("Not exactly one element: " + elements.length)
447+
throw new Error(`Not exactly one element: ${elements.length}`)
448448
}
449449
return elements[0]
450450
}

sites/equinox/build/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
<body>
1515
<div data-generate="generateDefaultBreadcrumb(this, equinoxBreadcrumbBase)">
16-
<a href="..">Downloads</a>
16+
<a href="../..">Downloads</a>
1717
<span class="data-ref">${label}</span>
1818
</div>
1919

@@ -72,7 +72,7 @@ <h3 id="other">Other Information</h3>
7272
document.getElementById('build-timestamp').innerHTML = `<b>${formatBuildDate(build.timestamp)} (UTC)</b>`
7373

7474
// Inject resource files
75-
const dataTables = Array.from(mainElement.getElementsByClassName("files-table"))
75+
const dataTables = Array.from(mainElement.getElementsByClassName('files-table'))
7676
for (const table of dataTables) {
7777
const dataPath = table.getAttribute('data-path')
7878
const filesData = getValue(build, dataPath)

sites/equinox/overview/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ <h3 id="integration-builds">Integration Builds</h3>
3636
loadPageData('data.json')
3737

3838
contentPostProcessor = (mainElement, contentData) => {
39-
const dataTables = Array.from(mainElement.getElementsByClassName("builds-table"))
39+
const dataTables = Array.from(mainElement.getElementsByClassName('builds-table'))
4040
for (const table of dataTables) {
4141
const dataPath = table.getAttribute('data-path');
4242
const tableData = dataPath != 'latest'

0 commit comments

Comments
 (0)