Skip to content

Commit

Permalink
Revert "Navbar hide flick (#1558)"
Browse files Browse the repository at this point in the history
This reverts commit 84905b3.
  • Loading branch information
Jesús Ángel committed Aug 16, 2019
1 parent 1201c72 commit 7ab433b
Show file tree
Hide file tree
Showing 24 changed files with 118 additions and 270 deletions.
60 changes: 26 additions & 34 deletions public/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,35 +39,6 @@ import './components';
// angular-charts.js
import 'angular-chart.js';

// pin-wz-menu.js
import { changeWazuhNavLogo } from './utils/wz-logo-menu';

// Font Awesome, Kibana UI framework and others
import './utils/fontawesome/css/font-awesome.min.css';

// Dev tools
import './utils/codemirror';

import './utils/jquery-ui';

// Material
import 'angular-material/angular-material.css';
import 'angular-aria/angular-aria';
import 'angular-animate/angular-animate';
import 'angular-material/angular-material';

// Cookies
import 'angular-cookies/angular-cookies';

import 'ui/autoload/all';

// Wazuh
import './kibana-integrations';
import './services';
import './controllers';
import './factories';
import './directives';

// Set up Wazuh app
const app = uiModules.get('app/wazuh', ['ngCookies', 'ngMaterial', 'chart.js']);

Expand All @@ -88,10 +59,6 @@ app.config([
]);

