@bundle-stats/ui 3.1.4-alpha.0 → 3.2.1-alpha.0
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/.babelrc.js +3 -3
- package/CHANGELOG.md +18 -1
- package/lib/app/app.js +2 -1
- package/lib/app/app.stories.js +2 -1
- package/lib/assets/icons/arrow.svg +1 -0
- package/lib/assets/icons/cancel.svg +1 -0
- package/lib/assets/icons/clock.svg +1 -0
- package/lib/assets/icons/close.svg +1 -0
- package/lib/assets/icons/commit.svg +1 -0
- package/lib/assets/icons/filter.svg +1 -0
- package/lib/assets/icons/help.svg +1 -0
- package/lib/assets/icons/menu.svg +1 -0
- package/lib/{ui/icon/assets → assets/icons}/sort.svg +0 -0
- package/lib/assets/icons/warning.svg +1 -0
- package/lib/assets/icons.svg +1 -0
- package/lib/components/bundle-assets/bundle-assets.constants.js +1 -1
- package/lib/components/bundle-assets/bundle-assets.js +3 -3
- package/lib/components/bundle-assets/bundle-assets.stories.js +19 -7
- package/lib/components/bundle-assets/bundle-assets.utils.js +95 -28
- package/lib/components/bundle-assets/index.js +115 -4
- package/lib/components/bundle-modules/bundle-modules.constants.js +1 -1
- package/lib/components/bundle-modules/bundle-modules.js +3 -3
- package/lib/components/bundle-modules/bundle-modules.utils.js +152 -0
- package/lib/components/bundle-modules/index.js +135 -4
- package/lib/components/bundle-packages/bundle-packages.constants.js +1 -1
- package/lib/components/bundle-packages/bundle-packages.js +27 -7
- package/lib/components/bundle-packages/bundle-packages.module.css +5 -0
- package/lib/components/bundle-packages/{bundle-packages.container.js → bundle-packages.utils.js} +8 -42
- package/lib/components/bundle-packages/index.js +111 -3
- package/lib/components/duplicate-packages-warning/duplicate-packages-warning.js +7 -4
- package/lib/components/duplicate-packages-warning/duplicate-packages-warning.stories.js +4 -3
- package/lib/components/index.js +18 -18
- package/lib/components/metrics-table/metrics-table.js +3 -7
- package/lib/components/metrics-table-search/metrics-table-search.js +2 -1
- package/lib/components/metrics-table-search/metrics-table-search.module.css +2 -1
- package/lib/constants.js +1 -1
- package/lib/hooks/rows-filter.js +28 -0
- package/lib/hooks/rows-sort.js +54 -0
- package/lib/{hocs/with-search.js → hooks/search-params.js} +15 -64
- package/lib/layout/index.js +8 -8
- package/lib/ui/icon/icon.js +4 -191
- package/lib/ui/logo/logo.constants.js +1 -1
- package/lib/ui/popover/popover.js +3 -1
- package/lib/ui/popover/popover.module.css +3 -3
- package/lib/ui/sort-dropdown/sort-dropdown.js +12 -13
- package/lib/ui/sort-dropdown/sort-dropdown.stories.js +2 -2
- package/lib/ui/tooltip/tooltip.js +2 -1
- package/lib-esm/app/app.js +89 -108
- package/lib-esm/app/app.stories.js +50 -70
- package/lib-esm/app/header/header.js +19 -20
- package/lib-esm/assets/icons/arrow.svg +1 -0
- package/lib-esm/assets/icons/cancel.svg +1 -0
- package/lib-esm/assets/icons/clock.svg +1 -0
- package/lib-esm/assets/icons/close.svg +1 -0
- package/lib-esm/assets/icons/commit.svg +1 -0
- package/lib-esm/assets/icons/filter.svg +1 -0
- package/lib-esm/assets/icons/help.svg +1 -0
- package/lib-esm/assets/icons/menu.svg +1 -0
- package/lib-esm/{ui/icon/assets → assets/icons}/sort.svg +0 -0
- package/lib-esm/assets/icons/warning.svg +1 -0
- package/lib-esm/assets/icons.svg +1 -0
- package/lib-esm/components/asset-info/asset-info.js +20 -18
- package/lib-esm/components/asset-info/asset-info.stories.js +29 -33
- package/lib-esm/components/browsertime-table/browsertime-table.js +6 -4
- package/lib-esm/components/browsertime-table/browsertime-table.stories.js +9 -13
- package/lib-esm/components/bundle-assets/bundle-assets.constants.js +17 -15
- package/lib-esm/components/bundle-assets/bundle-assets.js +148 -151
- package/lib-esm/components/bundle-assets/bundle-assets.stories.js +58 -63
- package/lib-esm/components/bundle-assets/bundle-assets.utils.js +65 -21
- package/lib-esm/components/bundle-assets/index.js +89 -2
- package/lib-esm/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.js +46 -51
- package/lib-esm/components/bundle-assets-totals-chart-bars/bundle-assets-totals-chart-bars.stories.js +9 -13
- package/lib-esm/components/bundle-assets-totals-table/bundle-assets-totals-table.js +13 -13
- package/lib-esm/components/bundle-assets-totals-table/bundle-assets-totals-table.stories.js +13 -19
- package/lib-esm/components/bundle-modules/bundle-modules.constants.js +17 -15
- package/lib-esm/components/bundle-modules/bundle-modules.js +120 -133
- package/lib-esm/components/bundle-modules/bundle-modules.stories.js +46 -58
- package/lib-esm/components/bundle-modules/bundle-modules.utils.js +95 -0
- package/lib-esm/components/bundle-modules/index.js +111 -3
- package/lib-esm/components/bundle-packages/bundle-packages.constants.js +17 -15
- package/lib-esm/components/bundle-packages/bundle-packages.js +81 -77
- package/lib-esm/components/bundle-packages/bundle-packages.module.css +5 -0
- package/lib-esm/components/bundle-packages/bundle-packages.stories.js +34 -46
- package/lib-esm/components/bundle-packages/bundle-packages.utils.js +44 -0
- package/lib-esm/components/bundle-packages/index.js +87 -2
- package/lib-esm/components/component-link.js +9 -13
- package/lib-esm/components/delta/delta.js +7 -6
- package/lib-esm/components/delta/delta.stories.js +26 -38
- package/lib-esm/components/duplicate-packages-warning/duplicate-packages-warning.js +15 -10
- package/lib-esm/components/duplicate-packages-warning/duplicate-packages-warning.stories.js +20 -25
- package/lib-esm/components/job-header/job-header.js +14 -11
- package/lib-esm/components/job-header/job-header.stories.js +12 -18
- package/lib-esm/components/job-meta/job-meta.js +14 -18
- package/lib-esm/components/job-meta/job-meta.stories.js +10 -12
- package/lib-esm/components/job-name/job-name.js +11 -17
- package/lib-esm/components/job-name/job-name.stories.js +15 -23
- package/lib-esm/components/jobs-header/jobs-header.js +12 -12
- package/lib-esm/components/jobs-header/jobs-header.stories.js +80 -86
- package/lib-esm/components/lighthouse-table/lighthouse-table.js +6 -4
- package/lib-esm/components/lighthouse-table/lighthouse-table.stories.js +10 -14
- package/lib-esm/components/metric/metric.js +14 -19
- package/lib-esm/components/metric/metric.stories.js +36 -58
- package/lib-esm/components/metrics-table/metrics-table.js +128 -143
- package/lib-esm/components/metrics-table/metrics-table.stories.js +27 -35
- package/lib-esm/components/metrics-table-options/metrics-table-options.js +15 -20
- package/lib-esm/components/metrics-table-options/metrics-table-options.stories.js +6 -12
- package/lib-esm/components/metrics-table-search/metrics-table-search.js +17 -18
- package/lib-esm/components/metrics-table-search/metrics-table-search.module.css +2 -1
- package/lib-esm/components/metrics-table-search/metrics-table-search.stories.js +4 -9
- package/lib-esm/components/metrics-table-title/metrics-table-title.js +9 -7
- package/lib-esm/components/module-info/module-info.js +15 -13
- package/lib-esm/components/module-info/module-info.stories.js +20 -22
- package/lib-esm/components/summary/summary.js +38 -52
- package/lib-esm/components/summary/summary.stories.js +28 -46
- package/lib-esm/components/summary-item/summary-item.js +25 -29
- package/lib-esm/components/summary-item/summary-item.stories.js +40 -50
- package/lib-esm/components/total-size-type-title/total-size-type-title.js +14 -15
- package/lib-esm/constants.js +25 -30
- package/lib-esm/hooks/rows-filter.js +19 -0
- package/lib-esm/hooks/rows-sort.js +21 -0
- package/lib-esm/hooks/search-params.js +166 -0
- package/lib-esm/layout/box/box.js +12 -19
- package/lib-esm/layout/box/box.stories.js +34 -46
- package/lib-esm/layout/flex-stack/flex-stack.js +9 -12
- package/lib-esm/layout/flex-stack/flex-stack.stories.js +39 -49
- package/lib-esm/layout/footer/footer.js +34 -37
- package/lib-esm/layout/footer/footer.stories.js +7 -11
- package/lib-esm/layout/header/header.js +17 -24
- package/lib-esm/layout/header/header.stories.js +34 -43
- package/lib-esm/layout/stack/stack.js +8 -6
- package/lib-esm/layout/stack/stack.stories.js +39 -49
- package/lib-esm/layout/sub-header/sub-header.js +14 -12
- package/lib-esm/layout/sub-header/sub-header.stories.js +57 -69
- package/lib-esm/prototypes/typography.stories.js +48 -58
- package/lib-esm/query-state.js +13 -16
- package/lib-esm/stories/wrapper.js +14 -26
- package/lib-esm/ui/alert/alert.js +6 -4
- package/lib-esm/ui/alert/alert.stories.js +14 -24
- package/lib-esm/ui/container/container.js +9 -15
- package/lib-esm/ui/container/container.stories.js +15 -17
- package/lib-esm/ui/dropdown/dropdown.js +13 -11
- package/lib-esm/ui/dropdown/dropdown.stories.js +19 -26
- package/lib-esm/ui/empty-set/empty-set.js +12 -12
- package/lib-esm/ui/empty-set/empty-set.stories.js +11 -19
- package/lib-esm/ui/file-name/file-name.js +7 -8
- package/lib-esm/ui/file-name/file-name.stories.js +12 -16
- package/lib-esm/ui/filters/filters.container.js +52 -77
- package/lib-esm/ui/filters/filters.js +61 -89
- package/lib-esm/ui/filters/filters.stories.js +81 -100
- package/lib-esm/ui/filters/filters.utils.js +24 -28
- package/lib-esm/ui/filters/index.js +1 -1
- package/lib-esm/ui/horizontal-bar-chart/horizontal-bar-chart.js +67 -78
- package/lib-esm/ui/horizontal-bar-chart/horizontal-bar-chart.stories.js +67 -77
- package/lib-esm/ui/icon/icon.js +14 -206
- package/lib-esm/ui/icon/icon.stories.js +16 -24
- package/lib-esm/ui/input/input.js +6 -10
- package/lib-esm/ui/input/input.stories.js +8 -12
- package/lib-esm/ui/loader/loader.js +7 -13
- package/lib-esm/ui/loader/loader.stories.js +5 -9
- package/lib-esm/ui/logo/logo.constants.js +6 -6
- package/lib-esm/ui/logo/logo.js +14 -15
- package/lib-esm/ui/logo/logo.stories.js +14 -28
- package/lib-esm/ui/panels/panels.js +14 -27
- package/lib-esm/ui/panels/panels.stories.js +14 -16
- package/lib-esm/ui/popover/popover.js +13 -10
- package/lib-esm/ui/popover/popover.module.css +3 -3
- package/lib-esm/ui/popover/popover.stories.js +7 -11
- package/lib-esm/ui/skeleton/skeleton.js +6 -9
- package/lib-esm/ui/skeleton/skeleton.stories.js +2 -4
- package/lib-esm/ui/sort-dropdown/sort-dropdown.js +36 -39
- package/lib-esm/ui/sort-dropdown/sort-dropdown.stories.js +14 -16
- package/lib-esm/ui/table/table.js +25 -31
- package/lib-esm/ui/table/table.stories.js +84 -102
- package/lib-esm/ui/tabs/tabs.js +14 -25
- package/lib-esm/ui/tabs/tabs.stories.js +4 -6
- package/lib-esm/ui/toolbar/toolbar.js +7 -5
- package/lib-esm/ui/toolbar/toolbar.stories.js +11 -16
- package/lib-esm/ui/tooltip/tooltip.js +15 -17
- package/lib-esm/ui/tooltip/tooltip.stories.js +8 -12
- package/lib-esm/utils.js +15 -28
- package/package.json +19 -27
- package/src/app/app.jsx +4 -1
- package/src/assets/icons/arrow.svg +1 -0
- package/src/assets/icons/cancel.svg +1 -0
- package/src/assets/icons/clock.svg +1 -0
- package/src/assets/icons/close.svg +1 -0
- package/src/assets/icons/commit.svg +1 -0
- package/src/assets/icons/filter.svg +1 -0
- package/src/assets/icons/help.svg +1 -0
- package/src/assets/icons/menu.svg +1 -0
- package/src/{ui/icon/assets → assets/icons}/sort.svg +0 -0
- package/src/assets/icons/warning.svg +1 -0
- package/src/assets/icons.svg +1 -0
- package/src/components/bundle-assets/bundle-assets.jsx +3 -3
- package/src/components/bundle-assets/bundle-assets.utils.js +96 -17
- package/src/components/bundle-assets/index.jsx +89 -0
- package/src/components/bundle-modules/bundle-modules.jsx +3 -3
- package/src/components/bundle-modules/bundle-modules.utils.js +101 -0
- package/src/components/bundle-modules/index.jsx +107 -0
- package/src/components/bundle-packages/bundle-packages.jsx +21 -8
- package/src/components/bundle-packages/bundle-packages.module.css +5 -0
- package/src/components/bundle-packages/bundle-packages.utils.js +47 -0
- package/src/components/bundle-packages/index.jsx +84 -0
- package/src/components/duplicate-packages-warning/duplicate-packages-warning.jsx +9 -2
- package/src/components/metrics-table/metrics-table.jsx +2 -7
- package/src/components/metrics-table-search/metrics-table-search.jsx +1 -0
- package/src/components/metrics-table-search/metrics-table-search.module.css +2 -1
- package/src/hooks/rows-filter.js +16 -0
- package/src/hooks/rows-sort.js +24 -0
- package/src/hooks/search-params.js +153 -0
- package/src/ui/icon/icon.jsx +7 -42
- package/src/ui/popover/popover.jsx +1 -1
- package/src/ui/popover/popover.module.css +3 -3
- package/src/ui/sort-dropdown/sort-dropdown.jsx +11 -11
- package/src/ui/tooltip/tooltip.jsx +1 -1
- package/lib/components/bundle-assets/bundle-assets.container.js +0 -140
- package/lib/components/bundle-modules/bundle-modules.container.js +0 -222
- package/lib/hocs/with-custom-sort.js +0 -75
- package/lib/hocs/with-filtered-items.js +0 -54
- package/lib/ui/icon/assets/arrow.svg +0 -4
- package/lib/ui/icon/assets/branch.svg +0 -3
- package/lib/ui/icon/assets/cancel.svg +0 -4
- package/lib/ui/icon/assets/clock.svg +0 -3
- package/lib/ui/icon/assets/close.svg +0 -4
- package/lib/ui/icon/assets/commit.svg +0 -3
- package/lib/ui/icon/assets/filter.svg +0 -4
- package/lib/ui/icon/assets/help.svg +0 -4
- package/lib/ui/icon/assets/job.svg +0 -3
- package/lib/ui/icon/assets/menu.svg +0 -4
- package/lib/ui/icon/assets/package.svg +0 -3
- package/lib/ui/icon/assets/pull-request.svg +0 -3
- package/lib/ui/icon/assets/repository.svg +0 -3
- package/lib/ui/icon/assets/warning.svg +0 -4
- package/lib-esm/components/bundle-assets/bundle-assets.container.js +0 -119
- package/lib-esm/components/bundle-modules/bundle-modules.container.js +0 -175
- package/lib-esm/components/bundle-packages/bundle-packages.container.js +0 -91
- package/lib-esm/hocs/with-custom-sort.js +0 -43
- package/lib-esm/hocs/with-filtered-items.js +0 -35
- package/lib-esm/hocs/with-search.js +0 -214
- package/lib-esm/ui/icon/assets/arrow.svg +0 -4
- package/lib-esm/ui/icon/assets/branch.svg +0 -3
- package/lib-esm/ui/icon/assets/cancel.svg +0 -4
- package/lib-esm/ui/icon/assets/clock.svg +0 -3
- package/lib-esm/ui/icon/assets/close.svg +0 -4
- package/lib-esm/ui/icon/assets/commit.svg +0 -3
- package/lib-esm/ui/icon/assets/filter.svg +0 -4
- package/lib-esm/ui/icon/assets/help.svg +0 -4
- package/lib-esm/ui/icon/assets/job.svg +0 -3
- package/lib-esm/ui/icon/assets/menu.svg +0 -4
- package/lib-esm/ui/icon/assets/package.svg +0 -3
- package/lib-esm/ui/icon/assets/pull-request.svg +0 -3
- package/lib-esm/ui/icon/assets/repository.svg +0 -3
- package/lib-esm/ui/icon/assets/warning.svg +0 -4
- package/src/components/bundle-assets/bundle-assets.container.js +0 -146
- package/src/components/bundle-assets/index.js +0 -4
- package/src/components/bundle-modules/bundle-modules.container.js +0 -158
- package/src/components/bundle-modules/index.js +0 -4
- package/src/components/bundle-packages/bundle-packages.container.js +0 -93
- package/src/components/bundle-packages/index.js +0 -4
- package/src/hocs/with-custom-sort.jsx +0 -35
- package/src/hocs/with-filtered-items.jsx +0 -34
- package/src/hocs/with-search.jsx +0 -184
- package/src/ui/icon/assets/arrow.svg +0 -4
- package/src/ui/icon/assets/branch.svg +0 -3
- package/src/ui/icon/assets/cancel.svg +0 -4
- package/src/ui/icon/assets/clock.svg +0 -3
- package/src/ui/icon/assets/close.svg +0 -4
- package/src/ui/icon/assets/commit.svg +0 -3
- package/src/ui/icon/assets/filter.svg +0 -4
- package/src/ui/icon/assets/help.svg +0 -4
- package/src/ui/icon/assets/job.svg +0 -3
- package/src/ui/icon/assets/menu.svg +0 -4
- package/src/ui/icon/assets/package.svg +0 -3
- package/src/ui/icon/assets/pull-request.svg +0 -3
- package/src/ui/icon/assets/repository.svg +0 -3
- package/src/ui/icon/assets/warning.svg +0 -4
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
import _map from "lodash/map";
|
|
2
2
|
import _get from "lodash/get";
|
|
3
3
|
|
|
4
|
-
var _PropTypes$shape;
|
|
5
|
-
|
|
6
4
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
7
5
|
|
|
8
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
9
|
-
|
|
10
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
11
|
-
|
|
12
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
|
-
|
|
14
6
|
import React, { useMemo } from 'react';
|
|
15
7
|
import PropTypes from 'prop-types';
|
|
16
8
|
import cx from 'classnames';
|
|
@@ -33,42 +25,36 @@ import { MetricsTableSearch } from '../metrics-table-search';
|
|
|
33
25
|
import { MetricsTableOptions } from '../metrics-table-options';
|
|
34
26
|
import { MetricsTableTitle } from '../metrics-table-title';
|
|
35
27
|
import css from './bundle-assets.module.css';
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
var getFileTypeFilters = function getFileTypeFilters(filters) {
|
|
41
|
-
return Object.entries(FILE_TYPE_LABELS).map(function (_ref) {
|
|
42
|
-
var _ref2;
|
|
28
|
+
const RUN_TITLE_CURRENT = 'Current';
|
|
29
|
+
const RUN_TITLE_BASELINE = 'Baseline';
|
|
30
|
+
const RUNS_LABELS = [RUN_TITLE_CURRENT, RUN_TITLE_BASELINE];
|
|
43
31
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}, {});
|
|
53
|
-
};
|
|
32
|
+
const getFileTypeFilters = filters => Object.entries(FILE_TYPE_LABELS).map(([id, label]) => ({
|
|
33
|
+
[id]: {
|
|
34
|
+
label,
|
|
35
|
+
defaultValue: _get(filters, `${ASSET_FILE_TYPE}.${id}`, true)
|
|
36
|
+
}
|
|
37
|
+
})).reduce((agg, current) => ({ ...agg,
|
|
38
|
+
...current
|
|
39
|
+
}), {});
|
|
54
40
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}))));
|
|
71
|
-
};
|
|
41
|
+
const TooltipNotPredictive = ({
|
|
42
|
+
runs
|
|
43
|
+
}) => /*#__PURE__*/React.createElement("div", {
|
|
44
|
+
className: css.tooltipNotPredictive
|
|
45
|
+
}, /*#__PURE__*/React.createElement("p", {
|
|
46
|
+
className: css.tooltipNotPredictiveText
|
|
47
|
+
}, "File name is the same, but the size has changed:"), /*#__PURE__*/React.createElement("table", {
|
|
48
|
+
className: css.tooltipTable
|
|
49
|
+
}, /*#__PURE__*/React.createElement("tr", null, runs.map(({
|
|
50
|
+
name,
|
|
51
|
+
value
|
|
52
|
+
}, index) => {
|
|
53
|
+
const key = index;
|
|
54
|
+
return /*#__PURE__*/React.createElement("tr", {
|
|
55
|
+
key: key
|
|
56
|
+
}, /*#__PURE__*/React.createElement("th", null, RUNS_LABELS[index]), /*#__PURE__*/React.createElement("td", null, name), /*#__PURE__*/React.createElement("td", null, value));
|
|
57
|
+
}))));
|
|
72
58
|
|
|
73
59
|
TooltipNotPredictive.defaultProps = {
|
|
74
60
|
runs: []
|
|
@@ -78,101 +64,101 @@ TooltipNotPredictive.propTypes = {
|
|
|
78
64
|
|
|
79
65
|
};
|
|
80
66
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
67
|
+
const getRenderRowHeader = ({
|
|
68
|
+
labels,
|
|
69
|
+
CustomComponentLink,
|
|
70
|
+
chunks
|
|
71
|
+
}) => item => {
|
|
72
|
+
const {
|
|
73
|
+
label,
|
|
74
|
+
isNotPredictive,
|
|
75
|
+
runs,
|
|
76
|
+
isChunk,
|
|
77
|
+
isEntry,
|
|
78
|
+
isInitial
|
|
79
|
+
} = item;
|
|
80
|
+
return /*#__PURE__*/React.createElement(Popover, {
|
|
81
|
+
label: /*#__PURE__*/React.createElement(FileName, {
|
|
82
|
+
name: label
|
|
83
|
+
}),
|
|
84
|
+
icon: /*#__PURE__*/React.createElement("div", {
|
|
85
|
+
className: css.assetInfoFlags
|
|
86
|
+
}, isNotPredictive && /*#__PURE__*/React.createElement(Tooltip, {
|
|
87
|
+
className: css.notPredictive,
|
|
88
|
+
title: /*#__PURE__*/React.createElement(TooltipNotPredictive, {
|
|
89
|
+
runs: runs
|
|
90
|
+
})
|
|
91
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
92
|
+
className: css.notPredictiveIcon,
|
|
93
|
+
glyph: "warning"
|
|
94
|
+
})), isChunk && /*#__PURE__*/React.createElement("span", {
|
|
95
|
+
title: "Chunk",
|
|
96
|
+
className: css.flagChunk
|
|
97
|
+
}, "c"), isEntry && /*#__PURE__*/React.createElement("span", {
|
|
98
|
+
title: "Entrypoint",
|
|
99
|
+
className: css.flagEntry
|
|
100
|
+
}, "e"), isInitial && /*#__PURE__*/React.createElement("span", {
|
|
101
|
+
title: "Initial",
|
|
102
|
+
className: css.flagInitial
|
|
103
|
+
}, "i"))
|
|
104
|
+
}, /*#__PURE__*/React.createElement(AssetInfo, {
|
|
105
|
+
className: css.assetInfo,
|
|
106
|
+
item: item,
|
|
107
|
+
labels: labels,
|
|
108
|
+
chunks: chunks,
|
|
109
|
+
CustomComponentLink: CustomComponentLink
|
|
110
|
+
}));
|
|
124
111
|
};
|
|
125
112
|
|
|
126
|
-
export
|
|
127
|
-
var _jobs$, _jobs$$meta, _jobs$$meta$webpack
|
|
113
|
+
export const BundleAssets = props => {
|
|
114
|
+
var _jobs$, _jobs$$meta, _jobs$$meta$webpack;
|
|
128
115
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
116
|
+
const {
|
|
117
|
+
className,
|
|
118
|
+
jobs,
|
|
119
|
+
items,
|
|
120
|
+
updateFilters,
|
|
121
|
+
resetFilters,
|
|
122
|
+
resetAllFilters,
|
|
123
|
+
totalRowCount,
|
|
124
|
+
filters,
|
|
125
|
+
hasActiveFilters,
|
|
126
|
+
sortFields,
|
|
127
|
+
sort,
|
|
128
|
+
updateSort,
|
|
129
|
+
search,
|
|
130
|
+
updateSearch,
|
|
131
|
+
customComponentLink: CustomComponentLink
|
|
132
|
+
} = props;
|
|
133
|
+
const emptyMessage = /*#__PURE__*/React.createElement(EmptySet, {
|
|
145
134
|
resources: "assets",
|
|
146
135
|
filtered: totalRowCount !== 0,
|
|
147
136
|
handleResetFilters: resetFilters,
|
|
148
137
|
handleViewAll: resetAllFilters
|
|
149
138
|
});
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
});
|
|
157
|
-
}, [jobs, chunks]);
|
|
139
|
+
const chunks = ((_jobs$ = jobs[0]) == null ? void 0 : (_jobs$$meta = _jobs$.meta) == null ? void 0 : (_jobs$$meta$webpack = _jobs$$meta.webpack) == null ? void 0 : _jobs$$meta$webpack.chunks) || [];
|
|
140
|
+
const renderRowHeader = useMemo(() => getRenderRowHeader({
|
|
141
|
+
labels: _map(jobs, 'label'),
|
|
142
|
+
CustomComponentLink,
|
|
143
|
+
chunks
|
|
144
|
+
}), [jobs, chunks]);
|
|
158
145
|
return /*#__PURE__*/React.createElement("section", {
|
|
159
146
|
className: cx(css.root, className)
|
|
160
147
|
}, /*#__PURE__*/React.createElement(Toolbar, {
|
|
161
148
|
className: css.toolbar,
|
|
162
|
-
renderActions:
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}
|
|
149
|
+
renderActions: ({
|
|
150
|
+
actionClassName
|
|
151
|
+
}) => /*#__PURE__*/React.createElement(FlexStack, {
|
|
152
|
+
space: "xsmall",
|
|
153
|
+
className: cx(css.dropdown, actionClassName)
|
|
154
|
+
}, /*#__PURE__*/React.createElement(SortDropdown, _extends({
|
|
155
|
+
fields: sortFields
|
|
156
|
+
}, sort, {
|
|
157
|
+
onChange: updateSort
|
|
158
|
+
})), /*#__PURE__*/React.createElement(MetricsTableOptions, {
|
|
159
|
+
handleViewAll: resetAllFilters,
|
|
160
|
+
handleResetFilters: resetFilters
|
|
161
|
+
}))
|
|
176
162
|
}, /*#__PURE__*/React.createElement(FlexStack, null, /*#__PURE__*/React.createElement(MetricsTableSearch, {
|
|
177
163
|
className: css.toolbarSearch,
|
|
178
164
|
placeholder: "Search by name",
|
|
@@ -180,27 +166,36 @@ export var BundleAssets = function BundleAssets(props) {
|
|
|
180
166
|
updateSearch: updateSearch
|
|
181
167
|
}), /*#__PURE__*/React.createElement(Filters, {
|
|
182
168
|
className: css.toolbarFilters,
|
|
183
|
-
filters:
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
169
|
+
filters: {
|
|
170
|
+
[ASSET_FILTERS.CHANGED]: {
|
|
171
|
+
label: 'Changed',
|
|
172
|
+
defaultValue: filters[ASSET_FILTERS.CHANGED],
|
|
173
|
+
disabled: jobs.length <= 1
|
|
174
|
+
},
|
|
175
|
+
[ASSET_ENTRY_TYPE]: {
|
|
176
|
+
label: 'Entry type',
|
|
177
|
+
[ASSET_FILTERS.ENTRY]: {
|
|
178
|
+
label: 'Entry',
|
|
179
|
+
defaultValue: _get(filters, `${ASSET_ENTRY_TYPE}.${ASSET_FILTERS.ENTRY}`, true)
|
|
180
|
+
},
|
|
181
|
+
[ASSET_FILTERS.INITIAL]: {
|
|
182
|
+
label: 'Initial',
|
|
183
|
+
defaultValue: _get(filters, `${ASSET_ENTRY_TYPE}.${ASSET_FILTERS.INITIAL}`, true)
|
|
184
|
+
},
|
|
185
|
+
[ASSET_FILTERS.CHUNK]: {
|
|
186
|
+
label: 'Chunk',
|
|
187
|
+
defaultValue: _get(filters, `${ASSET_ENTRY_TYPE}.${ASSET_FILTERS.CHUNK}`, true)
|
|
188
|
+
},
|
|
189
|
+
[ASSET_FILTERS.ASSET]: {
|
|
190
|
+
label: 'Asset',
|
|
191
|
+
defaultValue: _get(filters, `${ASSET_ENTRY_TYPE}.${ASSET_FILTERS.ASSET}`, true)
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
[ASSET_FILE_TYPE]: {
|
|
195
|
+
label: 'File type',
|
|
196
|
+
...getFileTypeFilters(filters)
|
|
197
|
+
}
|
|
198
|
+
},
|
|
204
199
|
hasActiveFilters: hasActiveFilters,
|
|
205
200
|
onChange: updateFilters
|
|
206
201
|
}))), /*#__PURE__*/React.createElement("main", null, /*#__PURE__*/React.createElement(MetricsTable, {
|
|
@@ -211,7 +206,7 @@ export var BundleAssets = function BundleAssets(props) {
|
|
|
211
206
|
showHeaderSum: true,
|
|
212
207
|
title: /*#__PURE__*/React.createElement(MetricsTableTitle, {
|
|
213
208
|
title: I18N.ASSETS,
|
|
214
|
-
info:
|
|
209
|
+
info: `(${items.length}/${totalRowCount})`,
|
|
215
210
|
popoverInfo: I18N.ASSETS_INFO,
|
|
216
211
|
popoverHref: config.documentation.assets
|
|
217
212
|
})
|
|
@@ -251,10 +246,12 @@ BundleAssets.propTypes = {
|
|
|
251
246
|
changed: PropTypes.bool
|
|
252
247
|
}).isRequired,
|
|
253
248
|
hasActiveFilters: PropTypes.bool,
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
249
|
+
sortFields: PropTypes.shape({
|
|
250
|
+
[PropTypes.string]: PropTypes.shape({
|
|
251
|
+
label: PropTypes.string,
|
|
252
|
+
defaultDirection: PropTypes.bool
|
|
253
|
+
})
|
|
254
|
+
}).isRequired,
|
|
258
255
|
search: PropTypes.string.isRequired,
|
|
259
256
|
updateSearch: PropTypes.func.isRequired,
|
|
260
257
|
sort: PropTypes.shape({
|
|
@@ -7,73 +7,68 @@ import baselineStats from '../../../__mocks__/webpack-stats.baseline.json';
|
|
|
7
7
|
import currentStats from '../../../__mocks__/webpack-stats.current.json';
|
|
8
8
|
import { getWrapperDecorator } from '../../stories';
|
|
9
9
|
import { BundleAssets } from '.';
|
|
10
|
-
|
|
10
|
+
const JOBS = createJobs([{
|
|
11
11
|
webpack: currentStats
|
|
12
12
|
}, {
|
|
13
13
|
webpack: baselineStats
|
|
14
14
|
}]);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
stories.addDecorator(getWrapperDecorator());
|
|
19
|
-
stories.add('default', function () {
|
|
20
|
-
return /*#__PURE__*/React.createElement(BundleAssets, {
|
|
21
|
-
jobs: [baselineJob]
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
stories.add('multiple jobs', function () {
|
|
25
|
-
return /*#__PURE__*/React.createElement(BundleAssets, {
|
|
26
|
-
jobs: JOBS
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
stories.add('custom filters', function () {
|
|
30
|
-
var _ref;
|
|
15
|
+
const [currentJob, baselineJob] = JOBS;
|
|
16
|
+
|
|
17
|
+
const setState = params => console.info(params);
|
|
31
18
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
19
|
+
const stories = storiesOf('Components/BundleAssets', module);
|
|
20
|
+
stories.addDecorator(getWrapperDecorator());
|
|
21
|
+
stories.add('default', () => /*#__PURE__*/React.createElement(BundleAssets, {
|
|
22
|
+
jobs: [baselineJob],
|
|
23
|
+
setState: setState
|
|
24
|
+
}));
|
|
25
|
+
stories.add('multiple jobs', () => /*#__PURE__*/React.createElement(BundleAssets, {
|
|
26
|
+
jobs: JOBS,
|
|
27
|
+
setState: setState
|
|
28
|
+
}));
|
|
29
|
+
stories.add('custom filters', () => /*#__PURE__*/React.createElement(BundleAssets, {
|
|
30
|
+
jobs: JOBS,
|
|
31
|
+
filters: {
|
|
32
|
+
[`${ASSET_ENTRY_TYPE}.${ASSET_FILTERS.ENTRY}`]: true,
|
|
33
|
+
[`${ASSET_FILE_TYPE}.${FILE_TYPE_JS}`]: true
|
|
34
|
+
},
|
|
35
|
+
setState: setState
|
|
36
|
+
}));
|
|
37
|
+
const JOBS_EMPTY_BASELINE = createJobs([{
|
|
38
38
|
webpack: currentStats
|
|
39
39
|
}, null]);
|
|
40
|
-
stories.add('empty baseline',
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
value: 2988
|
|
76
|
-
}
|
|
77
|
-
})]
|
|
78
|
-
});
|
|
79
|
-
});
|
|
40
|
+
stories.add('empty baseline', () => /*#__PURE__*/React.createElement(BundleAssets, {
|
|
41
|
+
jobs: JOBS_EMPTY_BASELINE,
|
|
42
|
+
setState: setState
|
|
43
|
+
}));
|
|
44
|
+
stories.add('no assets', () => /*#__PURE__*/React.createElement(BundleAssets, {
|
|
45
|
+
jobs: JOBS.map(job => _set(_merge({}, job), 'metrics.webpack.assets', {})),
|
|
46
|
+
setState: setState
|
|
47
|
+
}));
|
|
48
|
+
stories.add('empty filtered data', () => /*#__PURE__*/React.createElement(BundleAssets, {
|
|
49
|
+
jobs: [_set(_merge({}, currentJob), 'metrics.webpack.assets', {
|
|
50
|
+
'main.js': {
|
|
51
|
+
value: 100
|
|
52
|
+
}
|
|
53
|
+
}), _set(_merge({}, baselineJob), 'metrics.webpack.assets', {
|
|
54
|
+
'main.js': {
|
|
55
|
+
value: 100
|
|
56
|
+
}
|
|
57
|
+
})],
|
|
58
|
+
search: "vendors",
|
|
59
|
+
setState: setState
|
|
60
|
+
}));
|
|
61
|
+
stories.add('not predictive', () => /*#__PURE__*/React.createElement(BundleAssets, {
|
|
62
|
+
jobs: [_set(_merge({}, currentJob), 'metrics.webpack.assets', {
|
|
63
|
+
'static/js/not-predictive.js': {
|
|
64
|
+
name: 'static/js/not-predictive.93191a1.js',
|
|
65
|
+
value: 2989
|
|
66
|
+
}
|
|
67
|
+
}), _set(_merge({}, baselineJob), 'metrics.webpack.assets', {
|
|
68
|
+
'static/js/not-predictive.js': {
|
|
69
|
+
name: 'static/js/not-predictive.93191a1.js',
|
|
70
|
+
value: 2988
|
|
71
|
+
}
|
|
72
|
+
})],
|
|
73
|
+
setState: setState
|
|
74
|
+
}));
|
|
@@ -1,22 +1,66 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
import _get from "lodash/get";
|
|
2
|
+
import { ASSET_ENTRY_TYPE, ASSET_FILE_TYPE, ASSET_FILTERS, getFileType } from '@bundle-stats/utils';
|
|
3
|
+
import { SORT_BY_NAME, SORT_BY_DELTA, SORT_BY_SIZE } from './bundle-assets.constants';
|
|
4
|
+
export const addRowAssetFlags = row => {
|
|
5
|
+
const {
|
|
6
|
+
runs
|
|
7
|
+
} = row;
|
|
8
|
+
const isEntry = runs.map(run => run == null ? void 0 : run.isEntry).includes(true);
|
|
9
|
+
const isInitial = runs.map(run => run == null ? void 0 : run.isInitial).includes(true);
|
|
10
|
+
const isChunk = runs.map(run => run == null ? void 0 : run.isChunk).includes(true);
|
|
11
|
+
const isAsset = !(isEntry || isInitial || isChunk);
|
|
12
|
+
return { ...row,
|
|
13
|
+
isEntry,
|
|
14
|
+
isInitial,
|
|
15
|
+
isChunk,
|
|
16
|
+
isAsset
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export const getIsNotPredictive = (key, runs) => runs.reduce((agg, current, index) => {
|
|
20
|
+
if (agg) {
|
|
21
|
+
return agg;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (index + 1 === runs.length) {
|
|
25
|
+
return agg;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (current && runs[index + 1] && current.delta !== 0 && key !== current.name && current.name === runs[index + 1].name) {
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return agg;
|
|
33
|
+
}, false);
|
|
34
|
+
export const addRowIsNotPredictive = row => ({ ...row,
|
|
35
|
+
isNotPredictive: getIsNotPredictive(row.key, row.runs)
|
|
36
|
+
});
|
|
37
|
+
export const getRowFilter = filters => item => {
|
|
38
|
+
if (filters[ASSET_FILTERS.CHANGED] && !item.changed) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (!(filters[`${ASSET_ENTRY_TYPE}.${ASSET_FILTERS.ENTRY}`] && item.isEntry || filters[`${ASSET_ENTRY_TYPE}.${ASSET_FILTERS.INITIAL}`] && item.isInitial || filters[`${ASSET_ENTRY_TYPE}.${ASSET_FILTERS.CHUNK}`] && item.isChunk || filters[`${ASSET_ENTRY_TYPE}.${ASSET_FILTERS.ASSET}`] && item.isAsset)) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (!filters[`${ASSET_FILE_TYPE}.${getFileType(item.key)}`]) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return true;
|
|
51
|
+
};
|
|
52
|
+
export const getCustomSort = sortId => item => {
|
|
53
|
+
if (sortId === SORT_BY_NAME) {
|
|
54
|
+
return item.key;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (sortId === SORT_BY_DELTA) {
|
|
58
|
+
return _get(item, 'runs[0].deltaPercentage', 0);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (sortId === SORT_BY_SIZE) {
|
|
62
|
+
return _get(item, 'runs[0].value', 0);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return [!item.isNotPredictive, !item.changed, !item.isInitial, !item.isEntry, !item.isChunk, item.key];
|
|
22
66
|
};
|