Skip to content

Commit

Permalink
Merge branch 'master' into bump_apollo_server
Browse files Browse the repository at this point in the history
  • Loading branch information
kenglxn committed Sep 5, 2023
2 parents dad0fd3 + 59ccf1c commit c2f7008
Show file tree
Hide file tree
Showing 8 changed files with 5,273 additions and 4,790 deletions.
1 change: 1 addition & 0 deletions .github/workflows/bygg-og-deploy-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ jobs:
npx -p @sentry/cli sentry-cli releases new "${{ github.sha }}"
npx -p @sentry/cli sentry-cli releases files "${{ github.sha }}" upload-sourcemaps build/static/js \
--url-prefix '~/min-side-arbeidsgiver/static/js'
npx -p @sentry-cli sentry-cli releases set-commits --auto "${{ github.sha }}"
npx -p @sentry/cli sentry-cli releases finalize "${{ github.sha }}"
Expand Down
1 change: 1 addition & 0 deletions nais/dev-gcp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ spec:
readiness:
path: /min-side-arbeidsgiver/internal/isReady
initialDelay: 20
terminationGracePeriodSeconds: 60
prometheus:
enabled: true
path: /min-side-arbeidsgiver/internal/metrics
Expand Down
1 change: 1 addition & 0 deletions nais/prod-gcp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ spec:
readiness:
path: /min-side-arbeidsgiver/internal/isReady
initialDelay: 20
terminationGracePeriodSeconds: 60
prometheus:
enabled: true
path: /min-side-arbeidsgiver/internal/metrics
Expand Down
9,880 changes: 5,197 additions & 4,683 deletions server/package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"express": "^4.17.3",
"express-http-proxy": "1.6.3",
"http-proxy-middleware": "3.0.0-beta.1",
"jsdom": "^16.4.0",
"http-terminator": "3.2.0",
"jsdom": "^16.4.0",
"mustache": "^4.2.0",
"node-fetch": "^3.2.10",
"openid-client": "5.1.9",
Expand Down
13 changes: 11 additions & 2 deletions server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import path from 'path';
import express from 'express';
import Mustache from 'mustache';
import httpProxyMiddleware, { responseInterceptor } from 'http-proxy-middleware';
import { createHttpTerminator } from 'http-terminator';
import Prometheus from 'prom-client';
import { createLogger, format, transports } from 'winston';
import cookieParser from 'cookie-parser';
Expand Down Expand Up @@ -272,10 +273,18 @@ const main = async () => {
log.info(`Server listening on port ${PORT}`);
});

const terminator = createHttpTerminator({
server,
gracefulTerminationTimeout: 30_000, // defaults: terminator=5s, k8s=30s
});

