Skip to content

Commit

Permalink
refactor(inventory): ent-4572 rename components (#857)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdcabrera committed Jan 21, 2022
1 parent ef317b5 commit acb1a07
Show file tree
Hide file tree
Showing 40 changed files with 85 additions and 85 deletions.
10 changes: 5 additions & 5 deletions src/components/i18n/__tests__/__snapshots__/i18n.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ Array [
],
},
Object {
"file": "./src/components/inventoryList/inventoryCard.js",
"file": "./src/components/inventoryCard/inventoryCard.js",
"keys": Array [
Object {
"key": "curiosity-inventory.tab",
Expand All @@ -171,7 +171,7 @@ Array [
],
},
Object {
"file": "./src/components/inventoryList/inventoryCardHelpers.js",
"file": "./src/components/inventoryCard/inventoryCardHelpers.js",
"keys": Array [
Object {
"key": "curiosity-inventory.header",
Expand All @@ -184,7 +184,7 @@ Array [
],
},
Object {
"file": "./src/components/inventoryList/inventoryList.deprecated.js",
"file": "./src/components/inventoryCard/inventoryList.deprecated.js",
"keys": Array [
Object {
"key": "curiosity-inventory.tab",
Expand Down Expand Up @@ -693,11 +693,11 @@ Array [
"key": "curiosity-graph.label",
},
Object {
"file": "./src/components/inventoryList/inventoryCard.js",
"file": "./src/components/inventoryCard/inventoryCard.js",
"key": "curiosity-inventory.tab",
},
Object {
"file": "./src/components/inventoryList/inventoryList.deprecated.js",
"file": "./src/components/inventoryCard/inventoryList.deprecated.js",
"key": "curiosity-inventory.tab",
},
Object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ exports[`InventoryCard Component should handle expandable guests data: number of
1,
"loremIpsum",
],
"expandedContent": <Memo(Connect(GuestsList))
"expandedContent": <Memo(Connect(InventoryGuests))
id="loremIpsum"
numberOfGuests={1}
/>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { connect, reduxSelectors } from '../../redux';
import Table from '../table/table';
import { Loader } from '../loader/loader';
import { MinHeight } from '../minHeight/minHeight';
import GuestsList from '../guestsList/guestsList';
import InventoryGuests from '../inventoryGuests/inventoryGuests';
import { inventoryCardHelpers } from './inventoryCardHelpers';
import Pagination from '../pagination/pagination';
import { ToolbarFieldDisplayName } from '../toolbar/toolbarFieldDisplayName';
Expand Down Expand Up @@ -112,7 +112,7 @@ const InventoryCard = ({
return {
cells,
expandedContent:
(isSubTable && <GuestsList numberOfGuests={numberOfGuests} id={subscriptionManagerId} />) || undefined
(isSubTable && <InventoryGuests numberOfGuests={numberOfGuests} id={subscriptionManagerId} />) || undefined
};
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { connect, reduxActions, reduxSelectors, reduxTypes, store } from '../../
import Table from '../table/table';
import { Loader } from '../loader/loader';
import { MinHeight } from '../minHeight/minHeight';
import GuestsList from '../guestsList/guestsList.deprecated';
import GuestsList from '../inventoryGuests/guestsList.deprecated';
import { inventoryCardHelpers } from './inventoryCardHelpers';
import Pagination from '../pagination/pagination';
import { ToolbarFieldDisplayName } from '../toolbar/toolbarFieldDisplayName';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`InventorySubscriptions Component should render a basic component: basic render 1`] = `
exports[`InventoryCardSubscriptions Component should render a basic component: basic render 1`] = `
<Connect(InventoryCard)
cardActions={null}
isDisabled={false}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`InventorySubscriptionsContext should handle an onColumnSort event: onColumnSort event, dispatch 1`] = `
exports[`InventoryCardSubscriptionsContext should handle an onColumnSort event: onColumnSort event, dispatch 1`] = `
Array [
Array [
Array [
Expand Down Expand Up @@ -33,7 +33,7 @@ Array [
]
`;

exports[`InventorySubscriptionsContext should handle an onPage event: onPage event, dispatch 1`] = `
exports[`InventoryCardSubscriptionsContext should handle an onPage event: onPage event, dispatch 1`] = `
Array [
Array [
Array [
Expand All @@ -52,7 +52,7 @@ Array [
]
`;

exports[`InventorySubscriptionsContext should handle instances inventory API responses: inventory, cancelled 1`] = `
exports[`InventoryCardSubscriptionsContext should handle instances inventory API responses: inventory, cancelled 1`] = `
Object {
"data": Object {},
"error": undefined,
Expand All @@ -61,7 +61,7 @@ Object {
}
`;

exports[`InventorySubscriptionsContext should handle instances inventory API responses: inventory, disabled 1`] = `
exports[`InventoryCardSubscriptionsContext should handle instances inventory API responses: inventory, disabled 1`] = `
Object {
"data": Object {},
"error": undefined,
Expand All @@ -70,7 +70,7 @@ Object {
}
`;

exports[`InventorySubscriptionsContext should handle instances inventory API responses: inventory, error 1`] = `
exports[`InventoryCardSubscriptionsContext should handle instances inventory API responses: inventory, error 1`] = `
Object {
"data": Object {},
"error": true,
Expand All @@ -79,7 +79,7 @@ Object {
}
`;

exports[`InventorySubscriptionsContext should handle instances inventory API responses: inventory, fulfilled 1`] = `
exports[`InventoryCardSubscriptionsContext should handle instances inventory API responses: inventory, fulfilled 1`] = `
Object {
"data": Object {},
"error": undefined,
Expand All @@ -88,7 +88,7 @@ Object {
}
`;

exports[`InventorySubscriptionsContext should handle instances inventory API responses: inventory, pending 1`] = `
exports[`InventoryCardSubscriptionsContext should handle instances inventory API responses: inventory, pending 1`] = `
Object {
"data": Object {},
"error": undefined,
Expand All @@ -97,7 +97,7 @@ Object {
}
`;

exports[`InventorySubscriptionsContext should return specific properties: specific properties 1`] = `
exports[`InventoryCardSubscriptionsContext should return specific properties: specific properties 1`] = `
Object {
"useGetSubscriptionsInventory": [Function],
"useOnColumnSortSubscriptions": [Function],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import { InventorySubscriptions } from '../inventorySubscriptions';
import { InventoryCardSubscriptions } from '../inventoryCardSubscriptions';
import { RHSM_API_QUERY_TYPES } from '../../../types/rhsmApiTypes';

describe('InventorySubscriptions Component', () => {
describe('InventoryCardSubscriptions Component', () => {
it('should render a basic component', async () => {
const props = {
useProduct: () => ({ productId: 'lorem' }),
Expand All @@ -12,7 +12,7 @@ describe('InventorySubscriptions Component', () => {
})
};

const component = await shallowHookComponent(<InventorySubscriptions {...props} />);
const component = await shallowHookComponent(<InventoryCardSubscriptions {...props} />);
expect(component).toMatchSnapshot('basic render');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import {
useGetSubscriptionsInventory,
useOnPageSubscriptions,
useOnColumnSortSubscriptions
} from '../inventorySubscriptionsContext';
} from '../inventoryCardSubscriptionsContext';
import { RHSM_API_QUERY_INVENTORY_SORT_DIRECTION_TYPES as SORT_DIRECTION_TYPES } from '../../../services/rhsm/rhsmConstants';

describe('InventorySubscriptionsContext', () => {
describe('InventoryCardSubscriptionsContext', () => {
it('should return specific properties', () => {
expect(context).toMatchSnapshot('specific properties');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {
useGetSubscriptionsInventory,
useOnPageSubscriptions,
useOnColumnSortSubscriptions
} from './inventorySubscriptionsContext';
import InventoryCard from '../inventoryList/inventoryCard';
} from './inventoryCardSubscriptionsContext';
import InventoryCard from '../inventoryCard/inventoryCard';
import { helpers } from '../../common';

/**
Expand All @@ -27,7 +27,7 @@ import { helpers } from '../../common';
* @fires onUpdateInventoryData
* @returns {Node}
*/
const InventorySubscriptions = ({
const InventoryCardSubscriptions = ({
isDisabled,
useGetInventory: useAliasGetInventory,
useOnPage: useAliasOnPage,
Expand All @@ -52,7 +52,7 @@ const InventorySubscriptions = ({
* @type {{useOnPage: Function, isDisabled: boolean, useProductInventoryConfig: Function, useGetInventory: Function,
* useOnColumnSort: Function, useProductInventoryQuery: Function}}
*/
InventorySubscriptions.propTypes = {
InventoryCardSubscriptions.propTypes = {
isDisabled: PropTypes.bool,
useGetInventory: PropTypes.func,
useOnPage: PropTypes.func,
Expand All @@ -67,7 +67,7 @@ InventorySubscriptions.propTypes = {
* @type {{useOnPage: Function, isDisabled: boolean, useProductInventoryConfig: Function, useGetInventory: Function,
* useOnColumnSort: Function, useProductInventoryQuery: Function}}
*/
InventorySubscriptions.defaultProps = {
InventoryCardSubscriptions.defaultProps = {
isDisabled: helpers.UI_DISABLED_TABLE_SUBSCRIPTIONS,
useGetInventory: useGetSubscriptionsInventory,
useOnPage: useOnPageSubscriptions,
Expand All @@ -76,4 +76,4 @@ InventorySubscriptions.defaultProps = {
useProductInventoryQuery: useProductInventorySubscriptionsQuery
};

export { InventorySubscriptions as default, InventorySubscriptions };
export { InventoryCardSubscriptions as default, InventoryCardSubscriptions };
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { GuestsList } from '../guestsList';
import { InventoryGuests } from '../inventoryGuests';

describe('GuestsList Component', () => {
it('should render a basic component', async () => {
Expand All @@ -8,7 +8,7 @@ describe('GuestsList Component', () => {
numberOfGuests: 0
};

const component = await shallowHookComponent(<GuestsList {...props} />);
const component = await shallowHookComponent(<InventoryGuests {...props} />);
expect(component).toMatchSnapshot('basic render');
});

Expand All @@ -26,7 +26,7 @@ describe('GuestsList Component', () => {
})
};

const component = await shallowHookComponent(<GuestsList {...props} />);
const component = await shallowHookComponent(<InventoryGuests {...props} />);
expect(component).toMatchSnapshot('variable data');

component.setProps({
Expand All @@ -47,7 +47,7 @@ describe('GuestsList Component', () => {
})
};

const component = await shallowHookComponent(<GuestsList {...props} />);
const component = await shallowHookComponent(<InventoryGuests {...props} />);
expect(component).toMatchSnapshot('initial pending');

component.setProps({
Expand Down Expand Up @@ -76,7 +76,7 @@ describe('GuestsList Component', () => {
})
};

const component = await shallowHookComponent(<GuestsList {...props} />);
const component = await shallowHookComponent(<InventoryGuests {...props} />);
component
.find('.curiosity-table-scroll-list')
.simulate('scroll', { target: { scrollHeight: 200, scrollTop: 100, clientHeight: 100 } });
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { context, useGetGuestsInventory, useOnScroll } from '../guestsListContext';
import { context, useGetGuestsInventory, useOnScroll } from '../inventoryGuestsContext';
import { RHSM_API_QUERY_SET_TYPES } from '../../../services/rhsm/rhsmConstants';

describe('InventorySubscriptionsContext', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { TableVariant } from '@patternfly/react-table';
import { helpers } from '../../common';
import { apiQueries, connect, reduxActions, reduxSelectors } from '../../redux';
import { Loader } from '../loader/loader';
import { inventoryCardHelpers } from '../inventoryList/inventoryCardHelpers';
import { inventoryCardHelpers } from '../inventoryCard/inventoryCardHelpers';
import { RHSM_API_QUERY_TYPES } from '../../types/rhsmApiTypes';
import { Table } from '../table/table';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { TableVariant } from '@patternfly/react-table';
import { useProductInventoryGuestsConfig, useProductInventoryGuestsQuery } from '../productView/productViewContext';
import { connect, reduxSelectors } from '../../redux';
import { Loader } from '../loader/loader';
import { inventoryCardHelpers } from '../inventoryList/inventoryCardHelpers';
import { inventoryCardHelpers } from '../inventoryCard/inventoryCardHelpers';
import { RHSM_API_QUERY_SET_TYPES } from '../../services/rhsm/rhsmConstants';
import { Table } from '../table/table';
import { useGetGuestsInventory, useOnScroll } from './guestsListContext';
import { useGetGuestsInventory, useOnScroll } from './inventoryGuestsContext';

/**
* A system inventory guests component.
Expand All @@ -24,7 +24,7 @@ import { useGetGuestsInventory, useOnScroll } from './guestsListContext';
* @fires onScroll
* @returns {Node}
*/
const GuestsList = ({
const InventoryGuests = ({
defaultPerPage,
id,
numberOfGuests,
Expand Down Expand Up @@ -149,7 +149,7 @@ const GuestsList = ({
* @type {{useProductInventoryGuestsConfig: Function, session: object, useOnScroll: Function, numberOfGuests: number,
* id: string, useGetGuestsInventory: Function, useProductInventoryGuestsQuery: Function, defaultPerPage: number}}
*/
GuestsList.propTypes = {
InventoryGuests.propTypes = {
defaultPerPage: PropTypes.number,
id: PropTypes.string.isRequired,
numberOfGuests: PropTypes.number.isRequired,
Expand All @@ -166,7 +166,7 @@ GuestsList.propTypes = {
* @type {{useProductInventoryGuestsConfig: Function, session: object, useOnScroll: Function,
* useGetGuestsInventory: Function, useProductInventoryGuestsQuery: Function, defaultPerPage: number}}
*/
GuestsList.defaultProps = {
InventoryGuests.defaultProps = {
defaultPerPage: 5,
session: {},
useGetGuestsInventory,
Expand All @@ -182,6 +182,6 @@ GuestsList.defaultProps = {
*/
const makeMapStateToProps = reduxSelectors.user.makeUserSession();

const ConnectedGuestsList = connect(makeMapStateToProps)(GuestsList);
const ConnectedInventoryGuests = connect(makeMapStateToProps)(InventoryGuests);

export { ConnectedGuestsList as default, ConnectedGuestsList, GuestsList };
export { ConnectedInventoryGuests as default, ConnectedInventoryGuests, InventoryGuests };
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ exports[`ProductView Component should allow custom inventory displays via config
key="inventory_subs_lorem"
title="t(curiosity-inventory.tabSubscriptions, {\\"context\\":\\"lorem\\"})"
>
<InventorySubscriptions
<InventoryCardSubscriptions
isDisabled={false}
useGetInventory={[Function]}
useOnColumnSort={[Function]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ exports[`ProductViewOpenShiftContainer Component should render a basic component
key="inventory_subs_OpenShift Container Platform"
title="t(curiosity-inventory.tabSubscriptions, {\\"context\\":\\"OpenShift Container Platform\\"})"
>
<InventorySubscriptions
<InventoryCardSubscriptions
isDisabled={false}
useGetInventory={[Function]}
useOnColumnSort={[Function]}
Expand Down
8 changes: 4 additions & 4 deletions src/components/productView/productView.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import { apiQueries } from '../../redux';
import { ConnectedGraphCard as ConnectedGraphCardDeprecated } from '../graphCard/graphCard.deprecated';
import { GraphCard } from '../graphCard/graphCard';
import { Toolbar } from '../toolbar/toolbar';
import { ConnectedInventoryList as ConnectedInventoryListDeprecated } from '../inventoryList/inventoryList.deprecated';
import { ConnectedInventoryCard } from '../inventoryList/inventoryCard';
import { ConnectedInventoryList as ConnectedInventoryListDeprecated } from '../inventoryCard/inventoryList.deprecated';
import { ConnectedInventoryCard } from '../inventoryCard/inventoryCard';
import { helpers } from '../../common';
import BannerMessages from '../bannerMessages/bannerMessages';
import { SelectPosition } from '../form/select';
import { ToolbarFieldGranularity } from '../toolbar/toolbarFieldGranularity';
import InventoryTabs, { InventoryTab } from '../inventoryTabs/inventoryTabs';
import { InventorySubscriptions } from '../inventorySubscriptions/inventorySubscriptions';
import { InventoryCardSubscriptions } from '../inventoryCardSubscriptions/inventoryCardSubscriptions';
import { RHSM_API_PATH_PRODUCT_TYPES } from '../../services/rhsm/rhsmConstants';
import { translate } from '../i18n/i18n';

Expand Down Expand Up @@ -154,7 +154,7 @@ const ProductView = ({ t, toolbarGraph, toolbarGraphDescription, useRouteDetail:
key={`inventory_subs_${productId}`}
title={t('curiosity-inventory.tabSubscriptions', { context: productId })}
>
<InventorySubscriptions />
<InventoryCardSubscriptions />
</InventoryTab>
)}
</InventoryTabs>
Expand Down
Loading

0 comments on commit acb1a07

Please sign in to comment.