Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion test/integration/host_js_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@ class HostJSTest < IntegrationTestWithJavascript
test "all audit redirect to audit page" do
visit host_details_page_path(@host)
find('a', :text => /All audits/).click
assert_current_path audits_path(search: "host=#{@host.fqdn}")
assert_current_path audits_path, ignore_query: true
query = Rack::Utils.parse_query(URI.parse(current_url).query)
assert_equal "host=#{@host.fqdn}", query['search']
assert_equal '1', query['page']
end

test "manage host statuses modal" do
Expand Down
1 change: 1 addition & 0 deletions test/integration/hostgroup_js_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class HostgroupJSTest < IntegrationTestWithJavascript
select2 os.media.first.name, :from => 'hostgroup_medium_id'
wait_for_ajax
select2 os.ptables.first.name, :from => 'hostgroup_ptable_id'
wait_for_ajax
fill_in 'hostgroup_root_pass', :with => '12345678'
click_button 'Submit'
hostgroup = wait_for do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ import { translate as __ } from '../../../common/I18n';
export const initializeAudits = () => dispatch => {
const params = getParams();
dispatch(fetchAudits(params));
if (!history.action === 'POP') {

if (history.action !== 'POP') {
history.replace({
pathname: AUDITS_PATH,
search: stringifyParams(params),
Expand All @@ -36,14 +37,17 @@ export const fetchAudits = (
url = AUDITS_PATH
) => async (dispatch, getState) => {
dispatch({ type: AUDITS_PAGE_SHOW_LOADING });
if (selectAuditsHasError(getState()))

if (selectAuditsHasError(getState())) {
dispatch({
type: AUDITS_PAGE_CLEAR_ERROR,
});
}

const onRequestSuccess = ({ data: { audits, itemCount } }) => {
if (selectAuditsIsLoadingPage(getState()))
if (selectAuditsIsLoadingPage(getState())) {
dispatch({ type: AUDITS_PAGE_HIDE_LOADING });
}

dispatch({
type: AUDITS_PAGE_UPDATE_QUERY,
Expand All @@ -63,9 +67,11 @@ export const fetchAudits = (
},
});
};

const onRequestFail = error => {
if (selectAuditsIsLoadingPage(getState()))
if (selectAuditsIsLoadingPage(getState())) {
dispatch({ type: AUDITS_PAGE_HIDE_LOADING });
}

dispatch({
type: AUDITS_PAGE_DATA_FAILED,
Expand All @@ -77,6 +83,7 @@ export const fetchAudits = (
},
});
};

try {
const response = await API.get(
url,
Expand All @@ -87,6 +94,7 @@ export const fetchAudits = (
search: searchQuery,
}
);

return onRequestSuccess(response);
} catch (error) {
return onRequestFail(error);
Expand Down
Loading
Loading