@bundle-stats/ui 3.2.0-beta.1 → 3.2.1-beta.10
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 +11 -4
- 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/browsertime-table/browsertime-table.stories.js +1 -0
- 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-assets-totals-chart-bars/bundle-assets-totals-chart-bars.js +17 -18
- 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.js +3 -3
- 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/job-meta/job-meta.js +1 -1
- 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/components/summary/summary.js +52 -34
- 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} +16 -65
- package/lib/layout/box/box.js +2 -2
- package/lib/layout/stack/stack.js +13 -3
- package/lib/ui/icon/icon.js +4 -191
- package/lib/ui/sort-dropdown/sort-dropdown.js +12 -13
- package/lib/ui/sort-dropdown/sort-dropdown.stories.js +2 -2
- package/lib/utils.js +6 -3
- package/lib-esm/app/app.js +60 -70
- package/lib-esm/app/app.stories.js +50 -71
- package/lib-esm/app/header/header.js +5 -3
- 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 +21 -17
- 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 +11 -14
- package/lib-esm/components/bundle-assets/bundle-assets.constants.js +17 -15
- package/lib-esm/components/bundle-assets/bundle-assets.js +107 -97
- 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 +51 -53
- 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 +14 -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 +112 -110
- package/lib-esm/components/bundle-modules/bundle-modules.stories.js +46 -58
- package/lib-esm/components/bundle-modules/bundle-modules.utils.js +98 -0
- package/lib-esm/components/bundle-modules/index.js +114 -3
- package/lib-esm/components/bundle-packages/bundle-packages.constants.js +17 -15
- package/lib-esm/components/bundle-packages/bundle-packages.js +71 -69
- 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 +10 -13
- package/lib-esm/components/delta/delta.js +8 -6
- package/lib-esm/components/delta/delta.stories.js +26 -38
- package/lib-esm/components/duplicate-packages-warning/duplicate-packages-warning.js +11 -9
- package/lib-esm/components/duplicate-packages-warning/duplicate-packages-warning.stories.js +20 -26
- 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 +15 -18
- package/lib-esm/components/job-meta/job-meta.stories.js +10 -12
- package/lib-esm/components/job-name/job-name.js +9 -12
- 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 +15 -19
- package/lib-esm/components/metric/metric.stories.js +36 -58
- package/lib-esm/components/metrics-table/metrics-table.js +128 -139
- package/lib-esm/components/metrics-table/metrics-table.stories.js +27 -35
- package/lib-esm/components/metrics-table-options/metrics-table-options.js +16 -19
- 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 +52 -36
- package/lib-esm/components/summary/summary.stories.js +31 -46
- package/lib-esm/components/summary-item/summary-item.js +27 -28
- 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 +4 -2
- package/lib-esm/constants.js +25 -30
- package/lib-esm/hooks/rows-filter.js +20 -0
- package/lib-esm/hooks/rows-sort.js +22 -0
- package/lib-esm/hooks/search-params.js +170 -0
- package/lib-esm/layout/box/box.js +14 -21
- 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 +11 -11
- package/lib-esm/layout/footer/footer.stories.js +7 -11
- package/lib-esm/layout/header/header.js +10 -14
- package/lib-esm/layout/header/header.stories.js +50 -44
- package/lib-esm/layout/stack/stack.js +13 -8
- 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 +49 -58
- package/lib-esm/query-state.js +13 -16
- package/lib-esm/stories/wrapper.js +6 -12
- 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 +6 -9
- 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 +22 -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 +6 -4
- package/lib-esm/ui/file-name/file-name.stories.js +12 -16
- package/lib-esm/ui/filters/filters.container.js +57 -76
- package/lib-esm/ui/filters/filters.js +71 -77
- package/lib-esm/ui/filters/filters.stories.js +82 -100
- package/lib-esm/ui/filters/filters.utils.js +26 -24
- package/lib-esm/ui/filters/index.js +1 -1
- package/lib-esm/ui/horizontal-bar-chart/horizontal-bar-chart.js +68 -78
- package/lib-esm/ui/horizontal-bar-chart/horizontal-bar-chart.stories.js +67 -77
- package/lib-esm/ui/icon/icon.js +13 -202
- package/lib-esm/ui/icon/icon.stories.js +16 -24
- package/lib-esm/ui/input/input.js +7 -10
- package/lib-esm/ui/input/input.stories.js +8 -12
- package/lib-esm/ui/loader/loader.js +6 -9
- 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 +15 -15
- package/lib-esm/ui/logo/logo.stories.js +14 -22
- package/lib-esm/ui/panels/panels.js +13 -23
- package/lib-esm/ui/panels/panels.stories.js +14 -16
- package/lib-esm/ui/popover/popover.js +11 -9
- 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 +38 -38
- package/lib-esm/ui/sort-dropdown/sort-dropdown.stories.js +14 -16
- package/lib-esm/ui/table/table.js +26 -31
- package/lib-esm/ui/table/table.stories.js +84 -102
- package/lib-esm/ui/tabs/tabs.js +13 -21
- 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 +14 -16
- package/lib-esm/ui/tooltip/tooltip.js +13 -16
- package/lib-esm/ui/tooltip/tooltip.stories.js +8 -12
- package/lib-esm/utils.js +20 -24
- package/package.json +30 -33
- 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-assets-totals-chart-bars/bundle-assets-totals-chart-bars.jsx +15 -15
- 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 +3 -3
- package/src/components/bundle-packages/bundle-packages.utils.js +47 -0
- package/src/components/bundle-packages/index.jsx +84 -0
- package/src/components/job-meta/job-meta.jsx +1 -3
- 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/components/summary/summary.jsx +26 -10
- 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/layout/box/box.jsx +1 -1
- package/src/layout/stack/stack.jsx +2 -2
- package/src/ui/icon/icon.jsx +7 -42
- package/src/ui/sort-dropdown/sort-dropdown.jsx +11 -11
- package/src/utils.jsx +5 -3
- 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
|
@@ -2,38 +2,34 @@ import React from 'react';
|
|
|
2
2
|
import { storiesOf } from '@storybook/react';
|
|
3
3
|
import { getWrapperDecorator } from '../../stories';
|
|
4
4
|
import { AssetInfo } from '.';
|
|
5
|
-
|
|
5
|
+
const stories = storiesOf('Components/AssetInfo', module);
|
|
6
6
|
stories.addDecorator(getWrapperDecorator());
|
|
7
|
-
stories.add('default',
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
name: 'static/vendor.abcd1234.js'
|
|
12
|
-
}, {
|
|
13
|
-
name: 'static/vendor.defg5678.js'
|
|
14
|
-
}]
|
|
15
|
-
},
|
|
16
|
-
labels: ['Job #2', 'Job #1']
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
stories.add('with chunks', function () {
|
|
20
|
-
return /*#__PURE__*/React.createElement(AssetInfo, {
|
|
21
|
-
item: {
|
|
22
|
-
runs: [{
|
|
23
|
-
name: 'static/vendor.abcd1234.js',
|
|
24
|
-
chunkId: '1'
|
|
25
|
-
}, {
|
|
26
|
-
name: 'static/vendor.defg5678.js',
|
|
27
|
-
chunkId: '2'
|
|
28
|
-
}]
|
|
29
|
-
},
|
|
30
|
-
chunks: [{
|
|
31
|
-
id: '1',
|
|
32
|
-
name: 'vendor'
|
|
7
|
+
stories.add('default', () => /*#__PURE__*/React.createElement(AssetInfo, {
|
|
8
|
+
item: {
|
|
9
|
+
runs: [{
|
|
10
|
+
name: 'static/vendor.abcd1234.js'
|
|
33
11
|
}, {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
12
|
+
name: 'static/vendor.defg5678.js'
|
|
13
|
+
}]
|
|
14
|
+
},
|
|
15
|
+
labels: ['Job #2', 'Job #1']
|
|
16
|
+
}));
|
|
17
|
+
stories.add('with chunks', () => /*#__PURE__*/React.createElement(AssetInfo, {
|
|
18
|
+
item: {
|
|
19
|
+
runs: [{
|
|
20
|
+
name: 'static/vendor.abcd1234.js',
|
|
21
|
+
chunkId: '1'
|
|
22
|
+
}, {
|
|
23
|
+
name: 'static/vendor.defg5678.js',
|
|
24
|
+
chunkId: '2'
|
|
25
|
+
}]
|
|
26
|
+
},
|
|
27
|
+
chunks: [{
|
|
28
|
+
id: '1',
|
|
29
|
+
name: 'vendor'
|
|
30
|
+
}, {
|
|
31
|
+
id: '2',
|
|
32
|
+
name: 'app~common~utils~shared'
|
|
33
|
+
}],
|
|
34
|
+
labels: ['Job #2', 'Job #1']
|
|
35
|
+
}));
|
|
@@ -2,10 +2,12 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import * as browsertime from '@bundle-stats/utils';
|
|
4
4
|
import { MetricsTable } from '../metrics-table';
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
export const BrowsertimeTable = props => {
|
|
6
|
+
const {
|
|
7
|
+
className,
|
|
8
|
+
jobs
|
|
9
|
+
} = props;
|
|
10
|
+
const items = browsertime.compare(jobs);
|
|
9
11
|
return /*#__PURE__*/React.createElement(MetricsTable, {
|
|
10
12
|
className: className,
|
|
11
13
|
items: items,
|
|
@@ -1,25 +1,22 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { storiesOf } from '@storybook/react';
|
|
3
3
|
import { createJobs } from '@bundle-stats/utils';
|
|
4
|
-
import * as browsertime from '@bundle-stats/utils/lib-esm/browsertime';
|
|
4
|
+
import * as browsertime from '@bundle-stats/utils/lib-esm/browsertime'; // eslint-disable-next-line import/no-relative-packages
|
|
5
|
+
|
|
5
6
|
import browsertimeSourceFixtures from '../../../../../fixtures/browsertime.json';
|
|
6
7
|
import { getWrapperDecorator } from '../../stories';
|
|
7
8
|
import { BrowsertimeTable } from '.';
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
const browsertimeFixtures = browsertime.filter(browsertimeSourceFixtures);
|
|
10
|
+
const JOBS = createJobs([{
|
|
10
11
|
browsertime: browsertimeFixtures
|
|
11
12
|
}, {
|
|
12
13
|
browsertime: browsertimeFixtures
|
|
13
14
|
}]);
|
|
14
|
-
|
|
15
|
+
const stories = storiesOf('Components/BrowsertimeTable', module);
|
|
15
16
|
stories.addDecorator(getWrapperDecorator());
|
|
16
|
-
stories.add('default',
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return /*#__PURE__*/React.createElement(BrowsertimeTable, {
|
|
23
|
-
jobs: [JOBS[1]]
|
|
24
|
-
});
|
|
25
|
-
});
|
|
17
|
+
stories.add('default', () => /*#__PURE__*/React.createElement(BrowsertimeTable, {
|
|
18
|
+
jobs: JOBS
|
|
19
|
+
}));
|
|
20
|
+
stories.add('no baseline', () => /*#__PURE__*/React.createElement(BrowsertimeTable, {
|
|
21
|
+
jobs: [JOBS[1]]
|
|
22
|
+
}));
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
export const SORT_BY_NAME = 'name';
|
|
2
|
+
export const SORT_BY_SIZE = 'size';
|
|
3
|
+
export const SORT_BY_DELTA = 'delta';
|
|
4
|
+
export const SORT_BY = {
|
|
5
|
+
[SORT_BY_NAME]: {
|
|
6
|
+
label: 'Name',
|
|
7
|
+
defaultDirection: 'asc'
|
|
8
|
+
},
|
|
9
|
+
[SORT_BY_DELTA]: {
|
|
10
|
+
label: 'Delta',
|
|
11
|
+
defaultDirection: 'desc'
|
|
12
|
+
},
|
|
13
|
+
[SORT_BY_SIZE]: {
|
|
14
|
+
label: 'Size',
|
|
15
|
+
defaultDirection: 'desc'
|
|
16
|
+
}
|
|
17
|
+
};
|
|
@@ -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,37 +25,38 @@ 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(_ref => {
|
|
33
|
+
let [id, label] = _ref;
|
|
34
|
+
return {
|
|
35
|
+
[id]: {
|
|
36
|
+
label,
|
|
37
|
+
defaultValue: _get(filters, `${ASSET_FILE_TYPE}.${id}`, true)
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}).reduce((agg, current) => ({ ...agg,
|
|
41
|
+
...current
|
|
42
|
+
}), {});
|
|
54
43
|
|
|
55
|
-
|
|
56
|
-
|
|
44
|
+
const TooltipNotPredictive = _ref2 => {
|
|
45
|
+
let {
|
|
46
|
+
runs
|
|
47
|
+
} = _ref2;
|
|
57
48
|
return /*#__PURE__*/React.createElement("div", {
|
|
58
49
|
className: css.tooltipNotPredictive
|
|
59
50
|
}, /*#__PURE__*/React.createElement("p", {
|
|
60
51
|
className: css.tooltipNotPredictiveText
|
|
61
52
|
}, "File name is the same, but the size has changed:"), /*#__PURE__*/React.createElement("table", {
|
|
62
53
|
className: css.tooltipTable
|
|
63
|
-
}, /*#__PURE__*/React.createElement("tr", null, runs.map(
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
54
|
+
}, /*#__PURE__*/React.createElement("tr", null, runs.map((_ref3, index) => {
|
|
55
|
+
let {
|
|
56
|
+
name,
|
|
57
|
+
value
|
|
58
|
+
} = _ref3;
|
|
59
|
+
const key = index;
|
|
67
60
|
return /*#__PURE__*/React.createElement("tr", {
|
|
68
61
|
key: key
|
|
69
62
|
}, /*#__PURE__*/React.createElement("th", null, RUNS_LABELS[index]), /*#__PURE__*/React.createElement("td", null, name), /*#__PURE__*/React.createElement("td", null, value));
|
|
@@ -78,17 +71,21 @@ TooltipNotPredictive.propTypes = {
|
|
|
78
71
|
|
|
79
72
|
};
|
|
80
73
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
74
|
+
const getRenderRowHeader = _ref4 => {
|
|
75
|
+
let {
|
|
76
|
+
labels,
|
|
77
|
+
CustomComponentLink,
|
|
78
|
+
chunks
|
|
79
|
+
} = _ref4;
|
|
80
|
+
return item => {
|
|
81
|
+
const {
|
|
82
|
+
label,
|
|
83
|
+
isNotPredictive,
|
|
84
|
+
runs,
|
|
85
|
+
isChunk,
|
|
86
|
+
isEntry,
|
|
87
|
+
isInitial
|
|
88
|
+
} = item;
|
|
92
89
|
return /*#__PURE__*/React.createElement(Popover, {
|
|
93
90
|
label: /*#__PURE__*/React.createElement(FileName, {
|
|
94
91
|
name: label
|
|
@@ -123,49 +120,51 @@ var getRenderRowHeader = function getRenderRowHeader(_ref5) {
|
|
|
123
120
|
};
|
|
124
121
|
};
|
|
125
122
|
|
|
126
|
-
export
|
|
127
|
-
var _jobs$, _jobs$$meta, _jobs$$meta$webpack
|
|
123
|
+
export const BundleAssets = props => {
|
|
124
|
+
var _jobs$, _jobs$$meta, _jobs$$meta$webpack;
|
|
128
125
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
126
|
+
const {
|
|
127
|
+
className,
|
|
128
|
+
jobs,
|
|
129
|
+
items,
|
|
130
|
+
updateFilters,
|
|
131
|
+
resetFilters,
|
|
132
|
+
resetAllFilters,
|
|
133
|
+
totalRowCount,
|
|
134
|
+
filters,
|
|
135
|
+
hasActiveFilters,
|
|
136
|
+
sortFields,
|
|
137
|
+
sort,
|
|
138
|
+
updateSort,
|
|
139
|
+
search,
|
|
140
|
+
updateSearch,
|
|
141
|
+
customComponentLink: CustomComponentLink
|
|
142
|
+
} = props;
|
|
143
|
+
const emptyMessage = /*#__PURE__*/React.createElement(EmptySet, {
|
|
145
144
|
resources: "assets",
|
|
146
145
|
filtered: totalRowCount !== 0,
|
|
147
146
|
handleResetFilters: resetFilters,
|
|
148
147
|
handleViewAll: resetAllFilters
|
|
149
148
|
});
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
});
|
|
157
|
-
}, [jobs, chunks]);
|
|
149
|
+
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) || [];
|
|
150
|
+
const renderRowHeader = useMemo(() => getRenderRowHeader({
|
|
151
|
+
labels: _map(jobs, 'label'),
|
|
152
|
+
CustomComponentLink,
|
|
153
|
+
chunks
|
|
154
|
+
}), [jobs, chunks]);
|
|
158
155
|
return /*#__PURE__*/React.createElement("section", {
|
|
159
156
|
className: cx(css.root, className)
|
|
160
157
|
}, /*#__PURE__*/React.createElement(Toolbar, {
|
|
161
158
|
className: css.toolbar,
|
|
162
|
-
renderActions:
|
|
163
|
-
|
|
159
|
+
renderActions: _ref5 => {
|
|
160
|
+
let {
|
|
161
|
+
actionClassName
|
|
162
|
+
} = _ref5;
|
|
164
163
|
return /*#__PURE__*/React.createElement(FlexStack, {
|
|
165
164
|
space: "xsmall",
|
|
166
165
|
className: cx(css.dropdown, actionClassName)
|
|
167
166
|
}, /*#__PURE__*/React.createElement(SortDropdown, _extends({
|
|
168
|
-
|
|
167
|
+
fields: sortFields
|
|
169
168
|
}, sort, {
|
|
170
169
|
onChange: updateSort
|
|
171
170
|
})), /*#__PURE__*/React.createElement(MetricsTableOptions, {
|
|
@@ -180,27 +179,36 @@ export var BundleAssets = function BundleAssets(props) {
|
|
|
180
179
|
updateSearch: updateSearch
|
|
181
180
|
}), /*#__PURE__*/React.createElement(Filters, {
|
|
182
181
|
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
|
-
|
|
182
|
+
filters: {
|
|
183
|
+
[ASSET_FILTERS.CHANGED]: {
|
|
184
|
+
label: 'Changed',
|
|
185
|
+
defaultValue: filters[ASSET_FILTERS.CHANGED],
|
|
186
|
+
disabled: jobs.length <= 1
|
|
187
|
+
},
|
|
188
|
+
[ASSET_ENTRY_TYPE]: {
|
|
189
|
+
label: 'Entry type',
|
|
190
|
+
[ASSET_FILTERS.ENTRY]: {
|
|
191
|
+
label: 'Entry',
|
|
192
|
+
defaultValue: _get(filters, `${ASSET_ENTRY_TYPE}.${ASSET_FILTERS.ENTRY}`, true)
|
|
193
|
+
},
|
|
194
|
+
[ASSET_FILTERS.INITIAL]: {
|
|
195
|
+
label: 'Initial',
|
|
196
|
+
defaultValue: _get(filters, `${ASSET_ENTRY_TYPE}.${ASSET_FILTERS.INITIAL}`, true)
|
|
197
|
+
},
|
|
198
|
+
[ASSET_FILTERS.CHUNK]: {
|
|
199
|
+
label: 'Chunk',
|
|
200
|
+
defaultValue: _get(filters, `${ASSET_ENTRY_TYPE}.${ASSET_FILTERS.CHUNK}`, true)
|
|
201
|
+
},
|
|
202
|
+
[ASSET_FILTERS.ASSET]: {
|
|
203
|
+
label: 'Asset',
|
|
204
|
+
defaultValue: _get(filters, `${ASSET_ENTRY_TYPE}.${ASSET_FILTERS.ASSET}`, true)
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
[ASSET_FILE_TYPE]: {
|
|
208
|
+
label: 'File type',
|
|
209
|
+
...getFileTypeFilters(filters)
|
|
210
|
+
}
|
|
211
|
+
},
|
|
204
212
|
hasActiveFilters: hasActiveFilters,
|
|
205
213
|
onChange: updateFilters
|
|
206
214
|
}))), /*#__PURE__*/React.createElement("main", null, /*#__PURE__*/React.createElement(MetricsTable, {
|
|
@@ -211,7 +219,7 @@ export var BundleAssets = function BundleAssets(props) {
|
|
|
211
219
|
showHeaderSum: true,
|
|
212
220
|
title: /*#__PURE__*/React.createElement(MetricsTableTitle, {
|
|
213
221
|
title: I18N.ASSETS,
|
|
214
|
-
info:
|
|
222
|
+
info: `(${items.length}/${totalRowCount})`,
|
|
215
223
|
popoverInfo: I18N.ASSETS_INFO,
|
|
216
224
|
popoverHref: config.documentation.assets
|
|
217
225
|
})
|
|
@@ -251,10 +259,12 @@ BundleAssets.propTypes = {
|
|
|
251
259
|
changed: PropTypes.bool
|
|
252
260
|
}).isRequired,
|
|
253
261
|
hasActiveFilters: PropTypes.bool,
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
262
|
+
sortFields: PropTypes.shape({
|
|
263
|
+
[PropTypes.string]: PropTypes.shape({
|
|
264
|
+
label: PropTypes.string,
|
|
265
|
+
defaultDirection: PropTypes.bool
|
|
266
|
+
})
|
|
267
|
+
}).isRequired,
|
|
258
268
|
search: PropTypes.string.isRequired,
|
|
259
269
|
updateSearch: PropTypes.func.isRequired,
|
|
260
270
|
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
|
};
|