-
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
Add a feature for custom panel titles #14831
Merged
stacey-gammon
merged 11 commits into
elastic:master
from
stacey-gammon:feature/custom-panel-titles
Nov 16, 2017
+310
−113
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
1cb2a5d
Add a feature for custom panel titles
stacey-gammon 16bc0aa
Add tests and put back data-test-subjs
stacey-gammon c217a8a
sync with master and add padding to form
stacey-gammon eb7180b
UI/UX cleanup
stacey-gammon 5a1d337
Fix refactor miss from merge
stacey-gammon 8a77dd1
whoops, put block display back to make link fall to bottom
stacey-gammon 168f18a
Undo accidental delete visualization name change
stacey-gammon 6a2ea23
Color top pop over arrow correctly
stacey-gammon 1ebdafa
Use naming Options and Customize Panel
stacey-gammon a7c91cd
update jest snapshot
stacey-gammon 80d33d2
Use custom panels for data-title attributes
stacey-gammon 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
27 changes: 0 additions & 27 deletions
27
src/core_plugins/kibana/public/dashboard/panel/panel_header/delete_menu_item.js
This file was deleted.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
src/core_plugins/kibana/public/dashboard/panel/panel_header/edit_menu_item.js
This file was deleted.
Oops, something went wrong.
28 changes: 0 additions & 28 deletions
28
src/core_plugins/kibana/public/dashboard/panel/panel_header/expand_or_collapse_menu_item.js
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
59 changes: 59 additions & 0 deletions
59
src/core_plugins/kibana/public/dashboard/panel/panel_header/panel_header_container.test.js
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,59 @@ | ||
import React from 'react'; | ||
import { Provider } from 'react-redux'; | ||
import _ from 'lodash'; | ||
import { mount } from 'enzyme'; | ||
|
||
import { PanelHeaderContainer } from './panel_header_container'; | ||
import { DashboardViewMode } from '../../dashboard_view_mode'; | ||
import { store } from '../../../store'; | ||
import { | ||
updateViewMode, | ||
setPanels, | ||
setPanelTitle, | ||
resetPanelTitle, | ||
embeddableRenderFinished, | ||
} from '../../actions'; | ||
import { getEmbeddableFactoryMock } from '../../__tests__/get_embeddable_factories_mock'; | ||
import { | ||
TestSubjects, | ||
} from 'ui_framework/src/test'; | ||
|
||
function getProps(props = {}) { | ||
const defaultTestProps = { | ||
panelId: 'foo1', | ||
embeddableFactory: getEmbeddableFactoryMock(), | ||
}; | ||
return _.defaultsDeep(props, defaultTestProps); | ||
} | ||
|
||
let component; | ||
|
||
beforeAll(() => { | ||
store.dispatch(updateViewMode(DashboardViewMode.EDIT)); | ||
store.dispatch(setPanels([{ panelIndex: 'foo1' }])); | ||
store.dispatch(embeddableRenderFinished('foo1', { title: 'my embeddable title', editUrl: 'editme' })); | ||
}); | ||
|
||
afterAll(() => { | ||
component.unmount(); | ||
}); | ||
|
||
test('Panel header shows embeddable title when nothing is set on the panel', () => { | ||
component = mount(<Provider store={store}><PanelHeaderContainer {...getProps()} /></Provider>); | ||
expect(TestSubjects.getText(component, 'dashboardPanelTitle')).toBe('my embeddable title'); | ||
}); | ||
|
||
test('Panel header shows panel title when it is set on the panel', () => { | ||
store.dispatch(setPanelTitle('my custom panel title', 'foo1')); | ||
expect(TestSubjects.getText(component, 'dashboardPanelTitle')).toBe('my custom panel title'); | ||
}); | ||
|
||
test('Panel header shows no panel title when it is set to an empty string on the panel', () => { | ||
store.dispatch(setPanelTitle('', 'foo1')); | ||
expect(TestSubjects.getText(component, 'dashboardPanelTitle')).toBe(''); | ||
}); | ||
|
||
test('Panel header shows embeddable title when the panel title is reset', () => { | ||
store.dispatch(resetPanelTitle('foo1')); | ||
expect(TestSubjects.getText(component, 'dashboardPanelTitle')).toBe('my embeddable title'); | ||
}); |
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
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.
What is this doing? Why
foo1
?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.
it's setting up redux so that the dashboard will be rendered with a single panel with a panel id/index of
foo1
.foo1
could be anything as long as it matches the defaultTestProps panel above. Without this call it'll break because you will be passing in props that say render panelfoo1
but that panel won't exist in the store, so I'll get an error likeCannot read property 'title' of undefined
.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.
sorry, I did not see this was a test file. Disregard the questions