Shaakunthala's Portal

Anything can go here, in any language... except my native language Sinhala. Be cool... anybody is warmly welcomed! :)

Save your day with JIRA AUI JavaScript Hacks

I've been a JIRA administrator for more than four years with the hope that time would permit me to blog anything about JIRA. Finally here it has come to that - my first blog post on JIRA administration!

So what I'm going to talk about today is how AUI JavaScript hacks can save a JIRA administrator's time and make his life easy.

AUI is an abbreviation for Atlassian User Interface Library. AUI JavaScript is actually a modified version of the famous JavaScript framework jQuery. Thus, the most of jQuery's official documentation works with AUI without a hassle.

Now, let me explain a case where AUI hacks can save you from cumbersome work.

Changing the workflow scheme of a JIRA project

It really frustrates me of when it comes to the status mapping part. I hate repetitive work. Especially when your JIRA project has a lot of issue types with a lot of Issues this step is a nightmare.

And this list repeats with all available issue types...
For simplicity, let's just assume all issue types follow the same workflow in the workflow scheme. Imagine your JIRA project has ten issue types and current workflow has ten statuses that do not exist in the new workflow. Then JIRA will give you 10 × 10 = 100 drop down lists to pick the new status mapping for each type-status. And it's a highly error prone when you do this by hand.

So how do we get through it in a 'hacker' way? Learning how to code is a worthy investment. :)

I’m using the Mozilla Firefox web browser with Firebug add-on here because it’s my familiar environment. But you can use vanilla Firefox or Chrome browser with pre-built development tools. First, when you are at the status mapping step, inspect a drop-down list using Firebug.

And then,

When you expand the HTML code for the select list, the HTML elements for the available options become visible. The value for each option is actually the ISSUESTATUS.ID column in JIRA database.

Looking at the structure of the page, jQuery's official documentation, AUI documentation you can quickly come up with a JavaScript code to change each drop down list's selected option to "In Progress" like this:

AJS.$('select option[value="3"]').attr('selected','selected');

The code says, "Make every drop down option who's value is 3 (In Progress) the selected option of its parent select element". Execute it in the Firebug script console and you can see all the drop down lists change their selection at once.

Now that was simple. Imagine you have discussed with the project stakeholders about how existing issue statuses should be mapped and agreed upon a mapping. For this example, let's take only two statuses.

Investigating --> In Progress
Verified --> Closed

Now, you can't use the above one line code because you want to 'filter off' old statuses other than "Investigating" before you change the values to "In Progress". Same applies to the "Verified" old status.

Don't panic. Let's just dig little deeper. If you carefully look at the "name" element of the select element we observed above, it says "mapping_1_10105". We have no idea what these numbers are for now, but with a little more inspection you will see in each drop down list where old status is "Investigating" the select element's name ends with 10105. (yes, it's very likely that status ID of "Investigating" is 10105)

Now, with a little more jQuery knowledge (read more about jQuery selectors), we can modify the above code as follows:

AJS.$('select[name$="_10105"] option[value="3"]').attr('selected','selected');

And for the "Verified" old status we can come up with something like this:

AJS.$('select[name$="_10101"] option[value="6"]').attr('selected','selected');

Just few lines of code and you're through a one cumbersome boring step with a big WOW! :)

Now, here's a question that some of my audience may ask:

What is the benefit of this whole process if you have spend more time on Firebugging and reading jQuery documentation than you could have just updated all entries by hand within a couple of minutes?
  • Because coding is so exciting and everyone should learn how to code. :)
  • Because this approach is less error prone. If your client or stakeholders are paranoid about data integrity, a wrong selection on a production environment can end up in a nightmare for real.
  • If you are doing data migration projects that have to do multiple rounds of testing and UAT, then this approach is a one time investment. You can save your code somewhere and reuse in each testing iteration. This ultimately saves a lot of time.

This blog post would have become unnecessarily long if I were to explain another case. So I won't be discussing more examples here. But AUI JavaScript is a cool thing to play with. Prepare your own evaluation instance of JIRA and you will see many ugly setups can be handled with simple pieces of JavaScript code. So play around, learn and share!

And to finish,... thanks for reading!

(The screenshots and examples used in this blog post do not reflect any of the JIRA setups I worked with at my previous or present places of work. All screenshots and examples are my own work on an evaluation instance of Atlassian JIRA)

Blogging from Android

This is going to be quite a short blog post. I bought an Android device. Well this is no big thing because it's been almost five years since the first release of Android. But I'm new to it. Still grabbing bits and pieces on how to use it.

I've been using several mobile devices time to time over the past few years. My first phone was a NEC-e1108 which was not good at all. Then used a Sony Ericsson K770i which was really a good phone. That phone made me a photogrpher. In 2011 I got a Nokia 5230 as a gift from a friend. Good thing with it was it had GPS. But when when my needs become more I wanted something that capable of much more things. That's why I bought my Galaxy Note II. Few years back it was the dream of mine to use a Linux capable phone. And now it's here.

