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

[APM] Persist local UI filter across views #43988

Merged
merged 4 commits into from
Aug 28, 2019

Conversation

dgieselaar
Copy link
Member

@dgieselaar dgieselaar commented Aug 26, 2019

Just did table + tabs, no breadcrumbs and others right now until we figure out what the right implementation is.

  • Service Overview => Transaction Overview (table)

  • Service Overview => Trace Overview (tab)

  • Trace Overview => Transaction Detail (table)

  • Trace Overview => Service Overview (tab)

  • Trace Overview => Service Overview (breadcrumb)

  • Transaction Overview => Transaction Detail (table)

  • Transaction Overview => Error Overview (tab)

  • Transaction Overview => Metrics Overview (tab)

  • Transaction Overview => Service Overview (breadcrumb)

  • Error Overview => Transaction Overview (tab)

  • Error Overview => Metrics Overview (tab)

  • Error Overview => Transaction Overview (breadcrumb)

  • Error Overview => Service Overview (breadcrumb)

  • Metrics Overview => Transaction Overview (tab)

  • Metrics Overview => Error Overview (tab)

  • Metrics Overview => Transaction Overview (breadcrumb)

  • Metrics Overview => Service Overview (breadcrumb)

  • Transaction Detail => Transaction Overview (breadcrumb)

  • Transaction Detail => Transaction Overview (flyout)

  • Transaction Detail => Trace Overview (full trace link)

@dgieselaar dgieselaar requested a review from sorenlouv August 26, 2019 14:04
@dgieselaar
Copy link
Member Author

Btw, I think adding this makes #43339 even more important, I think it would make the experience a lot better with persistent local UI filters.

@dgieselaar
Copy link
Member Author

@sqren should we do breadcrumbs? I don't see an easy way out there to be honest.

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@@ -33,20 +38,31 @@ export function ServiceDetailTabs({ urlParams }: Props) {
}
}, [serviceName, start, end]);

if (!serviceName) {
// this never happens, urlParams type is not accurate enough
Copy link
Member

@sorenlouv sorenlouv Aug 27, 2019

Choose a reason for hiding this comment

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

Thanks for adding this. We can probably solve this later with some io-ts at the route boundary.

padding: ${px(unit * 0.75)} ${px(unit)};
${({ isSelected }) =>
!isSelected ? `color: ${theme.euiTextColor} !important;` : ''}
}
Copy link
Member

Choose a reason for hiding this comment

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

Overriding EuiTabLink seems wrong - especially with !important. Although you probably have good reasons. Can you add a comment why we don't use EuiTab vanilla and why it's not possible to configure it via props (eg. it has a size property that is probably similar to setting padding)

Copy link
Member

Choose a reason for hiding this comment

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

Also, we should tag the EUI team if we think some config options are missing in EuiTab

Copy link
Member Author

Choose a reason for hiding this comment

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

Added a comment. Should we pull in EUI as well to get some kind of support for links in tabs?

Copy link
Member

Choose a reason for hiding this comment

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

Should we pull in EUI as well to get some kind of support for links in tabs?

Would be great if you can repro the problem in a codesandbox and create an issue in EUI. Then link to the issue from the comment, so we can remove the workaround when that is fixed.

@@ -7,6 +7,8 @@
import React from 'react';
import { Transaction } from '../../../../../typings/es_schemas/ui/Transaction';
import { APMLink } from './APMLink';
import { useUrlParams } from '../../../../hooks/useUrlParams';
import { pickKeys } from '../../../../utils/pickKeys';

