Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?


Add Right-Click Functionality


Add right-click functionality to a tab your app created in JSA.

This example shows how to use the right-click GUI Action to capture an IP address and pass the information to custom JavaScript. Use the right-click menu on the JSALog Activity tab to capture an IP address of an event. Pass the IP address to a custom tab. Use a button on the custom tab to initiate a search for events that contain the captured IP address.


... "areas": [ { "url": "index", "text": "RtClick", "required_capabilities": ["ADMIN"], "id": "QRtClick", "description": "An app to POC Right Click" } ], "gui_actions" : [ { "id" : "rtClickEventIP", "text" : "Get row info from right click", "description" : "Right click on a row, get all the info", "icon": null, "rest_method": "rtgetcontext", "javascript" : "clickme(result)", "groups" : ["ipPopup"], "required_capabilities" : ["ADMIN"] } ], "rest_methods" : [ { "name":"rtgetcontext", "url":"/getcontext", "method":"GET", "argument_names":["context"] } ], "page_scripts" : [ { "app_name":"EventViewer", "page_id":"EventList", "scripts" : ["static/clickme.js"] } ] ...


__author__ = 'IBM' from app import app from flask import jsonify, request, render_template import json from qpylib import qpylib @app.route('/') @app.route('/index') def index(): other_data = request.args.get("otherdata"); context = request.args.get("context"); if context is None: context = "" if other_data is None: other_data = "" qpylib.log("Displaying context" + str(context)); return render_template("index.html", context=context, other=other_data) @app.route('/getcontext', methods=['GET']) def get_context(): context = request.args.get("context") qpylib.log("Setting the results to: " + context) return json.dumps({"app_id":qpylib.get_app_id(),"context":context})


function clickme(result) { var app_id = "" var context = "" if (result) { app_id = encodeURI(result.app_id) context = encodeURI(result.context) } var d = new Date(); var n = d.getTime(); var otherData = "Something passed from Javascript" console.log("Hey, you right clicked on me"); console.log(result)


<html> <body> <script> var gotoTab = function() { var url = "/console/do/ariel/arielSearch?appName= EventViewer&pageId=EventList&dispatch=performSearch&value(searchMode)= AQL&searchOrigin=SEARCH_RESULTS_AQL&value(timeRangeType)= aqlTime&value(interval)=300000&value(searchName) =&value(searchId)=null&value(aql) =select%20*%20from%20events%20where%20destinationip%20%3D%20%27" + "{{context}}" + "%27%20LAST%2012%20HOURS&value(aqlLines) =%5B%22select%20*%20from%20events%20where%20destinationip%20%3D%20%27" + "{{context}}" + "%27%20LAST%2012%20HOURS%22%5D&value(recordsLimit)=" top.setActiveTab("EventViewer", url ) } </script> <div> <ul> <li>Received context data from JSA: {{context}}</li> <li>Received other data from Javascript: {{other}}</li> <li><button onclick="gotoTab()">Search for events with sourceip of {{context}}</button> </ul> </div> </body> </html>