Skip to content

Commit

Permalink
Add NoMatchingConnector event (#12036)
Browse files Browse the repository at this point in the history
* Add NoMatchingConnector event

* Remove console.log
  • Loading branch information
timroes authored Apr 15, 2022
1 parent 281e0ee commit b176625
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions airbyte-webapp/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"form.selectConnector": "Type to search for a connector",
"form.searchName": "search by name...",
"form.noResult": "No result",
"form.noConnectorFound": "No matching connector found",
"form.sourceName.placeholder": "Your source name",
"form.destinationName.placeholder": "Your destination name",
"form.connectionName.placeholder": "Name",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ const ConnectorServiceTypeControl: React.FC<{
documentationUrl,
onOpenRequestConnectorModal,
}) => {
const formatMessage = useIntl().formatMessage;
const { formatMessage } = useIntl();
const [field, fieldMeta, { setValue }] = useField(property.path);
const analytics = useAnalyticsService();

Expand Down Expand Up @@ -212,6 +212,21 @@ const ConnectorServiceTypeControl: React.FC<{
[availableServices]
);

const getNoOptionsMessage = useCallback(
({ inputValue }: { inputValue: string }) => {
analytics.track(
formType === "source"
? "Airbyte.UI.NewSource.NoMatchingConnector"
: "Airbyte.UI.NewDestination.NoMatchingConnector",
{
query: inputValue,
}
);
return formatMessage({ id: "form.noConnectorFound" });
},
[analytics, formType, formatMessage]
);

const selectedService = React.useMemo(
() => availableServices.find((s) => Connector.id(s) === field.value),
[field.value, availableServices]
Expand Down Expand Up @@ -259,6 +274,7 @@ const ConnectorServiceTypeControl: React.FC<{
options={sortedDropDownData}
onChange={handleSelect}
onMenuOpen={onMenuOpen}
noOptionsMessage={getNoOptionsMessage}
/>
</ControlLabels>
{selectedService && documentationUrl && (
Expand Down

0 comments on commit b176625

Please sign in to comment.