Skip to content

Commit

Permalink
feat(service-portal): law and order module (#14819)
Browse files Browse the repository at this point in the history
* feat: add law and order library

* feat: overview and detail screen

* feat: subpeona and modals, refactor data and structure

* fix: revert changes on progress meter

* fix: render modules

* chore: nx format:write update dirty files

* fix: naming

* fix: minor probs

* feat: graphql and client temp mocked

* fix: cleanup generated test file

* fix: path error

* fix: responsive fixes and spacing

* fix: path & mock data

* feat: locale changes + fixes

* fix: env missing

* chore: charts update dirty files

* feat: connect to service

* fix: ui changes

* feat: new client for judical system

* Update .github/CODEOWNERS

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* fix: add missing provider file

* fix: logger type

* update: use judicial client

* chore: charts update dirty files

* feat: get subpoena data from service

* fix: subpoena logic

* Update README.md

* chore: nx format:write update dirty files

* feat: update client

* Update libs/clients/judicial-system-sp/README.md

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update libs/clients/judicial-system-sp/README.md

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* fix: loading state for button

* update: client

* update client config

* update: move modal to core

* update: client

* chore: charts update dirty files

* fix: cleanup type declrations

* update: client

* fix: merge conflict

* fix: models

* fix: service

* feat: connect subpoena to service

* fix: errors

* update client

* fix: remove timout

* fix: import

* fix: remove type - causing errors

* chore: remove "as" from locale type & better error handling

* fix: locale typing

* fix: query after deleting input

* fix: dumdum

* fix: remove unused fields

* feat: add feature flag for module

* feat: add document actions

* feat: add callback for confirmation

* chore: nx format:write update dirty files

* display confirmation text

* missing text

* locale

* fix: locale

* fix: hide actions

* fix: defender null check

* testing new flow

* chore: charts update dirty files

* add scopes to resolver

* refactor data models

* feat: remove check if urgent

* refactor: remove async from resolver

* feat: redirect to mailbox

* fix: include doc in service

* cleanup

* fix

* feat: add feature flag for document actions

* refactor: strings and rollback fflag

* fix: PR comments

* fix: remove unused xroad

* chore: charts update dirty files

* feat: add versioning for digital mailbox

* refactor: add message to document actions from service

* refactor: updates from service + other refactor

* refactor: document actions

* fix: documents

* cleanup

* feat: add feature flag to resolver

* sort imports

* pr fixes and sorting

* fix: PR review

* fix build

---------

Co-authored-by: andes-it <builders@andes.is>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Tryggvi Geir Magnússon <tryggvi@hugsmidjan.is>
Co-authored-by: Kristofer <kristofer@andes.is>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
6 people authored and thoreyjona committed Oct 2, 2024
1 parent 1968918 commit a9b14e7
Show file tree
Hide file tree
Showing 118 changed files with 4,788 additions and 96 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ codemagic.yaml
/libs/api/domains/official-journal-of-iceland-application/ @island-is/hugsmidjan
/libs/api/domains/document-provider/ @island-is/hugsmidjan @island-is/core
/libs/api/domains/housing-benefits/ @island-is/hugsmidjan
/libs/api/domains/law-and-order/ @island-is/hugsmidjan
/libs/clients/documents/ @island-is/hugsmidjan
/libs/clients/documents-v2/ @island-is/hugsmidjan
/libs/clients/finance/ @island-is/hugsmidjan
Expand Down Expand Up @@ -198,6 +199,7 @@ codemagic.yaml
/libs/portals/admin/air-discount-scheme @island-is/hugsmidjan
/libs/application/templates/official-journal-of-iceland/ @island-is/hugsmidjan
/libs/application/template-api-modules/src/lib/modules/templates/official-journal-of-iceland/ @island-is/hugsmidjan
/libs/clients/judicial-system-sp/ @island-is/hugsmidjan
/libs/application/templates/data-protection-complaint/ @island-is/norda
/libs/application/templates/institution-collaboration/ @island-is/norda @island-is/fuglar
/libs/application/templates/login-service/ @island-is/norda
Expand Down
2 changes: 2 additions & 0 deletions apps/api/infra/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import {
UniversityCareers,
OfficialJournalOfIceland,
OfficialJournalOfIcelandApplication,
JudicialSystemServicePortal,
Frigg,
HealthDirectorateOrganDonation,
HealthDirectorateVaccination,
Expand Down Expand Up @@ -432,6 +433,7 @@ export const serviceSetup = (services: {
SignatureCollection,
SocialInsuranceAdministration,
OfficialJournalOfIceland,
JudicialSystemServicePortal,
OfficialJournalOfIcelandApplication,
Frigg,
HealthDirectorateOrganDonation,
Expand Down
6 changes: 5 additions & 1 deletion apps/api/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ import {
} from '@island.is/clients/university-careers'
import { HousingBenefitsConfig } from '@island.is/clients/hms-housing-benefits'
import { UserProfileClientConfig } from '@island.is/clients/user-profile'
import { LawAndOrderModule } from '@island.is/api/domains/law-and-order'
import { UltravioletRadiationClientConfig } from '@island.is/clients/ultraviolet-radiation'
import { JudicialSystemSPClientConfig } from '@island.is/clients/judicial-system-sp'
import { CriminalRecordClientConfig } from '@island.is/clients/criminal-record'
import { HealthInsuranceV2ClientConfig } from '@island.is/clients/icelandic-health-insurance/health-insurance'
import { VmstClientConfig } from '@island.is/clients/vmst'
Expand Down Expand Up @@ -328,6 +330,7 @@ const environment = getConfig
AuthAdminModule,
HousingBenefitCalculatorModule,
SignatureCollectionModule,
LawAndOrderModule,
UmbodsmadurSkuldaraModule,
HealthDirectorateModule,
ConfigModule.forRoot({
Expand Down Expand Up @@ -419,11 +422,12 @@ const environment = getConfig
LicenseConfig,
UserProfileClientConfig,
UltravioletRadiationClientConfig,
JudicialSystemSPClientConfig,
FriggClientConfig,
GradeClientConfig,
VmstClientConfig,
HealthInsuranceV2ClientConfig,
CriminalRecordClientConfig,
HealthInsuranceV2ClientConfig,
UmbodsmadurSkuldaraClientConfig,
emailModuleConfig,
],
Expand Down
1 change: 1 addition & 0 deletions apps/service-portal/src/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const SERVICE_PORTAL_SCOPES = [
ApiScope.internal,
ApiScope.internalProcuring,
ApiScope.meDetails,
ApiScope.lawAndOrder,
ApiScope.licenses,
ApiScope.licensesVerify,
ApiScope.company,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,8 @@ const ContentBreadcrumbs: FC<React.PropsWithChildren<unknown>> = () => {
}

findBreadcrumbsPath(navigation, [])

const isMobile = width < theme.breakpoints.md
if (items.length < 2) return null

return (
<Box
display="flex"
Expand Down
2 changes: 2 additions & 0 deletions apps/service-portal/src/lib/masterNavigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { sessionsNavigation } from '@island.is/service-portal/sessions'
import { consentNavigation } from '@island.is/service-portal/consent'
import { ServicePortalPaths } from '@island.is/service-portal/core'
import { socialInsuranceMaintenanceNavigation } from '@island.is/service-portal/social-insurance-maintenance'
import { lawAndOrderNavigation } from '@island.is/service-portal/law-and-order'

export const rootNavigationItem: PortalNavigationItem = {
name: m.overview,
Expand Down Expand Up @@ -55,5 +56,6 @@ export const MAIN_NAVIGATION: PortalNavigationItem = {
occupationalLicensesNavigation,
airDiscountNavigation,
educationNavigation,
lawAndOrderNavigation,
],
}
2 changes: 2 additions & 0 deletions apps/service-portal/src/lib/modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { consentModule } from '@island.is/service-portal/consent'
import { occupationalLicensesModule } from '@island.is/service-portal/occupational-licenses'
import { signatureCollectionModule } from '@island.is/service-portal/signature-collection'
import { socialInsuranceMaintenanceModule } from '@island.is/service-portal/social-insurance-maintenance'
import { lawAndOrderModule } from '@island.is/service-portal/law-and-order'

/**
* NOTE:
Expand Down Expand Up @@ -47,4 +48,5 @@ export const modules: PortalModule[] = [
socialInsuranceMaintenanceModule,
signatureCollectionModule,
petitionsModule,
lawAndOrderModule,
]
73 changes: 56 additions & 17 deletions apps/service-portal/src/screens/Dashboard/Dashboard.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC, useEffect } from 'react'
import React, { FC, useEffect, useState } from 'react'
import { Link, useLocation } from 'react-router-dom'
import { useAuth } from '@island.is/auth/react'
import {
Expand All @@ -16,6 +16,7 @@ import { useLocale } from '@island.is/localization'
import {
DocumentsPaths,
DocumentLine,
DocumentLineV3,
useDocumentList,
} from '@island.is/service-portal/documents'
import {
Expand All @@ -36,6 +37,7 @@ import * as styles from './Dashboard.css'
import cn from 'classnames'
import { getOrganizationLogoUrl } from '@island.is/shared/utils'
import { DocumentsScope } from '@island.is/auth/scopes'
import { useFeatureFlagClient } from '@island.is/react/feature-flags'

export const Dashboard: FC<React.PropsWithChildren<unknown>> = () => {
const { userInfo } = useAuth()
Expand All @@ -51,6 +53,24 @@ export const Dashboard: FC<React.PropsWithChildren<unknown>> = () => {
const IS_COMPANY = userInfo?.profile?.subjectType === 'legalEntity'
const hasDelegationAccess = userInfo?.scopes?.includes(DocumentsScope.main)

// Versioning feature flag. Remove after feature is live.
const [v3Enabled, setV3Enabled] = useState<boolean>()

const featureFlagClient = useFeatureFlagClient()
useEffect(() => {
const isFlagEnabled = async () => {
const ffEnabled = await featureFlagClient.getValue(
`isServicePortalDocumentsV3PageEnabled`,
false,
)
if (ffEnabled) {
setV3Enabled(ffEnabled as boolean)
}
}
isFlagEnabled()
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])

useEffect(() => {
PlausiblePageviewDetail(
ServicePortalPaths.Root,
Expand Down Expand Up @@ -219,22 +239,41 @@ export const Dashboard: FC<React.PropsWithChildren<unknown>> = () => {
) : filteredDocuments.length > 0 ? (
filteredDocuments.map((doc, i) => (
<Box key={doc.id}>
<DocumentLine
img={
doc?.sender?.name
? getOrganizationLogoUrl(
doc?.sender?.name,
organizations,
60,
'none',
)
: undefined
}
documentLine={doc}
active={false}
asFrame
includeTopBorder={i === 0}
/>
{v3Enabled ? (
<DocumentLineV3
img={
doc?.sender?.name
? getOrganizationLogoUrl(
doc?.sender?.name,
organizations,
60,
'none',
)
: undefined
}
documentLine={doc}
active={false}
asFrame
includeTopBorder={i === 0}
/>
) : (
<DocumentLine
img={
doc?.sender?.name
? getOrganizationLogoUrl(
doc?.sender?.name,
organizations,
60,
'none',
)
: undefined
}
documentLine={doc}
active={false}
asFrame
includeTopBorder={i === 0}
/>
)}
</Box>
))
) : (
Expand Down
1 change: 1 addition & 0 deletions charts/islandis/values.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ api:
XROAD_ICELAND_UNIVERSITY_OF_THE_ARTS_PATH: 'IS-DEV/EDU/10049/LHI-Protected/brautskraning-v1'
XROAD_INNA_PATH: 'IS-DEV/GOV/10066/MMS-Protected/inna-v1'
XROAD_INTELLECTUAL_PROPERTIES_PATH: 'IS-DEV/GOV/10030/WebAPI-Public/HUG-webAPI/'
XROAD_JUDICIAL_SYSTEM_SP_PATH: 'IS-DEV/GOV/10014/Rettarvorslugatt-Private/judicial-system-mailbox-api'
XROAD_MMS_FRIGG_PATH: 'IS-DEV/GOV/10066/MMS-Protected/frigg-api'
XROAD_MMS_GRADE_SERVICE_ID: 'IS-DEV/GOV/10066/MMS-Protected/grade-api-v1'
XROAD_MMS_LICENSE_SERVICE_ID: 'IS-DEV/GOV/10066/MMS-Protected/license-api-v1'
Expand Down
1 change: 1 addition & 0 deletions charts/islandis/values.prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ api:
XROAD_ICELAND_UNIVERSITY_OF_THE_ARTS_PATH: 'IS/EDU/4210984099/LHI-Protected/brautskraning-v1'
XROAD_INNA_PATH: 'IS/GOV/6601241280/MMS-Protected/inna-v1'
XROAD_INTELLECTUAL_PROPERTIES_PATH: 'IS/GOV/6501912189/WebAPI-Public/HUG-webAPI/'
XROAD_JUDICIAL_SYSTEM_SP_PATH: 'IS-GOV/GOV/5804170510/Rettarvorslugatt-Private/judicial-system-mailbox-api'
XROAD_MMS_FRIGG_PATH: 'IS/GOV/10066/MMS-Protected/frigg-api'
XROAD_MMS_GRADE_SERVICE_ID: 'IS/GOV/6601241280/MMS-Protected/grade-api-v1'
XROAD_MMS_LICENSE_SERVICE_ID: 'IS/GOV/6601241280/MMS-Protected/license-api-v1'
Expand Down
1 change: 1 addition & 0 deletions charts/islandis/values.staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ api:
XROAD_ICELAND_UNIVERSITY_OF_THE_ARTS_PATH: 'IS-TEST/EDU/10049/LHI-Protected/brautskraning-v1'
XROAD_INNA_PATH: 'IS-TEST/GOV/6601241280/MMS-Protected/inna-v1'
XROAD_INTELLECTUAL_PROPERTIES_PATH: 'IS-TEST/GOV/6501912189/WebAPI-Public/HUG-webAPI/'
XROAD_JUDICIAL_SYSTEM_SP_PATH: 'IS-TEST/GOV/10014/Rettarvorslugatt-Private/judicial-system-mailbox-api'
XROAD_MMS_FRIGG_PATH: 'IS-TEST/GOV/10066/MMS-Protected/frigg-api'
XROAD_MMS_GRADE_SERVICE_ID: 'IS-TEST/GOV/6601241280/MMS-Protected/grade-api-v1'
XROAD_MMS_LICENSE_SERVICE_ID: 'IS-TEST/GOV/6601241280/MMS-Protected/license-api-v1'
Expand Down
11 changes: 11 additions & 0 deletions infra/src/dsl/xroad.ts
Original file line number Diff line number Diff line change
Expand Up @@ -841,6 +841,17 @@ export const UniversityGatewayReykjavikUniversity = new XroadConf({
},
})

export const JudicialSystemServicePortal = new XroadConf({
env: {
XROAD_JUDICIAL_SYSTEM_SP_PATH: {
dev: 'IS-DEV/GOV/10014/Rettarvorslugatt-Private/judicial-system-mailbox-api',
staging:
'IS-TEST/GOV/10014/Rettarvorslugatt-Private/judicial-system-mailbox-api',
prod: 'IS-GOV/GOV/5804170510/Rettarvorslugatt-Private/judicial-system-mailbox-api',
},
},
})

export const SocialInsuranceAdministration = new XroadConf({
env: {
XROAD_TR_PATH: {
Expand Down
11 changes: 10 additions & 1 deletion libs/api/domains/documents/src/lib/documentV2.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { MailActionInput } from './models/v2/bulkMailAction.input'
import { DocumentMailAction } from './models/v2/mailAction.model.'
import { LOGGER_PROVIDER, type Logger } from '@island.is/logging'
import { DocumentV2MarkAllMailAsRead } from './models/v2/markAllMailAsRead.model'
import type { Locale } from '@island.is/shared/types'

const LOG_CATEGORY = 'documents-resolver'

Expand All @@ -46,6 +47,8 @@ export class DocumentResolverV2 {
@Query(() => DocumentV2, { nullable: true, name: 'documentV2' })
async documentV2(
@Args('input') input: DocumentInput,
@Args('locale', { type: () => String, nullable: true })
locale: Locale = 'is',
@CurrentUser() user: User,
): Promise<DocumentV2 | null> {
try {
Expand All @@ -55,8 +58,14 @@ export class DocumentResolverV2 {
namespace: '@island.is/api/document-v2',
action: 'getDocument',
resources: input.id,
meta: { includeDocument: input.includeDocument },
},
this.documentServiceV2.findDocumentById(user.nationalId, input.id),
this.documentServiceV2.findDocumentById(
user.nationalId,
input.id,
locale,
input.includeDocument,
),
)
} catch (e) {
this.logger.info('failed to get single document', {
Expand Down
Loading

0 comments on commit a9b14e7

Please sign in to comment.