I am building a dashboard that uses a base query and then several panels use that query to display some data. A few of my panels do not show anything (No Result Found) . All of the panels that dont show any data use stats function. Here is my dashboard code -
<label>ZZ_Test</label>
<description>Test Playground</description>
<search id="mainData">
<query>
index="mydata"| eventstats max(_time) as maxTimestamp| where _time=maxTimestamp| search businessGroup IN ("*")
</query>
<earliest>$timeToken.earliest$</earliest>
<latest>$timeToken.latest$</latest>
</search>
<fieldset submitButton="false">
<input type="time" token="timeToken">
<label>timeToken</label>
<default>
<earliest>-24h#h</earliest>
<latest>now</latest>
</default>
</input>
</fieldset>
<row>
<panel>
<single>
<title>Total1</title>
<search base="mainData">
<query>stats sum("objects{}.count") as "Total"</query>
</search>
<option name="drilldown">none</option>
<option name="refresh.display">progressbar</option>
</single>
<single>
<title>Total2</title>
<search base="mainData">
<query>spath path="objects{}.count" output="Total"</query>
</search>
<option name="drilldown">none</option>
<option name="refresh.display">progressbar</option>
</single>
</panel>
</row>
</form>
Here are a couple of sample events -
[{
"businessGroup": "Sample1",
"objects": [
{
"count": 5
}
]
},
{
"businessGroup": "Sample2",
"objects": [
{
"count": 54
}
]
}
]
When i view this dashboard, i see Total2 populated, but Total1 shows no results found.
What am i missing ?
I suspect the stats command doesn't like field names in object format. Try renaming them to something simpler first.
<query>| rename "objects{}.count" as count | stats sum(count) as "Total"</query>
[EDIT]
Second suggestion. The "Total1" panel does not contain an spath command, unlike panel "Total2". Without spath the field being counted probably doesn't exist.
Related
I am using https://dabernathy89.github.io/vue-query-builder/ Vue Query Builder. Now, I need to use custom-component type. Here is the code for the rules in the parent component:
rules: [
{
type: "text",
id: "url_regex",
label: "Url Regex",
},
{
type: "text",
id: "page_source",
label: "Page Source ",
},
{
type: "custom-component",
id: "page_dom_element",
label: "Page Dom Element",
operators: [],
component : PageDomElement,
},
],
Above you can see that, third rules contain custom-component type and the component is PageDomElement.
And this PageDomElement is look like this:
<template>
<div>
<input type="text" id="page_dom_element" class="form-control" placeholder="jQuery path"/>
<select name="" id="" class="form-control">
<option value="equals">equals</option>
<option value="does-not-equals">does not equals</option>
<option value="contains">contains</option>
<option value="does-not-contain">does not contain</option>
<option value="is-empty">is empty</option>
<option value="is-not-empty">is not empty</option>
<option value="begins-with">begins with</option>
<option value="end-with">end with</option>
</select>
<input type="text" class="form-control"/>
</div>
</template>
<script setup lang="ts">
</script>
<style scoped>
</style>
Now, my question is how can I get the this custom component fields value ?
I have created a dashboard with the base search as shown below.
The base search is applied correctly on single panel but in chart panel the base search does not seem to work. The chart panel always shows no result found. But if I give the query directly instead of referencing to base search then the chart panel also works fine.
How do I make sure that chart panel uses the base search?
<search id="base_search_app">
<query>index=something | table msg,timestamp</query>
<earliest>$time.earliest$</earliest>
<latest>$time.latest$</latest>
</search>
<fieldset submitButton="true" autoRun="true">
<input type="time" token="time">
<label>Time Picker</label>
<default>
<earliest>-15m</earliest>
<latest>now</latest>
</default>
</input>
</fieldset>
<row>
<panel>
<single>
<title>Total created</title>
<search base="base_search_app">
<query>| where like(msg, "%Invoked service%") | stats count</query>
</search>
<option name="colorMode">block</option>
<option name="drilldown">none</option>
<option name="rangeColors">["0x53a051","0x0877a6","0xf8be34","0xf1813f","0x006d9c"]</option>
<option name="underLabel">No idea when to use this</option>
<option name="useColors">1</option>
</single>
</panel>
</row>
<row>
<panel>
<chart>
<title>Customer response timeline</title>
<search base="base_search_app">
<query>| search msg="*something*" OR msg="*somethingelse*" | timechart count</query>
</search>
<option name="charting.chart">line</option>
<option name="charting.drilldown">none</option>
<option name="height">558</option>
<option name="refresh.display">progressbar</option>
</chart>
</panel>
</row>
The timechart command requires the _time field, which the base search does not provide. The fix depends on the format of the timestamp field. If it's in epoch form then a simple | rename timestamp as _time in the chart panel will do; otherwise, timestamp will have to be converted into epoch form using | eval _time = strptime(timestamp, "<format string>").
I have a button 'Add Field' and when I click it, I show a select box with several predefined options.
Now, below this select box I want to display another select box if the value selected in the select field is equal to, let's say, 'Hello', otherwise display an input field but I am struggling to achieve this.
Right now, my code looks like this:
<div v-for="option in folder.salary.fields" :key="option.id">
<b-form-group label="Select field" label-for="salaryOptionField">
<select
v-model="folder.salary.fields.name"
value-field="id"
#change="onOptionSelected"
>
<option :value="null" disabled>Select type</option>
<option v-for="(type, key) in salaryFields" :value="key">
{{ salaryFields[key] }}
</option>
</select>
<template v-if="folder.salary.fields.name === 'Hello'">
<b-form-group label="Name" label-for="name">
<input type="text"
name="name"
v-model="folder.salary.benefits.a"
required/>
</b-form-group>
</template>
</b-form-group>
</div>
<b-btn #click="addNewSalaryField" variant="primary">Add Field</b-btn>
addNewSalaryField(){
this.folder.salary.fields.push({
name: '',
amount: ''
})
}
data() {
return {
folder: {
pages: [],
salary: {
fields: [],
benefits: []
}
}
}
}
Right now, if I select 'Hello' from the select field, nothing happens. Appreciate your help.
I've made a user profile plugin for Joomla 2.5 using this tutorial link
It works great, but I need the custom field that I added to be a radio button instead of text, because it's a "male/female' option.
Here is how it looks like in /plugins/user/profile10/profiles/profile.xml:
<field
name="gender"
type="text"
id="gender"
description="Male or Female?"
filter="string"
label="Male or Female?"
message="PLG_USER_PROFILE_FIELD_WEB_SITE_MESSAGE"
size="30"
/>
and plugins/user/profile10/profile10.xml:
<field name="register-require_gender" type="list"
description="Your gender"
label="Male or female?"
>
<option value="2">JOPTION_REQUIRED</option>
<option value="1">JOPTION_OPTIONAL</option>
<option value="0">JDISABLED</option>
</field>
I noticed the line type="text" but I'm not sure what I replace it for and where I place both options.
Does anyone know how to do it? Thanks in advance.
According to the Joomla documentation for Standard Form Field Types, you want to use the Radio type. In this case, type would be 'radio' and you would add options for each value specified.
This is the code that I've used:
<field
name="gender"
type="radio"
id="gender"
label="PLG_USER_TESTPROFILE_FIELD_GENDER_LABEL"
default="m">
<option value="m">Male</option>
<option value="f">Female</option>
</field>
I have a dijit.form.Select on my page:
<c:set var="qualId" value="${previous.qualification.id}" />
<select id="qualification" name="qualification" dojoType="dijit.form.Select" onchange="checkForPHD()">
<option value="-1" label=" "> </option>
<c:forEach items="${requestScope.qualifications}" var="qualItem">
<c:choose>
<c:when test="${qualId eq qualItem.id}">
<option value="${qualItem.id}" selected = "selected">${qualItem.name}</option>
</c:when>
<c:otherwise>
<option value="${qualItem.id}">${qualItem.name}</option>
</c:otherwise>
</c:choose>
</c:forEach>
</select>
Then some javascript that I'm trying to use to set some text to the TEXT of the option chosen from the select box;
function checkForPHD() {
dojo.byId('clazzPHDMessage').innerHTML = dojo.byId('qualification')
.attr('displayedValue');
}
I'd read that the .attr('displayedValue') was suppose to get the text from the selected option in a dijit.form.Select but it doesn't seem to do much? .attr('value') got that values ok but I need the TEXT?
You should use dijit.byId() to get widget instance. Try to use this code to get selected text:
dijit.byId('qualification').attr('displayedValue')
Seems like what you want is the innerHTML of the currently selected option (<option>THIS TEXT??</option>). I think this should do the trick. Loop over all the select's options with getOptions and find the selected one, then return its innerHTML. I don't know if dijit.form.Select has a selectedIndex property, but that would help too.
function getSelectedText() {
dojo.foreach(dijit.byId("qualification").getOptions(), function(opt, i) {
if (opt.selected) {
return opt.innerHTML;
}
});
}
You should try to get the selected node first, then get the attribute you want, as follows:
dijit.byId("qualification").getSelected().attr('innerHTML');
You can try the below Code Snip
dijit.registry.byId("regionList").value;
<select name="regionList" id="regionList" data-dojo-id="regionList" data-dojo-type="dijit/form/Select">
<option value="" selected="true">Select LoB</option>
<option value="Asia" >Asia</option>
<option value="Africa" >Africa</option>
</select>