app.run(function($rootScope, $route, $location, appState, $window) {
chrome
.setRootTemplate('<wz-menu></wz-menu><div ng-view></div>')
.setRootController(() => require('./app'));
changeWazuhNavLogo();
appState.setNavigation({ status: false });
appState.setNavigation({
reloaded: false,
Expand All @@ -115,7 +82,6 @@ app.run(function($rootScope, $route, $location, appState, $window) {

$rootScope.$on('$locationChangeSuccess', () => {
const navigation = appState.getNavigation();
$rootScope.hideWzMenu = navigation.currLocation === '/health-check';
appState.setNavigation({ currLocation: $location.path() });
if (navigation.currLocation !== navigation.prevLocation) {
if (navigation.discoverSections.includes(navigation.currLocation)) {
Expand Down Expand Up @@ -224,6 +190,32 @@ app.run(function($rootScope, $route, $location, appState, $window) {
});
});

// Font Awesome, Kibana UI framework and others
import './utils/fontawesome/css/font-awesome.min.css';

// Dev tools
import './utils/codemirror';

import './utils/jquery-ui';

// Material
import 'angular-material/angular-material.css';
import 'angular-aria/angular-aria';
import 'angular-animate/angular-animate';
import 'angular-material/angular-material';

// Cookies
import 'angular-cookies/angular-cookies';

import 'ui/autoload/all';

// Wazuh
import './kibana-integrations';
import './services';
import './controllers';
import './factories';
import './directives';

// Added due to Kibana 6.3.0. Do not modify.
uiModules.get('kibana').provider('dashboardConfig', () => {
let hideWriteControls = false;
Expand Down
4 changes: 2 additions & 2 deletions public/controllers/agent/agents.js
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ export class AgentsController {
this.$scope.agent.status =
(((agentInfo || {}).data || {}).data || {}).status ||
this.$scope.agent.status;
} catch (error) {} // eslint-disable-line
} catch (error) { } // eslint-disable-line
}

try {
Expand Down Expand Up @@ -614,7 +614,7 @@ export class AgentsController {
if (tab === 'syscollector')
try {
await this.loadSyscollector(this.$scope.agent.id);
} catch (error) {} // eslint-disable-line
} catch (error) { } // eslint-disable-line
if (tab === 'configuration') {
this.$scope.switchConfigurationTab('welcome');
} else {
Expand Down
22 changes: 11 additions & 11 deletions public/controllers/management/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,13 @@ export class FilesController {
isOverwrite: !!this.overwriteError
};
(isNewFile && this.$scope.type === 'rules') ||
(!isNewFile && this.$scope.currentFile.type === 'rule')
(!isNewFile && this.$scope.currentFile.type === 'rule')
? (objParam.rule = isNewFile
? this.selectedItem
: this.$scope.currentFile)
? this.selectedItem
: this.$scope.currentFile)
: (objParam.decoder = isNewFile
? this.selectedItem
: this.$scope.currentFile);
? this.selectedItem
: this.$scope.currentFile);
this.$scope.$broadcast('saveXmlFile', objParam);
this.$scope.$applyAsync();
}
Expand Down Expand Up @@ -170,13 +170,13 @@ export class FilesController {
this.$scope.fetchedXML =
this.$scope.type === 'rules'
? await this.rulesetHandler.getRuleConfiguration(
this.$scope.currentFile.file,
readonly
)
this.$scope.currentFile.file,
readonly
)
: await this.rulesetHandler.getDecoderConfiguration(
this.$scope.currentFile.file,
readonly
);
this.$scope.currentFile.file,
readonly
);
this.$scope.$applyAsync();
if (!readonly) {
this.$scope.$broadcast('fetchedFile', { data: this.$scope.fetchedXML });
Expand Down
1 change: 0 additions & 1 deletion public/controllers/misc/health-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ export class HealthCheck {
this.errors = [];
this.processedChecks = 0;
this.totalChecks = 0;
this.$rootScope.hideWzMenu = true;
}

/**
Expand Down
32 changes: 15 additions & 17 deletions public/directives/wz-menu/wz-menu.html
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
<md-toolbar ng-style="{'height': {{barHeight}} + 'px','min-height': {{barHeight}} + 'px'}" ng-hide="root.hideWzMenu">
<md-toolbar ng-style="{'height': {{barHeight}} + 'px','min-height': {{barHeight}} + 'px'}">

<!-- Main toolbar content -->
<div class="md-toolbar-tools wz-menu-content">

<!-- Main Wazuh app navigation buttons -->
<md-button class="wz-menu-button" ng-href="#/overview" ng-click="setMenuNavItem('overview')"
ng-class="{'wz-menu-active': menuNavItem === 'overview' || menuNavItem === 'health-check' }"
aria-label="Overview tab">
<md-button class="wz-menu-button" ng-href="#/overview"
ng-class="{'wz-menu-active': menuNavItem === 'overview' }" aria-label="Overview tab">
<react-component name="EuiIcon" class="kbnGlobalNavLink__euiIcon" props="{type:'visualizeApp'}" /> Overview
</md-button>

<md-button class="wz-menu-button" ng-href="#/manager" ng-click="setMenuNavItem('manager')"
ng-class="{'wz-menu-active': menuNavItem === 'manager' }" aria-label="Cluster tab">
<md-button class="wz-menu-button" ng-href="#/manager" ng-class="{'wz-menu-active': menuNavItem === 'manager' }"
aria-label="Cluster tab">
<react-component name="EuiIcon" class="kbnGlobalNavLink__euiIcon" props="{type:'infraApp'}" /> Management
</md-button>

<md-button class="wz-menu-button" ng-href="#/agents-preview" ng-click="setMenuNavItem('agents-preview')"
ng-class="{'wz-menu-active': menuNavItem === 'agents-preview' || menuNavItem === 'agents' }"
aria-label="Agents tab">
<md-button class="wz-menu-button" ng-href="#/agents-preview"
ng-class="{'wz-menu-active': menuNavItem === 'agents' }" aria-label="Agents tab">
<i class="fa fa-fw fa-tv" aria-hidden="true"></i> Agents
</md-button>

<md-button class="wz-menu-button" ng-href="#/wazuh-discover" ng-click="setMenuNavItem('wazuh-discover')"
ng-class="{'wz-menu-active': menuNavItem === 'wazuh-discover' }" aria-label="Discover tab">
<md-button class="wz-menu-button" ng-href="#/wazuh-discover"
ng-class="{'wz-menu-active': menuNavItem === 'discover' }" aria-label="Discover tab">
<react-component name="EuiIcon" class="kbnGlobalNavLink__euiIcon" props="{type:'discoverApp'}" /> Discover
</md-button>

<md-button class="wz-menu-button" ng-href="#/wazuh-dev" ng-click="setMenuNavItem('wazuh-dev')"
<md-button class="wz-menu-button" ng-href="#/wazuh-dev"
ng-class="{'wz-menu-active': menuNavItem === 'wazuh-dev' }" aria-label="Dev Tools tab">
<react-component name="EuiIcon" class="kbnGlobalNavLink__euiIcon" props="{type:'console'}" /> Dev tools
</md-button>
Expand All @@ -36,19 +34,19 @@

<!-- API/Index pattern section -->
<!-- Case 1a - There's API -->
<span ng-show="theresAPI" class="small" tooltip="Selected API" tooltip-placement="left">
<span ng-show="theresAPI" class="small" tooltip="Selected API" tooltip-placement="bottom">
<i class="fa fa-star fa-fw wz-color-orange" aria-hidden="true"></i>{{currentAPI}}<span
ng-if="showSelector">&nbsp;&ndash;&nbsp;</span>
</span>

<!-- Case 1b - There's no API -->
<span ng-show="!theresAPI" class="small" tooltip="No API credentials inserted" tooltip-placement="left">
<span ng-show="!theresAPI" class="small" tooltip="No API credentials inserted" tooltip-placement="bottom">
No API<span ng-if="showSelector">&nbsp;&ndash;&nbsp;</span>
</span>

<!-- Case 2a - There's pattern and there's more than one -->
<span ng-if="showSelector" ng-show="theresPattern && patternList && patternList.length > 1" class="small"
tooltip="Selected index pattern" tooltip-placement="left">
tooltip="Selected index pattern" tooltip-placement="bottom">
<select class="wz-menu-select" ng-model="currentSelectedPattern"
ng-change="changePattern(currentSelectedPattern)" aria-label="Index pattern selector"
placeholder="Index pattern">
Expand All @@ -61,12 +59,12 @@

<!-- Case 2b - There's pattern and there's only one-->
<span ng-if="showSelector" ng-show="theresPattern && patternList && patternList.length === 1" class="small"
tooltip="Selected index pattern" tooltip-placement="left">
tooltip="Selected index pattern" tooltip-placement="bottom">
{{patternList[0].title}}
</span>

<!-- Settings tab button -->
<md-button class="wz-menu-button md-icon-button" ng-href="#/settings" ng-click="setMenuNavItem('settings')"
<md-button class="wz-menu-button md-icon-button" ng-href="#/settings"
ng-class="{'wz-menu-active': menuNavItem === 'settings' }" aria-label="Settings tab">
<react-component name="EuiIcon" class="kbnGlobalNavLink__euiIcon" props="{type:'gear'}" />
</md-button>
Expand Down
13 changes: 2 additions & 11 deletions public/directives/wz-menu/wz-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class WzMenu {

controller(
$scope,
$rootScope,
$window,
appState,
patternHandler,
Expand All @@ -35,7 +34,7 @@ class WzMenu {
wazuhConfig
) {
$scope.showSelector = appState.getPatternSelector();
$scope.root = $rootScope;

let height = false;
try {
height = $('#navDrawerMenu > ul:nth-child(2)')[0].clientHeight;
Expand All @@ -55,10 +54,6 @@ class WzMenu {
$window.location.href = path;
};

$scope.setMenuNavItem = item => {
$scope.menuNavItem = item;
};

/**
* When controller loads
*/
Expand Down Expand Up @@ -99,12 +94,8 @@ class WzMenu {
$scope.patternList = list;
$scope.currentSelectedPattern = appState.getCurrentPattern();
}
if (!$scope.menuNavItem) {
$scope.menuNavItem = appState
.getNavigation()
.currLocation.replace(/\//g, '');
}
$scope.$applyAsync();

return;
} catch (error) {
errorHandler.handle(error.message || error);
Expand Down
49 changes: 6 additions & 43 deletions public/directives/wz-menu/wz-menu.less
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,11 @@

/* Style to the base toolbar */
/* Style applied to the toolbar-tools container */

wz-menu {
position: fixed;
z-index: 999;
}

.wz-menu-content {
color: #373a42;
background-color: #FFF;
z-index: 1000;
border-bottom: 1px solid #D3DAE6;
position: fixed;
width: calc(~'100% - 49px');
box-shadow: 0 2px 2px -1px rgba(152, 162, 179, 0.3);
}
@media only screen and (max-width: 767px){
.wz-menu-content {
width: 100%;
}
}

/* Style to override the font on the toolbar */
.wz-menu-content {
Expand All @@ -45,12 +30,12 @@ wz-menu {
.wz-menu-button {
font-size: 14px !important;
transition: none !important;
min-height: 35px !important;
line-height: 35px !important;
height: 35px;
padding: 0px 8px;
border-radius: 4px;
margin: 0px 5px;
min-height: 30px !important;
line-height: 30px !important;
height: 49px;
border-radius: 0;
padding: 10px 13px;
margin: 0;
}

.wz-menu-button.md-icon-button {
Expand Down Expand Up @@ -88,25 +73,3 @@ wz-menu {
width: 16px !important;
height: 16px !important;
}

.wz-menu-bottom-line {
border-bottom: 1px solid #d3dae6;
width: 100%;
height: 1px;
left: 0;
position: absolute;
top: 97px;
}

.euiHeader {
box-shadow: none !important;
}

md-toolbar {
height: 49px !important;
min-height: 0px !important;
}

.md-toolbar-tools {
height: 49px !important;
}
11 changes: 10 additions & 1 deletion public/img/icon_blue.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion public/img/logo.svg

This file was deleted.

Binary file added public/img/sca.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions public/kibana-integrations/kibana-discover.js
Original file line number Diff line number Diff line change
Expand Up @@ -647,12 +647,12 @@ function discoverController(
$scope.updateQueryAndFetch = function({ query, dateRange }) {
// Wazuh filters are not ready yet
if (!filtersAreReady()) return;

// Update query from search bar
discoverPendingUpdates.removeAll();
discoverPendingUpdates.addItem($state.query, queryFilter.getFilters());
$rootScope.$broadcast('updateVis');

timefilter.setTime(dateRange);
if (query) $state.query = query;
$scope.fetch();
Expand Down
Loading

0 comments on commit 7ab433b

Please sign in to comment.