Some improvements

This commit is contained in:
JuanCarlos 2018-12-13 15:48:03 +01:00
parent 635af9d7fa
commit 5a2e172005
6 changed files with 72 additions and 39 deletions

View File

@ -13,6 +13,7 @@ import beautifier from '../../utils/json-beautifier';
import * as FileSaver from '../../services/file-saver';
export function GroupsController(
$rootScope,
$scope,
$location,
apiReq,
@ -185,7 +186,8 @@ export function GroupsController(
// Resetting the factory configuration
$scope.$on('$destroy', () => { });
$scope.$watch('lookingGroup', value => {
$scope.$watch('lookingGroup', value => {
$rootScope.$emit('closeEditXmlFile', {});
if (!value) {
$scope.file = false;
$scope.filename = false;

View File

@ -1,12 +1,12 @@
<div layout="row" class="md-padding" ng-show="wazuh_table_loading" >
<div class='uil-ring-css'><div></div></div>
<div layout="row" class="md-padding" ng-show="wazuh_table_loading">
<div class='uil-ring-css'>
<div></div>
</div>
</div>
<div layout="row" ng-show="!error && !wazuh_table_loading && items.length">
<table class="table table-striped table-condensed" style="table-layout: fixed !important" id="wz_table">
<thead class="wz-text-bold">
<th ng-repeat="key in keys" class="wz-text-left"
ng-class="{ 'cursor-pointer' : !key.nosortable, 'col-lg-1' : !key.size, 'col-lg-{{key.size}}' : key.size }"
<th ng-repeat="key in keys" class="wz-text-left" ng-class="{ 'cursor-pointer' : !key.nosortable, 'col-lg-1' : !key.size, 'col-lg-{{key.size}}' : key.size }"
ng-click="!key.nosortable && sort(key)">
{{ keyEquivalence[key.value || key] || key.value || key }}
<i ng-if="!key.nosortable" class="fa wz-theader-sort-icon" ng-class="sortValue === (key.value || key) ? (sortDir ? 'fa-sort-asc' : 'fa-sort-desc') : 'fa-sort'"
@ -15,18 +15,20 @@
<th ng-if="path === '/agents' || path === '/agents/groups' || isLookingGroup()" class="wz-text-left col-lg-1">Actions</th>
</thead>
<tbody>
<tr ng-class="allowClick ? 'cursor-pointer' : ''" class="wz-word-wrap" ng-repeat="item in pagedItems[currentPage] | filter:{item:'!'}" ng-click="clickAction(item)">
<tr ng-class="allowClick ? 'cursor-pointer' : ''" class="wz-word-wrap" ng-repeat="item in pagedItems[currentPage] | filter:{item:'!'}"
ng-click="clickAction(item)">
<td ng-repeat="key in keys" ng-if="path !== '/decoders' && path !== '/rules'">
{{
parseValue(key,item) | limitTo: extraLimit ? 100 : 25
parseValue(key,item) | limitTo: extraLimit ? 100 : 25
}}
<span ng-if="parseValue(key,item).length > (extraLimit ? 100 : 25)">...</span>
<md-tooltip ng-if="parseValue(key,item).length > (extraLimit ? 100 : 25)" md-direction="bottom" class="wz-tooltip">
<md-tooltip ng-if="parseValue(key,item).length > (extraLimit ? 100 : 25)" md-direction="bottom"
class="wz-tooltip">
{{ parseValue(key,item) }}
</md-tooltip>
</td>
<td ng-repeat="key in keys" ng-if="path === '/rules'" ng-click="key === 'id' && searchRuleId($event,item.id)">
<span ng-if="key === 'id'" class="wz-text-link" >
<span ng-if="key === 'id'" class="wz-text-link">
{{ item.id }}
<md-tooltip ng-if="key === 'id'" md-direction="right" class="wz-tooltip">
Filter by rule ID in Discover
@ -35,46 +37,53 @@
<span ng-if="key !== 'id'">
{{
parseValue(key,item) | limitTo: extraLimit ? 100 : 25
parseValue(key,item) | limitTo: extraLimit ? 100 : 25
}}
</span>
<span ng-if="parseValue(key,item).length > (extraLimit ? 100 : 25)">...</span>
<md-tooltip ng-if="parseValue(key,item).length > (extraLimit ? 100 : 25)" md-direction="bottom" class="wz-tooltip">
<md-tooltip ng-if="parseValue(key,item).length > (extraLimit ? 100 : 25)" md-direction="bottom"
class="wz-tooltip">
{{ parseValue(key,item) }}
</md-tooltip>
</td>
<td ng-repeat="key in keys" ng-if="path === '/decoders'">
{{
parseValue(key,item) | limitTo: extraLimit ? 100 : 25
parseValue(key,item) | limitTo: extraLimit ? 100 : 25
}}
<span ng-if="parseValue(key,item).length > (extraLimit ? 100 : 25)">...</span>
<md-tooltip ng-if="parseValue(key,item).length > (extraLimit ? 100 : 25)" md-direction="bottom" class="wz-tooltip">
<md-tooltip ng-if="parseValue(key,item).length > (extraLimit ? 100 : 25)" md-direction="bottom"
class="wz-tooltip">
{{ parseValue(key,item) }}
</md-tooltip>
</td>
<td ng-if="path === '/agents'" ng-click="$event.stopPropagation()" class="cursor-default">
<i ng-click="clickAction(item, 'discover'); $event.stopPropagation()" class="fa fa-fw fa-compass cursor-pointer" tooltip="Open Discover panel for this agent" tooltip-placement="left" aria-hidden="true"></i>
<i ng-click="clickAction(item, 'configuration'); $event.stopPropagation()" class="fa fa-fw fa-wrench cursor-pointer" tooltip="Open configuration for this agent" tooltip-placement="left" aria-hidden="true"></i>
<i ng-click="clickAction(item, 'discover'); $event.stopPropagation()" class="fa fa-fw fa-compass cursor-pointer"
tooltip="Open Discover panel for this agent" tooltip-placement="left" aria-hidden="true"></i>
<i ng-click="clickAction(item, 'configuration'); $event.stopPropagation()" class="fa fa-fw fa-wrench cursor-pointer"
tooltip="Open configuration for this agent" tooltip-placement="left" aria-hidden="true"></i>
</td>
<td ng-if="path === '/agents/groups'" ng-click="$event.stopPropagation()" class="cursor-default">
<i ng-click="editGroupAgentConfig($event, item); $event.stopPropagation()" class="fa fa-fw fa-edit cursor-pointer" tooltip="Edit this group agent.conf file" tooltip-placement="left" aria-hidden="true"></i>
<i ng-click="editGroupAgentConfig($event, item); $event.stopPropagation()" class="fa fa-fw fa-edit cursor-pointer"
tooltip="Edit this group agent.conf file" tooltip-placement="left" aria-hidden="true"></i>
</td>
<td ng-if="isLookingGroup()" ng-click="$event.stopPropagation()" class="cursor-default">
<i ng-click="showConfirm($event, item); $event.stopPropagation()" class="fa fa-fw fa-remove cursor-pointer" tooltip="Remove this agent from the group" tooltip-placement="left" aria-hidden="true"></i>
<i ng-click="showConfirm($event, item); $event.stopPropagation()" class="fa fa-fw fa-remove cursor-pointer"
tooltip="Remove this agent from the group" tooltip-placement="left" aria-hidden="true"></i>
</td>
</tr>
</tbody>
<tfoot >
<td colspan="{{ path === '/agents' || isLookingGroup() ? keys.length + 1 : keys.length}}">
<span ng-show="!wazuh_table_loading" class="color-grey">{{ totalItems }} items ({{time | number: 2}} seconds)</span>
<tfoot>
<td colspan="{{ path === '/agents' || path === '/agents/groups' || isLookingGroup() ? keys.length + 1 : keys.length}}">
<span ng-show="!wazuh_table_loading" class="color-grey">{{ totalItems }} items ({{time | number: 2}}
seconds)</span>
<div ng-show="items.length >= itemsPerPage" class="pagination pull-right" style="margin:0 !important">
<ul layout="row">
<li ng-show="currentPage" class="md-padding">
<a href ng-click="prevPage()">« Prev</a>
</li>
<li ng-repeat="n in range(pagedItems.length, currentPage, currentPage + gap) " ng-class="{'wz-text-active': n == currentPage}" ng-click="setPage()"
class="md-padding">
<li ng-repeat="n in range(pagedItems.length, currentPage, currentPage + gap) " ng-class="{'wz-text-active': n == currentPage}"
ng-click="setPage()" class="md-padding">
<a href ng-bind="n + 1">1</a>
</li>
@ -91,7 +100,13 @@
<div layout="row" ng-if="!error && !wazuh_table_loading && !totalItems">
<div flex class="euiCallOut euiCallOut--warning">
<div class="euiCallOutHeader">
<svg class="euiIcon euiIcon--medium euiCallOutHeader__icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16"><defs><path id="help-a" d="M13.6 12.186l-1.357-1.358c-.025-.025-.058-.034-.084-.056.53-.794.84-1.746.84-2.773a4.977 4.977 0 0 0-.84-2.772c.026-.02.059-.03.084-.056L13.6 3.813a6.96 6.96 0 0 1 0 8.373zM8 15A6.956 6.956 0 0 1 3.814 13.6l1.358-1.358c.025-.025.034-.057.055-.084C6.02 12.688 6.974 13 8 13a4.978 4.978 0 0 0 2.773-.84c.02.026.03.058.056.083l1.357 1.358A6.956 6.956 0 0 1 8 15zm-5.601-2.813a6.963 6.963 0 0 1 0-8.373l1.359 1.358c.024.025.057.035.084.056A4.97 4.97 0 0 0 3 8c0 1.027.31 1.98.842 2.773-.027.022-.06.031-.084.056l-1.36 1.358zm5.6-.187A4 4 0 1 1 8 4a4 4 0 0 1 0 8zM8 1c1.573 0 3.019.525 4.187 1.4l-1.357 1.358c-.025.025-.035.057-.056.084A4.979 4.979 0 0 0 8 3a4.979 4.979 0 0 0-2.773.842c-.021-.027-.03-.059-.055-.084L3.814 2.4A6.957 6.957 0 0 1 8 1zm0-1a8.001 8.001 0 1 0 .003 16.002A8.001 8.001 0 0 0 8 0z"></path></defs><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#help-a" fill-rule="evenodd"></use></svg>
<svg class="euiIcon euiIcon--medium euiCallOutHeader__icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16">
<defs>
<path id="help-a" d="M13.6 12.186l-1.357-1.358c-.025-.025-.058-.034-.084-.056.53-.794.84-1.746.84-2.773a4.977 4.977 0 0 0-.84-2.772c.026-.02.059-.03.084-.056L13.6 3.813a6.96 6.96 0 0 1 0 8.373zM8 15A6.956 6.956 0 0 1 3.814 13.6l1.358-1.358c.025-.025.034-.057.055-.084C6.02 12.688 6.974 13 8 13a4.978 4.978 0 0 0 2.773-.84c.02.026.03.058.056.083l1.357 1.358A6.956 6.956 0 0 1 8 15zm-5.601-2.813a6.963 6.963 0 0 1 0-8.373l1.359 1.358c.024.025.057.035.084.056A4.97 4.97 0 0 0 3 8c0 1.027.31 1.98.842 2.773-.027.022-.06.031-.084.056l-1.36 1.358zm5.6-.187A4 4 0 1 1 8 4a4 4 0 0 1 0 8zM8 1c1.573 0 3.019.525 4.187 1.4l-1.357 1.358c-.025.025-.035.057-.056.084A4.979 4.979 0 0 0 8 3a4.979 4.979 0 0 0-2.773.842c-.021-.027-.03-.059-.055-.084L3.814 2.4A6.957 6.957 0 0 1 8 1zm0-1a8.001 8.001 0 1 0 .003 16.002A8.001 8.001 0 0 0 8 0z"></path>
</defs>
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#help-a" fill-rule="evenodd"></use>
</svg>
<span class="euiCallOutHeader__title">No results match your search criteria</span>
</div>
</div>
@ -100,7 +115,13 @@
<div layout="row" ng-if="error" class="wz-margin-bottom-45">
<div flex class="euiCallOut euiCallOut--warning">
<div class="euiCallOutHeader">
<svg class="euiIcon euiIcon--medium euiCallOutHeader__icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16"><defs><path id="help-a" d="M13.6 12.186l-1.357-1.358c-.025-.025-.058-.034-.084-.056.53-.794.84-1.746.84-2.773a4.977 4.977 0 0 0-.84-2.772c.026-.02.059-.03.084-.056L13.6 3.813a6.96 6.96 0 0 1 0 8.373zM8 15A6.956 6.956 0 0 1 3.814 13.6l1.358-1.358c.025-.025.034-.057.055-.084C6.02 12.688 6.974 13 8 13a4.978 4.978 0 0 0 2.773-.84c.02.026.03.058.056.083l1.357 1.358A6.956 6.956 0 0 1 8 15zm-5.601-2.813a6.963 6.963 0 0 1 0-8.373l1.359 1.358c.024.025.057.035.084.056A4.97 4.97 0 0 0 3 8c0 1.027.31 1.98.842 2.773-.027.022-.06.031-.084.056l-1.36 1.358zm5.6-.187A4 4 0 1 1 8 4a4 4 0 0 1 0 8zM8 1c1.573 0 3.019.525 4.187 1.4l-1.357 1.358c-.025.025-.035.057-.056.084A4.979 4.979 0 0 0 8 3a4.979 4.979 0 0 0-2.773.842c-.021-.027-.03-.059-.055-.084L3.814 2.4A6.957 6.957 0 0 1 8 1zm0-1a8.001 8.001 0 1 0 .003 16.002A8.001 8.001 0 0 0 8 0z"></path></defs><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#help-a" fill-rule="evenodd"></use></svg>
<svg class="euiIcon euiIcon--medium euiCallOutHeader__icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16">
<defs>
<path id="help-a" d="M13.6 12.186l-1.357-1.358c-.025-.025-.058-.034-.084-.056.53-.794.84-1.746.84-2.773a4.977 4.977 0 0 0-.84-2.772c.026-.02.059-.03.084-.056L13.6 3.813a6.96 6.96 0 0 1 0 8.373zM8 15A6.956 6.956 0 0 1 3.814 13.6l1.358-1.358c.025-.025.034-.057.055-.084C6.02 12.688 6.974 13 8 13a4.978 4.978 0 0 0 2.773-.84c.02.026.03.058.056.083l1.357 1.358A6.956 6.956 0 0 1 8 15zm-5.601-2.813a6.963 6.963 0 0 1 0-8.373l1.359 1.358c.024.025.057.035.084.056A4.97 4.97 0 0 0 3 8c0 1.027.31 1.98.842 2.773-.027.022-.06.031-.084.056l-1.36 1.358zm5.6-.187A4 4 0 1 1 8 4a4 4 0 0 1 0 8zM8 1c1.573 0 3.019.525 4.187 1.4l-1.357 1.358c-.025.025-.035.057-.056.084A4.979 4.979 0 0 0 8 3a4.979 4.979 0 0 0-2.773.842c-.021-.027-.03-.059-.055-.084L3.814 2.4A6.957 6.957 0 0 1 8 1zm0-1a8.001 8.001 0 1 0 .003 16.002A8.001 8.001 0 0 0 8 0z"></path>
</defs>
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#help-a" fill-rule="evenodd"></use>
</svg>
<span class="euiCallOutHeader__title">{{error}}</span>
</div>
</div>
@ -109,5 +130,4 @@
<div layout="row" ng-if="!wazuh_table_loading && !totalItems" class="wz-margin-top-10">
<span class="color-grey">0 items ({{time | number: 2}} seconds)</span>
</div>
</div>

View File

@ -1,12 +1,17 @@
<div class='wzEmbedDialog' ng-show='!lookingGroup && editingFile'>
<div class='wzEmbedDialogHeader'>
<div class='wzXmlEditor' ng-show='editingFile'>
<div class='wzXmlEditorHeader'>
<span>Edit <b>{{fileName}}</b> of <b>{{targetName}}</b></span>
<i aria-hidden='true' class='fa fa-fw fa-times cursor-pointer' ng-click='editingFile = false'></i>
</div>
<div ng-show='!loadingFile'>
<textarea id='xml_box'></textarea>
<div class='wzXmlEditorBody'>
<div class='uil-ring-css' ng-show="loadingFile">
<div></div>
</div>
<div ng-show='!loadingFile'>
<textarea id='xml_box'></textarea>
</div>
</div>
<div class='wzEmbedDialogFooter'>
<div class='wzXmlEditorFooter'>
<span ng-disabled='xmlHasErrors' ng-click='saveFile()' class='btn btn-primary'><i aria-hidden='true' class='fa fa-fw fa-save'></i>
Save file</span>
<span ng-show='xmlHasErrors' class='btn-danger'><i aria-hidden='true' class='fa fa-fw fa-exclamation-triangle'></i>

View File

@ -122,6 +122,7 @@ app.directive('wzXmlFileEditor', function () {
}
};
$rootScope.$on('editXmlFile', (item, params) => $scope.editXmlFile(item, params));
$rootScope.$on('closeEditXmlFile', () => $scope.editingFile = false);
},
template
};

View File

@ -15,7 +15,7 @@
/* -------------------------------------------------------------------------- */
.wzEmbedDialog{
.wzXmlEditor{
width: 50vw;
height: 400px;
position: fixed;
@ -27,19 +27,22 @@
right: 0;
box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.1) !important;
}
.wzEmbedDialogHeader{
.wzXmlEditorHeader{
padding: 15px;
}
.wzEmbedDialogHeader b{
.wzXmlEditorHeader b{
font-weight: 600;
}
.wzEmbedDialogHeader i{
.wzXmlEditorHeader i{
float: right;
}
.wzEmbedDialogFooter{
.wzXmlEditorBody{
height: 300px;
}
.wzXmlEditorFooter{
padding: 10px;
border-top: 1px solid #dddddd;
}

View File

@ -90,8 +90,10 @@
<!-- End CSV Download button section for groups -->
<!-- XML editor for group agents -->
<wz-xml-file-editor file-name='agents.conf' load-path='hola' update-path='adios'>
</wz-xml-file-editor>
<div ng-if="!lookingGroup">
<wz-xml-file-editor file-name='agents.conf' load-path='load' update-path='update'>
</wz-xml-file-editor>
</div>
<!-- XML editor for group agents -->
<!-- Group agents table -->