-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Migrate saved object to typescript and deangularisation #51562
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
Changes from 46 commits
5563f83
e24bc6b
d9c0d74
2e05092
dc47644
e0cc901
01b5cb5
093bedc
8038c00
a31bd35
7a0dc19
ae0b043
2f7e6c1
cf2b1f8
174d784
b7a7960
be2e79c
5c6f162
051a936
334dd1f
d6f1a6b
4b1e8b1
b4d6363
a4d19dd
54b8622
10d6b45
bb838c1
c3e8e05
cdca97f
9a47751
47eb12c
c130333
7926552
de0ce4e
be86b58
114576a
01cf3f3
8774715
30dcc2a
b38c89b
3022a7d
3006561
6aa01c6
2ce5f34
c441b88
b063f3d
87b0ba7
163f53f
5b7b989
d03416c
74a7488
eb72d95
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| /* | ||
| * Licensed to Elasticsearch B.V. under one or more contributor | ||
| * license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright | ||
| * ownership. Elasticsearch B.V. licenses this file to you under | ||
| * the Apache License, Version 2.0 (the "License"); you may | ||
| * not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
| import { SavedObjectKibanaServices } from 'ui/saved_objects/types'; | ||
| import { createSavedObjectClass } from 'ui/saved_objects/saved_object'; | ||
|
|
||
| export function createSavedSearchClass(services: SavedObjectKibanaServices) { | ||
| const SavedObjectClass = createSavedObjectClass(services); | ||
|
|
||
| class SavedSearch extends SavedObjectClass { | ||
| public static type: string = 'search'; | ||
| public static mapping = { | ||
| title: 'text', | ||
| description: 'text', | ||
| hits: 'integer', | ||
| columns: 'keyword', | ||
| sort: 'keyword', | ||
| version: 'integer', | ||
| }; | ||
| // Order these fields to the top, the rest are alphabetical | ||
| public static fieldOrder = ['title', 'description']; | ||
| public static searchSource = true; | ||
|
|
||
| public id: string; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Those can be removed now because they are already defined in the base type
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I adapted this change, since it makes sense, but had to revert, because for some reason inheritance doesn't work in this case (Functional tests were failing). could be because we don't inherit directly but generate the Class to inherit from. A pattern we should and will change. |
||
| public showInRecentlyAccessed: boolean; | ||
|
|
||
| constructor(id: string) { | ||
| super({ | ||
| id, | ||
| type: 'search', | ||
| mapping: { | ||
| title: 'text', | ||
| description: 'text', | ||
| hits: 'integer', | ||
| columns: 'keyword', | ||
| sort: 'keyword', | ||
| version: 'integer', | ||
| }, | ||
| searchSource: true, | ||
| defaults: { | ||
| title: '', | ||
| description: '', | ||
| columns: [], | ||
| hits: 0, | ||
| sort: [], | ||
| version: 1, | ||
| }, | ||
| }); | ||
| this.showInRecentlyAccessed = true; | ||
| this.id = id; | ||
| this.getFullPath = () => `/app/kibana#/discover/${String(id)}`; | ||
| } | ||
| } | ||
|
|
||
| return SavedSearch; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