From 9e14991dc3aa321645066d6bfdcfb557911c1de3 Mon Sep 17 00:00:00 2001 From: Karsten Thiems <150006841+typecastcloud@users.noreply.github.com> Date: Fri, 30 Aug 2024 13:53:38 +0200 Subject: [PATCH] feat(marketplace): Adjusted role requirement for app subscription (#1013) --- CHANGELOG.md | 2 ++ .../components/AppDetailHeader/index.tsx | 16 ++++------------ src/types/Constants.ts | 1 + 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e30b1e51..5c69a785f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/components/pages/AppDetail/components/AppDetailHeader/index.tsx b/src/components/pages/AppDetail/components/AppDetailHeader/index.tsx index 204474552..f2f41a6c1 100644 --- a/src/components/pages/AppDetail/components/AppDetailHeader/index.tsx +++ b/src/components/pages/AppDetail/components/AppDetailHeader/index.tsx @@ -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' @@ -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 } @@ -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 ?? '', @@ -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)) } /> diff --git a/src/types/Constants.ts b/src/types/Constants.ts index 6b54a64aa..fd0abb2cf 100644 --- a/src/types/Constants.ts +++ b/src/types/Constants.ts @@ -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',