interface TransactionLinkProps {
transaction: Transaction | undefined;
Copy link
Member

@sorenlouv sorenlouv Aug 27, 2019

Choose a reason for hiding this comment

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

TransactionLink is a bit different than all the others because it takes a Transaction as argument. Did you consider changing that to individual params like:

const TransactionLink = ({ 
  serviceName, 
  traceId,
  transactionId,
  transactionName,
  transactionType 
}) => { ... }

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I think flattening those is an improvement, will change 👍

@sorenlouv
Copy link
Member

@sqren should we do breadcrumbs? I don't see an easy way out there to be honest.

I think it's fine to defer breadcrumbs for now.

Copy link
Member

@sorenlouv sorenlouv left a comment

Choose a reason for hiding this comment

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

This looks really good 👍
After this PR, do we still use APMLink directly, or only the specialized link components? Would be great if we got rid of all direct usages of APMLink since it would make it much simpler to update link structures if they are all located in the same folder (links/apm/{specialized-component}).

@dgieselaar
Copy link
Member Author

@sqren:

After this PR, do we still use APMLink directly, or only the specialized link components? Would be great if we got rid of all direct usages of APMLink since it would make it much simpler to update link structures if they are all located in the same folder (links/apm/{specialized-component}).

I think we can do that yeah, we need some other links like HomeLink and SettingsLink but it should be manageable. Do we have situations where we link internally with anything other than an APMLink component? Could not find one so quickly, but maybe you know one.

@dgieselaar dgieselaar force-pushed the persist-local-filters branch from 4f0c5dd to e34e06d Compare August 28, 2019 11:31
@@ -38,9 +37,9 @@ describe('ErrorGroupOverview -> List', () => {
it('should render empty state', () => {
const storeState = {};
const wrapper = mount(
<MemoryRouter>
<MockUrlParamsProvider>
Copy link
Member Author

Choose a reason for hiding this comment

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

this change was necessary because List now throws if no serviceName is defined in urlParams

@@ -112,8 +112,8 @@ export async function getErrorGroups({
return {
message,
occurrenceCount: bucket.doc_count,
culprit: idx(source, _ => _.error.culprit),
groupId: idx(source, _ => _.error.grouping_key),
culprit: source.error.culprit,
Copy link
Member Author

Choose a reason for hiding this comment

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

type says both culprit and grouping_key are always defined. don't want to use idx because it makes the property optional, which causes issues for consumers.

Copy link
Member

Choose a reason for hiding this comment

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

Great! 👍 We shouldn't use idx for non-optional properties anyway

@dgieselaar dgieselaar marked this pull request as ready for review August 28, 2019 11:41
@dgieselaar dgieselaar requested a review from a team as a code owner August 28, 2019 11:41
@sorenlouv sorenlouv added release_note:skip Skip the PR/issue when compiling release notes v7.4.0 Team:APM All issues that need APM UI Team support labels Aug 28, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/apm-ui

interface Props extends APMLinkExtendProps {
serviceName: string;
errorGroupId: string;
}
Copy link
Member

@sorenlouv sorenlouv Aug 28, 2019

Choose a reason for hiding this comment

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

Maybe it's just the name of APMLinkExtendProps that throws me off but might be more clear to do:

interface Props extends EuiLinkAnchorProps {
  serviceName: string;
  errorGroupId: string;
  children?: React.ReactNode;
}

Copy link
Member Author

Choose a reason for hiding this comment

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

APMLinkExtendProps explicitly disallows path and query to prevent prop conflicts (e.g. serviceName and errorGroupId are used to build a path, and uiFilters are used to build a query). Would be happy with a better name though, if you have any suggestions 😅

@@ -18,6 +18,8 @@ interface Props extends EuiLinkAnchorProps {
children?: React.ReactNode;
}

export type APMLinkExtendProps = Omit<Props, 'path' | 'query'>;

Copy link
Member

@sorenlouv sorenlouv Aug 28, 2019

Choose a reason for hiding this comment

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

Not necessary for this PR but looking at the TODO comment in this file we could fix it like:

export function getAPMHref(
  path: string,
  urlParams: IUrlParams,
  query: APMQueryParams = {}
) {
  const nextQuery = {
    rangeFrom: urlParams.rangeFrom || TIMEPICKER_DEFAULTS.rangeFrom,
    rangeTo: urlParams.rangeTo || TIMEPICKER_DEFAULTS.rangeTo,
    refreshPaused: urlParams.refreshPaused || TIMEPICKER_DEFAULTS.refreshPaused,
    refreshInterval:
      urlParams.refreshInterval || TIMEPICKER_DEFAULTS.refreshInterval,
    kuery: urlParams.kuery,
    environment: urlParams.environment,
    ...query
  };
  const nextSearch = fromQuery(nextQuery);

  return url.format({
    pathname: core.http.basePath.prepend('/app/apm'),
    hash: `${path}?${nextSearch}`
  });
}

I opted for inlining PERSISTENT_APM_PARAMS since it's not re-used anywhere else and this seemed a little clearer.
But again: not important for this PR.

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

'host',
'containerId',
'podName'
);
Copy link
Member

Choose a reason for hiding this comment

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

These are now duplicated:

filterNames: ['transactionResult', 'host', 'containerId', 'podName'],

I don't think that's a problem now, but in the future we could lift the filterNames to be defined in the route config (where this linking function could also be defined).

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah this is one of the downsides of loose coupling. But hopefully we can fix the routing soon

Copy link
Member

Choose a reason for hiding this comment

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

But hopefully we can fix the routing soon

++

Copy link
Member

@sorenlouv sorenlouv left a comment

Choose a reason for hiding this comment

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

LGTM. Just a few nits and observations for future changes. Nothing blocking 👍

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@dgieselaar dgieselaar merged commit 5de2fd4 into elastic:master Aug 28, 2019
@dgieselaar dgieselaar deleted the persist-local-filters branch August 28, 2019 15:27
dgieselaar added a commit to dgieselaar/kibana that referenced this pull request Aug 28, 2019
* [APM] Persist local UI filter across views

* Migrate remaining links

* Add comment clarifying override of EUITab styling

* Remove unnecessary check for existence of waterfall.traceRoot
dgieselaar added a commit that referenced this pull request Aug 28, 2019
* [APM] Persist local UI filter across views

* Migrate remaining links

* Add comment clarifying override of EUITab styling

* Remove unnecessary check for existence of waterfall.traceRoot
@sorenlouv
Copy link
Member

sorenlouv commented Sep 10, 2019

Test plan:

  • ✅Local filters are correctly carried over to pages that support them
  • ✅They are not carried over to pages that do not support them
  • ✅They are carried over for links and tabs
  • ✅They are not carried over for the breadcrumb (this is fine imo)
  • ⚠️transaction.result is carried over to error overview page. But errors never have transaction.result. Reported bug in [APM] Error overview has local filter for transaction.result #45264

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes Team:APM All issues that need APM UI Team support v7.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants