This repository was archived by the owner on Jan 14, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
[ORCT-164] Puppeteer setup #182
Merged
Merged
Changes from all commits
Commits
Show all changes
87 commits
Select commit
Hold shift + click to select a range
8216274
New api periods
Ehevi 073fef1
Apply eslint rules :sparkles:
Ehevi f2b237b
Use message panels
Ehevi c3df896
Messages
Ehevi 2a9f8eb
Add dataAccess
Ehevi 00965ae
Move userPreferences up in model hierarchy
Ehevi f917829
Eslint :sparkles:
Ehevi 116ce04
Cleanup :broom:
Ehevi 7beba23
Cleanup :broom:
Ehevi cce4554
Display periods from the new API
Ehevi b3c38e5
Run energies
Ehevi b2ca901
Periods css update
Ehevi 31cd33b
Update user preferences access
Ehevi ebcb8a4
Enable data selection
Ehevi 544140f
Add column filtering options
Ehevi a571ef6
Add pagination
Ehevi 81cd499
Add year field
Ehevi 01b4528
Improve display of the distinct energies
Ehevi 091377a
Rename pager to obsolete pager
Ehevi 5e0fc39
Remove the old period field name config
Ehevi dc18122
Mark previous items couter as obsolete
Ehevi b3060f9
Use the new items counter in the periods view
Ehevi c879e25
Docs cleanup :broom:
Ehevi 5b565e3
Rename column display options
Ehevi 4b90f21
Rename css class
Ehevi 9ee617a
Rename column display options select
Ehevi 7f66310
Cleanup :broom:
Ehevi e27b345
Use the tableManager row
Ehevi ae26171
Fix setting rows on page
Ehevi 4311b94
Cleanup :broom:
Ehevi 46e3168
Fix pagination
Ehevi 628e3f0
Cleanup :broom:
Ehevi 7beb922
ItemsCounter cleanup :broom:
Ehevi ad51576
SetRowsOnSite cleanup :broom:
Ehevi ab7af4e
Cleanup :broom:
Ehevi 5cf1469
Cleanup :broom:
Ehevi 21acc3d
Remove unused delay function
Ehevi 96b1cef
Rename header columns
Ehevi 7745401
Cleanup :broom:
Ehevi 574d884
Cleanup :broom:
Ehevi 6060f57
Quickfix
Ehevi 6b67ef7
[ORCT-157] Mark obsolete data requests as @deprecated (#176)
Ehevi e936501
Add items counter test
Ehevi efea3d5
Rename files
Ehevi e3c3103
Prepare periods export modal
Ehevi b3b12ab
Enable user to select csv or json export
Ehevi bf04c25
Cleanup :broom:
Ehevi 5b47e18
Mark obsolete csv download as deprecated
Ehevi f8becf7
Pass userPreferences directly to modals
Ehevi 4ab63c8
Cleanup :broom:
Ehevi 384dc79
Cleanup :broom:
Ehevi 606f3c7
Remove dependencies
Ehevi d54b1db
Fix preparedData in obsoleteCsvExport
Ehevi 1e4b1c9
Cleanup :broom:
Ehevi 0fbf57a
Use the model name as downloaded filename for exports
Ehevi acda977
Add capitalization tests
Ehevi d2d7cd8
Add readable file size test
Ehevi 9104a20
Cleanup :broom:
Ehevi fdf8618
Cleanup :broom:
Ehevi 7ea3ace
Tests cleanup :broom:
Ehevi 66529b0
Enum content types
Ehevi ca85ace
Add CSV data preparation test
Ehevi 809176a
Remove console logs
Ehevi 4fdc9b5
Fix dataExport modal rendering condition
Ehevi 8c4d9d7
Address review comments
Ehevi e3e30a7
Address review comments
Ehevi f4aa38e
Remove capitalizeFirstLetter function
Ehevi 6950d88
Newlines
Ehevi 489c1d6
Pagename tests
Ehevi ac25f2f
Cleanup :broom:
Ehevi 85bb90a
Sort cleanup
Ehevi c2e7267
Address review comments
Ehevi ad73985
Address review comments
Ehevi 4277845
Move pageTitle to separate component
Ehevi 4a06657
Chai export cleanup :broom:
Ehevi d25936a
Tests cleanup :broom:
Ehevi 9c58165
Tests cleanup :broom:
Ehevi 9cee950
Cleanup :broom:
Ehevi 64d92db
Puppeteer sandbox
Ehevi a629bcc
less dependencies
xsalonx f9deb0a
docker node image to alpine due to puppeteer related reason
xsalonx 73994a2
Page load test
Ehevi dce1bac
Build url test
Ehevi 3480826
Cleanup :broom:
Ehevi 35ccea8
Check page title
Ehevi 88598ac
Cleanup :broom:
Ehevi de7df4b
Merge branch 'master' into test/ORCT-164/puppeteer-setup
Ehevi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,127 @@ | ||
| /** | ||
| * @license | ||
| * Copyright CERN and copyright holders of ALICE O2. This software is | ||
| * distributed under the terms of the GNU General Public License v3 (GPL | ||
| * Version 3), copied verbatim in the file "COPYING". | ||
| * | ||
| * See http://alice-o2.web.cern.ch/license for full licensing information. | ||
| * | ||
| * In applying this license CERN does not waive the privileges and immunities | ||
| * granted to it by virtue of its status as an Intergovernmental Organization | ||
| * or submit itself to any jurisdiction. | ||
| */ | ||
|
|
||
| /** | ||
| * @typedef {string|number|null|boolean} QueryParameterValue | ||
| */ | ||
|
|
||
| /** | ||
| * Build a URL from a base URL (that may already have query parameters) and a list of query parameters | ||
| * | ||
| * @param {string} baseURL the base URL to which parameters should be added | ||
| * @param {object} parameters the query parameters | ||
| * @return {string} URL the built URL | ||
| */ | ||
| exports.buildUrl = (baseURL, parameters) => { | ||
| if (!parameters) { | ||
| parameters = {}; | ||
| } | ||
| const [url, existingParameters] = baseURL.split('?'); | ||
|
|
||
| /** | ||
| * Build a parameter object or array from a parameters keys path | ||
| * | ||
| * For example, a parameter `key1[key2][]=value` translates to keys path ['key1', 'key2', ''] and will lead to {key1: {key2: [value]}} | ||
| * | ||
| * @param {object|array} parentParameter the parameter's object or array up to the current key | ||
| * @param {array} nestedKeys the keys path to build from the current point | ||
| * @param {string} value the value of the parameter represented by the key path | ||
| * @param {string|null} absoluteCurrentKey the full key currently building, used to display useful error message | ||
| * @return {void} | ||
| */ | ||
| const buildParameterFromNestedKeys = (parentParameter, nestedKeys, value, absoluteCurrentKey) => { | ||
| const currentKey = nestedKeys.shift(); | ||
| const absoluteParentKey = absoluteCurrentKey; | ||
| absoluteCurrentKey = absoluteCurrentKey ? `${absoluteCurrentKey}[${currentKey}]` : currentKey; | ||
|
|
||
| if (currentKey === '') { | ||
| // Parameter must be an array and the value is a new item in that array | ||
| if (!Array.isArray(parentParameter)) { | ||
| throw new Error(`Existing parameter at key <${absoluteParentKey}> is an array`); | ||
| } | ||
|
|
||
| parentParameter.push(value); | ||
| } else if (currentKey) { | ||
| // Parameter must be an object and the value is a property in that array | ||
| if (Array.isArray(parentParameter) || typeof parentParameter !== 'object' || parentParameter === null) { | ||
| throw new Error(`Existing parameter at key <${absoluteParentKey}> expects nested values`); | ||
| } | ||
|
|
||
| if (nestedKeys.length > 0) { | ||
| // We still have nested keys to fill | ||
| if (!(currentKey in parentParameter)) { | ||
| parentParameter[currentKey] = nestedKeys[0] === '' ? [] : {}; | ||
| } | ||
| buildParameterFromNestedKeys(parentParameter[currentKey], nestedKeys, value, absoluteCurrentKey); | ||
| } else { | ||
| if (Array.isArray(parentParameter[currentKey])) { | ||
| throw new Error(`Existing parameter at key <${currentKey}> is not an array`); | ||
| } else if (typeof parentParameter[currentKey] === 'object' && parentParameter[currentKey] !== null) { | ||
| throw new Error(`Existing parameter at key <${currentKey}> is not nested`); | ||
| } | ||
| parentParameter[currentKey] = value; | ||
| } | ||
| } | ||
| }; | ||
|
|
||
| if (existingParameters) { | ||
| for (const formattedParameter of existingParameters.split('&')) { | ||
| const [key, value] = formattedParameter.split('='); | ||
| const [firstKey, ...dirtyKeys] = key.split('['); | ||
| const nestedKeys = [firstKey, ...dirtyKeys.map((key) => key.slice(0, -1))]; | ||
xsalonx marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| buildParameterFromNestedKeys(parameters, nestedKeys, value, null); | ||
| } | ||
| } | ||
|
|
||
| const serializedQueryParameters = []; | ||
|
|
||
| if (Object.keys(parameters).length === 0) { | ||
| return url; | ||
| } | ||
|
|
||
| /** | ||
| * Stringify a query parameter to be used in a URL and push it in the serialized query parameters list | ||
| * | ||
| * @param {string} key the parameter's key | ||
| * @param {QueryParameterValue} value the parameter's value | ||
| * @return {void} | ||
| */ | ||
| const formatAndPushQueryParameter = (key, value) => { | ||
| if (value === undefined) { | ||
| return; | ||
| } | ||
|
|
||
| if (Array.isArray(value)) { | ||
| for (const subValue of value) { | ||
| formatAndPushQueryParameter(`${key}[]`, subValue); | ||
| } | ||
| return; | ||
| } | ||
|
|
||
| if (typeof value === 'object' && value !== null) { | ||
| for (const [subKey, subValue] of Object.entries(value)) { | ||
| formatAndPushQueryParameter(`${key}[${subKey}]`, subValue); | ||
| } | ||
| return; | ||
| } | ||
|
|
||
| serializedQueryParameters.push(`${key}=${value}`); | ||
| }; | ||
xsalonx marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| for (const [key, parameter] of Object.entries(parameters)) { | ||
| formatAndPushQueryParameter(key, parameter); | ||
| } | ||
|
|
||
| return `${url}?${serializedQueryParameters.join('&')}`; | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,31 @@ | ||
| FROM node:18.16.0-buster as base | ||
| FROM node:18-alpine3.17 as base | ||
| WORKDIR /opt/RunConditionTable | ||
|
|
||
| RUN apt update -y && apt install -y \ | ||
| netcat \ | ||
| bash | ||
| RUN apk add --no-cache \ | ||
| bash=5.2.15-r0 \ | ||
| netcat-openbsd | ||
|
|
||
|
|
||
| # Installs Git and packages required for Puppeteer | ||
| # https://pkgs.alpinelinux.org/packages | ||
| RUN apk add --no-cache \ | ||
| chromium=112.0.5615.165-r0 \ | ||
| freetype=2.12.1-r0 \ | ||
| freetype-dev=2.12.1-r0 \ | ||
| git=2.38.5-r0 \ | ||
| harfbuzz=5.3.1-r1 \ | ||
| ca-certificates=20230506-r0 \ | ||
| ttf-freefont=20120503-r3 | ||
|
|
||
| # Tell Puppeteer to skip installing Chrome. We'll be using the installed package. | ||
| ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true | ||
| ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser | ||
|
|
||
| COPY ./package*.json ./ | ||
| RUN npm --silent ci | ||
|
|
||
|
|
||
| FROM base as dev | ||
| RUN apt update -y && apt install -y \ | ||
| postgresql-client | ||
| RUN apk add postgresql-client | ||
|
|
||
| FROM base as test |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.