Redirect after a version is created.

Mizan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 24, 2012

Hi All ,

I need to redirect to the version eg: http://localhost:8080/browse/TST/fixforversion/10003 after the version(10003) is created.

Jira version is 5.1.3

I am trying to do this using the event listener for VersionCreateEvent but i guess this is not possible .

Is there a javascript/jquery solution for this ?

Any help highly appreciated.

Thank you

1 answer

0 votes
Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 24, 2012

The version creation is now done using REST APIs and hence this will not be possible without changing JIRA source files.

An easier, and probably better, approach will be to disable the standard functionality and provide it via a plugin of your own. You can then redirect it in your code.

Mizan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 26, 2012

Hi Jobin ,

How to disable the standard functionality of adding a version ? and will i have to provide a separate UI to the user for adding a version ? the current UI provided by Jira is very good and i wont be able to replicate the same .

Can i just disable the add version functionality and insert a new logic via a plugin, which on the button click adds the version and redirects ... is this possible ?

Thank you.

Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 26, 2012

You will have to disable that panel in the system plugin. And yes, you will have to provde your own UI if you want to do it in a plugin.

Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 26, 2012

btw, it appears some of those modules cannot be disabled from UI. A harder task then! You will have to disable them in the bundled plugins

I am not sure if there is an event that you can capture in Javascript to do the redirection. If there was, that would have been the best hack!

Mizan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 27, 2012

Below is a Javascript which redirects but it is for Jira 4.4 and does not work for Jira 5.1.x since the event cannot be captured.

AJS.$(function () {
    AJS.$("#project-config-versions-add").submit(function() {
        window.location.href = "http://www.google.com";
    });
});

Can we do something like

//pseudo code
AJS.$(function () {
if(version creation page){
 AJS.$(".aui-button").click(function() {
        window.location.href = "http://www.google.com";
    });
}
 });

Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 27, 2012

Yeah, seems the button doesn't have a unique id now! Maybe you can check if there is a table with id project-config-versions-table and then do the redirection.

This is assuming that there is no other page with the same table id!

Mizan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 1, 2012

How to check if the table is submitted successfully and then redirect ?

Can we add a link to the button using Javascript and this link will call an action (java class of webwork plugin module) but how to check if the version was created and get its id . because versions with same name are not created .

Thank you

Mizan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 10, 2012

Hi Jobin ,

I guess this is not possible using Javascript .

Do you know which Jira files i will need to modify for redirecting after version is created.

Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 11, 2012

I dont know for sure. But start looking at jira-project-config-plugin which is a bundled plugin. It has few version related javascripts under versions/js folder.

Suggest an answer

Log in or Sign up to answer