Skip to content

Commit

Permalink
Fix show tootlip in truncated fields (#1605)
Browse files Browse the repository at this point in the history
  • Loading branch information
juankaromo authored and Jesús Ángel committed Jul 15, 2019
1 parent 2b2f3c0 commit 9b84916
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 27 deletions.
10 changes: 5 additions & 5 deletions public/directives/wz-table/wz-table-directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { checkGap } from './lib/check-gap';

const app = uiModules.get('app/wazuh', []);

app.directive('wzTable', function() {
app.directive('wzTable', function () {
return {
restrict: 'E',
scope: {
Expand Down Expand Up @@ -300,11 +300,11 @@ app.directive('wzTable', function() {
$scope.prevPage = () => pagination.prevPage($scope);
$scope.nextPage = async (currentPage, last = false) =>
pagination.nextPage(currentPage, $scope, errorHandler, fetch, last);
$scope.firstPage = function() {
$scope.firstPage = function () {
$scope.setPage(1);
$scope.prevPage();
};
$scope.setPage = function(page = false, logs = false, last = false) {
$scope.setPage = function (page = false, logs = false, last = false) {
this.n = page || this.n;
$scope.currentPage = this.n;
$scope.nextPage(this.n, last).then(() => {
Expand Down Expand Up @@ -487,8 +487,8 @@ app.directive('wzTable', function() {
}
};

$scope.showTooltip = (id1, id2, item) => {
const $element = $('#td-' + id1 + '-' + id2 + ' div');
$scope.showTooltip = (id1, id2, item, path) => {
const $element = $(`#${path}-td-` + id1 + '-' + id2 + ' div');
const $c = $element
.clone()
.css({ display: 'inline', width: 'auto', visibility: 'hidden' })
Expand Down
41 changes: 19 additions & 22 deletions public/directives/wz-table/wz-table.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<tbody>
<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" id="td-{{$parent.$index}}-{{$index}}" ng-mouseover="showTooltip($parent.$index, $index, item)">
<td ng-repeat="key in keys" id="{{scapepath}}-td-{{$parent.$index}}-{{$index}}" ng-mouseover="showTooltip($parent.$index, $index, item, scapepath)">
<div class="wz-text-truncatable-container">
<span class="wz-text-truncatable">
{{
Expand Down Expand Up @@ -188,15 +188,15 @@
<tbody>
<tr class="wz-word-wrap cursor-pointer" ng-repeat-start="item in pagedItems[currentPage] | filter:{item:'!'}"
ng-click="expandTableRow(item)" ng-class="{'selected': item.expanded}">
<td ng-repeat="key in keys" id="td-{{$parent.$index}}-{{$index}}" ng-mouseover="showTooltip($parent.$index, $index, item)">
<td ng-repeat="key in keys" id="{{scapepath}}-td-{{$parent.$index}}-{{$index}}" ng-mouseover="showTooltip($parent.$index, $index, item, scapepath)">
<div ng-class="customColumns ? 'wz-text-truncatable-container' : ''">
<span class="wz-text-truncatable">
<span ng-show="(key.value || key ) === 'result'" class="no-wrap">
<p class="round status little" ng-class="item.result ? (item.result === 'passed' ? 'teal' : 'red') : 'gray'">
</p>&nbsp;&nbsp;
</span>
{{
key.value === 'result' && !item.result ? item.status : parseValue(key,item)
key.value === 'result' && !item.result ? item.status : parseValue(key,item)
}}
</span>
<md-tooltip ng-show="item.showTooltip[$index]" md-direction="bottom" class="wz-tooltip">
Expand All @@ -206,22 +206,22 @@
</td>
</tr>
<tr ng-show="(item.rationale || item.remediation || item.directory || (item.rules && item.rules.length) || (item.compliance && item.compliance.length)) && item.expanded"
class="wz-word-wrap cursor-pointer selected" ng-repeat-end=""
ng-click="expandTableRow(item)">
class="wz-word-wrap cursor-pointer selected" ng-repeat-end="" ng-click="expandTableRow(item)">
<td colspan="{{keys.length}}" style="border-top: none">
<div layout="row" layout-padding="" class="layout-padding layout-row">
<md-card flex="" class="wz-md-card wz-padding-top-0 wz-padding-bottom-0 wz-no-margin _md flex">
<md-card-content ng-click="$event.stopPropagation()">
<div>
<div class="euiFlexItem euiFlexItem--flexGrowZero" ng-if="item.reason">
<div class="euiStat euiStat--leftAligned">
<p class="euiTitle euiTitle--small euiStat__title ng-binding" style="font-size: 1.15rem;">Check not applicable due to:</p>
<div class="euiText euiText--small euiStat__description wz-text-gray">
<p>{{item.reason}}</p>
</div>
<div class="euiStat euiStat--leftAligned">
<p class="euiTitle euiTitle--small euiStat__title ng-binding" style="font-size: 1.15rem;">Check
not applicable due to:</p>
<div class="euiText euiText--small euiStat__description wz-text-gray">
<p>{{item.reason}}</p>
</div>
<div layout="column" class="wz-margin-bottom-10"></div>
</div>
<div layout="column" class="wz-margin-bottom-10"></div>
</div>
<div class="euiFlexItem euiFlexItem--flexGrowZero" ng-if="item.rationale">
<div class="euiStat euiStat--leftAligned">
<p class="euiTitle euiTitle--small euiStat__title ng-binding" style="font-size: 1.15rem;">Rationale</p>
Expand Down Expand Up @@ -260,11 +260,10 @@
</div>
<div layout="column" class="wz-margin-bottom-10"></div>
</div>
<div class="euiFlexItem euiFlexItem--flexGrowZero"
ng-if="item.rules && item.rules.length">
<div class="euiFlexItem euiFlexItem--flexGrowZero" ng-if="item.rules && item.rules.length">
<div class="euiStat euiStat--leftAligned">
<p class="euiTitle euiTitle--small euiStat__title ng-binding"
style="font-size: 1.15rem;">{{item.rules.length > 1 ? 'Checks' : 'Check'}}
<p class="euiTitle euiTitle--small euiStat__title ng-binding" style="font-size: 1.15rem;">{{item.rules.length
> 1 ? 'Checks' : 'Check'}}
</p>
<div class="euiText euiText--small euiStat__description wz-text-gray">
<div layout="row" ng-repeat="rule in item.rules">
Expand All @@ -274,8 +273,7 @@
</div>
<div layout="column" class="wz-margin-bottom-10"></div>
</div>
<div class="euiFlexItem euiFlexItem--flexGrowZero"
ng-if="item.compliance && item.compliance.length">
<div class="euiFlexItem euiFlexItem--flexGrowZero" ng-if="item.compliance && item.compliance.length">

<div class="euiStat euiStat--leftAligned">
<p class="euiTitle euiTitle--small euiStat__title ng-binding" style="font-size: 1.15rem;">Compliance</p>
Expand Down Expand Up @@ -328,8 +326,8 @@
</div>

<div ng-if="!wazuh_table_loading && isSyscheck()" ng-show="!error && items.length">
<table class="table table-striped table-striped-duo table-condensed table-hover no-margin-bottom"
ng-class="customColumns ? 'table-resizable' : 'euiTable euiTable--responsive'" id="table{{scapepath}}">
<table class="table table-striped table-striped-duo table-condensed table-hover no-margin-bottom" ng-class="customColumns ? 'table-resizable' : 'euiTable euiTable--responsive'"
id="table{{scapepath}}">
<thead class="wz-text-bold">
<th ng-repeat="key in keys" class="euiTableHeaderCell wz-text-left" ng-style="key.width && {'width':key.width}">
<p ng-class="{ 'cursor-pointer' : !key.nosortable }" ng-click="!key.nosortable && sort(key)">{{
Expand All @@ -342,7 +340,7 @@
<tbody>
<tr class="wz-word-wrap cursor-pointer" ng-repeat-start="item in pagedItems[currentPage] | filter:{item:'!'}"
ng-click="expandTableRow(item)" ng-class="{'selected': item.expanded}">
<td ng-repeat="key in keys" id="td-{{$parent.$index}}-{{$index}}" ng-mouseover="showTooltip($parent.$index, $index, item)">
<td ng-repeat="key in keys" id="{{scapepath}}-td-{{$parent.$index}}-{{$index}}" ng-mouseover="showTooltip($parent.$index, $index, item, scapepath)">
<div class="wz-text-truncatable-container">
<span class="wz-text-truncatable">
{{
Expand All @@ -355,8 +353,7 @@
</div>
</td>
</tr>
<tr class="wz-word-wrap cursor-pointer selected" ng-show="item.expanded" ng-repeat-end=""
ng-click="expandTableRow(item)">
<tr class="wz-word-wrap cursor-pointer selected" ng-show="item.expanded" ng-repeat-end="" ng-click="expandTableRow(item)">
<td colspan="{{keys.length}}" style="border-top: none">
<div layout="row" layout-padding="" class="layout-padding layout-row" ng-if="item.expanded">
<md-card flex="" class="wz-md-card wz-padding-top-0 wz-padding-bottom-0 wz-no-margin _md flex">
Expand Down

0 comments on commit 9b84916

Please sign in to comment.