%page args="module" />
<%!
import logging
logger = logging.getLogger('splunk.appserver.mrsparkle.modules.Count')
%>
<%
domId = module['id'] + '_select'
selectOptions = []
isMatched = False
for option in module['options']:
label = option['text']
try:
value = int(option['value'])
except:
logger.error('Cannot add invalid number as option: %s' % value)
continue
if value > 0:
if value == int(module['params'].get('count', 0)):
selectOptions.append([value, label, True])
isMatched = True
else:
selectOptions.append([value, label, False])
# ensure something is selected
if not isMatched:
logger.warn('No count assigned; reverting to first value in drop down')
selectOptions[0][2] = True
%>