I was able to change it through the developer tools feature in Chrome which is temporary.
I wish to change the message "No Results found" to "Not Applicable" in all the panels; Same panel in the below screenshot:
Achieved it through developer tools feature as below; But how do i make it permanent ?
Could someone please help on what lines of code am i to add in my source code so "Not Applicable" is displayed?
Thanks in advance!
I think below example will help you on this.
XML:
<dashboard script="myJs.js">
<label>Replace No Rec Found - > Other Text</label>
<search id="base">
<query>| makeresults count=5 | eval a=1| accum a</query>
</search>
<row>
<panel>
<table id="t1">
<search id="s1" base="base">
<query>|where a="10"</query>
</search>
</table>
</panel>
<panel>
<table id="t2">
<search id="s2" base="base">
<query>|where a="9"</query>
</search>
</table>
</panel>
<panel>
<table id="t3">
<search id="s3" base="base">
<query>|where a="3"</query>
</search>
</table>
</panel>
<panel>
<table id="t4">
<search id="s4" base="base">
<query>|where a="7"</query>
</search>
</table>
</panel>
<panel>
<table id="t5">
<search id="s5" base="base">
<query>|where a="6"</query>
</search>
</table>
</panel>
</row>
</dashboard>
myJs.js
require([
'underscore',
'jquery',
'splunkjs/mvc',
'splunkjs/mvc/simplexml/ready!'
], function(_, $, mvc) {
$(document).ready(function() {
// Panel wise tabe id and search id mappig
var table_search_mapping = {
"t1": "s1",
"t2": "s2",
"t3": "s3",
"t4": "s4",
"t5": "s5"
};
$.each(table_search_mapping, function(tableId, searchId) {
var tmp = mvc.Components.get(searchId);
tmp.on("search:done", function(properties) {
if ($("#" + tableId + " .alert.alert-info")[0] !== undefined) {
console.log($("#" + tableId + " .alert.alert-info")[0].innerText)
if ($("#" + tableId + " .alert.alert-info")[0].innerText === "No results found.") {
$("#" + tableId + " .alert.alert-info")[0].innerText = "KV ▄︻̷̿┻̿═━一 ";
}
}
});
});
});
});
Feel free to ask anything in case.
Thanks
KV
▄︻̷̿┻̿═━一
If this reply helps you, an upvote would be appreciated.
I think below example will help you on this.
XML:
<dashboard script="myJs.js">
<label>Replace No Rec Found - > Other Text</label>
<search id="base">
<query>| makeresults count=5 | eval a=1| accum a</query>
</search>
<row>
<panel>
<table id="t1">
<search id="s1" base="base">
<query>|where a="10"</query>
</search>
</table>
</panel>
<panel>
<table id="t2">
<search id="s2" base="base">
<query>|where a="9"</query>
</search>
</table>
</panel>
<panel>
<table id="t3">
<search id="s3" base="base">
<query>|where a="3"</query>
</search>
</table>
</panel>
<panel>
<table id="t4">
<search id="s4" base="base">
<query>|where a="7"</query>
</search>
</table>
</panel>
<panel>
<table id="t5">
<search id="s5" base="base">
<query>|where a="6"</query>
</search>
</table>
</panel>
</row>
</dashboard>
myJs.js
require([
'underscore',
'jquery',
'splunkjs/mvc',
'splunkjs/mvc/simplexml/ready!'
], function(_, $, mvc) {
$(document).ready(function() {
// Panel wise tabe id and search id mappig
var table_search_mapping = {
"t1": "s1",
"t2": "s2",
"t3": "s3",
"t4": "s4",
"t5": "s5"
};
$.each(table_search_mapping, function(tableId, searchId) {
var tmp = mvc.Components.get(searchId);
tmp.on("search:done", function(properties) {
if ($("#" + tableId + " .alert.alert-info")[0] !== undefined) {
console.log($("#" + tableId + " .alert.alert-info")[0].innerText)
if ($("#" + tableId + " .alert.alert-info")[0].innerText === "No results found.") {
$("#" + tableId + " .alert.alert-info")[0].innerText = "KV ▄︻̷̿┻̿═━一 ";
}
}
});
});
});
});
Feel free to ask anything in case.
Thanks
KV
▄︻̷̿┻̿═━一
If this reply helps you, an upvote would be appreciated.
Hi kamlesh_vaghela!
Thanks for this!
Do i just add it with the rest of the XML code i already have for the dashboard and place the js in the backend?
Sorry new to this!
Create myJs.js javascript in SPLUNK_HOME/etc/apps/YOUR_APP/appserver/static/ folder.
Thanks
KV
▄︻̷̿┻̿═━一
If this reply helps you, an upvote would be appreciated.
Hi KV,
I added the script to my env, but my searches do not include a search id, base search or a table id which i understand is vital in order for the script to work(Please correct me if i am wrong).
Is there a workaround?
Thanks again in advance!
Can we also just make do by assigning search id's alone?