Avoid fetching IPs twice

This commit is contained in:
Jesús Ángel 2018-10-28 10:29:25 +01:00
parent 514397fe2b
commit 092803d428
2 changed files with 7 additions and 3 deletions

View File

@ -20,7 +20,11 @@ export class PatternHandler {
async getPatternList() {
try {
const patternList = await this.genericReq.request('GET', '/elastic/index-patterns', {});
const patternList = await this.genericReq.request(
'GET',
'/elastic/index-patterns',
{}
);
if (!patternList.data.data.length) {
this.wzMisc.setBlankScr('Sorry but no valid index patterns were found');

View File

@ -39,14 +39,14 @@ export function getIp(
const { savedObjects } = savedObjectsData;
const data = await genericReq.request('GET', '/elastic/index-patterns');
let currentPattern = '';
if (appState.getCurrentPattern()) {
// There's cookie for the pattern
currentPattern = appState.getCurrentPattern();
} else {
const data = await genericReq.request('GET', '/elastic/index-patterns');
if (!data || !data.data || !data.data.data || !data.data.data.length) {
wzMisc.setBlankScr('Sorry but no valid index patterns were found');
$location.search('tab', null);