Splunk - Multi-select - Show unique hosts - splunk

I want to populate the list of hosts in the multiselect input option in Splunk.
index=someIndexName * host!="notThis*" | stats values(host) as host
I can see the list of hosts getting populated in Splunk. However, they are not getting populated in multiselect list. It says "populating" and nothing shows up.

Try using this as the populating search
index=someIndexName * host!="notThis*" | stats count by host
and then use host as the Field for Label and also the Field for Value

<input type="multiselect" token="field1">
<label>Hosts</label>
<fieldForLabel>host</fieldForLabel>
<fieldForValue>host</fieldForValue>
<search>
<query>index= someIndexName host!="notThis*"| stats count by host</query>
</search>
<choice value="*">All</choice>
<default>*</default>
<initialValue>*</initialValue>
<delimiter> </delimiter>
</input>
As Simon Duff also suggested, this works!

Related

How can I set the checked property using vuelidate from an array of options?

I have an array of activities that looks like this:
[
{id: 'd0a503f0-be2b-453c-8f6e-d5a734bbba33, name: 'Baseball'}
{id: 'd0a503f0..., name: 'Soccer'}
...
]
I am looping through each activity to render a list of checkbox options like this:
<div v-for="activity in activities" :key="activity.id">
<input :id="`activity-${activity.id}`"
v-model="$v.resource.activities.$model" name="activities" :value="activity.id" />
<label>{{ activity.name }}</label>
</div>
So far, things work great. The checkbox group renders with the correct value(s). I am able to check the ones I want and when I save my form, I am saving an array of activity id's.
When I edit the resource, the checkboxes are not being pre-populated (checked). I am struggling to understand how to loop through each of the array elements in vuelidate's $v.model.
Let's say I have 4 activities total. Here is what the $v.resource.activities attribute looks like in my devtools toolbar (2 activities have been previously selected):
$v:Object
resource
activities:Object
$anyDirty:false
$anyError:false
$dirty:false
$error:false
$invalid:false
$model:Array[2]
0:Object
createdAt:"2023-02-04T08:55:27.009Z"
id:"d0a503f0-be2b-453c-8f6e-d5a734bbba33"
name:"Baseball"
updatedAt:"2023-02-05T23:17:00.206Z"
1:Object
createdAt:"2023-02-05T23:19:49.938Z"
id:"c251e931-2a8a-468c-aff4-b4250233cfa6"
name:"Soccer"
updatedAt:"2023-02-05T23:19:49.938Z"
I know I need to keep the initial loop like I have above to generate the list of checkboxes. I am confused as to how to also loop through each of the $model attributes to see if the checkbox should be checked or not.
Since the value of the checkboxes are only the id of the activity, I don't think it knows what to do (which is understandable). How can I loop through the list of activities and correctly populate which checkbox has been selected?

Adding Custom Product Detail Fields in BigCommerce Stencil?

We want to add custom fields that can be modified on the back end, yet also populate on the front end using custom fields. We have tried following, yet the fields didn't populate on the front end. See below for examples of the code and corresponding output:
Example Code
Result
How can we get these fields to properly populate on the front end?
I would start by reading the BigCommerce Stencil Documentation. The way you are calling the custom field values is not how they suggest calling these values.
The custom_fields are only accessible on the product detail page at this time in Stencil.
To display them on the product detail page, you can loop through each custom_field value with the following code.
{{#each product.custom_fields}}
<dt class="productView-info-name">{{name}}:</dt>
<dd class="productView-info-value">{{{value}}}</dd>
{{/each}}
You can check to see what values are available on each page by either reading the Stencil docs linked above, or debugging your page by removing the closing '/' and adding '?debug=bar' to the end of your localhost URL. Refresh your page and you will see all available store data in JSON format below the rendered page.
For more control over which custom field you output where you can create a reusable loop.
i.e. Create templates/components/products/custom-fields.html
{{#each product.custom_fields}}
{{#if name '===' ../custom_field}}
{{{value}}}
{{/if}}
{{/each}}
Then from your product_view.html you can specify the field value to output with a single line:
{{> components/products/custom-field custom_fields='custom field name'}}

Selenium IDE - Enter values in to dynamic fields

So first time posting, and I am not even sure Selenium IDE can handle what I want.
So on the web page I have 10 quantity fields (its a simple e-commerce site)
And I want to populate these 10 Quantity fields with values, however the id of these Qty fields can change.
e.g
Command Target Value
type id=qtyField_124098 1
type id=qtyField_124099 2 etc.
Is there an easy way to represent the Target by position. So I could put a value of 1 into the first Qty field, and 2 into the second Qty field.
Your best bet is to change your locator from the id to xpath. As such you could use something like //input[n] but obviously you'd change based on what is the actual xpath value for those fields.
EDIT:
With an example:
<div>
<input> </input>
<input> </input>
</div>
To reference the first <input> yourxpath` would be
//div/input[1]
the second would be
//div/input[2]
Obviously, in most cases xpath expressions will be more complicated than that but hopefully this gives you a starting point.
As this code helps me to find values dynamically and helped me, hope it will also help you
click name=cmb_text_xxx
mouseOver css=a:contains("xxx")
mouseDown css=a:contains("xxx")
click css=a:contains("xxx")

how to combine html:text and bean:write

I am using <bean:write/> tag in my struts program to catch my data into text field but I want to update/edit those data which is coming by this tag so I want to use <html:text/> tag with <bean:write/>, is it possible?
is there any other option to update <bean:write/> tag's data.
I am using this tag like -
<bean:write name="Customer" property="lastname"/>
It's not entirely clear to me what you want to update, and under what circumstances.
If you're saying to want to have the customer's last name be an editable text field, then initialize the ActionForm with the appropriate values before displaying it to the user; you don't need the <bean:write> tag at all if you're just trying to initialize/show a form field.

how to use a hidden input field to store a blog post's set of tags

I have some slightly funky UI for inputting tags for a blog post: as tags are entered into an input field they are wrapped into spans that make them look nice by surrounding them in a stylized box, the end result comes out to be something like this:
http://forr.st/posts/OLs/original
Now, this input field (call it field 1)is not part of the form that gets submitted to the controller (I'm using RoR btw) for two reasons: it contains extraneous html tags, besides the actual tags; also if it was part of the form pressing enter would submit the form instead of triggering the js that wraps the entered tag into a span.
So what I'm doing is when each tag is entered, I copy its value (via js) to a hidden input field that IS part of the tag entry form, and when submitted would contain only the tag values and nothing else. The question is: What should I use as delimiter to separate the tags in the hidden input field. Currently I'm using ';' but if a tag itself contains ; that'd cause problems.
I'm also open to suggestions about the general method of how to keep track of the tags entered into 'field 1'
Thanks a lot,
I would recommend just adding a hidden input for each tag.
<input type="hidden" name="post[tags][]" value="tag_name" />
<input type="hidden" name="post[tags][]" value="tag_name" />
<input type="hidden" name="post[tags][]" value="tag_name" />
then in rails
post.rb
def tags=(value)
tag_array = [*value]
# then just filter these out.
end
I use a similar method with the tokenInput jQuery plugin. But in my case I've placed it inside the form. I solved the problems that you mentioned by capturing the keypress event and preventing it for that input and I ignore the search input value.
The one thing that I really like about keeping it inside the form is how it is managed afterward. I place the hidden tag, name, and a remove 'x' in a span (like you mentioned) and then just remove this tag when the 'x' is clicked. I like this because the name and the hidden_tag are removed at the same time.
Just one other tip. If you can, pass the tag_id in the hidden field. This way you don't have to add the tags attribute add all: <input type="hidden" name="post[tag_ids][]" value="tag_name" />.