Skip to content

Commit

Permalink
Feat/am UI/1091 modal husker siste søk når man går tilbake fra resu (#…
Browse files Browse the repository at this point in the history
…1099)

* Refactor DelegationModal component and extract its content to a separate component

- Extracted the content of the DelegationModal component to a new component called DelegationModalContent
- Created a new context called DelegationModalContext to manage the state and functions related to the DelegationModal component
- Moved the useState hooks and related functions from DelegationModal to DelegationModalContext
- Updated the imports and references in DelegationModal to use the new

* Refactor DelegationModal component and extract its content to a separate component

* ikkje

* added narnia and testdepartment (corrected orgnumber) to list of serviceowners

* Update src/localizations/no_nn.json

Co-authored-by: Alexandra Vedeler <arnex04@gmail.com>

* Update src/features/amUI/userRightsPage/DelegationModal/ResourceInfo.tsx

Co-authored-by: Alexandra Vedeler <arnex04@gmail.com>

* Refactor resource search functionality in ResourceSearch component

---------

Co-authored-by: Allinox <arnex04@gmail.com>
  • Loading branch information
sonwit and allinox authored Oct 1, 2024
1 parent d5387ba commit 00714ec
Show file tree
Hide file tree
Showing 18 changed files with 300 additions and 123 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
],
"hasCompetentAuthority": {
"orgcode": "TTD",
"organization": "123456789",
"organization": "974760746",
"name": {
"en": "Testdepartementet",
"nb": "Testdepartementet",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
],
"hasCompetentAuthority": {
"orgcode": "TTD",
"organization": "123456789",
"organization": "974760746",
"name": {
"en": "Testdepartementet",
"nb": "Testdepartementet",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
{
"orgs": {
"nar": {
"name": {
"en": "Narnia",
"nb": "Narnia",
"nn": "Narnia"
},
"logo": "https://altinncdn.no/orgs/nbib/nasjonalbiblioteket.png",
"orgnr": "777777777",
"homepage": "https://en.wikipedia.org/wiki/The_Chronicles_of_Narnia",
"environments": [
"tt02",
"production"
]
},
"brg": {
"name": {
"en": "Brønnøysund Register Centre",
Expand Down Expand Up @@ -495,7 +509,7 @@
"nn": "Testdepartementet"
},
"logo": "",
"orgnr": "",
"orgnr": "974760746",
"homepage": "",
"environments": [
"at21",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@
],
"hasCompetentAuthority": {
"orgcode": "TTD",
"organization": "123456789",
"organization": "974760746",
"name": {
"en": "Testdepartementet",
"nb": "Testdepartementet",
Expand Down Expand Up @@ -620,7 +620,7 @@
],
"hasCompetentAuthority": {
"orgcode": "TTD",
"organization": "123456789",
"organization": "974760746",
"name": {
"en": "Testdepartementet",
"nb": "Testdepartementet",
Expand Down Expand Up @@ -685,7 +685,7 @@
],
"hasCompetentAuthority": {
"orgcode": "TTD",
"organization": "123456789",
"organization": "974760746",
"name": {
"en": "Testdepartementet",
"nb": "Testdepartementet",
Expand Down Expand Up @@ -755,7 +755,7 @@
],
"hasCompetentAuthority": {
"orgcode": "TTD",
"organization": "123456789",
"organization": "974760746",
"name": {
"en": "Testdepartementet",
"nb": "Testdepartementet",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@
}
],
"resourceOwnerName": "Testdepartementet",
"resourceOwnerOrgNumber": "123456789"
"resourceOwnerOrgNumber": "974760746"
},
{
"title": "A2 skjema",
Expand Down Expand Up @@ -446,7 +446,7 @@
}
],
"resourceOwnerName": "Testdepartementet",
"resourceOwnerOrgNumber": "123456789"
"resourceOwnerOrgNumber": "974760746"
},
{
"title": "A3 app 2",
Expand Down Expand Up @@ -491,7 +491,7 @@
}
],
"resourceOwnerName": "Testdepartementet",
"resourceOwnerOrgNumber": "123456789"
"resourceOwnerOrgNumber": "974760746"
},
{
"title": "A2 skjema 2",
Expand Down Expand Up @@ -541,7 +541,7 @@
}
],
"resourceOwnerName": "Testdepartementet",
"resourceOwnerOrgNumber": "123456789"
"resourceOwnerOrgNumber": "974760746"
},
{
"title": "Brannbilen i Brønnøysund",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
],
"hasCompetentAuthority": {
"orgcode": "TTD",
"organization": "123456789",
"organization": "974760746",
"name": {
"en": "Testdepartementet",
"nb": "Testdepartementet",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
],
"hasCompetentAuthority": {
"orgcode": "TTD",
"organization": "123456789",
"organization": "974760746",
"name": {
"en": "Testdepartementet",
"nb": "Testdepartementet",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public async Task GetSingleRightsSearch_filterSet_ReturnsMatch()
int page = 1;
int resultsPerPage = 4;
// Narnia and testdepartementet
string[] roFilters = { "777777777", "123456789" };
string[] roFilters = { "777777777", "974760746" };

List<ServiceResourceFE> allExpectedResources = TestDataUtil.GetSingleRightsResources().FindAll(r => roFilters.Contains(r.ResourceOwnerOrgNumber));
PaginatedList<ServiceResourceFE> expectedResult = new PaginatedList<ServiceResourceFE>(allExpectedResources.GetRange(0, resultsPerPage), page, allExpectedResources.Count);
Expand Down Expand Up @@ -210,7 +210,7 @@ public async Task GetSingleRightsSearch_searchStringAndFilterSet_ReturnsCorrectO
int resultsPerPage = 4;
string searchString = "gir tilgang til brannbilen";
// Brannvesenet and Testdepartementet
string[] roFilters = { "110110110", "123456789" };
string[] roFilters = { "110110110", "974760746" };

List<ServiceResourceFE> allExpectedResources = TestDataUtil.GetSingleRightsResources().FindAll(r => roFilters.Contains(r.ResourceOwnerOrgNumber));
// The most relevant resource to our search will be the Brannvesenet service, which is stored last
Expand Down Expand Up @@ -329,7 +329,7 @@ public async Task GetResourceOwners_resourceTypeMaskinPortenSchemAndAltinn2Servi
new ResourceOwnerFE("NARNIA", "777777777"),
new ResourceOwnerFE("PÅFUNNSETATEN", "985399077"),
new ResourceOwnerFE("Skatteetaten", "974761076"),
new ResourceOwnerFE("Testdepartementet", "123456789"),
new ResourceOwnerFE("Testdepartementet", "974760746"),
};

// Act
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
[
{
"OrganisationName": "Narnia",
"OrganisationNumber": "777777777"
},
{
"OrganisationName": "Brønnøysundregistrene",
"OrganisationNumber": "974760673"
Expand Down Expand Up @@ -145,7 +149,7 @@
},
{
"OrganisationName": "Testdepartementet",
"OrganisationNumber": ""
"OrganisationNumber": "974760746"
},
{
"OrganisationName": "Utlendingsdirektoratet",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,25 @@
"Delegable": true,
"Visible": true,
"ResourceOwnerName": "Testdepartementet",
"ResourceOwnerOrgNumber": "123456789",
"ResourceOwnerOrgNumber": "974760746",
"ResourceReferences": [
{ "ReferenceSource": "Altinn3", "Reference": "ttd/a3-app", "ReferenceType": "ApplicationId" }
{
"ReferenceSource": "Altinn3",
"Reference": "ttd/a3-app",
"ReferenceType": "ApplicationId"
}
],
"PriorityCounter": null,
"ResourceType": "AltinnApp",
"AuthorizationReference": [
{ "Id": "urn:altinn:app", "Value": "a3-app" },
{ "Id": "urn:altinn:org", "Value": "ttd" }
{
"Id": "urn:altinn:app",
"Value": "a3-app"
},
{
"Id": "urn:altinn:org",
"Value": "ttd"
}
]
},
{
Expand All @@ -98,16 +108,30 @@
"Delegable": true,
"Visible": true,
"ResourceOwnerName": "Testdepartementet",
"ResourceOwnerOrgNumber": "123456789",
"ResourceOwnerOrgNumber": "974760746",
"ResourceReferences": [
{ "ReferenceSource": "Altinn2", "Reference": "3225", "ReferenceType": "ServiceCode" },
{ "ReferenceSource": "Altinn2", "Reference": "1596", "ReferenceType": "ServiceEditionCode" }
{
"ReferenceSource": "Altinn2",
"Reference": "3225",
"ReferenceType": "ServiceCode"
},
{
"ReferenceSource": "Altinn2",
"Reference": "1596",
"ReferenceType": "ServiceEditionCode"
}
],
"PriorityCounter": null,
"ResourceType": "Altinn2Service",
"AuthorizationReference": [
{ "Id": "urn:altinn:servicecode", "Value": "3225" },
{ "Id": "urn:altinn:serviceeditioncode", "Value": "1596" }
{
"Id": "urn:altinn:servicecode",
"Value": "3225"
},
{
"Id": "urn:altinn:serviceeditioncode",
"Value": "1596"
}
]
},
{
Expand All @@ -129,15 +153,25 @@
"Delegable": true,
"Visible": true,
"ResourceOwnerName": "Testdepartementet",
"ResourceOwnerOrgNumber": "123456789",
"ResourceOwnerOrgNumber": "974760746",
"ResourceReferences": [
{ "ReferenceSource": "Altinn3", "Reference": "ttd/a3-app2", "ReferenceType": "ApplicationId" }
{
"ReferenceSource": "Altinn3",
"Reference": "ttd/a3-app2",
"ReferenceType": "ApplicationId"
}
],
"PriorityCounter": null,
"ResourceType": "AltinnApp",
"AuthorizationReference": [
{ "Id": "urn:altinn:app", "Value": "a3-app2" },
{ "Id": "urn:altinn:org", "Value": "ttd" }
{
"Id": "urn:altinn:app",
"Value": "a3-app2"
},
{
"Id": "urn:altinn:org",
"Value": "ttd"
}
]
},
{
Expand All @@ -159,16 +193,30 @@
"Delegable": true,
"Visible": true,
"ResourceOwnerName": "Testdepartementet",
"ResourceOwnerOrgNumber": "123456789",
"ResourceOwnerOrgNumber": "974760746",
"ResourceReferences": [
{ "ReferenceSource": "Altinn2", "Reference": "322a", "ReferenceType": "ServiceCode" },
{ "ReferenceSource": "Altinn2", "Reference": "159b", "ReferenceType": "ServiceEditionCode" }
{
"ReferenceSource": "Altinn2",
"Reference": "322a",
"ReferenceType": "ServiceCode"
},
{
"ReferenceSource": "Altinn2",
"Reference": "159b",
"ReferenceType": "ServiceEditionCode"
}
],
"PriorityCounter": null,
"ResourceType": "Altinn2Service",
"AuthorizationReference": [
{ "Id": "urn:altinn:servicecode", "Value": "322a" },
{ "Id": "urn:altinn:serviceeditioncode", "Value": "159b" }
{
"Id": "urn:altinn:servicecode",
"Value": "322a"
},
{
"Id": "urn:altinn:serviceeditioncode",
"Value": "159b"
}
]
},
{
Expand Down
Loading

0 comments on commit 00714ec

Please sign in to comment.