Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/frontend oppdatering #3576

Merged
merged 9 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4,475 changes: 1,216 additions & 3,259 deletions apps/dolly-frontend/src/main/js/package-lock.json

Large diffs are not rendered by default.

31 changes: 3 additions & 28 deletions apps/dolly-frontend/src/main/js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dolly",
"version": "3.0.16",
"version": "3.0.21",
"type": "module",
"description": "",
"main": "index.js",
Expand All @@ -17,9 +17,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"@babel/preset-flow": "^7.18.6",
"@grafana/faro-react": "^1.1.2",
"@grafana/faro-web-sdk": "^1.1.1",
"@hookform/resolvers": "^3.3.2",
"@navikt/ds-css-internal": "^3.4.3",
"@navikt/ds-react-internal": "^3.4.3",
Expand All @@ -28,30 +26,20 @@
"classnames": "^2.3.1",
"country-data-list": "^1.3.0",
"date-fns": "^3.0.6",
"eslint-import-resolver-typescript": "^3.5.2",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsx-a11y": "^6.6.1",
"events-polyfill": "^2.1.2",
"history": "^5.3.0",
"immer": "^10.0.1",
"lodash": "^4.17.21",
"lodash.throttle": "^4.1.1",
"prop-types": "^15.8.1",
"rc-progress": "^4.0.0",
"rc-tooltip": "^6.0.1",
"react": "^18.2.0",
"react-confetti-explosion": "^2.1.2",
"react-datepicker": "^7.0.0",
"react-day-picker": "^8.1.0",
"react-dom": "^18.2.0",
"react-highlight-words": "^0.20.0",
"react-hook-form": "^7.48.2",
"react-images-uploading": "^3.1.7",
"react-inlinesvg": "^4.0.0",
"react-is": "^18.2.0",
"react-modal": "^3.15.1",
"react-paginate": "^8.1.3",
"react-scroll": "^1.8.7",
"react-select": "^5.4.0",
"react-syntax-highlighter": "^15.5.0",
"react-toastify": "^10.0.0",
Expand All @@ -62,12 +50,10 @@
"redux-first-history": "^5.2.0",
"redux-promise-middleware": "^6.1.2",
"redux-thunk": "^3.1.0",
"regenerator-runtime": "^0.14.0",
"reselect": "^5.1.0",
"styled-components": "^6.0.1",
"use-react-router-breadcrumbs": "^4.0.0",
"uuid": "^9.0.0",
"whatwg-fetch": "^3.6.2",
"uuid": "^10.0.0",
"yup": "^1.3.2"
},
"devDependencies": {
Expand All @@ -79,10 +65,8 @@
"@playwright/test": "^1.44.1",
"@redux-devtools/extension": "^3.3.0",
"@reduxjs/toolkit": "^2.2.1",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^11.1.0",
"@types/lodash": "^4.14.182",
"@types/node": "^20.8.9",
"@types/node": "^22.1.0",
"@types/react": "^18.2.22",
"@types/react-datepicker": "^6.0.0",
"@types/react-dom": "^18.0.6",
Expand All @@ -96,28 +80,19 @@
"@typescript-eslint/parser": "^7.0.1",
"@vitejs/plugin-react": "^4.0.0",
"babel-plugin-styled-components": "^2.1.1",
"cpx2": "^7.0.1",
"cross-env": "^7.0.3",
"dot-prop": "^9.0.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-react": "^7.31.11",
"fetch-retry": "^6.0.0",
"isomorphic-fetch": "^3.0.0",
"less": "^4.1.3",
"node-forge": "^1.3.1",
"prettier": "^3.0.0",
"react-dropzone": "^14.2.3",
"react-pdf": "^9.0.0",
"react-redux": "^9.1.0",
"react-router-dom": "^6.3.0",
"resq": "^1.10.2",
"rollup-plugin-node-externals": "^7.0.1",
"rollup-plugin-visualizer": "^5.12.0",
"sass": "^1.62.1",
"selfsigned": "^2.0.1",
"start-server-and-test": "^2.0.0",
"swr": "^2.0.0",
"ts-node": "^10.9.1",
"typescript": "^5.3.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ test.describe('Åpne bestilt ident med knytning mot alle fagsystem', () => {
.first()
.click()
await page.getByTestId(TestComponentSelectors.TOGGLE_VISNING_BESTILLINGER).click()
await page.waitForTimeout(1000)
await page.waitForTimeout(2000)
await page
.getByTestId(TestComponentSelectors.BUTTON_OPEN_BESTILLING)
.all()
Expand Down
19 changes: 16 additions & 3 deletions apps/dolly-frontend/src/main/js/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import axios from 'axios'
import fetch_retry from 'fetch-retry'
import { runningE2ETest } from '@/service/services/Request'
import { navigateToLogin } from '@/components/utlogging/navigateToLogin'
import { Logger } from '@/logger/Logger'

const fetchRetry = fetch_retry(originalFetch)

Expand Down Expand Up @@ -152,7 +153,7 @@ type Config = {

const _fetch = (url: string, config: Config, body?: object): Promise<Response> =>
fetchRetry(url, {
retryOn: (attempt, _error, response) => {
retryOn: (attempt, error, response) => {
if (!response.ok && !runningE2ETest()) {
if (
response?.status === 401 &&
Expand All @@ -165,12 +166,19 @@ const _fetch = (url: string, config: Config, body?: object): Promise<Response> =
if (attempt < 4) {
return true
}
throw new Error('Response fra endepunkt var ikke ok')
Logger.error({
event: `Response fra URL: ${response.url} var ikke OK`,
message: error,
uuid: window.uuid,
})
throw new Error(`Response fra endepunkt var ikke ok, max retries oversteget`)
}
return false
},
retries: 5,
retryDelay: 800,
retryDelay: (attempt: number, _error: any, _response: any) => {
return Math.pow(2, attempt) * 1000 // 1000, 2000, 4000
},
method: config.method,
redirect: config.redirect,
credentials: 'include',
Expand All @@ -192,6 +200,11 @@ const _fetch = (url: string, config: Config, body?: object): Promise<Response> =
if (response.status === 404) {
throw new NotFoundError()
}
Logger.error({
event: `Response fra URL: ${response.url} var ikke OK`,
message: response.text(),
uuid: window.uuid,
})
throw new Error('Response fra endepunkt var ikke ok')
}
return response
Expand Down
6 changes: 3 additions & 3 deletions apps/dolly-frontend/src/main/js/src/logger/Logger.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const log = (event: object | undefined) => {
Api.fetch(
`/api/dolly-logg`,
{ method: 'POST', headers: { 'Content-Type': 'application/json' } },
event
event,
)
}

Expand All @@ -17,7 +17,7 @@ const logger = (
uuid: any,
rating?: undefined,
isAnonym?: undefined,
brukerType?: undefined
brukerType?: undefined,
) => {
log({
event: event,
Expand All @@ -37,6 +37,6 @@ export const Logger = {
logger('INFO', event, message, uuid, rating, isAnonym, brukerType),
warn: ({ event, message, uuid, rating }) =>
logger('WARNING', event, message, uuid, rating, undefined, undefined),
error: ({ event, message, uuid, rating }) =>
error: ({ event, message, uuid, rating = undefined }) =>
logger('ERROR', event, message, uuid, rating, undefined, undefined),
}
Loading