Skip to content

Commit

Permalink
Added single vs ccs condtion
Browse files Browse the repository at this point in the history
  • Loading branch information
igoristic committed Oct 2, 2020
1 parent 0492e27 commit f2eaf07
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
4 changes: 2 additions & 2 deletions x-pack/plugins/monitoring/public/services/clusters.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ export function monitoringClustersProvider($injector) {
if (Legacy.shims.isCloud) {
return Promise.resolve();
}

const css = window.location.hash.split('?')[0] === '#/home' ? 'css' : 'single';
return $http
.get('../api/monitoring/v1/elasticsearch_settings/check/internal_monitoring')
.get(`../api/monitoring/v1/elasticsearch_settings/check/internal_monitoring/${css}`)
.then(({ data }) => {
showInternalMonitoringToast({
legacyIndices: data.legacy_indices,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { schema } from '@kbn/config-schema';
import { RequestHandlerContext } from 'kibana/server';
import {
INDEX_PATTERN_ELASTICSEARCH,
Expand Down Expand Up @@ -73,21 +74,31 @@ export function internalMonitoringCheckRoute(
) {
npRoute.router.get(
{
path: '/api/monitoring/v1/elasticsearch_settings/check/internal_monitoring',
validate: false,
path: '/api/monitoring/v1/elasticsearch_settings/check/internal_monitoring/{ccs}',
validate: {
params: schema.object({
ccs: schema.maybe(schema.string()),
}),
},
},
async (context, _request, response) => {
async (context, request, response) => {
try {
const typeCount = {
legacy_indices: 0,
mb_indices: 0,
};

const config = server.config();
const ccs = '*';
const esIndexPattern = prefixIndexPattern(config, INDEX_PATTERN_ELASTICSEARCH, ccs, true);
const kbnIndexPattern = prefixIndexPattern(config, INDEX_PATTERN_KIBANA, ccs, true);
const lsIndexPattern = prefixIndexPattern(config, INDEX_PATTERN_LOGSTASH, ccs, true);
const { ccs } = request.params;
const ccsPrefix = ccs === 'ccs' ? '*' : null;
const esIndexPattern = prefixIndexPattern(
config,
INDEX_PATTERN_ELASTICSEARCH,
ccsPrefix,
true
);
const kbnIndexPattern = prefixIndexPattern(config, INDEX_PATTERN_KIBANA, ccsPrefix, true);
const lsIndexPattern = prefixIndexPattern(config, INDEX_PATTERN_LOGSTASH, ccsPrefix, true);

const indexCounts = await Promise.all([
checkLatestMonitoringIsLegacy(context, esIndexPattern),
Expand Down

0 comments on commit f2eaf07

Please sign in to comment.