Skip to content

Commit

Permalink
fix(RHCLOUD-24793): Show ROS tab is azure or aws cloud provider (#1800)…
Browse files Browse the repository at this point in the history
… (#1812)

* fix(RHCLOUD-24793): Show ROS tab is azure or aws cloud provider

* Enable ros only for AWS
  • Loading branch information
karelhala authored Mar 29, 2023
1 parent 2cb29a4 commit b1cd309
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
9 changes: 7 additions & 2 deletions src/routes/InventoryDetail.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState, useCallback } from 'react';
import React, { useEffect, useState, useCallback, useMemo } from 'react';
import PropTypes from 'prop-types';
import { useSelector, useStore, useDispatch } from 'react-redux';
import { useLocation, useParams, Link, useHistory } from 'react-router-dom';
Expand Down Expand Up @@ -75,6 +75,11 @@ const Inventory = () => {
const writePermissions = useWritePermissions();
const entityLoaded = useSelector(({ entityDetails }) => entityDetails?.loaded);
const entity = useSelector(({ entityDetails }) => entityDetails?.entity);
const cloudProvider = useSelector(({ systemProfileStore }) => systemProfileStore?.systemProfile?.cloud_provider);
const availableApps = useMemo(() => appList.map((app) => app.name === 'ros' ? {
...app,
isVisible: cloudProvider === 'aws'
} : app), [cloudProvider]);
const clearNotifications = () => dispatch(actions.clearNotifications());

useEffect(() => {
Expand Down Expand Up @@ -122,7 +127,7 @@ const Inventory = () => {
<BreadcrumbWrapper entity={entity} entityLoaded={entityLoaded} inventoryId={inventoryId}/>
}
activeApp={activeApp}
appList={appList}
appList={availableApps}
onTabSelect={onTabSelect}
/>
);
Expand Down
14 changes: 1 addition & 13 deletions src/store/reducers.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,6 @@ function entitySelected(state, { payload }) {
};
}

function resourceOptTabVisibility(state, { payload }) {
return {
...state,
activeApps: state.activeApps?.map((entity) => entity.name === 'ros' ? ({
...entity,
isVisible: payload
}) : entity
)
};
}

function entityDeleted(state, { meta }) {
const selected = state.selected || (new Map());
meta.systems.forEach(id => selected.delete(id));
Expand Down Expand Up @@ -135,8 +124,7 @@ export const tableReducer = applyReducerHash(

export const entitesDetailReducer = () => applyReducerHash(
{
[INVENTORY_ACTION_TYPES.LOAD_ENTITY_FULFILLED]: entityLoaded,
[INVENTORY_ACTION_TYPES.LOAD_SYSTEM_PROFILE_FULFILLED]: resourceOptTabVisibility
[INVENTORY_ACTION_TYPES.LOAD_ENTITY_FULFILLED]: entityLoaded
},
defaultState
);
Expand Down

0 comments on commit b1cd309

Please sign in to comment.