Skip to content

Commit

Permalink
Merge pull request #71 from maykinmedia/feature/#69-link-zaak-to-exte…
Browse files Browse the repository at this point in the history
…rnal-system

✨ [#69] Support linking to zaken in an external system
  • Loading branch information
SilviaAmAm authored Jun 6, 2024
2 parents 6ae5de5 + 9a5d5d7 commit e8d4af3
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 6 deletions.
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ services:
- CELERY_LOGLEVEL=DEBUG
- REACT_APP_API_URL=http://localhost:8080
- REACT_APP_API_PATH=/api/v1
- REACT_APP_ZAAK_URL_TEMPLATE=https://www.example.com/zaken/{identificatie}
ports:
- 8080:8080
depends_on:
Expand Down
1 change: 1 addition & 0 deletions frontend/.env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
REACT_APP_API_URL=http://localhost:8080
REACT_APP_API_PATH=/api/v1
REACT_APP_ZAAK_URL_TEMPLATE=https://www.example.com/zaken/{identificatie}
1 change: 1 addition & 0 deletions frontend/.env.production.template
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
REACT_APP_API_URL=REACT_APP_API_URL_PLACEHOLDER
REACT_APP_API_PATH=REACT_APP_API_PATH_PLACEHOLDER
REACT_APP_ZAAK_URL_TEMPLATE=REACT_APP_ZAAK_URL_TEMPLATE_PLACEHOLDER
1 change: 1 addition & 0 deletions frontend/scripts/replace-envvars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ for file in /app/static/js/*.js;
do
sed -i 's|REACT_APP_API_URL_PLACEHOLDER|'${REACT_APP_API_URL}'|g' $file
sed -i 's|REACT_APP_API_PATH_PLACEHOLDER|'${REACT_APP_API_PATH}'|g' $file
sed -i 's|REACT_APP_ZAAK_URL_TEMPLATE_PLACEHOLDER|'${REACT_APP_ZAAK_URL_TEMPLATE}'|g' $file
done
12 changes: 11 additions & 1 deletion frontend/src/components/DestructionList/DestructionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
DataGridProps,
ListTemplate,
TypedField,
formatMessage,
} from "@maykin-ui/admin-ui";
import { useEffect, useState } from "react";
import {
Expand Down Expand Up @@ -32,6 +33,9 @@ export type DestructionList = {
destructionListCreateKey: string;
};

/** The template used to format urls to an external application providing zaak details. */
const REACT_APP_ZAAK_URL_TEMPLATE = process.env.REACT_APP_ZAAK_URL_TEMPLATE;

/**
* Review-destruction-list page
*/
Expand All @@ -45,7 +49,10 @@ export function DestructionList({
const errors = useActionData() || {};

const [searchParams, setSearchParams] = useSearchParams();
const objectList = zaken.results as unknown as AttributeData[];
const objectList = zaken.results.map((zaak) => ({
...zaak,
href: formatMessage(REACT_APP_ZAAK_URL_TEMPLATE || "", zaak),
})) as unknown as AttributeData[];
const { state } = useNavigation();

const [fieldSelectionState, setFieldSelectionState] =
Expand Down Expand Up @@ -196,6 +203,9 @@ export function DestructionList({
errors={Object.values(errors)}
dataGridProps={
{
aProps: {
target: "_blank",
},
count: zaken.count,
fields: fields,
loading: state === "loading",
Expand Down
6 changes: 1 addition & 5 deletions frontend/src/pages/destructionlist/DestructionListCreate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
import { Zaak } from "../../types";
import "./DestructionListCreate.css";

/** We need a key to store the zaak selection to, however we don't have a destruction list name yet. */
const DESTRUCTION_LIST_CREATE_KEY = "destruction-list-create";

export type DestructionListCreateContext = {
Expand Down Expand Up @@ -80,11 +81,6 @@ export async function destructionListCreateAction({
return redirect("/");
}

export type DestructionListCreateProps = Omit<
React.ComponentProps<"main">,
"onChange" | "onSelect"
>;

/**
* Destruction list creation page
*/
Expand Down

0 comments on commit e8d4af3

Please sign in to comment.