Skip to content

Commit

Permalink
Dynamic height for the menu directive
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesús Ángel committed Jun 10, 2019
1 parent a998955 commit 427d0f3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion public/directives/wz-menu/wz-menu.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<md-toolbar class="wz-menu">
<md-toolbar ng-style="{'height': {{barHeight}} + 'px','min-height': {{barHeight}} + 'px'}">

<!-- Main toolbar content -->
<div class="md-toolbar-tools wz-menu-content">
Expand Down
7 changes: 7 additions & 0 deletions public/directives/wz-menu/wz-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import menuTemplate from './wz-menu.html';
import { uiModules } from 'ui/modules';
import $ from 'jquery';

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

Expand All @@ -34,6 +35,12 @@ class WzMenu {
) {
$scope.showSelector = appState.getPatternSelector();

let height = false;
try {
height = $('#navDrawerMenu > ul:nth-child(2)')[0].clientHeight;
} catch (error) {} // eslint-disable-line
$scope.barHeight = (height || 51) + 2;

$scope.$applyAsync();

if (appState.getCurrentAPI()) {
Expand Down
5 changes: 0 additions & 5 deletions public/directives/wz-menu/wz-menu.less
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@
/* -------------------------------------------------------------------------- */

/* Style to the base toolbar */
.wz-menu {
height: 53px;
min-height: 53px;
}

/* Style applied to the toolbar-tools container */
.wz-menu-content {
color: #373a42;
Expand Down
2 changes: 1 addition & 1 deletion public/templates/agents-prev/agents-prev.head
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div ng-cloak flex="auto" ng-controller="agentsPreviewController as ctrl" layout="column" class="mozilla-table-size-99">
<div ng-cloak flex="auto" ng-controller="agentsPreviewController as ctrl" layout="column">

<wz-menu ng-init="menuNavItem = 'agents'"></wz-menu>

Expand Down

0 comments on commit 427d0f3

Please sign in to comment.