From ba0e055fd1fadceda7761636cb74b25a68e9fa22 Mon Sep 17 00:00:00 2001 From: Markus Winter Date: Wed, 3 Jan 2024 21:34:07 +0100 Subject: [PATCH] incorporate feedback use existing colors only animate when unknown or with flag animate via build caption and progressive rendering --- .../hudson/model/Run/statusIcon.jelly | 1 + .../DownloadJob/Installing/status.jelly | 2 +- .../resources/lib/hudson/build-caption.js | 6 ++ .../resources/lib/hudson/buildCaption.jelly | 2 +- .../lib/hudson/buildProgressBar.jelly | 6 +- .../resources/lib/hudson/progressBar.jelly | 68 ++++++++++------- .../lib/layout/progressiveRendering.jelly | 2 +- war/src/main/scss/abstracts/_theme.scss | 6 -- war/src/main/scss/base/_style.scss | 62 --------------- war/src/main/scss/components/_index.scss | 1 + .../main/scss/components/_progress-bar.scss | 75 +++++++++++++++++++ 11 files changed, 134 insertions(+), 97 deletions(-) create mode 100644 war/src/main/scss/components/_progress-bar.scss diff --git a/core/src/main/resources/hudson/model/Run/statusIcon.jelly b/core/src/main/resources/hudson/model/Run/statusIcon.jelly index 13598c0830b9..e481fd48761d 100644 --- a/core/src/main/resources/hudson/model/Run/statusIcon.jelly +++ b/core/src/main/resources/hudson/model/Run/statusIcon.jelly @@ -33,6 +33,7 @@ THE SOFTWARE. + diff --git a/core/src/main/resources/hudson/model/UpdateCenter/DownloadJob/Installing/status.jelly b/core/src/main/resources/hudson/model/UpdateCenter/DownloadJob/Installing/status.jelly index 69efd8937e8b..278604796fe6 100644 --- a/core/src/main/resources/hudson/model/UpdateCenter/DownloadJob/Installing/status.jelly +++ b/core/src/main/resources/hudson/model/UpdateCenter/DownloadJob/Installing/status.jelly @@ -28,6 +28,6 @@ THE SOFTWARE. ${%Installing}
- +
diff --git a/core/src/main/resources/lib/hudson/build-caption.js b/core/src/main/resources/lib/hudson/build-caption.js index e7414623123b..0dd83654c589 100644 --- a/core/src/main/resources/lib/hudson/build-caption.js +++ b/core/src/main/resources/lib/hudson/build-caption.js @@ -10,6 +10,7 @@ let progress = rsp.headers.get("X-Progress"); let runtime = rsp.headers.get("X-Executor-Runtime"); let remaining = rsp.headers.get("X-Executor-Remaining"); + let stuck = rsp.headers.get("X-Executor-Stuck"); let progressBar = document.querySelector(".app-progress-bar"); let progressBarDone = document.querySelector( ".app-progress-bar span", @@ -20,6 +21,11 @@ progressBar.setAttribute("tooltip", tooltip); progressBar.setAttribute("title", tooltip); Behaviour.applySubtree(progressBar, true); + if (stuck === "true") { + progressBar.classList.add("app-progress-bar--error"); + } else { + progressBar.classList.remove("app-progress-bar--error"); + } } if (progressBarDone) { progressBarDone.style.width = `${progress}%`; diff --git a/core/src/main/resources/lib/hudson/buildCaption.jelly b/core/src/main/resources/lib/hudson/buildCaption.jelly index f5ff16692e4c..82af767467a8 100644 --- a/core/src/main/resources/lib/hudson/buildCaption.jelly +++ b/core/src/main/resources/lib/hudson/buildCaption.jelly @@ -44,7 +44,7 @@ THE SOFTWARE. ${%Progress}: - + diff --git a/core/src/main/resources/lib/hudson/buildProgressBar.jelly b/core/src/main/resources/lib/hudson/buildProgressBar.jelly index ea6f87ded46a..55d2a50c825b 100644 --- a/core/src/main/resources/lib/hudson/buildProgressBar.jelly +++ b/core/src/main/resources/lib/hudson/buildProgressBar.jelly @@ -32,10 +32,14 @@ THE SOFTWARE. Executor that's carrying out the build. If null, defaults to "build.executor" + + animate the progress bar + + tooltipTemplate="${%text('%0','%1')}" + animate="${attrs.animate}"/> diff --git a/core/src/main/resources/lib/hudson/progressBar.jelly b/core/src/main/resources/lib/hudson/progressBar.jelly index c4974fa326c7..688318a8c2e6 100644 --- a/core/src/main/resources/lib/hudson/progressBar.jelly +++ b/core/src/main/resources/lib/hudson/progressBar.jelly @@ -22,30 +22,48 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --> - - -
- - - - - - - - -
+ + + + 0-100 to indicates the current progress. -1 if the progress is unknown + + + if set, the progress bar becomes a hyperlink + + + if set to non-null, the progress bar will be drawn in red, to indicate that the processing is likely stuck. + + + If set, id will be the identifier for the component + + + If set, the progress bar will have the double size + + + Tooltip with more progress details. + + + Template for the tooltip, so the tooltip can be updated dynamically via javascript. Used by buildCaption. + + + If set the progress bar will be animated. Animation will also be used when the current progress is unknown. + + + + + app-progress-bar ${attrs.large?'app-progress-bar--large':null} ${attrs.red?'app-progress-bar--error':null} + ${attrs.href} + + ${attrs.id} + + + + + + + + + + \ No newline at end of file diff --git a/core/src/main/resources/lib/layout/progressiveRendering.jelly b/core/src/main/resources/lib/layout/progressiveRendering.jelly index a07e78f4ad5f..4fa9f22012d8 100644 --- a/core/src/main/resources/lib/layout/progressiveRendering.jelly +++ b/core/src/main/resources/lib/layout/progressiveRendering.jelly @@ -36,7 +36,7 @@ THE SOFTWARE. - +
diff --git a/war/src/main/scss/abstracts/_theme.scss b/war/src/main/scss/abstracts/_theme.scss index f0da680d5497..fa97f23d6b66 100644 --- a/war/src/main/scss/abstracts/_theme.scss +++ b/war/src/main/scss/abstracts/_theme.scss @@ -311,12 +311,6 @@ $semantics: ( --item-background--active: hsla(240, 25%, 75%, 0.225); --item-box-shadow--focus: hsla(240, 25%, 75%, 0.105); - // progress-bar - --progress-done: #3465a4; - --progress-done-red: #c00; - --progress-left: #bababa; - --progress-anime-bg: white; - // Deprecated --primary: var(--accent-color); // Use var(--accent-color) instead --success: var(--green); // Use var(--success-color) instead diff --git a/war/src/main/scss/base/_style.scss b/war/src/main/scss/base/_style.scss index 8530f3edfc67..5d1762b54891 100644 --- a/war/src/main/scss/base/_style.scss +++ b/war/src/main/scss/base/_style.scss @@ -832,68 +832,6 @@ textarea { /* ========================= progress bar ========================= */ -.app-progress-bar { - height: 12px; - width: 100px; - padding: 2px; - border-radius: 6px; - background-color: var(--progress-left); - margin-top: 2px; - - &-large { - height: 24px; - width: 200px; - padding: 4px; - border-radius: 12px; - - & > span { - border-radius: 10px !important; - } - } - - & > span { - height: 100%; - min-width: 8%; - background-color: var(--progress-done); - display: block; - border-radius: 4px; - } - - &-animate { - background-image: linear-gradient( - -45deg, - var(--progress-anime-bg) 25%, - transparent 25%, - transparent 50%, - var(--progress-anime-bg) 50%, - var(--progress-anime-bg) 75%, - transparent 75%, - transparent - ); - z-index: 1; - background-size: 25px 25px; - animation: progress-bar 5s linear infinite; - } - - &.red > span { - background-color: var(--progress-done-red); - } - - & > .unknown { - width: 100%; - } -} - -@keyframes progress-bar { - 0% { - background-position: 0 0; - } - - 100% { - background-position: 25px 25px; - } -} - table.progress-bar { border-collapse: collapse; border: 1px solid #3465a4; diff --git a/war/src/main/scss/components/_index.scss b/war/src/main/scss/components/_index.scss index 70a4f6f62dd7..8551ffb500c4 100644 --- a/war/src/main/scss/components/_index.scss +++ b/war/src/main/scss/components/_index.scss @@ -13,6 +13,7 @@ @use "page-header"; @use "panes-and-bigtable"; @use "progress-animation"; +@use "progress-bar"; @use "row-selection-controller"; @use "section"; @use "side-panel-tasks"; diff --git a/war/src/main/scss/components/_progress-bar.scss b/war/src/main/scss/components/_progress-bar.scss new file mode 100644 index 000000000000..084452f03ef7 --- /dev/null +++ b/war/src/main/scss/components/_progress-bar.scss @@ -0,0 +1,75 @@ +.app-progress-bar { + --color: var(--accent-color); + + height: 12px; + width: 104px; + padding: 2px; + border-radius: 6px; + background-color: var(--text-color-secondary); + margin-top: 2px; + display: block; + opacity: 1 !important; + + &--error > span { + --color: var(--error-color); + } + + &--unknown { + width: 100%; + } + + &--large { + height: 24px; + width: 208px; + padding: 4px; + border-radius: 12px; + + & > span { + border-radius: 8px !important; + } + } + + & > span { + height: 100%; + min-width: 8%; + background-color: var(--color); + display: block; + border-radius: 4px; + } + + &--animate { + background-image: linear-gradient( + -45deg, + var(--background) 25%, + transparent 25%, + transparent 50%, + var(--background) 50%, + var(--background) 75%, + transparent 75%, + transparent + ); + z-index: 1; + background-size: 25px 25px; + animation: progress-bar 5s linear infinite; + + @keyframes progress-bar { + 0% { + background-position: 0 0; + } + + 100% { + background-position: 25px 25px; + } + } + } + + &:link { + &:hover { + opacity: 0.75 !important; + } + + &:active { + opacity: 0.5 !important; + } + } +}