mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
* [Discover] fix manage of saved search embeddable columns
* [Discover] add functional test
* [Discover] rename function
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 3c5b3f38db
)
Co-authored-by: Dmitry Tomashevich <39378793+dimaanj@users.noreply.github.com>
This commit is contained in:
parent
ba0afde463
commit
69ab3ea3d1
3 changed files with 39 additions and 15 deletions
|
@ -147,7 +147,7 @@ export class SavedSearchEmbeddable
|
|||
this.searchProps &&
|
||||
(titleChanged ||
|
||||
this.isFetchRequired(this.searchProps) ||
|
||||
this.isInputChangedAndRerenderRequired(this.searchProps))
|
||||
this.isRerenderRequired(this.searchProps))
|
||||
) {
|
||||
this.pushContainerStateParamsToProps(this.searchProps);
|
||||
}
|
||||
|
@ -405,11 +405,14 @@ export class SavedSearchEmbeddable
|
|||
);
|
||||
}
|
||||
|
||||
private isInputChangedAndRerenderRequired(searchProps?: SearchProps) {
|
||||
private isRerenderRequired(searchProps?: SearchProps) {
|
||||
if (!searchProps) {
|
||||
return false;
|
||||
}
|
||||
return this.input.rowsPerPage !== searchProps.rowsPerPageState;
|
||||
return (
|
||||
this.input.rowsPerPage !== searchProps.rowsPerPageState ||
|
||||
(this.input.columns && !isEqual(this.input.columns, searchProps.columns))
|
||||
);
|
||||
}
|
||||
|
||||
private async pushContainerStateParamsToProps(
|
||||
|
|
|
@ -78,8 +78,23 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
|||
await dataGrid.checkCurrentRowsPerPageToBe(10);
|
||||
});
|
||||
|
||||
it('should render duplicate saved search embeddables', async () => {
|
||||
it('should control columns correctly', async () => {
|
||||
await PageObjects.dashboard.switchToEditMode();
|
||||
|
||||
const cell = await dataGrid.getCellElement(0, 2);
|
||||
expect(await cell.getVisibleText()).to.be('Sep 22, 2015 @ 23:50:13.253');
|
||||
await dataGrid.clickMoveColumnLeft('agent');
|
||||
|
||||
const cellAfter = await dataGrid.getCellElement(0, 2);
|
||||
expect(await cellAfter.getVisibleText()).to.be(
|
||||
'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)'
|
||||
);
|
||||
|
||||
await dataGrid.clickRemoveColumn('agent');
|
||||
expect(await cell.getVisibleText()).to.be('Sep 22, 2015 @ 23:50:13.253');
|
||||
});
|
||||
|
||||
it('should render duplicate saved search embeddables', async () => {
|
||||
await addSearchEmbeddableToDashboard();
|
||||
const [firstGridCell, secondGridCell] = await dataGrid.getAllCellElements();
|
||||
const firstGridCellContent = await firstGridCell.getVisibleText();
|
||||
|
|
|
@ -254,30 +254,36 @@ export class DataGridService extends FtrService {
|
|||
});
|
||||
}
|
||||
|
||||
public async clickDocSortAsc(field?: string, sortText = 'Sort Old-New') {
|
||||
private async clickColumnMenuField(field?: string) {
|
||||
if (field) {
|
||||
await this.openColMenuByField(field);
|
||||
} else {
|
||||
await this.find.clickByCssSelector('.euiDataGridHeaderCell__button');
|
||||
}
|
||||
}
|
||||
|
||||
public async clickDocSortAsc(field?: string, sortText = 'Sort Old-New') {
|
||||
await this.clickColumnMenuField(field);
|
||||
await this.find.clickByButtonText(sortText);
|
||||
}
|
||||
|
||||
public async clickDocSortDesc(field?: string, sortText = 'Sort New-Old') {
|
||||
if (field) {
|
||||
await this.openColMenuByField(field);
|
||||
} else {
|
||||
await this.find.clickByCssSelector('.euiDataGridHeaderCell__button');
|
||||
}
|
||||
await this.clickColumnMenuField(field);
|
||||
await this.find.clickByButtonText(sortText);
|
||||
}
|
||||
|
||||
public async clickMoveColumnRight(field?: string) {
|
||||
await this.clickColumnMenuField(field);
|
||||
await this.find.clickByButtonText('Move right');
|
||||
}
|
||||
|
||||
public async clickMoveColumnLeft(field?: string) {
|
||||
await this.clickColumnMenuField(field);
|
||||
await this.find.clickByButtonText('Move left');
|
||||
}
|
||||
|
||||
public async clickRemoveColumn(field?: string) {
|
||||
if (field) {
|
||||
await this.openColMenuByField(field);
|
||||
} else {
|
||||
await this.find.clickByCssSelector('.euiDataGridHeaderCell__button');
|
||||
}
|
||||
await this.clickColumnMenuField(field);
|
||||
await this.find.clickByButtonText('Remove column');
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue