mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-19 10:51:34 +08:00
Drop release notes webhook -- with the notification system in place we will be utilizing that moving forward
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
id: news
|
||||
type:
|
||||
- masthead
|
||||
activate: true
|
||||
|
||||
icon: fa-bullhorn
|
||||
tooltip: See the Galaxy Release Notes
|
||||
@@ -1,111 +0,0 @@
|
||||
(function () {
|
||||
function hideNewsOverlay() {
|
||||
const container = document.getElementById("news-container");
|
||||
if (container) {
|
||||
container.style.visibility = "hidden";
|
||||
}
|
||||
}
|
||||
|
||||
function newsSeen(currentGalaxyVersion) {
|
||||
// When it's seen, remove the red indicator if it exists and store the current version.
|
||||
const newsIndicator = document.getElementById("news-indicator");
|
||||
if (newsIndicator) {
|
||||
newsIndicator.remove();
|
||||
}
|
||||
window.localStorage.setItem("galaxy-news-seen-release", currentGalaxyVersion);
|
||||
}
|
||||
|
||||
function newsUnseen() {
|
||||
// When there is news, add an red indicator to the icon.
|
||||
const newsIconSpan = document.querySelector("#news .nav-link");
|
||||
newsIconSpan.insertAdjacentHTML("beforeend", '<span id="news-indicator"></span>');
|
||||
}
|
||||
|
||||
/* The masthead icon may not exist yet when this webhook executes; we need this to wait for that to happen.
|
||||
* elementReady function from gist:
|
||||
* https://gist.github.com/jwilson8767/db379026efcbd932f64382db4b02853e
|
||||
*/
|
||||
function elementReadyNews(selector) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const el = document.querySelector(selector);
|
||||
if (el) {
|
||||
resolve(el);
|
||||
}
|
||||
new MutationObserver((mutationRecords, observer) => {
|
||||
// Query for elements matching the specified selector
|
||||
Array.from(document.querySelectorAll(selector)).forEach((element) => {
|
||||
resolve(element);
|
||||
//Once we have resolved we don't need the observer anymore.
|
||||
observer.disconnect();
|
||||
});
|
||||
}).observe(document.documentElement, {
|
||||
childList: true,
|
||||
subtree: true,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
elementReadyNews("#news a").then((el) => {
|
||||
// External stuff may also have attached a click handler here (vue-based masthead)
|
||||
// replace with a clean copy of the node to remove all that cruft.
|
||||
clean = el.cloneNode(true);
|
||||
el.parentNode.replaceChild(clean, el);
|
||||
|
||||
let currentGalaxyVersion = Galaxy.config.version_major;
|
||||
const lastSeenVersion = window.localStorage.getItem("galaxy-news-seen-release");
|
||||
|
||||
// If we're at a deployed release candidate, just mark it seen and show
|
||||
// the previous notes if someone clicks the link. RC notes won't exist.
|
||||
if (Galaxy.config.version_minor.startsWith("rc")) {
|
||||
// If we, for whatever reason, need to do this again just add
|
||||
// another case here. It's not worth parsing and doing version
|
||||
// math, and we should be able to drop preferring notifications
|
||||
// framework moving forward in 23.2
|
||||
if (currentGalaxyVersion == "23.1") {
|
||||
currentGalaxyVersion = "23.0";
|
||||
}
|
||||
newsSeen(currentGalaxyVersion);
|
||||
} else if (lastSeenVersion != currentGalaxyVersion) {
|
||||
newsUnseen();
|
||||
} else {
|
||||
newsSeen(currentGalaxyVersion);
|
||||
}
|
||||
|
||||
const releaseNotes = `https://docs.galaxyproject.org/en/latest/releases/${currentGalaxyVersion}_announce_user.html`;
|
||||
|
||||
clean.addEventListener("click", (e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
// If element doesn't exist, add it.
|
||||
if (document.getElementById("news-container") == null) {
|
||||
document.querySelector("body.full-content").insertAdjacentHTML(
|
||||
"afterbegin",
|
||||
`
|
||||
<div id="news-container" style="visibility: hidden">
|
||||
<div id="news-screen-overlay"></div>
|
||||
<div id="news-screen">
|
||||
<div id="news-header">
|
||||
<iframe id="news-embed" src="${releaseNotes}" width="80%" height="80%"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</div>`
|
||||
);
|
||||
// Clicking outside of GTN closes it
|
||||
document.getElementById("news-screen").addEventListener("click", () => {
|
||||
hideNewsOverlay();
|
||||
});
|
||||
}
|
||||
document.getElementById("news-container").style.visibility = "visible";
|
||||
newsSeen(currentGalaxyVersion);
|
||||
});
|
||||
});
|
||||
|
||||
// Remove the overlay on escape button click
|
||||
document.addEventListener("keydown", (e) => {
|
||||
// Check for escape button - "27"
|
||||
if (e.which === 27 || e.keyCode === 27) {
|
||||
hideNewsOverlay();
|
||||
}
|
||||
});
|
||||
})();
|
||||
@@ -1,38 +0,0 @@
|
||||
#news-screen {
|
||||
position: fixed;
|
||||
z-index: 5100;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#news-screen-overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
background: rgba(224, 224, 224, 0.75);
|
||||
z-index: 5000;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
opacity: 2;
|
||||
}
|
||||
|
||||
#news-header {
|
||||
position: fixed;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
z-index: 5200;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
#news-indicator {
|
||||
position: absolute;
|
||||
top: 0.5rem;
|
||||
right: 0.2rem;
|
||||
width: 0.6rem;
|
||||
height: 0.6rem;
|
||||
border-radius: 50%;
|
||||
background: #e31a1e;
|
||||
}
|
||||
Reference in New Issue
Block a user