Skip to content

Commit f2552a8

Browse files
committed
Placeholder for Change requests
1 parent 792ab5d commit f2552a8

7 files changed

Lines changed: 110 additions & 3 deletions

File tree

client/src/api/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ export function privacy() {
185185
return fetchJson("/api/v1/manage/privacy", {}, {}, false);
186186
}
187187

188-
189188
//Connections
190189
export function newConnection(connection) {
191190
return postPutJson("/api/v1/connections", connection, "POST");
@@ -211,6 +210,11 @@ export function requestConnectionProductionStatus(connectionId) {
211210
return postPutJson(`/api/v1/connections/request-production-status/${connectionId}`, {}, "PUT");
212211
}
213212

213+
export function getChangeRequests(connection) {
214+
return fetchJson(`/api/v1/connections/change-requests/${connection.id}`, {}, {}, false);
215+
}
216+
217+
214218
//OrganizationMemberships
215219
export function changeOrganizationMembershipById(organizationMembership, authority) {
216220
const body = {id: organizationMembership.id, authority: authority}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import "./ChangeRequests.scss";
2+
import React, {useEffect, useState} from "react";
3+
import I18n from "../locale/I18n";
4+
import {useAppStore} from "../stores/AppStore.js";
5+
import {getChangeRequests} from "../api/index.js";
6+
import {Button, Loader} from "@surfnet/sds";
7+
import {ENVIRONMENTS} from "../utils/Manage.js";
8+
9+
export const ChangeRequests = ({
10+
application
11+
}) => {
12+
13+
const {setFlash} = useAppStore(state => state);
14+
const [changeRequests, setChangeRequests] = useState(true);
15+
const [loading, setLoading] = useState(true);
16+
17+
useEffect(() => {
18+
const promises = application.connections
19+
.filter(connection => connection.environment === ENVIRONMENTS.PROD && connection.state === "prodaccepted")
20+
.map(connection => getChangeRequests(connection));
21+
Promise.all(promises)
22+
.then(res => {
23+
setChangeRequests(res);
24+
setLoading(false);
25+
})
26+
27+
}, [application]);
28+
29+
30+
if (loading) {
31+
return <Loader/>
32+
}
33+
34+
return (
35+
<div className="change-requests-container">
36+
<div className="change-requests-inner">
37+
<div className="app-header">
38+
<h2>{I18n.t("changeRequests.title")}</h2>
39+
</div>
40+
<div className="change-requests-information card">
41+
{JSON.stringify(changeRequests)}
42+
</div>
43+
<div className={`actions orphan`}>
44+
{!application.signedContract &&
45+
<>
46+
<Button txt={I18n.t("connection.contractSection.sign")}
47+
disabled={!maySignContract}
48+
onClick={() => submit()}/>
49+
</>
50+
}
51+
</div>
52+
</div>
53+
</div>
54+
);
55+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
@use "../styles/mixins" as *;
2+
@use "../index";
3+
@use "../styles/application";
4+
5+
$width-percentage: 75%;
6+
7+
.change-requests-container {
8+
background-color: white;
9+
padding: 25px 50px;
10+
11+
.change-requests-inner {
12+
max-width: 60%;
13+
}
14+
.app-header {
15+
display: flex;
16+
align-items: center;
17+
margin-bottom: 25px;
18+
}
19+
.change-requests-information {
20+
max-width: 100%;
21+
}
22+
.actions {
23+
display: flex;
24+
margin: 25px 0;
25+
align-items: flex-end;
26+
justify-content: space-between;
27+
28+
&.orphan {
29+
justify-content: flex-end;
30+
}
31+
32+
33+
button svg {
34+
width: 16px;
35+
height: auto;
36+
}
37+
}
38+
}

client/src/connection/Testing.jsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,6 +1015,9 @@ export const Testing = ({
10151015
return !informationProfileValid();
10161016
}
10171017
case sections.testIdP: {
1018+
if (isProduction) {
1019+
return false;
1020+
}
10181021
return !testIdPValid();
10191022
}
10201023
}
@@ -1034,7 +1037,7 @@ export const Testing = ({
10341037
}
10351038
const proceed = (section === sections.technical && technicalValid()) ||
10361039
(section === sections.informationProfile && informationProfileValid()) ||
1037-
(section === sections.testIdP && testIdPValid());
1040+
(section === sections.testIdP && (isProduction || testIdPValid()));
10381041
if (proceed) {
10391042
setLoading(true);
10401043
const promise = connection.id ? updateConnection : newConnection

client/src/locale/en.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ const en = {
198198
testing: "Testing",
199199
prod: "Production",
200200
application: "App information",
201+
change_requests: "Change request",
201202
contract: "Contract",
202203
appteam: "Appteam",
203204
welcome: "Welkom {{user}}. {{name}} is nog niet gekoppeld met SURF Access. Begin met een koppeling aan onze testomgeving.",

client/src/pages/Connection.jsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ import {Contract} from "../connection/Contract.jsx";
2020
import {AppTeamManagement} from "../application/AppTeamManagement.jsx";
2121
import {connectOptions, visibilities} from "../utils/Connection.js";
2222
import {isEmpty} from "../utils/Utils.js";
23+
import {ChangeRequests} from "../connection/ChangeRequests.jsx";
2324

24-
const tabNames = ["overview", "testing", "prod", "application", "contract", "appteam"]
25+
const tabNames = ["overview", "testing", "prod", "application", "change_requests", "contract", "appteam"]
2526

2627
const protocolOptions = Object.values(PROTOCOLS).map(protocol => ({
2728
value: protocol,
@@ -214,6 +215,10 @@ export const Connection = () => {
214215
arpInfo={arp}
215216
/>
216217
}
218+
case "change_requests": {
219+
return <ChangeRequests application={application}
220+
/>
221+
}
217222
case "contract": {
218223
return <Contract application={application}
219224
setApplication={setApplication}

server/src/test/java/access/manage/ConnectionProviderConverterTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class ConnectionProviderConverterTest extends AbstractTest {
2020

2121
@Autowired
2222
private ConnectionProviderConverter connectionProviderConverter;
23+
2324
@Autowired
2425
private Manage manage;
2526

0 commit comments

Comments
 (0)