Skip to content

feat(discover2): Discover v2 table and friends #14403

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

Merged
merged 57 commits into from
Aug 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
1124b0d
src/sentry/static/sentry/app/views/organizationEventsV2/tagsTable.tsx
dashed Aug 10, 2019
ac2983a
replace react router stuffs
dashed Aug 21, 2019
a5dc8a4
refine type of field formatters
dashed Aug 15, 2019
6959b3d
refine type of special fields
dashed Aug 15, 2019
b9eaac4
adjust specialfield type
dashed Aug 15, 2019
1452e87
src/sentry/static/sentry/app/views/organizationEventsV2/data.tsx: sto…
dashed Aug 21, 2019
980cbe3
remove issue_title type from SpecialFields
dashed Aug 21, 2019
81b5801
table revamp
dashed Aug 22, 2019
9374c79
fix
dashed Aug 22, 2019
44aa2fc
as const
dashed Aug 22, 2019
84752b1
rename
dashed Aug 23, 2019
53458f2
discover2table
dashed Aug 23, 2019
21f03bf
old
dashed Aug 24, 2019
3710da6
eventView.tsx
dashed Aug 24, 2019
039c02a
fix
dashed Aug 24, 2019
b592202
decodeSorts
dashed Aug 24, 2019
ae02803
things
dashed Aug 24, 2019
803f5c5
types
dashed Aug 24, 2019
bced93f
decodeQuery
dashed Aug 24, 2019
83aae39
various fixes
dashed Aug 26, 2019
563bc65
default view
dashed Aug 26, 2019
c2b6f73
flesh out
dashed Aug 26, 2019
3b06efc
more stuff
dashed Aug 27, 2019
400b58d
simplify
dashed Aug 27, 2019
30da584
header cell
dashed Aug 27, 2019
4719b68
no results
dashed Aug 27, 2019
81514d6
grid size
dashed Aug 27, 2019
571455d
display table
dashed Aug 27, 2019
a8322d5
comment
dashed Aug 27, 2019
48a24e6
clean up
dashed Aug 27, 2019
3016a53
fix
dashed Aug 27, 2019
3f86658
nevermind
dashed Aug 27, 2019
68a9b42
auto expanding columns
dashed Aug 27, 2019
e4f1ee9
refactor
dashed Aug 27, 2019
5c3460f
DEFAULT_EVENT_VIEW_V1
dashed Aug 27, 2019
1dd9cde
fix
dashed Aug 27, 2019
9c98008
rebase and refactor ontop of Mark's SEN-967
dashed Aug 27, 2019
a578f03
polish
dashed Aug 27, 2019
e793433
clean up
dashed Aug 27, 2019
bb07273
remove getCurrentView
dashed Aug 27, 2019
436ab9c
clean up
dashed Aug 27, 2019
ee514db
fix
dashed Aug 27, 2019
489d9d1
sort
dashed Aug 27, 2019
467829f
fix tags.spec.jsx
dashed Aug 27, 2019
58cad64
tests/js/spec/views/organizationEventsV2/utils.spec.jsx
dashed Aug 27, 2019
b8c40cb
tests/js/spec/views/organizationEventsV2/index.spec.jsx
dashed Aug 27, 2019
4523aa2
tests/js/spec/views/organizationEventsV2/eventDetails.spec.jsx
dashed Aug 27, 2019
d4cfa9a
Fix missing borders.
markstory Aug 27, 2019
d655468
Fix sorting on aggregates.
markstory Aug 27, 2019
4717d79
remove automatic expanding columns
dashed Aug 27, 2019
013d207
add document title
dashed Aug 27, 2019
6385e07
rename isComplete to isValid
dashed Aug 27, 2019
b66332b
move Events API query generation into EventView class
dashed Aug 27, 2019
9da6e03
lint fix
dashed Aug 27, 2019
cb60686
refactor test
dashed Aug 27, 2019
154698d
tests/acceptance/test_organization_events_v2.py
dashed Aug 27, 2019
537da8d
tests/acceptance/test_organization_events_v2.py
dashed Aug 28, 2019
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
6 changes: 1 addition & 5 deletions src/sentry/static/sentry/app/types/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -275,18 +275,14 @@ export type Group = {
seenBy: User[];
};

