D3JS with Kibana - javascript

Is it possible to host a D3.js control inside kibana
So for example if I click a cell in a row in kibana it should run a D3.js Background .Will it require a change in the Kibana source code ?

Apparently, it is possible: though integration within an existing dashboard may not be trivial. From the linked article:
As I understand, you want to access your custom script dashboard. If
so, keep your script file (.js) directly under app/dashboards and
access that http://localhost/kibana/#/dashboard/script/.js

Related

reveal.js working/bootstrap example

I found reveal.js but I couldn't find a simple working example.
I found this but they are either too complex or cannot find the source.
Does anyone have a simple example?
The reveal.js repository on GitHub is in itself a demo for a simple presentation.
You can simply fork the project on GitHub, clone the fork to your local file system and edit the index.html file in the root directory to get started with your presentation.
I myself have created several presentations this way, most recently this one: https://github.com/pahund/devugees-prez-oct2017
If you create your presentation on a special Git branch named gh-pages, you can even view it online without having to deploy it to a server, for example: https://pahund.github.io/devugees-prez-oct2017/
If you don't want to install all the components (around npm) needed to use reveal.js, you can still use a docker image like agiled-de/reveal.js-docker
This images makes it easy to use reveal.js with docker. It supports the use of the following plugins:
MathJax Enables you to write LaTeX formulas in your presentations
reveal.js-menu Adds a menu to test themes, transitions and jump to slides
Chalkbord Write on your slides or on a chalkboard
Reveal.js-Title-Footer Adds a footer that will stay on every slide
Charts To create charts within your presentation
vis.js To create graphs in your presentation
And it has a demo_presentation/index.md included.

Adding pure javascript code to Shopify Theme by using Shopify API

I developed a Shopify application that i install on Shopify Store and i want my application to add a javascript snippet in all the store pages. For this I want my application to modify the current theme, by using Shopify API, and add the javascript snippet to that theme.
I know of several ways to do it but they have several disadvantage:
Add a Shopify Asset/Snippet - The store owner has to manually modify the store's theme to link to the asset/snippet.
Add a script tag - I want my javascript to be embedded and not to be downloaded from a different source. A different source means longer page loads and i do not want my site to extend the page load.
Add an application proxy - This can also extend the loading time.
Can you suggest on what is the correct way to do it?
Add a script tag and be done with it. No other pattern offers up the same customer experience. When they install your App, your script is available. When they uninstall your App, their theme reverts nicely. Worrying about the load times of your asset is not worth it if you have done your job, and minimized your code and provided a fast CDN address for it.
In 2022, you get Theme App Extensions for OS 2.0. Do that!! Best way to add JS to a theme/store.
Are you using the embedded apps SDK? I'm pretty sure they have some option that makes this easier, like you can create a "sidebar" on every page and position it wherever you want (hidden if necessary).
Answering you question: the good way is using ScriptTag. Consider this article on this: https://docs.shopify.com/api/unlinked/using-javascript-responsibly
Still if you need to add code snippet as an asset, I want to point out that it's not necessary the customer must manually update the theme. As far as I know, you can add your snippet as an asset and then update another -- theme liquid template.
https://docs.shopify.com/api/asset#update
For the reasons described in an article I've provided above, you should not do that.

How to run d3 Javascript

I am trying to run a simple example of d3 Javascript. I am following this tutorial for setting up d3:
https://github.com/mbostock/d3/wiki
This is also a link where I copied and pasted the code from:
http://bl.ocks.org/mbostock/4062045
The codes are basically for visualising a Force-Directed Graph. I created a Dynamic Web Project in Eclipse Juno. Inside the Web content, I have created an HTML file and pasted the codes. I also downloaded:
http://d3js.org/d3.v3.min.js
I normally run the file either with a web browser (Right-click -> Open with -> Web browser) or on the server:(Right-click -> Run -> Run on server - Tomcat 7). Unfortunately, I do not see the graph. I am using Firefox. It seems I have misunderstood something from this tutorial for setting up d3:
https://github.com/mbostock/d3/wiki
Could anyone please help me to solve the issue of setting up d3. Is there anything I need to configure that I have missed in order to get it run. Your assistance would be very much appreciated.

Jenkins description

Is there a way to incorporate JavaScript into the description field on the top of Jenkins?
Anytime I add a script tag it's deleted by the Jenkins when you look at the source.
<script> </script>
If anyone has suggestions or a direction to point me that would be fantastic.
The main purpose of this would be to make have a simple check for a flag on the local machine that affects the builds and display its state in the description.
As per this answer, Jenkins applies an HTML sanitisation policy by default, which only permits certain HTML tags and attributes. The <script> tag is not one of these.
However, the way in which these descriptions is displayed is pluggable.
If you want to use the <script> tag, you would need to install a formatter plugin like the "Anything Goes" Formatter — which does no stripping of HTML whatsoever (leading to the risk of XSS) — and then enable it in the main Jenkins config.
When you say "on the top of Jenkins", I'm assuming you mean the top of the job page within the Jenkins UI.
According to this bug report stripping all HTML tags started happening in 2010. (Hudson is the project Jenkins was forked from is 2011 or so).
I would imagine they are stripping the HTML on display of the page, so editing the files directly on the Jenkins server may not work either. I would look into using the Jenkins API to update the job description to display the information you need.
Another idea would be to create a user script that you would install within the browser. Then it would pull the status, and inject it into the Jenkins interface.
One way to do this is with browser user scripts with the Tampermonkey or GreaseMonkey - Firefox only plugins. Users would need plugin and your user scripts. This would allow you to fetch data, alter page DOM, etc.. to customize the Jenkins workflow or display. The scripts can be configured to only match certain hosts and urls.

Grails javascript file reload

I'm developing a single page app and this requires a lot of javascript code editing. Unfortunately looks like grails is caching the javascript files and i can't see the effect of the modifications I made until I'm not running a clean command followed by a restart (it is 100% not a browser cache problem).
I'm using the resource plugin to get my JS files but I tried with and I get the same result, no matter were the files are placed (web-app/js or web-app/assets/js).
The only way to see the modifications in realtime is to place the code in a .gsp file but I don't like this solution. Is there any setting to enable the hot reload?
I'm using grails 2.2.2, win7
If you're using resources plugin (as it's the default in grails 2 I think), just add the following to the end of the url and you will se the changes:
?_debugResources=y
for example:
http://localhost:8080/myapp/main?_debugResources=y
Check the official documentation for other options: http://grails-plugins.github.io/grails-resources/guide/8.%20Debugging.html
Try adding the Grails cached-resources plugin. This will generate a unique name to your file based on your content, so everytime you change your javascript file, a new name will be linked in your GSP.

Categories