Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX JENKINS-41966] load and save using the editor from Github (#886)
* JENKINS-41966 load and save using the editor from Github
- Loading branch information
Showing
29 changed files
with
187 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/** | ||
* This contains a bit that reuses the index.jelly progress bar | ||
* so React components can just add a <PageLoading/> indicator, | ||
* and overlapping loading should just extend the time, etc. | ||
*/ | ||
let loadingCount = 0; | ||
const timeouts = []; | ||
|
||
// use a short timeout so fast connections aren't seeing | ||
// flashes of the progress bar all the time | ||
const delay = 350; | ||
const loadbar = typeof document !== 'undefined' && document.getElementById('loadbar'); | ||
|
||
/** | ||
* Remove queued progress additions | ||
*/ | ||
function clearTimeouts() { | ||
while (timeouts.length) { | ||
clearTimeout(timeouts.pop()); | ||
} | ||
} | ||
|
||
/** | ||
* Add a timeout to transition the loading animation differently | ||
*/ | ||
function setLoaderClass(c, t) { | ||
timeouts.push(setTimeout(() => { | ||
loadbar.classList.add(c); | ||
}, t)); | ||
} | ||
|
||
/** | ||
* Simple mostly css-based loading animation | ||
*/ | ||
export default { | ||
show() { | ||
if (loadbar) { | ||
if (loadingCount === 0) { | ||
// (re)start the loading animation | ||
clearTimeouts(); | ||
loadbar.classList.remove('complete'); | ||
setLoaderClass('go', delay); // these times need to match the index.jelly CSS definitions | ||
setLoaderClass('long', delay + 1000); | ||
setLoaderClass('longer', delay + 6000); | ||
} | ||
loadingCount++; | ||
} | ||
}, | ||
|
||
hide() { | ||
if (loadbar) { | ||
if (loadingCount > 0) { | ||
loadingCount--; | ||
} | ||
|
||
if (loadingCount === 0) { | ||
// stop the loading animation | ||
clearTimeouts(); | ||
setLoaderClass('complete', 10); | ||
timeouts.push(setTimeout(() => { | ||
// The Element.classList is a read-only property | ||
const classList = loadbar.classList; | ||
if (classList && classList.length && classList.length > 0) { | ||
// remove all items - compatible with older browser | ||
classList.remove.apply(classList, [... classList]); | ||
} | ||
}, 500)); | ||
} | ||
} | ||
}, | ||
|
||
// TODO should make this a stack to push/pop | ||
setDarkBackground() { | ||
if (loadbar) document.getElementsByTagName('body')[0].classList.add('loadbar-light'); | ||
}, | ||
|
||
setLightBackground() { | ||
if (loadbar) document.getElementsByTagName('body')[0].classList.remove('loadbar-light'); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.