mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
* Fix calls to `/api/monitoring/v1/clusters` and `/api/monitoring/v1/elasticsearch_settings/check/cluster` Seen on page: /app/monitoring * Fix calls to `/api/index_management/indices/reload` Seen on page: /app/kibana#/management/elasticsearch/index_management/indices * Fix calls to `/api/cross_cluster_replication/follower_indices` Seen on page: /app/kibana#/management/elasticsearch/cross_cluster_replication/follower_indices * Fix calls to `/api/cross_cluster_replication/auto_follow_patterns` Seen on page: /app/kibana#/management/elasticsearch/cross_cluster_replication/auto_follow_patterns * Fix calls to `/api/remote_clusters` Seen on page: /app/kibana#/management/elasticsearch/remote_clusters/list * Fix calls to `/api/watcher/watches` Seen on page: /app/kibana#/management/elasticsearch/watcher/watches * Fix calls to `/api/rollup/jobs` Seen on page: /app/kibana#/management/elasticsearch/rollup_jobs/job_list
This commit is contained in:
parent
9dfaf566f4
commit
92972261ae
17 changed files with 68 additions and 39 deletions
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
import chrome from 'ui/chrome';
|
||||
import { addSystemApiHeader } from 'ui/system_api';
|
||||
import {
|
||||
API_BASE_PATH,
|
||||
API_REMOTE_CLUSTERS_BASE_PATH,
|
||||
|
@ -35,9 +36,10 @@ export function setHttpClient(client, $deffered) {
|
|||
const extractData = (response) => response.data;
|
||||
|
||||
/* Auto Follow Pattern */
|
||||
export const loadAutoFollowPatterns = () => (
|
||||
httpClient.get(`${apiPrefix}/auto_follow_patterns`).then(extractData)
|
||||
);
|
||||
export const loadAutoFollowPatterns = (asSystemRequest) => {
|
||||
const headers = asSystemRequest ? addSystemApiHeader({}) : undefined;
|
||||
return httpClient.get(`${apiPrefix}/auto_follow_patterns`, { headers }).then(extractData);
|
||||
};
|
||||
|
||||
export const getAutoFollowPattern = (id) => (
|
||||
httpClient.get(`${apiPrefix}/auto_follow_patterns/${encodeURIComponent(id)}`).then(extractData)
|
||||
|
@ -62,9 +64,10 @@ export const deleteAutoFollowPattern = (id) => {
|
|||
};
|
||||
|
||||
/* Follower Index */
|
||||
export const loadFollowerIndices = () => (
|
||||
httpClient.get(`${apiPrefix}/follower_indices`).then(extractData)
|
||||
);
|
||||
export const loadFollowerIndices = (asSystemRequest) => {
|
||||
const headers = asSystemRequest ? addSystemApiHeader({}) : undefined;
|
||||
return httpClient.get(`${apiPrefix}/follower_indices`, { headers }).then(extractData);
|
||||
};
|
||||
|
||||
export const getFollowerIndex = (id) => (
|
||||
httpClient.get(`${apiPrefix}/follower_indices/${encodeURIComponent(id)}`).then(extractData)
|
||||
|
|
|
@ -36,7 +36,7 @@ export const loadAutoFollowPatterns = (isUpdating = false) =>
|
|||
scope,
|
||||
status: isUpdating ? API_STATUS.UPDATING : API_STATUS.LOADING,
|
||||
handler: async () => (
|
||||
await loadAutoFollowPatternsRequest()
|
||||
await loadAutoFollowPatternsRequest(isUpdating)
|
||||
),
|
||||
});
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ export const loadFollowerIndices = (isUpdating = false) =>
|
|||
scope,
|
||||
status: isUpdating ? API_STATUS.UPDATING : API_STATUS.LOADING,
|
||||
handler: async () => (
|
||||
await loadFollowerIndicesRequest()
|
||||
await loadFollowerIndicesRequest(isUpdating)
|
||||
),
|
||||
});
|
||||
|
||||
|
|
|
@ -78,8 +78,8 @@ const mapDispatchToProps = (dispatch) => {
|
|||
loadIndices: () => {
|
||||
dispatch(loadIndices());
|
||||
},
|
||||
reloadIndices: () => {
|
||||
dispatch(reloadIndices());
|
||||
reloadIndices: (options) => {
|
||||
dispatch(reloadIndices(undefined, options));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
@ -98,7 +98,10 @@ export class IndexTableUi extends Component {
|
|||
}
|
||||
componentDidMount() {
|
||||
this.props.loadIndices();
|
||||
this.interval = setInterval(this.props.reloadIndices, REFRESH_RATE_INDEX_LIST);
|
||||
this.interval = setInterval(
|
||||
() => this.props.reloadIndices({ asSystemRequest: true }),
|
||||
REFRESH_RATE_INDEX_LIST
|
||||
);
|
||||
const { filterChanged, filterFromURI } = this.props;
|
||||
if (filterFromURI) {
|
||||
const decodedFilter = decodeURIComponent(filterFromURI);
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
import chrome from 'ui/chrome';
|
||||
import { addSystemApiHeader } from 'ui/system_api';
|
||||
let httpClient;
|
||||
export const setHttpClient = (client) => {
|
||||
httpClient = client;
|
||||
|
@ -19,11 +20,12 @@ export async function loadIndices() {
|
|||
return response.data;
|
||||
}
|
||||
|
||||
export async function reloadIndices(indexNames) {
|
||||
export async function reloadIndices(indexNames, { asSystemRequest } = {}) {
|
||||
const body = {
|
||||
indexNames
|
||||
};
|
||||
const response = await httpClient.post(`${apiPrefix}/indices/reload`, body);
|
||||
const headers = asSystemRequest ? addSystemApiHeader({}) : undefined;
|
||||
const response = await httpClient.post(`${apiPrefix}/indices/reload`, body, { headers });
|
||||
return response.data;
|
||||
}
|
||||
|
||||
|
@ -126,4 +128,4 @@ export async function loadIndexData(type, indexName) {
|
|||
case 'Stats':
|
||||
return loadIndexStats(indexName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,11 +12,11 @@ import { loadIndices } from './load_indices';
|
|||
import { toastNotifications } from 'ui/notify';
|
||||
|
||||
export const reloadIndicesSuccess = createAction('INDEX_MANAGEMENT_RELOAD_INDICES_SUCCESS');
|
||||
export const reloadIndices = (indexNames) => async (dispatch, getState) => {
|
||||
export const reloadIndices = (indexNames, options) => async (dispatch, getState) => {
|
||||
let indices;
|
||||
indexNames = indexNames || getIndexNamesForCurrentPage(getState());
|
||||
try {
|
||||
indices = await request(indexNames);
|
||||
indices = await request(indexNames, options);
|
||||
} catch (error) {
|
||||
// an index has been deleted
|
||||
// or the user does not have privileges for one of the indices on the current page,
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { addSystemApiHeader } from 'ui/system_api';
|
||||
|
||||
export class SettingsChecker {
|
||||
constructor($http) {
|
||||
this.$http = $http;
|
||||
|
@ -43,7 +45,9 @@ export class SettingsChecker {
|
|||
|
||||
async executeCheck() {
|
||||
try {
|
||||
const { data } = await this.$http.get(this.getApi());
|
||||
const { data } = await this.$http.get(this.getApi(), {
|
||||
headers: addSystemApiHeader({}),
|
||||
});
|
||||
const { found, reason } = data;
|
||||
|
||||
return { found, reason };
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
import { uiModules } from 'ui/modules';
|
||||
import { ajaxErrorHandlersProvider } from 'plugins/monitoring/lib/ajax_error_handler';
|
||||
import { timefilter } from 'ui/timefilter';
|
||||
import { addSystemApiHeader } from 'ui/system_api';
|
||||
import { STANDALONE_CLUSTER_CLUSTER_UUID } from '../../common/constants';
|
||||
|
||||
function formatClusters(clusters) {
|
||||
|
@ -32,13 +33,18 @@ uiModule.service('monitoringClusters', ($injector) => {
|
|||
}
|
||||
|
||||
const $http = $injector.get('$http');
|
||||
return $http.post(url, {
|
||||
ccs,
|
||||
timeRange: {
|
||||
min: min.toISOString(),
|
||||
max: max.toISOString()
|
||||
}
|
||||
})
|
||||
return $http
|
||||
.post(
|
||||
url,
|
||||
{
|
||||
ccs,
|
||||
timeRange: {
|
||||
min: min.toISOString(),
|
||||
max: max.toISOString(),
|
||||
},
|
||||
},
|
||||
{ headers: addSystemApiHeader({}) }
|
||||
)
|
||||
.then(response => response.data)
|
||||
.then(data => {
|
||||
if (clusterUuid) {
|
||||
|
|
|
@ -5,14 +5,16 @@
|
|||
*/
|
||||
|
||||
import chrome from 'ui/chrome';
|
||||
import { addSystemApiHeader } from 'ui/system_api';
|
||||
let httpClient;
|
||||
export const setHttpClient = (client) => {
|
||||
httpClient = client;
|
||||
};
|
||||
const apiPrefix = chrome.addBasePath('/api/remote_clusters');
|
||||
|
||||
export async function loadClusters() {
|
||||
const response = await httpClient.get(`${apiPrefix}`);
|
||||
export async function loadClusters({ asSystemRequest } = {}) {
|
||||
const headers = asSystemRequest ? addSystemApiHeader({}) : undefined;
|
||||
const response = await httpClient.get(`${apiPrefix}`, { headers });
|
||||
return response.data;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ import {
|
|||
export const refreshClusters = () => async (dispatch) => {
|
||||
let clusters;
|
||||
try {
|
||||
clusters = await sendLoadClustersRequest();
|
||||
clusters = await sendLoadClustersRequest({ asSystemRequest: true });
|
||||
} catch (error) {
|
||||
return showApiWarning(error, i18n.translate('xpack.remoteClusters.refreshAction.errorTitle', {
|
||||
defaultMessage: 'Error refreshing remote clusters',
|
||||
|
|
|
@ -34,8 +34,8 @@ const mapDispatchToProps = (dispatch) => {
|
|||
loadJobs: () => {
|
||||
dispatch(loadJobs());
|
||||
},
|
||||
refreshJobs: () => {
|
||||
dispatch(refreshJobs());
|
||||
refreshJobs: (options) => {
|
||||
dispatch(refreshJobs(options));
|
||||
},
|
||||
openDetailPanel: (jobId) => {
|
||||
dispatch(openDetailPanel({ jobId: jobId }));
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -60,7 +60,9 @@ app.directive('watchList', function ($injector, i18n) {
|
|||
this.pager = pagerFactory.create(this.watches.length, PAGINATION.PAGE_SIZE, 1);
|
||||
|
||||
// Reload watches periodically
|
||||
const refreshInterval = $interval(() => this.loadWatches(), REFRESH_INTERVALS.WATCH_LIST);
|
||||
const refreshInterval = $interval(() => this.loadWatches({
|
||||
asSystemRequest: true,
|
||||
}), REFRESH_INTERVALS.WATCH_LIST);
|
||||
$scope.$on('$destroy', () => $interval.cancel(refreshInterval));
|
||||
|
||||
// react to watch and ui changes
|
||||
|
@ -81,8 +83,8 @@ app.directive('watchList', function ($injector, i18n) {
|
|||
return this.selectedWatches.length > 0;
|
||||
}
|
||||
|
||||
loadWatches = () => {
|
||||
watchesService.getWatchList()
|
||||
loadWatches = ({ asSystemRequest } = {}) => {
|
||||
watchesService.getWatchList({ asSystemRequest })
|
||||
.then(watches => {
|
||||
this.watches = watches;
|
||||
this.forbidden = false;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
import chrome from 'ui/chrome';
|
||||
import { addSystemApiHeader } from 'ui/system_api';
|
||||
import { ROUTES } from '../../../common/constants';
|
||||
import { Watch } from 'plugins/watcher/models/watch';
|
||||
|
||||
|
@ -14,8 +15,9 @@ export class WatchesService {
|
|||
this.basePath = chrome.addBasePath(ROUTES.API_ROOT);
|
||||
}
|
||||
|
||||
getWatchList() {
|
||||
return this.$http.get(`${this.basePath}/watches`)
|
||||
getWatchList({ asSystemRequest } = {}) {
|
||||
const headers = asSystemRequest ? addSystemApiHeader({}) : undefined;
|
||||
return this.$http.get(`${this.basePath}/watches`, { headers })
|
||||
.then(response => response.data.watches)
|
||||
.then(watches => watches.map(watch => {
|
||||
return Watch.fromUpstreamJson(watch);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue