Dashboards & Visualizations

Suppress unwanted 'Duplicate values causing conflict' for Dropdown

pclewis
Explorer

I don't know how to disable this message for my dashboard properly. 
I have added to a css style block within my dashboard 

 

 

  .splunk-choice-input-message { visibility: hidden }

 

 


This suppresses all of the text beneath all of the inputs in the dashboard which is fine as it's better than causing concern with the "Duplicate values causing conflict" message.

So if anyone knows a way to manipulate the CSS to only suppress that message I'd be grateful.

 I don't have to allow duplicates in the dropdown and that in general it's probably a good hint but sometimes it just makes sense or so I think to ignore such warnings.

I [mis]use the dropdown to also show a relative timeline of events in the order they appear in a an splunk event (which is comprised of many lines of text).  The user can drill down to the specific log line within a splunk event that they they want to examine in detail. 

I also realise that I could solve this with condition on change and split the $value$ selected so that I get the id part without breaking the built in idea of duplicates being bad..  I don't know that I should have to do extra calculations just to achieve the simple idea.  Data below is my justification and it works really well for the use case which actually has hundreds of lines in the combo box.  

 

 

| makeresults
| eval events="1147,Event A [1]
1066,Event B [2..3]
1147,Event A [4]
1156,Event C [5..8]
1147,Event A [9]
1073,Event D [10..14]
1050,Event E [15..20]
1073,Event D [21..40]
1156,Event C [41..44]
1050,Event E [45..46]
1147,Event A [47]
1090,Event F [48]
1678,Event G [49]
1090,Event F [50]
1180,Event H [51]
1127,Event I [52]
1097,Event J [53]
1127,Event I [54..55]
1180,Event H [56]
1068,Event K [57..60]
1138,Event L [61..63]
1122,Event M [64]"
| rex max_match=0 field=events "(?<event>.*)\n"
| table id event
| mvexpand event
| rex max_match=0 field=event "(?<id>.*),(?<event>.*)"

 

 

 

It's true that the label in this case will be unique and the id will be duplicated.  Yet it's the label that holds the human readable useful data and the id just refers to a lookup key to present.

Labels (1)
0 Karma

pclewis
Explorer

@kamlesh_vaghela 
Thanks for the reply and this is what I am already doing.
To restate the issue, which is very minor, it just annoyed me - I do want to suppress one of the many messages that appear in that 

.splunk-choice-input-message

 Currently I suppress them all with the CSS.  It is the least annoying option.

I didn't think there would be CSS option that would allow me to suppress that div if it contained specific text.  I still don't think that is possible (with css alone) so I wanted to whine in there and try my luck asking people that undoubtedly have more CSS horsepower.

@bowesmana 
Yes I have used that approach initially and I became annoyed at the waste of processing and extra lines of xml needed just to suppress an unwanted "warning".  As the author of the dashboard I considered it my divine right to decide what is an is not acceptable.  Thankfully the devs didn't make the dropdown fail to work - just a distracting message lingers.

kamlesh_vaghela
SplunkTrust
SplunkTrust

@pclewis 

To make the css specific to input add id to the input and use it to specify css.  

Screenshot 2021-09-27 at 8.48.38 AM.png

Please check sample code in my previous comment and let me know if any issue.

0 Karma

bowesmana
SplunkTrust
SplunkTrust

Another option that may or may not be useful, is to make the id a combination of the id and event and then in the search that uses the token, split the id back out again so it's used in the search.

This could be done two ways, either as a rex statement in the search where the ID is used, or as a hidden search which uses the selected token which generates a new token just containing the id you really want, so it can be used directly in the search.

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@pclewis 

Can you please try this?

Add id in dropdown input and add below css.

<input type="dropdown" token="field1" id="field1_id">

 

#field1_id .splunk-choice-input-message {
          visibility: hidden;
          }

 

Thanks
KV
▄︻̷̿┻̿═━一   😉

If any of my reply helps you to solve the problem Or gain knowledge, an upvote would be appreciated.

0 Karma

pclewis
Explorer

@kamlesh_vaghela I think my way of explaining is not sufficient.  
To try again as I can see you really want to figure this out, here is a sample of some messages that appear beneath a dropdown at various times during data refresh.  No doubt there are more but I grabbed these in the startup of my form so it was quick and easy.

 

"Could not create search"

"Populating..."

"Search produced no results"

And the one I disagree with and wish to suppress on this one dropdown in order to prevent users logging this as a problem...

"Duplicate values causing conflict"

 

Ideally I don't want to suppress all of those other messages.  However I currently do suppress them all rather than the sensible approach munging a unique key then unmanaging it after user selection.  It's not a huge burden to do that but I remember thinking at the time "I bet there is a CSS way to do it".  Then, an hour later I said to myself "I bet I need help to do this"...

Many thanks

Paul

 

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@pclewis 

May be this js will help you. Just remove css previously I suggested. 

require([
    'underscore',
    'jquery',
    'splunkjs/mvc/simplexml/ready!'
], function(_, $) {
    $(document).ready(function() {
        $('#field1_id .splunk-choice-input-message').bind('DOMSubtreeModified', function() {
            if ($('#field1_id .splunk-choice-input-message').text() === 'Duplicate values causing conflict') {
                $("#field1_id .splunk-choice-input-message").css("visibility", "hidden");
            } else {
                $("#field1_id .splunk-choice-input-message").css("visibility", "");
            }
        });
    });
});

 

0 Karma

pclewis
Explorer

Hi @kamlesh_vaghela 
Can we agree that there's probably no fancy CSS way?  This is all I was trying to determine.  It's the sort of thing that I thought might exist and might have eluded my google searches.

Your latest suggestion looks like javascript and looks like it would work however this is a change at server end I would think and I'm not going to ask our splunk admins for this as they seem busy enough as it is.  I appreciate the efforts, can you make a new reply that says "no it's not possible with CSS" which I can mark as accepted 🙂

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@pclewis 

As your requirement, it is not possible with CSS. we need to do some condition and put logic to achieve the requirement.

 

Thanks
KV
▄︻̷̿┻̿═━一   😉

If any of my reply helps you to solve the problem Or gain knowledge, an upvote would be appreciated.

0 Karma
*NEW* Splunk Love Promo!
Snag a $25 Visa Gift Card for Giving Your Review!

It's another Splunk Love Special! For a limited time, you can review one of our select Splunk products through Gartner Peer Insights and receive a $25 Visa gift card!

Review:





Or Learn More in Our Blog >>