Skip to content

Commit

Permalink
Merget hovedbranch inn i lokal feature branch
Browse files Browse the repository at this point in the history
  • Loading branch information
ulrikHesmyr committed Jul 24, 2024
2 parents d144c75 + 77751f3 commit 3b6920c
Show file tree
Hide file tree
Showing 31 changed files with 180 additions and 80 deletions.
1 change: 1 addition & 0 deletions apps/dolly-frontend/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ spec:
- application: testnav-varslinger-service
- application: testnorge-profil-api
- application: testnorge-tilbakemelding-api
- application: testnav-levende-arbeidsforhold-ansettelsev2
external:
- host: testnav-pensjon-testdata-facade-proxy.dev-fss-pub.nais.io
- host: testnav-sigrunstub-proxy.dev-fss-pub.nais.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public RouteLocator customRouteLocator(RouteLocatorBuilder builder) {
.route(createRoute(consumers.getGenererNavnService()))
.route(createRoute(consumers.getTestnavKodeverkService()))
.route(createRoute(consumers.getTestnavTenorSearchService()))
.route(createRoute(consumers.getTestnavLevendeArbeidsforholdAnsettelsev2(), "testnav-levende-arbeidsforhold-ansettelsev2"))
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,6 @@ public class Consumers {
private ServerProperties testnorgeProfilApi;
private ServerProperties testnorgeTilbakemeldingApi;
private ServerProperties testnavTenorSearchService;
private ServerProperties testnavLevendeArbeidsforholdAnsettelsev2;

}
5 changes: 5 additions & 0 deletions apps/dolly-frontend/src/main/js/proxy-routes.json
Original file line number Diff line number Diff line change
Expand Up @@ -228,5 +228,10 @@
"target": "http://localhost:8020",
"changeOrigin": true,
"secure": false
},
"/testnav-levende-arbeidsforhold-ansettelse/api": {
"target": "http://localhost:8020",
"changeOrigin": true,
"secure": false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,60 @@ import { AdminAccessDenied } from '@/pages/adminPages/AdminAccessDenied'
import { Alert } from '@navikt/ds-react'
import { AppstyringTable } from '@/pages/adminPages/Appstyring/AppstyringTable'
import { erDollyAdmin } from '@/utils/DollyAdmin'
import data from "@navikt/ds-icons/src/Data";
import React, { useState, useEffect } from "react";
import Request from '@/service/services/Request'
import {JobbParametere} from "@/pages/adminPages/Appstyring/util/AppstyringParametere";

export default () => {
if (!erDollyAdmin()) {
return <AdminAccessDenied />
}

let data: {parameter: string, verdi: string, verdier: {verdi: string, navn: string}[] }[] = [];
Request.get('https://testnav-levende-arbeidsforhold-ansettelse.intern.dev.nav.no/api').then(
(response: JobbParametere) => {
console.log(response);
}
);

/*
useEffect(() => {
fetch("/testnav-levende-arbeidsforhold-ansettelse/api", {
method: "GET"})
.then((response) => response.json())
.then(data => {
for (const parameter of data) {
let verdier: {verdi: string, navn: string}[] = [];
for (const verdi of data.verdier) {
verdier.push({verdi: verdi.verdi, navn: verdi.navn });
}
data.push({parameter: parameter.navn, verdi: parameter.verdi, verdier: verdier});
}
})
.then(json=>console.log(json));
});
*/

//const headers = { 'Authorization': 'Bearer ' };
/*
fetch('/testnav-levende-arbeidsforhold-ansettelse/api')
.then(res=>res.json())
.then((data) => {
for (const parameter of data) {
let verdier: {verdi: string, navn: string}[] = [];
for (const verdi of data.verdier) {
verdier.push({verdi: verdi.verdi, navn: verdi.navn });
}
data.push({parameter: parameter.navn, verdi: parameter.verdi, verdier: verdier});
}
})
.then(json=>console.log(json));
*/

//TODO: Implementer henting av data fra backend
const dataMock = [
{ parameter: 'Parameter 1', verdi: 'verdi1' },
Expand All @@ -28,7 +76,7 @@ export default () => {
<Alert variant={'info'} style={{ marginBottom: '15px' }}>
Denne siden er under utvikling.
</Alert>
<AppstyringTable data={dataMock} />
<AppstyringTable data={data} />
</>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,8 @@ import {ifPresent} from "@/utils/YupValidations";

export const AppstyringTable = ({ data }: any) => {
//TODO: Implementer henting av options pr parameter fra backend
if (data.contains("Organisasjon")) {
//useEffect(() => {
// fetch(url)
//}, []);
}
if (data.contains("Person")){

}
if (data.contains("Arbeidsforhold")){

}

const getOptions = (parameter: string) => {
return [
Expand Down Expand Up @@ -53,7 +44,7 @@ export const AppstyringTable = ({ data }: any) => {
<EditParameter
name={row.parameter}
initialValue={row.verdi}
getOptions={getOptions}
getOptions={row.verdier}
/>
</Table.DataCell>
</Table.Row>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ export type JobbParametere = {
param_navn: string
param_tekst: string
param_verdi: string
verdier: any[]
}

This file was deleted.

5 changes: 5 additions & 0 deletions apps/dolly-frontend/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@ consumers:
namespace: dolly
name: testnav-tenor-search-service
url: http://testnav-tenor-search-service.dolly.svc.cluster.local
testnav-levende-arbeidsforhold-ansettelsev2:
cluster: dev-gcp
namespace: dolly
name: testnav-levende-arbeidsforhold-ansettelsev2
url: https://testnav-levende-arbeidsforhold-ansettelse-v2.intern.dev.nav.no

management:
endpoints:
Expand Down
21 changes: 5 additions & 16 deletions apps/levende-arbeidsforhold-ansettelse/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,23 @@ repositories {
}

dependencies {
implementation "no.nav.testnav.libs:kafka-config"
implementation 'no.nav.testnav.libs:security-core'
implementation 'no.nav.testnav.libs:reactive-core'
implementation 'no.nav.testnav.libs:servlet-core'
implementation 'no.nav.testnav.libs:commands'
implementation 'no.nav.testnav.libs:data-transfer-objects'
implementation 'no.nav.testnav.libs:servlet-security'
implementation 'no.nav.testnav.libs:avro-schema'
implementation 'no.nav.testnav.libs:servlet-insecure-security'


implementation 'org.springframework.boot:spring-boot-starter-webflux'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-quartz'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'

implementation 'org.springframework.cloud:spring-cloud-starter-vault-config'
implementation 'org.springframework.boot:spring-boot-starter-actuator'

Expand All @@ -78,21 +80,8 @@ dependencies {
annotationProcessor 'org.projectlombok:lombok'
testAnnotationProcessor 'org.projectlombok:lombok'

implementation 'no.nav.testnav.libs:kafka-config'
implementation 'org.apache.kafka:kafka-clients:3.7.0'
implementation 'org.springframework.kafka:spring-kafka'

implementation 'no.nav.testnav.libs:avro-schema'
implementation 'no.nav.testnav.libs:commands'
implementation 'no.nav.testnav.libs:data-transfer-objects'
implementation 'no.nav.testnav.libs:kafka-config'
implementation 'no.nav.testnav.libs:security-core'
implementation 'no.nav.testnav.libs:servlet-insecure-security'
implementation 'no.nav.testnav.libs:servlet-core'

implementation 'org.flywaydb:flyway-core'
implementation 'com.h2database:h2'
implementation 'com.zaxxer:HikariCP'
implementation 'com.h2database:h2'
implementation 'org.postgresql:postgresql'

}
Expand Down
11 changes: 4 additions & 7 deletions apps/levende-arbeidsforhold-ansettelse/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: nais.io/v1alpha1
kind: Application
metadata:
name: testnav-levende-arbeidsforhold-ansettelse
name: testnav-levende-arbeidsforhold-ansettelsev2
namespace: dolly
labels:
team: dolly
Expand All @@ -12,9 +12,9 @@ spec:
inbound:
rules:
- application: team-dolly-lokal-app
cluster: dev-gcp
- application: testnav-oversikt-frontend
cluster: dev-gcp
- application: dolly-frontend
outbound:
external:
- host: testnav-aareg-proxy.dev-fss-pub.nais.io
Expand Down Expand Up @@ -48,21 +48,18 @@ spec:
memory: 1024Mi
limits:
memory: 2048Mi
envFrom:
- secret: google-sql-testnav-levende-arbeidsforhold-ansettelse
ingresses:
- "https://testnav-levende-arbeidsforhold-ansettelse.intern.dev.nav.no"
- "https://testnav-levende-arbeidsforhold-ansettelse-v2.intern.dev.nav.no"
gcp:
sqlInstances:
- autoBackupHour: 3 #Lager backup av hele SQL instancen hver dag kl 03:00
type: POSTGRES_14
databases:
- name: levende-arbeidsforhold-ansettelse-db
- name: testnav-levende-arbeidsforhold-db
insights:
enabled: true
recordApplicationTags: true
recordClientAddress: true
cascadingDelete: true
tier: db-f1-micro
diskAutoresize: true #Kanskje ikke nødvendig?
#collation: DESC
1 change: 0 additions & 1 deletion apps/levende-arbeidsforhold-ansettelse/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ plugins {

rootProject.name = 'testnav-levende-arbeidsforhold-ansettelse'

includeBuild "../../libs/kafka-config"
includeBuild "../../libs/avro-schema"
includeBuild '../../libs/security-core'
includeBuild '../../libs/servlet-core'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import no.nav.registre.testnorge.levendearbeidsforholdansettelse.service.JobbService;
import no.nav.registre.testnorge.levendearbeidsforholdansettelse.service.KodeverkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

Expand All @@ -28,6 +29,15 @@ public class JobbController {

@GetMapping
public ResponseEntity<List<JobbParameterEntity>> hentAlleJobber() {
/*
HttpHeaders responseHeaders = new HttpHeaders();
responseHeaders.set("Access-Control-Allow-Origin", "http://localhost:3000");
responseHeaders.set("Access-Control-Allow-Methods", "GET, POST, PUT");
responseHeaders.set("Access-Control-Allow-Headers", "Authorization, Content-Type");
*/
//return ResponseEntity.ok().headers(responseHeaders).body(jobbService.hentAlleParametere());
//jobbService.initDb();
return ResponseEntity.ok(jobbService.hentAlleParametere());
}
/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public class JobbParameterEntity implements Serializable {
@Column(name = "VERDI")
private String verdi;

@OneToMany(mappedBy = "jobbParameterEntity")
private final Collection<VerdierEntity> verdier = new ArrayList<>();
@OneToMany//mappedBy = "jobbParameterEntity"
private Collection<VerdierEntity> verdier = new ArrayList<>();
// Getters and Setters
public String toString(){
return "navn: " + navn + " tekst: " + tekst + " verdi: " +verdi;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,23 @@
@NoArgsConstructor
@Getter
@Setter
@Table(name = "verdier")
@Table(name = "VERDIER")
public class VerdierEntity implements Serializable {
/*
@ManyToOne(fetch = FetchType.LAZY)
private JobbParameterEntity jobbParameterEntity;
*/
@Id
@GeneratedValue
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "ID")
private int id;

@JoinColumn(name = "NAVN")
@JoinColumn(name = "VERDI_NAVN")
private String navn;

@Column(name = "verdi_verdi")
@Column(name = "VERDI_VERDI")
private String verdi;
@Override
public String toString(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import no.nav.registre.testnorge.levendearbeidsforholdansettelse.entity.JobbParameterEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ public interface VerdiRepository extends JpaRepository<VerdierEntity, String> {

List<VerdierEntity> findByNavn(String navn);

//@Query(value ="select verdier.verdi_verdi from verdier, jobb_parameter where jobb_parameter.NAVN=verdier.verdi_navn and verdier.navn=:navn")
//List<VerdierEntity> hentVerdier(String navn);
//@Query("select verdi_verdi from verdier, jobb_parameter where jobb_parameter.NAVN=verdi_verdi.verdi_navn and verdi_navn=?")

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
import no.nav.registre.testnorge.levendearbeidsforholdansettelse.repository.VerdiRepository;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.*;

@Slf4j
@Service
Expand All @@ -24,16 +21,18 @@ public class JobbService {
private final VerdiRepository verdiRepository;
public List<JobbParameterEntity> hentAlleParametere(){
List<JobbParameterEntity> test = jobberRepository.findAll();
log.info("Hentet fra h2: {}", test.toString());
return test;
}

public List<VerdierEntity> hentAlleMedNavn(String navn){
//JobbParameterEntity org = jobberRepository.findByNavn("antallOrganisasjoner");
//org.getVerdier();
//List<VerdierEntity> test = verdiRepository.findByNavn(navn);
//log.info("Henter fra verdier table {}", test.toString());
return null;
JobbParameterEntity org = jobberRepository.findByNavn("antallOrganisasjoner");
org.getVerdier();
List<VerdierEntity> test = verdiRepository.findAll();
//List<VerdierEntity> test2 = verdiRepository.hentVerdier(navn);

log.info("Henter fra verdier table {}", test.toString());
//log.info("Henter navn fra table {}", test2.toString());
return test;
}

public Map<String, String> hentParameterMap() {
Expand All @@ -50,6 +49,15 @@ public void initDb(){
jobberRepository.save(jobbParameterEntity);
JobbParameterEntity jobb2 = JobbParameterEntity.builder().navn("antallPersoner").tekst("Antall personer").verdi("20").build();
jobberRepository.save(jobb2);
List<VerdierEntity> verdierEntities = new ArrayList<>();
for(int i = 20; i<=100; i+=20){
VerdierEntity verdier = VerdierEntity.builder().navn(jobbParameterEntity.getNavn()).verdi(String.valueOf(i)).build();
verdierEntities.add(verdier);
verdiRepository.save(verdier);
}
jobbParameterEntity.setVerdier(verdierEntities);
jobberRepository.save(jobbParameterEntity);

}

public void lagreParameter(JobbParameterEntity jobbParameterEntity){
Expand Down
Loading

0 comments on commit 3b6920c

Please sign in to comment.