export type EventView = {
export type EventViewv1 = {
id: string;
name: string;
data: {
fields: string[];
columnNames: string[];
sort: string[];
query?: string;

// TODO: removed as of https://github.com/getsentry/sentry/pull/14321
// groupby: string[];
// orderby: string[];
};
tags: string[];
columnWidths: string[];
Expand Down
105 changes: 74 additions & 31 deletions src/sentry/static/sentry/app/views/organizationEventsV2/data.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import styled from 'react-emotion';
import {Location} from 'history';

import {deepFreeze} from 'app/utils';
import {t} from 'app/locale';
import Count from 'app/components/count';
import DateTime from 'app/components/dateTime';
Expand All @@ -12,37 +12,28 @@ import getDynamicText from 'app/utils/getDynamicText';
import overflowEllipsis from 'app/styles/overflowEllipsis';
import pinIcon from 'app/../images/location-pin.png';
import space from 'app/styles/space';
import {EventView} from 'app/types';
import {EventViewv1, Organization} from 'app/types';

import {QueryLink} from './styles';

// TODO(ts): add as const after babel upgrade
export const MODAL_QUERY_KEYS = ['eventSlug'];
export const MODAL_QUERY_KEYS = ['eventSlug'] as const;
export const PIN_ICON = `image://${pinIcon}`;
// TODO(ts): add as const after babel upgrade
export const AGGREGATE_ALIASES = ['last_seen', 'latest_event'];
export const AGGREGATE_ALIASES = ['last_seen', 'latest_event'] as const;

// TODO(ts): eventually defer to TS compile-time check to ensure this is readonly instead
// of deepfreezing it in runtime
export const ALL_VIEWS: Readonly<Array<EventView>> = deepFreeze([
{
id: 'all',
name: t('All Events'),
data: {
fields: ['title', 'event.type', 'project', 'user', 'timestamp'],
columnNames: ['title', 'type', 'project', 'user', 'time'],
sort: ['-timestamp'],
},
tags: [
'event.type',
'release',
'project.name',
'user.email',
'user.ip',
'environment',
],
columnWidths: ['3fr', '80px', '1fr', '1fr', '1.5fr'],
export const DEFAULT_EVENT_VIEW_V1: Readonly<EventViewv1> = {
id: 'all',
name: t('All Events'),
data: {
fields: ['title', 'event.type', 'project', 'user', 'timestamp'],
columnNames: ['title', 'type', 'project', 'user', 'time'],
sort: ['-timestamp'],
},
tags: ['event.type', 'release', 'project.name', 'user.email', 'user.ip', 'environment'],
columnWidths: ['3fr', '80px', '1fr', '1fr', '1.5fr'],
};

export const ALL_VIEWS: Readonly<Array<EventViewv1>> = [
DEFAULT_EVENT_VIEW_V1,
{
id: 'errors',
name: t('Errors'),
Expand Down Expand Up @@ -92,14 +83,47 @@ export const ALL_VIEWS: Readonly<Array<EventView>> = deepFreeze([
],
columnWidths: ['3fr', '1fr', '70px'],
},
]);
];

type EventData = {[key: string]: any};

type RenderFunctionBaggage = {
organization: Organization;
location: Location;
};

type FieldFormatterRenderFunction = (
field: string,
data: EventData,
baggage: RenderFunctionBaggage
) => React.ReactNode;

export type FieldFormatterRenderFunctionPartial = (
data: EventData,
baggage: RenderFunctionBaggage
) => React.ReactNode;

type FieldFormatter = {
sortField: boolean;
renderFunc: FieldFormatterRenderFunction;
};

type FieldFormatters = {
boolean: FieldFormatter;
integer: FieldFormatter;
number: FieldFormatter;
date: FieldFormatter;
string: FieldFormatter;
};

export type FieldTypes = keyof FieldFormatters;

/**
* A mapping of field types to their rendering function.
* This mapping is used when a field is not defined in SPECIAL_FIELDS
* This mapping should match the output sentry.utils.snuba:get_json_type
*/
export const FIELD_FORMATTERS = {
export const FIELD_FORMATTERS: FieldFormatters = {
boolean: {
sortField: true,
renderFunc: (field, data, {organization, location}) => {
Expand Down Expand Up @@ -160,12 +184,31 @@ export const FIELD_FORMATTERS = {
},
};

type SpecialFieldRenderFunc = (
data: EventData,
baggage: RenderFunctionBaggage
) => React.ReactNode;

type SpecialField = {
sortField: string | null;
renderFunc: SpecialFieldRenderFunc;
};

type SpecialFields = {
transaction: SpecialField;
title: SpecialField;
'event.type': SpecialField;
project: SpecialField;
user: SpecialField;
last_seen: SpecialField;
};

/**
* "Special fields" do not map 1:1 to an single column in the event database,
* they are a UI concept that combines the results of multiple fields and
* displays with a custom render function.
*/
export const SPECIAL_FIELDS = {
export const SPECIAL_FIELDS: SpecialFields = {
transaction: {
sortField: 'transaction',
renderFunc: (data, {location}) => {
Expand Down Expand Up @@ -203,7 +246,7 @@ export const SPECIAL_FIELDS = {
);
},
},
type: {
'event.type': {
Copy link
Member

Choose a reason for hiding this comment

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

Why did this need to change?

Copy link
Member Author

@dashed dashed Aug 27, 2019

Choose a reason for hiding this comment

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

I double checked again and this change allowed the sort to work properly in light of the new changes.

sortField: 'event.type',
renderFunc: (data, {location}) => {
const target = {
Expand All @@ -218,7 +261,7 @@ export const SPECIAL_FIELDS = {
},
},
project: {
sortField: false,
sortField: null,
renderFunc: (data, {organization}) => {
const project = organization.projects.find(p => p.slug === data['project.name']);
return (
Expand Down
Loading