Skip to content

Commit fe978cf

Browse files
authored
5.1.2 release (#51)
1 parent 477de50 commit fe978cf

20 files changed

Lines changed: 432 additions & 141 deletions

File tree

cypress/integration/applications.js

100755100644
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,22 @@ describe('Applications', () => {
9797
// Details
9898
cy.findByLabelText('Generate New Secret').should('not.exist');
9999
});
100+
it('should NOT show Generate New Secret when Application status is DELETE_APPLICATION_PENDING_APPROVAL for an org user', () => {
101+
login('orgPublisher', 'Password@1');
102+
103+
cy.findAllByText('Applications')
104+
.first()
105+
.click();
106+
107+
cy.findByTitle('Display as list').click();
108+
109+
cy.findByTitle('GB International Interactions(Deleting)').click({
110+
force: true,
111+
});
112+
113+
// Details
114+
cy.findByLabelText('Generate New Secret').should('not.exist');
115+
});
100116

101117
context('when editing an application', () => {
102118
it('should allow the changing of an API plan on a selected API', () => {

cypress/integration/newPassword.js

100755100644
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
describe('New Password', () => {
44
it('should not load the new password form', () => {
5-
cy.loadData();
5+
// cy.loadData();
66

77
cy.visit('#/new-password/#token/GildasAndAdrien');
88

@@ -18,7 +18,7 @@ describe('New Password', () => {
1818
});
1919

2020
it('should fill the new password form', () => {
21-
cy.loadData();
21+
// cy.loadData();
2222

2323
cy.visit('#/new-password/#token/Mithrandir');
2424

@@ -58,7 +58,7 @@ describe('New Password', () => {
5858
});
5959

6060
it('should return an error if the password is the same than before', () => {
61-
cy.loadData();
61+
// cy.loadData();
6262

6363
cy.visit('#/new-password/#token/Saruman'); // Mocks will trigger an error for this token
6464

package.json

100755100644
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141
"bl": "~4.0.3",
4242
"cypress": "~5.6.0",
4343
"date-fns": "~2.9.0",
44+
"es-abstract": "~1.19.0",
45+
"get-intrinsic": "~1.1.3",
4446
"serialize-javascript": "~3.1.0"
4547
}
4648
}

packages/layer7-apihub-mock/src/defaultData.json

100755100644
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,36 @@
755755
"61bc2c17-19ba-4e01-873f-e3201706908e"
756756
]
757757
},
758+
{
759+
"id": "f6a72eb7-d848-48d2-b33f-5823672cfea5",
760+
"uuid": "f6a72eb7-d848-48d2-b33f-5823672cfea5",
761+
"name": "GB International Interactions(Deleting)",
762+
"status": "DELETE_APPLICATION_PENDING_APPROVAL",
763+
"disabledByType": "EXTERNAL",
764+
"description": "Enhanced bi-directional complexity",
765+
"OauthCallbackUrl": "https://example.com/oauthCallback",
766+
"OauthScope": "OOB",
767+
"OauthType": "confidential",
768+
"apiKey": "fbb71539-e654-434c-ab4d-b83a612fcb6b",
769+
"keySecret": "b47ac256-769d-47f5-9640-8bdc25f1e9b5",
770+
"apiIds": {
771+
"results": [
772+
"9f0ee511-c6ec-4380-8057-43b6bcf49ac4",
773+
"9c531b86-d5f0-46c7-bdd0-d52fc9e1dd9c",
774+
"9e9b888a-8b2e-4a98-aab8-35843b1d3c73",
775+
"04065447-bdf5-4553-8356-ee835150f216",
776+
"61bc2c17-19ba-4e01-873f-e3201706908e",
777+
"8a334a2f-de19-472a-bb11-5a6e38e1c2ee"
778+
]
779+
},
780+
"_accessibleApis": [
781+
"9f0ee511-c6ec-4380-8057-43b6bcf49ac4",
782+
"9c531b86-d5f0-46c7-bdd0-d52fc9e1dd9c",
783+
"9e9b888a-8b2e-4a98-aab8-35843b1d3c73",
784+
"04065447-bdf5-4553-8356-ee835150f216",
785+
"61bc2c17-19ba-4e01-873f-e3201706908e"
786+
]
787+
},
758788
{
759789
"id": "fefbfb9a-9dda-47fd-ba0c-73fbcb17211d",
760790
"uuid": "fefbfb9a-9dda-47fd-ba0c-73fbcb17211d",

packages/layer7-apihub/package.json

100755100644
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"react-dnd": "~10.0.2",
2929
"react-dnd-html5-backend": "~10.0.2",
3030
"react-markdown-editor-lite": "~1.0.2",
31+
"trim": "0.0.3",
3132
"remark-parse": "7.0.2",
3233
"remark-react": "~7.0.1",
3334
"remove-markdown": "~0.3.0",

packages/layer7-apihub/src/applications/ApplicationList.js

100755100644
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ const ApplicationFilter = props => {
134134
name: 'resources.applications.status.disabled',
135135
},
136136
{
137-
id: 'APPLICATION_PENDING_APPROVAL',
137+
id: 'APPLICATION_PENDING_APPROVAL,EDIT_APPLICATION_PENDING_APPROVAL,DELETE_APPLICATION_PENDING_APPROVAL',
138138
name:
139139
'resources.applications.status.application_pending_approval',
140140
},

packages/layer7-apihub/src/applications/ApplicationShow.js

100755100644
Lines changed: 42 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import React from 'react';
22
import { useHistory } from 'react-router-dom';
3-
import { CRUD_DELETE, useDelete, useTranslate } from 'ra-core';
3+
import { useTranslate } from 'ra-core';
44
import { makeStyles } from '@material-ui/core/styles';
55
import Button from '@material-ui/core/Button';
66
import DeleteIcon from '@material-ui/icons/Delete';
7-
7+
import { useDataProvider, useTranslate } from 'ra-core';
88
import { EditButton, TopToolbar } from 'react-admin';
99
import { Show } from '../ui';
1010
import { ApplicationDetails } from './ApplicationDetails';
@@ -35,6 +35,7 @@ const AppShowActions = ({
3535
const notify = useLayer7Notify();
3636
const contentLabelClasses = useContentStyles();
3737
const history = useHistory();
38+
const dataProvider = useDataProvider();
3839
const [deleting, setDeleting] = React.useState(false);
3940

4041
React.useEffect(() => {
@@ -48,7 +49,9 @@ const AppShowActions = ({
4849
React.useEffect(() => {
4950
if (data && userContext) {
5051
if (
52+
data.status !== 'APPLICATION_PENDING_APPROVAL' &&
5153
data.status !== 'EDIT_APPLICATION_PENDING_APPROVAL' &&
54+
data.status !== 'DELETE_APPLICATION_PENDING_APPROVAL' &&
5255
!userContext.userDetails.developer
5356
) {
5457
setCanDelete(true);
@@ -57,29 +60,44 @@ const AppShowActions = ({
5760
}
5861
}
5962
}, [canDelete, data, userContext]);
60-
61-
const [deleteApplication] = useDelete('applications', data?.id, data, {
62-
action: CRUD_DELETE,
63-
onSuccess: () => {
64-
notify(
65-
'resources.applications.notifications.delete_success',
66-
'info',
67-
{
68-
smart_count: 1,
63+
const notifyAndNavigate = () => {
64+
setDeleting(false);
65+
notify('resources.applications.notifications.delete_success', 'info');
66+
history.push('/applications');
67+
};
68+
const deleteApplication = () => {
69+
dataProvider.delete(
70+
'applications',
71+
{
72+
id: data.id,
73+
},
74+
{
75+
onFailure: error => {
76+
setDeleting(false);
77+
notify(error || 'resources.applications.notifications.delete_error',
78+
'error');
79+
},
80+
onSuccess: delData => {
81+
dataProvider.getOne(
82+
'applications',
83+
{
84+
id: data.id,
85+
},
86+
{
87+
onFailure: error => notifyAndNavigate(error),
88+
onSuccess: getData => {
89+
setDeleting(false);
90+
notify('resources.applications.notifications.delete_request_success',
91+
'info');
92+
history.go(0);
93+
}
94+
}
95+
);
6996
}
70-
);
71-
setDeleting(false);
72-
history.push('/applications');
73-
},
74-
onFailure: error => {
75-
setDeleting(false);
76-
notify(
77-
error || 'resources.applications.notifications.delete_error',
78-
'error'
79-
);
80-
},
81-
});
82-
97+
}
98+
);
99+
};
100+
83101
const confirmDelete = event => {
84102
setDeleteConfirm(true);
85103
};

packages/layer7-apihub/src/applications/isApplicationPending.js

100755100644
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ import { isOrgBoundUser } from '../userContexts';
22

33
const STATUS_PENDING_APPROVAL = 'APPLICATION_PENDING_APPROVAL';
44
const STATUS_EDIT_PENDING_APPROVAL = 'EDIT_APPLICATION_PENDING_APPROVAL';
5+
const STATUS_DELETE_PENDING_APPROVAL = 'DELETE_APPLICATION_PENDING_APPROVAL';
56
const DISABLED_BY_TYPE_EXTERNAL = 'EXTERNAL';
67

78
export const isApplicationPendingOrDisabled = (status, disabledByType) => {
89
return (
910
![DISABLED_BY_TYPE_EXTERNAL, null].includes(disabledByType) ||
10-
[STATUS_PENDING_APPROVAL, STATUS_EDIT_PENDING_APPROVAL].includes(status)
11+
[STATUS_PENDING_APPROVAL, STATUS_EDIT_PENDING_APPROVAL, STATUS_DELETE_PENDING_APPROVAL].includes(status)
1112
);
1213
};
1314

packages/layer7-apihub/src/authentication/AccountSetup/TermsDialog.js

100755100644
File mode changed.

packages/layer7-apihub/src/authentication/useResetPassword.js

100755100644
Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,16 @@ export const fetchResetPassword = async (
99
username
1010
) => {
1111
const fetchJson = getFetchJson(originHubName);
12+
const headers = new Headers({
13+
'Content-Type': 'application/json; charset=UTF-8',
14+
Accept: 'text/plain, */*; q=0.01',
15+
});
1216

13-
const { json } = await fetchJson(
14-
`${urlWithTenant}/ResetMyPassword()?Username='${username}'`
15-
);
17+
const { json } = await fetchJson(`${urlWithTenant}/reset-my-password`, {
18+
method: 'put',
19+
headers: headers,
20+
body: JSON.stringify({ userName: username }),
21+
});
1622

1723
return await json;
1824
};

0 commit comments

Comments
 (0)