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

Typescript search embeddable #26863

Conversation

stacey-gammon
Copy link
Contributor

No description provided.

@elasticmachine
Copy link
Contributor

💔 Build Failed

@stacey-gammon stacey-gammon force-pushed the 2018-12-09-typescript-search-embeddable branch from cd0b9df to 8068d33 Compare December 9, 2018 23:51
@elasticmachine
Copy link
Contributor

💔 Build Failed

@stacey-gammon stacey-gammon force-pushed the 2018-12-09-typescript-search-embeddable branch from 8068d33 to e649458 Compare December 10, 2018 17:48
@elasticmachine
Copy link
Contributor

💔 Build Failed

@stacey-gammon stacey-gammon force-pushed the 2018-12-09-typescript-search-embeddable branch from e649458 to adb0b9f Compare December 10, 2018 19:14
@elasticmachine
Copy link
Contributor

💔 Build Failed

@stacey-gammon stacey-gammon force-pushed the 2018-12-09-typescript-search-embeddable branch from adb0b9f to 1c55fa4 Compare December 10, 2018 20:57
@elasticmachine
Copy link
Contributor

💔 Build Failed

@stacey-gammon stacey-gammon force-pushed the 2018-12-09-typescript-search-embeddable branch from 1c55fa4 to 873b010 Compare December 11, 2018 00:12
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@stacey-gammon stacey-gammon force-pushed the 2018-12-09-typescript-search-embeddable branch from 873b010 to 762cb00 Compare December 11, 2018 00:58
@elasticmachine
Copy link
Contributor

💔 Build Failed

@stacey-gammon stacey-gammon force-pushed the 2018-12-09-typescript-search-embeddable branch from 762cb00 to 54ac214 Compare December 11, 2018 01:25
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Contributor

@timroes timroes left a comment

Choose a reason for hiding this comment

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

Mainly two typing issues, and one suggestion (to take or ignore).

*/

import dateMath from '@elastic/datemath';
import _ from 'lodash';
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we're anyway touching this, let's make this a named import instead.

onEmbeddableStateChanged: OnEmbeddableStateChanged;
savedSearch: SavedSearch;
editUrl: string;
loader: SavedSearchLoader;
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be removed, since we don't pass the loader in. It currently only works, because search_embeddable_factory is still in JS.

src/legacy/core_plugins/kibana/public/discover/types.d.ts Outdated Show resolved Hide resolved
@@ -96,6 +160,9 @@ export class SearchEmbeddable extends Embeddable {

const timeRangeSearchSource = this.searchScope.searchSource.create();
timeRangeSearchSource.setField('filter', () => {
if (!this.searchScope || !this.timeRange) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe a better way to not need all those checks, would be just first creating that scope on a local variable, in this function and then assign at the end to the class:

const searchScope: SearchScope = this.$rootScope.$new();
searchScope.description = this.savedSearch.description;
// ...
searchScope.setSortOrder = (columnName, direction) => {
  // no check now required
  searchScope.sort = this.customization.sort = [ columnName, direction ];
}
// ...
this.searchScope = searchScope;

Copy link
Contributor

Choose a reason for hiding this comment

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

But since we're checking in a lot of places still for existence of columns not sure if it really adds too much to the readability. So feel free to treat this as you wish.

@stacey-gammon stacey-gammon force-pushed the 2018-12-09-typescript-search-embeddable branch from f1b5707 to 6b5fe1d Compare December 11, 2018 20:54
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@stacey-gammon
Copy link
Contributor Author

done @timroes, thanks!

@@ -36,7 +36,7 @@ declare const datemath: {
input: string,
options?: {
roundUp?: boolean;
forceNow?: boolean;
forceNow?: Date;
Copy link
Member

Choose a reason for hiding this comment

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

not familiar with this code, but could we rename parameter or add some jsdocs decribing what this forceNow does ?

Copy link
Member

@ppisljar ppisljar left a comment

Choose a reason for hiding this comment

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

code LGTM, tried adding search panel on dashboard and it works ok (chrome linux)

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@stacey-gammon stacey-gammon merged commit f3545f3 into elastic:master Dec 12, 2018
stacey-gammon added a commit to stacey-gammon/kibana that referenced this pull request Dec 12, 2018
* typescript search embeddable

* Add a comment
stacey-gammon added a commit that referenced this pull request Dec 12, 2018
* typescript search embeddable

* Add a comment
@stacey-gammon stacey-gammon deleted the 2018-12-09-typescript-search-embeddable branch December 13, 2018 15:47
@rayafratkina rayafratkina added the Team:Visualizations Visualization editors, elastic-charts and infrastructure label Jan 17, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app

@rayafratkina rayafratkina added the release_note:skip Skip the PR/issue when compiling release notes label Jan 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v6.6.0 v7.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants