Skip to content

Commit 86859db

Browse files
committed
Remove Gosys description entries warning
1 parent c540eab commit 86859db

File tree

5 files changed

+8
-36
lines changed

5 files changed

+8
-36
lines changed

frontend/src/components/behandling/behandlingsdetaljer/gosys.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export const Gosys = ({ oppgavebehandling }: Props) => {
3131
<Warning hasGosysOppgave={hasGosysOppgave} status={gosysOppgave?.status} />
3232

3333
{hasGosysOppgave && gosysOppgave !== undefined && gosysOppgave.beskrivelse !== null ? (
34-
<GosysBeskrivelse id={gosysOppgave.id} oppgavebeskrivelse={gosysOppgave.beskrivelse} />
34+
<GosysBeskrivelse oppgavebeskrivelse={gosysOppgave.beskrivelse} />
3535
) : null}
3636
</VStack>
3737
</BehandlingSection>

frontend/src/components/behandling/behandlingsdetaljer/select-gosys-oppgave/row.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export const Row = ({ gosysOppgave, selectedGosysOppgave, oppgaveId, showFerdigs
4343
<StatusRow
4444
$status={gosysOppgave.status}
4545
selected={selected}
46-
content={<GosysBeskrivelseTabs id={gosysOppgave.id} beskrivelse={gosysOppgave.beskrivelse} />}
46+
content={<GosysBeskrivelseTabs beskrivelse={gosysOppgave.beskrivelse} />}
4747
shadeOnHover
4848
expandOnRowClick
4949
>

frontend/src/components/gosys/beskrivelse/beskrivelse-tabs.tsx

+3-27
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,19 @@ import { EntryList } from '@app/components/gosys/beskrivelse/entry-list';
22
import { GosysBeskrivelseFormat } from '@app/components/gosys/beskrivelse/format-enum';
33
import type { GosysBeskrivelseEntry } from '@app/components/gosys/beskrivelse/parsing/type';
44
import { useGosysBeskrivelseTab } from '@app/hooks/settings/use-setting';
5-
import { pushLog, usePushEvent } from '@app/observability';
5+
import { usePushEvent } from '@app/observability';
66
import { BulletListIcon, CaptionsIcon } from '@navikt/aksel-icons';
77
import { BodyLong, Tabs } from '@navikt/ds-react';
8-
import { useCallback, useEffect } from 'react';
8+
import { useCallback } from 'react';
99
import { styled } from 'styled-components';
10-
import { simpleHeaderPrecheck } from './parsing/parse-header';
1110
import { splitBeskrivelse } from './parsing/split-beskrivelse';
1211

1312
interface Props {
14-
id: number;
1513
beskrivelse?: string | null;
1614
entries?: GosysBeskrivelseEntry[];
1715
}
1816

19-
export const GosysBeskrivelseTabs = ({
20-
id,
21-
beskrivelse = '',
22-
entries = splitBeskrivelse(beskrivelse ?? ''),
23-
}: Props) => {
17+
export const GosysBeskrivelseTabs = ({ beskrivelse = '', entries = splitBeskrivelse(beskrivelse ?? '') }: Props) => {
2418
const [format, setFormat] = usePreferredFormat();
2519
const pushEvent = usePushEvent();
2620

@@ -32,21 +26,6 @@ export const GosysBeskrivelseTabs = ({
3226
[setFormat, pushEvent],
3327
);
3428

35-
const expectedEntries = getExpectedEntries(beskrivelse);
36-
const hasExpectedEntries = entries.length === expectedEntries;
37-
38-
useEffect(() => {
39-
if (!hasExpectedEntries) {
40-
const context = {
41-
expectedEntries: expectedEntries.toString(10),
42-
actualEntries: entries.length.toString(10),
43-
gosysOppgaveId: id.toString(10),
44-
};
45-
pushLog('Unexpected number of entries in Gosys description', { context });
46-
pushEvent('unexpected-gosys-description', context);
47-
}
48-
}, [entries.length, expectedEntries, hasExpectedEntries, pushEvent, id]);
49-
5029
return (
5130
<Tabs size="small" value={format} onChange={onChange} className="flex h-full flex-col">
5231
<Tabs.List>
@@ -71,9 +50,6 @@ export const GosysBeskrivelseTabs = ({
7150
);
7251
};
7352

74-
const getExpectedEntries = (beskrivelse: string | null | undefined): number =>
75-
beskrivelse?.split('\n').filter((l) => simpleHeaderPrecheck(l) && l.split('').some((c) => c !== '-')).length ?? 0;
76-
7753
const usePreferredFormat = (): [GosysBeskrivelseFormat, (format: GosysBeskrivelseFormat) => void] => {
7854
const { value, setValue } = useGosysBeskrivelseTab();
7955

frontend/src/components/gosys/beskrivelse/beskrivelse.tsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ import { useCallback, useMemo, useRef } from 'react';
1010
import { styled } from 'styled-components';
1111

1212
interface Props {
13-
id: number;
1413
oppgavebeskrivelse: string;
1514
}
1615

17-
export const GosysBeskrivelse = ({ id, oppgavebeskrivelse }: Props) => {
16+
export const GosysBeskrivelse = ({ oppgavebeskrivelse }: Props) => {
1817
const oppgaveId = useOppgaveIdString();
1918
const modalRef = useRef<HTMLDialogElement>(null);
2019
const trimmedBeskrivelse = oppgavebeskrivelse.trim();
@@ -58,7 +57,7 @@ export const GosysBeskrivelse = ({ id, oppgavebeskrivelse }: Props) => {
5857

5958
<Modal header={{ heading: 'Beskrivelse fra Gosys', closeButton: true }} ref={modalRef} closeOnBackdropClick>
6059
<Modal.Body className="h-[80vh] overflow-hidden">
61-
<GosysBeskrivelseTabs id={id} beskrivelse={trimmedBeskrivelse} entries={entries} />
60+
<GosysBeskrivelseTabs beskrivelse={trimmedBeskrivelse} entries={entries} />
6261
</Modal.Body>
6362
</Modal>
6463
</>

frontend/src/components/oppgavebehandling-footer/update-in-gosys/gosys-oppgave.tsx

+1-4
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@ export const GosysOppgave = ({ oppgavebehandling }: Props) => {
2828
<Table size="small">
2929
<TableHeader isFerdigstilt={isFerdigstilt} />
3030
<Table.Body>
31-
<Table.ExpandableRow
32-
content={<GosysBeskrivelseTabs id={data.id} beskrivelse={data.beskrivelse} />}
33-
expandOnRowClick
34-
>
31+
<Table.ExpandableRow content={<GosysBeskrivelseTabs beskrivelse={data.beskrivelse} />} expandOnRowClick>
3532
<Table.DataCell>
3633
{data.gjelder === null ? null : (
3734
<Tag size="small" variant="success">

0 commit comments

Comments
 (0)