Skip to content

Commit ee2ceef

Browse files
Index Pattern class - remove toJSON and toString (#76246)
* remove toJSON * remove toJSON, toString * fix ml url * Update actions_panel.tsx * fix url Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
1 parent 46aef4b commit ee2ceef

7 files changed

Lines changed: 4 additions & 48 deletions

File tree

docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,5 @@ export declare class IndexPattern implements IIndexPattern
6161
| [refreshFields()](./kibana-plugin-plugins-data-public.indexpattern.refreshfields.md) | | |
6262
| [removeScriptedField(fieldName)](./kibana-plugin-plugins-data-public.indexpattern.removescriptedfield.md) | | |
6363
| [save(saveAttempts)](./kibana-plugin-plugins-data-public.indexpattern.save.md) | | |
64-
| [toJSON()](./kibana-plugin-plugins-data-public.indexpattern.tojson.md) | | |
6564
| [toSpec()](./kibana-plugin-plugins-data-public.indexpattern.tospec.md) | | |
66-
| [toString()](./kibana-plugin-plugins-data-public.indexpattern.tostring.md) | | |
6765

docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.tojson.md

Lines changed: 0 additions & 15 deletions
This file was deleted.

docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpattern.tostring.md

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/plugins/data/common/index_patterns/index_patterns/index_pattern.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,6 @@ describe('IndexPattern', () => {
151151
expect(indexPattern).toHaveProperty('getNonScriptedFields');
152152
expect(indexPattern).toHaveProperty('addScriptedField');
153153
expect(indexPattern).toHaveProperty('removeScriptedField');
154-
expect(indexPattern).toHaveProperty('toString');
155-
expect(indexPattern).toHaveProperty('toJSON');
156154
expect(indexPattern).toHaveProperty('save');
157155

158156
// properties

src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -650,12 +650,4 @@ export class IndexPattern implements IIndexPattern {
650650
});
651651
});
652652
}
653-
654-
toJSON() {
655-
return this.id;
656-
}
657-
658-
toString() {
659-
return '' + this.toJSON();
660-
}
661653
}

src/plugins/data/public/public.api.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,12 +1022,8 @@ export class IndexPattern implements IIndexPattern {
10221022
// (undocumented)
10231023
title: string;
10241024
// (undocumented)
1025-
toJSON(): string | undefined;
1026-
// (undocumented)
10271025
toSpec(): IndexPatternSpec;
10281026
// (undocumented)
1029-
toString(): string;
1030-
// (undocumented)
10311027
type: string | undefined;
10321028
// (undocumented)
10331029
typeMeta?: IndexPatternTypeMeta;

x-pack/plugins/ml/public/application/datavisualizer/index_based/components/actions_panel/actions_panel.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@ import { EuiSpacer, EuiText, EuiTitle, EuiFlexGroup } from '@elastic/eui';
1313
import { IndexPattern } from '../../../../../../../../../src/plugins/data/public';
1414
import { CreateJobLinkCard } from '../../../../components/create_job_link_card';
1515
import { DataRecognizer } from '../../../../components/data_recognizer';
16+
import { getBasePath } from '../../../../util/dependency_cache';
1617

1718
interface Props {
1819
indexPattern: IndexPattern;
1920
}
2021

2122
export const ActionsPanel: FC<Props> = ({ indexPattern }) => {
2223
const [recognizerResultsCount, setRecognizerResultsCount] = useState(0);
24+
const basePath = getBasePath();
2325

2426
const recognizerResults = {
2527
count: 0,
@@ -31,7 +33,7 @@ export const ActionsPanel: FC<Props> = ({ indexPattern }) => {
3133
function openAdvancedJobWizard() {
3234
// TODO - pass the search string to the advanced job page as well as the index pattern
3335
// (add in with new advanced job wizard?)
34-
window.open(`#/jobs/new_job/advanced?index=${indexPattern}`, '_self');
36+
window.open(`${basePath.get()}/app/ml/jobs/new_job/advanced?index=${indexPattern.id}`, '_self');
3537
}
3638

3739
// Note we use display:none for the DataRecognizer section as it needs to be
@@ -86,7 +88,7 @@ export const ActionsPanel: FC<Props> = ({ indexPattern }) => {
8688
'Use the full range of options to create a job for more advanced use cases',
8789
})}
8890
onClick={openAdvancedJobWizard}
89-
href={`#/jobs/new_job/advanced?index=${indexPattern}`}
91+
href={`${basePath.get()}/app/ml/jobs/new_job/advanced?index=${indexPattern.id}`}
9092
data-test-subj="mlDataVisualizerCreateAdvancedJobCard"
9193
/>
9294
</div>

0 commit comments

Comments
 (0)