diff --git a/.env b/.env index 914259bf9..409d8d38c 100644 --- a/.env +++ b/.env @@ -17,7 +17,6 @@ REACT_APP_UI_DISABLED_TOOLBAR=false REACT_APP_UI_DISABLED_TOOLBAR_GROUP_VARIANT=false REACT_APP_UI_DISABLED_GRAPH=false REACT_APP_UI_DISABLED_TABLE=false -REACT_APP_UI_DISABLED_TABLE_HOSTS=false REACT_APP_UI_DISABLED_TABLE_INSTANCES=false REACT_APP_UI_DISABLED_TABLE_SUBSCRIPTIONS=false REACT_APP_UI_LOGGER_ID=curiosity @@ -40,8 +39,6 @@ REACT_APP_SERVICES_RHSM_REPORT=/api/rhsm-subscriptions/v1/tally/products/ REACT_APP_SERVICES_RHSM_TALLY=/api/rhsm-subscriptions/v1/tally/products/{0}/{1} REACT_APP_SERVICES_RHSM_CAPACITY=/api/rhsm-subscriptions/v1/capacity/products/{0}/{1} REACT_APP_SERVICES_RHSM_CAPACITY_DEPRECATED=/api/rhsm-subscriptions/v1/capacity/products/ -REACT_APP_SERVICES_RHSM_INVENTORY=/api/rhsm-subscriptions/v1/hosts/products/ -REACT_APP_SERVICES_RHSM_INVENTORY_GUESTS=/api/rhsm-subscriptions/v1/hosts/{0}/guests REACT_APP_SERVICES_RHSM_INVENTORY_INSTANCES=/api/rhsm-subscriptions/v1/instances/products/ REACT_APP_SERVICES_RHSM_INVENTORY_INSTANCES_GUESTS=/api/rhsm-subscriptions/v1/instances/{0}/guests REACT_APP_SERVICES_RHSM_INVENTORY_SUBSCRIPTIONS=/api/rhsm-subscriptions/v1/subscriptions/products/ diff --git a/.env.development b/.env.development index c995546e5..34b555b24 100644 --- a/.env.development +++ b/.env.development @@ -10,8 +10,6 @@ REACT_APP_SERVICES_RHSM_REPORT=http://localhost:5000/api/rhsm-subscriptions/v1/t REACT_APP_SERVICES_RHSM_TALLY=http://localhost:5000/api/rhsm-subscriptions/v1/tally/products/{0}/{1} REACT_APP_SERVICES_RHSM_CAPACITY=http://localhost:5000/api/rhsm-subscriptions/v1/capacity/products/{0}/{1} REACT_APP_SERVICES_RHSM_CAPACITY_DEPRECATED=http://localhost:5000/api/rhsm-subscriptions/v1/capacity/products/ -REACT_APP_SERVICES_RHSM_INVENTORY=http://localhost:5000/api/rhsm-subscriptions/v1/hosts/products/ -REACT_APP_SERVICES_RHSM_INVENTORY_GUESTS=http://localhost:5000/api/rhsm-subscriptions/v1/hosts/{0}/guests REACT_APP_SERVICES_RHSM_INVENTORY_INSTANCES=http://localhost:5000/api/rhsm-subscriptions/v1/instances/products/ REACT_APP_SERVICES_RHSM_INVENTORY_INSTANCES_GUESTS=http://localhost:5000/api/rhsm-subscriptions/v1/instances/{0}/guests REACT_APP_SERVICES_RHSM_INVENTORY_SUBSCRIPTIONS=http://localhost:5000/api/rhsm-subscriptions/v1/subscriptions/products/ diff --git a/public/locales/en-US.json b/public/locales/en-US.json index f7d1c695a..ce2c8057b 100644 --- a/public/locales/en-US.json +++ b/public/locales/en-US.json @@ -157,10 +157,6 @@ "cardHeading": "Current systems", "tabHeading": "Inventory tabs", "tabSubHeading": "Tab {{count}}", - "tabHosts": "Current systems", - "tabHosts_OpenShift-dedicated-metrics": "Current instances", - "tabHosts_OpenShift-dedicated-metrics_one": "{{count}} instance", - "tabHosts_OpenShift-dedicated-metrics_other": "{{count}} instances", "tabInstances": "Current monthly instances", "tabInstances_RHEL": "Current instances", "tabInstances_RHEL for ARM": "$t(curiosity-inventory.tabInstances_RHEL)", diff --git a/src/common/README.md b/src/common/README.md index caa8f7e21..cf789c840 100644 --- a/src/common/README.md +++ b/src/common/README.md @@ -182,7 +182,6 @@ Download the debug log file. * [~UI_DISABLED_GRAPH](#Helpers.module_General..UI_DISABLED_GRAPH) : boolean * [~UI_DISABLED_NOTIFICATIONS](#Helpers.module_General..UI_DISABLED_NOTIFICATIONS) : boolean * [~UI_DISABLED_TABLE](#Helpers.module_General..UI_DISABLED_TABLE) : boolean - * [~UI_DISABLED_TABLE_HOSTS](#Helpers.module_General..UI_DISABLED_TABLE_HOSTS) : boolean * [~UI_DISABLED_TABLE_INSTANCES](#Helpers.module_General..UI_DISABLED_TABLE_INSTANCES) : boolean * [~UI_DISABLED_TABLE_SUBSCRIPTIONS](#Helpers.module_General..UI_DISABLED_TABLE_SUBSCRIPTIONS) : boolean * [~UI_DISABLED_TOOLBAR](#Helpers.module_General..UI_DISABLED_TOOLBAR) : boolean @@ -317,13 +316,6 @@ See dotenv config files for activation. Disable the inventory/table aspect of the UI. See dotenv config files for activation. -**Kind**: inner constant of [General](#Helpers.module_General) - - -### General~UI\_DISABLED\_TABLE\_HOSTS : boolean -Disable the current hosts inventory/table aspect of the UI. -See dotenv config files for activation. - **Kind**: inner constant of [General](#Helpers.module_General) diff --git a/src/common/__tests__/__snapshots__/helpers.test.js.snap b/src/common/__tests__/__snapshots__/helpers.test.js.snap index 996412dcf..88d81e054 100644 --- a/src/common/__tests__/__snapshots__/helpers.test.js.snap +++ b/src/common/__tests__/__snapshots__/helpers.test.js.snap @@ -18,7 +18,6 @@ exports[`Helpers should expose a window object: limited window object 1`] = ` "UI_DISABLED_GRAPH": false, "UI_DISABLED_NOTIFICATIONS": false, "UI_DISABLED_TABLE": false, - "UI_DISABLED_TABLE_HOSTS": false, "UI_DISABLED_TABLE_INSTANCES": false, "UI_DISABLED_TABLE_SUBSCRIPTIONS": false, "UI_DISABLED_TOOLBAR": false, @@ -65,7 +64,6 @@ exports[`Helpers should expose a window object: window object 1`] = ` "UI_DISABLED_GRAPH": false, "UI_DISABLED_NOTIFICATIONS": false, "UI_DISABLED_TABLE": false, - "UI_DISABLED_TABLE_HOSTS": false, "UI_DISABLED_TABLE_INSTANCES": false, "UI_DISABLED_TABLE_SUBSCRIPTIONS": false, "UI_DISABLED_TOOLBAR": false, @@ -124,7 +122,6 @@ exports[`Helpers should have specific functions: helpers 1`] = ` "UI_DISABLED_GRAPH": false, "UI_DISABLED_NOTIFICATIONS": false, "UI_DISABLED_TABLE": false, - "UI_DISABLED_TABLE_HOSTS": false, "UI_DISABLED_TABLE_INSTANCES": false, "UI_DISABLED_TABLE_SUBSCRIPTIONS": false, "UI_DISABLED_TOOLBAR": false, diff --git a/src/common/helpers.js b/src/common/helpers.js index 2bd877c78..7ef436a24 100644 --- a/src/common/helpers.js +++ b/src/common/helpers.js @@ -272,14 +272,6 @@ const UI_DISABLED_NOTIFICATIONS = process.env.REACT_APP_UI_DISABLED_NOTIFICATION */ const UI_DISABLED_TABLE = process.env.REACT_APP_UI_DISABLED_TABLE === 'true'; -/** - * Disable the current hosts inventory/table aspect of the UI. - * See dotenv config files for activation. - * - * @type {boolean} - */ -const UI_DISABLED_TABLE_HOSTS = process.env.REACT_APP_UI_DISABLED_TABLE_HOSTS === 'true'; - /** * Disable the current instances inventory/table aspect of the UI. * See dotenv config files for activation. @@ -456,7 +448,6 @@ const helpers = { UI_DISABLED_GRAPH, UI_DISABLED_NOTIFICATIONS, UI_DISABLED_TABLE, - UI_DISABLED_TABLE_HOSTS, UI_DISABLED_TABLE_INSTANCES, UI_DISABLED_TABLE_SUBSCRIPTIONS, UI_DISABLED_TOOLBAR, diff --git a/src/components/README.md b/src/components/README.md index 0969851a8..f291d5a1f 100644 --- a/src/components/README.md +++ b/src/components/README.md @@ -63,14 +63,12 @@
i18nHelpers
InventoryCard
-

Instances, Hosts, and Subscriptions base inventory card.

+

Instances, and Subscriptions base inventory card.

InventoryCardContext
InventoryCardHelpers
-
InventoryCardHosts
-
InventoryCardSubscriptions
InventoryCardSubscriptionsContext
@@ -2833,7 +2831,7 @@ Apply string replacements against a component, HOC. ## InventoryCard -Instances, Hosts, and Subscriptions base inventory card. +Instances, and Subscriptions base inventory card. **Properties** @@ -2848,8 +2846,6 @@ Instances, Hosts, and Subscriptions base inventory card. InventoryCardContextmodule InventoryCardHelpersmodule - - InventoryCardHostsmodule @@ -2922,44 +2918,11 @@ Default props. ## InventoryCardContext * [InventoryCardContext](#InventoryCard.module_InventoryCardContext) - * [~useGetHostsInventory(options)](#InventoryCard.module_InventoryCardContext..useGetHostsInventory) ⇒ Object * [~useGetInstancesInventory(options)](#InventoryCard.module_InventoryCardContext..useGetInstancesInventory) ⇒ Object * [~useOnPageInstances(options)](#InventoryCard.module_InventoryCardContext..useOnPageInstances) ⇒ function - * [~useOnColumnSortHosts(options)](#InventoryCard.module_InventoryCardContext..useOnColumnSortHosts) ⇒ function * [~useOnColumnSortInstances(options)](#InventoryCard.module_InventoryCardContext..useOnColumnSortInstances) ⇒ function * ["onPage" (params)](#event_onPage) ⇒ void * ["onColumnSort" (_data, params)](#event_onColumnSort) ⇒ void - * ["onColumnSort" (_data, params)](#event_onColumnSort) ⇒ void - - - -### InventoryCardContext~useGetHostsInventory(options) ⇒ Object -Combined Redux RHSM Actions, getHostsInventory, and inventory selector response. - -**Kind**: inner method of [InventoryCardContext](#InventoryCard.module_InventoryCardContext) - - - - - - - - - - - - - - - - - - - - - - -
ParamType
optionsobject
options.isDisabledboolean
options.getInventoryfunction
options.useDispatchfunction
options.useProductfunction
options.useProductInventoryQueryfunction
options.useSelectorsResponsefunction
@@ -3013,30 +2976,6 @@ An onPage callback for instances inventory. - - -### InventoryCardContext~useOnColumnSortHosts(options) ⇒ function -An onColumnSort callback for hosts inventory. - -**Kind**: inner method of [InventoryCardContext](#InventoryCard.module_InventoryCardContext) - - - - - - - - - - - - - - - - -
ParamType
optionsobject
options.sortColumnsobject
options.useDispatchfunction
options.useProductfunction
- ### InventoryCardContext~useOnColumnSortInstances(options) ⇒ function @@ -3085,30 +3024,6 @@ On event update state for instances inventory. -### "onColumnSort" (_data, params) ⇒ void -On event update state for hosts inventory. - -**Kind**: event emitted by [InventoryCardContext](#InventoryCard.module_InventoryCardContext) - - - - - - - - - - - - - - - - -
ParamType
_data*
paramsobject
params.directionstring
params.idstring
- - - ### "onColumnSort" (_data, params) ⇒ void On event update state for instances inventory. @@ -3289,58 +3204,6 @@ Parse and return formatted/filtered table cells, and apply table filters. - - -## InventoryCardHosts - -* [InventoryCardHosts](#InventoryCard.module_InventoryCardHosts) - * [~InventoryCardHosts(props)](#InventoryCard.module_InventoryCardHosts..InventoryCardHosts) ⇒ React.ReactNode - * [.propTypes](#InventoryCard.module_InventoryCardHosts..InventoryCardHosts.propTypes) : Object - * [.defaultProps](#InventoryCard.module_InventoryCardHosts..InventoryCardHosts.defaultProps) : Object - - - -### InventoryCardHosts~InventoryCardHosts(props) ⇒ React.ReactNode -***Deprecated*** - -A hosts' system inventory component. - -**Kind**: inner method of [InventoryCardHosts](#InventoryCard.module_InventoryCardHosts) - - - - - - - - - - - - - - - - -
ParamType
propsobject
props.isDisabledboolean
props.useGetInventoryfunction
props.useOnColumnSortfunction
- - -* [~InventoryCardHosts(props)](#InventoryCard.module_InventoryCardHosts..InventoryCardHosts) ⇒ React.ReactNode - * [.propTypes](#InventoryCard.module_InventoryCardHosts..InventoryCardHosts.propTypes) : Object - * [.defaultProps](#InventoryCard.module_InventoryCardHosts..InventoryCardHosts.defaultProps) : Object - - - -#### InventoryCardHosts.propTypes : Object -Prop types. - -**Kind**: static property of [InventoryCardHosts](#InventoryCard.module_InventoryCardHosts..InventoryCardHosts) - - -#### InventoryCardHosts.defaultProps : Object -Default props. - -**Kind**: static property of [InventoryCardHosts](#InventoryCard.module_InventoryCardHosts..InventoryCardHosts) ## InventoryCardSubscriptions @@ -4992,7 +4855,7 @@ Return guests inventory configuration. ### ProductViewContext~useProductInventoryHostsConfig(options) ⇒ Object -Return hosts inventory configuration. +Return inventory configuration. **Kind**: inner method of [ProductViewContext](#ProductView.module_ProductViewContext) diff --git a/src/components/inventoryCard/__tests__/__snapshots__/inventoryCardContext.test.js.snap b/src/components/inventoryCard/__tests__/__snapshots__/inventoryCardContext.test.js.snap index 8f6c5d414..56a7179b8 100644 --- a/src/components/inventoryCard/__tests__/__snapshots__/inventoryCardContext.test.js.snap +++ b/src/components/inventoryCard/__tests__/__snapshots__/inventoryCardContext.test.js.snap @@ -17,49 +17,6 @@ exports[`InventoryCardContext should expect specific sort properties: sort prope } `; -exports[`InventoryCardContext should handle a store response with useGetHostsInventory: store response 1`] = ` -{ - "data": [ - { - "data": [ - { - "lorem": "ipsum", - }, - { - "dolor": "sit", - }, - ], - "meta": {}, - }, - ], - "error": false, - "fulfilled": true, - "message": null, - "pending": false, - "responses": { - "id": {}, - "list": [ - { - "data": [ - { - "data": [ - { - "lorem": "ipsum", - }, - { - "dolor": "sit", - }, - ], - "meta": {}, - }, - ], - "fulfilled": true, - }, - ], - }, -} -`; - exports[`InventoryCardContext should handle a store response with useGetInstancesInventory: store response 1`] = ` { "data": [ @@ -103,39 +60,6 @@ exports[`InventoryCardContext should handle a store response with useGetInstance } `; -exports[`InventoryCardContext should handle an onColumnSort event for hosts: onColumnSort event, dispatch hosts 1`] = ` -[ - [ - [ - { - "dir": "desc", - "type": "SET_QUERY_RHSM_HOSTS_INVENTORY_dir", - "viewId": "lorem", - }, - { - "sort": "loremIpsumColumnOne", - "type": "SET_QUERY_RHSM_HOSTS_INVENTORY_sort", - "viewId": "lorem", - }, - ], - ], - [ - [ - { - "dir": "asc", - "type": "SET_QUERY_RHSM_HOSTS_INVENTORY_dir", - "viewId": "lorem", - }, - { - "sort": "loremIpsumColumnOne", - "type": "SET_QUERY_RHSM_HOSTS_INVENTORY_sort", - "viewId": "lorem", - }, - ], - ], -] -`; - exports[`InventoryCardContext should handle an onColumnSort event: onColumnSort event, dispatch 1`] = ` [ [ @@ -188,44 +112,6 @@ exports[`InventoryCardContext should handle an onPage event: onPage event, dispa ] `; -exports[`InventoryCardContext should handle variations in hosts inventory API responses: inventory, cancelled 1`] = ` -{ - "data": {}, - "pending": true, -} -`; - -exports[`InventoryCardContext should handle variations in hosts inventory API responses: inventory, disabled 1`] = ` -{ - "data": {}, - "fulfilled": true, - "pending": false, -} -`; - -exports[`InventoryCardContext should handle variations in hosts inventory API responses: inventory, error 1`] = ` -{ - "data": {}, - "error": true, - "pending": false, -} -`; - -exports[`InventoryCardContext should handle variations in hosts inventory API responses: inventory, fulfilled 1`] = ` -{ - "data": {}, - "fulfilled": true, - "pending": false, -} -`; - -exports[`InventoryCardContext should handle variations in hosts inventory API responses: inventory, pending 1`] = ` -{ - "data": {}, - "pending": true, -} -`; - exports[`InventoryCardContext should handle variations in instances inventory API responses: inventory, cancelled 1`] = ` { "data": {}, @@ -266,9 +152,7 @@ exports[`InventoryCardContext should handle variations in instances inventory AP exports[`InventoryCardContext should return specific properties: specific properties 1`] = ` { - "useGetHostsInventory": [Function], "useGetInstancesInventory": [Function], - "useOnColumnSortHosts": [Function], "useOnColumnSortInstances": [Function], "useOnPageInstances": [Function], } diff --git a/src/components/inventoryCard/__tests__/__snapshots__/inventoryCardHosts.test.js.snap b/src/components/inventoryCard/__tests__/__snapshots__/inventoryCardHosts.test.js.snap deleted file mode 100644 index 43533bb13..000000000 --- a/src/components/inventoryCard/__tests__/__snapshots__/inventoryCardHosts.test.js.snap +++ /dev/null @@ -1,26 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`InventoryCardHosts Component should render a basic component: basic render 1`] = ` - - - - } - isDisabled={false} - perPageDefault={10} - t={[Function]} - useGetInventory={[Function]} - useOnColumnSort={[Function]} - useOnPage={[Function]} - useProduct={[Function]} - useProductInventoryConfig={[Function]} - useProductInventoryQuery={[Function]} - useSession={[Function]} -/> -`; diff --git a/src/components/inventoryCard/__tests__/inventoryCardContext.test.js b/src/components/inventoryCard/__tests__/inventoryCardContext.test.js index cb947deca..5bfc09068 100644 --- a/src/components/inventoryCard/__tests__/inventoryCardContext.test.js +++ b/src/components/inventoryCard/__tests__/inventoryCardContext.test.js @@ -1,9 +1,7 @@ import { context, - useGetHostsInventory, useGetInstancesInventory, useOnPageInstances, - useOnColumnSortHosts, useOnColumnSortInstances } from '../inventoryCardContext'; import { @@ -103,93 +101,6 @@ describe('InventoryCardContext', () => { expect(disabledResponse).toMatchSnapshot('inventory, disabled'); }); - it('should handle a store response with useGetHostsInventory', async () => { - const { result } = await renderHook( - () => - useGetHostsInventory({ - getInventory: () => () => {}, - useProduct: () => ({ productId: 'lorem' }), - useDispatch: () => {} - }), - { - state: { - inventory: { - hostsInventory: { - lorem: { - fulfilled: true, - data: [{ data: [{ lorem: 'ipsum' }, { dolor: 'sit' }], meta: {} }] - } - } - } - } - } - ); - - expect(result).toMatchSnapshot('store response'); - }); - - it('should handle variations in hosts inventory API responses', async () => { - const { result: errorResponse } = await renderHook(() => - useGetHostsInventory({ - getInventory: () => () => {}, - useProduct: () => ({ productId: 'lorem' }), - useDispatch: () => {}, - useSelectorsResponse: () => ({ error: true }) - }) - ); - - expect(errorResponse).toMatchSnapshot('inventory, error'); - - const { result: pendingResponse } = await renderHook(() => - useGetHostsInventory({ - getInventory: () => () => {}, - useProduct: () => ({ productId: 'lorem' }), - useDispatch: () => {}, - useProductInventoryQuery: () => ({}), - useSelectorsResponse: () => ({ pending: true }) - }) - ); - - expect(pendingResponse).toMatchSnapshot('inventory, pending'); - - const { result: cancelledResponse } = await renderHook(() => - useGetHostsInventory({ - getInventory: () => () => {}, - useProduct: () => ({ productId: 'lorem' }), - useDispatch: () => {}, - useProductInventoryQuery: () => ({}), - useSelectorsResponse: () => ({ cancelled: true }) - }) - ); - - expect(cancelledResponse).toMatchSnapshot('inventory, cancelled'); - - const { result: fulfilledResponse } = await renderHook(() => - useGetHostsInventory({ - getInventory: () => () => {}, - useProduct: () => ({ productId: 'lorem' }), - useDispatch: () => {}, - useProductInventoryQuery: () => ({}), - useSelectorsResponse: () => ({ fulfilled: true }) - }) - ); - - expect(fulfilledResponse).toMatchSnapshot('inventory, fulfilled'); - - const { result: disabledResponse } = await renderHook(() => - useGetHostsInventory({ - isDisabled: true, - getInventory: () => () => {}, - useProduct: () => ({ productId: 'lorem' }), - useDispatch: () => {}, - useProductInventoryQuery: () => ({}), - useSelectorsResponse: () => ({ fulfilled: true }) - }) - ); - - expect(disabledResponse).toMatchSnapshot('inventory, disabled'); - }); - it('should handle an onPage event', () => { const mockDispatch = jest.fn(); const onPage = useOnPageInstances({ @@ -202,21 +113,6 @@ describe('InventoryCardContext', () => { mockDispatch.mockClear(); }); - it('should handle an onColumnSort event for hosts', () => { - const mockDispatch = jest.fn(); - const onColumnSort = useOnColumnSortHosts({ - sortColumns: { LOREM_IPSUM_COLUMN_ONE: 'loremIpsumColumnOne' }, - useDispatch: () => mockDispatch, - useProduct: () => ({ productId: 'lorem' }) - }); - - onColumnSort(null, { direction: SORT_DIRECTION_TYPES.DESCENDING, id: 'loremIpsumColumnOne' }); - onColumnSort(null, { direction: SORT_DIRECTION_TYPES.ASCENDING, id: 'loremIpsumColumnOne' }); - - expect(mockDispatch.mock.calls).toMatchSnapshot('onColumnSort event, dispatch hosts'); - mockDispatch.mockClear(); - }); - it('should handle an onColumnSort event', () => { const mockDispatch = jest.fn(); const onColumnSort = useOnColumnSortInstances({ diff --git a/src/components/inventoryCard/__tests__/inventoryCardHosts.test.js b/src/components/inventoryCard/__tests__/inventoryCardHosts.test.js deleted file mode 100644 index 1ad90c358..000000000 --- a/src/components/inventoryCard/__tests__/inventoryCardHosts.test.js +++ /dev/null @@ -1,18 +0,0 @@ -import React from 'react'; -import { InventoryCardHosts } from '../inventoryCardHosts'; -import { RHSM_API_QUERY_SET_TYPES } from '../../../services/rhsm/rhsmConstants'; - -describe('InventoryCardHosts Component', () => { - it('should render a basic component', async () => { - const props = { - useProductInventoryConfig: () => ({ filters: [], settings: {} }), - useProductInventoryQuery: () => ({ - [RHSM_API_QUERY_SET_TYPES.LIMIT]: 10, - [RHSM_API_QUERY_SET_TYPES.OFFSET]: 0 - }) - }; - - const component = await shallowComponent(); - expect(component).toMatchSnapshot('basic render'); - }); -}); diff --git a/src/components/inventoryCard/inventoryCard.js b/src/components/inventoryCard/inventoryCard.js index 5242c0524..3a7a62791 100644 --- a/src/components/inventoryCard/inventoryCard.js +++ b/src/components/inventoryCard/inventoryCard.js @@ -24,13 +24,12 @@ import { translate } from '../i18n/i18n'; import { useGetInstancesInventory, useOnPageInstances, useOnColumnSortInstances } from './inventoryCardContext'; /** - * Instances, Hosts, and Subscriptions base inventory card. + * Instances, and Subscriptions base inventory card. * * @memberof Components * @module InventoryCard * @property {module} InventoryCardContext * @property {module} InventoryCardHelpers - * @property {module} InventoryCardHosts */ /** diff --git a/src/components/inventoryCard/inventoryCardContext.js b/src/components/inventoryCard/inventoryCardContext.js index c02f2dd93..7be508d79 100644 --- a/src/components/inventoryCard/inventoryCardContext.js +++ b/src/components/inventoryCard/inventoryCardContext.js @@ -4,7 +4,6 @@ import { SortByDirection } from '@patternfly/react-table'; import { reduxActions, reduxTypes, storeHooks } from '../../redux'; import { useProduct, useProductInventoryHostsQuery } from '../productView/productViewContext'; import { - RHSM_API_QUERY_INVENTORY_HOSTS_SORT_TYPES as HOSTS_SORT_TYPES, RHSM_API_QUERY_INVENTORY_SORT_DIRECTION_TYPES as SORT_DIRECTION_TYPES, RHSM_API_QUERY_INVENTORY_SORT_TYPES as SORT_TYPES, RHSM_API_QUERY_SET_TYPES @@ -16,46 +15,6 @@ import { helpers } from '../../common'; * @module InventoryCardContext */ -/** - * Combined Redux RHSM Actions, getHostsInventory, and inventory selector response. - * - * @param {object} options - * @param {boolean} options.isDisabled - * @param {Function} options.getInventory - * @param {Function} options.useDispatch - * @param {Function} options.useProduct - * @param {Function} options.useProductInventoryQuery - * @param {Function} options.useSelectorsResponse - * @returns {{data: (*|{}|Array|{}), pending: boolean, fulfilled: boolean, error: boolean}} - */ -const useGetHostsInventory = ({ - isDisabled = false, - getInventory = reduxActions.rhsm.getHostsInventory, - useDispatch: useAliasDispatch = storeHooks.reactRedux.useDispatch, - useProduct: useAliasProduct = useProduct, - useProductInventoryQuery: useAliasProductInventoryQuery = useProductInventoryHostsQuery, - useSelectorsResponse: useAliasSelectorsResponse = storeHooks.reactRedux.useSelectorsResponse -} = {}) => { - const { productId } = useAliasProduct(); - const query = useAliasProductInventoryQuery(); - const dispatch = useAliasDispatch(); - const { cancelled, pending, data, ...response } = useAliasSelectorsResponse( - ({ inventory }) => inventory?.hostsInventory?.[productId] - ); - - useShallowCompareEffect(() => { - if (!isDisabled) { - getInventory(productId, query)(dispatch); - } - }, [dispatch, isDisabled, productId, query]); - - return { - ...response, - pending: pending || cancelled || false, - data: (data?.length === 1 && data[0]) || data || {} - }; -}; - /** * Combined Redux RHSM Actions, getInstancesInventory, and inventory selector response. * @@ -136,68 +95,6 @@ const useOnPageInstances = ({ }; }; -/** - * An onColumnSort callback for hosts inventory. - * - * @param {object} options - * @param {object} options.sortColumns - * @param {Function} options.useDispatch - * @param {Function} options.useProduct - * @returns {Function} - */ -const useOnColumnSortHosts = ({ - sortColumns = HOSTS_SORT_TYPES, - useDispatch: useAliasDispatch = storeHooks.reactRedux.useDispatch, - useProduct: useAliasProduct = useProduct -} = {}) => { - const { productId } = useAliasProduct(); - const dispatch = useAliasDispatch(); - - /** - * On event update state for hosts inventory. - * - * @event onColumnSort - * @param {*} _data - * @param {object} params - * @param {string} params.direction - * @param {string} params.id - * @returns {void} - */ - return (_data, { direction, id }) => { - const updatedSortColumn = Object.values(sortColumns).find(value => value === id || _camelCase(value) === id); - let updatedDirection; - - if (!updatedSortColumn) { - if (helpers.DEV_MODE || helpers.REVIEW_MODE) { - console.warn(`Sorting can only be performed on select fields, confirm field ${id} is allowed.`); - } - return; - } - - switch (direction) { - case SortByDirection.desc: - updatedDirection = SORT_DIRECTION_TYPES.DESCENDING; - break; - default: - updatedDirection = SORT_DIRECTION_TYPES.ASCENDING; - break; - } - - dispatch([ - { - type: reduxTypes.query.SET_QUERY_RHSM_HOSTS_INVENTORY_TYPES[RHSM_API_QUERY_SET_TYPES.DIRECTION], - viewId: productId, - [RHSM_API_QUERY_SET_TYPES.DIRECTION]: updatedDirection - }, - { - type: reduxTypes.query.SET_QUERY_RHSM_HOSTS_INVENTORY_TYPES[RHSM_API_QUERY_SET_TYPES.SORT], - viewId: productId, - [RHSM_API_QUERY_SET_TYPES.SORT]: updatedSortColumn - } - ]); - }; -}; - /** * An onColumnSort callback for instances inventory. * @@ -261,19 +158,9 @@ const useOnColumnSortInstances = ({ }; const context = { - useGetHostsInventory, useGetInstancesInventory, useOnPageInstances, - useOnColumnSortHosts, useOnColumnSortInstances }; -export { - context as default, - context, - useGetHostsInventory, - useGetInstancesInventory, - useOnPageInstances, - useOnColumnSortHosts, - useOnColumnSortInstances -}; +export { context as default, context, useGetInstancesInventory, useOnPageInstances, useOnColumnSortInstances }; diff --git a/src/components/inventoryCard/inventoryCardHosts.js b/src/components/inventoryCard/inventoryCardHosts.js deleted file mode 100644 index 445c72de8..000000000 --- a/src/components/inventoryCard/inventoryCardHosts.js +++ /dev/null @@ -1,47 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import { useGetHostsInventory, useOnColumnSortHosts } from './inventoryCardContext'; -import InventoryCard from './inventoryCard'; -import { helpers } from '../../common'; - -/** - * @memberof InventoryCard - * @module InventoryCardHosts - */ - -/** - * A hosts' system inventory component. - * - * @deprecated The Hosts API response is deprecated. New product inventory displays should be using Instances - * and/or Subscriptions. - * @param {object} props - * @param {boolean} props.isDisabled - * @param {Function} props.useGetInventory - * @param {Function} props.useOnColumnSort - * @returns {React.ReactNode} - */ -const InventoryCardHosts = ({ ...props }) => ; - -/** - * Prop types. - * - * @type {{isDisabled: boolean, useGetInventory: Function, useOnColumnSort: Function}} - */ -InventoryCardHosts.propTypes = { - isDisabled: PropTypes.bool, - useGetInventory: PropTypes.func, - useOnColumnSort: PropTypes.func -}; - -/** - * Default props. - * - * @type {{isDisabled: boolean, useGetInventory: Function, useOnColumnSort: Function}} - */ -InventoryCardHosts.defaultProps = { - isDisabled: helpers.UI_DISABLED_TABLE_HOSTS, - useGetInventory: useGetHostsInventory, - useOnColumnSort: useOnColumnSortHosts -}; - -export { InventoryCardHosts as default, InventoryCardHosts }; diff --git a/src/components/productView/productViewContext.js b/src/components/productView/productViewContext.js index 5fc3bc02c..2bcce4ac4 100644 --- a/src/components/productView/productViewContext.js +++ b/src/components/productView/productViewContext.js @@ -328,7 +328,7 @@ const useProductInventoryGuestsConfig = ({ useProductContext: useAliasProductCon }; /** - * Return hosts inventory configuration. + * Return inventory configuration. * * @param {object} options * @param {Function} options.useProductContext diff --git a/src/config/__tests__/product.rhacs.test.js b/src/config/__tests__/product.rhacs.test.js index 287b40368..61bcd7d5a 100644 --- a/src/config/__tests__/product.rhacs.test.js +++ b/src/config/__tests__/product.rhacs.test.js @@ -122,9 +122,6 @@ describe('Product RHACS config', () => { expect(generateTicks()).toMatchSnapshot('yAxisTickFormat'); }); - /** - * FixMe: this test needs to be updated as part of the refactor towards instances vs hosts - */ it('should apply an inventory configuration', () => { const { initialInventoryFilters: initialFilters, inventoryHostsQuery: inventoryQuery } = config; diff --git a/src/config/__tests__/product.rhods.test.js b/src/config/__tests__/product.rhods.test.js index 547f2be48..950dcfe78 100644 --- a/src/config/__tests__/product.rhods.test.js +++ b/src/config/__tests__/product.rhods.test.js @@ -122,9 +122,6 @@ describe('Product RHODS config', () => { expect(generateTicks()).toMatchSnapshot('yAxisTickFormat'); }); - /** - * FixMe: this test needs to be updated as part of the refactor towards instances vs hosts - */ it('should apply an inventory configuration', () => { const { initialInventoryFilters: initialFilters, inventoryHostsQuery: inventoryQuery } = config; diff --git a/src/redux/README.md b/src/redux/README.md index b1275e223..bdedd65e0 100644 --- a/src/redux/README.md +++ b/src/redux/README.md @@ -169,8 +169,6 @@ RHSM service wrappers for dispatch, state update. * [RhsmActions](#Actions.module_RhsmActions) * [~getGraphMetrics(idMetric, query, options)](#Actions.module_RhsmActions..getGraphMetrics) ⇒ function - * [~getHostsInventory(id, query)](#Actions.module_RhsmActions..getHostsInventory) ⇒ function - * [~getHostsInventoryGuests(id, query)](#Actions.module_RhsmActions..getHostsInventoryGuests) ⇒ function * [~getInstancesInventory(id, query)](#Actions.module_RhsmActions..getInstancesInventory) ⇒ function * [~getInstancesInventoryGuests(id, query)](#Actions.module_RhsmActions..getInstancesInventoryGuests) ⇒ function * [~getSubscriptionsInventory(id, query)](#Actions.module_RhsmActions..getSubscriptionsInventory) ⇒ function @@ -200,50 +198,6 @@ Get a RHSM response from multiple Tally, or Capacity, IDs and metrics.
- - -### RhsmActions~getHostsInventory(id, query) ⇒ function -***Deprecated*** - -Get a hosts response listing from RHSM subscriptions. - -**Kind**: inner method of [RhsmActions](#Actions.module_RhsmActions) - - - - - - - - - - - - -
ParamTypeDefault
idstringnull
queryobject
- - - -### RhsmActions~getHostsInventoryGuests(id, query) ⇒ function -***Deprecated*** - -Get a host's guest response listing from RHSM subscriptions. - -**Kind**: inner method of [RhsmActions](#Actions.module_RhsmActions) - - - - - - - - - - - - -
ParamTypeDefault
idstringnull
queryobject
- ### RhsmActions~getInstancesInventory(id, query) ⇒ function @@ -1068,7 +1022,7 @@ Inventory, and tabs, related API and user state reducer. ### InventoryReducer~inventoryReducer(state, action) ⇒ object \| Object -Apply generated inventory observer/reducer for hosts/system and subscriptions inventory to state, +Apply generated inventory observer/reducer for system and subscriptions inventory to state, against actions. **Kind**: inner method of [InventoryReducer](#Reducers.module_InventoryReducer) @@ -1269,7 +1223,7 @@ Inventory query types associated with only GUESTS' queries. ### QueryTypes~SET\_QUERY\_RHSM\_HOSTS\_INVENTORY\_TYPES -Inventory query types associated with only HOSTS' and INSTANCES' queries. +Inventory query types associated with only INSTANCES' queries. **Kind**: inner constant of [QueryTypes](#Types.module_QueryTypes) diff --git a/src/redux/actions/__tests__/rhsmActions.test.js b/src/redux/actions/__tests__/rhsmActions.test.js index b1b7acdf1..3b731ca27 100644 --- a/src/redux/actions/__tests__/rhsmActions.test.js +++ b/src/redux/actions/__tests__/rhsmActions.test.js @@ -21,7 +21,7 @@ describe('RhsmActions', () => { beforeEach(() => { moxios.install(); - moxios.stubRequest(/\/(tally|capacity|hosts|instances|subscriptions|version).*?/, { + moxios.stubRequest(/\/(tally|capacity|instances|subscriptions|version).*?/, { status: 200, responseText: 'success', timeout: 1, @@ -58,28 +58,6 @@ describe('RhsmActions', () => { }); }); - it('Should return response content for getHostsInventory method', done => { - const store = generateStore(); - const dispatcher = rhsmActions.getHostsInventory(); - - dispatcher(store.dispatch).then(() => { - const response = store.getState().inventory; - expect(response.hostsInventory.fulfilled).toBe(true); - done(); - }); - }); - - it('Should return response content for getHostsInventoryGuests method', done => { - const store = generateStore(); - const dispatcher = rhsmActions.getHostsInventoryGuests(); - - dispatcher(store.dispatch).then(() => { - const response = store.getState().inventory; - expect(response.hostsGuests.fulfilled).toBe(true); - done(); - }); - }); - it('Should return response content for getInstancesInventory method', done => { const store = generateStore(); const dispatcher = rhsmActions.getInstancesInventory(); diff --git a/src/redux/actions/rhsmActions.js b/src/redux/actions/rhsmActions.js index 777a45b59..dfadb3c92 100644 --- a/src/redux/actions/rhsmActions.js +++ b/src/redux/actions/rhsmActions.js @@ -51,48 +51,6 @@ const getGraphMetrics = return Promise.all(dispatch(multiDispatch)); }; -/** - * Get a hosts response listing from RHSM subscriptions. - * - * @deprecated The Hosts API is being replaced in favor of the Instances API response. - * @param {string} id - * @param {object} query - * @returns {Function} - */ -const getHostsInventory = - (id = null, query = {}) => - dispatch => - dispatch({ - type: rhsmTypes.GET_HOSTS_INVENTORY_RHSM, - payload: rhsmServices.getHostsInventory(id, query), - meta: { - id, - query, - notifications: {} - } - }); - -/** - * Get a host's guest response listing from RHSM subscriptions. - * - * @deprecated The Hosts API is being replaced in favor of the Instances API response. - * @param {string} id - * @param {object} query - * @returns {Function} - */ -const getHostsInventoryGuests = - (id = null, query = {}) => - dispatch => - dispatch({ - type: rhsmTypes.GET_HOSTS_INVENTORY_GUESTS_RHSM, - payload: rhsmServices.getHostsInventoryGuests(id, query), - meta: { - id, - query, - notifications: {} - } - }); - /** * Get an instances response listing from RHSM subscriptions. * @@ -155,8 +113,6 @@ const getSubscriptionsInventory = const rhsmActions = { getGraphMetrics, - getHostsInventory, - getHostsInventoryGuests, getInstancesInventory, getInstancesInventoryGuests, getSubscriptionsInventory @@ -166,8 +122,6 @@ export { rhsmActions as default, rhsmActions, getGraphMetrics, - getHostsInventory, - getHostsInventoryGuests, getInstancesInventory, getInstancesInventoryGuests, getSubscriptionsInventory diff --git a/src/redux/reducers/__tests__/__snapshots__/inventoryReducer.test.js.snap b/src/redux/reducers/__tests__/__snapshots__/inventoryReducer.test.js.snap index 01d044f60..7e5319577 100644 --- a/src/redux/reducers/__tests__/__snapshots__/inventoryReducer.test.js.snap +++ b/src/redux/reducers/__tests__/__snapshots__/inventoryReducer.test.js.snap @@ -1,52 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`InventoryReducer should handle all defined error types: rejected types GET_HOSTS_INVENTORY_GUESTS_RHSM 1`] = ` -{ - "result": { - "hostsGuests": { - "error": true, - "errorMessage": "MESSAGE", - "fulfilled": false, - "meta": {}, - "pending": false, - "status": 0, - }, - "hostsInventory": {}, - "instancesGuests": {}, - "instancesInventory": {}, - "subscriptionsInventory": {}, - "tabs": {}, - }, - "type": "GET_HOSTS_INVENTORY_GUESTS_RHSM_REJECTED", -} -`; - -exports[`InventoryReducer should handle all defined error types: rejected types GET_HOSTS_INVENTORY_RHSM 1`] = ` -{ - "result": { - "hostsGuests": {}, - "hostsInventory": { - "error": true, - "errorMessage": "MESSAGE", - "fulfilled": false, - "meta": {}, - "pending": false, - "status": 0, - }, - "instancesGuests": {}, - "instancesInventory": {}, - "subscriptionsInventory": {}, - "tabs": {}, - }, - "type": "GET_HOSTS_INVENTORY_RHSM_REJECTED", -} -`; - exports[`InventoryReducer should handle all defined error types: rejected types GET_INSTANCES_INVENTORY_GUESTS_RHSM 1`] = ` { "result": { - "hostsGuests": {}, - "hostsInventory": {}, "instancesGuests": { "error": true, "errorMessage": "MESSAGE", @@ -66,8 +22,6 @@ exports[`InventoryReducer should handle all defined error types: rejected types exports[`InventoryReducer should handle all defined error types: rejected types GET_INSTANCES_INVENTORY_RHSM 1`] = ` { "result": { - "hostsGuests": {}, - "hostsInventory": {}, "instancesGuests": {}, "instancesInventory": { "error": true, @@ -87,8 +41,6 @@ exports[`InventoryReducer should handle all defined error types: rejected types exports[`InventoryReducer should handle all defined error types: rejected types GET_SUBSCRIPTIONS_INVENTORY_RHSM 1`] = ` { "result": { - "hostsGuests": {}, - "hostsInventory": {}, "instancesGuests": {}, "instancesInventory": {}, "subscriptionsInventory": { @@ -105,61 +57,9 @@ exports[`InventoryReducer should handle all defined error types: rejected types } `; -exports[`InventoryReducer should handle all defined fulfilled types: fulfilled types GET_HOSTS_INVENTORY_GUESTS_RHSM 1`] = ` -{ - "result": { - "hostsGuests": { - "data": { - "test": "success", - }, - "date": null, - "error": false, - "errorMessage": "", - "fulfilled": true, - "meta": {}, - "pending": false, - "status": 0, - }, - "hostsInventory": {}, - "instancesGuests": {}, - "instancesInventory": {}, - "subscriptionsInventory": {}, - "tabs": {}, - }, - "type": "GET_HOSTS_INVENTORY_GUESTS_RHSM_FULFILLED", -} -`; - -exports[`InventoryReducer should handle all defined fulfilled types: fulfilled types GET_HOSTS_INVENTORY_RHSM 1`] = ` -{ - "result": { - "hostsGuests": {}, - "hostsInventory": { - "data": { - "test": "success", - }, - "date": null, - "error": false, - "errorMessage": "", - "fulfilled": true, - "meta": {}, - "pending": false, - "status": 0, - }, - "instancesGuests": {}, - "instancesInventory": {}, - "subscriptionsInventory": {}, - "tabs": {}, - }, - "type": "GET_HOSTS_INVENTORY_RHSM_FULFILLED", -} -`; - exports[`InventoryReducer should handle all defined fulfilled types: fulfilled types GET_INSTANCES_INVENTORY_GUESTS_RHSM 1`] = ` { "result": { - "hostsGuests": {}, - "hostsInventory": {}, "instancesGuests": { "data": { "test": "success", @@ -183,8 +83,6 @@ exports[`InventoryReducer should handle all defined fulfilled types: fulfilled t exports[`InventoryReducer should handle all defined fulfilled types: fulfilled types GET_INSTANCES_INVENTORY_RHSM 1`] = ` { "result": { - "hostsGuests": {}, - "hostsInventory": {}, "instancesGuests": {}, "instancesInventory": { "data": { @@ -208,8 +106,6 @@ exports[`InventoryReducer should handle all defined fulfilled types: fulfilled t exports[`InventoryReducer should handle all defined fulfilled types: fulfilled types GET_SUBSCRIPTIONS_INVENTORY_RHSM 1`] = ` { "result": { - "hostsGuests": {}, - "hostsInventory": {}, "instancesGuests": {}, "instancesInventory": {}, "subscriptionsInventory": { @@ -230,51 +126,9 @@ exports[`InventoryReducer should handle all defined fulfilled types: fulfilled t } `; -exports[`InventoryReducer should handle all defined pending types: pending types GET_HOSTS_INVENTORY_GUESTS_RHSM 1`] = ` -{ - "result": { - "hostsGuests": { - "error": false, - "errorMessage": "", - "fulfilled": false, - "meta": {}, - "pending": true, - }, - "hostsInventory": {}, - "instancesGuests": {}, - "instancesInventory": {}, - "subscriptionsInventory": {}, - "tabs": {}, - }, - "type": "GET_HOSTS_INVENTORY_GUESTS_RHSM_PENDING", -} -`; - -exports[`InventoryReducer should handle all defined pending types: pending types GET_HOSTS_INVENTORY_RHSM 1`] = ` -{ - "result": { - "hostsGuests": {}, - "hostsInventory": { - "error": false, - "errorMessage": "", - "fulfilled": false, - "meta": {}, - "pending": true, - }, - "instancesGuests": {}, - "instancesInventory": {}, - "subscriptionsInventory": {}, - "tabs": {}, - }, - "type": "GET_HOSTS_INVENTORY_RHSM_PENDING", -} -`; - exports[`InventoryReducer should handle all defined pending types: pending types GET_INSTANCES_INVENTORY_GUESTS_RHSM 1`] = ` { "result": { - "hostsGuests": {}, - "hostsInventory": {}, "instancesGuests": { "error": false, "errorMessage": "", @@ -293,8 +147,6 @@ exports[`InventoryReducer should handle all defined pending types: pending types exports[`InventoryReducer should handle all defined pending types: pending types GET_INSTANCES_INVENTORY_RHSM 1`] = ` { "result": { - "hostsGuests": {}, - "hostsInventory": {}, "instancesGuests": {}, "instancesInventory": { "error": false, @@ -313,8 +165,6 @@ exports[`InventoryReducer should handle all defined pending types: pending types exports[`InventoryReducer should handle all defined pending types: pending types GET_SUBSCRIPTIONS_INVENTORY_RHSM 1`] = ` { "result": { - "hostsGuests": {}, - "hostsInventory": {}, "instancesGuests": {}, "instancesInventory": {}, "subscriptionsInventory": { @@ -333,8 +183,6 @@ exports[`InventoryReducer should handle all defined pending types: pending types exports[`InventoryReducer should handle specific defined types: defined type CLEAR_INVENTORY_GUESTS 1`] = ` { "result": { - "hostsGuests": {}, - "hostsInventory": {}, "instancesGuests": { "lorem": {}, }, @@ -349,8 +197,6 @@ exports[`InventoryReducer should handle specific defined types: defined type CLE exports[`InventoryReducer should handle specific defined types: defined type SET_INVENTORY_TAB 1`] = ` { "result": { - "hostsGuests": {}, - "hostsInventory": {}, "instancesGuests": {}, "instancesInventory": {}, "subscriptionsInventory": {}, diff --git a/src/redux/reducers/__tests__/inventoryReducer.test.js b/src/redux/reducers/__tests__/inventoryReducer.test.js index 8db91790f..c92688639 100644 --- a/src/redux/reducers/__tests__/inventoryReducer.test.js +++ b/src/redux/reducers/__tests__/inventoryReducer.test.js @@ -27,8 +27,6 @@ describe('InventoryReducer', () => { it('should handle all defined error types', () => { const specificTypes = [ - types.GET_HOSTS_INVENTORY_RHSM, - types.GET_HOSTS_INVENTORY_GUESTS_RHSM, types.GET_INSTANCES_INVENTORY_RHSM, types.GET_INSTANCES_INVENTORY_GUESTS_RHSM, types.GET_SUBSCRIPTIONS_INVENTORY_RHSM @@ -60,8 +58,6 @@ describe('InventoryReducer', () => { it('should handle all defined pending types', () => { const specificTypes = [ - types.GET_HOSTS_INVENTORY_RHSM, - types.GET_HOSTS_INVENTORY_GUESTS_RHSM, types.GET_INSTANCES_INVENTORY_RHSM, types.GET_INSTANCES_INVENTORY_GUESTS_RHSM, types.GET_SUBSCRIPTIONS_INVENTORY_RHSM @@ -82,8 +78,6 @@ describe('InventoryReducer', () => { it('should handle all defined fulfilled types', () => { const specificTypes = [ - types.GET_HOSTS_INVENTORY_RHSM, - types.GET_HOSTS_INVENTORY_GUESTS_RHSM, types.GET_INSTANCES_INVENTORY_RHSM, types.GET_INSTANCES_INVENTORY_GUESTS_RHSM, types.GET_SUBSCRIPTIONS_INVENTORY_RHSM diff --git a/src/redux/reducers/inventoryReducer.js b/src/redux/reducers/inventoryReducer.js index 8e2c62686..7e18ee730 100644 --- a/src/redux/reducers/inventoryReducer.js +++ b/src/redux/reducers/inventoryReducer.js @@ -13,12 +13,9 @@ import { inventoryTypes } from '../types'; * Initial state. * * @private - * @type {{subscriptionsInventory: {}, instancesGuests: {}, instancesInventory: {}, tabs: {}, hostsInventory: {}, - * hostsGuests: {}}} + * @type {{subscriptionsInventory: {}, instancesGuests: {}, instancesInventory: {}, tabs: {}}} */ const initialState = { - hostsInventory: {}, - hostsGuests: {}, instancesInventory: {}, instancesGuests: {}, subscriptionsInventory: {}, @@ -26,7 +23,7 @@ const initialState = { }; /** - * Apply generated inventory observer/reducer for hosts/system and subscriptions inventory to state, + * Apply generated inventory observer/reducer for system and subscriptions inventory to state, * against actions. * * @param {object} state @@ -60,8 +57,6 @@ const inventoryReducer = (state = initialState, action) => { default: return reduxHelpers.generatedPromiseActionReducer( [ - { ref: 'hostsInventory', type: rhsmTypes.GET_HOSTS_INVENTORY_RHSM }, - { ref: 'hostsGuests', type: rhsmTypes.GET_HOSTS_INVENTORY_GUESTS_RHSM }, { ref: 'instancesInventory', type: rhsmTypes.GET_INSTANCES_INVENTORY_RHSM }, { ref: 'instancesGuests', type: rhsmTypes.GET_INSTANCES_INVENTORY_GUESTS_RHSM }, { ref: 'subscriptionsInventory', type: rhsmTypes.GET_SUBSCRIPTIONS_INVENTORY_RHSM } diff --git a/src/redux/types/__tests__/__snapshots__/index.test.js.snap b/src/redux/types/__tests__/__snapshots__/index.test.js.snap index 5efe2a8ab..333c44244 100644 --- a/src/redux/types/__tests__/__snapshots__/index.test.js.snap +++ b/src/redux/types/__tests__/__snapshots__/index.test.js.snap @@ -71,8 +71,6 @@ exports[`ReduxTypes should have specific type properties: all redux types 1`] = "GET_GRAPH_CAPACITY_RHSM": "GET_GRAPH_CAPACITY_RHSM", "GET_GRAPH_REPORT_CAPACITY_RHSM": "GET_GRAPH_REPORT_CAPACITY_RHSM", "GET_GRAPH_TALLY_RHSM": "GET_GRAPH_TALLY_RHSM", - "GET_HOSTS_INVENTORY_GUESTS_RHSM": "GET_HOSTS_INVENTORY_GUESTS_RHSM", - "GET_HOSTS_INVENTORY_RHSM": "GET_HOSTS_INVENTORY_RHSM", "GET_INSTANCES_INVENTORY_GUESTS_RHSM": "GET_INSTANCES_INVENTORY_GUESTS_RHSM", "GET_INSTANCES_INVENTORY_RHSM": "GET_INSTANCES_INVENTORY_RHSM", "GET_SUBSCRIPTIONS_INVENTORY_RHSM": "GET_SUBSCRIPTIONS_INVENTORY_RHSM", @@ -201,8 +199,6 @@ exports[`ReduxTypes should have specific type properties: all redux types 1`] = "GET_GRAPH_CAPACITY_RHSM": "GET_GRAPH_CAPACITY_RHSM", "GET_GRAPH_REPORT_CAPACITY_RHSM": "GET_GRAPH_REPORT_CAPACITY_RHSM", "GET_GRAPH_TALLY_RHSM": "GET_GRAPH_TALLY_RHSM", - "GET_HOSTS_INVENTORY_GUESTS_RHSM": "GET_HOSTS_INVENTORY_GUESTS_RHSM", - "GET_HOSTS_INVENTORY_RHSM": "GET_HOSTS_INVENTORY_RHSM", "GET_INSTANCES_INVENTORY_GUESTS_RHSM": "GET_INSTANCES_INVENTORY_GUESTS_RHSM", "GET_INSTANCES_INVENTORY_RHSM": "GET_INSTANCES_INVENTORY_RHSM", "GET_SUBSCRIPTIONS_INVENTORY_RHSM": "GET_SUBSCRIPTIONS_INVENTORY_RHSM", @@ -223,8 +219,6 @@ exports[`ReduxTypes should have specific type properties: all redux types 1`] = "GET_GRAPH_CAPACITY_RHSM": "GET_GRAPH_CAPACITY_RHSM", "GET_GRAPH_REPORT_CAPACITY_RHSM": "GET_GRAPH_REPORT_CAPACITY_RHSM", "GET_GRAPH_TALLY_RHSM": "GET_GRAPH_TALLY_RHSM", - "GET_HOSTS_INVENTORY_GUESTS_RHSM": "GET_HOSTS_INVENTORY_GUESTS_RHSM", - "GET_HOSTS_INVENTORY_RHSM": "GET_HOSTS_INVENTORY_RHSM", "GET_INSTANCES_INVENTORY_GUESTS_RHSM": "GET_INSTANCES_INVENTORY_GUESTS_RHSM", "GET_INSTANCES_INVENTORY_RHSM": "GET_INSTANCES_INVENTORY_RHSM", "GET_SUBSCRIPTIONS_INVENTORY_RHSM": "GET_SUBSCRIPTIONS_INVENTORY_RHSM", @@ -306,8 +300,6 @@ exports[`ReduxTypes should have specific type properties: specific types 1`] = ` "GET_GRAPH_CAPACITY_RHSM": "GET_GRAPH_CAPACITY_RHSM", "GET_GRAPH_REPORT_CAPACITY_RHSM": "GET_GRAPH_REPORT_CAPACITY_RHSM", "GET_GRAPH_TALLY_RHSM": "GET_GRAPH_TALLY_RHSM", - "GET_HOSTS_INVENTORY_GUESTS_RHSM": "GET_HOSTS_INVENTORY_GUESTS_RHSM", - "GET_HOSTS_INVENTORY_RHSM": "GET_HOSTS_INVENTORY_RHSM", "GET_INSTANCES_INVENTORY_GUESTS_RHSM": "GET_INSTANCES_INVENTORY_GUESTS_RHSM", "GET_INSTANCES_INVENTORY_RHSM": "GET_INSTANCES_INVENTORY_RHSM", "GET_SUBSCRIPTIONS_INVENTORY_RHSM": "GET_SUBSCRIPTIONS_INVENTORY_RHSM", diff --git a/src/redux/types/queryTypes.js b/src/redux/types/queryTypes.js index 6626dec35..7caf41d9f 100644 --- a/src/redux/types/queryTypes.js +++ b/src/redux/types/queryTypes.js @@ -33,7 +33,7 @@ const SET_QUERY_RHSM_GUESTS_INVENTORY_TYPES = { }; /** - * Inventory query types associated with only HOSTS' and INSTANCES' queries. + * Inventory query types associated with only INSTANCES' queries. */ const SET_QUERY_RHSM_HOSTS_INVENTORY_TYPES = { [RHSM_API_QUERY_TYPES.DIRECTION]: `SET_QUERY_RHSM_HOSTS_INVENTORY_${RHSM_API_QUERY_TYPES.DIRECTION}`, diff --git a/src/redux/types/rhsmTypes.js b/src/redux/types/rhsmTypes.js index 4ed79f803..3caeac505 100644 --- a/src/redux/types/rhsmTypes.js +++ b/src/redux/types/rhsmTypes.js @@ -6,8 +6,6 @@ const GET_GRAPH_CAPACITY_RHSM = 'GET_GRAPH_CAPACITY_RHSM'; const GET_GRAPH_REPORT_CAPACITY_RHSM = 'GET_GRAPH_REPORT_CAPACITY_RHSM'; const GET_GRAPH_TALLY_RHSM = 'GET_GRAPH_TALLY_RHSM'; -const GET_HOSTS_INVENTORY_RHSM = 'GET_HOSTS_INVENTORY_RHSM'; -const GET_HOSTS_INVENTORY_GUESTS_RHSM = 'GET_HOSTS_INVENTORY_GUESTS_RHSM'; const GET_INSTANCES_INVENTORY_RHSM = 'GET_INSTANCES_INVENTORY_RHSM'; const GET_INSTANCES_INVENTORY_GUESTS_RHSM = 'GET_INSTANCES_INVENTORY_GUESTS_RHSM'; const GET_SUBSCRIPTIONS_INVENTORY_RHSM = 'GET_SUBSCRIPTIONS_INVENTORY_RHSM'; @@ -15,16 +13,13 @@ const GET_SUBSCRIPTIONS_INVENTORY_RHSM = 'GET_SUBSCRIPTIONS_INVENTORY_RHSM'; /** * RHSM API action, reducer types. * - * @type {{GET_GRAPH_REPORT_CAPACITY_RHSM: string, GET_HOSTS_INVENTORY_GUESTS_RHSM: string, - * GET_GRAPH_CAPACITY_RHSM: string, GET_INSTANCES_INVENTORY_GUESTS_RHSM: string, GET_SUBSCRIPTIONS_INVENTORY_RHSM: string, - * GET_HOSTS_INVENTORY_RHSM: string, GET_INSTANCES_INVENTORY_RHSM: string, GET_GRAPH_TALLY_RHSM: string}} + * @type {{GET_GRAPH_REPORT_CAPACITY_RHSM: string, GET_GRAPH_CAPACITY_RHSM: string, GET_INSTANCES_INVENTORY_GUESTS_RHSM: string, + * GET_SUBSCRIPTIONS_INVENTORY_RHSM: string, GET_INSTANCES_INVENTORY_RHSM: string, GET_GRAPH_TALLY_RHSM: string}} */ const rhsmTypes = { GET_GRAPH_CAPACITY_RHSM, GET_GRAPH_REPORT_CAPACITY_RHSM, GET_GRAPH_TALLY_RHSM, - GET_HOSTS_INVENTORY_RHSM, - GET_HOSTS_INVENTORY_GUESTS_RHSM, GET_INSTANCES_INVENTORY_RHSM, GET_INSTANCES_INVENTORY_GUESTS_RHSM, GET_SUBSCRIPTIONS_INVENTORY_RHSM @@ -36,8 +31,6 @@ export { GET_GRAPH_CAPACITY_RHSM, GET_GRAPH_REPORT_CAPACITY_RHSM, GET_GRAPH_TALLY_RHSM, - GET_HOSTS_INVENTORY_RHSM, - GET_HOSTS_INVENTORY_GUESTS_RHSM, GET_INSTANCES_INVENTORY_RHSM, GET_INSTANCES_INVENTORY_GUESTS_RHSM, GET_SUBSCRIPTIONS_INVENTORY_RHSM diff --git a/src/services/README.md b/src/services/README.md index d0fe27a95..3722a3a9c 100644 --- a/src/services/README.md +++ b/src/services/README.md @@ -448,8 +448,6 @@ Parse platform getUserPermissions response. * [~RHSM_API_RESPONSE_ERRORS](#Rhsm.module_RhsmConstants..RHSM_API_RESPONSE_ERRORS) : string * [~RHSM_API_RESPONSE_ERRORS_TYPES](#Rhsm.module_RhsmConstants..RHSM_API_RESPONSE_ERRORS_TYPES) : Object * [~RHSM_API_RESPONSE_ERRORS_CODE_TYPES](#Rhsm.module_RhsmConstants..RHSM_API_RESPONSE_ERRORS_CODE_TYPES) : Object - * [~RHSM_API_RESPONSE_HOSTS_DATA_TYPES](#Rhsm.module_RhsmConstants..RHSM_API_RESPONSE_HOSTS_DATA_TYPES) : Object - * [~RHSM_API_RESPONSE_HOSTS_META_TYPES](#Rhsm.module_RhsmConstants..RHSM_API_RESPONSE_HOSTS_META_TYPES) : Object * [~RHSM_API_RESPONSE_INSTANCES_DATA_TYPES](#Rhsm.module_RhsmConstants..RHSM_API_RESPONSE_INSTANCES_DATA_TYPES) : Object * [~RHSM_API_RESPONSE_INSTANCES_META_TYPES](#Rhsm.module_RhsmConstants..RHSM_API_RESPONSE_INSTANCES_META_TYPES) : Object * [~RHSM_API_RESPONSE_SUBSCRIPTIONS_DATA_TYPES](#Rhsm.module_RhsmConstants..RHSM_API_RESPONSE_SUBSCRIPTIONS_DATA_TYPES) : Object @@ -463,7 +461,6 @@ Parse platform getUserPermissions response. * [~RHSM_API_RESPONSE_UOM_TYPES](#Rhsm.module_RhsmConstants..RHSM_API_RESPONSE_UOM_TYPES) : Object * [~RHSM_API_RESPONSE_USAGE_TYPES](#Rhsm.module_RhsmConstants..RHSM_API_RESPONSE_USAGE_TYPES) : Object * [~RHSM_API_QUERY_CATEGORY_TYPES](#Rhsm.module_RhsmConstants..RHSM_API_QUERY_CATEGORY_TYPES) : Object - * [~RHSM_API_QUERY_INVENTORY_HOSTS_SORT_TYPES](#Rhsm.module_RhsmConstants..RHSM_API_QUERY_INVENTORY_HOSTS_SORT_TYPES) : Object * [~RHSM_API_QUERY_INVENTORY_SORT_TYPES](#Rhsm.module_RhsmConstants..RHSM_API_QUERY_INVENTORY_SORT_TYPES) : Object * [~RHSM_API_QUERY_INVENTORY_SORT_DIRECTION_TYPES](#Rhsm.module_RhsmConstants..RHSM_API_QUERY_INVENTORY_SORT_DIRECTION_TYPES) : Object * [~RHSM_API_QUERY_INVENTORY_SUBSCRIPTIONS_SORT_TYPES](#Rhsm.module_RhsmConstants..RHSM_API_QUERY_INVENTORY_SUBSCRIPTIONS_SORT_TYPES) : Object @@ -539,23 +536,12 @@ RHSM response errors types. ### RhsmConstants~RHSM\_API\_RESPONSE\_ERRORS\_CODE\_TYPES : Object RHSM response error codes. -**Kind**: inner constant of [RhsmConstants](#Rhsm.module_RhsmConstants) - - -### RhsmConstants~RHSM\_API\_RESPONSE\_HOSTS\_DATA\_TYPES : Object -RHSM response Hosts DATA types. - -**Kind**: inner constant of [RhsmConstants](#Rhsm.module_RhsmConstants) - - -### RhsmConstants~RHSM\_API\_RESPONSE\_HOSTS\_META\_TYPES : Object -RHSM response Hosts META types. - **Kind**: inner constant of [RhsmConstants](#Rhsm.module_RhsmConstants) ### RhsmConstants~RHSM\_API\_RESPONSE\_INSTANCES\_DATA\_TYPES : Object -RHSM response Instance DATA types. +RHSM combined response Instance and Instance Guests DATA types. +"INSTANCE_ID" and "SUBSCRIPTION_MANAGER_ID" are associated with instance guests. **Kind**: inner constant of [RhsmConstants](#Rhsm.module_RhsmConstants) @@ -629,12 +615,6 @@ RHSM response, query parameters for USAGE. ### RhsmConstants~RHSM\_API\_QUERY\_CATEGORY\_TYPES : Object RHSM query/search parameter CATEGORY type values for TALLY/CAPACITY. -**Kind**: inner constant of [RhsmConstants](#Rhsm.module_RhsmConstants) - - -### RhsmConstants~RHSM\_API\_QUERY\_INVENTORY\_HOSTS\_SORT\_TYPES : Object -RHSM API query/search parameter SORT type values for HOSTS. - **Kind**: inner constant of [RhsmConstants](#Rhsm.module_RhsmConstants) @@ -722,9 +702,6 @@ Patch for returning a made up API architecture, variant param as a product ID * [~guestsMetaSchema](#Rhsm.module_RhsmSchemas..guestsMetaSchema) : \* * [~guestsItem](#Rhsm.module_RhsmSchemas..guestsItem) : \* * [~guestsResponseSchema](#Rhsm.module_RhsmSchemas..guestsResponseSchema) : \* - * [~hostsMetaSchema](#Rhsm.module_RhsmSchemas..hostsMetaSchema) : \* - * [~hostsItem](#Rhsm.module_RhsmSchemas..hostsItem) : \* - * [~hostsResponseSchema](#Rhsm.module_RhsmSchemas..hostsResponseSchema) : \* * [~instancesMetaSchema](#Rhsm.module_RhsmSchemas..instancesMetaSchema) : \* * [~instancesItem](#Rhsm.module_RhsmSchemas..instancesItem) : \* * [~instancesResponseSchema](#Rhsm.module_RhsmSchemas..instancesResponseSchema) : \* @@ -794,24 +771,6 @@ Guests response item. ### RhsmSchemas~guestsResponseSchema : \* Guests response. -**Kind**: inner constant of [RhsmSchemas](#Rhsm.module_RhsmSchemas) - - -### RhsmSchemas~hostsMetaSchema : \* -Hosts response meta field. - -**Kind**: inner constant of [RhsmSchemas](#Rhsm.module_RhsmSchemas) - - -### RhsmSchemas~hostsItem : \* -Hosts response item. - -**Kind**: inner constant of [RhsmSchemas](#Rhsm.module_RhsmSchemas) - - -### RhsmSchemas~hostsResponseSchema : \* -Hosts response. - **Kind**: inner constant of [RhsmSchemas](#Rhsm.module_RhsmSchemas) @@ -875,10 +834,7 @@ RHSM API service calls. * [RhsmServices](#Rhsm.module_RhsmServices) * [~getApiVersion(options)](#Rhsm.module_RhsmServices..getApiVersion) ⇒ Promise.<\*> - * [~getGraphReports(id, params, options)](#Rhsm.module_RhsmServices..getGraphReports) ⇒ Promise.<\*> * [~getGraphCapacity(id, params, options)](#Rhsm.module_RhsmServices..getGraphCapacity) ⇒ Promise.<\*> - * [~getHostsInventory(id, params, options)](#Rhsm.module_RhsmServices..getHostsInventory) ⇒ Promise.<\*> - * [~getHostsInventoryGuests(id, params, options)](#Rhsm.module_RhsmServices..getHostsInventoryGuests) ⇒ Promise.<\*> * [~getInstancesInventoryGuests(id, params, options)](#Rhsm.module_RhsmServices..getInstancesInventoryGuests) ⇒ Promise.<\*> * [~getInstancesInventory(id, params, options)](#Rhsm.module_RhsmServices..getInstancesInventory) ⇒ Promise.<\*> * [~getSubscriptionsInventory(id, params, options)](#Rhsm.module_RhsmServices..getSubscriptionsInventory) ⇒ Promise.<\*> @@ -905,36 +861,6 @@ Get RHSM API version information. - - -### RhsmServices~getGraphReports(id, params, options) ⇒ Promise.<\*> -***Deprecated*** - -Get RHSM API reporting/tally graph/chart data. - -**Kind**: inner method of [RhsmServices](#Rhsm.module_RhsmServices) - - - - - - - - - - - - - - - - - - -
ParamTypeDescription
idstring

Product ID

-
paramsobject

Query/search params

-
optionsobject
options.cancelboolean
options.cancelIdstring
- ### RhsmServices~getGraphCapacity(id, params, options) ⇒ Promise.<\*> @@ -963,74 +889,6 @@ Get RHSM API capacity/threshold graph/chart data. - - -### RhsmServices~getHostsInventory(id, params, options) ⇒ Promise.<\*> -***Deprecated*** - -Get RHSM API hosts table/inventory data. - -**Kind**: inner method of [RhsmServices](#Rhsm.module_RhsmServices) - - - - - - - - - - - - - - - - - - -
ParamTypeDescription
idstring

Product ID

-
paramsobject

Query/search params

-
optionsobject
options.cancelboolean
options.cancelIdstring
- - - -### RhsmServices~getHostsInventoryGuests(id, params, options) ⇒ Promise.<\*> -***Deprecated*** - -Get RHSM API hosts table/inventory guests data. - -**Kind**: inner method of [RhsmServices](#Rhsm.module_RhsmServices) - - - - - - - - - - - - - - - - - - - - - - - - -
ParamTypeDescription
idstring

Subscription Manager ID

-
paramsobject

Query/search params

-
optionsobject
options.cacheboolean
options.cancelboolean
options.cancelIdstring
options.schemaArray

An array of callbacks used to transform the response, ie. [SUCCESS SCHEMA, ERROR SCHEMA]

-
options.transformArray

An array of callbacks used to transform the response, ie. [SUCCESS TRANSFORM, ERROR TRANSFORM]

-
- ### RhsmServices~getInstancesInventoryGuests(id, params, options) ⇒ Promise.<\*> @@ -1146,28 +1004,9 @@ Transform RHSM responses. Replaces selector usage. * [RhsmTransformers](#Rhsm.module_RhsmTransformers) - * [~rhsmHosts(response)](#Rhsm.module_RhsmTransformers..rhsmHosts) ⇒ object * [~rhsmInstances(response, config)](#Rhsm.module_RhsmTransformers..rhsmInstances) ⇒ object * [~rhsmTallyCapacity(response, config)](#Rhsm.module_RhsmTransformers..rhsmTallyCapacity) ⇒ object - - -### RhsmTransformers~rhsmHosts(response) ⇒ object -Parse RHSM hosts response for caching. - -**Kind**: inner method of [RhsmTransformers](#Rhsm.module_RhsmTransformers) - - - - - - - - - - -
ParamType
responseobject
- ### RhsmTransformers~rhsmInstances(response, config) ⇒ object diff --git a/src/services/rhsm/__tests__/__snapshots__/rhsmConstants.test.js.snap b/src/services/rhsm/__tests__/__snapshots__/rhsmConstants.test.js.snap index dcb6abe45..2e82824e8 100644 --- a/src/services/rhsm/__tests__/__snapshots__/rhsmConstants.test.js.snap +++ b/src/services/rhsm/__tests__/__snapshots__/rhsmConstants.test.js.snap @@ -55,16 +55,6 @@ exports[`RHSM Constants should have specific properties: all exported constants "QUARTERLY": "Quarterly", "WEEKLY": "Weekly", }, - "RHSM_API_QUERY_INVENTORY_HOSTS_SORT_TYPES": { - "CORES": "cores", - "CORE_HOURS": "core_hours", - "HARDWARE": "hardware_type", - "INSTANCE_HOURS": "instance_hours", - "LAST_SEEN": "last_seen", - "MEASUREMENT": "measurement_type", - "NAME": "display_name", - "SOCKETS": "sockets", - }, "RHSM_API_QUERY_INVENTORY_SORT_DIRECTION_TYPES": { "ASCENDING": "asc", "DESCENDING": "desc", @@ -175,24 +165,6 @@ exports[`RHSM Constants should have specific properties: all exported constants "QUARTERLY": "Quarterly", "WEEKLY": "Weekly", }, - "RHSM_API_RESPONSE_HOSTS_DATA_TYPES": { - "CLOUD_PROVIDER": "cloud_provider", - "CORES": "cores", - "CORE_HOURS": "core_hours", - "DISPLAY_NAME": "display_name", - "HARDWARE_TYPE": "hardware_type", - "INSTANCE_HOURS": "instance_hours", - "INVENTORY_ID": "inventory_id", - "LAST_SEEN": "last_seen", - "MEASUREMENT_TYPE": "measurement_type", - "NUMBER_OF_GUESTS": "number_of_guests", - "SOCKETS": "sockets", - "SUBSCRIPTION_MANAGER_ID": "subscription_manager_id", - }, - "RHSM_API_RESPONSE_HOSTS_META_TYPES": { - "COUNT": "count", - "PRODUCT": "product", - }, "RHSM_API_RESPONSE_INSTANCES_DATA_TYPES": { "BILLING_ACCOUNT_ID": "billing_account_id", "BILLING_PROVIDER": "billing_provider", @@ -340,16 +312,6 @@ exports[`RHSM Constants should have specific properties: all exported constants "QUARTERLY": "Quarterly", "WEEKLY": "Weekly", }, - "RHSM_API_QUERY_INVENTORY_HOSTS_SORT_TYPES": { - "CORES": "cores", - "CORE_HOURS": "core_hours", - "HARDWARE": "hardware_type", - "INSTANCE_HOURS": "instance_hours", - "LAST_SEEN": "last_seen", - "MEASUREMENT": "measurement_type", - "NAME": "display_name", - "SOCKETS": "sockets", - }, "RHSM_API_QUERY_INVENTORY_SORT_DIRECTION_TYPES": { "ASCENDING": "asc", "DESCENDING": "desc", @@ -460,24 +422,6 @@ exports[`RHSM Constants should have specific properties: all exported constants "QUARTERLY": "Quarterly", "WEEKLY": "Weekly", }, - "RHSM_API_RESPONSE_HOSTS_DATA_TYPES": { - "CLOUD_PROVIDER": "cloud_provider", - "CORES": "cores", - "CORE_HOURS": "core_hours", - "DISPLAY_NAME": "display_name", - "HARDWARE_TYPE": "hardware_type", - "INSTANCE_HOURS": "instance_hours", - "INVENTORY_ID": "inventory_id", - "LAST_SEEN": "last_seen", - "MEASUREMENT_TYPE": "measurement_type", - "NUMBER_OF_GUESTS": "number_of_guests", - "SOCKETS": "sockets", - "SUBSCRIPTION_MANAGER_ID": "subscription_manager_id", - }, - "RHSM_API_RESPONSE_HOSTS_META_TYPES": { - "COUNT": "count", - "PRODUCT": "product", - }, "RHSM_API_RESPONSE_INSTANCES_DATA_TYPES": { "BILLING_ACCOUNT_ID": "billing_account_id", "BILLING_PROVIDER": "billing_provider", @@ -626,16 +570,6 @@ exports[`RHSM Constants should have specific properties: all exported constants "QUARTERLY": "Quarterly", "WEEKLY": "Weekly", }, - "RHSM_API_QUERY_INVENTORY_HOSTS_SORT_TYPES": { - "CORES": "cores", - "CORE_HOURS": "core_hours", - "HARDWARE": "hardware_type", - "INSTANCE_HOURS": "instance_hours", - "LAST_SEEN": "last_seen", - "MEASUREMENT": "measurement_type", - "NAME": "display_name", - "SOCKETS": "sockets", - }, "RHSM_API_QUERY_INVENTORY_SORT_DIRECTION_TYPES": { "ASCENDING": "asc", "DESCENDING": "desc", @@ -746,24 +680,6 @@ exports[`RHSM Constants should have specific properties: all exported constants "QUARTERLY": "Quarterly", "WEEKLY": "Weekly", }, - "RHSM_API_RESPONSE_HOSTS_DATA_TYPES": { - "CLOUD_PROVIDER": "cloud_provider", - "CORES": "cores", - "CORE_HOURS": "core_hours", - "DISPLAY_NAME": "display_name", - "HARDWARE_TYPE": "hardware_type", - "INSTANCE_HOURS": "instance_hours", - "INVENTORY_ID": "inventory_id", - "LAST_SEEN": "last_seen", - "MEASUREMENT_TYPE": "measurement_type", - "NUMBER_OF_GUESTS": "number_of_guests", - "SOCKETS": "sockets", - "SUBSCRIPTION_MANAGER_ID": "subscription_manager_id", - }, - "RHSM_API_RESPONSE_HOSTS_META_TYPES": { - "COUNT": "count", - "PRODUCT": "product", - }, "RHSM_API_RESPONSE_INSTANCES_DATA_TYPES": { "BILLING_ACCOUNT_ID": "billing_account_id", "BILLING_PROVIDER": "billing_provider", @@ -916,16 +832,6 @@ exports[`RHSM Constants should have specific properties: specific constants 1`] "QUARTERLY": "Quarterly", "WEEKLY": "Weekly", }, - "RHSM_API_QUERY_INVENTORY_HOSTS_SORT_TYPES": { - "CORES": "cores", - "CORE_HOURS": "core_hours", - "HARDWARE": "hardware_type", - "INSTANCE_HOURS": "instance_hours", - "LAST_SEEN": "last_seen", - "MEASUREMENT": "measurement_type", - "NAME": "display_name", - "SOCKETS": "sockets", - }, "RHSM_API_QUERY_INVENTORY_SORT_DIRECTION_TYPES": { "ASCENDING": "asc", "DESCENDING": "desc", @@ -1036,24 +942,6 @@ exports[`RHSM Constants should have specific properties: specific constants 1`] "QUARTERLY": "Quarterly", "WEEKLY": "Weekly", }, - "RHSM_API_RESPONSE_HOSTS_DATA_TYPES": { - "CLOUD_PROVIDER": "cloud_provider", - "CORES": "cores", - "CORE_HOURS": "core_hours", - "DISPLAY_NAME": "display_name", - "HARDWARE_TYPE": "hardware_type", - "INSTANCE_HOURS": "instance_hours", - "INVENTORY_ID": "inventory_id", - "LAST_SEEN": "last_seen", - "MEASUREMENT_TYPE": "measurement_type", - "NUMBER_OF_GUESTS": "number_of_guests", - "SOCKETS": "sockets", - "SUBSCRIPTION_MANAGER_ID": "subscription_manager_id", - }, - "RHSM_API_RESPONSE_HOSTS_META_TYPES": { - "COUNT": "count", - "PRODUCT": "product", - }, "RHSM_API_RESPONSE_INSTANCES_DATA_TYPES": { "BILLING_ACCOUNT_ID": "billing_account_id", "BILLING_PROVIDER": "billing_provider", diff --git a/src/services/rhsm/__tests__/__snapshots__/rhsmSchemas.test.js.snap b/src/services/rhsm/__tests__/__snapshots__/rhsmSchemas.test.js.snap index 07582b831..9c01364fd 100644 --- a/src/services/rhsm/__tests__/__snapshots__/rhsmSchemas.test.js.snap +++ b/src/services/rhsm/__tests__/__snapshots__/rhsmSchemas.test.js.snap @@ -5,7 +5,6 @@ exports[`RHSM Schemas should have specific response schemas: specific schemas 1` "capacity": [Function], "errors": [Function], "guests": [Function], - "hosts": [Function], "instances": [Function], "subscriptions": [Function], "tally": [Function], @@ -34,14 +33,6 @@ exports[`RHSM Schemas should have valid schemas that validate API responses: gue } `; -exports[`RHSM Schemas should have valid schemas that validate API responses: hosts response schema 1`] = ` -{ - "data": [], - "links": {}, - "meta": {}, -} -`; - exports[`RHSM Schemas should have valid schemas that validate API responses: instances response schema 1`] = ` { "data": [], diff --git a/src/services/rhsm/__tests__/__snapshots__/rhsmTransformers.test.js.snap b/src/services/rhsm/__tests__/__snapshots__/rhsmTransformers.test.js.snap index 7ae0cd8ec..6b407f73d 100644 --- a/src/services/rhsm/__tests__/__snapshots__/rhsmTransformers.test.js.snap +++ b/src/services/rhsm/__tests__/__snapshots__/rhsmTransformers.test.js.snap @@ -744,34 +744,6 @@ exports[`RHSM Transformers should attempt to parse a tally response: tally, mont } `; -exports[`RHSM Transformers should attempt to parse an hosts response: hosts 1`] = ` -{ - "data": [ - { - "numberOfGuests": 2, - "number_of_guests": 2, - "sockets": 1000, - "subscriptionManagerId": undefined, - "subscription_manager_id": undefined, - }, - ], - "meta": { - "count": 10, - "productId": undefined, - }, -} -`; - -exports[`RHSM Transformers should attempt to parse an hosts response: hosts, failed 1`] = ` -{ - "data": [], - "meta": { - "count": undefined, - "productId": undefined, - }, -} -`; - exports[`RHSM Transformers should attempt to parse an instances response: instances 1`] = ` { "data": [ @@ -880,7 +852,6 @@ exports[`RHSM Transformers should attempt to parse an instances response: instan exports[`RHSM Transformers should have specific response transformers: specific transformers 1`] = ` { - "hosts": [Function], "instances": [Function], "tallyCapacity": [Function], } diff --git a/src/services/rhsm/__tests__/rhsmServices.test.js b/src/services/rhsm/__tests__/rhsmServices.test.js index c2ac69918..ad724bd7c 100644 --- a/src/services/rhsm/__tests__/rhsmServices.test.js +++ b/src/services/rhsm/__tests__/rhsmServices.test.js @@ -5,7 +5,7 @@ describe('RhsmServices', () => { beforeEach(() => { moxios.install(); - moxios.stubRequest(/\/(tally|capacity|hosts|instances|subscriptions|version).*?/, { + moxios.stubRequest(/\/(tally|capacity|instances|subscriptions|version).*?/, { status: 200, responseText: 'success', timeout: 1 @@ -17,16 +17,13 @@ describe('RhsmServices', () => { }); it('should export a specific number of methods and classes', () => { - expect(Object.keys(rhsmServices)).toHaveLength(9); + expect(Object.keys(rhsmServices)).toHaveLength(6); }); it('should have specific methods', () => { expect(rhsmServices.getApiVersion).toBeDefined(); expect(rhsmServices.getGraphCapacity).toBeDefined(); - expect(rhsmServices.getGraphReports).toBeDefined(); expect(rhsmServices.getGraphTally).toBeDefined(); - expect(rhsmServices.getHostsInventory).toBeDefined(); - expect(rhsmServices.getHostsInventoryGuests).toBeDefined(); expect(rhsmServices.getInstancesInventory).toBeDefined(); expect(rhsmServices.getInstancesInventoryGuests).toBeDefined(); expect(rhsmServices.getSubscriptionsInventory).toBeDefined(); diff --git a/src/services/rhsm/__tests__/rhsmTransformers.test.js b/src/services/rhsm/__tests__/rhsmTransformers.test.js index 726c6044c..89dc46955 100644 --- a/src/services/rhsm/__tests__/rhsmTransformers.test.js +++ b/src/services/rhsm/__tests__/rhsmTransformers.test.js @@ -214,24 +214,6 @@ describe('RHSM Transformers', () => { ); }); - it('should attempt to parse an hosts response', () => { - expect(rhsmTransformers.hosts(undefined)).toMatchSnapshot('hosts, failed'); - - expect( - rhsmTransformers.hosts({ - [rhsmConstants.RHSM_API_RESPONSE_DATA]: [ - { - [rhsmConstants.RHSM_API_RESPONSE_HOSTS_DATA_TYPES.NUMBER_OF_GUESTS]: 2, - [rhsmConstants.RHSM_API_RESPONSE_HOSTS_DATA_TYPES.SOCKETS]: 1000 - } - ], - [rhsmConstants.RHSM_API_RESPONSE_META]: { - [rhsmConstants.RHSM_API_RESPONSE_HOSTS_META_TYPES.COUNT]: 10 - } - }) - ).toMatchSnapshot('hosts'); - }); - it('should attempt to parse an instances response', () => { expect(rhsmTransformers.instances(undefined)).toMatchSnapshot('instances, failed'); diff --git a/src/services/rhsm/rhsmConstants.js b/src/services/rhsm/rhsmConstants.js index 52c80b8c9..65aff0b35 100644 --- a/src/services/rhsm/rhsmConstants.js +++ b/src/services/rhsm/rhsmConstants.js @@ -119,43 +119,8 @@ const RHSM_API_RESPONSE_ERRORS_CODE_TYPES = { }; /** - * RHSM response Hosts DATA types. - * - * @type {{MEASUREMENT_TYPE: string, CORES: string, CORE_HOURS: string, HARDWARE_TYPE: string, - * SUBSCRIPTION_MANAGER_ID: string, INSTANCE_HOURS: string, SOCKETS: string, INVENTORY_ID: string, NUMBER_OF_GUESTS: string, - * DISPLAY_NAME: string, CLOUD_PROVIDER: string, LAST_SEEN: string}} - */ -const RHSM_API_RESPONSE_HOSTS_DATA_TYPES = { - CORE_HOURS: 'core_hours', - CORES: 'cores', - CLOUD_PROVIDER: 'cloud_provider', - DISPLAY_NAME: 'display_name', - HARDWARE_TYPE: 'hardware_type', - INSTANCE_HOURS: 'instance_hours', - INVENTORY_ID: 'inventory_id', - LAST_SEEN: 'last_seen', - MEASUREMENT_TYPE: 'measurement_type', - NUMBER_OF_GUESTS: 'number_of_guests', - SOCKETS: 'sockets', - SUBSCRIPTION_MANAGER_ID: 'subscription_manager_id' -}; - -/** - * RHSM response Hosts META types. - * - * @type {{PRODUCT: string, COUNT: string}} - */ -const RHSM_API_RESPONSE_HOSTS_META_TYPES = { - ...RHSM_API_RESPONSE_META_TYPES -}; - -/** - * FixMe: Appears we combined future guests used with instances. Investigate moving "INVENTORY_ID" and "SUBSCRIPTION_MANAGER_ID". - * They're current associated with "hosts" guests. Need to also determine if this is something that needs to be added to "instances" - * or if keeping them added to guests only is enough. - */ -/** - * RHSM response Instance DATA types. + * RHSM combined response Instance and Instance Guests DATA types. + * "INSTANCE_ID" and "SUBSCRIPTION_MANAGER_ID" are associated with instance guests. * * @type {{MEASUREMENTS: string, BILLING_ACCOUNT_ID: string, CATEGORY: string, SUBSCRIPTION_MANAGER_ID: string, * INVENTORY_ID: string, NUMBER_OF_GUESTS: string, BILLING_PROVIDER: string, DISPLAY_NAME: string, CLOUD_PROVIDER: string, @@ -334,27 +299,6 @@ const RHSM_API_QUERY_CATEGORY_TYPES = { const RHSM_API_QUERY_GRANULARITY_TYPES = RHSM_API_RESPONSE_GRANULARITY_TYPES; -/** - * ToDo: Remove RHSM_API_QUERY_INVENTORY_HOSTS_SORT_TYPES once hosts is fully deprecated - * These sort params are focused on the hosts api. - */ -/** - * RHSM API query/search parameter SORT type values for HOSTS. - * - * @type {{CORES: string, CORE_HOURS: string, HARDWARE: string, INSTANCE_HOURS: string, SOCKETS: string, MEASUREMENT: string, - * LAST_SEEN: string, NAME: string}} - */ -const RHSM_API_QUERY_INVENTORY_HOSTS_SORT_TYPES = { - CORES: 'cores', - CORE_HOURS: 'core_hours', - HARDWARE: 'hardware_type', - INSTANCE_HOURS: 'instance_hours', - LAST_SEEN: 'last_seen', - MEASUREMENT: 'measurement_type', - NAME: 'display_name', - SOCKETS: 'sockets' -}; - /** * RHSM API query/search parameter SORT type values for general inventory displays. * @@ -489,45 +433,41 @@ const RHSM_INTERNAL_PRODUCT_DISPLAY_TYPES = { * RHSM_API_RESPONSE_INSTANCES_DATA_TYPES: {MEASUREMENTS: string, BILLING_ACCOUNT_ID: string, CATEGORY: string, * SUBSCRIPTION_MANAGER_ID: string, INVENTORY_ID: string, NUMBER_OF_GUESTS: string, BILLING_PROVIDER: string, DISPLAY_NAME: string, * CLOUD_PROVIDER: string, INSTANCE_ID: string, LAST_SEEN: string}, RHSM_API_RESPONSE_SLA_TYPES: {PREMIUM: string, SELF: string, - * NONE: string, STANDARD: string}, RHSM_API_RESPONSE_HOSTS_META_TYPES: {PRODUCT: string, COUNT: string}, - * RHSM_API_RESPONSE_META_TYPES: {PRODUCT: string, COUNT: string}, RHSM_API_RESPONSE_ERRORS_CODE_TYPES: {GENERIC: string, OPTIN: string}, - * RHSM_API_QUERY_GRANULARITY_TYPES: {WEEKLY: string, QUARTERLY: string, DAILY: string, MONTHLY: string}, - * RHSM_API_RESPONSE_UOM_TYPES: {CORES: string, SOCKETS: string}, RHSM_API_PATH_PRODUCT_VARIANT_RHEL_TYPES: {RHEL_ARM: string, - * RHEL_IBM_Z: string, RHEL_IBM_POWER: string, RHEL_X86: string}, RHSM_API_RESPONSE_SUBSCRIPTIONS_DATA_TYPES: {BILLING_ACCOUNT_ID: string, - * QUANTITY: string, SUBSCRIPTION_MANAGER_ID: string, INVENTORY_ID: string, NUMBER_OF_GUESTS: string, HAS_INFINITE_QUANTITY: string, - * TOTAL_CAPACITY: string, PRODUCT_NAME: string, SERVICE_LEVEL: string, DISPLAY_NAME: string, MEASUREMENTS: string, UOM: string, - * CATEGORY: string, NEXT_EVENT_DATE: string, BILLING_PROVIDER: string, LAST_SEEN: string}, - * RHSM_API_QUERY_INVENTORY_SORT_DIRECTION_TYPES: {ASCENDING: string, DESCENDING: string}, - * RHSM_API_RESPONSE_SUBSCRIPTION_TYPES: {ANNUAL: string, ON_DEMAND: string}, RHSM_API_QUERY_INVENTORY_SORT_TYPES: {CORES: string, - * STORAGE_GIBIBYTES: string, CATEGORY: string, SOCKETS: string, INSTANCE_HOURS: string, NUMBER_OF_GUESTS: string, - * TRANSFER_GIBIBYTES: string, BILLING_PROVIDER: string, CORE_SECONDS: string, STORAGE_GIBIBYTE_MONTHS: string, LAST_SEEN: string, - * NAME: string}, RHSM_API_PATH_PRODUCT_TYPES: {RHEL_ARM: string, OPENSHIFT_METRICS: string, RHEL_WORKSTATION: string, RHODS: string, - * ROSA: string, RHEL_X86: string, RHEL_COMPUTE_NODE: string, OPENSHIFT: string, SATELLITE_SERVER: string, - * OPENSHIFT_DEDICATED_METRICS: string, SATELLITE_CAPSULE: string, RHEL_IBM_Z: string, RHEL_IBM_POWER: string, RHACS: string}, - * RHSM_API_RESPONSE_BILLING_PROVIDER_TYPES: {AZURE: string, GCP: string, RED_HAT: string, NONE: string, AWS: string, ORACLE: string}, - * RHSM_API_RESPONSE_ERRORS_TYPES: {CODE: string}, RHSM_API_RESPONSE_TALLY_CAPACITY_DATA_TYPES: {DATE: string, HAS_DATA: string, - * VALUE: string, HAS_INFINITE_QUANTITY: string}, RHSM_API_RESPONSE_TALLY_CAPACITY_META_TYPES: {TOTAL_MONTHLY: string, DATE: string, - * PRODUCT: string, HAS_CLOUDIGRADE_DATA: string, HAS_CLOUDIGRADE_MISMATCH: string, HAS_DATA: string, METRIC_ID: string, COUNT: string, - * VALUE: string}, RHSM_API_QUERY_BILLING_PROVIDER_TYPES: {AZURE: string, GCP: string, RED_HAT: string, NONE: string, AWS: string, - * ORACLE: string}, RHSM_API_QUERY_CATEGORY_TYPES: {CLOUD: string, PHYSICAL: string, ON_DEMAND: string, HYPERVISOR: string, - * PREPAID: string, VIRTUAL: string}, RHSM_API_QUERY_USAGE_TYPES: {UNSPECIFIED: string, DISASTER: string, DEVELOPMENT: string, - * PRODUCTION: string}, RHSM_API_QUERY_SLA_TYPES: {PREMIUM: string, SELF: string, NONE: string, STANDARD: string}, + * NONE: string, STANDARD: string}, RHSM_API_RESPONSE_META_TYPES: {PRODUCT: string, COUNT: string}, + * RHSM_API_RESPONSE_ERRORS_CODE_TYPES: {GENERIC: string, OPTIN: string}, RHSM_API_QUERY_GRANULARITY_TYPES: {WEEKLY: string, + * QUARTERLY: string, DAILY: string, MONTHLY: string}, RHSM_API_RESPONSE_UOM_TYPES: {CORES: string, SOCKETS: string}, + * RHSM_API_PATH_PRODUCT_VARIANT_RHEL_TYPES: {RHEL_ARM: string, RHEL_IBM_Z: string, RHEL_IBM_POWER: string, RHEL_X86: string}, + * RHSM_API_RESPONSE_SUBSCRIPTIONS_DATA_TYPES: {BILLING_ACCOUNT_ID: string, QUANTITY: string, SUBSCRIPTION_MANAGER_ID: string, + * INVENTORY_ID: string, NUMBER_OF_GUESTS: string, HAS_INFINITE_QUANTITY: string, TOTAL_CAPACITY: string, PRODUCT_NAME: string, + * SERVICE_LEVEL: string, DISPLAY_NAME: string, MEASUREMENTS: string, UOM: string, CATEGORY: string, NEXT_EVENT_DATE: string, + * BILLING_PROVIDER: string, LAST_SEEN: string}, RHSM_API_QUERY_INVENTORY_SORT_DIRECTION_TYPES: {ASCENDING: string, + * DESCENDING: string}, RHSM_API_RESPONSE_SUBSCRIPTION_TYPES: {ANNUAL: string, ON_DEMAND: string}, + * RHSM_API_QUERY_INVENTORY_SORT_TYPES: {CORES: string, STORAGE_GIBIBYTES: string, CATEGORY: string, SOCKETS: string, + * INSTANCE_HOURS: string, NUMBER_OF_GUESTS: string, TRANSFER_GIBIBYTES: string, BILLING_PROVIDER: string, CORE_SECONDS: string, + * STORAGE_GIBIBYTE_MONTHS: string, LAST_SEEN: string, NAME: string}, RHSM_API_PATH_PRODUCT_TYPES: {RHEL_ARM: string, + * OPENSHIFT_METRICS: string, RHEL_WORKSTATION: string, RHODS: string, ROSA: string, RHEL_X86: string, RHEL_COMPUTE_NODE: string, + * OPENSHIFT: string, SATELLITE_SERVER: string, OPENSHIFT_DEDICATED_METRICS: string, SATELLITE_CAPSULE: string, RHEL_IBM_Z: string, + * RHEL_IBM_POWER: string, RHACS: string}, RHSM_API_RESPONSE_BILLING_PROVIDER_TYPES: {AZURE: string, GCP: string, RED_HAT: string, + * NONE: string, AWS: string, ORACLE: string}, RHSM_API_RESPONSE_ERRORS_TYPES: {CODE: string}, + * RHSM_API_RESPONSE_TALLY_CAPACITY_DATA_TYPES: {DATE: string, HAS_DATA: string, VALUE: string, HAS_INFINITE_QUANTITY: string}, + * RHSM_API_RESPONSE_TALLY_CAPACITY_META_TYPES: {TOTAL_MONTHLY: string, DATE: string, PRODUCT: string, HAS_CLOUDIGRADE_DATA: string, + * HAS_CLOUDIGRADE_MISMATCH: string, HAS_DATA: string, METRIC_ID: string, COUNT: string, VALUE: string}, + * RHSM_API_QUERY_BILLING_PROVIDER_TYPES: {AZURE: string, GCP: string, RED_HAT: string, NONE: string, AWS: string, ORACLE: string}, + * RHSM_API_QUERY_CATEGORY_TYPES: {CLOUD: string, PHYSICAL: string, ON_DEMAND: string, HYPERVISOR: string, PREPAID: string, + * VIRTUAL: string}, RHSM_API_QUERY_USAGE_TYPES: {UNSPECIFIED: string, DISASTER: string, DEVELOPMENT: string, PRODUCTION: string}, + * RHSM_API_QUERY_SLA_TYPES: {PREMIUM: string, SELF: string, NONE: string, STANDARD: string}, * RHSM_API_QUERY_SET_INVENTORY_TYPES: {BILLING_ACCOUNT_ID: string, DIRECTION: string, END_DATE: string, SLA: string, LIMIT: string, * START_DATE: string, VARIANT: string, DISPLAY_NAME: string, UOM: string, USAGE: string, CATEGORY: string, SORT: string, - * OFFSET: string, BILLING_PROVIDER: string}, RHSM_API_RESPONSE_HOSTS_DATA_TYPES: {MEASUREMENT_TYPE: string, CORES: string, - * CORE_HOURS: string, HARDWARE_TYPE: string, SUBSCRIPTION_MANAGER_ID: string, INSTANCE_HOURS: string, SOCKETS: string, - * INVENTORY_ID: string, NUMBER_OF_GUESTS: string, DISPLAY_NAME: string, CLOUD_PROVIDER: string, LAST_SEEN: string}, - * RHSM_API_RESPONSE_ERRORS: string, RHSM_API_QUERY_UOM_TYPES: {CORES: string, SOCKETS: string}, RHSM_API_RESPONSE_META: string, - * RHSM_API_RESPONSE_GRANULARITY_TYPES: {WEEKLY: string, QUARTERLY: string, DAILY: string, MONTHLY: string}, - * RHSM_API_QUERY_SET_TYPES: {GRANULARITY: string, BILLING_ACCOUNT_ID: string, DIRECTION: string, END_DATE: string, SLA: string, - * LIMIT: string, START_DATE: string, VARIANT: string, DISPLAY_NAME: string, USE_RUNNING_TOTALS_FORMAT: string, - * BILLING_CATEGORY: string, UOM: string, USAGE: string, CATEGORY: string, SORT: string, OFFSET: string, BILLING_PROVIDER: string}, - * RHSM_API_QUERY_INVENTORY_SUBSCRIPTIONS_SORT_TYPES: {QUANTITY: string, USAGE: string, NEXT_EVENT_TYPE: string, - * NEXT_EVENT_DATE: string, TOTAL_CAPACITY: string, PRODUCT_NAME: string, SKU: string, SERVICE_LEVEL: string}, - * RHSM_INTERNAL_PRODUCT_DISPLAY_TYPES: {CAPACITY: string, LEGACY: string, DUAL_AXES: string, PARTIAL: string, HOURLY: string}, - * RHSM_API_RESPONSE_USAGE_TYPES: {UNSPECIFIED: string, DISASTER: string, DEVELOPMENT: string, PRODUCTION: string}, - * RHSM_API_QUERY_INVENTORY_HOSTS_SORT_TYPES: {CORES: string, CORE_HOURS: string, HARDWARE: string, INSTANCE_HOURS: string, - * SOCKETS: string, MEASUREMENT: string, LAST_SEEN: string, NAME: string}}} + * OFFSET: string, BILLING_PROVIDER: string}, RHSM_API_RESPONSE_ERRORS: string, RHSM_API_QUERY_UOM_TYPES: {CORES: string, + * SOCKETS: string}, RHSM_API_RESPONSE_META: string, RHSM_API_RESPONSE_GRANULARITY_TYPES: {WEEKLY: string, QUARTERLY: string, + * DAILY: string, MONTHLY: string}, RHSM_API_QUERY_SET_TYPES: {GRANULARITY: string, BILLING_ACCOUNT_ID: string, DIRECTION: string, + * END_DATE: string, SLA: string, LIMIT: string, START_DATE: string, VARIANT: string, DISPLAY_NAME: string, + * USE_RUNNING_TOTALS_FORMAT: string, BILLING_CATEGORY: string, UOM: string, USAGE: string, CATEGORY: string, SORT: string, + * OFFSET: string, BILLING_PROVIDER: string}, RHSM_API_QUERY_INVENTORY_SUBSCRIPTIONS_SORT_TYPES: {QUANTITY: string, USAGE: string, + * NEXT_EVENT_TYPE: string, NEXT_EVENT_DATE: string, TOTAL_CAPACITY: string, PRODUCT_NAME: string, SKU: string, + * SERVICE_LEVEL: string}, RHSM_INTERNAL_PRODUCT_DISPLAY_TYPES: {CAPACITY: string, LEGACY: string, DUAL_AXES: string, + * PARTIAL: string, HOURLY: string}, RHSM_API_RESPONSE_USAGE_TYPES: {UNSPECIFIED: string, DISASTER: string, DEVELOPMENT: string, + * PRODUCTION: string}}} */ const rhsmConstants = { RHSM_API_PATH_PRODUCT_TYPES, @@ -540,8 +480,6 @@ const rhsmConstants = { RHSM_API_RESPONSE_ERRORS, RHSM_API_RESPONSE_ERRORS_TYPES, RHSM_API_RESPONSE_ERRORS_CODE_TYPES, - RHSM_API_RESPONSE_HOSTS_DATA_TYPES, - RHSM_API_RESPONSE_HOSTS_META_TYPES, RHSM_API_RESPONSE_INSTANCES_DATA_TYPES, RHSM_API_RESPONSE_INSTANCES_META_TYPES, RHSM_API_RESPONSE_SUBSCRIPTIONS_DATA_TYPES, @@ -556,7 +494,6 @@ const rhsmConstants = { RHSM_API_RESPONSE_USAGE_TYPES, RHSM_API_QUERY_CATEGORY_TYPES, RHSM_API_QUERY_GRANULARITY_TYPES, - RHSM_API_QUERY_INVENTORY_HOSTS_SORT_TYPES, RHSM_API_QUERY_INVENTORY_SORT_TYPES, RHSM_API_QUERY_INVENTORY_SORT_DIRECTION_TYPES, RHSM_API_QUERY_INVENTORY_SUBSCRIPTIONS_SORT_TYPES, @@ -583,8 +520,6 @@ export { RHSM_API_RESPONSE_ERRORS, RHSM_API_RESPONSE_ERRORS_TYPES, RHSM_API_RESPONSE_ERRORS_CODE_TYPES, - RHSM_API_RESPONSE_HOSTS_DATA_TYPES, - RHSM_API_RESPONSE_HOSTS_META_TYPES, RHSM_API_RESPONSE_INSTANCES_DATA_TYPES, RHSM_API_RESPONSE_INSTANCES_META_TYPES, RHSM_API_RESPONSE_SUBSCRIPTIONS_DATA_TYPES, @@ -599,7 +534,6 @@ export { RHSM_API_RESPONSE_USAGE_TYPES, RHSM_API_QUERY_CATEGORY_TYPES, RHSM_API_QUERY_GRANULARITY_TYPES, - RHSM_API_QUERY_INVENTORY_HOSTS_SORT_TYPES, RHSM_API_QUERY_INVENTORY_SORT_TYPES, RHSM_API_QUERY_INVENTORY_SORT_DIRECTION_TYPES, RHSM_API_QUERY_INVENTORY_SUBSCRIPTIONS_SORT_TYPES, diff --git a/src/services/rhsm/rhsmSchemas.js b/src/services/rhsm/rhsmSchemas.js index e58d131a4..6d1ce2f22 100644 --- a/src/services/rhsm/rhsmSchemas.js +++ b/src/services/rhsm/rhsmSchemas.js @@ -122,42 +122,6 @@ const guestsResponseSchema = Joi.object().keys({ meta: guestsMetaSchema.default({}) }); -/** - * Hosts response meta field. - * - * @type {*} Joi schema - */ -const hostsMetaSchema = metaResponseSchema; - -/** - * Hosts response item. - * - * @type {*} Joi schema - */ -const hostsItem = Joi.object({ - cloud_provider: Joi.string().lowercase().optional().allow(null), - display_name: Joi.string().optional().allow(null), - hardware_type: Joi.string().lowercase().optional().allow(null), - inventory_id: Joi.string().optional().allow(null), - measurement_type: Joi.string().lowercase().optional().allow(null), - number_of_guests: Joi.number().integer().default(0), - subscription_manager_id: Joi.string().optional().allow(null), - last_seen: Joi.date().utc().allow(null) -}) - .unknown(true) - .default(); - -/** - * Hosts response. - * - * @type {*} Joi schema - */ -const hostsResponseSchema = Joi.object().keys({ - data: Joi.array().items(hostsItem).default([]), - links: linksSchema.default({}), - meta: hostsMetaSchema.default({}) -}); - /** * Instances response meta field. * @@ -285,7 +249,6 @@ const rhsmSchemas = { capacity: response => schemaResponse({ response, schema: capacityResponseSchema, id: 'RHSM capacity' }), errors: response => schemaResponse({ response, schema: errorResponseSchema, id: 'RHSM errors' }), guests: response => schemaResponse({ response, schema: guestsResponseSchema, id: 'RHSM guests' }), - hosts: response => schemaResponse({ response, schema: hostsResponseSchema, id: 'RHSM hosts' }), instances: response => schemaResponse({ response, schema: instancesResponseSchema, id: 'RHSM instances' }), subscriptions: response => schemaResponse({ response, schema: subscriptionsResponseSchema, id: 'RHSM subscriptions' }), diff --git a/src/services/rhsm/rhsmServices.js b/src/services/rhsm/rhsmServices.js index 57eabed8b..53e500c82 100644 --- a/src/services/rhsm/rhsmServices.js +++ b/src/services/rhsm/rhsmServices.js @@ -68,707 +68,6 @@ const getApiVersion = (options = {}) => { }); }; -/** - * @apiMock {DelayResponse} 250 - * @apiMock {RandomSuccess} - * @api {get} /api/rhsm-subscriptions/v1/tally/products/:product_id Get RHSM graph data - * @apiDescription Retrieve graph data. - * - * Reference [RHSM for report params and commands](https://github.com/RedHatInsights/rhsm-subscriptions/blob/main/api/rhsm-subscriptions-api-spec.yaml) - * - * @apiParam {string} product_id The ID for the product we wish to query. - * - RHEL - * - * @apiParam (Query string) {string} granularity The level of granularity to return. - * - DAILY - * - WEEKLY - * - MONTHLY - * - QUARTERLY - * - YEARLY - * @apiParam (Query string) {Date} beginning Defines the start of the report period. Dates should be provided in ISO 8601 format but the only accepted offset is UTC. E.g. 2017-07-21T17:32:28Z - * @apiParam (Query string) {Date} ending Defines the end of the report period. Defaults to the current time. Dates should be provided in UTC. - * @apiParam (Query string) {Number} [limit] The numbers of items to return. - * @apiParam (Query string) {Number} [offset] The number of items to skip before starting to collect the result set. - * - * @apiSuccess {Array} data - * @apiSuccess {object} links - * @apiSuccess {object} meta - * @apiSuccess {string} meta.granularity - * - DAILY - * - WEEKLY - * - MONTHLY - * - QUARTERLY - * - YEARLY - * @apiSuccess {string} meta.product - * - RHEL - * @apiSuccess {number} meta.resultSetSize - * - * @apiSuccessExample {json} DAILY, Success-Response: - * HTTP/1.1 200 OK - * { - * "data": [ - * { - * "date": "2020-07-01T00:00:00Z", - * "sockets": 50, - * "physical_sockets": 50, - * "hypervisor_sockets": 0, - * "has_data": true, - * "cloud_sockets": 80, - * "core_hours": 0, - * "instance_hours": 3 - * }, - * { - * "date": "2020-07-02T00:00:00Z", - * "sockets": 50, - * "physical_sockets": 50, - * "hypervisor_sockets": 0, - * "has_data": true, - * "cloud_sockets": 80, - * "core_hours": 10, - * "instance_hours": 2 - * }, - * { - * "date": "2020-07-03T00:00:00Z", - * "sockets": 50, - * "physical_sockets": 50, - * "hypervisor_sockets": 0, - * "has_data": true, - * "cloud_sockets": 80, - * "core_hours": 10, - * "instance_hours": 12 - * }, - * { - * "date": "2020-07-04T00:00:00Z", - * "sockets": 50, - * "physical_sockets": 50, - * "hypervisor_sockets": 0, - * "has_data": true, - * "cloud_sockets": 80, - * "core_hours": 10, - * "instance_hours": 4 - * }, - * { - * "date": "2020-07-05T00:00:00Z", - * "sockets": 50, - * "physical_sockets": 50, - * "hypervisor_sockets": 0, - * "has_data": false, - * "cloud_sockets": 20, - * "core_hours": 10, - * "instance_hours": 1 - * }, - * { - * "date": "2020-07-06T00:00:00Z", - * "sockets": 50, - * "physical_sockets": 50, - * "hypervisor_sockets": 0, - * "has_data": true, - * "cloud_sockets": 20, - * "core_hours": 1000.057890, - * "instance_hours": 2 - * }, - * { - * "date": "2020-07-07T00:00:00Z", - * "sockets": 50, - * "physical_sockets": 50, - * "hypervisor_sockets": 0, - * "has_data": false, - * "cloud_sockets": 20, - * "core_hours": 1000, - * "instance_hours": 2 - * }, - * { - * "date": "2020-07-08T00:00:00Z", - * "sockets": 50, - * "physical_sockets": 50, - * "hypervisor_sockets": 0, - * "has_data": false, - * "cloud_sockets": 20, - * "core_hours": 1000, - * "instance_hours": 3 - * }, - * { - * "date": "2020-07-09T00:00:00Z", - * "sockets": 50, - * "physical_sockets": 50, - * "hypervisor_sockets": 0, - * "has_data": false, - * "cloud_sockets": 20, - * "core_hours": 1000, - * "instance_hours": 3 - * }, - * { - * "date": "2020-07-10T00:00:00Z", - * "sockets": 50, - * "physical_sockets": 50, - * "hypervisor_sockets": 0, - * "has_data": false, - * "cloud_sockets": 20, - * "core_hours": null, - * "instance_hours": 3 - * }, - * { - * "date": "2020-07-11T00:00:00Z", - * "sockets": 50, - * "physical_sockets": 50, - * "hypervisor_sockets": 0, - * "has_data": false, - * "cloud_sockets": 20, - * "core_hours": null - * }, - * { - * "date": "2020-07-12T00:00:00Z", - * "sockets": 50, - * "physical_sockets": 50, - * "hypervisor_sockets": 0, - * "has_data": false, - * "cloud_sockets": 20, - * "core_hours": null, - * "instance_hours": 0 - * }, - * { - * "date": "2020-07-13T00:00:00Z", - * "sockets": 50, - * "physical_sockets": 50, - * "hypervisor_sockets": 0, - * "has_data": false, - * "cloud_sockets": 20, - * "core_hours": null, - * "instance_hours": 0 - * }, - * { - * "date": "2020-07-14T00:00:00Z", - * "sockets": 50, - * "physical_sockets": 50, - * "hypervisor_sockets": 0, - * "has_data": false, - * "cloud_sockets": 20, - * "core_hours": null, - * "instance_hours": 0 - * }, - * { - * "date": "2020-07-15T00:00:00Z", - * "sockets": 50, - * "physical_sockets": 50, - * "hypervisor_sockets": 0, - * "has_data": false, - * "cloud_sockets": 20, - * "core_hours": null, - * "instance_hours": 0 - * }, - * { - * "date": "2020-07-16T00:00:00Z", - * "sockets": 50, - * "physical_sockets": 50, - * "hypervisor_sockets": 0, - * "has_data": false, - * "cloud_sockets": 20, - * "core_hours": null, - * "instance_hours": 0 - * }, - * { - * "date": "2020-07-17T00:00:00Z", - * "sockets": 50, - * "physical_sockets": 50, - * "hypervisor_sockets": 0, - * "has_data": false, - * "cloud_sockets": 20, - * "core_hours": null, - * "instance_hours": 0 - * }, - * { - * "date": "2020-07-18T00:00:00Z", - * "sockets": 50, - * "physical_sockets": 50, - * "hypervisor_sockets": 0, - * "has_data": true, - * "cloud_sockets": 20, - * "core_hours": null, - * "instance_hours": 0 - * }, - * { - * "date": "2020-07-19T00:00:00Z", - * "sockets": 50, - * "physical_sockets": 50, - * "hypervisor_sockets": 0, - * "has_data": true, - * "cloud_sockets": 20, - * "core_hours": null, - * "instance_hours": 0 - * }, - * { - * "date": "2020-07-20T00:00:00Z", - * "sockets": 0, - * "physical_sockets": 0, - * "hypervisor_sockets": 0, - * "has_data": true, - * "cloud_sockets": 20, - * "core_hours": null, - * "instance_hours": 0 - * }, - * { - * "date": "2020-07-21T00:00:00Z", - * "sockets": 24, - * "physical_sockets": 24, - * "hypervisor_sockets": 0, - * "has_data": true, - * "cloud_sockets": 20, - * "core_hours": null, - * "instance_hours": 0 - * }, - * { - * "date": "2020-07-22T00:00:00Z", - * "sockets": 0, - * "physical_sockets": 0, - * "hypervisor_sockets": 0, - * "has_data": false, - * "cloud_sockets": 0, - * "core_hours": null, - * "instance_hours": 0 - * }, - * { - * "date": "2020-07-23T00:00:00Z", - * "sockets": 0, - * "physical_sockets": 0, - * "hypervisor_sockets": 0, - * "has_data": false, - * "cloud_sockets": 0, - * "core_hours": null, - * "instance_hours": 0 - * }, - * { - * "date": "2020-07-24T00:00:00Z", - * "sockets": 76, - * "physical_sockets": 36, - * "hypervisor_sockets": 40, - * "has_data": true, - * "cloud_sockets": 0, - * "core_hours": null, - * "instance_hours": 0 - * }, - * { - * "date": "2020-07-25T00:00:00Z", - * "sockets": 90, - * "physical_sockets": 40, - * "hypervisor_sockets": 50, - * "has_data": true, - * "cloud_sockets": 0, - * "core_hours": null, - * "instance_hours": 0 - * }, - * { - * "date": "2020-07-26T00:00:00Z", - * "sockets": 104, - * "physical_sockets": 44, - * "hypervisor_sockets": 60, - * "has_data": true, - * "cloud_sockets": 0, - * "core_hours": null, - * "instance_hours": 0 - * }, - * { - * "date": "2020-07-27T00:00:00Z", - * "sockets": 78, - * "physical_sockets": 48, - * "hypervisor_sockets": 30, - * "has_data": true, - * "cloud_sockets": 0, - * "core_hours": null, - * "instance_hours": 0 - * }, - * { - * "date": "2020-07-28T00:00:00Z", - * "sockets": 82, - * "physical_sockets": 52, - * "hypervisor_sockets": 30, - * "has_data": true, - * "cloud_sockets": 0, - * "core_hours": null, - * "instance_hours": 0 - * }, - * { - * "date": "2020-07-29T00:00:00Z", - * "sockets": 86, - * "physical_sockets": 56, - * "hypervisor_sockets": 30, - * "has_data": true, - * "cloud_sockets": 60, - * "core_hours": null, - * "instance_hours": 0 - * }, - * { - * "date": "2020-07-30T00:00:00Z", - * "sockets": 90, - * "physical_sockets": 60, - * "hypervisor_sockets": 30, - * "has_data": true, - * "cloud_sockets": 40, - * "core_hours": null, - * "instance_hours": 0 - * }, - * { - * "date": "2020-07-31T00:00:00Z", - * "sockets": 144, - * "physical_sockets": 64, - * "hypervisor_sockets": 80, - * "has_data": true, - * "cloud_sockets": 40, - * "core_hours": null, - * "has_cloudigrade_data": true, - * "has_cloudigrade_mismatch": true, - * "instance_hours": 0 - * } - * ], - * "links": { - * "first": "/api/rhsm-subscriptions/v1/tally/products/RHEL?granularity=daily&beginning=2020-07-20T00:00:00.000Z&ending=2020-08-19T23:59:59.999Z&offset=0", - * "last": "/api/rhsm-subscriptions/v1/tally/products/RHEL?granularity=daily&beginning=2020-07-20T00:00:00.000Z&ending=2020-08-19T23:59:59.999Z&offset=0" - * }, - * "meta": { - * "count": 12, - * "product": "RHEL", - * "granularity": "daily", - * "total_core_hours": 30500.04, - * "total_instance_hours": 35 - * } - * } - * - * @apiSuccessExample {json} WEEKLY, Success-Response: - * HTTP/1.1 200 OK - * { - * "data": [ - * { - * "date": "2020-05-19T00:00:00Z", - * "sockets": 86, - * "physical_sockets": 56, - * "hypervisor_sockets": 30, - * "has_data": true, - * "cloud_sockets": 60, - * "core_hours": 10.20, - * "instance_hours": 1 - * }, - * { - * "date": "2020-05-26T00:00:00Z", - * "sockets": 86, - * "physical_sockets": 56, - * "hypervisor_sockets": 30, - * "has_data": true, - * "cloud_sockets": 60, - * "core_hours": 10.15, - * "instance_hours": 1 - * }, - * { - * "date": "2020-06-02T00:00:00Z", - * "sockets": 86, - * "physical_sockets": 56, - * "hypervisor_sockets": 30, - * "has_data": true, - * "cloud_sockets": 60, - * "core_hours": 10.11, - * "instance_hours": 1 - * }, - * { - * "date": "2020-06-09T00:00:00Z", - * "sockets": 86, - * "physical_sockets": 56, - * "hypervisor_sockets": 30, - * "has_data": true, - * "cloud_sockets": 60, - * "core_hours": 2000.32, - * "instance_hours": 23 - * }, - * { - * "date": "2020-06-16T00:00:00Z", - * "sockets": 86, - * "physical_sockets": 56, - * "hypervisor_sockets": 30, - * "has_data": true, - * "cloud_sockets": 60, - * "core_hours": 2000.42, - * "instance_hours": 0 - * }, - * { - * "date": "2020-06-23T00:00:00Z", - * "sockets": 86, - * "physical_sockets": 56, - * "hypervisor_sockets": 30, - * "has_data": true, - * "cloud_sockets": 60, - * "core_hours": 999.06, - * "instance_hours": 0 - * }, - * { - * "date": "2020-06-30T00:00:00Z", - * "sockets": 86, - * "physical_sockets": 56, - * "hypervisor_sockets": 30, - * "has_data": true, - * "cloud_sockets": 60, - * "core_hours": null, - * "instance_hours": 0 - * }, - * { - * "date": "2020-07-07T00:00:00Z", - * "sockets": 86, - * "physical_sockets": 56, - * "hypervisor_sockets": 30, - * "has_data": true, - * "cloud_sockets": 60, - * "core_hours": null, - * "instance_hours": 0 - * }, - * { - * "date": "2020-07-14T00:00:00Z", - * "sockets": 86, - * "physical_sockets": 56, - * "hypervisor_sockets": 30, - * "has_data": true, - * "cloud_sockets": 60, - * "core_hours": null, - * "instance_hours": 0 - * }, - * { - * "date": "2020-07-21T00:00:00Z", - * "sockets": 86, - * "physical_sockets": 56, - * "hypervisor_sockets": 30, - * "has_data": true, - * "cloud_sockets": 60, - * "core_hours": null, - * "instance_hours": 0 - * }, - * { - * "date": "2020-07-28T00:00:00Z", - * "sockets": 86, - * "physical_sockets": 56, - * "hypervisor_sockets": 30, - * "has_data": true, - * "cloud_sockets": 60, - * "core_hours": null, - * "instance_hours": 0 - * }, - * { - * "date": "2020-08-04T00:00:00Z", - * "sockets": 86, - * "physical_sockets": 56, - * "hypervisor_sockets": 30, - * "has_data": true, - * "cloud_sockets": 60, - * "core_hours": null, - * "instance_hours": 0 - * } - * ], - * "links": { - * "first": "/api/rhsm-subscriptions/v1/tally/products/RHEL?granularity=weekly&beginning=2020-05-26T00:00:00.000Z&ending=2020-08-19T23:59:59.999Z&offset=0", - * "last": "/api/rhsm-subscriptions/v1/tally/products/RHEL?granularity=weekly&beginning=2020-05-26T00:00:00.000Z&ending=2020-08-19T23:59:59.999Z&offset=0" - * }, - * "meta": { - * "count": 10, - * "product": "RHEL", - * "granularity": "weekly", - * "total_core_hours": 200.03, - * "total_instance_hours": 26 - * } - * } - * - * @apiSuccessExample {json} MONTHLY, Success-Response: - * HTTP/1.1 200 OK - * { - * "data": [ - * { - * "date": "2019-08-01T00:00:00Z", - * "sockets": 100, - * "physical_sockets": 25, - * "hypervisor_sockets": 50, - * "has_data": true, - * "cloud_sockets": 25, - * "core_hours": 200, - * "instance_hours": 0 - * }, - * { - * "date": "2019-09-01T00:00:00Z", - * "sockets": 100, - * "physical_sockets": 25, - * "hypervisor_sockets": 50, - * "has_data": true, - * "cloud_sockets": 25, - * "core_hours": 200, - * "instance_hours": 0 - * }, - * { - * "date": "2019-10-01T00:00:00Z", - * "sockets": 100, - * "physical_sockets": 25, - * "hypervisor_sockets": 50, - * "has_data": true, - * "cloud_sockets": 25, - * "core_hours": 400, - * "instance_hours": 0 - * }, - * { - * "date": "2019-11-01T00:00:00Z", - * "sockets": 0, - * "physical_sockets": 0, - * "hypervisor_sockets": null, - * "has_data": false, - * "cloud_sockets": 0, - * "core_hours": 0, - * "instance_hours": 0 - * }, - * { - * "date": "2019-12-01T00:00:00Z", - * "sockets": 0, - * "physical_sockets": 0, - * "hypervisor_sockets": null, - * "has_data": false, - * "cloud_sockets": 0, - * "core_hours": 0, - * "instance_hours": 0 - * }, - * { - * "date": "2020-01-01T00:00:00Z", - * "sockets": 0, - * "physical_sockets": 0, - * "hypervisor_sockets": null, - * "has_data": false, - * "cloud_sockets": 0, - * "core_hours": 0, - * "instance_hours": 0 - * }, - * { - * "date": "2020-02-01T00:00:00Z", - * "sockets": 0, - * "physical_sockets": 0, - * "hypervisor_sockets": null, - * "has_data": false, - * "cloud_sockets": 0, - * "core_hours": 0, - * "instance_hours": 0 - * }, - * { - * "date": "2020-03-01T00:00:00Z", - * "sockets": 3000, - * "physical_sockets": 500, - * "hypervisor_sockets": 2000, - * "has_data": true, - * "cloud_sockets": 500 - * }, - * { - * "date": "2020-04-01T00:00:00Z", - * "sockets": 2600, - * "physical_sockets": 100, - * "hypervisor_sockets": 2000, - * "has_data": true, - * "cloud_sockets": 500 - * }, - * { - * "date": "2020-05-01T00:00:00Z", - * "sockets": 3000, - * "physical_sockets": 500, - * "hypervisor_sockets": 2000, - * "has_data": true, - * "cloud_sockets": 500 - * }, - * { - * "date": "2020-06-01T00:00:00Z", - * "sockets": 3000, - * "physical_sockets": 500, - * "hypervisor_sockets": 2000, - * "has_data": true, - * "cloud_sockets": 500 - * }, - * { - * "date": "2020-07-01T00:00:00Z", - * "sockets": 3000, - * "physical_sockets": 500, - * "hypervisor_sockets": 2000, - * "has_data": true, - * "cloud_sockets": 500 - * }, - * { - * "date": "2020-08-01T00:00:00Z", - * "sockets": 2600, - * "physical_sockets": 100, - * "hypervisor_sockets": 2000, - * "has_data": true, - * "cloud_sockets": 500 - * } - * ], - * "links": { - * "first": "/api/rhsm-subscriptions/v1/tally/products/RHEL?granularity=monthly&beginning=2019-08-01T00:00:00.000Z&ending=2020-08-19T23:59:59.999Z&offset=0", - * "last": "/api/rhsm-subscriptions/v1/tally/products/RHEL?granularity=monthly&beginning=2019-08-01T00:00:00.000Z&ending=2020-08-19T23:59:59.999Z&offset=0" - * }, - * "meta": { - * "count": 6, - * "product": "RHEL", - * "granularity": "monthly", - * "total_core_hours": 2050.04 - * } - * } - * - * - * @apiError {Array} errors - * @apiErrorExample {json} Error-Response: - * HTTP/1.1 403 Forbidden - * { - * "errors": [ - * { - * "code": "SUBSCRIPTIONS1004", - * "detail": "Opt-in required.", - * "status": "403", - * "title": "Access Denied" - * } - * ] - * } - * @apiError {Array} errors - * @apiErrorExample {json} Error-Response: - * HTTP/1.1 404 Internal Server Error - * { - * "errors": [ - * { - * "status": "string", - * "code": "string", - * "title": "string", - * "detail": "string" - * } - * ] - * } - * @apiError {Array} errors - * @apiErrorExample {json} Error-Response: - * HTTP/1.1 500 Internal Server Error - * { - * "errors": [ - * { - * "status": "string", - * "code": "string", - * "title": "string", - * "detail": "string" - * } - * ] - * } - */ -/** - * Get RHSM API reporting/tally graph/chart data. - * - * @deprecated The graph reports Tally call is replaced by independent Tally and Capacity metric calls. - * @param {string} id Product ID - * @param {object} params Query/search params - * @param {object} options - * @param {boolean} options.cancel - * @param {string} options.cancelId - * @returns {Promise<*>} - */ -const getGraphReports = (id, params = {}, options = {}) => { - const { cache = true, cancel = true, cancelId } = options; - const updatedId = rhsmHelpers.filterArchitectureVariant(id, params); - return serviceCall({ - url: `${process.env.REACT_APP_SERVICES_RHSM_REPORT}${updatedId}`, - params, - cache, - cancel, - cancelId - }); -}; - /** * @apiMock {DelayResponse} 2000 * @apiMock {RandomSuccess} @@ -2226,362 +1525,6 @@ const getGraphCapacity = (id, params = {}, options = {}) => { }); }; -/** - * @apiMock {DelayResponse} 500 - * @api {get} /api/rhsm-subscriptions/v1/hosts/products/:product_id Get RHSM hosts/systems table/inventory data - * @apiDescription Retrieve hosts/systems table/inventory data. - * - * Reference [RHSM for hosts/system table/inventory](https://github.com/RedHatInsights/rhsm-subscriptions/blob/main/api/rhsm-subscriptions-api-spec.yaml) - * - * @apiSuccessExample {json} Success-Response: - * HTTP/1.1 200 OK - * { - * "data" : [ - * { - * "insights_id": "498cff02-8b4b-46f8-a655-123456789012", - * "inventory_id": "498cff02-8b4b-46f8-a655-123456789012", - * "display_name": "ipsum.example.com", - * "subscription_manager_id": "b6028fa4-cd26-449a-b122-123456789012", - * "cores": 4, - * "core_hours": 10.05, - * "sockets": 2, - * "hardware_type": "VIRTUALIZED", - * "measurement_type": "VIRTUAL", - * "number_of_guests": 70, - * "last_seen": "2020-04-01T00:00:00Z" - * }, - * { - * "insights_id": "499cff02-8b4b-46f8-a6xx-X3bXe4XXfD6N", - * "inventory_id": "499cff02-8b4b-46f8-a6xx-X3bXe4XXfD6N", - * "subscription_manager_id": "b6028fa4-cd26-449a-b123-X3bXe4XXfD6N", - * "cloud_provider": "AZURE", - * "cores": 4, - * "core_hours": 10.00, - * "sockets": 6, - * "hardware_type": "CLOUD", - * "measurement_type": "CLOUD", - * "number_of_guests": 0, - * "last_seen": "2020-06-20T00:00:00Z" - * }, - * { - * "insights_id": "498cff02-8b4b-46f8-a655-X3bXe4XXfD6M", - * "inventory_id": "498cff02-8b4b-46f8-a655-X3bXe4XXfD6M", - * "display_name": "dolor.example.com", - * "subscription_manager_id": "b6028fa4-cd26-449a-b122-X3bXe4XXfD6M", - * "cores": 4, - * "core_hours": 1000.20, - * "sockets": 2, - * "hardware_type": "VIRTUALIZED", - * "measurement_type": "VIRTUAL", - * "number_of_guests": 10, - * "last_seen": "2020-04-02T00:00:00Z" - * }, - * { - * "insights_id": "498cff02-8b4b-46f8-a655-X3bXe4XXfD6L", - * "inventory_id": "498cff02-8b4b-46f8-a655-X3bXe4XXfD6L", - * "display_name": "dolor.again.com", - * "subscription_manager_id": "b6028fa4-cd26-449a-b122-X3bXe4XXfD6L", - * "cores": 4, - * "core_hours": 1001.60, - * "sockets": 2, - * "hardware_type": "VIRTUALIZED", - * "measurement_type": "VIRTUAL", - * "number_of_guests": 1, - * "last_seen": "2020-04-02T00:00:00Z" - * }, - * { - * "insights_id": "499cff02-8b4b-46f8-a6xx-X3bXe4XXfD6YX", - * "inventory_id": "499cff02-8b4b-46f8-a6xx-X3bXe4XXfD6YX", - * "display_name": "lorem.test.com", - * "subscription_manager_id": "b6028fa4-cd26-449a-b123-X3bXe4XXfD6YX", - * "cores": 4, - * "core_hours": 999.60, - * "sockets": 6, - * "hardware_type": "PHYSICAL", - * "measurement_type": "HYPERVISOR", - * "number_of_guests": 0, - * "last_seen": "2020-06-20T00:00:00Z" - * }, - * { - * "insights_id": "499cff02-8b4b-46f8-a6xx-X3bXe4XXfD6YZ", - * "inventory_id": "499cff02-8b4b-46f8-a6xx-X3bXe4XXfD6YZ", - * "display_name": "lorem.again.com", - * "subscription_manager_id": "b6028fa4-cd26-449a-b123-X3bXe4XXfD6YZ", - * "cores": 0, - * "core_hours": 0, - * "sockets": 6, - * "hardware_type": "PHYSICAL", - * "measurement_type": "PHYSICAL", - * "number_of_guests": 0, - * "last_seen": "2020-06-20T00:00:00Z" - * }, - * { - * "insights_id": "499cff02-8b4b-46f8-a6xx-X3bXe4XXfD6YA", - * "inventory_id": "499cff02-8b4b-46f8-a6xx-X3bXe4XXfD6YA", - * "display_name": "lorem.another.com", - * "subscription_manager_id": "b6028fa4-cd26-449a-b123-X3bXe4XXfD6YA", - * "cores": 0, - * "core_hours": 0.01, - * "sockets": 6, - * "hardware_type": "PHYSICAL", - * "measurement_type": "PHYSICAL", - * "number_of_guests": 0, - * "last_seen": "2020-06-21T00:00:00Z" - * }, - * { - * "insights_id": "499cff02-8b4b-46f8-a6xx-X3bXe4XXfD6YB", - * "inventory_id": "499cff02-8b4b-46f8-a6xx-X3bXe4XXfD6YB", - * "subscription_manager_id": "b6028fa4-cd26-449a-b123-X3bXe4XXfD6YB", - * "cores": 0, - * "core_hours": 999.61, - * "sockets": 6, - * "hardware_type": "PHYSICAL", - * "measurement_type": "PHYSICAL", - * "number_of_guests": 0, - * "last_seen": "2020-06-22T00:00:00Z" - * }, - * { - * "insights_id": "499cff02-8b4b-46f8-a6xx-X3bXe4XXfD6YC", - * "inventory_id": "499cff02-8b4b-46f8-a6xx-X3bXe4XXfD6YC", - * "subscription_manager_id": "b6028fa4-cd26-449a-b123-X3bXe4XXfD6YC", - * "cores": 3, - * "sockets": 1, - * "hardware_type": "PHYSICAL", - * "measurement_type": "HYPERVISOR", - * "number_of_guests": 0, - * "last_seen": "2020-06-23T00:00:00Z" - * }, - * { - * "insights_id": "499cff02-8b4b-46f8-a6xx-X3bXe4XXfD6YD", - * "inventory_id": "499cff02-8b4b-46f8-a6xx-X3bXe4XXfD6YD", - * "subscription_manager_id": "b6028fa4-cd26-449a-b123-X3bXe4XXfD6YD", - * "cores": 3, - * "sockets": 1, - * "hardware_type": "PHYSICAL", - * "measurement_type": "HYPERVISOR", - * "number_of_guests": 0, - * "last_seen": "2020-06-24T00:00:00Z" - * }, - * { - * "insights_id": "499cff02-8b4b-46f8-a6xx-X3bXe4XXfD6YEE", - * "inventory_id": "499cff02-8b4b-46f8-a6xx-X3bXe4XXfD6YEE", - * "subscription_manager_id": "b6028fa4-cd26-449a-b123-X3bXe4XXfD6YEE", - * "cores": 3, - * "sockets": 0, - * "hardware_type": "PHYSICAL", - * "measurement_type": "HYPERVISOR", - * "number_of_guests": 0, - * "last_seen": "2020-06-26T00:00:00Z" - * }, - * { - * "insights_id": "499cff02-8b4b-46f8-a6xx-X3bXe4XXfD6YF", - * "inventory_id": "499cff02-8b4b-46f8-a6xx-X3bXe4XXfD6YF", - * "subscription_manager_id": "b6028fa4-cd26-449a-b123-X3bXe4XXfD6YF", - * "cores": 3, - * "sockets": 0, - * "hardware_type": "PHYSICAL", - * "measurement_type": "HYPERVISOR", - * "number_of_guests": 0, - * "last_seen": "2020-06-29T00:00:00Z" - * } - * ], - * "links": { - * "first": "/api/rhsm-subscriptions/v1/hosts/RHEL?granularity=DAILY&sla=Premium&usage=Production&offset=0&limit=5", - * "last": "/api/rhsm-subscriptions/v1/hosts/RHEL?granularity=DAILY&sla=Premium&usage=Production&offset=5&limit=5", - * "previous": null, - * "next": "/api/rhsm-subscriptions/v1/hosts/RHEL?granularity=DAILY&sla=Premium&usage=Production&offset=5&limit=5" - * }, - * "meta": { - * "count": 11 - * } - * } - * - * @apiError {Array} errors - * @apiErrorExample {json} Error-Response: - * HTTP/1.1 500 Internal Server Error - * { - * "errors": [ - * { - * "status": "string", - * "code": "string", - * "title": "string", - * "detail": "string" - * } - * ] - * } - */ -/** - * Get RHSM API hosts table/inventory data. - * - * @deprecated The Hosts inventory response is being replaced in favor of the Instances inventory response. - * @param {string} id Product ID - * @param {object} params Query/search params - * @param {object} options - * @param {boolean} options.cancel - * @param {string} options.cancelId - * @returns {Promise<*>} - */ -const getHostsInventory = (id, params = {}, options = {}) => { - const { - cache = true, - cancel = true, - cancelId, - schema = [rhsmSchemas.hosts, rhsmSchemas.errors], - transform = [rhsmTransformers.hosts] - } = options; - const updatedId = rhsmHelpers.filterArchitectureVariant(id, params); - return serviceCall({ - url: `${process.env.REACT_APP_SERVICES_RHSM_INVENTORY}${updatedId}`, - params, - cache, - cancel, - cancelId, - schema, - transform - }); -}; - -/** - * @apiMock {DelayResponse} 250 - * @api {get} /api/rhsm-subscriptions/v1/hosts/:hypervisor_uuid/guests Get RHSM hosts/systems table/inventory guests data - * @apiDescription Retrieve hosts/systems table/inventory guests data. - * - * Reference [RHSM for hosts/system table/inventory](https://github.com/RedHatInsights/rhsm-subscriptions/blob/main/api/rhsm-subscriptions-api-spec.yaml) - * - * @apiSuccessExample {json} Success-Response: - * HTTP/1.1 200 OK - * { - * "data" : [ - * { - * "insights_id": "d6214a0b-b344-4778-831c-d53dcacb2da3", - * "inventory_id": "d6214a0b-b344-4778-831c-d53dcacb2da3", - * "display_name": "guest01.example.com", - * "subscription_manager_id": "adafd9d5-5b00-42fa-a6c9-75801d45cc6d", - * "last_seen": "2020-04-01T00:00:00Z" - * }, - * { - * "insights_id": "9358e312-1c9f-42f4-8910-dcef6e970852", - * "inventory_id": "9358e312-1c9f-42f4-8910-dcef6e970852", - * "display_name": "guest02.example.com", - * "subscription_manager_id": "b101a72f-1859-4489-acb8-d6d31c2578c4", - * "last_seen": "2020-07-01T00:00:00Z" - * }, - * { - * "insights_id": "9358e312-1c9f-42f4-8910-XLef312123456", - * "inventory_id": "9358e312-1c9f-42f4-8910-XLef312123456", - * "display_name": "guest03.example.com", - * "subscription_manager_id": "c101a72f-1859-4489-acb8-d6d31c2578c4", - * "last_seen": "2020-07-01T00:00:00Z" - * }, - * { - * "insights_id": "498cff02-8b4b-46f8-a655-XLef312123456", - * "inventory_id": "498cff02-8b4b-46f8-a655-XLef312123456", - * "display_name": "guest04.example.com", - * "subscription_manager_id": "c101a72f-1859-4489-acb8-d6d31c2578c4", - * "last_seen": "2020-07-01T00:00:00Z" - * }, - * { - * "insights_id": "9358e312-1c9f-42f4-8910-XLef312123456", - * "inventory_id": "9358e312-1c9f-42f4-8910-XLef312123456", - * "display_name": "guest05.example.com", - * "subscription_manager_id": "c101a72f-1859-4489-acb8-d6d31c2578c4", - * "last_seen": "2020-07-01T00:00:00Z" - * }, - * { - * "insights_id": "9358e312-1c9f-42f4-8910-XLef312123456", - * "inventory_id": "9358e312-1c9f-42f4-8910-XLef312123456", - * "display_name": "guest06.example.com", - * "subscription_manager_id": "c101a72f-1859-4489-acb8-d6d31c2578c4", - * "last_seen": "2020-07-01T00:00:00Z" - * }, - * { - * "insights_id": "9358e312-1c9f-42f4-8910-XLef312123456", - * "inventory_id": "9358e312-1c9f-42f4-8910-XLef312123456", - * "display_name": "guest07.example.com", - * "subscription_manager_id": "c101a72f-1859-4489-acb8-d6d31c2578c4", - * "last_seen": "2020-07-01T00:00:00Z" - * }, - * { - * "insights_id": "9358e312-1c9f-42f4-8910-XLef312123456", - * "inventory_id": "9358e312-1c9f-42f4-8910-XLef312123456", - * "display_name": "guest08.example.com", - * "subscription_manager_id": "c101a72f-1859-4489-acb8-d6d31c2578c4", - * "last_seen": "2020-07-01T00:00:00Z" - * }, - * { - * "insights_id": "9358e312-1c9f-42f4-8910-XLef312123456", - * "inventory_id": "9358e312-1c9f-42f4-8910-XLef312123456", - * "display_name": "guest09.example.com", - * "subscription_manager_id": "c101a72f-1859-4489-acb8-d6d31c2578c4", - * "last_seen": "2020-07-01T00:00:00Z" - * }, - * { - * "insights_id": "9358e312-1c9f-42f4-8910-XLef312123456", - * "inventory_id": "9358e312-1c9f-42f4-8910-XLef312123456", - * "display_name": "guest10.example.com", - * "subscription_manager_id": "c101a72f-1859-4489-acb8-d6d31c2578c4", - * "last_seen": "2020-07-01T00:00:00Z" - * } - * ], - * "links": { - * "first": "/api/rhsm-subscriptions/v1/hosts/a283ffb6-e0f3-4dbe-9732-ccfdb297ba07/guests?offset=0&limit=5", - * "last": "/api/rhsm-subscriptions/v1/hosts/a283ffb6-e0f3-4dbe-9732-ccfdb297ba07/guests?offset=5&limit=5", - * "previous": null, - * "next": "/api/rhsm-subscriptions/v1/hosts/a283ffb6-e0f3-4dbe-9732-ccfdb297ba07/guests?offset=5&limit=5" - * }, - * "meta": { - * "count": 70 - * } - * } - * - * @apiError {Array} errors - * @apiErrorExample {json} Error-Response: - * HTTP/1.1 500 Internal Server Error - * { - * "errors": [ - * { - * "status": "string", - * "code": "string", - * "title": "string", - * "detail": "string" - * } - * ] - * } - */ -/** - * Get RHSM API hosts table/inventory guests data. - * - * @deprecated The Hosts inventory guest response is being replaced in favor of the Instances inventory guest response. - * @param {string} id Subscription Manager ID - * @param {object} params Query/search params - * @param {object} options - * @param {boolean} options.cache - * @param {boolean} options.cancel - * @param {string} options.cancelId - * @param {Array} options.schema An array of callbacks used to transform the response, ie. [SUCCESS SCHEMA, ERROR SCHEMA] - * @param {Array} options.transform An array of callbacks used to transform the response, ie. [SUCCESS TRANSFORM, ERROR TRANSFORM] - * @returns {Promise<*>} - */ -const getHostsInventoryGuests = (id, params = {}, options = {}) => { - const { - cache = true, - cancel = false, - cancelId, - schema = [rhsmSchemas.guests, rhsmSchemas.errors], - transform = [] - } = options; - const updatedId = rhsmHelpers.filterArchitectureVariant(id, params); - return serviceCall({ - url: process.env.REACT_APP_SERVICES_RHSM_INVENTORY_GUESTS.replace('{0}', updatedId), - params, - cache, - cancel, - cancelId, - schema, - transform - }); -}; - /** * @apiMock {DelayResponse} 250 * @api {get} /api/rhsm-subscriptions/v1/instances/:instance_id/guests Get RHSM instances/systems table/inventory guests data @@ -2992,10 +1935,7 @@ const getSubscriptionsInventory = (id, params = {}, options = {}) => { const rhsmServices = { getApiVersion, getGraphCapacity, - getGraphReports, getGraphTally, - getHostsInventory, - getHostsInventoryGuests, getInstancesInventory, getInstancesInventoryGuests, getSubscriptionsInventory @@ -3011,10 +1951,7 @@ export { rhsmServices, getApiVersion, getGraphCapacity, - getGraphReports, getGraphTally, - getHostsInventory, - getHostsInventoryGuests, getInstancesInventory, getInstancesInventoryGuests, getSubscriptionsInventory diff --git a/src/services/rhsm/rhsmTransformers.js b/src/services/rhsm/rhsmTransformers.js index 532d08452..494ff8a71 100644 --- a/src/services/rhsm/rhsmTransformers.js +++ b/src/services/rhsm/rhsmTransformers.js @@ -2,8 +2,6 @@ import moment from 'moment'; import { RHSM_API_QUERY_SET_TYPES, RHSM_API_PATH_METRIC_TYPES, - RHSM_API_RESPONSE_HOSTS_DATA_TYPES as HOSTS_DATA_TYPES, - RHSM_API_RESPONSE_HOSTS_META_TYPES as HOSTS_META_TYPES, RHSM_API_RESPONSE_INSTANCES_DATA_TYPES as INSTANCES_DATA_TYPES, RHSM_API_RESPONSE_INSTANCES_META_TYPES as INSTANCES_META_TYPES, RHSM_API_RESPONSE_TALLY_CAPACITY_DATA_TYPES as TALLY_CAPACITY_DATA_TYPES, @@ -19,39 +17,6 @@ import { dateHelpers } from '../../common'; * @module RhsmTransformers */ -/** - * Parse RHSM hosts response for caching. - * - * @param {object} response - * @returns {object} - */ -const rhsmHosts = response => { - const updatedResponse = {}; - const { [rhsmConstants.RHSM_API_RESPONSE_DATA]: data = [], [rhsmConstants.RHSM_API_RESPONSE_META]: meta = {} } = - response || {}; - - updatedResponse.data = data.map( - ({ - [HOSTS_DATA_TYPES.NUMBER_OF_GUESTS]: numberOfGuests, - [HOSTS_DATA_TYPES.SUBSCRIPTION_MANAGER_ID]: subscriptionManagerId, - ...dataResponse - }) => ({ - [HOSTS_DATA_TYPES.NUMBER_OF_GUESTS]: numberOfGuests, - [HOSTS_DATA_TYPES.SUBSCRIPTION_MANAGER_ID]: subscriptionManagerId, - numberOfGuests, - subscriptionManagerId, - ...dataResponse - }) - ); - - updatedResponse.meta = { - count: meta[HOSTS_META_TYPES.COUNT], - productId: meta[HOSTS_META_TYPES.PRODUCT] - }; - - return updatedResponse; -}; - /** * ToDO: remove the UOM fallback if/when the API supports returning some form of the UOM in the response * This is a temporary fix that passes the selected _uom from params in the event the API doesn't @@ -195,9 +160,8 @@ const rhsmTallyCapacity = (response, { _isCapacity, params } = {}) => { }; const rhsmTransformers = { - hosts: rhsmHosts, instances: rhsmInstances, tallyCapacity: rhsmTallyCapacity }; -export { rhsmTransformers as default, rhsmTransformers, rhsmHosts, rhsmInstances, rhsmTallyCapacity }; +export { rhsmTransformers as default, rhsmTransformers, rhsmInstances, rhsmTallyCapacity }; diff --git a/tests/__snapshots__/code.test.js.snap b/tests/__snapshots__/code.test.js.snap index 4876a5e10..6bb082404 100644 --- a/tests/__snapshots__/code.test.js.snap +++ b/tests/__snapshots__/code.test.js.snap @@ -3,8 +3,7 @@ exports[`General code checks should only have specific console.[warn|log|info|error] methods: console methods 1`] = ` [ "components/bannerMessages/bannerMessagesContext.js:120: console.warn(", - "components/inventoryCard/inventoryCardContext.js:172: console.warn(\`Sorting can only be performed on select fields, confirm field \${id} is allowed.\`);", - "components/inventoryCard/inventoryCardContext.js:234: console.warn(\`Sorting can only be performed on select fields, confirm field \${id} is allowed.\`);", + "components/inventoryCard/inventoryCardContext.js:131: console.warn(\`Sorting can only be performed on select fields, confirm field \${id} is allowed.\`);", "components/inventoryCard/inventoryCardHelpers.js:92: console.warn(\`Warning: Filter "\${id}" not found in "table row" response data.\`, cellData);", "components/inventoryCardSubscriptions/inventoryCardSubscriptionsContext.js:131: console.warn(\`Sorting can only be performed on select fields, confirm field \${id} is allowed.\`);", "config/products.js:28: console.warn(\`Product configuration failed to load: \${e.message}\`);", diff --git a/tests/__snapshots__/dist.test.js.snap b/tests/__snapshots__/dist.test.js.snap index 4a35ac33e..ed035150a 100644 --- a/tests/__snapshots__/dist.test.js.snap +++ b/tests/__snapshots__/dist.test.js.snap @@ -551,7 +551,6 @@ exports[`Build distribution should match a specific file output 1`] = ` "./dist/css/6334*css", "./dist/css/7109*css", "./dist/css/9506*css", - "./dist/css/9659*css", "./dist/css/exposed-./RootApp*css", "./dist/fed-mods.json", "./dist/fonts/graph2x.png", @@ -632,7 +631,6 @@ exports[`Build distribution should match a specific file output 1`] = ` "./dist/js/939*js", "./dist/js/9407*js", "./dist/js/9517*js", - "./dist/js/9659*js", "./dist/js/9669*js", "./dist/js/9669*txt", "./dist/js/9818*js", @@ -711,7 +709,6 @@ exports[`Build distribution should match a specific file output 1`] = ` "./dist/sourcemaps/939*map", "./dist/sourcemaps/9407*map", "./dist/sourcemaps/9517*map", - "./dist/sourcemaps/9659*map", "./dist/sourcemaps/9669*map", "./dist/sourcemaps/9818*map", "./dist/sourcemaps/9928*map",