@bundle-stats/ui 3.2.1-alpha.0 → 3.2.1-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -1
- package/lib/utils.js +6 -3
- package/lib-esm/app/app.js +60 -50
- package/lib-esm/app/header/header.js +22 -19
- package/lib-esm/components/asset-info/asset-info.js +8 -6
- package/lib-esm/components/bundle-assets/bundle-assets.js +93 -80
- package/lib-esm/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.js +15 -12
- package/lib-esm/components/bundle-assets-totals-table/bundle-assets-totals-table.js +6 -5
- package/lib-esm/components/bundle-modules/bundle-modules.js +82 -67
- package/lib-esm/components/bundle-modules/bundle-modules.utils.js +9 -6
- package/lib-esm/components/bundle-modules/index.js +6 -3
- package/lib-esm/components/bundle-packages/bundle-packages.js +29 -24
- package/lib-esm/components/component-link.js +7 -6
- package/lib-esm/components/delta/delta.js +7 -6
- package/lib-esm/components/job-meta/job-meta.js +5 -4
- package/lib-esm/components/job-name/job-name.js +14 -11
- package/lib-esm/components/metric/metric.js +10 -9
- package/lib-esm/components/metrics-table/metrics-table.js +24 -20
- package/lib-esm/components/metrics-table-options/metrics-table-options.js +7 -5
- package/lib-esm/components/summary/summary.js +44 -32
- package/lib-esm/components/summary/summary.stories.js +11 -8
- package/lib-esm/components/summary-item/summary-item.js +18 -15
- package/lib-esm/components/total-size-type-title/total-size-type-title.js +17 -14
- package/lib-esm/hooks/rows-filter.js +7 -6
- package/lib-esm/hooks/rows-sort.js +8 -7
- package/lib-esm/hooks/search-params.js +73 -69
- package/lib-esm/layout/footer/footer.js +33 -30
- package/lib-esm/layout/header/header.js +17 -14
- package/lib-esm/layout/header/header.stories.js +45 -30
- package/lib-esm/prototypes/typography.stories.js +5 -4
- package/lib-esm/stories/wrapper.js +20 -14
- package/lib-esm/ui/container/container.js +12 -9
- package/lib-esm/ui/dropdown/dropdown.stories.js +9 -6
- package/lib-esm/ui/file-name/file-name.js +10 -7
- package/lib-esm/ui/filters/filters.container.js +14 -8
- package/lib-esm/ui/filters/filters.js +41 -19
- package/lib-esm/ui/filters/filters.stories.js +4 -3
- package/lib-esm/ui/filters/filters.utils.js +12 -6
- package/lib-esm/ui/horizontal-bar-chart/horizontal-bar-chart.js +7 -6
- package/lib-esm/ui/icon/icon.js +16 -13
- package/lib-esm/ui/input/input.js +6 -5
- package/lib-esm/ui/loader/loader.js +10 -7
- package/lib-esm/ui/logo/logo.js +7 -6
- package/lib-esm/ui/logo/logo.stories.js +7 -1
- package/lib-esm/ui/panels/panels.js +10 -7
- package/lib-esm/ui/popover/popover.js +8 -7
- package/lib-esm/ui/sort-dropdown/sort-dropdown.js +10 -7
- package/lib-esm/ui/table/table.js +8 -7
- package/lib-esm/ui/tabs/tabs.js +9 -6
- package/lib-esm/ui/toolbar/toolbar.stories.js +10 -7
- package/lib-esm/utils.js +13 -4
- package/package.json +14 -14
- package/src/utils.jsx +5 -3
|
@@ -25,12 +25,14 @@ import { MetricsTableTitle } from '../metrics-table-title';
|
|
|
25
25
|
import { ModuleInfo } from '../module-info';
|
|
26
26
|
import css from './bundle-modules.module.css';
|
|
27
27
|
|
|
28
|
-
const RowHeader =
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
const RowHeader = _ref => {
|
|
29
|
+
let {
|
|
30
|
+
row,
|
|
31
|
+
chunks,
|
|
32
|
+
labels,
|
|
33
|
+
CustomComponentLink
|
|
34
|
+
} = _ref;
|
|
35
|
+
|
|
34
36
|
const chunkIds = _map(chunks, 'id');
|
|
35
37
|
|
|
36
38
|
const [showPopopver, setPopover] = useState(false);
|
|
@@ -43,17 +45,20 @@ const RowHeader = ({
|
|
|
43
45
|
}, !showPopopver ? content : /*#__PURE__*/React.createElement(Popover, {
|
|
44
46
|
ariaLabel: "View module info",
|
|
45
47
|
label: content
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
48
|
+
}, _ref2 => {
|
|
49
|
+
let {
|
|
50
|
+
popoverToggle
|
|
51
|
+
} = _ref2;
|
|
52
|
+
return /*#__PURE__*/React.createElement(ModuleInfo, {
|
|
53
|
+
className: css.namePopover,
|
|
54
|
+
item: row,
|
|
55
|
+
chunks: chunks,
|
|
56
|
+
chunkIds: chunkIds,
|
|
57
|
+
labels: labels,
|
|
58
|
+
customComponentLink: CustomComponentLink,
|
|
59
|
+
onClick: popoverToggle
|
|
60
|
+
});
|
|
61
|
+
}));
|
|
57
62
|
};
|
|
58
63
|
|
|
59
64
|
RowHeader.propTypes = {
|
|
@@ -71,35 +76,39 @@ RowHeader.defaultProps = {
|
|
|
71
76
|
chunks: []
|
|
72
77
|
};
|
|
73
78
|
|
|
74
|
-
const getRenderRowHeader =
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
79
|
+
const getRenderRowHeader = _ref3 => {
|
|
80
|
+
let {
|
|
81
|
+
labels,
|
|
82
|
+
chunks,
|
|
83
|
+
CustomComponentLink
|
|
84
|
+
} = _ref3;
|
|
85
|
+
return row => /*#__PURE__*/React.createElement(RowHeader, {
|
|
86
|
+
row: row,
|
|
87
|
+
chunks: chunks,
|
|
88
|
+
labels: labels,
|
|
89
|
+
CustomComponentLink: CustomComponentLink
|
|
90
|
+
});
|
|
91
|
+
};
|
|
84
92
|
|
|
85
|
-
export const BundleModules =
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
93
|
+
export const BundleModules = _ref4 => {
|
|
94
|
+
let {
|
|
95
|
+
className,
|
|
96
|
+
jobs,
|
|
97
|
+
items,
|
|
98
|
+
chunks,
|
|
99
|
+
totalRowCount,
|
|
100
|
+
updateFilters,
|
|
101
|
+
resetFilters,
|
|
102
|
+
resetAllFilters,
|
|
103
|
+
filters,
|
|
104
|
+
sortFields,
|
|
105
|
+
sort,
|
|
106
|
+
updateSort,
|
|
107
|
+
search,
|
|
108
|
+
updateSearch,
|
|
109
|
+
hasActiveFilters,
|
|
110
|
+
customComponentLink: CustomComponentLink
|
|
111
|
+
} = _ref4;
|
|
103
112
|
const rootClassName = cx(css.root, className);
|
|
104
113
|
const labels = useMemo(() => _map(jobs, 'label'), [jobs]);
|
|
105
114
|
const renderRowHeader = useMemo(() => getRenderRowHeader({
|
|
@@ -134,15 +143,18 @@ export const BundleModules = ({
|
|
|
134
143
|
...(!_isEmpty(chunks) && {
|
|
135
144
|
[MODULE_CHUNK]: {
|
|
136
145
|
label: 'Chunk',
|
|
137
|
-
...chunks.reduce((chunkFilters, {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
+
...chunks.reduce((chunkFilters, _ref5) => {
|
|
147
|
+
let {
|
|
148
|
+
id,
|
|
149
|
+
name
|
|
150
|
+
} = _ref5;
|
|
151
|
+
return { ...chunkFilters,
|
|
152
|
+
[id]: {
|
|
153
|
+
label: name,
|
|
154
|
+
defaultValue: _get(filters, `${MODULE_CHUNK}.${id}`, true)
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
}, {})
|
|
146
158
|
}
|
|
147
159
|
}),
|
|
148
160
|
// Module source types
|
|
@@ -160,19 +172,22 @@ export const BundleModules = ({
|
|
|
160
172
|
className: rootClassName
|
|
161
173
|
}, /*#__PURE__*/React.createElement(Toolbar, {
|
|
162
174
|
className: css.toolbar,
|
|
163
|
-
renderActions:
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
175
|
+
renderActions: _ref6 => {
|
|
176
|
+
let {
|
|
177
|
+
actionClassName
|
|
178
|
+
} = _ref6;
|
|
179
|
+
return /*#__PURE__*/React.createElement(FlexStack, {
|
|
180
|
+
space: "xxsmall",
|
|
181
|
+
className: cx(css.dropdown, actionClassName)
|
|
182
|
+
}, /*#__PURE__*/React.createElement(SortDropdown, _extends({
|
|
183
|
+
className: css.tableDropdown,
|
|
184
|
+
fields: sortFields,
|
|
185
|
+
onChange: updateSort
|
|
186
|
+
}, sort)), /*#__PURE__*/React.createElement(MetricsTableOptions, {
|
|
187
|
+
handleViewAll: resetAllFilters,
|
|
188
|
+
handleResetFilters: resetFilters
|
|
189
|
+
}));
|
|
190
|
+
}
|
|
176
191
|
}, /*#__PURE__*/React.createElement(FlexStack, null, /*#__PURE__*/React.createElement(MetricsTableSearch, {
|
|
177
192
|
className: css.toolbarSearch,
|
|
178
193
|
search: search,
|
|
@@ -49,11 +49,12 @@ export const getRowFilter = filters => row => {
|
|
|
49
49
|
|
|
50
50
|
return true;
|
|
51
51
|
};
|
|
52
|
-
export const useModuleFilterByChunk =
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
export const useModuleFilterByChunk = _ref => {
|
|
53
|
+
let {
|
|
54
|
+
jobs,
|
|
55
|
+
filters,
|
|
56
|
+
chunkIds
|
|
57
|
+
} = _ref;
|
|
57
58
|
const filteredJobs = useMemo(() => {
|
|
58
59
|
// List of chunkIds with filter value set to `true`
|
|
59
60
|
const includedChunkIds = chunkIds.reduce((agg, chunkId) => {
|
|
@@ -74,7 +75,9 @@ export const useModuleFilterByChunk = ({
|
|
|
74
75
|
const {
|
|
75
76
|
modules
|
|
76
77
|
} = (job == null ? void 0 : (_job$metrics = job.metrics) == null ? void 0 : _job$metrics.webpack) || {};
|
|
77
|
-
const filteredModules = Object.entries(modules).reduce((agg,
|
|
78
|
+
const filteredModules = Object.entries(modules).reduce((agg, _ref2) => {
|
|
79
|
+
let [moduleId, moduleEntry] = _ref2;
|
|
80
|
+
|
|
78
81
|
const match = _intersection(moduleEntry.chunkIds, includedChunkIds);
|
|
79
82
|
|
|
80
83
|
if (match.length > 0) {
|
|
@@ -28,9 +28,12 @@ export const BundleModules = props => {
|
|
|
28
28
|
var _job$meta, _job$meta$webpack;
|
|
29
29
|
|
|
30
30
|
return (job == null ? void 0 : (_job$meta = job.meta) == null ? void 0 : (_job$meta$webpack = _job$meta.webpack) == null ? void 0 : _job$meta$webpack.chunks) || [];
|
|
31
|
-
}).flat(),
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
}).flat(), _ref => {
|
|
32
|
+
let {
|
|
33
|
+
id
|
|
34
|
+
} = _ref;
|
|
35
|
+
return id;
|
|
36
|
+
});
|
|
34
37
|
|
|
35
38
|
const chunkIds = _map(chunks, 'id');
|
|
36
39
|
|
|
@@ -21,13 +21,14 @@ import { MetricsTableOptions } from '../metrics-table-options';
|
|
|
21
21
|
import { MetricsTableTitle } from '../metrics-table-title';
|
|
22
22
|
import css from './bundle-packages.module.css';
|
|
23
23
|
|
|
24
|
-
const PackagePopoverContent =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
const PackagePopoverContent = _ref => {
|
|
25
|
+
let {
|
|
26
|
+
name,
|
|
27
|
+
fullName,
|
|
28
|
+
path,
|
|
29
|
+
duplicate,
|
|
30
|
+
CustomComponentLink
|
|
31
|
+
} = _ref;
|
|
31
32
|
const normalizedPackagePath = path || `node_modules/${fullName.split(PACKAGES_SEPARATOR).join('/node_modules/')}/`;
|
|
32
33
|
const [normalizedName, packageId] = name.split(PACKAGE_ID_SEPARATOR);
|
|
33
34
|
return /*#__PURE__*/React.createElement(Stack, {
|
|
@@ -75,10 +76,11 @@ PackagePopoverContent.defaultProps = {
|
|
|
75
76
|
path: ''
|
|
76
77
|
};
|
|
77
78
|
|
|
78
|
-
const PackageRowHeader =
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
const PackageRowHeader = _ref2 => {
|
|
80
|
+
let {
|
|
81
|
+
item,
|
|
82
|
+
CustomComponentLink
|
|
83
|
+
} = _ref2;
|
|
82
84
|
const packageNames = item.label.split(PACKAGES_SEPARATOR);
|
|
83
85
|
const {
|
|
84
86
|
path
|
|
@@ -147,19 +149,22 @@ export const BundlePackages = props => {
|
|
|
147
149
|
className: cx(css.root, className)
|
|
148
150
|
}, /*#__PURE__*/React.createElement(Toolbar, {
|
|
149
151
|
className: css.toolbar,
|
|
150
|
-
renderActions:
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
152
|
+
renderActions: _ref3 => {
|
|
153
|
+
let {
|
|
154
|
+
actionClassName
|
|
155
|
+
} = _ref3;
|
|
156
|
+
return /*#__PURE__*/React.createElement(FlexStack, {
|
|
157
|
+
space: "xxsmall",
|
|
158
|
+
className: cx(css.dropdown, actionClassName)
|
|
159
|
+
}, /*#__PURE__*/React.createElement(SortDropdown, _extends({
|
|
160
|
+
fields: sortFields
|
|
161
|
+
}, sort, {
|
|
162
|
+
onChange: updateSort
|
|
163
|
+
})), /*#__PURE__*/React.createElement(MetricsTableOptions, {
|
|
164
|
+
handleViewAll: resetAllFilters,
|
|
165
|
+
handleResetFilters: resetFilters
|
|
166
|
+
}));
|
|
167
|
+
}
|
|
163
168
|
}, /*#__PURE__*/React.createElement(FlexStack, null, /*#__PURE__*/React.createElement(MetricsTableSearch, {
|
|
164
169
|
className: css.toolbarSearch,
|
|
165
170
|
placeholder: "Search by name",
|
|
@@ -5,12 +5,13 @@ import PropTypes from 'prop-types';
|
|
|
5
5
|
import { Link } from 'react-router-dom';
|
|
6
6
|
import { getComponentStateQueryString } from '@bundle-stats/utils';
|
|
7
7
|
import { SECTION_URLS } from '../constants';
|
|
8
|
-
export const ComponentLink =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
export const ComponentLink = _ref => {
|
|
9
|
+
let {
|
|
10
|
+
section,
|
|
11
|
+
title,
|
|
12
|
+
params,
|
|
13
|
+
...props
|
|
14
|
+
} = _ref;
|
|
14
15
|
const search = getComponentStateQueryString(params);
|
|
15
16
|
const location = {
|
|
16
17
|
pathname: SECTION_URLS[section],
|
|
@@ -2,12 +2,13 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import cx from 'classnames';
|
|
4
4
|
import css from './delta.module.css';
|
|
5
|
-
export const Delta =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
export const Delta = _ref => {
|
|
6
|
+
let {
|
|
7
|
+
className,
|
|
8
|
+
displayValue,
|
|
9
|
+
deltaType,
|
|
10
|
+
inverted
|
|
11
|
+
} = _ref;
|
|
11
12
|
const rootClassName = cx(css.root, className, inverted && css.inverted, css[deltaType]);
|
|
12
13
|
return /*#__PURE__*/React.createElement("span", {
|
|
13
14
|
className: rootClassName
|
|
@@ -14,10 +14,11 @@ export const JobMeta = props => {
|
|
|
14
14
|
const rootClassName = cx(css.root, className);
|
|
15
15
|
return /*#__PURE__*/React.createElement(Component, _extends({
|
|
16
16
|
className: rootClassName
|
|
17
|
-
}, restProps), meta.map(({
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
}, restProps), meta.map((_ref, index) => {
|
|
18
|
+
let {
|
|
19
|
+
title,
|
|
20
|
+
content
|
|
21
|
+
} = _ref;
|
|
21
22
|
const key = index;
|
|
22
23
|
return /*#__PURE__*/React.createElement("div", {
|
|
23
24
|
className: css.item,
|
|
@@ -4,17 +4,20 @@ import React from 'react';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { Tooltip } from '../../ui/tooltip';
|
|
6
6
|
import css from './job-name.module.css';
|
|
7
|
-
export const JobName =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
export const JobName = _ref => {
|
|
8
|
+
let {
|
|
9
|
+
as: Component,
|
|
10
|
+
title,
|
|
11
|
+
internalBuildNumber,
|
|
12
|
+
children,
|
|
13
|
+
...restProps
|
|
14
|
+
} = _ref;
|
|
15
|
+
return /*#__PURE__*/React.createElement(Tooltip, _extends({
|
|
16
|
+
className: css.root,
|
|
17
|
+
as: Component,
|
|
18
|
+
title: title
|
|
19
|
+
}, restProps), children || `Job #${internalBuildNumber}`);
|
|
20
|
+
};
|
|
18
21
|
JobName.defaultProps = {
|
|
19
22
|
as: 'span',
|
|
20
23
|
title: '',
|
|
@@ -4,15 +4,16 @@ import cx from 'classnames';
|
|
|
4
4
|
import styles from './metric.module.css'; // Separate value and unit
|
|
5
5
|
|
|
6
6
|
const EXTRACT_VALUE_UNIT_PATTERN = /([\d|.|,| ]*)(\w*|%)$/;
|
|
7
|
-
export const Metric =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
export const Metric = _ref => {
|
|
8
|
+
let {
|
|
9
|
+
className,
|
|
10
|
+
value,
|
|
11
|
+
formatter,
|
|
12
|
+
inline,
|
|
13
|
+
anchored,
|
|
14
|
+
children,
|
|
15
|
+
enhanced
|
|
16
|
+
} = _ref;
|
|
16
17
|
const formattedValue = formatter(value); // eslint-disable-next-line no-unused-vars
|
|
17
18
|
|
|
18
19
|
const [matched, displayValue, displayUnit] = enhanced && formattedValue ? formattedValue.match(EXTRACT_VALUE_UNIT_PATTERN) : [null, formattedValue, null];
|
|
@@ -125,16 +125,17 @@ const getRows = (runs, items, renderRowHeader) => items.map((item, index) => {
|
|
|
125
125
|
};
|
|
126
126
|
});
|
|
127
127
|
|
|
128
|
-
export const MetricsTable =
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
128
|
+
export const MetricsTable = _ref => {
|
|
129
|
+
let {
|
|
130
|
+
className,
|
|
131
|
+
renderRowHeader,
|
|
132
|
+
runs,
|
|
133
|
+
items,
|
|
134
|
+
emptyMessage,
|
|
135
|
+
showHeaderSum,
|
|
136
|
+
headerRows,
|
|
137
|
+
title
|
|
138
|
+
} = _ref;
|
|
138
139
|
const {
|
|
139
140
|
headers,
|
|
140
141
|
columnClassNames
|
|
@@ -161,16 +162,19 @@ export const MetricsTable = ({
|
|
|
161
162
|
return /*#__PURE__*/React.createElement(Table.Tr, {
|
|
162
163
|
className: rowClassName
|
|
163
164
|
}, cells.map(header => /*#__PURE__*/React.createElement(Table.Th, header)));
|
|
164
|
-
})), /*#__PURE__*/React.createElement(Table.TBody, null, !_isEmpty(rows) ? rows.map(
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
165
|
+
})), /*#__PURE__*/React.createElement(Table.TBody, null, !_isEmpty(rows) ? rows.map(_ref2 => {
|
|
166
|
+
let {
|
|
167
|
+
key,
|
|
168
|
+
className: rowClassName,
|
|
169
|
+
cells
|
|
170
|
+
} = _ref2;
|
|
171
|
+
return /*#__PURE__*/React.createElement(Table.Tr, {
|
|
172
|
+
key: key,
|
|
173
|
+
className: rowClassName
|
|
174
|
+
}, cells.map((cell, index) => /*#__PURE__*/React.createElement(Table.Td, {
|
|
175
|
+
className: columnClassNames[index]
|
|
176
|
+
}, cell)));
|
|
177
|
+
}) : /*#__PURE__*/React.createElement(Table.Tr, null, /*#__PURE__*/React.createElement(Table.Td, {
|
|
174
178
|
className: styles.empty,
|
|
175
179
|
colSpan: (columnClassNames == null ? void 0 : columnClassNames.length) || 1
|
|
176
180
|
}, emptyMessage))));
|
|
@@ -14,11 +14,13 @@ export const MetricsTableOptions = props => {
|
|
|
14
14
|
return /*#__PURE__*/React.createElement(Dropdown, _extends({
|
|
15
15
|
className: className,
|
|
16
16
|
glyph: "menu"
|
|
17
|
-
}, restProps),
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
}, restProps), _ref => {
|
|
18
|
+
let {
|
|
19
|
+
MenuItem,
|
|
20
|
+
menu,
|
|
21
|
+
menuItemClassName
|
|
22
|
+
} = _ref;
|
|
23
|
+
|
|
22
24
|
const getButtonOnClick = handler => () => {
|
|
23
25
|
handler();
|
|
24
26
|
menu.toggle();
|
|
@@ -12,38 +12,50 @@ import { FlexStack } from '../../layout/flex-stack';
|
|
|
12
12
|
import { ComponentLink } from '../component-link';
|
|
13
13
|
import { SummaryItem } from '../summary-item';
|
|
14
14
|
import css from './summary.module.css';
|
|
15
|
-
export const Summary =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}))
|
|
15
|
+
export const Summary = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
className,
|
|
18
|
+
size,
|
|
19
|
+
keys,
|
|
20
|
+
data,
|
|
21
|
+
loading,
|
|
22
|
+
showSummaryItemDelta,
|
|
23
|
+
summaryItemLink: SummaryItemCustomLink
|
|
24
|
+
} = _ref;
|
|
25
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
26
|
+
outline: true,
|
|
27
|
+
className: cx(css.root, className)
|
|
28
|
+
}, /*#__PURE__*/React.createElement(FlexStack, {
|
|
29
|
+
className: css.items
|
|
30
|
+
}, Array.from(METRIC_COMPONENT_LINKS).filter(_ref2 => {
|
|
31
|
+
let [metricId] = _ref2;
|
|
32
|
+
return keys.includes(metricId);
|
|
33
|
+
}).map(_ref3 => {
|
|
34
|
+
let [metricId, metricOptions] = _ref3;
|
|
35
|
+
return /*#__PURE__*/React.createElement(SummaryItem, {
|
|
36
|
+
as: _ref4 => {
|
|
37
|
+
let {
|
|
38
|
+
className: itemClassName,
|
|
39
|
+
...itemProps
|
|
40
|
+
} = _ref4;
|
|
41
|
+
return /*#__PURE__*/React.createElement(Box, _extends({
|
|
42
|
+
padding: ['xsmall', 'small'],
|
|
43
|
+
className: cx(itemClassName, css.summaryItemLink)
|
|
44
|
+
}, itemProps, {
|
|
45
|
+
as: SummaryItemCustomLink
|
|
46
|
+
}, metricOptions.link));
|
|
47
|
+
},
|
|
48
|
+
size: size,
|
|
49
|
+
key: metricId,
|
|
50
|
+
id: metricId,
|
|
51
|
+
data: _get(data, metricId),
|
|
52
|
+
loading: loading,
|
|
53
|
+
showMetricDescription: true,
|
|
54
|
+
showDelta: showSummaryItemDelta && metricOptions.showDelta !== false,
|
|
55
|
+
className: css.item
|
|
56
|
+
});
|
|
57
|
+
})));
|
|
58
|
+
};
|
|
47
59
|
Summary.defaultProps = {
|
|
48
60
|
className: '',
|
|
49
61
|
data: null,
|
|
@@ -34,12 +34,15 @@ stories.add('single run', () => /*#__PURE__*/React.createElement(Summary, {
|
|
|
34
34
|
}));
|
|
35
35
|
stories.add('with link', () => /*#__PURE__*/React.createElement(Summary, {
|
|
36
36
|
data: MULTIPLE_JOBS[0].summary,
|
|
37
|
-
summaryItemLink:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
summaryItemLink: _ref => {
|
|
38
|
+
let {
|
|
39
|
+
keyProps,
|
|
40
|
+
...props
|
|
41
|
+
} = _ref;
|
|
42
|
+
return /*#__PURE__*/React.createElement("button", _extends({
|
|
43
|
+
type: "button"
|
|
44
|
+
}, props, {
|
|
45
|
+
onClick: () => alert(JSON.stringify(keyProps))
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
45
48
|
}));
|
|
@@ -12,10 +12,12 @@ import { Metric } from '../metric';
|
|
|
12
12
|
import { Delta } from '../delta';
|
|
13
13
|
import css from './summary-item.module.css';
|
|
14
14
|
|
|
15
|
-
const MetricInfo =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
const MetricInfo = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
description,
|
|
18
|
+
url
|
|
19
|
+
} = _ref;
|
|
20
|
+
|
|
19
21
|
// Workaround cases where the parent is a link
|
|
20
22
|
const readMoreOnClick = () => {
|
|
21
23
|
window.open(url);
|
|
@@ -37,17 +39,18 @@ MetricInfo.propTypes = {
|
|
|
37
39
|
MetricInfo.defaultProps = {
|
|
38
40
|
url: ''
|
|
39
41
|
};
|
|
40
|
-
export const SummaryItem =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
42
|
+
export const SummaryItem = _ref2 => {
|
|
43
|
+
let {
|
|
44
|
+
className,
|
|
45
|
+
as: Component,
|
|
46
|
+
size,
|
|
47
|
+
id,
|
|
48
|
+
data,
|
|
49
|
+
loading,
|
|
50
|
+
showDelta,
|
|
51
|
+
showMetricDescription,
|
|
52
|
+
...props
|
|
53
|
+
} = _ref2;
|
|
51
54
|
const {
|
|
52
55
|
baseline,
|
|
53
56
|
current
|