Feature #1149
Interactively allow creation of selector
100%
Description
Add the ability to interactively create a selector from the UI.
This can be done with something like the SelectorGadget (http://selectorgadget.com/). It could work like this:
- Have a link to open the defined web-page with the selector gadget loaded and the selector set accordingly
- If a URL is not yet defined, then just show a warning
- Add in a dialog that tells the user that the red box is for removing matches
Subtasks
History
#2 Updated by Luke Murphey over 8 years ago
- Nicer loading screen
- Guidance that you should click red boxes to limit matches
- Callback so that selector info is sent back to input page
- Close button should close the page too
- Needs to support setting the selector externally
- Remove xpath option
- Might want to disable links (or obtain link from page if it changes)
#3 Updated by Luke Murphey about 8 years ago
Turns out that you can't do this. The browser won't allow it unless they are on the same domain (https://github.com/cantino/selectorgadget/pull/4).
#4 Updated by Luke Murphey about 8 years ago
Could include this as a bookmarklet.
#5 Updated by Luke Murphey almost 8 years ago
I might be able to make this happen by making a proxy within Splunk. I could use rewrite_links() within lxml to re-write the links (http://stackoverflow.com/questions/5789127/how-to-replace-links-using-lxml-and-iterlinks).
#6 Updated by Luke Murphey over 7 years ago
To try the proxy, I would need:
- To write a simple Python proxy within Splunk (authentication would need to be required)
- Re-write the URLs accordingly
- Put restrictions on the proxy requests (authenticated user, would need the ability to create a web_input, size limitation)
#7 Updated by Luke Murphey over 7 years ago
- Might want to block following links in the iframe
- Allowing following the links using the internal proxy (and updating the URL accordingly)
#8 Updated by Luke Murphey over 7 years ago
#9 Updated by Luke Murphey over 7 years ago
The DomPredictionHelper is what is used to make the CSS selector. See https://github.com/cantino/selectorgadget/blob/master/spec/test_sites/test/testDom.html.
https://www.reddit.com/r/webdev/comments/1xh1g6/does_there_exist_a_dom_navigator_that_calculates/
var Predict = new DomPredictionHelper(); $(document.body).on('click', function (e) { var elem = document.elementFromPoint(e.clientX, e.clientY); alert(Predict.getPathsFor([elem])); });
#10 Updated by Luke Murphey over 7 years ago
Some things I don't like about the current approach:
- There may be a race condition when applying the JS to the iframe
- The code for loading the css and JS in the iframe is ugly. Use something like the addStylesheet() function in Slideshow (http://lukemurphey.net/projects/splunk-slideshow/repository/entry/trunk/src/appserver/static/js/views/SlideshowSetupView.js).
#11 Updated by Luke Murphey over 7 years ago
- Status changed from New to Closed