Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -48655,6 +48655,7 @@
"xpack.watcher.sections.watchList.watchTable.commentHeader": "Commentaire",
"xpack.watcher.sections.watchList.watchTable.commentHeader.tooltipText": "Si des actions ont été reconnues ou contraintes, ou si leur exécution a échoué.",
"xpack.watcher.sections.watchList.watchTable.disabledWatchTooltipText": "Cette alerte est en lecture seule",
"xpack.watcher.sections.watchList.watchTable.errorOnSearch": "Recherche non valide : {queryError}",
"xpack.watcher.sections.watchList.watchTable.idHeader": "ID",
"xpack.watcher.sections.watchList.watchTable.lastFiredHeader": "Dernière correspondance de la condition",
"xpack.watcher.sections.watchList.watchTable.lastFiredHeader.tooltipText": "Dernière fois où la condition a été remplie et qu'une action a été entreprise.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48608,6 +48608,7 @@
"xpack.watcher.sections.watchList.watchTable.commentHeader": "コメント",
"xpack.watcher.sections.watchList.watchTable.commentHeader.tooltipText": "アクションが確認または調整されたか、あるいは実行が失敗したかどうか。",
"xpack.watcher.sections.watchList.watchTable.disabledWatchTooltipText": "このウォッチは読み取り専用です",
"xpack.watcher.sections.watchList.watchTable.errorOnSearch": "無効な検索:{queryError}",
"xpack.watcher.sections.watchList.watchTable.idHeader": "ID",
"xpack.watcher.sections.watchList.watchTable.lastFiredHeader": "前回条件が満たされた日時",
"xpack.watcher.sections.watchList.watchTable.lastFiredHeader.tooltipText": "最後に条件が満たされ、アクションが実行された日付。",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48698,6 +48698,7 @@
"xpack.watcher.sections.watchList.watchTable.commentHeader": "注释",
"xpack.watcher.sections.watchList.watchTable.commentHeader.tooltipText": "是已确认、已限制还是无法执行任何操作。",
"xpack.watcher.sections.watchList.watchTable.disabledWatchTooltipText": "此监视为只读",
"xpack.watcher.sections.watchList.watchTable.errorOnSearch": "搜索无效:{queryError}",
"xpack.watcher.sections.watchList.watchTable.idHeader": "ID",
"xpack.watcher.sections.watchList.watchTable.lastFiredHeader": "上次符合条件",
"xpack.watcher.sections.watchList.watchTable.lastFiredHeader.tooltipText": "上次符合条件并采取了操作的时间。",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,48 @@ describe('<WatchListPage />', () => {
testBed.component.update();
});

test('should show error callout if search is invalid', async () => {
const { exists, actions } = testBed;

await actions.searchWatches('or');

expect(exists('watcherListSearchError')).toBe(true);
});

test('should retain the search query', async () => {
const { actions, find } = testBed;
const { table, actions } = testBed;

await actions.searchWatches(watch1.name);

await actions.searchWatches('query text');
const { tableCellsValues } = table.getMetaData('watchesTable');

// Expect "watch1" is only visible in the table
expect(tableCellsValues.length).toEqual(1);
const row = tableCellsValues[0];
const { name, id } = watch1;

const expectedRow = [
'', // checkbox
id,
name,
'', // state
'', // lastMetCondition
'', // lastChecked
'', // comment
'', // row actions
];

expect(row).toEqual(expectedRow);

await actions.advanceTimeToTableRefresh();

const searchInput = find('watchesTableContainer').find('input.euiFieldSearch');
// Verify the query text is still in the search bar
// @ts-ignore
expect(searchInput.instance().value).toEqual('query text');
const { tableCellsValues: updatedTableCellsValues } = table.getMetaData('watchesTable');

// Verify "watch1" is still the only watch visible in the table
expect(updatedTableCellsValues.length).toEqual(1);
const updatedRow = updatedTableCellsValues[0];

expect(updatedRow).toEqual(expectedRow);
});

test('should set the correct app title', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* 2.0.
*/

export const INDEX_NAMES = {
export const INDEX_NAMES: { [key: string]: string } = {
WATCHES: '.watches',
WATCHER_HISTORY: '.watcher-history-*',
};
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,3 @@ export type {
ServerWatchStatusModel,
ClientWatchStatusModel,
} from './status_types';

export type { BaseWatch } from './watch_types';
Original file line number Diff line number Diff line change
Expand Up @@ -29,33 +29,16 @@ export const getHttpClient = () => {

const basePath = ROUTES.API_ROOT;

const loadWatchesDeserializer = ({
watches = [],
watchCount,
}: {
watches: any[];
watchCount: number;
}) => {
return {
watches: watches.map((watch: any) => Watch.fromUpstreamJson(watch)),
watchCount,
};
const loadWatchesDeserializer = ({ watches = [] }: { watches: any[] }) => {
return watches.map((watch: any) => Watch.fromUpstreamJson(watch));
};

export const useLoadWatches = (
pollIntervalMs: number,
pageSize: number,
pageIndex: number,
sortField?: string,
sortDirection?: string,
query?: string
) => {
export const useLoadWatches = (pollIntervalMs: number) => {
return useRequest({
path: `${basePath}/watches`,
method: 'get',
pollIntervalMs,
deserializer: loadWatchesDeserializer,
query: { pageSize, pageIndex, sortField, sortDirection, query },
});
};

Expand Down
Loading