forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* WIP: prerelease toggle * changed styling * fixed switch * auto upgrade and hiding button on callout if no ga available * tweak prereleaseIntegrationsEnabled state to add undefined state in beginning * fixing types and tests * fixing types * removed dummy endpoint package * extracted hooks to avoid double loading of packages and categories * prevent double loading of package details * updated openapi * fixing tests * added try catch around loading settings in preconfig * error handling on integrations, fixing cypress test with that * reading prerelease from settings during package install * fix tests * fixing tests * added back experimental as deprecated, fix more tests * fixed issue in package details overview where nlatest version didnt show prerelease * changed getPackageInfo to load prerelease from settings if not provided * fixing tests, moved getSettings to bulk install fn * fixing cypress and endpoint tests * fix tests * fix tests * added back experimental flag in other plugins, as it is not exaclty the same as prerelease * reverted mappings change in api_integration * fixed prerelease condition, fix limited test, trying to fix field limit * removed experimental flag from epr api call * added unit test on version dropdown and prerelease callout, set field limit to 1500 * added UI package version check for prerelease disabled case * fixed synthetics test * extracted getSettings to a helper function * removed using prerease setting in auto upgrades and install * fixing tests, added back prerelease flag to install apis * fixing a bug with version and release badge of installed integrations * reload package in overview after loading prerelease setting, this is to show available upgrade if package is installed * fixing tests by passing prerelease flag on apis * fixing cypress test Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
- Loading branch information
1 parent
8be27cb
commit 5431d1f
Showing
66 changed files
with
886 additions
and
148 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
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
55 changes: 55 additions & 0 deletions
55
x-pack/plugins/fleet/public/applications/integrations/hooks/use_categories.tsx
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,55 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { useEffect, useCallback, useState } from 'react'; | ||
|
||
import type { RequestError } from '../../fleet/hooks'; | ||
import { sendGetCategories } from '../../fleet/hooks'; | ||
import type { GetCategoriesResponse } from '../types'; | ||
|
||
export function useCategories(prerelease?: boolean) { | ||
const [data, setData] = useState<GetCategoriesResponse | undefined>(); | ||
const [error, setError] = useState<RequestError | undefined>(); | ||
const [isLoading, setIsLoading] = useState(false); | ||
const [isPrereleaseEnabled, setIsPrereleaseEnabled] = useState(prerelease); | ||
|
||
const fetchData = useCallback(async () => { | ||
if (prerelease === undefined) { | ||
return; | ||
} | ||
if (isPrereleaseEnabled === prerelease) { | ||
return; | ||
} | ||
setIsPrereleaseEnabled(prerelease); | ||
setIsLoading(true); | ||
try { | ||
const res = await sendGetCategories({ | ||
include_policy_templates: true, | ||
prerelease, | ||
}); | ||
if (res.error) { | ||
throw res.error; | ||
} | ||
if (res.data) { | ||
setData(res.data); | ||
} | ||
} catch (err) { | ||
setError(err); | ||
} | ||
setIsLoading(false); | ||
}, [prerelease, isPrereleaseEnabled]); | ||
|
||
useEffect(() => { | ||
fetchData(); | ||
}, [fetchData]); | ||
|
||
return { | ||
data, | ||
error, | ||
isLoading, | ||
}; | ||
} |
Oops, something went wrong.