-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into sidebar-page-links
- Loading branch information
Showing
17 changed files
with
193 additions
and
135 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
type = "fixed" | ||
message = "Fix that non visible items are selected in index sets table when changing field type" | ||
|
||
issues = ["20592"] | ||
pulls = ["20616"] |
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
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
63 changes: 63 additions & 0 deletions
63
...og2-web-interface/src/views/logic/fieldactions/ChangeFieldType/hooks/useAllIndexSetIds.ts
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,63 @@ | ||
/* | ||
* Copyright (C) 2020 Graylog, Inc. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the Server Side Public License, version 1, | ||
* as published by MongoDB, Inc. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* Server Side Public License for more details. | ||
* | ||
* You should have received a copy of the Server Side Public License | ||
* along with this program. If not, see | ||
* <http://www.mongodb.com/licensing/server-side-public-license>. | ||
*/ | ||
import { useQuery } from '@tanstack/react-query'; | ||
|
||
import UserNotification from 'util/UserNotification'; | ||
import fetch from 'logic/rest/FetchProvider'; | ||
import { qualifyUrl } from 'util/URLUtils'; | ||
|
||
export type SimpleIndexSet = { id: string, type: string }; | ||
type IndexSetsState = Array<SimpleIndexSet>; | ||
const INITIAL_DATA: IndexSetsState = []; | ||
|
||
const url = qualifyUrl('system/indices/index_sets/types/index_sets_with_field_type_change_support'); | ||
|
||
const fetchAllIndexSetIds = async (streams: Array<string>): Promise<IndexSetsState> => fetch<Array<{index_set_id: string, type: string }>>('POST', url, streams?.length ? streams : undefined).then( | ||
(elements) => { | ||
const list: Array<SimpleIndexSet> = elements.map((element) => ({ | ||
id: element.index_set_id, | ||
type: element.type, | ||
})); | ||
|
||
return list; | ||
}, | ||
); | ||
|
||
const useAllIndexSetIds = (streams: Array<string>): { | ||
data: IndexSetsState, | ||
isLoading: boolean, | ||
refetch: () => void, | ||
} => { | ||
const { data, isLoading, refetch } = useQuery( | ||
['allIndexSetIds', ...streams], | ||
() => fetchAllIndexSetIds(streams), | ||
{ | ||
onError: (errorThrown) => { | ||
UserNotification.error(`Loading index sets with field type change support failed with status: ${errorThrown}`, | ||
'Could not load index sets with field type change support'); | ||
}, | ||
}, | ||
); | ||
|
||
return ({ | ||
data: data ?? INITIAL_DATA, | ||
isLoading, | ||
refetch, | ||
}); | ||
}; | ||
|
||
export default useAllIndexSetIds; |
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.