Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JiBrok/653b5615199ed991272ab1c8c8345d7f to your computer and use it in GitHub Desktop.
Save JiBrok/653b5615199ed991272ab1c8c8345d7f to your computer and use it in GitHub Desktop.
Jira announcement banner: Notification that this is a production environment and disabling plugin install
<script>
AJS.toInit(() => {
var baseUrl = "http://localhost:2990/jira"
var upmUrl = "/plugins/servlet/upm"
var worklfowUrl = "/secure/admin/workflows"
function isWorkingTime(){
return new Date().getHours() > 7 && new Date().getHours() < 22
}
function showAdminAlert(){
alert("Attention! it is prod system");
}
function showAdminBanner(){
AJS.messages.error(".generalAdminHeading, #upm-link-bar", {
title: 'THIS IS A PROD SYSTEM!!!',
body: ''
});
}
if(window.location.href.indexOf(baseUrl) >= 0){
if(window.location.href.indexOf(upmUrl) >= 0){
if(isWorkingTime()){
showAdminAlert()
showAdminBanner();
AJS.$('.upm-update-all-item, #upm-update-all, #upm-upload').remove();
AJS.$('#upm-manage-container').hide()
}
} else if(window.location.href.indexOf(worklfowUrl) >= 0){
if(isWorkingTime()){
showAdminAlert()
showAdminBanner();
}
}
}
})
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment