Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Overview redirect when a Kibana restart is performed #1378

Merged
merged 4 commits into from
Apr 15, 2019
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
7 changes: 0 additions & 7 deletions public/factories/misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,4 @@ export class WzMisc {
setLastRestart(value) {
this.state.lastRestart = value;
}

/**
* Get last restart
*/
getLastRestart() {
return this.state.lastRestart;
}
}
36 changes: 10 additions & 26 deletions public/services/api-tester.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,35 +35,19 @@ export class ApiTester {
timeout: timeout || 20000
};

/** Checks for outdated cookies */
const current = this.appState.getCreatedAt();
const lastRestart = this.wzMisc.getLastRestart();
const result = await this.$http.post(
chrome.addBasePath('/api/check-stored-api'),
data,
headers
);

if (current && lastRestart && lastRestart > current) {
this.appState.removeCurrentPattern();
this.appState.removeCurrentAPI();
this.appState.removeClusterInfo();
this.appState.removeCreatedAt();
this.wzMisc.setLastRestart(null);
this.appState.setPatternSelector(configuration['ip.selector']);

this.appState.setPatternSelector(configuration['ip.selector']);

return 'cookies_outdated';
/** End of checks for outdated cookies */
} else {
const result = await this.$http.post(
chrome.addBasePath('/api/check-stored-api'),
data,
headers
);

this.appState.setPatternSelector(configuration['ip.selector']);

if (result.error) {
return Promise.reject(result);
}
return result;
if (result.error) {
return Promise.reject(result);
}
return result;

} catch (error) {
if (((error || {}).data || {}).code === 3099) {
// Do nothing
Expand Down
12 changes: 0 additions & 12 deletions public/services/app-state.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ export class AppState {
return this.$cookies.getObject('_clusterInfo');
}

removeClusterInfo() {
return this.$cookies.remove('_clusterInfo');
}

setClusterInfo(cluster_info) {
const exp = new Date();
exp.setDate(exp.getDate() + 365);
Expand All @@ -66,10 +62,6 @@ export class AppState {
return this.$cookies.getObject('_createdAt');
}

removeCreatedAt() {
return this.$cookies.remove('_createdAt');
}

//Current api setters and getters

getCurrentAPI() {
Expand Down Expand Up @@ -109,10 +101,6 @@ export class AppState {
return this.$cookies.getObject('_currentPattern');
}

removeCurrentPattern() {
return this.$cookies.remove('_currentPattern');
}

//Dev tools setters and getters

setCurrentDevTools(current) {
Expand Down
3 changes: 0 additions & 3 deletions public/services/resolves/settings-wizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,6 @@ export function settingsWizard(
.then(data => {
if (data === 3099) {
deferred.resolve();
} else if (data && data === 'cookies_outdated') {
$location.search('tab', 'welcome');
$location.path('/overview');
} else {
if (data.data.error || data.data.data.apiIsDown) {
checkResponse(data);
Expand Down