Skip to content

Commit

Permalink
#12 Update wording in case details pane and add boolean updatable input
Browse files Browse the repository at this point in the history
  • Loading branch information
nadouani committed Jun 23, 2017
1 parent 4465dde commit e42c3e9
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 9 deletions.
1 change: 1 addition & 0 deletions ui/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@
<script src="scripts/directives/task-progress.js"></script>
<script src="scripts/directives/tlp.js"></script>
<script src="scripts/directives/updatable.js"></script>
<script src="scripts/directives/updatableBoolean.js"></script>
<script src="scripts/directives/updatableDataDropdown.js"></script>
<script src="scripts/directives/updatableDate.js"></script>
<script src="scripts/directives/updatableSimpleText.js"></script>
Expand Down
20 changes: 20 additions & 0 deletions ui/app/scripts/directives/updatableBoolean.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
(function() {
'use strict';
angular.module('theHiveDirectives')
.directive('updatableBoolean', function(UtilsSrv) {
return {
'restrict': 'E',
'link': UtilsSrv.updatableLink,
'templateUrl': 'views/directives/updatable-boolean.html',
'scope': {
'inputType': '@',
'value': '=?',
'onUpdate': '&',
'active': '=?',
'placeholder': '@',
'trueText': '@?',
'falseText': '@?'
}
};
});
})();
2 changes: 1 addition & 1 deletion ui/app/scripts/services/CaseTabsSrv.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
'details': {
name: 'details',
active: true,
label: 'Summary',
label: 'Details',
state: 'app.case.details'
},
'tasks': {
Expand Down
25 changes: 25 additions & 0 deletions ui/app/views/directives/updatable-boolean.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<span ng-hide="updatable.updating" ng-init="active = false" ng-mouseenter="active = true" ng-mouseleave="active = false">
<span ng-if="value!==null && value !==''" style="vertical-align: top; white-space: pre-wrap" class="updatable-value">{{value ? trueText || 'True' : falseText || 'False'}}</span>
<span ng-if="value === null || value === undefined" style="vertical-align: top;" class="updatable-value text-warning"><em>Not Specified</em></span>
<small ng-show="active">
<a href class="clickable" tooltip-popup-delay='500' uib-tooltip="edit">
<i class="glyphicon glyphicon-pencil" ng-click="edit()"></i>
</a>
</small>
<span ng-hide="active">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
</span>
<span ng-show="updatable.updating" ng-init="updatable.dropdownOpen=false">
<form ng-submit="update()">
<div class="input-group input-group-sm">
<select class="form-control input-sm" ng-model="value" ng-options="v for v in [true, false]" ng-change="update()"></select>
<span class="input-group-btn">
<button class="btn btn-sm btn-default" type="submit">
<i class="text-success glyphicon glyphicon-ok"></i>
</button>
<button class="btn btn-sm btn-default" type="button" ng-click="cancel()">
<i class="text-danger glyphicon glyphicon-remove"></i>
</button>
</span>
</div>
</form>
</span>
3 changes: 3 additions & 0 deletions ui/app/views/directives/updatable-simple-text.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
<div class="input-group input-group-sm">
<input type="{{inputType || 'text'}}" class="form-control input-sm" placeholder="{{placeholder}}" ng-model="value" autofocus="autofocus">
<span class="input-group-btn">
<button class="btn btn-sm btn-default" type="submit">
<i class="text-success glyphicon glyphicon-ok"></i>
</button>
<button class="btn btn-sm btn-default" type="button" ng-click="cancel()">
<i class="text-danger glyphicon glyphicon-remove"></i>
</button>
Expand Down
2 changes: 1 addition & 1 deletion ui/app/views/partials/case/case.details.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="row">
<div class="col-md-7">
<h4 class="vpad10 text-primary">Basic information</h4>
<h4 class="vpad10 text-primary">Summary</h4>
<dl class="dl-horizontal clear">
<dt class="pull-left">Severity</dt>
<dd>
Expand Down
13 changes: 9 additions & 4 deletions ui/app/views/partials/case/details/custom.fields.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<div class="case-custom-fields" ng-controller="CaseCustomFieldsCtrl">
<h4 class="vpad10 text-primary">
Custom fields
Additional information
<span uib-dropdown class="pull-right" ng-show="customFieldsAvailable">
<a href class="dropdown-toggle" uib-dropdown-toggle>
<i class="fa fa-plus"></i>
Add Custom field
<span class="caret"></span>
</a>
<ul class="dropdown-menu" uib-dropdown-menu>
<li ng-repeat="(key, value) in allCustomFields">
Expand All @@ -16,7 +14,7 @@ <h4 class="vpad10 text-primary">
</h4>

<div ng-if="!orderedFields || orderedFields.length === 0">
<em>No custom fields need to be set</em>
<em>No aditional information have been specified</em>
</div>

<dl class="dl-horizontal clear"
Expand All @@ -38,6 +36,13 @@ <h4 class="vpad10 text-primary">
on-update="updateField(getCustomFieldName(fieldDef), newValue)"
value="customFieldValue"></updatable-simple-text>

<updatable-boolean ng-switch-when="boolean"
input-type="number"
on-update="updateField(getCustomFieldName(fieldDef), newValue)"
value="customFieldValue"></updatable-boolean>



<span ng-switch-default>Not Editable</span>
</dd>
</dl>
Expand Down
4 changes: 1 addition & 3 deletions ui/app/views/partials/case/details/metrics.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ <h4 class="vpad10 text-primary">
<span uib-dropdown class="pull-right" ng-show="metricsAvailable">
<a href class="dropdown-toggle" uib-dropdown-toggle>
<i class="fa fa-plus"></i>
Add metric
<span class="caret"></span>
</a>
<ul class="dropdown-menu" uib-dropdown-menu>
<li ng-repeat="(key, value) in allMetrics">
Expand All @@ -16,7 +14,7 @@ <h4 class="vpad10 text-primary">
</h4>

<div ng-if="hasNoMetrics(caze)">
<em>No metrics need to be set</em>
<em>No metrics have been set</em>
</div>

<dl class="dl-horizontal clear" ng-repeat="(k,v) in caze.metrics">
Expand Down

0 comments on commit e42c3e9

Please sign in to comment.