process.on('SIGTERM', () => {
log.info('SIGTERM signal received: closing HTTP server');
server.close(() => {
log.info('HTTP server closed');
terminator.terminate().then(() => {
server.close(() => {
log.info('HTTP server closed');
process.exit(0);
});
});
});
};
Expand Down
14 changes: 2 additions & 12 deletions src/App/Hovedside/Sak/SisteSaker/SisteSaker.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
.siste_saker {
background: var(--a-bg-default);
border-radius: var(--a-border-radius-medium);
min-height: 9rem;
padding: 1rem 1.5rem;
padding: 32px 24px;
display: flex;
flex-direction: column;
gap: 1rem;
Expand All @@ -25,7 +24,7 @@
"ikon undertekst ekspander_kollaps";
align-items: center;
min-width: calc(50% - 2.5rem);
gap: 0 .5rem;
gap: 16px;
}

@media (max-width: 768px) {
Expand Down Expand Up @@ -80,13 +79,4 @@

.saker-lenke__undertekst {
grid-area: undertekst;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

.saker_lenke__undertekst_ekspandert {
white-space: normal;
overflow: visible;
text-overflow: unset;
}
150 changes: 58 additions & 92 deletions src/App/Hovedside/Sak/SisteSaker/SisteSaker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ import './SisteSaker.css';
import { useSaker } from '../useSaker';
import { loggNavigasjon } from '../../../../utils/funksjonerForAmplitudeLogging';
import amplitude from '../../../../utils/amplitude';
import { BodyShort, Button, Heading } from '@navikt/ds-react';
import { BodyShort, Heading } from '@navikt/ds-react';
import { useSessionStateForside } from '../Saksoversikt/useOversiktSessionStorage';
import { OppgaveTilstand, SakSortering } from '../../../../api/graphql-types';
import { Collapse, Expand } from '@navikt/ds-icons';
import { BellDotFillIcon, PaperplaneIcon } from '@navikt/aksel-icons';
import { SakSortering } from '../../../../api/graphql-types';
import { PaperplaneIcon } from '@navikt/aksel-icons';
import { OrganisasjonerOgTilgangerContext } from '../../../OrganisasjonerOgTilgangerProvider';
import { sorted } from '../../../../utils/util';
import { Set } from 'immutable';
Expand All @@ -21,74 +20,62 @@ interface SakerLenkeProps {
overskrift: string;
undertekst: string;
to: To;
ekspander: boolean;
setEkspander: (ekspander: boolean) => void;
}

const SakerLenke = ({ ikon, overskrift, undertekst, to, ekspander, setEkspander}: SakerLenkeProps) => {
const SakerLenke = ({ ikon, overskrift, undertekst, to }: SakerLenkeProps) => {
const [hover, setHover] = useState(false);
const ikonId = "ikon-id" + overskrift.toLowerCase().replace(' ', '-');
const lenkeId = "lenke-id" + overskrift.toLowerCase().replace(' ', '-');
const ikonId = 'ikon-id' + overskrift.toLowerCase().replace(' ', '-');
const lenkeId = 'lenke-id' + overskrift.toLowerCase().replace(' ', '-');

addEventListener('mouseover', (e) => {
const target = e.target as HTMLElement;
if (target.id === ikonId) {
setHover(true);
}
else if (target.id === lenkeId) {
} else if (target.id === lenkeId) {
setHover(true);
}
else {
} else {
setHover(false);
}
})
return <div className='saker-lenke'>
<Link
tabIndex={-1}
id={lenkeId}
className={'saker-lenke__ikon' + (hover ? ' saker-lenke__ikon__hover' : '')}
to={to}
onClick={() => {
scroll(0, 0);
loggNavigasjon('saksoversikt', 'se alle saker', location.pathname);
}}
>
{ikon}
</Link>

<Link className={'saker-lenke_headerlenke' + (hover ? ' saker-lenke_headerlenke__hover' : '')}
to={to}
onClick={() => {
scroll(0, 0);
loggNavigasjon('saksoversikt', 'se alle saker', location.pathname);
}}
>
<Heading id={ikonId} size={'small'}>
{overskrift}
</Heading>
</Link>
<BodyShort
className={'saker-lenke__undertekst ' + (ekspander ? ' saker_lenke__undertekst_ekspandert' : " ")}
>{undertekst}</BodyShort>
<Button
aria-label={`${ekspander ? "Skjul deler av" : "Vis hele"} teksten. (Hele teksten vises for skjermleser)`}
className="saker-lenke__ekspander-knapp"
size="xsmall"
variant="tertiary"
style={{color: "black"}}
onClick={() => setEkspander(!ekspander)
}
>
{ekspander ? <Collapse aria-hidden/> : <Expand aria-hidden/>}
</Button>

</div>;
});
return (
<div className="saker-lenke">
<Link
tabIndex={-1}
id={lenkeId}
className={'saker-lenke__ikon' + (hover ? ' saker-lenke__ikon__hover' : '')}
to={to}
onClick={() => {
scroll(0, 0);
loggNavigasjon('saksoversikt', 'se alle saker', location.pathname);
}}
>
{ikon}
</Link>

<Link
className={
'saker-lenke_headerlenke' + (hover ? ' saker-lenke_headerlenke__hover' : '')
}
to={to}
onClick={() => {
scroll(0, 0);
loggNavigasjon('saksoversikt', 'se alle saker', location.pathname);
}}
>
<Heading id={ikonId} size={'small'}>
{overskrift}
</Heading>
</Link>
<BodyShort className="saker-lenke__undertekst ">{undertekst}</BodyShort>
</div>
);
};

const SisteSaker = () => {
const { valgtOrganisasjon, antallSakerForAlleBedrifter } = useContext(OrganisasjonsDetaljerContext);
const { valgtOrganisasjon, antallSakerForAlleBedrifter } = useContext(
OrganisasjonsDetaljerContext
);
const { organisasjoner } = useContext(OrganisasjonerOgTilgangerContext);
const [ekspander, setEkspander] = useState(false);
const location = useLocation();

const { loading, data } = useSaker(ANTALL_FORSIDESAKER, {
Expand All @@ -100,17 +87,6 @@ const SisteSaker = () => {
oppgaveTilstand: [],
});

const sakerMedOppgaverRespons = useSaker(ANTALL_FORSIDESAKER, {
side: 1,
virksomheter: Set(),
tekstsoek: '',
sortering: SakSortering.Frist,
sakstyper: [],
oppgaveTilstand: [OppgaveTilstand.Ny],
});

const sakerMedOppgaver = sakerMedOppgaverRespons.data?.saker

useSessionStateForside();

useEffect(() => {
Expand All @@ -128,39 +104,29 @@ const SisteSaker = () => {

if ((antallSakerForAlleBedrifter ?? 0) === 0) return null;

const antallVirksomheter = Object.values(organisasjoner).filter(org => ["BEDR", "AAFY"].includes(org.organisasjon.OrganizationForm)).length;
const antallVirksomheter = Object.values(organisasjoner).filter((org) =>
['BEDR', 'AAFY'].includes(org.organisasjon.OrganizationForm)
).length;

return (
<div className='siste_saker'>
<Heading size='small' level='2'> Saker {antallVirksomheter > 1 ? "for dine virksomheter" : "" } </Heading>
<div className='siste_saker_valg_container'>
<div className="siste_saker">
<div className="siste_saker_valg_container">
<SakerLenke
to = {{
to={{
pathname: 'saksoversikt',
search: location.search,
}}
ikon={<PaperplaneIcon aria-hidden/>}
overskrift={`Antall saker (${antallSakerForAlleBedrifter})`}
undertekst={sorted(data.saker.sakstyper, sakstype => sakstype.navn).map((sakstype) => `${sakstype.navn} ${sakstype.antall}`).join(', ')}
ekspander={ekspander}
setEkspander={setEkspander}
/>
<SakerLenke
to = {{
pathname: 'saksoversikt',
search: location.search + "&oppgaveTilstand=NY"
}}
ikon={<BellDotFillIcon aria-hidden/>}
overskrift={'Med oppgaver ' + (((sakerMedOppgaver?.totaltAntallSaker ?? 0) > 0) ? `(${sakerMedOppgaver?.totaltAntallSaker})` : '')}
undertekst={sorted(sakerMedOppgaver?.sakstyper ?? [], sakstype => sakstype.navn).map(
(sakstype) => `${sakstype.navn} ${sakstype.antall}`).join(', ')
}
ekspander={ekspander}
setEkspander={setEkspander}
ikon={<PaperplaneIcon aria-hidden />}
overskrift={`Alle saker ${
antallVirksomheter > 1 ? 'for dine virksomheter' : ''
} (${antallSakerForAlleBedrifter})`}
undertekst={sorted(data.saker.sakstyper, (sakstype) => sakstype.navn)
.map((sakstype) => `${sakstype.navn} ${sakstype.antall}`)
.join(', ')}
/>
</div>
</div>
);
};

export default SisteSaker;
export default SisteSaker;

0 comments on commit c2f7008

Please sign in to comment.