Skip to content

Commit be3435e

Browse files
committed
fix api docs, simplify code
1 parent e06ac60 commit be3435e

6 files changed

Lines changed: 6 additions & 142 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ export declare class FieldList extends Array<Field> implements IFieldList
2424
| [getByName](./kibana-plugin-plugins-data-public.indexpatternfieldlist.getbyname.md) | | <code>(name: string) =&gt; Field &#124; undefined</code> | |
2525
| [getByType](./kibana-plugin-plugins-data-public.indexpatternfieldlist.getbytype.md) | | <code>(type: string) =&gt; any[]</code> | |
2626
| [remove](./kibana-plugin-plugins-data-public.indexpatternfieldlist.remove.md) | | <code>(field: IFieldType) =&gt; void</code> | |
27-
| [update](./kibana-plugin-plugins-data-public.indexpatternfieldlist.update.md) | | <code>(field: Field) =&gt; void</code> | |
27+
| [update](./kibana-plugin-plugins-data-public.indexpatternfieldlist.update.md) | | <code>(field: Record&lt;string, any&gt;) =&gt; void</code> | |
2828

docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfieldlist.update.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
<b>Signature:</b>
88

99
```typescript
10-
update: (field: Field) => void;
10+
update: (field: Record<string, any>) => void;
1111
```

src/legacy/ui/public/field_editor/field_editor.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ import { FieldFormatEditor } from './components/field_format_editor';
6767

6868
import { FIELD_TYPES_BY_LANG, DEFAULT_FIELD_TYPES } from './constants';
6969
import { executeScript, isScriptValid } from './lib';
70-
// import { copyField, executeScript, isScriptValid } from './lib';
71-
// import { Field } from '../../../../plugins/data/public';
7270

7371
import { i18n } from '@kbn/i18n';
7472
import { FormattedMessage } from '@kbn/i18n/react';
@@ -97,11 +95,13 @@ const getFieldTypeFormatsList = (field, defaultFieldFormat) => {
9795
];
9896
};
9997

98+
/*
10099
const copyFieldMk = field => {
101100
// console.log('copyField', field.format.params());
102101
const obj = { ...field, format: field.format };
103102
return obj;
104103
};
104+
*/
105105

106106
export class FieldEditor extends PureComponent {
107107
static propTypes = {
@@ -128,9 +128,7 @@ export class FieldEditor extends PureComponent {
128128
fieldTypes: [],
129129
fieldTypeFormats: [],
130130
existingFieldNames: indexPattern.fields.map(f => f.name),
131-
//field: copyField(field, indexPattern),
132-
//field: new Field(indexPattern, field.$$spec), // what about short dots?
133-
field: copyFieldMk(field),
131+
field: { ...field, format: field.format },
134132
fieldFormatId: undefined,
135133
fieldFormatParams: {},
136134
showScriptingHelp: false,
@@ -243,7 +241,6 @@ export class FieldEditor extends PureComponent {
243241
renderName() {
244242
const { isCreating, field } = this.state;
245243
const isInvalid = !field.name || !field.name.trim();
246-
// console.log('renderName', this.state.field);
247244

248245
return isCreating ? (
249246
<EuiFormRow
@@ -445,8 +442,6 @@ export class FieldEditor extends PureComponent {
445442
<FormattedMessage id="common.ui.fieldEditor.formatHeader" defaultMessage="Format" />
446443
);
447444

448-
// console.log('field_editor render fieldFormat', field.format);
449-
450445
return (
451446
<Fragment>
452447
<EuiFormRow

src/legacy/ui/public/field_editor/lib/__tests__/copy_field.test.js

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

src/legacy/ui/public/field_editor/lib/copy_field.js

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

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -976,7 +976,7 @@ export class IndexPatternFieldList extends Array<IndexPatternField> implements I
976976
// (undocumented)
977977
remove: (field: IFieldType) => void;
978978
// (undocumented)
979-
update: (field: IndexPatternField) => void;
979+
update: (field: Record<string, any>) => void;
980980
}
981981

982982
// Warning: (ae-missing-release-tag) "indexPatterns" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)

0 commit comments

Comments
 (0)