mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Search][Connectors] Fixing custom connector icon rendering (#212225)
## Summary Fixing areas where we were not rendering well the custom connector icon as described in this ticket: https://github.com/elastic/search-team/issues/9362    ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging. - [ ] [See some risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) - [ ] ...
This commit is contained in:
parent
52ab19db2d
commit
965cbbabc0
4 changed files with 38 additions and 31 deletions
|
@ -57,6 +57,12 @@ export const ConnectorConfiguration: React.FC = () => {
|
|||
[connectors]
|
||||
);
|
||||
|
||||
// TODO service_type === "" is considered unknown/custom connector multiple places replace all of them with a better solution
|
||||
const CUSTOM_CONNECTOR = useMemo(
|
||||
() => connectors.filter(({ serviceType }) => serviceType === ''),
|
||||
[connectors]
|
||||
);
|
||||
|
||||
const { updateConnectorConfiguration } = useActions(ConnectorViewLogic);
|
||||
|
||||
if (!connector) {
|
||||
|
@ -69,19 +75,10 @@ export const ConnectorConfiguration: React.FC = () => {
|
|||
|
||||
const isWaitingForConnector = !connector.status || connector.status === ConnectorStatus.CREATED;
|
||||
|
||||
const nativeConnector = NATIVE_CONNECTORS.find(
|
||||
(connectorDefinition) => connectorDefinition.serviceType === connector.service_type
|
||||
) || {
|
||||
docsUrl: '',
|
||||
externalAuthDocsUrl: '',
|
||||
externalDocsUrl: '',
|
||||
iconPath: 'custom.svg',
|
||||
isBeta: true,
|
||||
isNative: false,
|
||||
keywords: [],
|
||||
name: connector.name,
|
||||
serviceType: connector.service_type ?? '',
|
||||
};
|
||||
const nativeConnector =
|
||||
NATIVE_CONNECTORS.find(
|
||||
(connectorDefinition) => connectorDefinition.serviceType === connector.service_type
|
||||
) || CUSTOM_CONNECTOR[0];
|
||||
|
||||
const iconPath = nativeConnector.iconPath;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
import React, { ReactNode } from 'react';
|
||||
import React, { ReactNode, useMemo } from 'react';
|
||||
|
||||
import { useValues } from 'kea';
|
||||
|
||||
|
@ -126,7 +126,14 @@ export const ConnectorStats: React.FC<ConnectorStatsProps> = ({
|
|||
services: { discover },
|
||||
} = useKibana<KibanaDeps>();
|
||||
const { http } = useValues(HttpLogic);
|
||||
const connectorDefinition = connectorTypes.find((c) => c.serviceType === connector.service_type);
|
||||
// TODO service_type === "" is considered unknown/custom connector multiple places replace all of them with a better solution
|
||||
const CUSTOM_CONNECTOR = useMemo(
|
||||
() => connectorTypes.filter(({ serviceType }) => serviceType === ''),
|
||||
[connectorTypes]
|
||||
);
|
||||
const connectorDefinition =
|
||||
connectorTypes.find((c) => c.serviceType === connector.service_type) || CUSTOM_CONNECTOR[0];
|
||||
|
||||
const columns = connector.is_native ? 2 : 3;
|
||||
|
||||
const agnetlessPolicyExists = !!agentlessOverview?.policy;
|
||||
|
|
|
@ -40,29 +40,26 @@ export const NativeConnectorConfiguration: React.FC = () => {
|
|||
() => connectors.filter(({ isNative }) => isNative),
|
||||
[connectors]
|
||||
);
|
||||
|
||||
// TODO service_type === "" is considered unknown/custom connector multiple places replace all of them with a better solution
|
||||
const CUSTOM_CONNECTOR = useMemo(
|
||||
() => connectors.filter(({ serviceType }) => serviceType === ''),
|
||||
[connectors]
|
||||
);
|
||||
|
||||
const BETA_CONNECTORS = useMemo(() => connectors.filter(({ isBeta }) => isBeta), [connectors]);
|
||||
|
||||
if (!connector) {
|
||||
return <></>;
|
||||
}
|
||||
|
||||
const nativeConnector = NATIVE_CONNECTORS.find(
|
||||
(connectorDefinition) => connectorDefinition.serviceType === connector.service_type
|
||||
) || {
|
||||
docsUrl: '',
|
||||
externalAuthDocsUrl: '',
|
||||
externalDocsUrl: '',
|
||||
iconPath: 'custom.svg',
|
||||
isBeta: true,
|
||||
isNative: true,
|
||||
keywords: [],
|
||||
name: connector.name,
|
||||
serviceType: connector.service_type ?? '',
|
||||
};
|
||||
const nativeConnector =
|
||||
NATIVE_CONNECTORS.find(
|
||||
(connectorDefinition) => connectorDefinition.serviceType === connector.service_type
|
||||
) || CUSTOM_CONNECTOR[0];
|
||||
|
||||
const iconPath = nativeConnector.iconPath;
|
||||
|
||||
// TODO service_type === "" is considered unknown/custom connector multipleplaces replace all of them with a better solution
|
||||
const isBeta =
|
||||
!connector.service_type ||
|
||||
Boolean(BETA_CONNECTORS.find(({ serviceType }) => serviceType === connector.service_type));
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import React, { useMemo } from 'react';
|
||||
|
||||
import { useValues } from 'kea';
|
||||
|
||||
|
@ -23,7 +23,13 @@ export interface ConnectorTypeProps {
|
|||
|
||||
export const ConnectorType: React.FC<ConnectorTypeProps> = ({ serviceType }) => {
|
||||
const { connectorTypes } = useValues(KibanaLogic);
|
||||
const connector = connectorTypes.find((c) => c.serviceType === serviceType);
|
||||
// TODO service_type === "" is considered unknown/custom connector multiple places replace all of them with a better solution
|
||||
const CUSTOM_CONNECTOR = useMemo(
|
||||
() => connectorTypes.filter(({ serviceType: type }) => type === ''),
|
||||
[connectorTypes]
|
||||
);
|
||||
const connector =
|
||||
connectorTypes.find((c) => c.serviceType === serviceType) || CUSTOM_CONNECTOR[0];
|
||||
return (
|
||||
<EuiFlexGroup gutterSize="s" responsive={false} alignItems="center">
|
||||
{connector && connector.iconPath && (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue