-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Composable template] Create / Edit wizard #70220
Merged
sebelga
merged 12 commits into
elastic:master
from
sebelga:feature/composable-template-wizard-2
Jul 3, 2020
Merged
Changes from 7 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
93e28e1
Update server API routes
sebelga 0fd04b7
Update client code to support "components" step in wizard
sebelga c12f3b6
Add ComponentTemplate selector component
sebelga ccff4b4
Update reusable code from es_ui_shared
sebelga 6b2cd27
Fix component integration tests
sebelga 398b497
Update tables to support "create" and "edit" flows
sebelga b5b737f
Add API integration tests
sebelga 25aac75
Make CR changes
sebelga 8bc69d8
Merge remote-tracking branch 'upstream/master' into feature/composabl…
sebelga c997d51
Indicate "legacy" in creation flow
sebelga aac8f04
Fix TS issue
sebelga e82f8d4
Merge remote-tracking branch 'upstream/master' into feature/composabl…
sebelga File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ | |
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { ReactWrapper } from 'enzyme'; | ||
import { act } from 'react-dom/test-utils'; | ||
|
||
import { | ||
|
@@ -13,44 +12,21 @@ import { | |
TestBedConfig, | ||
findTestSubject, | ||
} from '../../../../../test_utils'; | ||
// NOTE: We have to use the Home component instead of the TemplateList component because we depend | ||
// upon react router to provide the name of the template to load in the detail panel. | ||
import { IndexManagementHome } from '../../../public/application/sections/home'; // eslint-disable-line @kbn/eslint/no-restricted-paths | ||
import { indexManagementStore } from '../../../public/application/store'; // eslint-disable-line @kbn/eslint/no-restricted-paths | ||
import { TemplateList } from '../../../public/application/sections/home/template_list'; // eslint-disable-line @kbn/eslint/no-restricted-paths | ||
import { TemplateDeserialized } from '../../../common'; | ||
import { WithAppDependencies, services, TestSubjects } from '../helpers'; | ||
import { WithAppDependencies, TestSubjects } from '../helpers'; | ||
|
||
const testBedConfig: TestBedConfig = { | ||
store: () => indexManagementStore(services as any), | ||
memoryRouter: { | ||
initialEntries: [`/indices`], | ||
componentRoutePath: `/:section(indices|templates)`, | ||
initialEntries: [`/templates`], | ||
componentRoutePath: `/templates/:templateName?`, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cjcenizal for info this is how you get the memory router to provide the "templateName" to the component. |
||
}, | ||
doMountAsync: true, | ||
}; | ||
|
||
const initTestBed = registerTestBed(WithAppDependencies(IndexManagementHome), testBedConfig); | ||
|
||
export interface IndexTemplatesTabTestBed extends TestBed<TestSubjects> { | ||
findAction: (action: 'edit' | 'clone' | 'delete') => ReactWrapper; | ||
actions: { | ||
goToTemplatesList: () => void; | ||
selectDetailsTab: (tab: 'summary' | 'settings' | 'mappings' | 'aliases') => void; | ||
clickReloadButton: () => void; | ||
clickTemplateAction: ( | ||
name: TemplateDeserialized['name'], | ||
action: 'edit' | 'clone' | 'delete' | ||
) => void; | ||
clickTemplateAt: (index: number) => void; | ||
clickCloseDetailsButton: () => void; | ||
clickActionMenu: (name: TemplateDeserialized['name']) => void; | ||
toggleViewItem: (view: 'composable' | 'system') => void; | ||
}; | ||
} | ||
|
||
export const setup = async (): Promise<IndexTemplatesTabTestBed> => { | ||
const testBed = await initTestBed(); | ||
const initTestBed = registerTestBed<TestSubjects>(WithAppDependencies(TemplateList), testBedConfig); | ||
|
||
const createActions = (testBed: TestBed<TestSubjects>) => { | ||
/** | ||
* Additional helpers | ||
*/ | ||
|
@@ -64,11 +40,6 @@ export const setup = async (): Promise<IndexTemplatesTabTestBed> => { | |
/** | ||
* User Actions | ||
*/ | ||
|
||
const goToTemplatesList = () => { | ||
testBed.find('templatesTab').simulate('click'); | ||
}; | ||
|
||
const selectDetailsTab = (tab: 'summary' | 'settings' | 'mappings' | 'aliases') => { | ||
const tabs = ['summary', 'settings', 'mappings', 'aliases']; | ||
|
||
|
@@ -136,10 +107,8 @@ export const setup = async (): Promise<IndexTemplatesTabTestBed> => { | |
}; | ||
|
||
return { | ||
...testBed, | ||
findAction, | ||
actions: { | ||
goToTemplatesList, | ||
selectDetailsTab, | ||
clickReloadButton, | ||
clickTemplateAction, | ||
|
@@ -150,3 +119,14 @@ export const setup = async (): Promise<IndexTemplatesTabTestBed> => { | |
}, | ||
}; | ||
}; | ||
|
||
export const setup = async (): Promise<IndexTemplatesTabTestBed> => { | ||
const testBed = await initTestBed(); | ||
|
||
return { | ||
...testBed, | ||
...createActions(testBed), | ||
}; | ||
}; | ||
|
||
export type IndexTemplatesTabTestBed = TestBed<TestSubjects> & ReturnType<typeof createActions>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 0 additions & 12 deletions
12
x-pack/plugins/index_management/common/constants/index_templates.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...ation/components/component_templates/component_template_selector/component_templates.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
|
||
|
||
/** | ||
* [1] Will center vertically the empty search result | ||
*/ | ||
|
||
$heightHeader: $euiSizeL * 2; | ||
|
||
.componentTemplates { | ||
@include euiBottomShadowFlat; | ||
height: 100%; | ||
|
||
&__header { | ||
height: $heightHeader; | ||
|
||
.euiFormControlLayout { | ||
max-width: initial; | ||
} | ||
} | ||
|
||
&__searchBox { | ||
border-bottom: $euiBorderThin; | ||
box-shadow: none; | ||
max-width: initial; | ||
} | ||
|
||
&__listWrapper { | ||
height: calc(100% - #{$heightHeader}); | ||
|
||
&--is-empty { | ||
display: flex; // [1] | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 thanks for fixing this