Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove stale flags #16039

Merged
merged 11 commits into from
Jan 21, 2025
33 changes: 6 additions & 27 deletions apps/portals/my-pages/src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@ import { helperStyles, theme } from '@island.is/island-ui/theme'
import { useLocale } from '@island.is/localization'
import { PortalPageLoader } from '@island.is/portals/core'
import { useUserInfo } from '@island.is/react-spa/bff'
import { useFeatureFlagClient } from '@island.is/react/feature-flags'
import {
LinkResolver,
ServicePortalPaths,
m,
} from '@island.is/portals/my-pages/core'
import { DocumentsPaths } from '@island.is/portals/my-pages/documents'
import { UserLanguageSwitcher, UserMenu } from '@island.is/shared/components'
import { useEffect, useRef, useState } from 'react'
import { useRef, useState } from 'react'
import { Link } from 'react-router-dom'
import { useWindowSize } from 'react-use'
import NotificationButton from '../Notifications/NotificationButton'
Expand All @@ -40,24 +39,6 @@ export const Header = ({ position }: Props) => {
const isMobile = width < theme.breakpoints.md
const user = useUserInfo()

// Notification feature flag. Remove after feature is live.
const [enableNotificationFlag, setEnableNotificationFlag] =
useState<boolean>(false)
const featureFlagClient = useFeatureFlagClient()
useEffect(() => {
const isFlagEnabled = async () => {
const ffEnabled = await featureFlagClient.getValue(
`isServicePortalNotificationsPageEnabled`,
false,
)
if (ffEnabled) {
setEnableNotificationFlag(ffEnabled as boolean)
}
}
isFlagEnabled()
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])

const hasNotificationsDelegationAccess = user?.scopes?.includes(
DocumentsScope.main,
)
Expand Down Expand Up @@ -122,13 +103,11 @@ export const Header = ({ position }: Props) => {
</Box>
</Hidden>

{enableNotificationFlag && (
<NotificationButton
setMenuState={(val: MenuTypes) => setMenuOpen(val)}
showMenu={menuOpen === 'notifications'}
disabled={!hasNotificationsDelegationAccess}
/>
)}
<NotificationButton
setMenuState={(val: MenuTypes) => setMenuOpen(val)}
showMenu={menuOpen === 'notifications'}
disabled={!hasNotificationsDelegationAccess}
/>

{user && <UserLanguageSwitcher />}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ const LOG_CATEGORY = 'law-and-order-resolver'
@UseGuards(IdsUserGuard, ScopesGuard, FeatureFlagGuard)
@Resolver()
@Audit({ namespace: '@island.is/api/law-and-order' })
@FeatureFlag(Features.servicePortalLawAndOrderModuleEnabled)
@Scopes(ApiScope.lawAndOrder)
export class LawAndOrderResolver {
constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import { BulkVehicleMileageRequestStatusInput } from '../dto/getBulkVehicleMilea
import { BulkVehicleMileageRequestOverviewInput } from '../dto/getBulkVehicleMileageRequestOverview.input'

@UseGuards(IdsUserGuard, ScopesGuard, FeatureFlagGuard)
@FeatureFlag(Features.servicePortalVehicleBulkMileagePageEnabled)
@Resolver()
@Audit({ namespace: '@island.is/api/vehicles' })
@Scopes(ApiScope.vehicles)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,13 @@ import {
PostVehicleMileageInput,
PutVehicleMileageInput,
} from '../dto/postVehicleMileageInput'
import {
FeatureFlagGuard,
FeatureFlag,
Features,
} from '@island.is/nest/feature-flags'
import { mileageDetailConstructor } from '../utils/helpers'
import { LOGGER_PROVIDER, type Logger } from '@island.is/logging'
import { VehicleMileagePostResponse } from '../models/v3/postVehicleMileageResponse.model'
import { VehiclesMileageUpdateError } from '../models/v3/vehicleMileageResponseError.model'
import { VehicleMileagePutResponse } from '../models/v3/putVehicleMileageResponse.model'

@UseGuards(IdsUserGuard, ScopesGuard, FeatureFlagGuard)
@FeatureFlag(Features.servicePortalVehicleMileagePageEnabled)
@UseGuards(IdsUserGuard, ScopesGuard)
@Resolver(() => VehicleMileageOverview)
@Audit({ namespace: '@island.is/api/vehicles' })
@Scopes(ApiScope.vehicles)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,8 @@ import { VehiclesService } from '../services/vehicles.service'
import { VehicleMileageDetail } from '../models/getVehicleMileage.model'
import { VehiclesDetail } from '../models/getVehicleDetail.model'
import { LOGGER_PROVIDER } from '@island.is/logging'
import {
FeatureFlagGuard,
FeatureFlag,
Features,
} from '@island.is/nest/feature-flags'

@UseGuards(IdsUserGuard, ScopesGuard, FeatureFlagGuard)
@FeatureFlag(Features.servicePortalVehicleMileagePageEnabled)
@UseGuards(IdsUserGuard, ScopesGuard)
@Resolver(() => VehiclesDetail)
@Audit({ namespace: '@island.is/api/vehicles' })
export class VehiclesSharedResolver {
Expand Down
42 changes: 0 additions & 42 deletions libs/api/domains/vehicles/src/lib/services/vehicles.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
RootPostRequest,
RootPutRequest,
} from '@island.is/clients/vehicles-mileage'
import { FeatureFlagService, Features } from '@island.is/nest/feature-flags'
import { AuthMiddleware } from '@island.is/auth-nest-tools'
import type { Auth, User } from '@island.is/auth-nest-tools'
import { LOGGER_PROVIDER } from '@island.is/logging'
Expand Down Expand Up @@ -70,7 +69,6 @@ export class VehiclesService {
constructor(
private vehiclesApi: VehicleSearchApi,
private mileageReadingApi: MileageReadingApi,
private readonly featureFlagService: FeatureFlagService,
@Inject(PublicVehicleSearchApi)
private publicVehiclesApi: PublicVehicleSearchApi,
@Inject(LOGGER_PROVIDER)
Expand Down Expand Up @@ -355,16 +353,6 @@ export class VehiclesService {
auth: User,
input: GetMileageReadingRequest,
): Promise<VehicleMileageOverview | null> {
const featureFlagOn = await this.featureFlagService.getValue(
Features.servicePortalVehicleMileagePageEnabled,
false,
auth,
)

if (!featureFlagOn) {
return null
}

await this.hasVehicleServiceAuth(auth, input.permno)

const res = await this.getMileageWithAuth(auth).getMileageReading({
Expand Down Expand Up @@ -561,16 +549,6 @@ export class VehiclesService {
auth: User,
input: CanregistermileagePermnoGetRequest,
): Promise<boolean> {
const featureFlagOn = await this.featureFlagService.getValue(
Features.servicePortalVehicleMileagePageEnabled,
false,
auth,
)

if (!featureFlagOn) {
return false
}

const res = await this.getMileageWithAuth(auth).canregistermileagePermnoGet(
{
permno: input.permno,
Expand All @@ -589,16 +567,6 @@ export class VehiclesService {
): Promise<boolean> {
if (!input) return false

const featureFlagOn = await this.featureFlagService.getValue(
Features.servicePortalVehicleMileagePageEnabled,
false,
auth,
)

if (!featureFlagOn) {
return false
}

const res = await this.isAllowedMileageRegistration(auth, input.permno)

return res
Expand All @@ -608,16 +576,6 @@ export class VehiclesService {
auth: User,
input: RequiresmileageregistrationPermnoGetRequest,
): Promise<boolean> {
const featureFlagOn = await this.featureFlagService.getValue(
Features.servicePortalVehicleMileagePageEnabled,
false,
auth,
)

if (!featureFlagOn) {
return false
}

const res = await this.getMileageWithAuth(
auth,
).requiresmileageregistrationPermnoGet({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export class WorkMachinesResolver {
) {}

@Scopes(ApiScope.workMachines)
@FeatureFlag(Features.servicePortalWorkMachinesModule)
@Query(() => PaginatedCollectionResponse, {
name: 'workMachinesPaginatedCollection',
nullable: true,
Expand All @@ -65,13 +64,11 @@ export class WorkMachinesResolver {
}

@Scopes(ApiScope.workMachines)
@FeatureFlag(Features.servicePortalWorkMachinesModule)
@Query(() => Document, {
name: 'workMachinesCollectionDocument',
nullable: true,
})
@Audit()
@FeatureFlag(Features.servicePortalWorkMachinesModule)
async getWorkMachinesCollectionDocument(
@Args('input', {
type: () => GetDocumentsInput,
Expand All @@ -89,7 +86,6 @@ export class WorkMachinesResolver {
}

@Scopes(ApiScope.workMachines)
@FeatureFlag(Features.servicePortalWorkMachinesModule)
@Query(() => WorkMachine, { name: 'workMachine', nullable: true })
@Audit()
async getWorkMachineById(
Expand Down
8 changes: 0 additions & 8 deletions libs/feature-flags/src/lib/features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,11 @@ export enum Features {
applicationSystemDelegations = 'applicationSystemDelegations',

// Service portal modules
servicePortalPetitionsModule = 'isServicePortalPetitionsModuleEnabled',
servicePortalConsentModule = 'isServicePortalConsentModuleEnabled',
servicePortalSecondaryEducationPages = 'isServicePortalSecondaryEducationPageEnabled',
servicePortalWorkMachinesModule = 'isServicePortalWorkMachinesPageEnabled',
servicePortalSignatureCollection = 'isServicePortalSignatureCollectionEnabled',
servicePortalVehicleMileagePageEnabled = 'isServicePortalVehicleMileagePageEnabled',
servicePortalVehicleBulkMileagePageEnabled = 'isServicePortalVehicleBulkMileagePageEnabled',
servicePortalSocialInsurancePageEnabled = 'isServicePortalSocialInsurancePageEnabled',
servicePortalSocialInsuranceIncomePlanPageEnabled = 'isServicePortalSocialInsuranceIncomePlanPageEnabled',
servicePortalHealthVaccinationsPageEnabled = 'isServicePortalHealthVaccinationsPageEnabled',
servicePortalHealthOrganDonationPageEnabled = 'isServicePortalHealthOrganDonationPageEnabled',
ServicePortalNotificationsEnabled = 'isServicePortalNotificationsPageEnabled',
servicePortalLawAndOrderModuleEnabled = 'isServicePortalLawAndOrderModuleEnabled',
servicePortalDocumentsActionsEnabled = 'isServicePortalDocumentsActionsEnabled',
isServicePortalDocumentsV3PageEnabled = 'isServicePortalDocumentsV3PageEnabled',
//Occupational License Health directorate fetch enabled
Expand Down
22 changes: 2 additions & 20 deletions libs/portals/my-pages/assets/src/components/VehicleCard.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { VehicleListed } from '@island.is/api/schema'
import { useLocale } from '@island.is/localization'
import React, { FC, useEffect, useState } from 'react'
import React, { FC } from 'react'
import { formatDate } from '@island.is/portals/my-pages/core'
import differenceInMonths from 'date-fns/differenceInMonths'
import { messages, vehicleMessage } from '../lib/messages'
import { ActionCard } from '@island.is/portals/my-pages/core'
import { AssetsPaths } from '../lib/paths'
import { useFeatureFlagClient } from '@island.is/react/feature-flags'

interface Props {
vehicle: VehicleListed
Expand All @@ -17,23 +16,6 @@ export const VehicleCard: FC<React.PropsWithChildren<Props>> = ({
}) => {
const { formatMessage } = useLocale()

// Remove flag functionality once feature goes live.
const [enabledMileageFlag, setEnabledMileageFlag] = useState<boolean>(false)
const featureFlagClient = useFeatureFlagClient()
useEffect(() => {
const isFlagEnabled = async () => {
const ffEnabled = await featureFlagClient.getValue(
`isServicePortalVehicleMileagePageEnabled`,
false,
)
if (ffEnabled) {
setEnabledMileageFlag(ffEnabled as boolean)
}
}
isFlagEnabled()
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])

if (!vehicle) {
return null
}
Expand Down Expand Up @@ -65,7 +47,7 @@ export const VehicleCard: FC<React.PropsWithChildren<Props>> = ({
: undefined
}
secondaryTag={
vehicle.requiresMileageRegistration && enabledMileageFlag
vehicle.requiresMileageRegistration
? {
label: formatMessage(vehicleMessage.mileageTagText),
variant: 'warn',
Expand Down
12 changes: 0 additions & 12 deletions libs/portals/my-pages/assets/src/module.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,12 @@ export const assetsModule: PortalModule = {
name: m.workMachines,
path: AssetsPaths.AssetsWorkMachines,
enabled: userInfo.scopes.includes(ApiScope.workMachines),
key: 'WorkMachines',
element: <WorkMachinesOverview />,
},
{
name: m.workMachines,
path: AssetsPaths.AssetsWorkMachinesDetail,
enabled: userInfo.scopes.includes(ApiScope.workMachines),
key: 'WorkMachines',
element: <WorkMachinesDetail />,
},
{
Expand Down Expand Up @@ -142,35 +140,30 @@ export const assetsModule: PortalModule = {
name: m.vehicleMileage,
path: AssetsPaths.AssetsVehiclesDetailMileage,
enabled: userInfo.scopes.includes(ApiScope.vehicles),
key: 'VehicleMileage',
element: <VehicleMileage />,
},
{
name: m.vehiclesBulkMileage,
path: AssetsPaths.AssetsVehiclesBulkMileage,
enabled: userInfo.scopes.includes(ApiScope.vehicles),
key: 'VehicleBulkMileage',
element: <VehicleBulkMileage />,
},
{
name: m.vehiclesBulkMileageUpload,
path: AssetsPaths.AssetsVehiclesBulkMileageUpload,
enabled: userInfo.scopes.includes(ApiScope.vehicles),
key: 'VehicleBulkMileage',
element: <VehicleBulkMileageUpload />,
},
{
name: m.vehiclesBulkMileageJobOverview,
path: AssetsPaths.AssetsVehiclesBulkMileageJobOverview,
enabled: userInfo.scopes.includes(ApiScope.vehicles),
key: 'VehicleBulkMileage',
element: <VehicleBulkMileageJobOverview />,
},
{
name: m.vehiclesBulkMileageJobDetail,
path: AssetsPaths.AssetsVehiclesBulkMileageJobDetail,
enabled: userInfo.scopes.includes(ApiScope.vehicles),
key: 'VehicleBulkMileage',
element: <VehicleBulkMileageJobDetail />,
},
{
Expand All @@ -184,33 +177,28 @@ export const assetsModule: PortalModule = {
{
name: m.intellectualProperties,
path: AssetsPaths.AssetsIntellectualProperties,
key: 'IntellectualProperties',
enabled: userInfo.scopes.includes(ApiScope.intellectualProperties),
element: <IPOverview />,
},
{
name: m.intellectualProperties,
path: AssetsPaths.AssetsIntellectualPropertiesDesign,
key: 'IntellectualProperties',
enabled: userInfo.scopes.includes(ApiScope.intellectualProperties),
element: <IPDesignDetail />,
},
{
name: m.intellectualProperties,
path: AssetsPaths.AssetsIntellectualPropertiesTrademark,
key: 'IntellectualProperties',
enabled: userInfo.scopes.includes(ApiScope.intellectualProperties),
element: <IPTrademarkDetail />,
},
{
name: m.intellectualProperties,
path: AssetsPaths.AssetsIntellectualPropertiesPatent,
key: 'IntellectualProperties',
enabled: userInfo.scopes.includes(ApiScope.intellectualProperties),
element: <IPPatentDetail />,
},
]

return routes
},
}
Loading
Loading