Skip to content

Commit

Permalink
#1669 Refactor severity and tlp components
Browse files Browse the repository at this point in the history
  • Loading branch information
nadouani committed Nov 19, 2020
1 parent 37d08cb commit 9506fe3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 24 deletions.
39 changes: 17 additions & 22 deletions frontend/app/views/directives/tlp.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
<span ng-switch="format">
<div ng-switch-when="active">
<!-- strong>TLP:</strong -->
<span class="label" ng-class="{ true:'label-info', false:'label-default' }[value == 0]" ng-click="update(0)">WHITE</span>
<span class="label" ng-class="{ true:'label-success', false:'label-default' }[value == 1]" ng-click="update(1)">GREEN</span>
<span class="label" ng-class="{ true:'label-warning', false:'label-default' }[value == 2]" ng-click="update(2)">AMBER</span>
<span class="label" ng-class="{ true:'label-danger', false:'label-default' }[value == 3]" ng-click="update(3)">RED</span>
</div>

<span ng-switch-when="static" ng-switch="value">
<span ng-switch-when="0" class="label label-info">{{namespace || 'TLP'}}:WHITE</span>
<span ng-switch-when="1" class="label label-success">{{namespace || 'TLP'}}:GREEN</span>
<span ng-switch-when="2" class="label label-warning">{{namespace || 'TLP'}}:AMBER</span>
<span ng-switch-when="3" class="label label-danger">{{namespace || 'TLP'}}:RED</span>
</span>

<span ng-switch-default ng-switch="value">
<span ng-switch-when="0" class="text-tlp-default fa fa-circle-o hpad10" uib-tooltip="{{namespace || 'TLP'}}:WHITE"></span>
<span ng-switch-when="1" class="text-tlp-green fa fa-circle hpad10" uib-tooltip="{{namespace || 'TLP'}}:GREEN"></span>
<span ng-switch-when="2" class="text-tlp-amber fa fa-circle hpad10" uib-tooltip="{{namespace || 'TLP'}}:AMBER"></span>
<span ng-switch-when="3" class="text-tlp-red fa fa-circle hpad10" uib-tooltip="{{namespace || 'TLP'}}:RED"></span>
</span>
<div ng-if="format === 'active'">
<span class="label" ng-class="{ true:'label-info', false:'label-default' }[value == 0]" ng-click="update(0)">WHITE</span>
<span class="label" ng-class="{ true:'label-success', false:'label-default' }[value == 1]" ng-click="update(1)">GREEN</span>
<span class="label" ng-class="{ true:'label-warning', false:'label-default' }[value == 2]" ng-click="update(2)">AMBER</span>
<span class="label" ng-class="{ true:'label-danger', false:'label-default' }[value == 3]" ng-click="update(3)">RED</span>
</div>
<span ng-if="format === 'static'" ng-switch="value">
<span ng-switch-when="0" class="label label-info">{{namespace || 'TLP'}}:WHITE</span>
<span ng-switch-when="1" class="label label-success">{{namespace || 'TLP'}}:GREEN</span>
<span ng-switch-when="2" class="label label-warning">{{namespace || 'TLP'}}:AMBER</span>
<span ng-switch-when="3" class="label label-danger">{{namespace || 'TLP'}}:RED</span>
</span>
<span ng-if="format !== 'active' && format !== 'static'">
<span ng-switch-when="0" class="text-tlp-default fa fa-circle-o hpad10" uib-tooltip="{{namespace || 'TLP'}}:WHITE"></span>
<span ng-switch-when="1" class="text-tlp-green fa fa-circle hpad10" uib-tooltip="{{namespace || 'TLP'}}:GREEN"></span>
<span ng-switch-when="2" class="text-tlp-amber fa fa-circle hpad10" uib-tooltip="{{namespace || 'TLP'}}:AMBER"></span>
<span ng-switch-when="3" class="text-tlp-red fa fa-circle hpad10" uib-tooltip="{{namespace || 'TLP'}}:RED"></span>
</span>
2 changes: 1 addition & 1 deletion frontend/app/views/partials/case/case.details.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ <h4 class="vpad10 text-primary">Summary</h4>
<dt class="pull-left">Severity</dt>
<dd ng-if="canEdit">
<a class="noline" href ng-click="activeSev = true" ng-init="activeSev = false">
<severity active="activeSev" on-update="updateField('severity', newValue)" style="float:left; font-size:16px" value="caze.severity"></severity>
<severity active="activeSev" on-update="updateField('severity', newValue)" value="caze.severity"></severity>
</a>
</dd>
<dd ng-if="!canEdit">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ <h4 class="vpad10 text-primary">
<dt class="pull-left">TLP</dt>
<dd ng-if="canEdit">
<a class="noline" href ng-init="activeTlp = 'static'" ng-click="activeTlp = 'active'">
<tlp value="artifact.tlp" format="activeTlp" style="font-size:16px" on-update="updateField('tlp', newValue)"></tlp>
<tlp value="artifact.tlp" format="activeTlp" on-update="updateField('tlp', newValue)"></tlp>
</a>
</dd>
<dd ng-if="!canEdit">
Expand Down

0 comments on commit 9506fe3

Please sign in to comment.