I am slowly crawling the Popup.js file, and I have "improved" my popup:
_myPopup = Splunk.Popup.createEAIForm(window, "My popup",
{
url : Splunk.util.make_url('manager',
Splunk.util.getCurrentApp(),
'/saved/eventtypes/_new?action=edit&noContainer=2&viewFilter=modal&eleOnly=1'),
title : "My Popup",
pclass : "myPopupClass",
buttons :
[
{
label: 'Cancel',
type : 'secondary',
callback: cancel
},
{
label: 'Apply',
type : 'primary',
callback: handleSaveSubmit
}
]
});
I think I have understood that you can't directly inject some html code inside it. It looks like you have to take the layout of the popup from a page (by the url property). I have taken this example from the Popup.js file itself, and I can use it in my page, but there is so many things that I still don't have any clue:
1°) How to create the html content and where to put it for it to be displayed in the popup
2°) How do you pass values back and forth the page <-> popup (how do you save changes done in the popup)
3°) Where can I find documentation on the Popup class (except from inside the code comments)? (I don't know what meansEAIForm, what exactly does the make_url function ...)
If any one could help, it would be greatly appreciated
PS: I have put it inside another answer for clarity, besides it partially answer the question
EDIT:
I was able to answer 1°) : here is the code of my popup:
_myPopup = Splunk.Popup.createEAIForm(window, "My Popup Name",
{
url : Splunk.util.make_url('app', Splunk.util.getCurrentApp(), 'The view you want your popup to be populated with'),
title : "My popup",
pclass : "myPopupClass",
buttons :
[
{
label: 'Cancel',
type : 'secondary',
callback: cancel
},
{
label: 'Apply',
type : 'primary',
callback: handleSaveSubmit
}
]
});
I still have a problem (JS error: TypeError: Splunk.EAI.getInstance(...) is null). I am currently investigating.
Hope this helps, but I still don't know how to do n°2.
... View more