hide integration editor table if no extensions available
@@ -78,18 +78,12 @@ export interface ISaveIntegrationPageProps
* @todo toast notifications.
* @todo redirect to the integration detail page once available.
*/
-export const SaveIntegrationPage: React.FunctionComponent<ISaveIntegrationPageProps> = ({
- postPublishHref,
- postSaveHref,
- getBreadcrumb,
- cancelHref,
- ...props
-}) => {
+export const SaveIntegrationPage: React.FunctionComponent<ISaveIntegrationPageProps> =
+ ({ postPublishHref, postSaveHref, getBreadcrumb, cancelHref, ...props }) => {
const { resource: extensionsData } = useExtensions(undefined, 'Libraries');
- const [currentSelectedExtensionIds, setSelectedExtensionIds] = React.useState<
- string[]
- >([]);
+ const [currentSelectedExtensionIds, setSelectedExtensionIds] =
+ React.useState<string[]>([]);
const [error, setError] = React.useState<
false | ErrorResponse | IntegrationSaveErrorResponse
>(false);
@@ -137,7 +131,11 @@ export const SaveIntegrationPage: React.FunctionComponent<ISaveIntegrationPagePr
let shouldPublish = false;
const onSave = async (
- { name, description, dependencies }: ISaveIntegrationForm,
+ {
+ name,
+ description,
+ dependencies,
+ }: ISaveIntegrationForm,
actions: any
) => {
setError(false);
@@ -157,7 +155,9 @@ export const SaveIntegrationPage: React.FunctionComponent<ISaveIntegrationPagePr
);
if (shouldPublish) {
pushNotification(
- i18n.t('integrations:PublishingIntegrationMessage'),
+ i18n.t(
+ 'integrations:PublishingIntegrationMessage'
+ ),
'info'
);
try {
@@ -171,7 +171,8 @@ export const SaveIntegrationPage: React.FunctionComponent<ISaveIntegrationPagePr
i18n.t(
'integrations:PublishingIntegrationFailedMessage',
{
- error: err.errorMessage || err.message || err,
+ error:
+ err.errorMessage || err.message || err,
}
),
'warning'
@@ -286,15 +287,18 @@ export const SaveIntegrationPage: React.FunctionComponent<ISaveIntegrationPagePr
<SyndesisAlert
level={SyndesisAlertLevel.ERROR}
message={
- (error as ErrorResponse).userMsg ||
- (error as IntegrationSaveErrorResponse)
- .message
+ (error as ErrorResponse)
+ .userMsg ||
+ (
+ error as IntegrationSaveErrorResponse
+ ).message
}
detail={
(error as ErrorResponse)
.developerMsg ||
- (error as IntegrationSaveErrorResponse)
- .error
+ (
+ error as IntegrationSaveErrorResponse
+ ).error
}
i18nTextExpanded={t(
'shared:HideDetails'
@@ -305,6 +309,7 @@ export const SaveIntegrationPage: React.FunctionComponent<ISaveIntegrationPagePr
/>
)}
{fields}
+ {extensions.length > 0 && (
<IntegrationEditorExtensionTable
extensionsAvailable={extensions}
i18nHeaderDescription={t(
@@ -327,6 +332,7 @@ export const SaveIntegrationPage: React.FunctionComponent<ISaveIntegrationPagePr
preSelectedExtensions
}
/>
+ )}
</>
</IntegrationSaveForm>
}
