Skip to content

Commit

Permalink
refactor(dotenv,redux): sw-1911 remove deprecated tally, capacity (#1254
Browse files Browse the repository at this point in the history
)
  • Loading branch information
cdcabrera authored Jan 18, 2024
1 parent 37901f5 commit 190b05f
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 100 deletions.
2 changes: 0 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@ REACT_APP_CONFIG_SERVICE_LOCALES_PATH=${UI_DEPLOY_PATH_PREFIX}/apps/subscription
REACT_APP_CONFIG_SERVICE_LOCALES_EXPIRE=604800000

REACT_APP_SERVICES_RHSM_VERSION=/api/rhsm-subscriptions/v1/version
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_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/
Expand Down
2 changes: 0 additions & 2 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ REACT_APP_CONFIG_SERVICE_LOCALES=/locales/locales.json
REACT_APP_CONFIG_SERVICE_LOCALES_PATH=/locales/{{lng}}.json

REACT_APP_SERVICES_RHSM_VERSION=http://localhost:5000/api/rhsm-subscriptions/v1/version
REACT_APP_SERVICES_RHSM_REPORT=http://localhost:5000/api/rhsm-subscriptions/v1/tally/products/
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_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/
Expand Down
1 change: 0 additions & 1 deletion .env.proxy
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
DEV_PORT=1337
DEV_BRANCH=stage-beta
UI_DEPLOY_PATH_PREFIX=/beta

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,17 @@ exports[`GraphReducer should handle all defined error types: rejected types GET_
"status": 0,
},
"legend": {},
"reportCapacity": {},
"tally": {},
},
"type": "GET_GRAPH_CAPACITY_RHSM_REJECTED",
}
`;

exports[`GraphReducer should handle all defined error types: rejected types GET_GRAPH_REPORT_CAPACITY_RHSM 1`] = `
{
"result": {
"capacity": {},
"legend": {},
"reportCapacity": {
"error": true,
"errorMessage": "MESSAGE",
"fulfilled": false,
"meta": {},
"pending": false,
"status": 0,
},
"tally": {},
},
"type": "GET_GRAPH_REPORT_CAPACITY_RHSM_REJECTED",
}
`;

exports[`GraphReducer should handle all defined error types: rejected types GET_GRAPH_TALLY_RHSM 1`] = `
{
"result": {
"capacity": {},
"legend": {},
"reportCapacity": {},
"tally": {
"error": true,
"errorMessage": "MESSAGE",
Expand Down Expand Up @@ -73,42 +52,17 @@ exports[`GraphReducer should handle all defined fulfilled types: fulfilled types
"status": 0,
},
"legend": {},
"reportCapacity": {},
"tally": {},
},
"type": "GET_GRAPH_CAPACITY_RHSM_FULFILLED",
}
`;

exports[`GraphReducer should handle all defined fulfilled types: fulfilled types GET_GRAPH_REPORT_CAPACITY_RHSM 1`] = `
{
"result": {
"capacity": {},
"legend": {},
"reportCapacity": {
"data": {
"test": "success",
},
"date": null,
"error": false,
"errorMessage": "",
"fulfilled": true,
"meta": {},
"pending": false,
"status": 0,
},
"tally": {},
},
"type": "GET_GRAPH_REPORT_CAPACITY_RHSM_FULFILLED",
}
`;

exports[`GraphReducer should handle all defined fulfilled types: fulfilled types GET_GRAPH_TALLY_RHSM 1`] = `
{
"result": {
"capacity": {},
"legend": {},
"reportCapacity": {},
"tally": {
"data": {
"test": "success",
Expand Down Expand Up @@ -137,37 +91,17 @@ exports[`GraphReducer should handle all defined pending types: pending types GET
"pending": true,
},
"legend": {},
"reportCapacity": {},
"tally": {},
},
"type": "GET_GRAPH_CAPACITY_RHSM_PENDING",
}
`;

exports[`GraphReducer should handle all defined pending types: pending types GET_GRAPH_REPORT_CAPACITY_RHSM 1`] = `
{
"result": {
"capacity": {},
"legend": {},
"reportCapacity": {
"error": false,
"errorMessage": "",
"fulfilled": false,
"meta": {},
"pending": true,
},
"tally": {},
},
"type": "GET_GRAPH_REPORT_CAPACITY_RHSM_PENDING",
}
`;

exports[`GraphReducer should handle all defined pending types: pending types GET_GRAPH_TALLY_RHSM 1`] = `
{
"result": {
"capacity": {},
"legend": {},
"reportCapacity": {},
"tally": {
"error": false,
"errorMessage": "",
Expand All @@ -187,7 +121,6 @@ exports[`GraphReducer should handle specific defined types: defined type SET_GRA
"legend": {
"lorem": true,
},
"reportCapacity": {},
"tally": {},
},
"type": "SET_GRAPH_LEGEND",
Expand Down
18 changes: 3 additions & 15 deletions src/redux/reducers/__tests__/graphReducer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@ describe('GraphReducer', () => {
});

it('should handle all defined error types', () => {
const specificTypes = [
types.GET_GRAPH_REPORT_CAPACITY_RHSM,
types.GET_GRAPH_CAPACITY_RHSM,
types.GET_GRAPH_TALLY_RHSM
];
const specificTypes = [types.GET_GRAPH_CAPACITY_RHSM, types.GET_GRAPH_TALLY_RHSM];

specificTypes.forEach(value => {
const dispatched = {
Expand All @@ -55,11 +51,7 @@ describe('GraphReducer', () => {
});

it('should handle all defined pending types', () => {
const specificTypes = [
types.GET_GRAPH_REPORT_CAPACITY_RHSM,
types.GET_GRAPH_CAPACITY_RHSM,
types.GET_GRAPH_TALLY_RHSM
];
const specificTypes = [types.GET_GRAPH_CAPACITY_RHSM, types.GET_GRAPH_TALLY_RHSM];

specificTypes.forEach(value => {
const dispatched = {
Expand All @@ -75,11 +67,7 @@ describe('GraphReducer', () => {
});

it('should handle all defined fulfilled types', () => {
const specificTypes = [
types.GET_GRAPH_REPORT_CAPACITY_RHSM,
types.GET_GRAPH_CAPACITY_RHSM,
types.GET_GRAPH_TALLY_RHSM
];
const specificTypes = [types.GET_GRAPH_CAPACITY_RHSM, types.GET_GRAPH_TALLY_RHSM];

specificTypes.forEach(value => {
const dispatched = {
Expand Down
4 changes: 1 addition & 3 deletions src/redux/reducers/graphReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ import { reduxHelpers } from '../common/reduxHelpers';
* Initial state.
*
* @private
* @type {{reportCapacity: {}, legend: {}, tally: {}, capacity: {}}}
* @type {{legend: {}, tally: {}, capacity: {}}}
*/
const initialState = {
capacity: {},
legend: {},
reportCapacity: {},
tally: {}
};

Expand Down Expand Up @@ -46,7 +45,6 @@ const graphReducer = (state = initialState, action) => {
return reduxHelpers.generatedPromiseActionReducer(
[
{ ref: 'capacity', type: rhsmTypes.GET_GRAPH_CAPACITY_RHSM },
{ ref: 'reportCapacity', type: rhsmTypes.GET_GRAPH_REPORT_CAPACITY_RHSM },
{ ref: 'tally', type: rhsmTypes.GET_GRAPH_TALLY_RHSM }
],
state,
Expand Down
4 changes: 0 additions & 4 deletions src/redux/types/__tests__/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ exports[`ReduxTypes should have specific type properties: all redux types 1`] =
},
"rhsm": {
"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_INSTANCES_INVENTORY_GUESTS_RHSM": "GET_INSTANCES_INVENTORY_GUESTS_RHSM",
"GET_INSTANCES_INVENTORY_RHSM": "GET_INSTANCES_INVENTORY_RHSM",
Expand Down Expand Up @@ -131,7 +130,6 @@ exports[`ReduxTypes should have specific type properties: all redux types 1`] =
},
"rhsm": {
"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_INSTANCES_INVENTORY_GUESTS_RHSM": "GET_INSTANCES_INVENTORY_GUESTS_RHSM",
"GET_INSTANCES_INVENTORY_RHSM": "GET_INSTANCES_INVENTORY_RHSM",
Expand All @@ -151,7 +149,6 @@ exports[`ReduxTypes should have specific type properties: all redux types 1`] =
},
"rhsmTypes": {
"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_INSTANCES_INVENTORY_GUESTS_RHSM": "GET_INSTANCES_INVENTORY_GUESTS_RHSM",
"GET_INSTANCES_INVENTORY_RHSM": "GET_INSTANCES_INVENTORY_RHSM",
Expand Down Expand Up @@ -210,7 +207,6 @@ exports[`ReduxTypes should have specific type properties: specific types 1`] = `
},
"rhsm": {
"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_INSTANCES_INVENTORY_GUESTS_RHSM": "GET_INSTANCES_INVENTORY_GUESTS_RHSM",
"GET_INSTANCES_INVENTORY_RHSM": "GET_INSTANCES_INVENTORY_RHSM",
Expand Down
8 changes: 2 additions & 6 deletions src/redux/types/rhsmTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,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_INSTANCES_INVENTORY_RHSM = 'GET_INSTANCES_INVENTORY_RHSM';
const GET_INSTANCES_INVENTORY_GUESTS_RHSM = 'GET_INSTANCES_INVENTORY_GUESTS_RHSM';
Expand All @@ -13,13 +12,11 @@ const GET_SUBSCRIPTIONS_INVENTORY_RHSM = 'GET_SUBSCRIPTIONS_INVENTORY_RHSM';
/**
* RHSM API action, reducer types.
*
* @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}}
* @type {{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_INSTANCES_INVENTORY_RHSM,
GET_INSTANCES_INVENTORY_GUESTS_RHSM,
Expand All @@ -30,7 +27,6 @@ export {
rhsmTypes as default,
rhsmTypes,
GET_GRAPH_CAPACITY_RHSM,
GET_GRAPH_REPORT_CAPACITY_RHSM,
GET_GRAPH_TALLY_RHSM,
GET_INSTANCES_INVENTORY_RHSM,
GET_INSTANCES_INVENTORY_GUESTS_RHSM,
Expand Down

0 comments on commit 190b05f

Please sign in to comment.