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

migrate 'core' ui settings to core #75544

Merged
merged 15 commits into from
Aug 24, 2020

Conversation

pgayvallet
Copy link
Contributor

@pgayvallet pgayvallet commented Aug 20, 2020

Summary

Fix #59755

  • Move platform owned settings to src/core/server/ui_settings/settings
  • Add schema validation and tests

Checklist

@pgayvallet pgayvallet added release_note:skip Skip the PR/issue when compiling release notes Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v7.10.0 labels Aug 20, 2020
'</a>',
},
}),
schema: schema.string(),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

AFAIK there is no way to validate a moment date format. We can't do better than just string here unfortunately...

Copy link
Contributor

Choose a reason for hiding this comment

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

'</a>',
},
}),
schema: schema.string(),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same here, no obvious way to validate the format. Parsing the json value to check if it's an array of array[2] felt overkill (and is not enough)

Comment on lines 37 to 40
buildNum: {
readonly: true,
schema: schema.maybe(schema.string()),
},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

buildNum was not on our list, but I guess it still belongs here.

@@ -60,6 +61,8 @@ export class UiSettingsService

savedObjects.registerType(uiSettingsType);
registerRoutes(http.createRouter(''));
this.register(getCoreSettings());
Copy link
Contributor Author

@pgayvallet pgayvallet Aug 20, 2020

Choose a reason for hiding this comment

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

I kept the registration internal to the service. Tell me if it should be done from elsewhere.

Copy link
Contributor

Choose a reason for hiding this comment

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

@pgayvallet pgayvallet marked this pull request as ready for review August 21, 2020 08:39
@pgayvallet pgayvallet requested a review from a team as a code owner August 21, 2020 08:39
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-platform (Team:Platform)

`"Must be a relative URL."`
);
expect(() => validate(125)).toThrowErrorMatchingInlineSnapshot(
`"expected value of type [string] but got [number]"`
Copy link
Contributor

Choose a reason for hiding this comment

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

can we remove this validation since you added this to the core?

},
})
),
defaultRoute: schema.maybe(schema.string()),
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we remove it completely? We validate overrides on the start


That's not the same thing entirely, but I would avoid spreading logic to different places.

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Build metrics

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@pgayvallet pgayvallet merged commit 4e3f47a into elastic:master Aug 24, 2020
pgayvallet added a commit to pgayvallet/kibana that referenced this pull request Aug 24, 2020
* migrate ui settings to core

* add basic test on service

* add unit tests

* adapt buildNum schema

* use any for buildNum...

* move i18n keys to core prefix

* translate added validation messages

* using number for schema for buildNum

* move state:storeInSessionStorage setting to core

* remove overrides config validation

* remove defaultRoute from config schema
pgayvallet added a commit that referenced this pull request Aug 24, 2020
* migrate ui settings to core

* add basic test on service

* add unit tests

* adapt buildNum schema

* use any for buildNum...

* move i18n keys to core prefix

* translate added validation messages

* using number for schema for buildNum

* move state:storeInSessionStorage setting to core

* remove overrides config validation

* remove defaultRoute from config schema
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:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v7.10.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate uiSettings defintions to NP
4 participants