Skip to content

Commit

Permalink
Merge branch 'content-blocks' into ui-vertical-slice-5
Browse files Browse the repository at this point in the history
  • Loading branch information
janfaracik committed Aug 12, 2023
2 parents 443b27e + af2ed8a commit 66f6c92
Show file tree
Hide file tree
Showing 15 changed files with 240 additions and 254 deletions.
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ properties([

def axes = [
platforms: ['linux', 'windows'],
jdks: [11, 17, 19],
jdks: [11, 17, 21],
]

stage('Record build') {
Expand Down
2 changes: 1 addition & 1 deletion ath.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -o xtrace
cd "$(dirname "$0")"

# https://github.com/jenkinsci/acceptance-test-harness/releases
export ATH_VERSION=5688.vb_f1ceb_4b_74c4
export ATH_VERSION=5689.v4df8c8248244

if [[ $# -eq 0 ]]; then
export JDK=17
Expand Down
25 changes: 25 additions & 0 deletions core/src/main/java/hudson/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -1927,4 +1927,29 @@ public static long daysElapsedSince(@NonNull Date date) {
private static PathRemover newPathRemover(@NonNull PathRemover.PathChecker pathChecker) {
return PathRemover.newFilteredRobustRemover(pathChecker, DELETION_RETRIES, GC_AFTER_FAILED_DELETE, WAIT_BETWEEN_DELETION_RETRIES);
}

/**
* Returns SHA-256 Digest of input bytes
*/
@Restricted(NoExternalUse.class)
public static byte[] getSHA256DigestOf(@NonNull byte[] input) {
try {
MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
messageDigest.update(input);
return messageDigest.digest();
} catch (NoSuchAlgorithmException noSuchAlgorithmException) {
throw new IllegalStateException("SHA-256 could not be instantiated, but is required to" +
" be implemented by the language specification", noSuchAlgorithmException);
}
}

/**
* Returns Hex string of SHA-256 Digest of passed input
*/
@Restricted(NoExternalUse.class)
public static String getHexOfSHA256DigestOf(byte[] input) throws IOException {
//get hex string of sha 256 of payload
byte[] payloadDigest = Util.getSHA256DigestOf(input);
return (payloadDigest != null) ? Util.toHexString(payloadDigest) : null;
}
}
6 changes: 4 additions & 2 deletions core/src/main/java/jenkins/security/ConfidentialStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,16 @@ void clear() {

@Override
protected void store(ConfidentialKey key, byte[] payload) throws IOException {
LOGGER.fine(() -> "storing " + key.getId() + " " + Util.getDigestOf(Util.toHexString(payload)));
//called only from tests, get hex string of sha 256 for logging payload
LOGGER.fine("storing " + key.getId() + " " + Util.getHexOfSHA256DigestOf(payload));
data.put(key.getId(), payload);
}

@Override
protected byte[] load(ConfidentialKey key) throws IOException {
byte[] payload = data.get(key.getId());
LOGGER.fine(() -> "loading " + key.getId() + " " + (payload != null ? Util.getDigestOf(Util.toHexString(payload)) : "null"));
//called only from tests, get hex string of sha 256 for logging payload
LOGGER.fine("loading " + key.getId() + " " + (payload != null ? Util.getHexOfSHA256DigestOf(payload) : "null"));
return payload;
}

Expand Down
18 changes: 5 additions & 13 deletions core/src/main/resources/hudson/model/AllView/noJob.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ div {
a(href: "newJob", class: "content-block__link") {
span(_("createJob"))
span(class: "trailing-icon") {
l.icon(
class: "icon-md",
src: "symbol-arrow-right")
l.icon(src: "symbol-add")
}
}
}
Expand All @@ -48,9 +46,7 @@ div {
a(href: "computer/new", class: "content-block__link") {
span(_("setUpAgent"))
span(class: "trailing-icon") {
l.icon(
class: "icon-md",
src: "symbol-arrow-right")
l.icon(src: "symbol-computer")
}
}
}
Expand All @@ -60,9 +56,7 @@ div {
a(href: "cloud/", class: "content-block__link") {
span(_("setUpCloud"))
span(class: "trailing-icon") {
l.icon(
class: "icon-md",
src: "symbol-arrow-right")
l.icon(src: "symbol-cloud")
}
}
}
Expand All @@ -71,12 +65,10 @@ div {
li(class: "content-block") {
a(href: "https://www.jenkins.io/redirect/distributed-builds",
target: "_blank",
class: "content-block__link content-block__help-link") {
class: "content-block__link") {
span(_("learnMoreDistributedBuilds"))
span(class: "trailing-icon") {
l.icon(
class: "icon-md",
src: "symbol-link")
l.icon(src: "symbol-help-circle")
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/hudson/model/View/main.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ if (items == null) {
include(my.owner.viewsTabBar,"viewTabs")
}
}
}
}
8 changes: 4 additions & 4 deletions core/src/main/resources/jenkins/agents/CloudSet/index.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ THE SOFTWARE.
class="content-block__link">
<span>${%newCloud}</span>
<span class="trailing-icon">
<l:icon class="icon-md" src="symbol-arrow-right"/>
<l:icon src="symbol-arrow-right"/>
</span>
</a>
</li>
Expand All @@ -102,17 +102,17 @@ THE SOFTWARE.
class="content-block__link">
<span>${%installCloudPlugin}</span>
<span class="trailing-icon">
<l:icon class="icon-md" src="symbol-arrow-right"/>
<l:icon src="symbol-plugins" />
</span>
</a>
</li>
<li class="content-block">
<a href="https://www.jenkins.io/redirect/distributed-builds"
class="content-block__link content-block__help-link"
class="content-block__link"
target="_blank" rel="noopener noreferrer">
<span>${%learnMoreDistributedBuilds}</span>
<span class="trailing-icon">
<l:icon class="icon-md" src="symbol-link"/>
<l:icon src="symbol-help-circle" />
</span>
</a>
</li>
Expand Down
19 changes: 19 additions & 0 deletions core/src/test/java/hudson/UtilTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.startsWith;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
Expand Down Expand Up @@ -726,6 +727,24 @@ public void ifOverriddenFailure() {
assertEquals("The class " + DerivedClassFailure.class.getName() + " must override at least one of the BaseClass.method methods", error.getMessage());
}

@Test
public void testGetHexOfSHA256DigestOf() throws IOException {
byte[] input = new byte[] {12, 34, 16};
String str = Util.getHexOfSHA256DigestOf(input);
assertEquals(str, "134fefbd329986726407a5208107ef07c9e33da779f5068bff191733268fe997");
}

@Test
public void testGetSHA256DigestOf() {
byte[] input = new byte[] {12, 34, 16};
byte[] sha256DigestActual = Util.getSHA256DigestOf(input);

byte[] expected = new byte[]
{ 19, 79, -17, -67, 50, -103, -122, 114, 100, 7, -91, 32, -127, 7, -17, 7, -55, -29, 61, -89, 121, -11,
6, -117, -1, 25, 23, 51, 38, -113, -23, -105};
assertArrayEquals(expected, sha256DigestActual);
}

public static class BaseClass {
protected String method() {
return "base";
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ THE SOFTWARE.

<access-modifier.version>1.32</access-modifier.version>
<antlr.version>4.13.0</antlr.version>
<bridge-method-injector.version>1.27</bridge-method-injector.version>
<bridge-method-injector.version>1.28</bridge-method-injector.version>
<spotless.check.skip>false</spotless.check.skip>
<!-- Make sure to keep the jetty-maven-plugin version in war/pom.xml in sync with the Jetty release in Winstone: -->
<winstone.version>6.12</winstone.version>
Expand Down
2 changes: 1 addition & 1 deletion test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ THE SOFTWARE.
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>cloudbees-folder</artifactId>
<version>6.815.v0dd5a_cb_40e0e</version>
<version>6.846.v23698686f0f6</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
6 changes: 3 additions & 3 deletions war/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
"lint": "yarn lint:js && yarn lint:css"
},
"devDependencies": {
"@babel/cli": "7.22.9",
"@babel/core": "7.22.9",
"@babel/preset-env": "7.22.9",
"@babel/cli": "7.22.10",
"@babel/core": "7.22.10",
"@babel/preset-env": "7.22.10",
"babel-loader": "9.1.3",
"clean-webpack-plugin": "4.0.0",
"css-loader": "6.8.1",
Expand Down
4 changes: 4 additions & 0 deletions war/src/main/scss/abstracts/mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@
box-shadow: 0 0 0 0.66rem transparent;
}

&:focus-visible {
outline: none;
}

&:not(:disabled) {
&:hover,
&:focus-visible {
Expand Down
1 change: 1 addition & 0 deletions war/src/main/scss/base/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ a {
svg {
width: 16px;
height: 16px;
flex: 0 0 auto;
color: var(--text-color) !important;
}
}
Expand Down
77 changes: 23 additions & 54 deletions war/src/main/scss/modules/content-blocks.scss
Original file line number Diff line number Diff line change
@@ -1,81 +1,50 @@
@use "../abstracts/mixins";

.content-block {
border-radius: 4px;
border: 2px solid var(--light-grey);
}

.content-block__body {
padding: 1.5rem;
}

.content-block__body > *:first-child {
margin-top: 0;
}

.content-block__body > *:last-child {
margin-bottom: 0;
}

.content-block__footer {
background-color: var(--light-grey);
padding: 0.5rem 1.5rem;
}

.content-block__link-list {
padding: 0;
}

.content-block__link-list li {
list-style: none;
width: 100%;

&:not(:last-child) {
margin-bottom: 0.75rem;
}
}

.content-block__link {
padding: 0.5rem 1rem;
@include mixins.item;

display: flex;
justify-content: space-between;
background-color: var(--light-grey);

@include mixins.link-dark;

&:focus {
outline-color: var(--focus);
align-items: center;
padding: 0.75rem 1.1rem;
color: var(--text-color) !important;
font-weight: 500;
text-decoration: none !important;

&::before {
background: var(--button-background);
}

.trailing-icon .svg-icon {
&.icon-sm {
height: 1.25rem;
.trailing-icon {
display: flex;
justify-content: center;
align-items: center;
width: 1.25rem;
height: 1.25rem;

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

.content-block__help-link {
background-color: var(--white);
}

// Empty state specific blocks

.empty-state-block {
max-width: 600px;
margin: 0 auto;
margin-top: 1.5rem;
}

.empty-state-section {
margin-top: 2rem;
margin-top: var(--section-padding);
}

.empty-state-section-list {
display: flex;
flex-direction: column;
gap: 0.625rem;
padding: 0;

li {
list-style: none;
margin-bottom: 1rem;
}
}
Loading

0 comments on commit 66f6c92

Please sign in to comment.