html-reporter 9.9.2 → 9.10.1
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/build/gemini.d.ts +2 -0
- package/{gemini.js → build/gemini.js} +1 -1
- package/build/gemini.js.map +1 -0
- package/build/hermione.d.ts +2 -0
- package/{hermione.js → build/hermione.js} +3 -21
- package/build/hermione.js.map +1 -0
- package/build/lib/cli-commands/gui.d.ts +2 -0
- package/{lib → build/lib}/cli-commands/gui.js +5 -7
- package/build/lib/cli-commands/gui.js.map +1 -0
- package/build/lib/cli-commands/index.d.ts +3 -0
- package/{lib → build/lib}/cli-commands/index.js +1 -1
- package/build/lib/cli-commands/index.js.map +1 -0
- package/build/lib/cli-commands/merge-reports.d.ts +2 -0
- package/{lib → build/lib}/cli-commands/merge-reports.js +11 -11
- package/build/lib/cli-commands/merge-reports.js.map +1 -0
- package/build/lib/cli-commands/remove-unused-screens/index.d.ts +2 -0
- package/{lib → build/lib}/cli-commands/remove-unused-screens/index.js +61 -110
- package/build/lib/cli-commands/remove-unused-screens/index.js.map +1 -0
- package/build/lib/cli-commands/remove-unused-screens/utils.d.ts +16 -0
- package/{lib → build/lib}/cli-commands/remove-unused-screens/utils.js +10 -48
- package/build/lib/cli-commands/remove-unused-screens/utils.js.map +1 -0
- package/build/lib/common-utils.d.ts +24 -0
- package/build/lib/common-utils.js +116 -0
- package/build/lib/common-utils.js.map +1 -0
- package/build/lib/config/custom-gui-asserts.d.ts +1 -0
- package/{lib → build/lib}/config/custom-gui-asserts.js +2 -12
- package/build/lib/config/custom-gui-asserts.js.map +1 -0
- package/build/lib/config/index.d.ts +21 -0
- package/{lib → build/lib}/config/index.js +7 -32
- package/build/lib/config/index.js.map +1 -0
- package/build/lib/constants/browser.d.ts +3 -0
- package/build/lib/constants/browser.js +5 -0
- package/build/lib/constants/browser.js.map +1 -0
- package/build/lib/constants/checked-statuses.d.ts +3 -0
- package/build/lib/constants/checked-statuses.js +7 -0
- package/build/lib/constants/checked-statuses.js.map +1 -0
- package/build/lib/constants/database.d.ts +25 -0
- package/build/lib/constants/database.js +47 -0
- package/build/lib/constants/database.js.map +1 -0
- package/build/lib/constants/defaults.d.ts +18 -0
- package/{lib → build/lib}/constants/defaults.js +1 -2
- package/build/lib/constants/defaults.js.map +1 -0
- package/build/lib/constants/diff-modes.d.ts +53 -0
- package/{lib → build/lib}/constants/diff-modes.js +2 -0
- package/build/lib/constants/diff-modes.js.map +1 -0
- package/build/lib/constants/errors.d.ts +5 -0
- package/{lib → build/lib}/constants/errors.js +1 -1
- package/build/lib/constants/errors.js.map +1 -0
- package/build/lib/constants/expand-modes.d.ts +4 -0
- package/{lib → build/lib}/constants/expand-modes.js +1 -1
- package/build/lib/constants/expand-modes.js.map +1 -0
- package/build/lib/constants/extension-points.d.ts +4 -0
- package/build/lib/constants/extension-points.js +8 -0
- package/build/lib/constants/extension-points.js.map +1 -0
- package/build/lib/constants/group-tests.d.ts +7 -0
- package/{lib → build/lib}/constants/group-tests.js +2 -0
- package/build/lib/constants/group-tests.js.map +1 -0
- package/build/lib/constants/paths.d.ts +2 -0
- package/{lib → build/lib}/constants/paths.js +1 -1
- package/build/lib/constants/paths.js.map +1 -0
- package/build/lib/constants/plugin-events.d.ts +5 -0
- package/{lib → build/lib}/constants/plugin-events.js +2 -4
- package/build/lib/constants/plugin-events.js.map +1 -0
- package/build/lib/constants/save-formats.d.ts +1 -0
- package/{lib → build/lib}/constants/save-formats.js +1 -1
- package/build/lib/constants/save-formats.js.map +1 -0
- package/build/lib/constants/test-statuses.d.ts +8 -0
- package/{lib → build/lib}/constants/test-statuses.js +1 -1
- package/build/lib/constants/test-statuses.js.map +1 -0
- package/build/lib/constants/view-modes.d.ts +5 -0
- package/{lib → build/lib}/constants/view-modes.js +1 -1
- package/build/lib/constants/view-modes.js.map +1 -0
- package/build/lib/db-utils/client.d.ts +19 -0
- package/{lib → build/lib}/db-utils/client.js +18 -45
- package/build/lib/db-utils/client.js.map +1 -0
- package/build/lib/db-utils/common.d.ts +10 -0
- package/build/lib/db-utils/common.js +56 -0
- package/build/lib/db-utils/common.js.map +1 -0
- package/build/lib/db-utils/server.d.ts +16 -0
- package/{lib → build/lib}/db-utils/server.js +15 -41
- package/build/lib/db-utils/server.js.map +1 -0
- package/build/lib/gui/api/facade.d.ts +8 -0
- package/{lib → build/lib}/gui/api/facade.js +1 -4
- package/build/lib/gui/api/facade.js.map +1 -0
- package/build/lib/gui/api/index.d.ts +9 -0
- package/{lib → build/lib}/gui/api/index.js +1 -5
- package/build/lib/gui/api/index.js.map +1 -0
- package/build/lib/gui/app.d.ts +62 -0
- package/{lib → build/lib}/gui/app.js +2 -21
- package/build/lib/gui/app.js.map +1 -0
- package/build/lib/gui/constants/client-events.d.ts +6 -0
- package/{lib → build/lib}/gui/constants/client-events.js +1 -4
- package/build/lib/gui/constants/client-events.js.map +1 -0
- package/build/lib/gui/constants/custom-gui-control-types.d.ts +2 -0
- package/{lib → build/lib}/gui/constants/custom-gui-control-types.js +1 -1
- package/build/lib/gui/constants/custom-gui-control-types.js.map +1 -0
- package/build/lib/gui/constants/gui-events.d.ts +2 -0
- package/{lib → build/lib}/gui/constants/gui-events.js +1 -1
- package/build/lib/gui/constants/gui-events.js.map +1 -0
- package/build/lib/gui/constants/server.d.ts +3 -0
- package/{lib → build/lib}/gui/constants/server.js +1 -1
- package/build/lib/gui/constants/server.js.map +1 -0
- package/build/lib/gui/event-source.d.ts +6 -0
- package/{lib → build/lib}/gui/event-source.js +2 -5
- package/build/lib/gui/event-source.js.map +1 -0
- package/build/lib/gui/index.d.ts +12 -0
- package/build/lib/gui/index.js +22 -0
- package/build/lib/gui/index.js.map +1 -0
- package/build/lib/gui/routes/plugins.d.ts +2 -0
- package/{lib → build/lib}/gui/routes/plugins.js +9 -24
- package/build/lib/gui/routes/plugins.js.map +1 -0
- package/build/lib/gui/server.d.ts +8 -0
- package/{lib → build/lib}/gui/server.js +32 -51
- package/build/lib/gui/server.js.map +1 -0
- package/build/lib/gui/tool-runner/index.d.ts +123 -0
- package/{lib → build/lib}/gui/tool-runner/index.js +42 -122
- package/build/lib/gui/tool-runner/index.js.map +1 -0
- package/build/lib/gui/tool-runner/report-subscriber.d.ts +2 -0
- package/{lib → build/lib}/gui/tool-runner/report-subscriber.js +7 -30
- package/build/lib/gui/tool-runner/report-subscriber.js.map +1 -0
- package/build/lib/gui/tool-runner/runner/all-test-runner.d.ts +4 -0
- package/{lib → build/lib}/gui/tool-runner/runner/all-test-runner.js +1 -3
- package/build/lib/gui/tool-runner/runner/all-test-runner.js.map +1 -0
- package/build/lib/gui/tool-runner/runner/index.d.ts +3 -0
- package/{lib → build/lib}/gui/tool-runner/runner/index.js +1 -2
- package/build/lib/gui/tool-runner/runner/index.js.map +1 -0
- package/build/lib/gui/tool-runner/runner/runner.d.ts +6 -0
- package/{lib → build/lib}/gui/tool-runner/runner/runner.js +1 -2
- package/build/lib/gui/tool-runner/runner/runner.js.map +1 -0
- package/build/lib/gui/tool-runner/runner/specific-test-runner.d.ts +7 -0
- package/{lib → build/lib}/gui/tool-runner/runner/specific-test-runner.js +2 -8
- package/build/lib/gui/tool-runner/runner/specific-test-runner.js.map +1 -0
- package/build/lib/gui/tool-runner/utils.d.ts +7 -0
- package/{lib → build/lib}/gui/tool-runner/utils.js +11 -35
- package/build/lib/gui/tool-runner/utils.js.map +1 -0
- package/build/lib/history-utils.d.ts +1 -0
- package/{lib → build/lib}/history-utils.js +5 -20
- package/build/lib/history-utils.js.map +1 -0
- package/build/lib/local-images-saver.d.ts +4 -0
- package/build/lib/local-images-saver.js +9 -0
- package/build/lib/local-images-saver.js.map +1 -0
- package/build/lib/merge-reports/index.d.ts +4 -0
- package/{lib → build/lib}/merge-reports/index.js +3 -8
- package/build/lib/merge-reports/index.js.map +1 -0
- package/build/lib/plugin-adapter.d.ts +32 -0
- package/{lib → build/lib}/plugin-adapter.js +8 -25
- package/build/lib/plugin-adapter.js.map +1 -0
- package/build/lib/plugin-api.d.ts +57 -0
- package/{lib → build/lib}/plugin-api.js +2 -20
- package/build/lib/plugin-api.js.map +1 -0
- package/build/lib/plugin-utils.d.ts +3 -0
- package/{lib → build/lib}/plugin-utils.js +3 -5
- package/build/lib/plugin-utils.js.map +1 -0
- package/build/lib/report-builder/gui.d.ts +73 -0
- package/{lib → build/lib}/report-builder/gui.js +33 -92
- package/build/lib/report-builder/gui.js.map +1 -0
- package/build/lib/report-builder/static.d.ts +32 -0
- package/{lib → build/lib}/report-builder/static.js +25 -64
- package/build/lib/report-builder/static.js.map +1 -0
- package/build/lib/reporter-helpers.d.ts +3 -0
- package/{lib → build/lib}/reporter-helpers.js +2 -11
- package/build/lib/reporter-helpers.js.map +1 -0
- package/build/lib/server-utils.d.ts +42 -0
- package/{lib → build/lib}/server-utils.js +37 -92
- package/build/lib/server-utils.js.map +1 -0
- package/build/lib/sqlite-adapter.d.ts +78 -0
- package/{lib → build/lib}/sqlite-adapter.js +15 -56
- package/build/lib/sqlite-adapter.js.map +1 -0
- package/build/lib/static/gui.min.css +1 -0
- package/build/lib/static/gui.min.js +124 -0
- package/build/lib/static/modules/utils.d.ts +31 -0
- package/{lib → build/lib}/static/modules/utils.js +16 -56
- package/build/lib/static/modules/utils.js.map +1 -0
- package/{lib → build/lib}/static/report.min.css +1 -1
- package/build/lib/static/report.min.js +124 -0
- package/build/lib/suite-adapter.d.ts +15 -0
- package/{lib → build/lib}/suite-adapter.js +2 -18
- package/build/lib/suite-adapter.js.map +1 -0
- package/build/lib/test-adapter.d.ts +118 -0
- package/{lib → build/lib}/test-adapter.js +38 -156
- package/build/lib/test-adapter.js.map +1 -0
- package/build/lib/tests-tree-builder/base.d.ts +70 -0
- package/{lib → build/lib}/tests-tree-builder/base.js +34 -74
- package/build/lib/tests-tree-builder/base.js.map +1 -0
- package/build/lib/tests-tree-builder/gui.d.ts +47 -0
- package/{lib → build/lib}/tests-tree-builder/gui.js +12 -63
- package/build/lib/tests-tree-builder/gui.js.map +1 -0
- package/build/lib/tests-tree-builder/static.d.ts +55 -0
- package/{lib → build/lib}/tests-tree-builder/static.js +11 -42
- package/build/lib/tests-tree-builder/static.js.map +1 -0
- package/build/lib/workers/create-workers.d.ts +2 -0
- package/{lib → build/lib}/workers/create-workers.js +1 -2
- package/build/lib/workers/create-workers.js.map +1 -0
- package/build/lib/workers/worker.d.ts +1 -0
- package/build/lib/workers/worker.js +13 -0
- package/build/lib/workers/worker.js.map +1 -0
- package/build/package.json +178 -0
- package/package.json +44 -23
- package/2html-reporter.iml +0 -9
- package/CHANGELOG.md +0 -2886
- package/docs/en/html-reporter-api.md +0 -198
- package/docs/en/html-reporter-commands.md +0 -96
- package/docs/en/html-reporter-custom-gui.md +0 -99
- package/docs/en/html-reporter-events.md +0 -125
- package/docs/en/html-reporter-plugins.md +0 -265
- package/docs/en/html-reporter-setup.md +0 -378
- package/docs/en/html-reporter.md +0 -8
- package/docs/ru/html-reporter-api.md +0 -198
- package/docs/ru/html-reporter-commands.md +0 -96
- package/docs/ru/html-reporter-custom-gui.md +0 -99
- package/docs/ru/html-reporter-events.md +0 -125
- package/docs/ru/html-reporter-plugins.md +0 -265
- package/docs/ru/html-reporter-setup.md +0 -378
- package/docs/ru/html-reporter.md +0 -8
- package/lib/common-utils.js +0 -117
- package/lib/constants/browser.js +0 -3
- package/lib/constants/database.js +0 -49
- package/lib/constants/extension-points.js +0 -6
- package/lib/db-utils/common.js +0 -76
- package/lib/gui/index.js +0 -19
- package/lib/local-images-saver.js +0 -11
- package/lib/static/components/bottom-progress-bar/index.js +0 -42
- package/lib/static/components/controls/accept-opened-button.js +0 -39
- package/lib/static/components/controls/base-host-input.js +0 -39
- package/lib/static/components/controls/browser-list/index.js +0 -239
- package/lib/static/components/controls/browser-list/index.styl +0 -52
- package/lib/static/components/controls/browser-list/label.js +0 -60
- package/lib/static/components/controls/browser-list/label.styl +0 -18
- package/lib/static/components/controls/browser-list/utils.js +0 -43
- package/lib/static/components/controls/common-controls.js +0 -75
- package/lib/static/components/controls/common-filters.js +0 -32
- package/lib/static/components/controls/control-button.js +0 -54
- package/lib/static/components/controls/controls.less +0 -109
- package/lib/static/components/controls/custom-gui-controls.js +0 -70
- package/lib/static/components/controls/find-same-diffs-button.js +0 -47
- package/lib/static/components/controls/gui-controls.js +0 -81
- package/lib/static/components/controls/menu-bar.js +0 -47
- package/lib/static/components/controls/report-controls.js +0 -21
- package/lib/static/components/controls/report-info.js +0 -31
- package/lib/static/components/controls/run-button.js +0 -27
- package/lib/static/components/controls/selects/control.js +0 -51
- package/lib/static/components/controls/selects/group-tests.js +0 -94
- package/lib/static/components/controls/selects/index.styl +0 -57
- package/lib/static/components/controls/strict-match-filter-input.js +0 -39
- package/lib/static/components/controls/test-name-filter-input.js +0 -42
- package/lib/static/components/custom-scripts.js +0 -23
- package/lib/static/components/details.js +0 -58
- package/lib/static/components/error-boundary.js +0 -26
- package/lib/static/components/extension-point.js +0 -106
- package/lib/static/components/favicon-changer.js +0 -56
- package/lib/static/components/group-tests/item.js +0 -39
- package/lib/static/components/group-tests/list.js +0 -71
- package/lib/static/components/group-tests/prop-types.js +0 -12
- package/lib/static/components/gui.js +0 -105
- package/lib/static/components/header/header.css +0 -5
- package/lib/static/components/header/index.js +0 -26
- package/lib/static/components/header/summary/dbBtn.js +0 -36
- package/lib/static/components/header/summary/dbSummary.js +0 -49
- package/lib/static/components/header/summary/index.js +0 -43
- package/lib/static/components/header/summary/item.js +0 -28
- package/lib/static/components/header/summary/summary.css +0 -77
- package/lib/static/components/icons/arrow.js +0 -24
- package/lib/static/components/icons/arrows-close.js +0 -25
- package/lib/static/components/icons/arrows-move.js +0 -24
- package/lib/static/components/icons/arrows-open.js +0 -25
- package/lib/static/components/icons/view-in-browser/index.js +0 -59
- package/lib/static/components/icons/view-in-browser/index.styl +0 -28
- package/lib/static/components/loading.js +0 -25
- package/lib/static/components/main-tree.js +0 -23
- package/lib/static/components/modals/find-same-diffs.js +0 -34
- package/lib/static/components/modals/index.js +0 -6
- package/lib/static/components/modals/modal.css +0 -3
- package/lib/static/components/modals/modal.js +0 -27
- package/lib/static/components/modals/screenshot-accepter/body.js +0 -88
- package/lib/static/components/modals/screenshot-accepter/header.js +0 -192
- package/lib/static/components/modals/screenshot-accepter/index.js +0 -228
- package/lib/static/components/modals/screenshot-accepter/meta.js +0 -32
- package/lib/static/components/modals/screenshot-accepter/style.css +0 -115
- package/lib/static/components/popup/index.js +0 -85
- package/lib/static/components/popup/index.styl +0 -37
- package/lib/static/components/progress-bar/index.js +0 -13
- package/lib/static/components/progress-bar/index.styl +0 -24
- package/lib/static/components/report.js +0 -72
- package/lib/static/components/retry-switcher/index.js +0 -36
- package/lib/static/components/retry-switcher/item.js +0 -55
- package/lib/static/components/section/body/description.js +0 -24
- package/lib/static/components/section/body/history/index.js +0 -29
- package/lib/static/components/section/body/history/index.styl +0 -4
- package/lib/static/components/section/body/index.js +0 -114
- package/lib/static/components/section/body/meta-info/content.js +0 -114
- package/lib/static/components/section/body/meta-info/index.js +0 -33
- package/lib/static/components/section/body/result.js +0 -41
- package/lib/static/components/section/body/tabs.js +0 -52
- package/lib/static/components/section/section-browser.js +0 -113
- package/lib/static/components/section/section-common.js +0 -100
- package/lib/static/components/section/section-wrapper.js +0 -20
- package/lib/static/components/section/title/browser-skipped.js +0 -22
- package/lib/static/components/section/title/browser.js +0 -74
- package/lib/static/components/section/title/simple.js +0 -82
- package/lib/static/components/state/error-details.js +0 -18
- package/lib/static/components/state/index.js +0 -208
- package/lib/static/components/state/screenshot/diff-circle.js +0 -66
- package/lib/static/components/state/screenshot/full.js +0 -28
- package/lib/static/components/state/screenshot/resized.js +0 -90
- package/lib/static/components/state/screenshot/with-encode-uri.js +0 -44
- package/lib/static/components/state/screenshot/with-synced-scale.js +0 -116
- package/lib/static/components/state/state-error.js +0 -140
- package/lib/static/components/state/state-fail/index.js +0 -161
- package/lib/static/components/state/state-fail/index.styl +0 -31
- package/lib/static/components/state/state-fail/onion-skin-diff/index.js +0 -43
- package/lib/static/components/state/state-fail/onion-skin-diff/index.styl +0 -19
- package/lib/static/components/state/state-fail/prop-types.js +0 -16
- package/lib/static/components/state/state-fail/swipe-diff/index.js +0 -138
- package/lib/static/components/state/state-fail/swipe-diff/index.styl +0 -82
- package/lib/static/components/state/state-fail/switch-diff/index.js +0 -36
- package/lib/static/components/state/state-fail/switch-diff/index.styl +0 -12
- package/lib/static/components/state/state-fail/useFitImages.js +0 -63
- package/lib/static/components/state/state-success.js +0 -23
- package/lib/static/components/sticky-header/gui.js +0 -12
- package/lib/static/components/sticky-header/index.js +0 -36
- package/lib/static/components/sticky-header/index.styl +0 -37
- package/lib/static/components/sticky-header/report.js +0 -14
- package/lib/static/components/suites.js +0 -157
- package/lib/static/containers/array/array.styl +0 -32
- package/lib/static/containers/array/index.js +0 -61
- package/lib/static/containers/modal.js +0 -43
- package/lib/static/gui.css +0 -161
- package/lib/static/gui.js +0 -14
- package/lib/static/gui.min.css +0 -1
- package/lib/static/gui.min.js +0 -124
- package/lib/static/hooks/useElementSize.js +0 -30
- package/lib/static/hooks/useEventListener.js +0 -25
- package/lib/static/hooks/useWindowSize.js +0 -25
- package/lib/static/index.js +0 -14
- package/lib/static/modules/action-names.js +0 -57
- package/lib/static/modules/actions.js +0 -332
- package/lib/static/modules/custom-queries.js +0 -27
- package/lib/static/modules/default-state.js +0 -84
- package/lib/static/modules/load-plugin.js +0 -109
- package/lib/static/modules/local-storage-wrapper.js +0 -54
- package/lib/static/modules/middlewares/local-storage.js +0 -30
- package/lib/static/modules/middlewares/metrika.js +0 -121
- package/lib/static/modules/plugins.js +0 -52
- package/lib/static/modules/query-params.js +0 -98
- package/lib/static/modules/reducers/api-values.js +0 -25
- package/lib/static/modules/reducers/auto-run.js +0 -14
- package/lib/static/modules/reducers/bottom-progress-bar.js +0 -16
- package/lib/static/modules/reducers/browsers.js +0 -43
- package/lib/static/modules/reducers/close-ids.js +0 -12
- package/lib/static/modules/reducers/config.js +0 -48
- package/lib/static/modules/reducers/date.js +0 -16
- package/lib/static/modules/reducers/db.js +0 -30
- package/lib/static/modules/reducers/fetch-db-details.js +0 -13
- package/lib/static/modules/reducers/grouped-tests/by/meta.js +0 -31
- package/lib/static/modules/reducers/grouped-tests/by/result.js +0 -57
- package/lib/static/modules/reducers/grouped-tests/helpers.js +0 -91
- package/lib/static/modules/reducers/grouped-tests/index.js +0 -52
- package/lib/static/modules/reducers/gui.js +0 -16
- package/lib/static/modules/reducers/index.js +0 -56
- package/lib/static/modules/reducers/loading.js +0 -12
- package/lib/static/modules/reducers/modals.js +0 -16
- package/lib/static/modules/reducers/notifications.js +0 -12
- package/lib/static/modules/reducers/plugins.js +0 -25
- package/lib/static/modules/reducers/processing.js +0 -21
- package/lib/static/modules/reducers/running.js +0 -19
- package/lib/static/modules/reducers/skips.js +0 -15
- package/lib/static/modules/reducers/stats.js +0 -21
- package/lib/static/modules/reducers/stopping.js +0 -16
- package/lib/static/modules/reducers/tree/helpers.js +0 -28
- package/lib/static/modules/reducers/tree/index.js +0 -314
- package/lib/static/modules/reducers/tree/nodes/browsers.js +0 -109
- package/lib/static/modules/reducers/tree/nodes/images.js +0 -59
- package/lib/static/modules/reducers/tree/nodes/results.js +0 -39
- package/lib/static/modules/reducers/tree/nodes/suites.js +0 -239
- package/lib/static/modules/reducers/view.js +0 -93
- package/lib/static/modules/selectors/grouped-tests.js +0 -8
- package/lib/static/modules/selectors/index.js +0 -3
- package/lib/static/modules/selectors/stats.js +0 -33
- package/lib/static/modules/selectors/tree.js +0 -256
- package/lib/static/modules/selectors/view.js +0 -5
- package/lib/static/modules/store.js +0 -25
- package/lib/static/modules/web-vitals.js +0 -13
- package/lib/static/modules/yandex-metrika.js +0 -50
- package/lib/static/report.min.js +0 -124
- package/lib/static/styles.css +0 -887
- package/lib/static/template.html +0 -13
- package/lib/workers/worker.js +0 -15
- package/webpack.common.js +0 -95
- package/webpack.dev.js +0 -25
- package/webpack.prod.js +0 -19
- /package/{lib → build/lib}/static/gui.html +0 -0
- /package/{lib → build/lib}/static/icons/favicon-failure.png +0 -0
- /package/{lib → build/lib}/static/icons/favicon-running.png +0 -0
- /package/{lib → build/lib}/static/icons/favicon-success.png +0 -0
- /package/{lib → build/lib}/static/icons/favicon.png +0 -0
- /package/{lib → build/lib}/static/index.html +0 -0
package/lib/common-utils.js
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const crypto = require('crypto');
|
|
4
|
-
const {pick} = require('lodash');
|
|
5
|
-
const url = require('url');
|
|
6
|
-
const axios = require('axios');
|
|
7
|
-
|
|
8
|
-
const {
|
|
9
|
-
SUCCESS,
|
|
10
|
-
FAIL,
|
|
11
|
-
ERROR,
|
|
12
|
-
SKIPPED,
|
|
13
|
-
UPDATED,
|
|
14
|
-
IDLE,
|
|
15
|
-
RUNNING,
|
|
16
|
-
QUEUED
|
|
17
|
-
} = require('./constants/test-statuses');
|
|
18
|
-
|
|
19
|
-
exports.getShortMD5 = (str) => {
|
|
20
|
-
return crypto.createHash('md5').update(str, 'ascii').digest('hex').substr(0, 7);
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
const statusPriority = [
|
|
24
|
-
// non-final
|
|
25
|
-
RUNNING, QUEUED,
|
|
26
|
-
|
|
27
|
-
// final
|
|
28
|
-
ERROR, FAIL, UPDATED, SUCCESS, IDLE, SKIPPED
|
|
29
|
-
];
|
|
30
|
-
|
|
31
|
-
exports.logger = pick(console, ['log', 'warn', 'error']);
|
|
32
|
-
|
|
33
|
-
exports.isSuccessStatus = (status) => status === SUCCESS;
|
|
34
|
-
exports.isFailStatus = (status) => status === FAIL;
|
|
35
|
-
exports.isIdleStatus = (status) => status === IDLE;
|
|
36
|
-
exports.isRunningStatus = (status) => status === RUNNING;
|
|
37
|
-
exports.isErroredStatus = (status) => status === ERROR;
|
|
38
|
-
exports.isSkippedStatus = (status) => status === SKIPPED;
|
|
39
|
-
exports.isUpdatedStatus = (status) => status === UPDATED;
|
|
40
|
-
|
|
41
|
-
exports.determineStatus = (statuses) => {
|
|
42
|
-
if (!statuses.length) {
|
|
43
|
-
return SUCCESS;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const set = new Set(statuses);
|
|
47
|
-
for (const status of statusPriority) {
|
|
48
|
-
if (set.has(status)) {
|
|
49
|
-
return status;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
console.error('Unknown statuses: ' + JSON.stringify(statuses));
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
exports.isUrl = (str) => {
|
|
57
|
-
if (typeof str !== 'string') {
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const parsedUrl = url.parse(str);
|
|
62
|
-
|
|
63
|
-
return parsedUrl.host && parsedUrl.protocol;
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
exports.buildUrl = (href, {host} = {}) => {
|
|
67
|
-
return host
|
|
68
|
-
? url.format(Object.assign(url.parse(href), {host}))
|
|
69
|
-
: href;
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
exports.fetchFile = async (url, options) => {
|
|
73
|
-
try {
|
|
74
|
-
const {data, status} = await axios.get(url, options);
|
|
75
|
-
|
|
76
|
-
return {data, status};
|
|
77
|
-
} catch (e) {
|
|
78
|
-
exports.logger.warn(`Error while fetching ${url}`, e);
|
|
79
|
-
|
|
80
|
-
// 'unknown' for request blocked by CORS policy
|
|
81
|
-
const status = e.response ? e.response.status : 'unknown';
|
|
82
|
-
|
|
83
|
-
return {data: null, status};
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
exports.normalizeUrls = (urls = [], baseUrl) => {
|
|
88
|
-
const baseUrlsSearch = new URL(baseUrl).search;
|
|
89
|
-
|
|
90
|
-
return urls.map(url => {
|
|
91
|
-
try {
|
|
92
|
-
const newUrl = new URL(url, baseUrl);
|
|
93
|
-
|
|
94
|
-
// URL's parameters can specify directory at file server
|
|
95
|
-
if (isRelativeUrl(url) && !newUrl.search) {
|
|
96
|
-
newUrl.search = baseUrlsSearch;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return newUrl.href;
|
|
100
|
-
} catch (e) {
|
|
101
|
-
exports.logger.warn(`Can not normalize url '${url} for base url '${baseUrl}'`, e);
|
|
102
|
-
|
|
103
|
-
return url;
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
function isRelativeUrl(url) {
|
|
109
|
-
try {
|
|
110
|
-
// eslint-disable-next-line no-new
|
|
111
|
-
new URL(url);
|
|
112
|
-
|
|
113
|
-
return false;
|
|
114
|
-
} catch (e) {
|
|
115
|
-
return true;
|
|
116
|
-
}
|
|
117
|
-
}
|
package/lib/constants/browser.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const DB_TYPES = {int: 'INT', text: 'TEXT'};
|
|
4
|
-
const DB_COLUMNS = {
|
|
5
|
-
SUITE_PATH: 'suitePath',
|
|
6
|
-
SUITE_NAME: 'suiteName',
|
|
7
|
-
NAME: 'name',
|
|
8
|
-
SUITE_URL: 'suiteUrl',
|
|
9
|
-
META_INFO: 'metaInfo',
|
|
10
|
-
HISTORY: 'history',
|
|
11
|
-
DESCRIPTION: 'description',
|
|
12
|
-
ERROR: 'error',
|
|
13
|
-
SKIP_REASON: 'skipReason',
|
|
14
|
-
IMAGES_INFO: 'imagesInfo',
|
|
15
|
-
SCREENSHOT: 'screenshot',
|
|
16
|
-
MULTIPLE_TABS: 'multipleTabs',
|
|
17
|
-
STATUS: 'status',
|
|
18
|
-
TIMESTAMP: 'timestamp'
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const SUITES_TABLE_COLUMNS = [
|
|
22
|
-
{name: DB_COLUMNS.SUITE_PATH, type: DB_TYPES.text},
|
|
23
|
-
{name: DB_COLUMNS.SUITE_NAME, type: DB_TYPES.text},
|
|
24
|
-
{name: DB_COLUMNS.NAME, type: DB_TYPES.text},
|
|
25
|
-
{name: DB_COLUMNS.SUITE_URL, type: DB_TYPES.text},
|
|
26
|
-
{name: DB_COLUMNS.META_INFO, type: DB_TYPES.text},
|
|
27
|
-
{name: DB_COLUMNS.HISTORY, type: DB_TYPES.text},
|
|
28
|
-
{name: DB_COLUMNS.DESCRIPTION, type: DB_TYPES.text},
|
|
29
|
-
{name: DB_COLUMNS.ERROR, type: DB_TYPES.text},
|
|
30
|
-
{name: DB_COLUMNS.SKIP_REASON, type: DB_TYPES.text},
|
|
31
|
-
{name: DB_COLUMNS.IMAGES_INFO, type: DB_TYPES.text},
|
|
32
|
-
{name: DB_COLUMNS.SCREENSHOT, type: DB_TYPES.int}, //boolean - 0 or 1
|
|
33
|
-
{name: DB_COLUMNS.MULTIPLE_TABS, type: DB_TYPES.int}, //boolean - 0 or 1
|
|
34
|
-
{name: DB_COLUMNS.STATUS, type: DB_TYPES.text},
|
|
35
|
-
{name: DB_COLUMNS.TIMESTAMP, type: DB_TYPES.int}
|
|
36
|
-
];
|
|
37
|
-
|
|
38
|
-
module.exports = {
|
|
39
|
-
DB_MAX_AVAILABLE_PAGE_SIZE: 65536, // helps to speed up queries
|
|
40
|
-
DB_SUITES_TABLE_NAME: 'suites',
|
|
41
|
-
DB_COLUMNS,
|
|
42
|
-
SUITES_TABLE_COLUMNS,
|
|
43
|
-
LOCAL_DATABASE_NAME: 'sqlite.db',
|
|
44
|
-
DATABASE_URLS_JSON_NAME: 'databaseUrls.json',
|
|
45
|
-
DB_COLUMN_INDEXES: SUITES_TABLE_COLUMNS.reduce((acc, {name}, index) => {
|
|
46
|
-
acc[name] = index;
|
|
47
|
-
return acc;
|
|
48
|
-
}, {})
|
|
49
|
-
};
|
package/lib/db-utils/common.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const _ = require('lodash');
|
|
4
|
-
const {logger} = require('../common-utils');
|
|
5
|
-
const {DB_MAX_AVAILABLE_PAGE_SIZE, DB_SUITES_TABLE_NAME, SUITES_TABLE_COLUMNS, DB_COLUMN_INDEXES} = require('../constants/database');
|
|
6
|
-
|
|
7
|
-
exports.selectAllQuery = (tableName) => `SELECT * FROM ${tableName}`;
|
|
8
|
-
exports.selectAllSuitesQuery = () => exports.selectAllQuery(DB_SUITES_TABLE_NAME);
|
|
9
|
-
|
|
10
|
-
exports.createTablesQuery = () => [
|
|
11
|
-
createTableQuery(DB_SUITES_TABLE_NAME, SUITES_TABLE_COLUMNS)
|
|
12
|
-
];
|
|
13
|
-
|
|
14
|
-
exports.compareDatabaseRowsByTimestamp = (row1, row2) => {
|
|
15
|
-
return row1[DB_COLUMN_INDEXES.timestamp] - row2[DB_COLUMN_INDEXES.timestamp];
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
exports.handleDatabases = async (dbJsonUrls, opts = {}) => {
|
|
19
|
-
return _.flattenDeep(
|
|
20
|
-
await Promise.all(
|
|
21
|
-
dbJsonUrls.map(async dbJsonUrl => {
|
|
22
|
-
try {
|
|
23
|
-
const currentJsonResponse = await opts.loadDbJsonUrl(dbJsonUrl);
|
|
24
|
-
|
|
25
|
-
if (!currentJsonResponse.data) {
|
|
26
|
-
logger.warn(`Cannot get data from ${dbJsonUrl}`);
|
|
27
|
-
|
|
28
|
-
return opts.formatData ? opts.formatData(dbJsonUrl, currentJsonResponse.status) : [];
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// JSON format declare at lib/static/modules/actions.js
|
|
32
|
-
const {dbUrls, jsonUrls} = currentJsonResponse.data;
|
|
33
|
-
|
|
34
|
-
// paths from databaseUrls.json may be relative or absolute
|
|
35
|
-
const preparedDbUrls = opts.prepareUrls(dbUrls, dbJsonUrl);
|
|
36
|
-
const preparedDbJsonUrls = opts.prepareUrls(jsonUrls, dbJsonUrl);
|
|
37
|
-
|
|
38
|
-
return await Promise.all([
|
|
39
|
-
exports.handleDatabases(preparedDbJsonUrls, opts),
|
|
40
|
-
...preparedDbUrls.map(dbUrl => opts.loadDbUrl(dbUrl, opts))
|
|
41
|
-
]);
|
|
42
|
-
} catch (e) {
|
|
43
|
-
logger.warn(`Error while downloading databases from ${dbJsonUrl}`, e);
|
|
44
|
-
|
|
45
|
-
return opts.formatData ? opts.formatData(dbJsonUrl) : [];
|
|
46
|
-
}
|
|
47
|
-
}),
|
|
48
|
-
),
|
|
49
|
-
);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
exports.mergeTables = ({db, dbPaths, getExistingTables = () => {}}) => {
|
|
53
|
-
db.prepare(`PRAGMA page_size = ${DB_MAX_AVAILABLE_PAGE_SIZE}`).run();
|
|
54
|
-
|
|
55
|
-
for (const dbPath of dbPaths) {
|
|
56
|
-
db.prepare(`ATTACH DATABASE '${dbPath}' AS attached`).run();
|
|
57
|
-
|
|
58
|
-
const getTablesStatement = db.prepare(`SELECT name FROM attached.sqlite_master WHERE type='table'`);
|
|
59
|
-
const tables = getExistingTables(getTablesStatement);
|
|
60
|
-
|
|
61
|
-
for (const tableName of tables) {
|
|
62
|
-
db.prepare(`CREATE TABLE IF NOT EXISTS ${tableName} AS SELECT * FROM attached.${tableName} LIMIT 0`).run();
|
|
63
|
-
db.prepare(`INSERT OR IGNORE INTO ${tableName} SELECT * FROM attached.${tableName}`).run();
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
db.prepare(`DETACH attached`).run();
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
function createTableQuery(tableName, columns) {
|
|
71
|
-
const formattedColumns = columns
|
|
72
|
-
.map(({name, type}) => `${name} ${type}`)
|
|
73
|
-
.join(', ');
|
|
74
|
-
|
|
75
|
-
return `CREATE TABLE IF NOT EXISTS ${tableName} (${formattedColumns})`;
|
|
76
|
-
}
|
package/lib/gui/index.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const chalk = require('chalk');
|
|
4
|
-
const opener = require('opener');
|
|
5
|
-
const server = require('./server');
|
|
6
|
-
const {logger} = require('../common-utils');
|
|
7
|
-
const {logError} = require('../server-utils');
|
|
8
|
-
|
|
9
|
-
module.exports = (args) => {
|
|
10
|
-
server.start(args)
|
|
11
|
-
.then(({url}) => {
|
|
12
|
-
logger.log(`GUI is running at ${chalk.cyan(url)}`);
|
|
13
|
-
args.configs.options.open && opener(url);
|
|
14
|
-
})
|
|
15
|
-
.catch((err) => {
|
|
16
|
-
logError(err);
|
|
17
|
-
process.exit(1);
|
|
18
|
-
});
|
|
19
|
-
};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
import {extend, isNumber} from 'lodash';
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import {connect} from 'react-redux';
|
|
6
|
-
|
|
7
|
-
import {getVisibleRootSuiteIds} from '../../modules/selectors/tree';
|
|
8
|
-
|
|
9
|
-
const BottomProgressBar = (props) => {
|
|
10
|
-
const {progressBar: {currentRootSuiteId}, visibleRootSuiteIds} = props;
|
|
11
|
-
const suiteIdsIndexMap = React.useMemo(
|
|
12
|
-
() => visibleRootSuiteIds.reduce((map, suiteId, idx) => extend(map, {[suiteId]: idx}), {}),
|
|
13
|
-
[visibleRootSuiteIds]
|
|
14
|
-
);
|
|
15
|
-
const currentRootSuiteIdx = suiteIdsIndexMap[currentRootSuiteId];
|
|
16
|
-
const percent = 100 / (visibleRootSuiteIds.length - 1) * currentRootSuiteIdx;
|
|
17
|
-
|
|
18
|
-
if (!isNumber(currentRootSuiteIdx)) {
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<div className="bottom-progress-bar">
|
|
24
|
-
<div className='bottom-progress-bar__progress-container'>
|
|
25
|
-
<div className='bottom-progress-bar__progress-bar' style={{width: `${percent}%`}}></div>
|
|
26
|
-
<div className='bottom-progress-bar__counter'>
|
|
27
|
-
{currentRootSuiteId}
|
|
28
|
-
<span>
|
|
29
|
-
{' '}(<strong>{currentRootSuiteIdx + 1}</strong> suite of <strong>{visibleRootSuiteIds.length}</strong>)
|
|
30
|
-
</span>
|
|
31
|
-
</div>
|
|
32
|
-
</div>
|
|
33
|
-
</div>
|
|
34
|
-
);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export default connect(
|
|
38
|
-
(state) => ({
|
|
39
|
-
progressBar: state.progressBar,
|
|
40
|
-
visibleRootSuiteIds: getVisibleRootSuiteIds(state)
|
|
41
|
-
}),
|
|
42
|
-
)(BottomProgressBar);
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import React, {Component} from 'react';
|
|
2
|
-
import {bindActionCreators} from 'redux';
|
|
3
|
-
import {connect} from 'react-redux';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
import * as actions from '../../modules/actions';
|
|
6
|
-
import ControlButton from './control-button';
|
|
7
|
-
import {getAcceptableOpenedImageIds} from '../../modules/selectors/tree';
|
|
8
|
-
|
|
9
|
-
class AcceptOpenedButton extends Component {
|
|
10
|
-
static propTypes = {
|
|
11
|
-
// from store
|
|
12
|
-
processing: PropTypes.bool.isRequired,
|
|
13
|
-
acceptableOpenedImageIds: PropTypes.arrayOf(PropTypes.string).isRequired
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
_acceptOpened = () => {
|
|
17
|
-
this.props.actions.acceptOpened(this.props.acceptableOpenedImageIds);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
render() {
|
|
21
|
-
const {acceptableOpenedImageIds, processing} = this.props;
|
|
22
|
-
|
|
23
|
-
return <ControlButton
|
|
24
|
-
label="Accept opened"
|
|
25
|
-
isDisabled={!acceptableOpenedImageIds.length || processing}
|
|
26
|
-
handler={this._acceptOpened}
|
|
27
|
-
/>;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export default connect(
|
|
32
|
-
(state) => {
|
|
33
|
-
return {
|
|
34
|
-
processing: state.processing,
|
|
35
|
-
acceptableOpenedImageIds: getAcceptableOpenedImageIds(state)
|
|
36
|
-
};
|
|
37
|
-
},
|
|
38
|
-
(dispatch) => ({actions: bindActionCreators(actions, dispatch)})
|
|
39
|
-
)(AcceptOpenedButton);
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
import React, {Component} from 'react';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
import {bindActionCreators} from 'redux';
|
|
6
|
-
import {connect} from 'react-redux';
|
|
7
|
-
import * as actions from '../../modules/actions';
|
|
8
|
-
|
|
9
|
-
class BaseHostInput extends Component {
|
|
10
|
-
static propTypes = {
|
|
11
|
-
baseHost: PropTypes.string.isRequired,
|
|
12
|
-
actions: PropTypes.object.isRequired
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
constructor(props) {
|
|
16
|
-
super(props);
|
|
17
|
-
this._onChange = this._onChange.bind(this);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
render() {
|
|
21
|
-
return (
|
|
22
|
-
<input
|
|
23
|
-
className="control-input basehost__text"
|
|
24
|
-
value={this.props.baseHost}
|
|
25
|
-
placeholder="change original host for view in browser"
|
|
26
|
-
onChange={this._onChange}
|
|
27
|
-
/>
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
_onChange(event) {
|
|
32
|
-
this.props.actions.updateBaseHost(event.target.value);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export default connect(
|
|
37
|
-
(state) => ({baseHost: state.view.baseHost}),
|
|
38
|
-
(dispatch) => ({actions: bindActionCreators(actions, dispatch)})
|
|
39
|
-
)(BaseHostInput);
|
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
import React, {useState, useMemo, useEffect, useCallback} from 'react';
|
|
4
|
-
import {flatten, isEmpty, get, chain, compact} from 'lodash';
|
|
5
|
-
import PropTypes from 'prop-types';
|
|
6
|
-
import CheckboxTree from 'react-checkbox-tree';
|
|
7
|
-
|
|
8
|
-
import Label from './label';
|
|
9
|
-
import {mkBrowserIcon, buildComplexId} from './utils';
|
|
10
|
-
import Popup from '../../popup';
|
|
11
|
-
import ArrayContainer from '../../../containers/array';
|
|
12
|
-
|
|
13
|
-
import 'react-checkbox-tree/lib/react-checkbox-tree.css';
|
|
14
|
-
import './index.styl';
|
|
15
|
-
|
|
16
|
-
const BrowserList = (props) => {
|
|
17
|
-
const {available, onChange, selected: selectedProp} = props;
|
|
18
|
-
|
|
19
|
-
const [expanded, setExpanded] = useState([]);
|
|
20
|
-
const [selected, setSelected] = useState(buidSelectedItems());
|
|
21
|
-
const [elements, setElements] = useState([]);
|
|
22
|
-
const treeDataMap = useMemo(buildTreeDataMap, [available]);
|
|
23
|
-
const nodes = useMemo(prepareTreeData, [available]);
|
|
24
|
-
const selectAll = useCallback(_selectAll, [setExpanded, treeDataMap]);
|
|
25
|
-
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
updateLabels();
|
|
28
|
-
onChange && onChange(formatSelectedData(selected));
|
|
29
|
-
}, [selected]);
|
|
30
|
-
|
|
31
|
-
function buildTreeDataMap() {
|
|
32
|
-
return available.reduce((acc, {id: browserId, versions}) => {
|
|
33
|
-
const hasChildren = !isEmpty(versions) && versions.length > 1;
|
|
34
|
-
|
|
35
|
-
acc[buildComplexId(browserId)] = {browserId, isLeaf: !hasChildren};
|
|
36
|
-
|
|
37
|
-
if (hasChildren) {
|
|
38
|
-
versions.forEach(version => {
|
|
39
|
-
acc[buildComplexId(browserId, version)] = {browserId, version, isLeaf: true};
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return acc;
|
|
44
|
-
}, {});
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function buidSelectedItems() {
|
|
48
|
-
if (!selectedProp || !selectedProp.length) {
|
|
49
|
-
return [];
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const selectedItems = selectedProp.map(({id, versions}) => {
|
|
53
|
-
if (!versions) {
|
|
54
|
-
return [];
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const availableNode = available.find((item) => item.id === id);
|
|
58
|
-
const shouldDrawOnlyRootNode = get(availableNode, 'versions.length', 1) === 1;
|
|
59
|
-
|
|
60
|
-
if (shouldDrawOnlyRootNode) {
|
|
61
|
-
return buildComplexId(id);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return versions.length
|
|
65
|
-
? versions.map((version) => buildComplexId(id, version))
|
|
66
|
-
: availableNode.versions.map(version => buildComplexId(id, version));
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
return flatten(selectedItems);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function prepareTreeData() {
|
|
73
|
-
const mkNode = ({browserId, version, icon}) => ({
|
|
74
|
-
icon,
|
|
75
|
-
data: {browserId, version},
|
|
76
|
-
value: buildComplexId(browserId, version),
|
|
77
|
-
label: mkLabel({browserId, version, elements})
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
return available.map(({id: browserId, versions}) => {
|
|
81
|
-
const node = mkNode({browserId, icon: mkBrowserIcon(browserId)});
|
|
82
|
-
|
|
83
|
-
if (!isEmpty(versions) && versions.length > 1) {
|
|
84
|
-
node.children = versions.map(version => mkNode({browserId, version}));
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return node;
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function _selectAll() {
|
|
92
|
-
const leaves = Object.keys(treeDataMap).filter(key => treeDataMap[key].isLeaf);
|
|
93
|
-
const cb = selected => selected.length !== leaves.length
|
|
94
|
-
? leaves
|
|
95
|
-
: selected;
|
|
96
|
-
|
|
97
|
-
setSelected(cb);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
function mkLabel({browserId, version, elements}) {
|
|
101
|
-
return (
|
|
102
|
-
<Label
|
|
103
|
-
treeDataMap={treeDataMap}
|
|
104
|
-
browserId={browserId}
|
|
105
|
-
version={version}
|
|
106
|
-
elements={elements}
|
|
107
|
-
setSelected={setSelected}
|
|
108
|
-
/>
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function buildElements() {
|
|
113
|
-
const availableVersionsCount = available.reduce((acc, browser) => {
|
|
114
|
-
acc[browser.id] = browser.versions ? browser.versions.length : undefined;
|
|
115
|
-
return acc;
|
|
116
|
-
}, {});
|
|
117
|
-
|
|
118
|
-
const selectedBrowsers = selected.reduce((acc, value) => {
|
|
119
|
-
if (!treeDataMap[value]) {
|
|
120
|
-
return acc;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
const {browserId, version} = treeDataMap[value];
|
|
124
|
-
|
|
125
|
-
acc[browserId] = acc[browserId] || [];
|
|
126
|
-
|
|
127
|
-
if (version) {
|
|
128
|
-
acc[browserId].push(version);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return acc;
|
|
132
|
-
}, {});
|
|
133
|
-
|
|
134
|
-
const elementsNew = [];
|
|
135
|
-
|
|
136
|
-
for (const browserId in selectedBrowsers) {
|
|
137
|
-
const versions = selectedBrowsers[browserId];
|
|
138
|
-
if (!versions.length || (availableVersionsCount[browserId] === versions.length)) {
|
|
139
|
-
elementsNew.push(browserId);
|
|
140
|
-
} else {
|
|
141
|
-
elementsNew.push(...versions.map(version => buildComplexId(browserId, version)));
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
return elementsNew;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
function updateLabels() {
|
|
149
|
-
const newElements = buildElements();
|
|
150
|
-
|
|
151
|
-
if (get(elements, 'length', 0) !== 1 && get(newElements, 'length', 0) !== 1) {
|
|
152
|
-
setElements(newElements);
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
const updatingValues = [
|
|
157
|
-
get(newElements, 'length', undefined) === 1 && newElements[0],
|
|
158
|
-
get(elements, 'length', undefined) === 1 && elements[0]
|
|
159
|
-
];
|
|
160
|
-
|
|
161
|
-
const nodesFlat = nodes.reduce((arr, node) => {
|
|
162
|
-
const children = node.children || [];
|
|
163
|
-
|
|
164
|
-
arr.push(node);
|
|
165
|
-
children.forEach(child => arr.push(child));
|
|
166
|
-
|
|
167
|
-
return arr;
|
|
168
|
-
}, []);
|
|
169
|
-
|
|
170
|
-
const updatingNodes = nodesFlat.filter(node => {
|
|
171
|
-
const {browserId, version} = node.data;
|
|
172
|
-
|
|
173
|
-
return updatingValues.includes(buildComplexId(browserId, version));
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
updatingNodes.forEach(node => {
|
|
177
|
-
const {browserId, version} = node.data;
|
|
178
|
-
node.label = mkLabel({browserId, version, elements: newElements});
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
setElements(newElements);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
function formatSelectedData(selectedItems) {
|
|
185
|
-
return chain(selectedItems)
|
|
186
|
-
.reduce((acc, value) => {
|
|
187
|
-
const {browserId, version} = treeDataMap[value] || {};
|
|
188
|
-
|
|
189
|
-
if (browserId) {
|
|
190
|
-
acc[browserId] = acc[browserId] || [];
|
|
191
|
-
acc[browserId].push(version);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
return acc;
|
|
195
|
-
}, {})
|
|
196
|
-
.map((versions, id) => ({id, versions: compact(versions)}))
|
|
197
|
-
.value();
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
if (isEmpty(available)) {
|
|
201
|
-
return (<div></div>);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
return (
|
|
205
|
-
<div className="browserlist">
|
|
206
|
-
<Popup
|
|
207
|
-
target={<ArrayContainer elements={elements} placeholder="Browsers" />}
|
|
208
|
-
action="click"
|
|
209
|
-
>
|
|
210
|
-
<div>
|
|
211
|
-
<button className='rct-controls' onClick={selectAll}>
|
|
212
|
-
Select all
|
|
213
|
-
</button>
|
|
214
|
-
<CheckboxTree
|
|
215
|
-
nodes={nodes}
|
|
216
|
-
checked={selected}
|
|
217
|
-
expanded={expanded}
|
|
218
|
-
onCheck={setSelected}
|
|
219
|
-
onExpand={setExpanded}
|
|
220
|
-
/>
|
|
221
|
-
</div>
|
|
222
|
-
</Popup>
|
|
223
|
-
</div>
|
|
224
|
-
);
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
BrowserList.propTypes = {
|
|
228
|
-
available: PropTypes.arrayOf(PropTypes.shape({
|
|
229
|
-
id: PropTypes.string,
|
|
230
|
-
versions: PropTypes.arrayOf(PropTypes.string)
|
|
231
|
-
})).isRequired,
|
|
232
|
-
selected: PropTypes.arrayOf(PropTypes.shape({
|
|
233
|
-
id: PropTypes.string,
|
|
234
|
-
versions: PropTypes.arrayOf(PropTypes.string)
|
|
235
|
-
})),
|
|
236
|
-
onChange: PropTypes.func.isRequired
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
export default BrowserList;
|