x
x
x
x
...
HTML |
---|
<style>
.applicationBannerNotStarted, .applicationBannerStarted, .applicationBannerSubmitted{
display: none;
}
.dash-banner{
height: fit-content!important;
}
.dash-banner .banner-segment:nth-child(1){
height: fit-content!important;
}
.dash-banner .banner-segment:nth-child(2){
height: unset!important;
}
</style>
<script>
const searchJiraApplicationsForUser = async (issueType) => {
let jiraRes = await jQuery.ajax({
url: "/rest/scriptrunner/latest/custom/searchJiraTickets",
headers: {
'X-Atlassian-Token' : 'nocheck',
'Content-type' : 'application/json'
},
type: "POST",
processData: false,
contentType: false,
data: JSON.stringify({
jql: `issuetype = "${issueType}" AND ('Confluence User Key' ~ '${AJS.params.remoteUserKey}') ORDER BY updated DESC`
}),
success: W=>{
console.log(W)
},
error: L=>{
console.log(L)
}
}).then(res => res);
return jiraRes;
}
const showDynamicApplicationBanner = async (pageTitle, issueType, applicationDeadlinePassed = false) => {
var bannerApplicationSubmitted = false;
var bannerApplicationComplete = false;
var bannerApplicationStarted = false;
if (applicationDeadlinePassed) {
$(".applicationBannerDeadlinePassed").waitUntilExists(() => {
$('.applicationBannerLoading').remove();
$(".applicationBannerDeadlinePassed").show();
});
return;
}
await searchJiraApplicationsForUser(issueType).then((appsCheck) => {
if (appsCheck.issues.length !== 0) {
bannerApplicationStarted = true;
if (appsCheck.issues[0].fields.customfield_10631) {
bannerApplicationSubmitted = true;
}
}
if (bannerApplicationSubmitted) {
// show submitted banner
$(".applicationBannerSubmitted").waitUntilExists(() => {
$('.applicationBannerLoading').remove();
$(".applicationBannerSubmitted").show();
});
} else if (bannerApplicationStarted) {
// show started banner
$(".applicationBannerStarted").waitUntilExists(() => {
$('.applicationBannerLoading').remove();
$(".applicationBannerStarted").show();
});
} else {
// show get started banner
$(".applicationBannerNotStarted").waitUntilExists(() => {
$('.applicationBannerLoading').remove();
$(".applicationBannerNotStarted").show();
});
}
})
}
</script> |
...