fix graph saving (#46243) (#46326)

This commit is contained in:
Joe Reuter 2019-09-23 15:19:55 +02:00 committed by GitHub
parent 979fd4686e
commit 0069db1b8b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 15 deletions

View file

@ -903,9 +903,8 @@ app.controller('graphuiPlugin', function (
);
return;
}
$scope.selectedIndex = selectedIndex;
$scope.proposedIndex = selectedIndex;
$route.current.locals.GetIndexPatternProvider.get(selectedIndex.id).then(indexPattern => {
$scope.selectedIndex = indexPattern;
initWorkspaceIfRequired();
const {
urlTemplates,

View file

@ -5,14 +5,9 @@
*/
import { appStateToSavedWorkspace } from './serialize';
import {
GraphWorkspaceSavedObject,
IndexPatternSavedObject,
Workspace,
WorkspaceEdge,
AppState,
} from '../../types';
import { GraphWorkspaceSavedObject, Workspace, WorkspaceEdge, AppState } from '../../types';
import { outlinkEncoders } from '../../helpers/outlink_encoders';
import { IndexPattern } from 'src/legacy/core_plugins/data/public';
describe('serialize', () => {
let appState: AppState;
@ -61,10 +56,8 @@ describe('serialize', () => {
},
],
selectedIndex: {
attributes: {
title: 'Testindexpattern',
},
} as IndexPatternSavedObject,
title: 'Testindexpattern',
} as IndexPattern,
urlTemplates: [
{
description: 'Template',

View file

@ -96,7 +96,7 @@ export function appStateToSavedWorkspace(
const mappedUrlTemplates = urlTemplates.map(serializeUrlTemplate);
const persistedWorkspaceState: SerializedWorkspaceState = {
indexPattern: selectedIndex.attributes.title,
indexPattern: selectedIndex.title,
selectedFields: selectedFields.map(serializeField),
blacklist,
vertices,

View file

@ -5,6 +5,7 @@
*/
import { SimpleSavedObject } from 'src/core/public';
import { IndexPattern } from 'src/legacy/core_plugins/data/public';
import { Workspace } from './workspace_state';
import { FontawesomeIcon } from '../helpers/style_choices';
import { OutlinkEncoder } from '../helpers/outlink_encoders';
@ -43,5 +44,5 @@ export interface AppState {
workspace: Workspace;
allFields: WorkspaceField[];
selectedFields: WorkspaceField[];
selectedIndex: IndexPatternSavedObject;
selectedIndex: IndexPattern;
}