% if element.get("elementName") == "name":
<%
qs = {'action':'edit'}
if entity['eai:acl']['app']:
qs['ns'] = entity['eai:acl']['app']
for key in kwargs:
if key in ('pwnr', 'ns', 'search', 'offset', 'count', 'sort_key', 'sort_dir') or key.lower().startswith('api.'):
qs['f_'+key] = kwargs[key]
list_links = filter((lambda x: x[0] == 'list'), entity.links)
if isLite and isSavedsearches:
list_links = False
%>
<%
entityName = entity.name
if isTcpInput:
entityName = resolveTcpInputName(entityName)['port']
endif
%>
% if list_links and not isAppList and not isForwardingServer:
% if isForwardedInput:
<% qs = {'uri': '/services/' + entity_endpoint_path + '/' + cpQuoteEntity(entity.name.replace(':','%3A').replace('\\','%5C').replace('/','%2F'), urlquote=False), 'action': 'edit'} %>
% else:
<% qs['uri'] = list_links[0][1] %>
% endif
${entityName | h}
% else:
${entityName | h}
% endif
% else:
<%
# apply any transformations defined in uiHelper
value = entity.get(element['elementName'], '')
processed_value = None
if element.has_key('processValueList'):
try:
processed_value = eval(element['processValueList'])
except Exception, e:
logger.error('uiHelper processValueList operator failed for endpoint_path=%s elementName=%s: %s' % (endpoint_path, element['elementName'], str(e)))
processed_value = '[PROCESSING ERROR]'
%>
% if element.has_key('showRSSLink'):
% if value == "1":
% endif
% elif element.has_key('showAlertsLink'):
% if len(value)>0:
<%
alerts_id = None
for link in entity.links:
if link[0]=='alerts':
alerts_id = urllib.quote_plus(link[1])
break
%>
% if alerts_id:
${i18n.format_number(int(value))|h}
% else:
${i18n.format_number(int(value))|h}
% endif
% else:
${_('0')}
% endif
% elif processed_value is None:
${value | h}
% else:
% if endpoint_path.startswith('deploymentsetup/app/data/inputs') and (element.get("elementName") == 'eai:acl.app'):
${processed_value|h}
% else:
${processed_value|h}
% endif
% endif
<%
update_link = filter((lambda x: x[0] == 'update'), entity.links)
implicit_id_required = splunk.util.normalizeBoolean(entity.get('update.implicit_id_required', None))
sbAppId = ''
if 'details' in entity and ('/' in entity['details']):
sbAppId = entity['details'][entity['details'].rfind('/')+1:]
if implicit_id_required:
update_link_text = _('Overwrite with')
else:
update_link_text = _('Update to')
endif
%>
% if isAppList and (element.get('elementName') == 'version') and update_link:
|${_('%s %s' % (update_link_text, entity['update.version']))}
% endif
% endif
% endif
% endif
% endif
% endfor
%def>
% if len(entities) == 0:
<%
if endpoint_path=='authentication/users':
no_entities_msg = _('User "%s" was not found. Click the "New" button to create a new user.') % kwargs.get("search")
else:
no_entities_msg = _('There are no configurations of this type. ') + (showNewButton and _('Click the "New" button to create a new configuration.') or "")
%>
<%doc>TRANS: Displayed if no admin entities exist to list%doc>${no_entities_msg |h}
% endif
% if isLite and isAppList:
% if isRestartRequired:
<%call expr="message(_('Restart is required. Please restart Splunk Light before configuring any add-ons.'), 'warn')"/>
% endif
<%
try:
appListRemote = en.getEntities("apps/remote/entries", search=['disabled=false','visible=true'], count=-1)
except:
appListRemote = None
try:
appListLocal = en.getEntities("apps/local", count=-1)
except:
appListLocal = None
%>
% if appListRemote:
<%
remote = appListRemote.values()
uninstalled = []
installed = []
%>
% for app in remote:
% if app['appID'] in appListLocal:
<% installed.append(appListLocal[app['appID']]) %>
% else:
<% uninstalled.append(app) %>
% endif
% endfor
% if installed:
% for installedApp in installed:
<% entityDisplayName = installedApp[displayNameField] if displayNameField else installedApp.name %>
% if not splunk.util.normalizeBoolean(installedApp.get('disabled', None)):
<% checked = "checked" %>
% else:
<% checked = "" %>
% endif
% if installedApp['eai:acl']['can_write']=='1':
% for ctrl in ('disable', 'enable'):
<% ctrl_links = filter((lambda x: x[0] == ctrl), installedApp.links) %>
% if ctrl_links:
<% jscall = "doObjectAction('%s', '%s', '%s'); return false;" % ( ctrl.replace("'","\\'"), ctrl_links[0][1].replace("'","\\'"), entityDisplayName.replace("\\","\\\\").replace("'","\\'") ) %>
<% all_tags = _(' all tags for pair') if endpoint_path == 'saved/fvtags' else '' %>
% endif
% endfor
% endif
${_(installedApp['label'])}
% if 'version' in installedApp:
${_('Version')}: ${installedApp['version']}
% endif
Splunk is unable to connect to the Internet to find the apps list.
% endif
% else:
<%
visibleApps = en.getEntities("apps/local", search=['visible=true'], count=-1)
%>
% for entity in entities.values():
<%
isDeletable = False if ((endpoint_path in ['data/inputs/win-wmi-collections'] and (entity.name in ['CPUTime', 'FreeDiskSpace', 'LocalNetwork', 'Memory', 'LocalProcesses', 'LocalPhysicalDisk'])) or (endpoint_path in ['data/inputs/win-event-log-collections'] and entity.name=='localhost') ) else True
_isClonable = isClonable and (endpoint_path not in ['authentication/users', 'data/inputs/tcp/cooked'] or ('type' in entity and entity['type'] == 'Splunk'))
entityDisplayName = entity[displayNameField] if displayNameField else entity.name
%>
% if "elements" in uiHelper:
<%
headerRow = False
if countRows == 0:
headerRow = True
isModifiable = True if entity['eai:acl']['modifiable']=="1" else False
isScheduled = True if entity.get('is_scheduled')=="1" else False
%>
% if headerRow:
<%call expr="genDataCells(uiHelper['elements'], endpoint_path, headerRow)"/>
% if showPermissionsColumn:
% if isModifiable:
<% countCols += 1 %>
% if isEnablable:
<%
if not splunk.util.normalizeBoolean(entity.get('disabled',None)):
enabledState = _("Enabled")
else:
enabledState = _("Disabled")
endif
%>
${enabledState}
% if entity['eai:acl']['can_write']=='1':
% for ctrl in ('disable', 'enable'):
<% ctrl_links = filter((lambda x: x[0] == ctrl), entity.links) %>
% if ctrl_links:
<%
ctrlUrl = ctrl_links[0][1].replace("'","\\'")
ctrlEntity = entityDisplayName.replace("\\","\\\\").replace("'","\\'")
if endpoint_path.startswith('deploymentsetup/app/data/inputs/'):
ctrlUrl = '/services/%s/%s/%s?app_name=%s' % (endpoint_path, ctrlEntity.replace('/','%2F'), ctrl, entity['eai:acl']['app'])
endif
%>
<% jscall = "doObjectAction('%s', '%s', '%s'); return false;" % ( ctrl.replace("'","\\'"), ctrlUrl, ctrlEntity ) %>
|
<% all_tags = _(' all tags for pair') if endpoint_path == 'saved/fvtags' else '' %>
${_(action_names[ctrl]) + all_tags}
<% needs_sep = True %>
% endif
% endfor
% endif
% endif
% endif
% if showActionsColumn:
<% countCols += 1 %>
<% needs_sep = False %>
% if (isSavedsearches and isScheduled):
% if needs_sep:
|
<% needs_sep = False %>
% endif
${_("View recent")}
<% needs_sep = True %>
% endif
% if (isSavedsearches):
% if needs_sep:
|
<% needs_sep = False %>
% endif
<% qs = {'s':entity.getLink("alternate")} %>
${_("Run")}
<% needs_sep = True %>
% endif
% if isLDAP and ('disabled' not in entity or entity['disabled'] == '0'):
% if needs_sep:
|
<% needs_sep = False %>
% endif
<% qs = {'api.strategy':entity.name} %>
${_("Map groups")}
<% needs_sep = True %>
% endif
% if isViews and (entity['eai:acl']['app'] in visibleApps) and ('disabled' not in entity or entity['disabled'] == '0'):
% if needs_sep:
|
<% needs_sep = False %>
% endif
${_("Open")}
<% needs_sep = True %>
% endif
% if isDeploymentserverclass:
% if needs_sep:
|
<% needs_sep = False %>
% endif
<%
link_url = filter((lambda x: x[0] == "status"), entity.links)[0][1]
link_url_parts = link_url.split('/')
status_link = ""
if link_url_parts[1] == "servicesNS":
# for servicesNS, remove the app and user parts + deployment since that is where we are.
status_link = link_url_parts[5:]
else:
# for services, there are no app and user parts to remove
status_link = link_url_parts[2:]
%>
${_('Status')}
<% needs_sep = True %>
% endif
% if isAppList:
<% hasSetup = False %>
% if needs_sep:
|
<% needs_sep = False %>
% endif
% if filter((lambda x: x[0] == 'setup'), entity.links):
<% qs = {'action':'edit'} %>
<%
hasSetup = True
if entity.name == "windows":
qs["redirect_override"]="/app/windows"
endif
%>
${_("Set up")}
<% needs_sep = True %>
% endif
% if (entity['visible'] == '1') and (entity['disabled'] == '0') and not ((entity['configured'] == '0') and hasSetup):
% if needs_sep:
|
<% needs_sep = False %>
% endif
${_("Launch app")}
<% needs_sep = True %>
% endif
% if entity['disabled'] == '0':
% if needs_sep:
|
<% needs_sep = False %>
% endif
<% qs = {'action':'edit'} %>
${_("Edit properties")}
<% needs_sep = True %>
% endif
% if entity['disabled'] == '0':
% if needs_sep:
|
<% needs_sep = False %>
% endif
<% qs = {'ns':entity.name, 'app_only':'1'} %>
${_("View objects")}
<% needs_sep = True %>
% endif
% if 'details' in entity:
% if needs_sep:
|
<% needs_sep = False %>
% endif
${_("View details on SplunkApps")}
<% needs_sep = True %>
% endif
% else:
<% list_links = filter((lambda x: x[0] == 'list'), entity.links) %>
% if _isClonable and list_links and hasCreateLink:
% if needs_sep:
|
<% needs_sep = False %>
% endif
<% needs_sep = True %>
<%doc>TRANS: Clicked to clone an existing enity%doc>${_('Clone')}
% endif
% if hasCreateLink and showAppContext:
<% move_link = filter((lambda x: x[0] == 'move'), entity.links) %>
% if move_link:
% if needs_sep:
|
<% needs_sep = False %>
% endif
<% needs_sep = True %>
<%
if entity['eai:acl']['sharing']=='user':
owner = entity.owner
else:
owner = "nobody"
endif
jscall = "moveObjectToApp(%s,%s,%s); return false;" % (jsonify(move_link[0][1]), jsonify(entityDisplayName), jsonify(owner))
%>
<%doc>TRANS: Clicked to move an existing enity to a different namespace%doc>${_('Move')}
% endif
% endif
% if (isSavedsearches):
<% unembed_link = filter((lambda x: x[0] == 'unembed'), entity.links) %>
% if (unembed_link):
% if needs_sep:
|
<% needs_sep = False %>
% endif
<% jscall = "doObjectAction('unembed', %s, %s);" % ( jsonify(unembed_link[0][1]), jsonify(entityDisplayName) ) %>
${_(action_names['unembed'])}
<% needs_sep = True %>
% endif
% endif
<% ctrl_links = filter((lambda x: x[0] == 'remove'), entity.links) %>
% if isDeletable and ctrl_links:
% if needs_sep:
|
% endif
<%
ctrlUrl = ctrl_links[0][1].replace("'","\\'")
ctrlEntity = entityDisplayName.replace("\\","\\\\").replace("'","\\'")
if endpoint_path.startswith('deploymentsetup/app/data/inputs/'):
ctrlUrl = '/services/%s/%s?app_name=%s' % (endpoint_path, ctrlEntity.replace('/','%2F'), entity['eai:acl']['app'])
endif
%>
<% jscall = "doObjectAction('remove', '%s', '%s'); return false;" % ( ctrlUrl, ctrlEntity ) %>
${_(action_names['remove'])}
% endif
% endif
% endif
<% countCols = 0 %>
% endif
<% countRows += 1 %>
% endfor
% endif
%def>
<%def name="menulist(namespace, menuDict)">
<%
label = menuDict.get("label", None)
menuItems = menuDict.get("menuItems",[]) # menu items is a list of dicts.
%>
% if label:
${_(label)}
% endif
% for item in menuItems:
<%
itemLabel = item.get("label", "A label is required for this item.")
itemUrl = item.get("url", None)
itemDescription = item.get("description", None)
links = item.get("links", None)
currentUser=auth.getCurrentUser()['name']
itemId=item.get("id", "default")
%>
% if itemUrl:
${_(itemLabel)}
% else:
${_(itemLabel)}
% endif
% if links:
% for link in links:
<%
label = link.get("label", "label is required and not provided")
url = "#"
localUrl = link.get("local-url", None)
remoteUrl = link.get("remote-url", None)
if remoteUrl != None:
url = remoteUrl
target = "_blank"
## local url's win if both are defined
if localUrl != None:
url = make_url(localUrl % dict(namespace=cpQuoteEntity(namespace),currentUser=cpQuoteEntity(currentUser)))
target = "_top"
%>
|${_(label)}
% endfor
% endif
% if itemDescription:
${_(itemDescription)}
% endif
% endfor
%def>
## used by admin/EAI to hook events into widgets
<%def name="wireElementEvents(element, eltype=None)">
<%
eltype = eltype if eltype else element['type']
%>
% if element.has_key('onChange') and eltype in ('select', 'multiselect', 'hidden', 'text'):
onchange="${'Splunk.EAI.getInstance().doElementOnChange(this, %s)' % (jsonify(element['elementName']).replace('"', "'"))}"
% endif
% if element.has_key('onChange') and eltype in ('radio','checkbox','button') :
onclick="${'Splunk.EAI.getInstance().doElementOnChange(this, %s)' % (jsonify(element['elementName']).replace('"', "'"))}"
% endif
%def>
<%def name="header(namespace)">