Skip to content

Commit

Permalink
feat(marketplace): Adjusted role requirement for app subscription (#1013
Browse files Browse the repository at this point in the history
)
  • Loading branch information
typecastcloud authored Aug 30, 2024
1 parent fcb887d commit 9e14991
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
- **Company data Management**
- integrated /ready api to trigger once the new record is created [#958](https://github.com/eclipse-tractusx/portal-frontend/pull/958)
- enabled displaying of sharing state error details in the company overlay details page [#958](https://github.com/eclipse-tractusx/portal-frontend/pull/958)
- **App Subscription**
- remove subscribe_service requirement for app subscription [#1013](https://github.com/eclipse-tractusx/portal-frontend/pull/1013)

### Feature

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { useTranslation } from 'react-i18next'
import type { AppDetails } from 'features/apps/details/types'
import { userSelector } from 'features/user/slice'
import './AppDetailHeader.scss'
import { OVERLAYS } from 'types/Constants'
import { OVERLAYS, ROLES } from 'types/Constants'
import { show } from 'features/control/overlay'
import { useParams } from 'react-router-dom'
import { useEffect, useState } from 'react'
Expand All @@ -38,11 +38,6 @@ import CommonService from 'services/CommonService'
import type { UseCaseType } from 'features/appManagement/types'
import type { RootState } from 'features/store'

enum Roles {
SUBSCRIBE_APPS = 'subscribe_apps',
SUBSCRIBE_SERVICE = 'subscribe_service',
}

export interface AppDetailHeaderProps {
item: AppDetails
}
Expand Down Expand Up @@ -111,8 +106,7 @@ export default function AppDetailHeader({ item }: AppDetailHeaderProps) {
default:
btnColor = {
color:
user.roles.indexOf(Roles.SUBSCRIBE_APPS) !== -1 &&
user.roles.indexOf(Roles.SUBSCRIBE_SERVICE) !== -1
user.roles.indexOf(ROLES.SUBSCRIBE_APP_MARKETPLACE) !== -1
? 'primary'
: 'secondary',
background1: paletteDefinitions.buttons.darkGrey ?? '',
Expand Down Expand Up @@ -154,15 +148,13 @@ export default function AppDetailHeader({ item }: AppDetailHeaderProps) {
buttonData={OrderStatusButtonItems}
selectable={
subscribeStatus === SubscriptionStatus.INACTIVE &&
user.roles.indexOf(Roles.SUBSCRIBE_APPS) !== -1 &&
user.roles.indexOf(Roles.SUBSCRIBE_SERVICE) !== -1
user.roles.indexOf(ROLES.SUBSCRIBE_APP_MARKETPLACE) !== -1
? true
: false
}
onButtonClick={() =>
subscribeStatus === SubscriptionStatus.INACTIVE &&
user.roles.indexOf(Roles.SUBSCRIBE_APPS) !== -1 &&
user.roles.indexOf(Roles.SUBSCRIBE_SERVICE) !== -1 &&
user.roles.indexOf(ROLES.SUBSCRIBE_APP_MARKETPLACE) !== -1 &&
dispatch(show(OVERLAYS.APPMARKETPLACE_REQUEST, appId))
}
/>
Expand Down
1 change: 1 addition & 0 deletions src/types/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ export enum ROLES {
SETUP_CLIENT = 'setup_client',
APPSTORE_VIEW = 'view_apps',
APPSTORE_VIEW_SERVICES = 'view_service_marketplace',
SUBSCRIBE_APP_MARKETPLACE = 'subscribe_apps',
SUBSCRIBE_SERVICE_MARKETPLACE = 'subscribe_service',
APPSTORE_VIEW_DATASPACES = 'view_dataspaces',
APPSTORE_ADD = 'add_app',
Expand Down

0 comments on commit 9e14991

Please sign in to comment.