From 188ace759dd556d1a58d1c19a086201fc515b3cf Mon Sep 17 00:00:00 2001 From: Janne Antikainen Date: Fri, 25 Aug 2023 13:11:19 +0300 Subject: [PATCH 1/4] feedids to matka, filter logic to matka, housekeeping --- .dockerignore | 1 + .gitignore | 1 + package-lock.json | 64 ++++++++++++++++++++-------------------- package.json | 2 +- server/package-lock.json | 19 ++++++++++++ server/package.json | 4 ++- src/defaultConfig.js | 15 ++++++++++ src/monitorConfig.js | 10 +++++++ src/ui/StopCardRow.tsx | 8 +++++ 9 files changed, 90 insertions(+), 34 deletions(-) diff --git a/.dockerignore b/.dockerignore index db7415af..cd245342 100644 --- a/.dockerignore +++ b/.dockerignore @@ -7,3 +7,4 @@ README.md docker-compose.yml node_modules server/node_modules +**/.env diff --git a/.gitignore b/.gitignore index c5291925..92b9bd62 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,4 @@ yarn-debug.log* yarn-error.log* yarn.lock dump.rdb +**/.env diff --git a/package-lock.json b/package-lock.json index 12baa0e9..9106889e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "MIT", "dependencies": { "@apollo/client": "^3.3.19", - "@digitransit-component/digitransit-component-autosuggest": "1.9.4", + "@digitransit-component/digitransit-component-autosuggest": "1.9.10", "@habx/apollo-multi-endpoint-link": "^2.5.0", "@hsl-fi/modal": "^0.3.1", "@hsl-fi/site-header": "4.2.2", @@ -2455,19 +2455,19 @@ } }, "node_modules/@digitransit-component/digitransit-component-autosuggest": { - "version": "1.9.4", - "resolved": "https://registry.npmjs.org/@digitransit-component/digitransit-component-autosuggest/-/digitransit-component-autosuggest-1.9.4.tgz", - "integrity": "sha512-VWegVojkBwA20gLJmlJ2f/DrXYMIN5v8lgA68qTHtU/sD4tTiz+zufoNUYQMUuxBVQR1bnlL4LSQr/JfFE3GGw==", + "version": "1.9.10", + "resolved": "https://registry.npmjs.org/@digitransit-component/digitransit-component-autosuggest/-/digitransit-component-autosuggest-1.9.10.tgz", + "integrity": "sha512-C6j//pFqJvFe/RQsC7lQmLNVhFNZDIeIBjsuOIqDfBRrg6e7FU17N3IqJk3BVztD1kuaU9tlS6iX3gU3nbBQjQ==", "dependencies": { - "@digitransit-search-util/digitransit-search-util-execute-search-immidiate": "^1.3.2", + "@digitransit-search-util/digitransit-search-util-execute-search-immidiate": "^1.3.3", "@digitransit-search-util/digitransit-search-util-get-label": "^0.2.0", "@digitransit-search-util/digitransit-search-util-uniq-by-label": "^1.1.0", - "@hsl-fi/hooks": "^1.2.0" + "@hsl-fi/hooks": "^1.2.3" }, "peerDependencies": { "@digitransit-component/digitransit-component-dialog-modal": "^0.3.4", - "@digitransit-component/digitransit-component-icon": "^0.2.0", - "@digitransit-component/digitransit-component-suggestion-item": "^1.1.1", + "@digitransit-component/digitransit-component-icon": "^0.2.2", + "@digitransit-component/digitransit-component-suggestion-item": "^1.1.3", "@hsl-fi/sass": "^0.2.0", "classnames": "2.2.6", "i18next": "^19.3.3", @@ -2497,9 +2497,9 @@ } }, "node_modules/@digitransit-component/digitransit-component-icon": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/@digitransit-component/digitransit-component-icon/-/digitransit-component-icon-0.2.0.tgz", - "integrity": "sha512-ltJ3zxjW1EqGeIalw/iEHgV4l3B/wNya9BndtA8lx4P/5MR0reKiW+7iSz9ZezFlFNlTtZy+Q8Nr2BmnPgJETg==", + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/@digitransit-component/digitransit-component-icon/-/digitransit-component-icon-0.2.2.tgz", + "integrity": "sha512-hi44VWPlCCTK5G7m8AifgwAudTfVDmhayuJf0hZ4wPcwcjTde0mDw2/RYJtw3ZTRU1EYPxcR96Yx6TeInQM8pw==", "peer": true, "peerDependencies": { "i18next": "^19.3.3", @@ -2508,15 +2508,15 @@ } }, "node_modules/@digitransit-component/digitransit-component-suggestion-item": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@digitransit-component/digitransit-component-suggestion-item/-/digitransit-component-suggestion-item-1.1.1.tgz", - "integrity": "sha512-uTDi14o79ANkjMgptJIpzCF1z+QtBGmOIFKW3TWV02SLPUt5lZcvUafg7qs1X8AyYdPPu6N4X+wW2f5dt1PFrA==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@digitransit-component/digitransit-component-suggestion-item/-/digitransit-component-suggestion-item-1.1.3.tgz", + "integrity": "sha512-QHYDinv3P4U0rouWWhczdlb7l+tljLILX+B01zldDM/lu96QPr50jX7Z2Qy6qJzQcEIfMZ60LNduYj2/dTgwJg==", "peer": true, "dependencies": { "recompose": "0.30.0" }, "peerDependencies": { - "@digitransit-component/digitransit-component-icon": "^0.2.0", + "@digitransit-component/digitransit-component-icon": "^0.2.2", "@hsl-fi/sass": " ^0.2.0", "classnames": "2.2.6", "i18next": "^19.3.3", @@ -2525,9 +2525,9 @@ } }, "node_modules/@digitransit-search-util/digitransit-search-util-execute-search-immidiate": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@digitransit-search-util/digitransit-search-util-execute-search-immidiate/-/digitransit-search-util-execute-search-immidiate-1.3.2.tgz", - "integrity": "sha512-atSBZooqI/Ejq1+xMW5+mmYWPHxV2hw4zp6mpBCIa3naneN5wLs4RtbNkaLkyyz/oL8Wu1Z58mACp2lUBNor/w==", + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@digitransit-search-util/digitransit-search-util-execute-search-immidiate/-/digitransit-search-util-execute-search-immidiate-1.3.3.tgz", + "integrity": "sha512-mE0yJT3L9WhdtNWzLBm2qlJYdEgOJRIq12/XJBtZLS+D9rpHoaF7cK+UBzDfvTK8m6lW28DjuO/cvYUSjJEINg==", "dependencies": { "@digitransit-search-util/digitransit-search-util-filter-matching-to-input": "0.0.3", "@digitransit-search-util/digitransit-search-util-get-geocoding-results": "0.0.5", @@ -23943,14 +23943,14 @@ } }, "@digitransit-component/digitransit-component-autosuggest": { - "version": "1.9.4", - "resolved": "https://registry.npmjs.org/@digitransit-component/digitransit-component-autosuggest/-/digitransit-component-autosuggest-1.9.4.tgz", - "integrity": "sha512-VWegVojkBwA20gLJmlJ2f/DrXYMIN5v8lgA68qTHtU/sD4tTiz+zufoNUYQMUuxBVQR1bnlL4LSQr/JfFE3GGw==", + "version": "1.9.10", + "resolved": "https://registry.npmjs.org/@digitransit-component/digitransit-component-autosuggest/-/digitransit-component-autosuggest-1.9.10.tgz", + "integrity": "sha512-C6j//pFqJvFe/RQsC7lQmLNVhFNZDIeIBjsuOIqDfBRrg6e7FU17N3IqJk3BVztD1kuaU9tlS6iX3gU3nbBQjQ==", "requires": { - "@digitransit-search-util/digitransit-search-util-execute-search-immidiate": "^1.3.2", + "@digitransit-search-util/digitransit-search-util-execute-search-immidiate": "^1.3.3", "@digitransit-search-util/digitransit-search-util-get-label": "^0.2.0", "@digitransit-search-util/digitransit-search-util-uniq-by-label": "^1.1.0", - "@hsl-fi/hooks": "^1.2.0" + "@hsl-fi/hooks": "^1.2.3" } }, "@digitransit-component/digitransit-component-dialog-modal": { @@ -23963,25 +23963,25 @@ } }, "@digitransit-component/digitransit-component-icon": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/@digitransit-component/digitransit-component-icon/-/digitransit-component-icon-0.2.0.tgz", - "integrity": "sha512-ltJ3zxjW1EqGeIalw/iEHgV4l3B/wNya9BndtA8lx4P/5MR0reKiW+7iSz9ZezFlFNlTtZy+Q8Nr2BmnPgJETg==", + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/@digitransit-component/digitransit-component-icon/-/digitransit-component-icon-0.2.2.tgz", + "integrity": "sha512-hi44VWPlCCTK5G7m8AifgwAudTfVDmhayuJf0hZ4wPcwcjTde0mDw2/RYJtw3ZTRU1EYPxcR96Yx6TeInQM8pw==", "peer": true, "requires": {} }, "@digitransit-component/digitransit-component-suggestion-item": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@digitransit-component/digitransit-component-suggestion-item/-/digitransit-component-suggestion-item-1.1.1.tgz", - "integrity": "sha512-uTDi14o79ANkjMgptJIpzCF1z+QtBGmOIFKW3TWV02SLPUt5lZcvUafg7qs1X8AyYdPPu6N4X+wW2f5dt1PFrA==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@digitransit-component/digitransit-component-suggestion-item/-/digitransit-component-suggestion-item-1.1.3.tgz", + "integrity": "sha512-QHYDinv3P4U0rouWWhczdlb7l+tljLILX+B01zldDM/lu96QPr50jX7Z2Qy6qJzQcEIfMZ60LNduYj2/dTgwJg==", "peer": true, "requires": { "recompose": "0.30.0" } }, "@digitransit-search-util/digitransit-search-util-execute-search-immidiate": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@digitransit-search-util/digitransit-search-util-execute-search-immidiate/-/digitransit-search-util-execute-search-immidiate-1.3.2.tgz", - "integrity": "sha512-atSBZooqI/Ejq1+xMW5+mmYWPHxV2hw4zp6mpBCIa3naneN5wLs4RtbNkaLkyyz/oL8Wu1Z58mACp2lUBNor/w==", + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@digitransit-search-util/digitransit-search-util-execute-search-immidiate/-/digitransit-search-util-execute-search-immidiate-1.3.3.tgz", + "integrity": "sha512-mE0yJT3L9WhdtNWzLBm2qlJYdEgOJRIq12/XJBtZLS+D9rpHoaF7cK+UBzDfvTK8m6lW28DjuO/cvYUSjJEINg==", "requires": { "@digitransit-search-util/digitransit-search-util-filter-matching-to-input": "0.0.3", "@digitransit-search-util/digitransit-search-util-get-geocoding-results": "0.0.5", diff --git a/package.json b/package.json index 8f65bdc5..d644b755 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "private": true, "dependencies": { "@apollo/client": "^3.3.19", - "@digitransit-component/digitransit-component-autosuggest": "1.9.4", + "@digitransit-component/digitransit-component-autosuggest": "1.9.10", "@habx/apollo-multi-endpoint-link": "^2.5.0", "@hsl-fi/modal": "^0.3.1", "@hsl-fi/site-header": "4.2.2", diff --git a/server/package-lock.json b/server/package-lock.json index 7a5e9786..a0918c04 100644 --- a/server/package-lock.json +++ b/server/package-lock.json @@ -27,6 +27,7 @@ "devDependencies": { "@types/uuid": "^8.3.1", "cross-env": "^7.0.2", + "dotenv": "^16.3.1", "eslint": "^8.20.0", "eslint-config-prettier": "^8.5.0", "eslint-plugin-prettier": "^4.2.1", @@ -949,6 +950,18 @@ "resolved": "https://registry.npmjs.org/doctypes/-/doctypes-1.1.0.tgz", "integrity": "sha1-6oCxBqh1OHdOijpKWv4pPeSJ4Kk=" }, + "node_modules/dotenv": { + "version": "16.3.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz", + "integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/motdotla/dotenv?sponsor=1" + } + }, "node_modules/ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -3827,6 +3840,12 @@ "resolved": "https://registry.npmjs.org/doctypes/-/doctypes-1.1.0.tgz", "integrity": "sha1-6oCxBqh1OHdOijpKWv4pPeSJ4Kk=" }, + "dotenv": { + "version": "16.3.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz", + "integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==", + "dev": true + }, "ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", diff --git a/server/package.json b/server/package.json index 18cbe654..88abd12a 100644 --- a/server/package.json +++ b/server/package.json @@ -5,6 +5,7 @@ "description": "Backend for Azure Cosmos DB's SQL API", "scripts": { "start": "cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 node server.js", + "start-local": "cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 node -r dotenv/config server.js", "lint": "eslint *.js --fix --quiet" }, "dependencies": { @@ -30,6 +31,7 @@ "prettier": "^2.8.0", "eslint": "^8.20.0", "eslint-config-prettier": "^8.5.0", - "eslint-plugin-prettier": "^4.2.1" + "eslint-plugin-prettier": "^4.2.1", + "dotenv": "^16.3.1" } } diff --git a/src/defaultConfig.js b/src/defaultConfig.js index 2a54efe7..5a36e59c 100644 --- a/src/defaultConfig.js +++ b/src/defaultConfig.js @@ -12,6 +12,21 @@ export default { 'lautta', 'OULU', 'digitraffic', + 'Rauma', + 'Hameenlinna', + 'Kotka', + 'Kouvola', + 'Lappeenranta', + 'Mikkeli', + 'Vaasa', + 'Joensuu', + 'FOLI', + 'Lahti', + 'Kuopio', + 'Rovaniemi', + 'Kajaani', + 'Salo', + 'Pori', ], fonts: { weights: { diff --git a/src/monitorConfig.js b/src/monitorConfig.js index 37e94d80..4d6f1df2 100644 --- a/src/monitorConfig.js +++ b/src/monitorConfig.js @@ -94,6 +94,16 @@ export default { map: { inUse: false, }, + stopSearchFilter: stop => { + const props = stop.properties; + if ( + props?.id?.includes('GTFS:HSL') && + props?.addendum?.GTFS?.modes?.includes('RAIL') + ) { + return false; + } + return true; + }, }, tampere: { colors: { diff --git a/src/ui/StopCardRow.tsx b/src/ui/StopCardRow.tsx index 537f8d55..454ac452 100644 --- a/src/ui/StopCardRow.tsx +++ b/src/ui/StopCardRow.tsx @@ -202,6 +202,14 @@ const StopCardRow: FC = ({ const possibleToMove = cards.length > 1; const possibleToDelete = hasMap ? cards.length > 2 : cards.length > 1; const filterSearchResults = (results, x) => { + if (config.stopSearchFilter) { + return results + .filter(result => { + const gtfsId = getGTFSId(result.properties.id); + return !columns.left.stops.some(s => s.gtfsId === gtfsId); + }) + .filter(config.stopSearchFilter); + } return results.filter(result => { const gtfsId = getGTFSId(result.properties.id); return !columns.left.stops.some(s => s.gtfsId === gtfsId); From 5a7167634bb194b61aad9f01be19c317bb8c2bae Mon Sep 17 00:00:00 2001 From: Janne Antikainen Date: Mon, 28 Aug 2023 10:13:21 +0300 Subject: [PATCH 2/4] envexample --- .dockerignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.dockerignore b/.dockerignore index cd245342..cbb662fe 100644 --- a/.dockerignore +++ b/.dockerignore @@ -8,3 +8,4 @@ docker-compose.yml node_modules server/node_modules **/.env +**/.env.example \ No newline at end of file From a26fca5c9c0cb1639b2a582fef6a583792a34e25 Mon Sep 17 00:00:00 2001 From: Janne Antikainen Date: Mon, 28 Aug 2023 12:42:24 +0300 Subject: [PATCH 3/4] env example file --- server/.env.example | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 server/.env.example diff --git a/server/.env.example b/server/.env.example new file mode 100644 index 00000000..2cb099b2 --- /dev/null +++ b/server/.env.example @@ -0,0 +1,15 @@ +MANAGEMENT_API_ID=<> +MANAGEMENT_API_SECRET=<> +REDIS_KEY=<> +REDIS_PORT=<> +APPSETTING_DB_ENDPOINT=<> +APPSETTING_DB_ID=<> +APPSETTING_DB_CONTAINER=<> +OIDC_CLIENT_ID=<> +OIDC_CLIENT_SECRET=<> +OIDCHOST=<> +API_SUBSCRIPTION_QUERY_PARAMETER_NAME=<> +API_SUBSCRIPTION_TOKEN=<> +DEBUGLOGGING=false +MAP_URL=<> + From 8893291d26bff8ff01215505e353b0f4fcc67739 Mon Sep 17 00:00:00 2001 From: Janne Antikainen Date: Mon, 28 Aug 2023 13:04:41 +0300 Subject: [PATCH 4/4] update workflows --- .github/workflows/next_virtualmonitor-app(dev).yml | 6 +++--- .github/workflows/next_virtualmonitor-app.yml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/next_virtualmonitor-app(dev).yml b/.github/workflows/next_virtualmonitor-app(dev).yml index c7d43d59..81328029 100644 --- a/.github/workflows/next_virtualmonitor-app(dev).yml +++ b/.github/workflows/next_virtualmonitor-app(dev).yml @@ -14,7 +14,7 @@ jobs: if: "!startsWith(github.event.head_commit.message, '[DEPLOY]')" steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: token: ${{ secrets.GIT_SECRET }} - run: git config --global user.name 'Digitransit' @@ -35,8 +35,8 @@ jobs: if: "startsWith(github.event.head_commit.message, '[DEPLOY]')" steps: - name: Checkout - uses: actions/checkout@v2 - - uses: azure/docker-login@v1 + uses: actions/checkout@v3 + - uses: azure/docker-login@v2 with: login-server: https://index.docker.io/v1/ username: ${{ secrets.AzureAppService_ContainerUsername_43e4c8bef39f4f7d9da4f67dc0bafa48 }} diff --git a/.github/workflows/next_virtualmonitor-app.yml b/.github/workflows/next_virtualmonitor-app.yml index 4633c9a5..7b4c5330 100644 --- a/.github/workflows/next_virtualmonitor-app.yml +++ b/.github/workflows/next_virtualmonitor-app.yml @@ -15,9 +15,9 @@ jobs: runs-on: 'ubuntu-latest' steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - uses: azure/docker-login@v1 + - uses: azure/docker-login@v2 with: login-server: https://index.docker.io/v1/ username: ${{ secrets.AzureAppService_ContainerUsername_43e4c8bef39f4f7d9da4f67dc0bafa48 }}