Skip to content

Commit

Permalink
More
Browse files Browse the repository at this point in the history
  • Loading branch information
janfaracik committed Feb 28, 2024
1 parent ee3c116 commit 3baf616
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 19 deletions.
21 changes: 15 additions & 6 deletions core/src/main/resources/hudson/model/Job/buildTimeTrend.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,14 @@ THE SOFTWARE.
<l:icon src="symbol-status-disabled-anime" id="disabled-anime" />
</template>

<h1>${%Builds}</h1>
<div class="jenkins-app-bar">
<div class="jenkins-app-bar__content">
<h1>${%Builds} <span class="aasda">${it.builds.size()}</span></h1>
</div>
<div class="jenkins-app-bar__controls">
<l:search-bar id="search-bar-builds" />
</div>
</div>

<!-- <j:set var="job" value="${it}" />-->
<!-- <j:forEach var="p" items="${it.permalinks}">-->
Expand All @@ -58,7 +65,7 @@ THE SOFTWARE.
<div class="abouttodays">
<div class="iteem iteem--time">
<!-- <span class="backplate"></span>-->
<l:icon src="symbol-check" />
<l:icon src="symbol-timer" />
<div>Average time</div>
<div>
${it.estimatedDuration}ms
Expand All @@ -74,15 +81,15 @@ THE SOFTWARE.
</div>
<a class="iteem iteem--success">
<!-- <span class="backplate"></span>-->
<l:icon src="symbol-check" />
<l:icon src="symbol-status-blue" />
<div>Last successful</div>
<div>
#123
</div>
</a>
<a class="iteem iteem--failed">
<!-- <span class="backplate"></span>-->
<l:icon src="symbol-check" />
<l:icon src="symbol-status-red" />
<div>Last failed</div>
<div>
#74
Expand All @@ -102,12 +109,14 @@ THE SOFTWARE.
data-is-distributed-build-enabled="${isDistributedBuildEnabled}">
<thead>
<tr>
<th><st:nbsp/></th>
<th class="jenkins-table__cell--tight">S</th>
<th initialSortDir="up">${%Build}</th>
<th>${%Duration}</th>
<th>${%Duration}</th>
<th>${%Completed}</th>
<j:if test="${isDistributedBuildEnabled}">
<th>${%Agent}</th>
</j:if>
<th>${%overflow}</th>
</tr>
<tbody></tbody>
</thead>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ window.buildTimeTrend_displayBuilds = function (data) {

link = document.createElement("a");
link.href = e.number + "/";
link.classList.add("model-link", "inside");
link.classList.add("model-link", "iamlink");
link.innerText = escapeHTML(e.displayName);

td.appendChild(link);
Expand Down Expand Up @@ -62,6 +62,8 @@ window.buildTimeTrend_displayBuilds = function (data) {
Behaviour.applySubtree(tr);
}
ts_refresh(p);

doThing()
};

/**
Expand Down Expand Up @@ -143,4 +145,38 @@ window.displayBuilds = function (data) {
Behaviour.applySubtree(tr);
}
ts_refresh(p);



};

function doThing() {
const searchBarInput = document.querySelector("#search-bar-builds");

console.log('light years')
console.log('light years')
console.log(document.querySelectorAll("tbody tr"))

console.log(Array.from(document.querySelectorAll("tbody tr"))
.map((item) => ({
url: item.querySelector(".iamlink").href,
icon: item.querySelector(
"svg",
).outerHTML,
label: item.querySelector(".iamlink").textContent,
})))

searchBarInput.suggestions = function () {
return Array.from(document.querySelectorAll("tbody tr"))
.map((item) => ({
url: item.querySelector(".iamlink").href,
icon: item.querySelector(
"svg",
).outerHTML,
label: item.querySelector(".iamlink").textContent,
}));
};

Behaviour.applySubtree(searchBarInput, true)
}

21 changes: 17 additions & 4 deletions war/src/main/js/components/search-bar/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
import { createElementFromHtml } from "@/util/dom";
import makeKeyboardNavigable from "@/util/keyboard";
import { xmlEscape } from "@/util/security";
import behaviorShim from "../../util/behavior-shim";

const SELECTED_CLASS = "jenkins-search__results-item--selected";

function init() {
const searchBarInputs = document.querySelectorAll(".jenkins-search__input");
// const searchBarInputs = document.querySelectorAll(".jenkins-search__input");

behaviorShim.specify(
".jenkins-search__input",
"jenkins-search__input",
0,
(searchBar) => {

if (!searchBar.suggestions) {
return;
}

Array.from(searchBarInputs)
.filter((searchBar) => searchBar.suggestions)
.forEach((searchBar) => {
const searchWrapper = searchBar.parentElement.parentElement;
const searchResultsContainer = createElementFromHtml(
`<div class="jenkins-search__results-container"></div>`,
Expand Down Expand Up @@ -113,6 +121,11 @@ function init() {
hideResultsContainer();
});
});

// Array.from(searchBarInputs)
// .filter((searchBar) => searchBar.suggestions)
// .forEach((searchBar) => {

}

export default { init };
1 change: 1 addition & 0 deletions war/src/main/resources/images/symbols/timer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 15 additions & 5 deletions war/src/main/scss/base/_style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1215,7 +1215,7 @@ svg.icon-xlg {

.canvaas {
padding: 1.5rem 1rem;
border-radius: 1rem;
border-radius: 0.75rem;
margin-bottom: 1rem;
border: var(--card-border-width) solid var(--card-border-color);

Expand All @@ -1224,6 +1224,11 @@ svg.icon-xlg {
}
}

.aasda {
color: var(--text-color-secondary);
margin-left: 0.5ch;
}

.abouttodays {
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr;
Expand All @@ -1239,14 +1244,16 @@ svg.icon-xlg {
.iteem {
position: relative;
padding: 1rem 1.2rem;
border-radius: 1rem;
border-radius: 0.75rem;
font-size: 1.2rem;
font-weight: 700;
font-weight: 550;
overflow: hidden;
aspect-ratio: 20 / 10;
display: flex;
flex-direction: column;
justify-content: end;
line-height: 1;
gap: 0.625rem;

.backplate {
position: absolute;
Expand Down Expand Up @@ -1281,6 +1288,11 @@ svg.icon-xlg {
border-radius: inherit;
}

svg {
width: 1.5rem;
height: 1.5rem;
}

&--time {
--card-symbol: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='ionicon' viewBox='0 0 512 512'%3E%3Cpath d='M112.91 128A191.85 191.85 0 0064 254c-1.18 106.35 85.65 193.8 192 194 106.2.2 192-85.83 192-192 0-104.54-83.55-189.61-187.5-192a4.36 4.36 0 00-4.5 4.37V152' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='32'/%3E%3Cpath d='M233.38 278.63l-79-113a8.13 8.13 0 0111.32-11.32l113 79a32.5 32.5 0 01-37.25 53.26 33.21 33.21 0 01-8.07-7.94z'/%3E%3C/svg%3E");
}
Expand All @@ -1298,8 +1310,6 @@ svg.icon-xlg {

div:first-of-type {
color: var(--text-color-secondary);
opacity: 0.75;
font-weight: 550;
}
}
}
Expand Down

0 comments on commit 3baf616

Please sign in to comment.