As I said I'm still trying to grab bits and pieces on how to use Android. I've been able to experience several cool stuff. I'm writing this post using the S-Pen and using the Google's Blogger app. Handwriting recognition is pretty awesome.

A while ago I managed to setup Tor to work with Google Chrome browser. Most probably within next few months I'm planning to learn Android application development as well. No plans to root the device until The warranty expires, however I would love to hack this device.

And much more to try out such as USB OTG (On The Go). I'm going to try out mounting my one terabyte portable hard disk into the phone. And I hope it's going to open the door for much more cool and interesting stuff. :)

(This is just a blog post I wrote to try out Blogger app on Android)

Viral Apps on Facebook | Would you let them to use you?

Recently I saw some videos spreading on Facebook. 'Spreading', in the sense that people watch and share. What so special with these videos was, their thumbnails had that "Youtube feel", but seemed bit different. Also, most of these had eye-catching titles (in Sinhala), and eye-catching thumbnails (For example, a girl changing her dress... ;-) ).

I actually clicked on one of these to play the video. Then it took me to a Facebook application page where it prompted me to grant permissions to a Facebook app called "Gindara videos". Why would I ever let a Facebook app to access my personal information when I have dozens of better ways to anonymously watch video on the Internet? As a matter of fact, I stopped there. Access denied, Gindara videos go fly a kite, please.

Few days back I saw a girl has shared another video of the same type. She is a fun person I know, but it was bit of odd thing that she would share such a thing publicly. So I left a chat message to her jokingly, "what are these things you post on fb? :P", and she replied, "seriously i didn't know. :'(".

Then I wanted to have a close look at the phenomenon. "Gindara videos" is a malware hosted on a Sri Lankan website called This is not the only such malware seen on the Internet. Even years ago, there have been many of this type. But I feel this particular malware remained on Facebook for sometime longer than the previous ones, totally because people's ignorance. Their targeted victims seemed to be Sri Lankans and that may be the reason for such long lasting. If it ever had a 'global presence', not very long time it takes to vanish from Facebook.

Whenever you spot that kind of video or any malicious post on Facebook, take a moment to report them for spam. It's more of a civic duty. After reading the story below this picture, you'll better understand why you should report them.

Just report it for Spam

I did a piece of Holmes stuff and found out that these guys are using tool called "Facebook Viral Videos App With Auto Share" from a vendor called Appstico. As the name says, it's a 'viral' app which can automatically share videos on Facebook. Now, look at my friend's reply above again... she didn't know that she has shared a video on Facebook.

I don't want to promote Appstico's blackmarket stuff here, but just putting a nofollow hyperlink for you to go through it as understand what these guys do with YOUR personal information that YOU allow them to see.

This is what exactly all about. In short, here's how it works.
  1. There's a bunch of bad guys who want few more visitors coming into their website.
  2. They deploy a virus. A social virus which uses human mind as its career and people's curiosity as the exploit.
  3. Misled people just want to watch something that is rarely or never seen for real. No time to worry about privacy!
  4. The video hyperlink on Facebook actually directs the victim to the bad guys' website.
  5. It doesn't stop there. Without victim's knowledge, it posts a video hyperlink to the victim's Facebook timeline, which can be seen by other people.
  6. They get more traffic, more traffic is more profit, and target accomplished. And the poor victim even doesn't know that someone has used him/her until a friend pokes.
Let's have a look at the 2nd step above. These 'Tharunaya' guys do business and their sole purpose is to increase their business. Who has time to learn how to make a virus from A to Z? So they outsource it to another party. And that another party is Appstico.

(click to enlarge)
Appstico also does is business, and knows that there are many bunches of bad guys who want more business coming in. So Appstico makes a package for everyone, and sell it to the bad guys just for one hundred US dollars. Bad guys just rename it to "Gindara videos" and make use of it. How clever is that?

Would you still let them to use you? Myself, I wouldn't. The more you report these malicious activities for spam, less they get spread. Eventually the viral app will be taken out by Facebook. And as I said above, it's a civic duty to report malicious things, as it helps to keep Facebook clean and safe place for people.

It doen't cost much time - usually lesser than to watch a video :-)

Theoretically this entire blog post is all about a separate area in Internet security called "Social Engineering". To end this blog post, I'll leave that for your further reading:

Thanks for reading!

* If anyone is interested, I have proof of what I speak.


Subscription Options

 Subscribe in a reader


Enter your email address:

to inscrease

and make me happy. :)

Other Blogs by the Author

The Author

My Photo
Ambalangoda, Southern Province, Sri Lanka
Shaakunthala works as a Systems Support Engineer at a World's leading IT solutions company. A wannabe hacker, FOSS enthusiast, cat lover and an insane motorcyclist. And he comes from Sri Lanka!! :)
ශාකුන්තල | Shaakunthala's items Go to ශාකුන්තල | Shaakunthala's photostream
Related Posts with Thumbnails

I'm on

I'm listed in Technology