Skip to content

Commit f9700a5

Browse files
authored
Merge pull request #30 from nais/refactor_migration
Refactor migration
2 parents f93daa9 + f02ec40 commit f9700a5

File tree

98 files changed

+3379
-1389
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+3379
-1389
lines changed

.env.example

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
VITE_API_USER_EMAIL="[email protected]"

.github/workflows/main.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on:
33
push:
44
branches:
55
- main
6+
- refactor_migration
67
env:
78
NAME: console-frontend
89
IMAGE_REPOSITORY: oci://europe-north1-docker.pkg.dev/nais-io/nais
@@ -42,6 +43,8 @@ jobs:
4243
rollout:
4344
needs:
4445
- build_push
46+
# Only do this if on main
47+
if: endsWith(github.ref, '/main')
4548
runs-on: fasit-deploy
4649
permissions:
4750
id-token: write
@@ -50,4 +53,3 @@ jobs:
5053
with:
5154
chart: ${{ env.IMAGE_REPOSITORY }}/${{ env.NAME }}
5255
version: ${{ needs.build_push.outputs.version }}
53-
feature_name: ${{ env.NAME }}

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ RUN npm ci --quiet --legacy-peer-deps
77

88
COPY . ./
99

10-
ENV VITE_GRAPHQL_ENDPOINT http://console-backend/query
10+
ENV VITE_GRAPHQL_ENDPOINT http://nais-api/query
1111

1212
RUN npm run build
1313

README.md

+24-23
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,39 @@
1-
# create-svelte
1+
# Console frontend
22

3-
Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte).
3+
## Development
44

5-
## Creating a project
6-
7-
If you're seeing this, you've probably already done this step. Congrats!
5+
The following snippet contains the most important commands for development.
86

97
```bash
10-
# create a new project in the current directory
11-
npm create svelte@latest
8+
npm install
9+
cp .env.example .env # Copy the example environment file
10+
npm run dev # Starts a development server on port 5173
1211

13-
# create a new project in my-app
14-
npm create svelte@latest my-app
12+
npm run check # Check for various issues
13+
npm run lint # Lint the code
14+
npm run format # Format the code (Or use a Prettier extension in your editor)
1515
```
1616

17-
## Developing
17+
## User
1818

19-
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
19+
In production `api` uses oauth2 to authenticate users.
20+
In developmen
2021

21-
```bash
22-
npm run dev
22+
### Local user override
2323

24-
# or start the server and open the app in a new browser tab
25-
npm run dev -- --open
26-
```
24+
When running locally, the frontend will proxy requests to the backend through a Vite Proxy.
25+
This proxy will add a special header for local development to specify which user to run as.
2726

28-
## Building
27+
There's two well known users:
2928

30-
To create a production version of your app:
29+
| User | Description |
30+
| --------------------------- | ---------------------------------------------------- |
31+
| `[email protected]` | A user with tenant wide permissions, but owns a team |
32+
| `[email protected]` | A user with all permissions |
3133

32-
```bash
33-
npm run build
34-
```
34+
You can specify which user to run as through `.env`.
35+
See `.env.example` for an example.
3536

36-
You can preview the production build with `npm run preview`.
37+
### Using OAUTH
3738

38-
> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.
39+
To use the oauth flow, you need to configure `api` with correct credentials, and the user has to exist in the database.

charts/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ apiVersion: v2
22
name: console-frontend
33
description: Frontend for NAIS console
44
type: application
5-
version: 1.0.0
5+
version: 2024-02-13-104003-46227aa
66
sources:
77
- https://github.com/nais/console-frontend/tree/main/charts

charts/templates/deployment.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ spec:
3232
image: '{{ .Values.image.repository }}/{{ .Values.image.name }}:{{ .Chart.Version }}'
3333
ports:
3434
- name: http
35-
containerPort: 8080
35+
containerPort: 3000
3636
protocol: TCP
3737
resources:
3838
requests:

charts/templates/ingress.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ metadata:
66
annotations:
77
nginx.ingress.kubernetes.io/proxy-buffer-size: 8k
88
spec:
9-
ingressClassName: nais-ingress-iap
9+
ingressClassName: nais-ingress
1010
rules:
1111
- host: '{{ .Values.host }}'
1212
http:

charts/templates/networkpolicy.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ spec:
1212
- to:
1313
- podSelector:
1414
matchLabels:
15-
app: console-backend
15+
app: nais-api
1616
podSelector:
1717
matchLabels:
1818
app: '{{ .Release.Name }}'

charts/templates/service.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ spec:
66
type: ClusterIP
77
ports:
88
- port: 80
9-
targetPort: 3000
9+
targetPort: http
1010
protocol: TCP
1111
name: http
1212
selector:

houdini.config.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
/** @type {import('houdini').ConfigFile} */
44
const config = {
55
watchSchema: {
6-
url: 'http://127.0.0.1:4242/query'
6+
url: 'http://127.0.0.1:3000/query'
77
},
88
plugins: {
99
'houdini-svelte': {}
1010
},
1111
scalars: {
12-
Cursor: { type: 'string' },
12+
Slug: { type: 'string' },
1313
Date: {
1414
type: 'Date',
1515
unmarshal(val) {
@@ -39,6 +39,11 @@ const config = {
3939
return date.toString();
4040
}
4141
}
42+
},
43+
types: {
44+
Reconciler: {
45+
keys: ['name']
46+
}
4247
}
4348
};
4449

package-lock.json

+25-37
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"format": "prettier --write ."
1414
},
1515
"devDependencies": {
16-
"@nais/ds-svelte-community": "^0.7.1",
16+
"@nais/ds-svelte-community": "^0.7.4",
1717
"@nais/ds-svelte-community-preprocess-svelte": "^0.7.0",
1818
"@navikt/ds-css": "^5.11.4",
1919
"@sveltejs/adapter-auto": "^2.1.1",

0 commit comments

Comments
 (0)