Skip to content

Commit

Permalink
Fix calls to /api/rollup/jobs
Browse files Browse the repository at this point in the history
Seen on page: /app/kibana#/management/elasticsearch/rollup_jobs/job_list
  • Loading branch information
jportner committed Feb 18, 2021
1 parent 76ea7df commit 1f74f80
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ const mapDispatchToProps = (dispatch) => {
loadJobs: () => {
dispatch(loadJobs());
},
refreshJobs: () => {
dispatch(refreshJobs());
refreshJobs: (options) => {
dispatch(refreshJobs(options));
},
openDetailPanel: (jobId) => {
dispatch(openDetailPanel({ jobId: jobId }));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ export class JobListUi extends Component {
}

componentDidMount() {
this.interval = setInterval(this.props.refreshJobs, REFRESH_RATE_MS);
this.interval = setInterval(
() => this.props.refreshJobs({ asSystemRequest: true }),
REFRESH_RATE_MS
);
}

componentWillUnmount() {
Expand Down
6 changes: 4 additions & 2 deletions x-pack/plugins/rollup/public/crud_app/services/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
*/

import chrome from 'ui/chrome';
import { addSystemApiHeader } from 'ui/system_api';
import { getHttp } from './http_provider';

const apiPrefix = chrome.addBasePath('/api/rollup');

export async function loadJobs() {
const { data: { jobs } } = await getHttp().get(`${apiPrefix}/jobs`);
export async function loadJobs({ asSystemRequest } = {}) {
const headers = asSystemRequest ? addSystemApiHeader({}) : undefined;
const { data: { jobs } } = await getHttp().get(`${apiPrefix}/jobs`, { headers });
return jobs;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import {
REFRESH_JOBS_SUCCESS,
} from '../action_types';

export const refreshJobs = () => async (dispatch) => {
export const refreshJobs = (options) => async (dispatch) => {
let jobs;
try {
jobs = await sendLoadJobsRequest();
jobs = await sendLoadJobsRequest(options);
} catch (error) {
return showApiWarning(error, i18n.translate('xpack.rollupJobs.refreshAction.errorTitle', {
defaultMessage: 'Error refreshing rollup jobs',
Expand Down

0 comments on commit 1f74f80

Please sign in to comment.