diff --git a/webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/index.js b/webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/index.js index 5645634b..20527acf 100644 --- a/webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/index.js +++ b/webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/index.js @@ -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 ( diff --git a/webpack/helpers/pageParamsHelper.js b/webpack/helpers/pageParamsHelper.js index 6abaa16b..bbe5aae0 100644 --- a/webpack/helpers/pageParamsHelper.js +++ b/webpack/helpers/pageParamsHelper.js @@ -1,3 +1,4 @@ +/* eslint-disable camelcase */ import URI from 'urijs'; import { useForemanSettings } from 'foremanReact/Root/Context/ForemanContext'; @@ -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, }; }; @@ -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);