-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a feature for custom panel titles (#14831)
* Add a feature for custom panel titles * Add tests and put back data-test-subjs * sync with master and add padding to form * UI/UX cleanup - add enter on close functionality - make reset title a link instead of a button - Push css to visualizations instead of the panel. This means background colors will be flush to the panel. Override for tile maps which apparently need it (yet region maps don’t for some reason??) * Fix refactor miss from merge * whoops, put block display back to make link fall to bottom * Undo accidental delete visualization name change * Color top pop over arrow correctly * Use naming Options and Customize Panel * update jest snapshot * Use custom panels for data-title attributes
- Loading branch information
1 parent
39c02c7
commit c2c1b51
Showing
22 changed files
with
310 additions
and
113 deletions.
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.