Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix breadcrumb styles for Wazuh Dashboard based on OSD 2.3.x #4649

Merged
merged 9 commits into from
Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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