Skip to content

Commit

Permalink
chore: Further upgrade host-inventory-client to use the latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
gkarat committed Feb 6, 2025
1 parent b6d966a commit 6380898
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 9 deletions.
25 changes: 23 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"@redhat-cloud-services/frontend-components-translations": "^3.2.18",
"@redhat-cloud-services/frontend-components-utilities": "^5.0.10",
"@redhat-cloud-services/host-inventory-client": "^2.0.1",
"@redhat-cloud-services/javascript-clients-shared": "^2.0.0",
"@scalprum/react-core": "^0.7.1",
"@sentry/webpack-plugin": "^3.1.0",
"@unleash/proxy-client-react": "^3.5.0",
Expand Down
25 changes: 18 additions & 7 deletions src/Utilities/api.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { SystemProfileApi, GroupsApi } from '@redhat-cloud-services/host-inventory-client';
import axios from './axiosInterceptors';
import { APIFactory } from '@redhat-cloud-services/javascript-clients-shared/utils';
import apiSystemProfileGetOperatingSystem from '@redhat-cloud-services/host-inventory-client/apiSystemProfileGetOperatingSystem';
import apiGroupGetGroupList from '@redhat-cloud-services/host-inventory-client/apiGroupGetGroupList';
import axiosInstance from './axiosInterceptors';
import { encodeApiParams, prepareEntitiesParams } from './Helpers';

const INVENTORY_API_BASE = '/api/inventory/v1';
Expand All @@ -16,7 +18,7 @@ export function createApiCall(
endpoint = endpoint.concat(encodeApiParams(parameters));
}

let result = axios({
let result = axiosInstance({
method,
url: '/api/patch/' + version + endpoint,
withCredentials: true,
Expand All @@ -27,8 +29,17 @@ export function createApiCall(
return result;
}

const systemProfile = new SystemProfileApi(undefined, INVENTORY_API_BASE, axios);
const groupsProfile = new GroupsApi(undefined, INVENTORY_API_BASE, axios);
// eslint-disable-next-line new-cap
const hostInventoryApi = APIFactory(
INVENTORY_API_BASE,
{
apiSystemProfileGetOperatingSystem,
apiGroupGetGroupList
},
{
axios: axiosInstance
}
);

export const fetchApplicableAdvisoriesApi = params => {
return createApiCall('/advisories', 'v3', 'get', params);
Expand Down Expand Up @@ -215,11 +226,11 @@ export const unassignSystemFromPatchSet = (payload) => {
};

export const getOperatingSystems = () => {
return systemProfile.apiSystemProfileGetOperatingSystem();
return hostInventoryApi.apiSystemProfileGetOperatingSystem();
};

export const getSystemsGroups = () => {
return groupsProfile.apiGroupGetGroupList();
return hostInventoryApi.apiGroupGetGroupList();
};

export const fetchIDs = (endpoint, queryParams) => {
Expand Down

0 comments on commit 6380898

Please sign in to comment.