Skip to content

Commit

Permalink
Fix breadcrumb styles for Wazuh Dashboard based on OSD 2.3.x (#4649)
Browse files Browse the repository at this point in the history
* Fix style in wazuh breadcrumb for osd 2.x

* add class osdBreadcrumbs

* remove euiBreadcrumbSeparator

* add crumbs funtion

* add changelog

* fix changelog

* remove style no used

* add validation breadcrumbs exist

Co-authored-by: yenienserrano <ian.serrano@wazuh.com>
Co-authored-by: Ian Yenien Serrano <63758389+yenienserrano@users.noreply.github.com>
Co-authored-by: Álex <alejandro.ruiz.becerra@wazuh.com>
  • Loading branch information
4 people authored Oct 19, 2022
1 parent fa0b464 commit 8e6f25a
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 35 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ All notable changes to the Wazuh app project will be documented in this file.
- The endpoint `/agents/summary/status` response was adapted. [#3874](https://github.com/wazuh/wazuh-kibana-app/pull/3874)
- Changed loading icons of the Agents Overview section to work independently [#4363](https://github.com/wazuh/wazuh-kibana-app/pull/4363)
- Enhance the message shown when a mismatch between Wazuh API and Wazuh APP occurs [#4544](https://github.com/wazuh/wazuh-kibana-app/pull/4544)
- Changed breadcrumb styling to support OpenSearch dashboard 2.x. [#4649](https://github.com/wazuh/wazuh-kibana-app/pull/4649)

### Removed

- Removed custom styles from kibana 7.9.0 [#4491](https://github.com/wazuh/wazuh-kibana-app/pull/4491)

### Fixed
Expand Down
25 changes: 16 additions & 9 deletions public/components/common/globalBreadcrumb/globalBreadcrumb.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
nav.euiBreadcrumbs.wz-global-breadcrumb span.euiBreadcrumb[title=""]:first-child{
display: none;
}

.euiBreadcrumbs--truncate .wz-global-breadcrumb .euiBreadcrumb:not(.euiBreadcrumb--collapsed) span.euiToolTipAnchor{
.euiBreadcrumbs--truncate .wz-global-breadcrumb .euiBreadcrumb:not(.euiBreadcrumb--collapsed) span.euiToolTipAnchor {
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
Expand All @@ -14,18 +10,29 @@ nav.euiBreadcrumbs.wz-global-breadcrumb span.euiBreadcrumb[title=""]:first-child
padding: 0px;
}

.wz-global-breadcrumb-btn{
max-width: unset!important;
.wz-global-breadcrumb-btn {
max-width: unset !important;
}

@media screen and (-webkit-min-device-pixel-ratio: 0) {
_::-webkit-full-page-media, _:future, :root , .wz-global-breadcrumb {

_::-webkit-full-page-media,
_:future,
:root,
.wz-global-breadcrumb {
line-height: 1.5;
}
}

@-moz-document url-prefix() {
.wz-global-breadcrumb #breadcrumbNoTitle {
height: auto!important;
height: auto !important;
}
}

// styles for opensearch >2.x

.osdHeaderBreadcrumbs ,
.osdHeaderBreadcrumbs--dark {
filter: none;
}
63 changes: 37 additions & 26 deletions public/components/common/globalBreadcrumb/globalBreadcrumb.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React, { Component } from 'react';
import { EuiBreadcrumbs, EuiToolTip } from '@elastic/eui';
import { EuiBreadcrumbs } from '@elastic/eui';
import { connect } from 'react-redux';
import './globalBreadcrumb.scss';
import { AppNavigate } from '../../../react-services/app-navigate';
import { getAngularModule } from '../../../kibana-services';

class WzGlobalBreadcrumb extends Component {
props: { state: { breadcrumb: [] } };
props: { state: { breadcrumb: [{ agent; text }] } };
constructor(props) {
super(props);
this.props = props;
Expand All @@ -15,46 +15,57 @@ class WzGlobalBreadcrumb extends Component {
async componentDidMount() {
const $injector = getAngularModule().$injector;
this.router = $injector.get('$route');
$('#breadcrumbNoTitle').attr("title", "");
}
componnedDidUpdate() {
$('#breadcrumbNoTitle').attr("title", "");
}

crumbs = () => {
const breadcrumbs = this.props.state.breadcrumb.map((breadcrumb) =>
breadcrumb.agent
? {
className: 'euiLink euiLink--subdued osdBreadcrumbs',
onClick: (ev) => {
ev.stopPropagation();
AppNavigate.navigateToModule(ev, 'agents', {
tab: 'welcome',
agent: breadcrumb.agent.id,
});
this.router.reload();
},
truncate: true,
text: breadcrumb.agent.name,
}
: {
...breadcrumb,
className: 'osdBreadcrumbs',
}
);

// remove frist breadcrumb if it's empty
if (breadcrumbs?.[0]?.text === '') {
breadcrumbs.shift();
}

return breadcrumbs;
};

render() {
return (
<div>
{!!this.props.state.breadcrumb.length && (
<EuiBreadcrumbs
className='wz-global-breadcrumb'
className="wz-global-breadcrumb"
responsive={false}
truncate={false}
max={6}
breadcrumbs={this.props.state.breadcrumb.map(breadcrumb => breadcrumb.agent ? {
className: "euiLink euiLink--subdued ",
onClick: (ev) => {
ev.stopPropagation();
AppNavigate.navigateToModule(ev, 'agents', {
"tab": "welcome", "agent": breadcrumb.agent.id
});
this.router.reload();
},
id: "breadcrumbNoTitle",
truncate: true,
text: (
<EuiToolTip position="top" content={"View agent summary"}>
<span>{breadcrumb.agent.name}</span>
</EuiToolTip>
)
} : breadcrumb)}
breadcrumbs={this.crumbs()}
aria-label="Wazuh global breadcrumbs"
/>
)}
</div>
)
);
}
}

const mapStateToProps = state => {
const mapStateToProps = (state) => {
return {
state: state.globalBreadcrumbReducers,
};
Expand Down

0 comments on commit 8e6f25a

Please sign in to comment.