Skip to content

Commit

Permalink
[ui] Difference between 'owtf found nothing' and 'user says it is pas…
Browse files Browse the repository at this point in the history
…sing'.
  • Loading branch information
DePierre committed Mar 16, 2015
1 parent b369a45 commit 33f3c85
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 21 deletions.
17 changes: 4 additions & 13 deletions framework/db/poutput_manager.py
Expand Up @@ -178,19 +178,11 @@ def DeleteAll(self, filter_data, target_id=None):
self.db.session.commit()

@target_required
def Update(
self,
plugin_group,
plugin_type,
plugin_code,
patch_data,
target_id=None):
query = self.GenerateQueryUsingSession(
{
def Update(self, plugin_group, plugin_type, plugin_code, patch_data, target_id=None):
query = self.GenerateQueryUsingSession({
"plugin_group": plugin_group,
"plugin_type": plugin_type,
"plugin_code": plugin_code,
},
"plugin_code": plugin_code,},
target_id)
obj = query.first()
if obj:
Expand All @@ -206,8 +198,7 @@ def Update(
self.db.session.merge(obj)
self.db.session.commit()
except ValueError:
raise InvalidParameterType(
"Integer has to be provided for integer fields")
raise InvalidParameterType("Integer has to be provided for integer fields")

def PluginAlreadyRun(self, PluginInfo, target_id=None):
plugin_output_count = self.db.session.query(models.PluginOutput).filter_by(
Expand Down
19 changes: 12 additions & 7 deletions framework/interface/templates/plugin_report.html
Expand Up @@ -41,7 +41,7 @@ <h4 id="header_badge_{{ test_code }}"></h4>
{# TODO: Clean buttons code. #}
{% set user_rank = poutput['user_rank'] %}
{% if user_rank in [0, 1, 2, 3, 4, 5] %}
<label id="{{ pkey }}_0" class="btn {% if user_rank == 0 %}active{% end %}" title="No ranking"><input type="radio" id="0" onchange="updatePluginInfoAndPatch('{{ pkey }}', '{{ poutput["plugin_group"] }}','{{ poutput["plugin_type"] }}','{{ test_code }}', '0');"/><i class="fa fa-thumbs-up"></i></label>
<label id="{{ pkey }}_0" class="btn {% if user_rank == 0 %}active{% end %}" title="Passing"><input type="radio" id="0" onchange="updatePluginInfoAndPatch('{{ pkey }}', '{{ poutput["plugin_group"] }}','{{ poutput["plugin_type"] }}','{{ test_code }}', '0');"/><i class="fa fa-thumbs-up"></i></label>
<label id="{{ pkey }}_1" class="btn {% if user_rank == 1 %}active btn-success{% end %}" title="Informational"><input type="radio" id="1" onchange="updatePluginInfoAndPatch('{{ pkey }}', '{{ poutput["plugin_group"] }}','{{ poutput["plugin_type"] }}','{{ test_code }}', '1');"/><i class="fa fa-info-circle"></i></label>
<label id="{{ pkey }}_2" class="btn {% if user_rank == 2 %}active btn-info{% end %}" title="Low"><input type="radio" id="2" onchange="updatePluginInfoAndPatch('{{ pkey }}', '{{ poutput["plugin_group"] }}','{{ poutput["plugin_type"] }}','{{ test_code }}', '2');"/><i class="fa fa-exclamation-circle"></i></label>
<label id="{{ pkey }}_3" class="btn {% if user_rank == 3 %}active btn-warning{% end %}" title="Medium"><input type="radio" id="3" onchange="updatePluginInfoAndPatch('{{ pkey }}', '{{ poutput["plugin_group"] }}','{{ poutput["plugin_type"] }}','{{ test_code }}', '3');"/><i class="fa fa-warning"></i></label>
Expand Down Expand Up @@ -150,12 +150,12 @@ <h4 id="header_badge_{{ test_code }}"></h4>
copyPOutputs['{{ test_code }}'] = {};
{% for poutput in poutput_list %}
copyPOutputs['{{ test_code }}']["{{ poutput['plugin_type'] }}"] = {
{% if poutput['owtf_rank'] %}
{% if poutput['owtf_rank'] >= 0 %}
"owtf_rank": {{ poutput['owtf_rank'] }},
{% else %}
"owtf_rank": null,
{% end %}
{% if poutput['user_rank'] %}
{% if poutput['user_rank'] >= 0 %}
"user_rank": {{ poutput['user_rank'] }},
{% else %}
"user_rank": null,
Expand Down Expand Up @@ -229,20 +229,23 @@ <h4 id="header_badge_{{ test_code }}"></h4>
}

function resetPluginColors(id) {
$("#" + id + "_0").removeClass("btn-passing");
$("#" + id + "_1").removeClass("btn-success");
$("#" + id + "_2").removeClass("btn-info");
$("#" + id + "_3").removeClass("btn-warning");
$("#" + id + "_4").removeClass("btn-danger");
$("#" + id + "_5").removeClass("btn-critical");
$("#tab_" + id).removeClass("alert-success alert-info alert-warning alert-danger alert-critical");
$("#tab_" + id).removeClass("alert-passing alert-success alert-info alert-warning alert-danger alert-critical");
};

function resetTestCaseColors(id) {
$("#header_" + id).removeClass("panel-success panel-info panel-warning panel-danger panel-critical");
$("#header_" + id).removeClass("panel-passing panel-success panel-info panel-warning panel-danger panel-critical");
}

function getAlertColor(level) {
if (level == 1)
if (level == 0)
return "passing";
else if (level == 1)
return "success";
else if (level == 2)
return "info";
Expand All @@ -256,7 +259,9 @@ <h4 id="header_badge_{{ test_code }}"></h4>
}

function getLabelColor(level) {
if (level == 1)
if (level == 0)
return "<label class='alert alert-passing' style='margin-bottom: 0px'>Passing</label>";
else if (level == 1)
return "<label class='alert alert-success' style='margin-bottom: 0px'>Info</label>";
else if (level == 2)
return "<label class='alert alert-info' style='margin-bottom: 0px'>Low</label>";
Expand Down
4 changes: 3 additions & 1 deletion framework/interface/templates/target_manager.html
Expand Up @@ -226,7 +226,9 @@ <h3>Add Targets</h3>

// get label color for target rating
function getLabel(level) {
if (level == 1)
if (level == 0)
return "<span class='label label-passing' style='text'>Passing</span>";
else if (level == 1)
return "<span class='label label-success' style='text'>Info</span>";
else if (level == 2)
return "<span class='label label-info' style='margin-bottom: 0px'>Low</span>";
Expand Down
7 changes: 7 additions & 0 deletions includes/css/stylesheet.css
Expand Up @@ -53,3 +53,10 @@ body {
color: #fff;
box-shadow: 0 3px 5px rgba(0, 0, 0, 0.125) inset;
}

.panel-passing > .panel-heading, .alert-passing, .label-passing {
background-image: linear-gradient(to bottom, #76746D 0px, #67655D 100%);
background-repeat: repeat-x;
border-color: #5E5D57;
color: #fff;
}

0 comments on commit 33f3c85

Please sign in to comment.