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

[app switcher] nav link enhancements #7601

Merged

Conversation

ycombinator
Copy link
Contributor

This PR adds the following functionality:

  • Allows retrieval of a nav link from the app switcher nav, given the link's title.
  • Allows toggling the display of the nav link in the app switcher nav
  • Allows toggling the enabled/disabled state of the nav link in the app switcher nav
  • Allows setting (and showing) a tooltip on the nav link in the app switcher nav

@ycombinator ycombinator force-pushed the app-switcher/nav-link-enhancements branch from 757f500 to 2712203 Compare July 1, 2016 10:48
@ycombinator ycombinator changed the title App switcher/nav link enhancements [app switcher] nav link enhancements Jul 1, 2016
@epixa epixa assigned ycombinator and unassigned epixa Jul 1, 2016
@epixa epixa removed the review label Jul 1, 2016
For plugins, by default the plugin ID is used as the nav link ID. This can be overridden by explicitly specifying an ID on the nav link (useful for plugins that register multiple nav links).
@ycombinator ycombinator assigned epixa and unassigned ycombinator Jul 1, 2016
@@ -45,6 +45,19 @@ describe('chrome nav apis', function () {
});
});

describe('#getNavLinkById', () => {
it ('retrieves the correct nav link, given its ID', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a test for the case where the id is not found. If possible, it'd be great if we could throw in that case, what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

@ycombinator ycombinator removed the review label Jul 1, 2016
@ycombinator ycombinator assigned ycombinator and unassigned epixa Jul 1, 2016
@@ -3,6 +3,7 @@ import { join } from 'path';

export default class UiNavLink {
constructor(uiExports, spec) {
this.id = spec.id;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since there are other things that rely on this property, can you add a test to verify that the constructor sets it properly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@ycombinator ycombinator assigned epixa and unassigned ycombinator Jul 1, 2016
@ycombinator
Copy link
Contributor Author

ycombinator commented Jul 1, 2016

@epixa, @cjcenizal This is ready for review again.

The build 💥 look unrelated to tests. Also Jenkins hosts seem to be changing. I'm keeping an eye on things.


const navLink = chrome.getNavLinkById('kibana:discover');
expect(navLink).to.not.be(undefined);
expect(navLink.title).to.be('Discover');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these two expectations can be replaced with:

expect(navLink).to.eql(nav[0]);

This should do a deep comparison: http://chaijs.com/api/bdd/#method_eql

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah cool. Will give this a shot. Thanks!

@cjcenizal
Copy link
Contributor

👍 Looks great!

@ycombinator
Copy link
Contributor Author

@cjcenizal Made the two changes you suggested. Ready for review again. 😄

@cjcenizal
Copy link
Contributor

LGTM!

@ycombinator
Copy link
Contributor Author

@epixa Can you take a look at this one again today, please? It looks like the build off the latest commit (81072ad) succeeded on the old CI environment: http://build-eu-00.elastic.co/job/kibana_core_pr/4454/

@epixa
Copy link
Contributor

epixa commented Jul 5, 2016

This needs to be rebased or have master merged.

if (navLink) {
return navLink;
} else {
throw new Error(`Nav link for id = ${id} not found`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the spirit of Return early from functions, I recommend doing this assertion up front and then returning outside of the conditional:

const navLink = internals.nav.find(link => link.id === id);
if (!navLink) {
  throw new Error(`Nav link for id = ${id} not found`);
}
return navLink;

@epixa
Copy link
Contributor

epixa commented Jul 5, 2016

LGTM on green

@epixa epixa assigned ycombinator and unassigned epixa Jul 5, 2016
@cjcenizal
Copy link
Contributor

LGTM

@ycombinator ycombinator merged commit 0169492 into elastic:master Jul 5, 2016
@ycombinator ycombinator deleted the app-switcher/nav-link-enhancements branch July 5, 2016 22:39
@epixa epixa added v5.0.0 and removed v5.0.0 labels Aug 1, 2016
airow pushed a commit to airow/kibana that referenced this pull request Feb 16, 2017
…k-enhancements

[app switcher] nav link enhancements

Former-commit-id: 0169492
cee-chen added a commit that referenced this pull request May 3, 2024
`v94.1.0-backport.0` ⏩ `v94.2.1-backport.0`

_[Questions? Please see our Kibana upgrade
FAQ.](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams)_

---

##
[`v94.2.1-backport.0`](https://github.com/elastic/eui/releases/v94.2.1-backport.0)

**This is a backport release only intended for use by Kibana.**

- Reverted the `EuiFlexGroup`/`EuiFlexItem` `component` prop feature due
to Kibana typing issues

## [`v94.2.1`](https://github.com/elastic/eui/releases/v94.2.1)

**Bug fixes**

- Fixed an `EuiTabbedContent` edge case bug that occurred when updated
with a completely different set of `tabs`
([#7713](elastic/eui#7713))
- Fixed the `@storybook/test` dependency to be listed in
`devDependencies` and not `dependencies`
([#7719](elastic/eui#7719))

## [`v94.2.0`](https://github.com/elastic/eui/releases/v94.2.0)

- Updated `getDefaultEuiMarkdownPlugins()` to allow excluding the
following plugins in addition to `tooltip`:
([#7676](elastic/eui#7676))
  - `checkbox`
  - `linkValidator`
  - `lineBreaks`
  - `emoji`
- Updated `EuiSelectable`'s `isPreFiltered` prop to allow passing a
configuration object, which allows disabling search highlighting in
addition to search filtering
([#7683](elastic/eui#7683))
- Updated `EuiFlexGroup` and `EuiFlexItem` prop types to support passing
any valid React component type to the `component` prop and ensure proper
type checking of the extra props forwarded to the `component`.
([#7688](elastic/eui#7688))
- Updated `EuiSearchBar` to allow the `@` special character in query
string searches ([#7702](elastic/eui#7702))
- Added a new, optional `optionMatcher` prop to `EuiSelectable` and
`EuiComboBox` allowing passing a custom option matcher function to these
components and controlling option filtering for given search string
([#7709](elastic/eui#7709))

**Bug fixes**

- Fixed an `EuiPageTemplate` bug where prop updates would not cascade
down to child sections
([#7648](elastic/eui#7648))
- To cascade props down to the sidebar, `EuiPageTemplate` now explicitly
requires using the `EuiPageTemplate.Sidebar` rather than
`EuiPageSidebar`
- Fixed `EuiFieldNumber`'s typing to accept an icon configuration shape
([#7666](elastic/eui#7666))
- Fixed `EuiFieldText` and `EuiFieldNumber` to render the correct
paddings for icon shapes set to `side: 'right'`
([#7666](elastic/eui#7666))
- Fixed `EuiFieldText` and `EuiFieldNumber` to fully ignore
`icon`/`prepend`/`append` when `controlOnly` is set to true
([#7666](elastic/eui#7666))
- Fixed `EuiColorPicker`'s input not setting the correct right padding
for the number of icons displayed
([#7666](elastic/eui#7666))
- Visual fixes for `EuiRange`s with `showInput`:
([#7678](elastic/eui#7678))
  - Longer `append`/`prepend` labels no longer cause a background bug
  - Inputs can no longer overwhelm the actual range in width
- Fixed a visual text alignment regression in `EuiTableRowCell`s with
the `row` header scope
([#7681](elastic/eui#7681))
- Fixed `toolTipProps` type on `EuiSuperUpdateButton` to use
`Partial<EuiToolTipProps>`
([#7692](elastic/eui#7692))
- Fixes missing prop type for `popperProps` on `EuiDatePicker`
([#7694](elastic/eui#7694))
- Fixed a focus bug with `EuiDataGrid`s with `leadingControlColumns`
when moving columns to the left/right
([#7701](elastic/eui#7701))
([#7698](elastic/eui#7698))
- Fixed `EuiSuperDatePicker` to validate date string with respect of
locale on `EuiAbsoluteTab`.
([#7705](elastic/eui#7705))
- Fixed a visual bug with `EuiSuperDatePicker`'s absolute tab on small
mobile screens ([#7708](elastic/eui#7708))
- Fixed i18n of empty and loading state messages for the
`FieldValueSelectionFilter` component
([#7718](elastic/eui#7718))

**Dependency updates**

- Updated `@hello-pangea/dnd` to v16.6.0
([#7599](elastic/eui#7599))
- Updated `remark-rehype` to v8.1.0
([#7601](elastic/eui#7601))

**Accessibility**

- Improved `EuiBasicTable` and `EuiInMemoryTable`'s selection checkboxes
to have unique aria-labels per row
([#7672](elastic/eui#7672))
- Added `aria-valuetext` attributes to `EuiRange`s with tick labels for
improved screen reader UX
([#7675](elastic/eui#7675))
- Updated `EuiAccordion` to keep focus on accordion trigger instead of
moving to content on click/keypress
([#7696](elastic/eui#7696))
- Added `aria-disabled` attribute to `EuiHorizontalSteps` when status is
"disabled" ([#7699](elastic/eui#7699))

---------

Co-authored-by: Tomasz Kajtoch <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants