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

[new-platform] Explicitly define core setup types #34817

Merged
merged 15 commits into from
Apr 16, 2019

Conversation

rudolf
Copy link
Contributor

@rudolf rudolf commented Apr 9, 2019

Summary

Addresses the following services from #34416:

  • BasePathSetup
  • I18nSetup
  • InjectedMetadataSetup
  • FatalErrorsSetup

Instead of trying to address all services in a single big PR, I'm breaking this up into smaller PR's to minimize the potential for merge conflicts.

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

@rudolf rudolf added Feature:New Platform Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc non-issue Indicates to automation that a pull request should not appear in the release notes v7.2.0 v8.0.0 labels Apr 9, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-platform

@rudolf rudolf changed the title Core explicit setup types Explicitly define core setup types Apr 9, 2019
@rudolf rudolf changed the title Explicitly define core setup types [new-platform] Explicitly define core setup types Apr 9, 2019
@elasticmachine
Copy link
Contributor

💔 Build Failed

@rudolf rudolf marked this pull request as ready for review April 10, 2019 09:00
@rudolf rudolf requested a review from a team as a code owner April 10, 2019 09:00
@rudolf rudolf added the review label Apr 10, 2019
@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

Copy link
Contributor

@eliperelman eliperelman left a comment

Choose a reason for hiding this comment

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

Functionally LGTM, just had some nits surrounding formatting consistency.

<b>Returns:</b>

`string`

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Remove this extra trailing line.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These docs are generated by api-documenter (I just bumped the version to include a PR I submitted to add a "do not edit header" so that this is clearer). At some point we might fork api-documenter to customize the formatting to our needs since I agree that the formatting like 4-space indentation is different from our standards.

`string`

The basePath as defined by the server

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Remove this extra trailing line.

| [addToPath(path)](./kibana-plugin-public.basepathsetup.addtopath.md) | Add the current basePath to a path string. |
| [get()](./kibana-plugin-public.basepathsetup.get.md) | Get the basePath as defined by the server |
| [removeFromPath(path)](./kibana-plugin-public.basepathsetup.removefrompath.md) | Remove the basePath from a path that starts with it |

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Remove this extra trailing line.

<b>Returns:</b>

`string`

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Remove this extra trailing line.


```typescript
Context: ({ children }: {
children: React.ReactNode;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: indentation consistency.

Suggested change
children: React.ReactNode;
children: React.ReactNode;

Copy link
Contributor

Choose a reason for hiding this comment

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

this file is autogenerated. the problem should be fixed in https:/Microsoft/web-build-tools/tree/master/apps/api-documenter
@skaapgif did you create an issue for this problem or I should?


```typescript
getPlugins: () => Array<{
id: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: indentation consistency.

Suggested change
id: string;
id: string;

```typescript
getPlugins: () => Array<{
id: string;
plugin: DiscoveredPlugin;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: indentation consistency.

Suggested change
plugin: DiscoveredPlugin;
plugin: DiscoveredPlugin;

getPlugins: () => Array<{
id: string;
plugin: DiscoveredPlugin;
}>;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: indentation consistency.

Suggested change
}>;
}>;

| [getKibanaVersion](./kibana-plugin-public.injectedmetadatasetup.getkibanaversion.md) | <code>() =&gt; string</code> | |
| [getLegacyMetadata](./kibana-plugin-public.injectedmetadatasetup.getlegacymetadata.md) | <code>() =&gt; {`<p/>` app: unknown;`<p/>` translations: unknown;`<p/>` bundleId: string;`<p/>` nav: unknown;`<p/>` version: string;`<p/>` branch: string;`<p/>` buildNum: number;`<p/>` buildSha: string;`<p/>` basePath: string;`<p/>` serverName: string;`<p/>` devMode: boolean;`<p/>` uiSettings: {`<p/>` defaults: UiSettingsState;`<p/>` user?: UiSettingsState &#124; undefined;`<p/>` };`<p/>` }</code> | |
| [getPlugins](./kibana-plugin-public.injectedmetadatasetup.getplugins.md) | <code>() =&gt; Array&lt;{`<p/>` id: string;`<p/>` plugin: DiscoveredPlugin;`<p/>` }&gt;</code> | An array of frontend plugins in topological order. |

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: remove extra trailing line for consistent file endings.

/** @public */
export type I18nSetup = ReturnType<I18nService['setup']>;
/**
* I18nSetup.Context is required by any localizable React component from \@kbn/i18n and \@elastic/eui packages
Copy link
Contributor

Choose a reason for hiding this comment

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

Can I ask why moving this comment now has forward slashes in front of @kbn and @elastic?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The TSDoc standard uses @... for tags, so anytime an '@' is used it needs to be escaped. Before these comments weren't exported as part of the type system, so they weren't interpreted by TSDoc/api-exporter, so it wasn't an issue.


## BasePathSetup.removeFromPath() method

Remove the basePath from a path that starts with it
Copy link
Contributor

Choose a reason for hiding this comment

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

optional: if starts with it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍


```typescript
Context: ({ children }: {
children: React.ReactNode;
Copy link
Contributor

Choose a reason for hiding this comment

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

this file is autogenerated. the problem should be fixed in https:/Microsoft/web-build-tools/tree/master/apps/api-documenter
@skaapgif did you create an issue for this problem or I should?

@@ -56,7 +78,7 @@ export class FatalErrorsService {
});
}

public add = (error: Error | string, source?: string) => {
public add: FatalErrorsSetup['add'] = (error, source?) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

private. no-one should call it on an instance

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

@elasticmachine
Copy link
Contributor

💔 Build Failed

@rudolf
Copy link
Contributor Author

rudolf commented Apr 10, 2019

@restrry for some reason github won't let me reply to this comment

this file is autogenerated. the problem should be fixed in https:/Microsoft/web-build-tools/tree/master/apps/api-documenter
@skaapgif did you create an issue for this problem or I should?

I've created microsoft/rushstack#1215 which has been merged and released as [email protected]. I haven't yet updated Kibana's version, but I can do it as part of this PR 👍

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@mshustov
Copy link
Contributor

mshustov commented Apr 11, 2019

@skaapgif what about other points in #32148 (review) ? do they have appropriate issues in https:/Microsoft/web-build-tools/ repo? should we create them?

@rudolf
Copy link
Contributor Author

rudolf commented Apr 11, 2019

@restrry There's been quite a lot of changes in api-extractor, so I wanted to just make sure we're on the latest version of both extractor and documenter before creating issues. I've bumped api-extractor here: #34925

@mshustov
Copy link
Contributor

@skaapgif yeah, problems are still present 😞

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@rudolf rudolf dismissed eliperelman’s stale review April 16, 2019 12:06

Formatting issues are due to upstream dependency, I've created issues for these and will follow-up once there's progress.

@rudolf rudolf requested a review from mshustov April 16, 2019 12:07
Copy link
Contributor

@mshustov mshustov left a comment

Choose a reason for hiding this comment

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

I'd change method definition https:/elastic/kibana/pull/34817/files#r274024421 but overall everything is 🆗

@elasticmachine
Copy link
Contributor

💔 Build Failed

@rudolf
Copy link
Contributor Author

rudolf commented Apr 16, 2019

I'd change method definition https:/elastic/kibana/pull/34817/files#r274024421 but overall everything is 🆗

I totally agree with your reasoning here, but I'll open a new PR for this.

@rudolf rudolf merged commit 764bf25 into elastic:master Apr 16, 2019
@rudolf rudolf deleted the core-explicit-setup-types branch April 16, 2019 20:19
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

rudolf added a commit to rudolf/kibana that referenced this pull request Apr 17, 2019
* Explicitly define BasePathSetup type

* Explicitly define I18nSetup type

* Explicitly define InjectedMetadataSetup type

* Explicitly define FatalErrorSetup type

* Fix lint errors

* Fix BasePathSetup types

* Fix lint errors

* Clarify basePath add() docs

* Upgrade api-documenter for 'do not edit' header

* Use @link references on CoreSetup to improve doc navigation

* Add comment that links to upstream api-documenter issue

* PR Comments: make FatalErrorsService.add() private

* Revert "PR Comments: make FatalErrorsService.add() private"

This reverts commit fe9e6e6.
rudolf added a commit that referenced this pull request Apr 17, 2019
* Explicitly define BasePathSetup type

* Explicitly define I18nSetup type

* Explicitly define InjectedMetadataSetup type

* Explicitly define FatalErrorSetup type

* Fix lint errors

* Fix BasePathSetup types

* Fix lint errors

* Clarify basePath add() docs

* Upgrade api-documenter for 'do not edit' header

* Use @link references on CoreSetup to improve doc navigation

* Add comment that links to upstream api-documenter issue

* PR Comments: make FatalErrorsService.add() private

* Revert "PR Comments: make FatalErrorsService.add() private"

This reverts commit fe9e6e6.
walterra pushed a commit to walterra/kibana that referenced this pull request Apr 23, 2019
* Explicitly define BasePathSetup type

* Explicitly define I18nSetup type

* Explicitly define InjectedMetadataSetup type

* Explicitly define FatalErrorSetup type

* Fix lint errors

* Fix BasePathSetup types

* Fix lint errors

* Clarify basePath add() docs

* Upgrade api-documenter for 'do not edit' header

* Use @link references on CoreSetup to improve doc navigation

* Add comment that links to upstream api-documenter issue

* PR Comments: make FatalErrorsService.add() private

* Revert "PR Comments: make FatalErrorsService.add() private"

This reverts commit fe9e6e6.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:New Platform non-issue Indicates to automation that a pull request should not appear in the release notes review Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v7.2.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants