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

uiSettings - use validation field for image field maxSize #54522

Merged
merged 19 commits into from
Jan 13, 2020

Conversation

mattkime
Copy link
Contributor

@mattkime mattkime commented Jan 11, 2020

Summary

In uiSettings, the image upload field required specifying maxSize via the options field. This was in conflict with the stated use and type of options - which is a string[] use to populate select fields. Use validation field for image field maxSize

Checklist

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

For maintainers

Dev Docs

uiSettings image upload field config

In uiSettings, the image upload field required specifying maxSize via the options field. This was in conflict with the stated use and type of options - which is a string[] use to populate select fields. uiOptions has been provided instead, accepting Record<string, any> values.

@mattkime
Copy link
Contributor Author

@elasticmachine merge upstream

@mattkime mattkime added v7.6.0 v8.0.0 release_note:skip Skip the PR/issue when compiling release notes Team:AppArch labels Jan 11, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-arch (Team:AppArch)

@mattkime mattkime marked this pull request as ready for review January 11, 2020 19:48
@mattkime mattkime requested review from a team as code owners January 11, 2020 19:48
@mattkime mattkime added release_note:plugin_api_changes Contains a Plugin API changes section for the breaking plugin API changes section. and removed release_note:skip Skip the PR/issue when compiling release notes labels Jan 12, 2020
Comment on lines 25 to 7
| [requiresPageReload](./kibana-plugin-server.uisettingsparams.requirespagereload.md) | <code>boolean</code> | a flag indicating whether new value applying requires page reloading |
| [type](./kibana-plugin-server.uisettingsparams.type.md) | <code>UiSettingsType</code> | defines a type of UI element [UiSettingsType](./kibana-plugin-server.uisettingstype.md) |
| [value](./kibana-plugin-server.uisettingsparams.value.md) | <code>SavedObjectAttribute</code> | default value to fall back to if a user doesn't provide any |

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [UiSettingsParams](./kibana-plugin-server.uisettingsparams.md)

## UiSettingsParams interface

UiSettings parameters defined by the plugins.
Copy link
Contributor

Choose a reason for hiding this comment

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

The generated doc files are using windows line feed (this is how the tool work so we decided to keep it like this), and you pushed them with LF (autocrlf probably). Please regenerate the doc and commit them with preserved line feeds.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think there is a way to configure it currently #53761 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think either, that's why we need to stick to CRLF for now. Issue is, a lot of developers uses core.autocrlf input git config to convert to LF (which is a good practice most of the time) and may push without even knowing they altered the linefeeds.

Copy link
Contributor

Choose a reason for hiding this comment

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

we can enforce EOL format for all *.md files on the github repo level https://github.com/microsoft/rushstack/blob/2c941e21777393c67979b25dc087433485b12575/.gitattributes#L44

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Obviously I know very little about this tool, but I'd be tempted to wrap it in a script that converts the line endings. Having markdown files that must use different line endings is going to cause some headaches.

@@ -102,6 +102,8 @@ export interface UiSettingsParams {
readonly?: boolean;
/** defines a type of UI element {@link UiSettingsType} */
type?: UiSettingsType;
/** field ui options */
uiOptions?: Record<string, any>;
Copy link
Contributor

Choose a reason for hiding this comment

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

uiOptions sounds like anything used in UI, although reporting uses it for validation. There is the validation field for the same purpose added in #44678 although it's missed in TypeScript definition. Would you mind adding one?
We have the separate issue to introduce a proper validation for UI settings #46717
Thus, we should mark this validation field as deprecated.

type StringValidation = {
  regexString: string,
  message: string
};
type ImageValidation = {
  maxSize: ...
}
interface UiSettingsParams {
...
/*
* Allows defining a custom validation applicable to value change on the client.
* @deprecated 
*/
validation: StringValidation | ImageValidation;
}

@mattkime
Copy link
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

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

Copy link
Contributor

@streamich streamich left a comment

Choose a reason for hiding this comment

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

Code changes LGTM.

@mattkime mattkime changed the title uiSettings - method of supplying arbitrary params to ui (reporting was overloading options) uiSettings - use validation field for image field maxSize Jan 13, 2020
@mattkime mattkime merged commit 2178ee3 into elastic:master Jan 13, 2020
mattkime added a commit to mattkime/kibana that referenced this pull request Jan 13, 2020
)

* uiSettings - use validation field for image field maxSize
mattkime added a commit that referenced this pull request Jan 13, 2020
…54641)

* uiSettings - use validation field for image field maxSize
gmmorris added a commit to gmmorris/kibana that referenced this pull request Jan 14, 2020
* upstream/master: (26 commits)
  Take page offset into account too (elastic#54567)
  [APM] Support error.{log,exception}.stacktrace.classname (elastic#54577)
  Np migration tsvb route validation (elastic#51850)
  [ML] MML calculator enhancements for multi-metric job wizard  (elastic#54573)
  [SIEM] Fix Inspect query 'request timestamp' value changes when curso… (elastic#54223)
  Fix chromeless NP apps not using full page width (elastic#54550)
  Remove extraneous public import to prevent failing Kibana startup (elastic#54676)
  [Uptime] Temporarily skip flakey tests (elastic#54675)
  Skip failing uptime tests
  Create UI for alerting and actions plugin (elastic#48959)
  [dev/build/sass] build stylesheets for disabled plugins too (elastic#54654)
  [SIEM] Use bulk actions API when updating or deleting rules (elastic#54521)
  Support "Deprecated" label in advanced settings (elastic#54539)
  [Maps] add text halo color and width style properties (elastic#53827)
  Service Map Data API at Runtime (elastic#54027)
  [SIEM] Detection Engine Create Rule Design Review #1 (elastic#54442)
  Skip flaky test
  [Canvas] Enable Embeddable maps (elastic#53971)
  [SIEM][Detection Engine] Increases the number or rules you can view on a single page (elastic#54628)
  uiSettings - use validation field for image field maxSize (elastic#54522)
  ...
jkelastic pushed a commit to jkelastic/kibana that referenced this pull request Jan 17, 2020
)

* uiSettings - use validation field for image field maxSize
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:plugin_api_changes Contains a Plugin API changes section for the breaking plugin API changes section. v7.6.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants