Skip to content

Commit

Permalink
Fixes #36469 - linter fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ronlavi2412 committed Jan 1, 2024
1 parent c0f829b commit cb40128
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ const AnsibleVariableOverrides = ({ hostId, hostAttrs, history }) => {
});

const renameData = data => {
const totalCount = data.host.ansibleVariablesWithOverrides.totalCount;
const { totalCount } = data.host.ansibleVariablesWithOverrides;
if (totalItems === 0) setTotalItems(totalCount);
return ({
return {
variables: data.host.ansibleVariablesWithOverrides.nodes,
totalCount,
})
};
};

return (
Expand Down
13 changes: 7 additions & 6 deletions webpack/helpers/pageParamsHelper.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable camelcase */
import URI from 'urijs';
import { useForemanSettings } from 'foremanReact/Root/Context/ForemanContext';

Expand All @@ -12,14 +13,13 @@ export const addSearch = (basePath, params) => {
return `${basePath}${stringyfied}`;
};

export const useCurrentPagination = (history) => {
export const useCurrentPagination = history => {
const pageParams = parsePageParams(history);
const uiSettings = useForemanSettings();

return {
page: parseInt(pageParams.page, 10) || 1,
per_page:
parseInt(pageParams.per_page, 10) || uiSettings.perPage,
per_page: parseInt(pageParams.per_page, 10) || uiSettings.perPage,
};
};

Expand All @@ -31,7 +31,8 @@ export const useCurrentPagination = (history) => {
*/
export const pageToVars = ({ page, per_page }, totalCount = 0) => ({
first: page * per_page,
last: page > 1 & totalCount > 0 ? totalCount - per_page : per_page,
})
last: page > 1 && totalCount > 0 ? totalCount - per_page : per_page,
});

export const useParamsToVars = (history, totalCount) => pageToVars(useCurrentPagination(history), totalCount);
export const useParamsToVars = (history, totalCount) =>
pageToVars(useCurrentPagination(history), totalCount);

0 comments on commit cb40128

Please sign in to comment.