Last active
December 9, 2020 12:56
-
-
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
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
<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
https://community.atlassian.com/t5/Northern-Virginia/what-was-I-thinking/gpm-p/1470858