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

Index Pattern class - remove toJSON and toString #76246

Merged
merged 8 commits into from
Sep 2, 2020
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,5 @@ export declare class IndexPattern implements IIndexPattern
| [refreshFields()](./kibana-plugin-plugins-data-public.indexpattern.refreshfields.md) | | |
| [removeScriptedField(fieldName)](./kibana-plugin-plugins-data-public.indexpattern.removescriptedfield.md) | | |
| [save(saveAttempts)](./kibana-plugin-plugins-data-public.indexpattern.save.md) | | |
| [toJSON()](./kibana-plugin-plugins-data-public.indexpattern.tojson.md) | | |
| [toSpec()](./kibana-plugin-plugins-data-public.indexpattern.tospec.md) | | |
| [toString()](./kibana-plugin-plugins-data-public.indexpattern.tostring.md) | | |

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,6 @@ describe('IndexPattern', () => {
expect(indexPattern).toHaveProperty('getNonScriptedFields');
expect(indexPattern).toHaveProperty('addScriptedField');
expect(indexPattern).toHaveProperty('removeScriptedField');
expect(indexPattern).toHaveProperty('toString');
expect(indexPattern).toHaveProperty('toJSON');
expect(indexPattern).toHaveProperty('save');

// properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -602,12 +602,4 @@ export class IndexPattern implements IIndexPattern {
});
});
}

toJSON() {
return this.id;
}

toString() {
return '' + this.toJSON();
}
}
4 changes: 0 additions & 4 deletions src/plugins/data/public/public.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1051,12 +1051,8 @@ export class IndexPattern implements IIndexPattern {
// (undocumented)
title: string;
// (undocumented)
toJSON(): string | undefined;
// (undocumented)
toSpec(): IndexPatternSpec;
// (undocumented)
toString(): string;
// (undocumented)
type: string | undefined;
// (undocumented)
typeMeta?: IndexPatternTypeMeta;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const ActionsPanel: FC<Props> = ({ indexPattern }) => {
function openAdvancedJobWizard() {
// TODO - pass the search string to the advanced job page as well as the index pattern
// (add in with new advanced job wizard?)
window.open(`#/jobs/new_job/advanced?index=${indexPattern}`, '_self');
window.open(`#/jobs/new_job/advanced?index=${indexPattern.id}`, '_self');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is causing the link to the advanced job editor in the data visualizer to fail.

image

Your change seems to have exposed an issue with the routing code in the ML plugin. In order to fix the link to the job wizard and get this PR through, I suggest making a slight change to the way the URL is built up here.

Add this to the list of imports:

import { getBasePath } from '../../../../util/dependency_cache';

and then construct the URL by:

const basePath = getBasePath();
window.open(`${basePath.get()}/app/ml/jobs/new_job/advanced?index=${indexPattern.id}`, '_self');

This fixes the link in the ML data visualizer for me (hopefully this will fix the associated functional tests too).

We can then follow-up with a cleaner refactor as part of the work we are already looking at as part of our switch to BrowserRouter in #72013.

}

// Note we use display:none for the DataRecognizer section as it needs to be
Expand Down