Skip to content

Commit

Permalink
#145 Update skin of metrics, settings and datatypes admin page
Browse files Browse the repository at this point in the history
  • Loading branch information
nadouani committed Mar 17, 2017
1 parent 8d7a1f6 commit a7a06d6
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 109 deletions.
29 changes: 12 additions & 17 deletions ui/app/scripts/controllers/admin/AdminObservablesCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
function($scope, ListSrv, AlertSrv) {
$scope.dataTypeList = [];
$scope.params = {
'newDataTypes': []
newDataType: null
};

$scope.load = function() {
Expand All @@ -28,23 +28,18 @@
$scope.load();

$scope.addArtifactDataTypeList = function() {
var datatypes = _.without(_.map($scope.params.newDataTypes, function(dt) {
return dt.trim();
}), '', null, undefined);
ListSrv.save({
'listId': 'list_artifactDataType'
}, {
'value': $scope.params.newDataType
}, function() {
$scope.load();
},
function(response) {
AlertSrv.error('ListSrv', response.data, response.status);
});

angular.forEach(datatypes, function(dt) {
ListSrv.save({
'listId': 'list_artifactDataType'
}, {
'value': dt
}, function() {
$scope.load();
},
function(response) {
AlertSrv.error('ListSrv', response.data, response.status);
});
});
$scope.params.newDataTypes = '';
$scope.params.newDataType = '';
};

$scope.deleteArtifactDataType = function(datatype) {
Expand Down
108 changes: 57 additions & 51 deletions ui/app/views/partials/admin/metrics.html
Original file line number Diff line number Diff line change
@@ -1,55 +1,61 @@
<h2 class="vpad10">Case metrics management</h2>
<div class="vpad10"></div>
<div class="row">
<div class="col-md-12">
<form ng-submit="addMetric()">
<div class="row">
<div class="form-group col-md-3">
<label>Name</label>
<input class="form-control" ng-model="metric.name" placeholder="The name of the metric" required type="text">
</div>
<div class="form-group col-md-3">
<label>Title</label>
<input class="form-control" ng-model="metric.title" placeholder="The label that will be used in the case form" required type="text">
<div class="box">
<div class="box-header">
<h3 class="box-title">Case metrics management</h3>
</div>
<div class="box-body">
<div class="row">
<div class="col-md-12">
<form name="metricForm" ng-submit="addMetric()">
<div class="row">
<div class="form-group col-md-3">
<label>Name</label>
<input class="form-control" ng-model="metric.name" placeholder="The name of the metric" required type="text">
</div>
<div class="form-group col-md-3">
<label>Title</label>
<input class="form-control" ng-model="metric.title" placeholder="The label that will be used in the case form" required type="text">

</div>
<div class="form-group col-md-5">
<label>Description</label>
<input class="form-control" ng-model="metric.description" placeholder="A brief description of the metric" required type="text">
</div>
<div class="form-group col-md-1">
<label>&nbsp;</label><br>
<button class="btn btn-primary" type="submit">Add metric</button>
</div>
</div>
<div class="form-group col-md-5">
<label>Description</label>
<input class="form-control" ng-model="metric.description" placeholder="A brief description of the metric" required type="text">
</div>
<div class="form-group col-md-1">
<label>&nbsp;</label><br>
<button class="btn btn-primary" type="submit" ng-disabled="metricForm.$invalid">Add metric</button>
</div>
</div>
</form>
</div>
</div>
<hr>
<div class="vpad10"></div>
<div class="row">
<div class="col-md-12" ng-if="metrics.length === 0">
<div class="empty-message">There are no metrics defined yet</div>
</div>
<div class="col-md-12" ng-if="metrics.length !== 0">
<table class="table table-striped">
<thead>
<tr>
<th class="col-md-3">Name</th>
<th class="col-md-3">Title</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="metric in metrics">
<td>{{metric.name}}</td>
<td>{{metric.title}}</td>
<td>{{metric.description}}</td>
</tr>
</tbody>
</table>
</div>
</form>
</div>
</div>
<hr>
<div class="vpad10"></div>
<div class="row">
<div class="col-md-12" ng-if="metrics.length === 0">
<div>There are not metrics defined yet</div>
</div>
<div class="col-md-12" ng-if="metrics.length !== 0">
<table class="table table-hover">
<thead>
<tr>
<th class="col-md-3">Name</th>
<th class="col-md-3">Title</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="metric in metrics">
<td>{{metric.name}}</td>
<td>{{metric.title}}</td>
<td>{{metric.description}}</td>
</tr>
</tbody>
</table>
</div>

</div>
</div>

<div class="vpad10"></div>

<div class="vpad10"></div>
</div>
</div>
67 changes: 35 additions & 32 deletions ui/app/views/partials/admin/observables.html
Original file line number Diff line number Diff line change
@@ -1,35 +1,38 @@
<h2 class="vpad10">Observables management</h2>
<div class="vpad10"></div>
<h4>DataTypes</h4>
<hr>
<div class="row">
<div class="col-md-6">
<!-- placeholder="newDataTypes" -->
<textarea class="form-control" ng-list="&#10;" ng-model="params.newDataTypes" ng-trim="false" style="resize: vertical"></textarea>
<br>
<span class="pull-right">
<button class="btn btn-primary" ng-click="addArtifactDataTypeList()" ng-disabled="newDataTypes.length === 0">
<i class=" glyphicon glyphicon-plus"></i>
<b>Add dataTypes</b>
</button>
</span>
<div class="box">
<div class="box-header">
<h3 class="box-title">Observable datatypes management</h3>
</div>
<div class="col-md-6">
<table class="table table-hover">
<thead>
<th>dataType</th>
<th class="col-md-1" style="text-align:center">Action</th>
</thead>
<tbody ng-init="textDel = muted" ng-repeat="datatype in dataTypeList">
<tr>
<td>{{datatype.value}}</td>
<td ng-mouseout="textDel = 'text-muted'" ng-mouseover="textDel = 'text-danger'" style="text-align:center">
<a href ng-click="deleteArtifactDataType(datatype)">
<i class="text-muted glyphicon glyphicon-trash" ng-class="textDel"></i>
</a>
</td>
</tr>
</tbody>
</table>
<div class="box-body">
<div class="row">
<div class="col-md-6">
<form class="mv-s" name="dtForm" ng-submit="addArtifactDataTypeList()">
<div class="input-group input-group-sm">
<input class="form-control" ng-model="params.newDataType" placeholder="Specify the datatype to add. Ex: domain, ip, email" required>
<span class="input-group-btn">
<button type="submit" class="btn btn-primary btn-flat" ng-disabled="dtForm.$invalid">Add dataType</button>
</span>
</div>
</form>

<table class="table table-striped">
<thead>
<tr>
<th>dataType</th>
<th width="80">Action</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="datatype in dataTypeList">
<td>{{datatype.value}}</td>
<td>
<a href ng-click="deleteArtifactDataType(datatype)">
<i class="text-danger glyphicon glyphicon-trash"></i>
</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
18 changes: 9 additions & 9 deletions ui/app/views/partials/personal-settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ <h3>

<!-- Update basic user information -->
<form name="basicForm" class="form-horizontal" ng-submit="updateBasicInfo(basicForm)" novalidate>
<div class="panel panel-default">
<div class="panel-heading">
<h4>Update basic information</h4>
<div class="box">
<div class="box-header">
<h3 class="box-title">Update basic information</h3>
</div>
<div class="panel-body">
<div class="box-body">

<div class="form-group">
<label class="col-md-3 control-label">Username</label>
Expand Down Expand Up @@ -72,12 +72,12 @@ <h4>Update basic information</h4>

<!-- Update user password -->
<form ng-if="canChangePass" class="form-horizontal mt-s" name="passForm" ng-submit="updatePassword(passForm);" novalidate>
<div class="panel panel-default">
<div class="panel-heading">
<h4><input type="checkbox" ng-model="passData.changePassword" ng-click="clearPassword(passForm, passData.changePassword)">
Update password</h4>
<div class="box">
<div class="box-header">
<h3 class="box-title"><input type="checkbox" ng-model="passData.changePassword" ng-click="clearPassword(passForm, passData.changePassword)">
Update password</h3>
</div>
<div class="panel-body" ng-show="passData.changePassword">
<div class="box-body" ng-show="passData.changePassword">
<div class="form-group" ng-class="{ 'has-error' : !passForm.currentPassword.$pristine && passForm.currentPassword.$invalid}">
<label class="col-md-3 control-label">Old password
<i class="fa fa-asterisk text-danger"></i>
Expand Down

0 comments on commit a7a06d6

Please sign in to comment.