diff --git a/src/components/CancelDeployment/index.js b/src/components/CancelDeployment/index.js index bf4839fe..833754bf 100644 --- a/src/components/CancelDeployment/index.js +++ b/src/components/CancelDeployment/index.js @@ -12,7 +12,7 @@ const CANCEL_DEPLOYMENT_MUTATION = gql` `; export const CancelDeploymentButton = ({ action, success, loading, error, beforeText, afterText }) => { - const [api, contextHolder] = notification.useNotification(); + const [api, contextHolder] = notification.useNotification({ maxCount: 1 }); const openNotificationWithIcon = errorMessage => { api['error']({ diff --git a/src/components/DeployLatest/index.js b/src/components/DeployLatest/index.js index df675996..2b1efe68 100644 --- a/src/components/DeployLatest/index.js +++ b/src/components/DeployLatest/index.js @@ -1,6 +1,7 @@ -import React, {useState} from 'react'; +import React from 'react'; import { Mutation } from 'react-apollo'; +import { notification } from 'antd'; import Button from 'components/Button'; import gql from 'graphql-tag'; @@ -30,6 +31,18 @@ const DeployLatest = ({ pageEnvironment: environment, onDeploy, ...rest }) => { deploymentsEnabled = false; } + const [api, contextHolder] = notification.useNotification({ maxCount: 1 }); + + const openNotificationWithIcon = errorMessage => { + api['error']({ + message: 'There was a problem deploying.', + description: errorMessage, + placement: 'top', + duration: 0, + style: { width: '500px' }, + }); + }; + return ( {!deploymentsEnabled && ( @@ -60,17 +73,12 @@ const DeployLatest = ({ pageEnvironment: environment, onDeploy, ...rest }) => { } return ( - {success &&
Deployment queued.
} - - {error && ( -
-

There was a problem deploying.

-

{error.message}

-
- )} + {error && openNotificationWithIcon(error.message)}
); }}