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

Add docs for SO migrations #1

Merged

Conversation

joshdover
Copy link

@joshdover joshdover commented Aug 6, 2020

Summary

This adds docs for:

  • Saved Object migrations in general
  • A pattern for nested saved object migrations, with a complete example

chart => chartMigrations['1.1.0'] ? chartMigrations['1.1.0'](chart) : chart
)
}

Choose a reason for hiding this comment

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

Is there a way we can automate this so the ChartList plugin author doesn't have to manually add a new migration in here every single minor? It'd be super easy to forget.

something like

 const migrationMap = {
    '1.1.0': my1_0_migration(),
     '2.5.0': my_2_5_migration()
  }

 // For versions that the Chart List plugin doesn't have any specific migrations for, they still want to
 // let each chart have an opportunity to add migrations.   Rather than require this to be manually added
 // every time, automatically fill in any versions that don't have manual migrations. 
  KIBANA_VERSION_LIST.foreach(version => {
    if (migrationMap[version] === undefined) {
      migrationMap[version] = {
              ...chartList,
              // For each chart, apply the chart migration for this version if it exists
              charts: chartList.map(
                chart => chartMigrations[version] ? chartMigrations[version](chart) : chart
             )
      }
    }
  );

  return migrationMap;

You would still need to remember to migrate the nested state inside each my_x_migration fn. Couple perhaps be remedied by some more refactoring.

Choose a reason for hiding this comment

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

Or even make it a part of registry API:

charts: chartList.map(state => plugins.charts.migrateTo(version, state))

class BarChartPlugin {
public setup(core, plugins) {
plugins.charts.register<BarChartState100>({

Choose a reason for hiding this comment

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

should be BarChartState110 ?

[source,typescript]
----
type ChartMigrationFn<ChartState extends object = object> = (chartDoc: object) => ChartState;

Choose a reason for hiding this comment

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

that's basically the same as type ChartMigrationFn = (input: Record<string, any>) => Record<string, any>, we cannot guarantee the output type for every migration

chart => chartMigrations['1.1.0'] ? chartMigrations['1.1.0'](chart) : chart
)
}

Choose a reason for hiding this comment

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

Or even make it a part of registry API:

charts: chartList.map(state => plugins.charts.migrateTo(version, state))

rudolf pushed a commit that referenced this pull request Sep 23, 2020
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
@rudolf
Copy link
Owner

rudolf commented Sep 23, 2020

As per elastic#71430 (comment) I'm merging this into that pull request and will remove the nested migrations documentation.

@rudolf rudolf marked this pull request as ready for review September 23, 2020 13:46
@rudolf rudolf merged commit 7ea3a50 into rudolf:saved-objects-dev-docs Sep 23, 2020
rudolf pushed a commit that referenced this pull request Oct 27, 2020
…lastic#65160)

* Remove stray rules that should've been deleted
* Update rule.ts and tests
* Remove deleted prebuilt rules from cypress ES archive (#1)
rudolf pushed a commit that referenced this pull request May 16, 2022
* Client side execution app level context propagation

* context$ + apm rum integration

* invert the context parent \ child relationship (cc @mikhail)
move more things to top level context

* Pass down context to apm on server

* types

* eslint

* parent <> child

* docs + eslint + jest

* execution context mock

* eslint

* jest

* jest

* server jest

* check

* jest

* storybook

* jest

* report the current space

* fix server side context container

* Remove spaces for now

* docssss

* jest

* lint

* test

* docs

* revert file

* doc

* all context params are optional

* clear on page change

* lint

* ts

* skipped test again

* testing fixes

* oops

* code review #1

* code review #2

* getAsLabels

* maps inherit dashboard context

* docs

* ts

* Give common context to all vis editors

* fix test

* ts \ es \ tests

* labels

* missing types

* docsy docs

* cr elastic#3

* improve jest

* Use editor name

* Update src/plugins/visualizations/public/visualize_app/components/visualize_editor.tsx

Co-authored-by: Marco Liberati <dej611@users.noreply.github.com>

* fix maps context

* jest tests for maps

* cr

* docs

* Update execution_context.test.ts

* docs

* lint

Co-authored-by: Marco Liberati <dej611@users.noreply.github.com>
rudolf pushed a commit that referenced this pull request May 16, 2022
* UI Polish for Session viewer frame + buttons

* UI Update for Session Viewer + Toolbar

* added Left Borders on Details panel + Fix Details panel button behaviour

* Details Panel UI Polish + PR Comments

* Find results interaction UI Polish, Def/Min/Max width for details panel, Timestamp bug fix

* more conflict fixes

* removed unused variable

* fix for failed checks on buildkite #1

* Addressing PR comments

* PR Comments + Search bar UI bug fix

* pr comments

Co-authored-by: Karl Godard <karl.godard@elastic.co>
rudolf pushed a commit that referenced this pull request Jun 23, 2022
* Initial commit for EUI 57.0.0 upgrade

* Handle i18n changes

* Resolved type errors in DatePicker and Markdown Editor

* Resolve test failures in Jest Test Suite #1. Updated multiple snapshots for euiLink and euiTitle as they have been converted to Emotion

* Resolved failing tests for Jest Suite #2. Updated snapshots for euiHealth, euiAvatar, euiSpacer, euiTitle, and euiLink as they have recently been converted to Emotion

* Resolved failing tests for Jest Suite 3. Updated failing snapshots as EuiSpacer, EuiText, EuiCallout, EuiHorizontalRule, EuiTitle, and EuiLink have been converted to Emotion. Updated the i18n translation snapshots

* Upgrade EUI verion to 58.0.0

* Resolved tests failures from Jest Test Suite 4. Updated snapshots as EuiLink, EuiTitle, EuiHorizontalRule, EuiSpace, and EuiCallout have been converted to Emotion

* Resolved failing test cases for Jest Test Suite 5. Updated snapshots as EuiLoader has been converted to Emotion

* Resolved failing tests in Jest Test Suite 6. Updated snapshots as EuiSpacer, EuiHorizontalRule, Eui Callout, and EuiLink have been converted to Emotion

* Resolved type errors for EuiDatePicker component

* Resolved type error within EuiContextMenu by removing the watchedItemProps prop. It was recently deprecated in EUI PR# 5880 (elastic/eui#5880) as is no longer needed

* Resolved type error within EuiContextMenu by removing the watchedItemProps prop. It was recently deprecated in EUI PR# 5880 (elastic/eui#5880) as is no longer needed

* Resolved type error within EuiContextMenu by removing the watchedItemProps prop. It was recently deprecated in EUI PR# 5880 (elastic/eui#5880) as is no longer needed

* Resolved type errors by updating the popoverPlacement prop for the EuiDatePicket component with new / valid values. A list of values were deprecated and new values were added in EUI PR elastic#5868 (elastic/eui#5868)

* Resolved type error within EuiTabs by removing instances of display: condensed as it is no longer a part of the Amsterdam theme via EUI PR elastic#5868(elastic/eui#5868)

* Remove deprecated `display` prop from EuiTabs

* Deprecate `.eui-textOverflowWrap`

* Deprecate EuiSuggestItem `labelDisplay` prop

* [EuiStepsHorizontal] Replace deprecated `isComplete`/`isSelected` with `status`

* Update last EuiStepsHorizontal `status` migration

- this one was more complex than the previous commit due to existing `status` usage and conditional steps. Some amount of logic was simplified via `completedStep`

* Resolved type error within EuiTabs by removing instances of display: condensed as it is no longer a part of the Amsterdam theme via EUI PR elastic#5868(elastic/eui#5868)

* Resolved failing test cases in Jest Test Suite 5. Updated snapshots as EuiTitle has been converted to Emotion

* Resovlved failing test cases in Jest Test Suite 4. Updated snapshots as EuiTitle and EuiSpacer have been converted to Emotion. Resolved failing tests for EuiLink click simlulations by esuring the test is referencing the correct element.

* Resolved failing test cases in Jest Test Suite 3. Updated snapshots as EuiLink, EuiSpacr, and EuiTItle have been converted to Emotion. Updated various test cases to ensure that the references to EuiLink are correct

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* Resolved failing test cases in Jest Test Suite 1. Updated snapshots as EUI text utilities have been converted to Emotion. Updated referenes to EuiLink to ensure test are simulating clicks on the correct elements

* Resolved failing test for Jet Test Suite 2. Updated required snapshots. Updated references to EuiLink to ensure that tests are simulating clicks on the correct elements

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* Resolved failing test cases for Jest Test Suite 5. Updated references to EuiLink to ensure tests are targeting the correct element

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* Resolved failing test cases across the Jest Test Suites. Updated required snaphots for components recently converted to Emotion. Updated test cases to ensure that tests targeting EuiLink are using the correct element.

* Resolved failing tests from multiple Jest test suites. Updated snapshots for components that have recently been converted to Emotion. Updated tests that reference the EuiLink component to ensure the correct element is being targeted

* Updated the getEuiStepsHorizontal function. Previously, this function used the .euiStepHorizontal-isSelected class (now deprecated) to determine which step was current. The function has been updated to use the status prop.

* Updated Jest integration test snapshots to account for the recent conversion of EuiLoader to Emotion

* Resolved failing tests in Jest suites 2 and 4. Updated required snapshots and references for tests using EuiLink

* Removed a console statement. Extracted a nested turnary operation into its own function.

* Rollback new turnary function and replace it with a simple if/else

* Rollback new turnary function and replace it with a simple if/else

* Rollback new turnary function and replace it with a simple if/else

* Rollback new turnary function and replace it with a simple if/else

* [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix'

* Resolved failing test cases in Jest Suites 3 and 5 by updating required snapshots

* revert doc_viewer_source test and snapshot changes

* Take care of merge conflict in license_checker:

* Reverted .render() change for analytics_no_data_page.component.test.tsx. Restored snapshot

* Reverted .render() change for analytics_no_data_page.component.test.tsx. Restored snapshot

Co-authored-by: Constance Chen <constance.chen@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Greg Thompson <thompson.glowe@gmail.com>
rudolf pushed a commit that referenced this pull request Sep 12, 2024
Connected to elastic#188187

## Summary

- Changed the cases `Settings` button and icon
- Changed the the `Additional fields` title to `Custom fields` for
consistency

<img width="1728" alt="Screenshot 2024-09-09 at 20 15 39"
src="https://github.com/user-attachments/assets/1fb1232a-f958-4d4d-8694-f85cc8872237">
<img width="1443" alt="Screenshot 2024-09-09 at 20 34 27"
src="https://github.com/user-attachments/assets/0fbdae02-65a6-4128-adc7-39f51cc2d5e6">
<img width="1370" alt="Screenshot 2024-09-09 at 20 34 57"
src="https://github.com/user-attachments/assets/c216407a-ac13-4579-8007-531c79d52de7">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants