Skip to content

Commit

Permalink
[FIXED JENKINS-18119] More compatible fix: make ts_refresh work again.
Browse files Browse the repository at this point in the history
  • Loading branch information
jglick committed Jul 29, 2013
1 parent 2cbaf86 commit aae1dc3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
3 changes: 3 additions & 0 deletions changelog.html
Expand Up @@ -88,6 +88,9 @@
<li class=bug>
Since 1.477 GET on <code>/view/…/config.xml</code> included a spurious wrapper element.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-17302">issue 17302</a>)
<li class=bug>
Revisited fix to be compatible for plugins.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-18119">issue 18119</a>)
<li class=rfe>
Clearer display of log messages: chronological order, and coloration of repeated vs. fresh metadata (date, log level, log source).
<li class=bug>
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/jenkins/util/ProgressiveRendering.java
Expand Up @@ -44,7 +44,7 @@
* (since it may be canceled if the user simply browses to another page while it is running).
* <ol>
* <li>Write a {@code <script>} section defining {@code function display(data)}.
* (Call {@code var t = document.getElementById('someid'); if (t.sortable != null) t.sortable.refresh()} if using a {@code sortable} table.)
* (Call {@code ts_refresh($('someid'))} if using a {@code sortable} table.)
* <li>Use {@code <l:progressiveRendering handler="${it.something()}" callback="display"/>} from your
* Jelly page to display a progress bar and initialize JavaScript infrastructure.
* (The callback attribute can take arbitrary JavaScript expression to be evaluated in the browser
Expand Down
Expand Up @@ -93,9 +93,7 @@ THE SOFTWARE.
}
r.appendChild(d);

if (p.sortable != null) {
p.sortable.refresh();
}
ts_refresh(p);
}
}
</script>
Expand Down
8 changes: 6 additions & 2 deletions war/src/main/webapp/scripts/sortable.js
Expand Up @@ -364,6 +364,10 @@ function ts_makeSortable(table) { // backward compatibility
return new Sortable.Sortable(table);
}

function ts_refresh(table) { // backward compatibility
return table.sortable.refresh();
/** Calls table.sortable.refresh() in case the sortable has been initialized; otherwise does nothing. */
function ts_refresh(table) {
var s = table.sortable;
if (s != null) {
s.refresh();
}
}

0 comments on commit aae1dc3

Please sign in to comment.