Skip to content

refactor: update alerts approach to newest splunk approach #1668

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 8 commits into
base: develop
Choose a base branch
from
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
{% from "helper.html" import show_help with context %}
<div class="control-group">
<label class="control-label" for="{{ mod_alert.short_name }}_{{ param.name }}">{{ param.label }} {{ '<span class="required">*</span>' if param.get("required") and param.required else '' }} </label>
<div class="controls">
{% block control %}
{% endblock %}
{{ show_help(param) }}
</div>
</div>

<splunk-control-group label="{{ param.label }}" help="{{ param.help_string }}">
{% block control %} {% endblock %}
</splunk-control-group>
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
{% from "helper.html" import expand_ctrl_props with context %}
{% from "helper.html" import show_help with context %}
<div class="control-group">
<splunk-control-group>
<div class="controls">
<label class="checkbox" for="{{ mod_alert.short_name }}_{{ param.name }}">
<input type="checkbox" name="action.{{ mod_alert.short_name }}.param.{{ param.name }}" id="{{ mod_alert.short_name }}_{{ param.name }}" {{ expand_ctrl_props(param) }} />
<input
type="checkbox"
name="action.{{ mod_alert.short_name }}.param.{{ param.name }}"
id="{{ mod_alert.short_name }}_{{ param.name }}"
{{ expand_ctrl_props(param) }}
/>
{{ param.label }}
</label>
{{ show_help(param) }}
</div>
</div>
</splunk-control-group>

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{% extends "basecontrol.html" %}
{% block control %}
<select name="action.{{ mod_alert.short_name }}.param.{{ param.name }}" id="{{ mod_alert.short_name }}_{{ param.name }}">
<splunk-select name="action.{{ mod_alert.short_name }}.param.{{ param.name }}" id="{{ mod_alert.short_name }}_{{ param.name }}">
{% for option, value in param.possible_values.items() %}
<option value="{{ value }}">{{ option }}</option>
<option value="{{ value }}">{{ option }}</option>
{% endfor %}
</select>
</splunk-select>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
{% extends "basecontrol.html" %}
{% from "helper.html" import expand_ctrl_props with context %}
{% block control %}
<splunk-search-dropdown name="action.{{ mod_alert.short_name }}.param.{{ param.name }}" id="{{ mod_alert.short_name }}_{{ param.name }}" {{ expand_ctrl_props(param) }} />
<splunk-search-dropdown
name="action.{{ mod_alert.short_name }}.param.{{ param.name }}"
id="{{ mod_alert.short_name }}_{{ param.name }}"
{{
expand_ctrl_props(param)
}}
/>
{% endblock %}
28 changes: 12 additions & 16 deletions splunk_add_on_ucc_framework/templates/html_templates/radio.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
{% from "helper.html" import expand_ctrl_props with context %}
{% from "helper.html" import show_help with context %}
<div class="control-group">
<label class="control-label">{{ param.label }}</label>
<div class="controls">
{% for option, value in param.possible_values.items() %}
<label class="radio" for="{{ mod_alert.short_name }}_{{ param.name }}_{{ value }}">
<input type="radio"
name="action.{{ mod_alert.short_name }}.param.{{ param.name }}" id="{{ mod_alert.short_name }}_{{ param.name }}_{{ value }}" value="{{ value }}"
{{ expand_ctrl_props(param) }} />
{{ option }}
</label>
{% endfor %}
{{ show_help(param) }}
</div>
</div>
{% extends "basecontrol.html" %}
{% block control %}
<splunk-radio-input
name="action.{{ mod_alert.short_name }}.param.{{ param.name }}"
id="{{ mod_alert.short_name }}_{{ param.name }}"
value="{{ param.default_value }}"
>
{% for option, value in param.possible_values.items() %}
<option value="{{option}}">{{ option }}</option>
{% endfor %}
</splunk-radio-input>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{% extends "basecontrol.html" %}
{% from "helper.html" import expand_ctrl_props with context %}
{% block control %}
<input type="text" name="action.{{ mod_alert.short_name }}.param.{{ param.name }}"
id="{{ mod_alert.short_name }}_{{ param.name }}" {{ expand_ctrl_props(param) }}/>
{% endblock %}
<splunk-text-input
name="action.{{ mod_alert.short_name }}.param.{{ param.name }}"
id="{{ mod_alert.short_name }}_{{ param.name }}"
/>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{% extends "basecontrol.html" %}
{% from "helper.html" import expand_ctrl_props with context %}
{% block control %}
<textarea name="action.{{ mod_alert.short_name }}.param.{{ param.name }}"
id="{{ mod_alert.short_name }}_{{ param.name }}" {{ expand_ctrl_props(param) }}></textarea>
<splunk-text-area
name="action.{{ mod_alert.short_name }}.param.{{ param.name }}"
id="{{ mod_alert.short_name }}_{{ param.name }}"
>
</splunk-text-area>
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,79 +1,59 @@
<form class="form-horizontal form-complex">
<div class="control-group">
<label class="control-label" for="test_alert_name">Name <span class="required">*</span> </label>
<splunk-control-group label="Name" help="Please enter your name">
<splunk-text-input
name="action.test_alert.param.name"
id="test_alert_name"
/>
</splunk-control-group>
<splunk-control-group label="Description" help="Please enter the description for the alert">
<splunk-text-area
name="action.test_alert.param.description"
id="test_alert_description"
>
</splunk-text-area>
</splunk-control-group>
<splunk-control-group>
<div class="controls">
<input type="text" name="action.test_alert.param.name"
id="test_alert_name" />
<label class="checkbox" for="test_alert_all_incidents">
<input
type="checkbox"
name="action.test_alert.param.all_incidents"
id="test_alert_all_incidents"
/>
All Incidents
</label>
<span class="help-block">
Please enter your name
</span>
</div>
</div>
<div class="control-group">
<label class="control-label" for="test_alert_description">Description <span class="required">*</span> </label>
<div class="controls">
<textarea name="action.test_alert.param.description"
id="test_alert_description" ></textarea>
<span class="help-block">
Please enter the description for the alert
</span>
</div>
</div>
<div class="control-group">
<div class="controls">
<label class="checkbox" for="test_alert_all_incidents">
<input type="checkbox" name="action.test_alert.param.all_incidents" id="test_alert_all_incidents" />
All Incidents
</label>
<span class="help-block">
Tick if you want to update all incidents/problems
</span>
</div>
</div>
<div class="control-group">
<label class="control-label" for="test_alert_table_list">Table List </label>
<div class="controls">
<select name="action.test_alert.param.table_list" id="test_alert_table_list">
<option value="incident">Incident</option>
<option value="problem">Problem</option>
</select>
<span class="help-block">
Please select the table
</span>
</div>
</div>
<div class="control-group">
<label class="control-label">Action:</label>
<div class="controls">
<label class="radio" for="test_alert_action_update">
<input type="radio"
name="action.test_alert.param.action" id="test_alert_action_update" value="update"
/>
Update
</label>
<label class="radio" for="test_alert_action_delete">
<input type="radio"
name="action.test_alert.param.action" id="test_alert_action_delete" value="delete"
/>
Delete
</label>
<span class="help-block">
Select the action you want to perform
</span>
</div>
</div>
<div class="control-group">
<label class="control-label" for="test_alert_account">Select Account <span class="required">*</span> </label>
<div class="controls">
<splunk-search-dropdown name="action.test_alert.param.account" id="test_alert_account" value-field="title"
</splunk-control-group>
<splunk-control-group label="Table List" help="Please select the table">
<splunk-select name="action.test_alert.param.table_list" id="test_alert_table_list">
<option value="incident">Incident</option>
<option value="problem">Problem</option>
<option value="example">Example</option>
</splunk-select>
</splunk-control-group>
<splunk-control-group label="Action:" help="Select the action you want to perform">
<splunk-radio-input
name="action.test_alert.param.action"
id="test_alert_action"
value="update"
>
<option value="Update">Update</option>
<option value="Delete">Delete</option>
<option value="Example">Example</option>
</splunk-radio-input>
</splunk-control-group>
<splunk-control-group label="Select Account" help="Select the account from the dropdown">
<splunk-search-dropdown
name="action.test_alert.param.account"
id="test_alert_account"
value-field="title"
label-field="title"
search="| rest /servicesNS/nobody/Splunk_TA_UCCExample/splunk_ta_uccexample_account | dedup title"
earliest="-4@h"
latest="now"
/>
<span class="help-block">
Select the account from the dropdown
</span>
</div>
</div>
/>
</splunk-control-group>
</form>
Loading