diff --git a/public/app/percona/dbaas/components/DBCluster/DBCluster.tsx b/public/app/percona/dbaas/components/DBCluster/DBCluster.tsx index 03e38fe85883..8136d1174d85 100644 --- a/public/app/percona/dbaas/components/DBCluster/DBCluster.tsx +++ b/public/app/percona/dbaas/components/DBCluster/DBCluster.tsx @@ -23,6 +23,7 @@ import { fetchDBClustersAction } from '../../../shared/core/reducers/dbaas/dbClu import { selectDBCluster, selectKubernetesCluster } from '../../../shared/core/reducers/dbaas/dbaas'; import { useUpdateOfKubernetesList } from '../../hooks/useKubernetesList'; import { AddClusterButton } from '../AddClusterButton/AddClusterButton'; +import DbaasDeprecationWarning from '../DeprecationWarning'; import { isKubernetesListUnavailable } from '../Kubernetes/Kubernetes.utils'; import { KubernetesClusterStatus } from '../Kubernetes/KubernetesClusterStatus/KubernetesClusterStatus.types'; @@ -215,6 +216,7 @@ export const DBCluster: FC = () => { +
diff --git a/public/app/percona/dbaas/components/DeprecationWarning/DeprecationWarning.constants.ts b/public/app/percona/dbaas/components/DeprecationWarning/DeprecationWarning.constants.ts new file mode 100644 index 000000000000..c97ec8a791ef --- /dev/null +++ b/public/app/percona/dbaas/components/DeprecationWarning/DeprecationWarning.constants.ts @@ -0,0 +1,2 @@ +export const EVEREST_LINK = 'http://per.co.na/pmm-to-everest'; +export const MIGRATION_GUIDE_LINK = 'http://per.co.na/pmm-to-everest-guide'; diff --git a/public/app/percona/dbaas/components/DeprecationWarning/DeprecationWarning.messages.ts b/public/app/percona/dbaas/components/DeprecationWarning/DeprecationWarning.messages.ts new file mode 100644 index 000000000000..a069cbf9b134 --- /dev/null +++ b/public/app/percona/dbaas/components/DeprecationWarning/DeprecationWarning.messages.ts @@ -0,0 +1,8 @@ +export const Messages = { + title: 'Deprecation notice', + warning: 'DBaaS feature is deprecated. We encourage you to use ', + everest: 'Everest', + warningCont: ' instead. Check out our ', + guide: 'Migration guide', + dot: '.', +}; diff --git a/public/app/percona/dbaas/components/DeprecationWarning/DeprecationWarning.tsx b/public/app/percona/dbaas/components/DeprecationWarning/DeprecationWarning.tsx new file mode 100644 index 000000000000..4c0530e68645 --- /dev/null +++ b/public/app/percona/dbaas/components/DeprecationWarning/DeprecationWarning.tsx @@ -0,0 +1,24 @@ +import React, { FC } from 'react'; + +import { Alert } from '@grafana/ui'; + +import { EVEREST_LINK, MIGRATION_GUIDE_LINK } from './DeprecationWarning.constants'; +import { Messages } from './DeprecationWarning.messages'; + +const DbaasDeprecationWarning: FC = () => ( +
+ + {Messages.warning} + + {Messages.everest} + + {Messages.warningCont} + + {Messages.guide} + + {Messages.dot} + +
+); + +export default DbaasDeprecationWarning; diff --git a/public/app/percona/dbaas/components/DeprecationWarning/index.ts b/public/app/percona/dbaas/components/DeprecationWarning/index.ts new file mode 100644 index 000000000000..2d3b0cd490d7 --- /dev/null +++ b/public/app/percona/dbaas/components/DeprecationWarning/index.ts @@ -0,0 +1,3 @@ +import DbaasDeprecationWarning from './DeprecationWarning'; + +export default DbaasDeprecationWarning; diff --git a/public/app/percona/dbaas/components/Kubernetes/KubernetesInventory.test.tsx b/public/app/percona/dbaas/components/Kubernetes/KubernetesInventory.test.tsx index 086541cb9bc6..1a15940e9442 100644 --- a/public/app/percona/dbaas/components/Kubernetes/KubernetesInventory.test.tsx +++ b/public/app/percona/dbaas/components/Kubernetes/KubernetesInventory.test.tsx @@ -5,7 +5,6 @@ import { Provider } from 'react-redux'; import { configureStore } from 'app/store/configureStore'; import { StoreState } from 'app/types'; -import { KubernetesService } from './Kubernetes.service'; import { KubernetesClusterStatus } from './KubernetesClusterStatus/KubernetesClusterStatus.types'; import { KubernetesInventory } from './KubernetesInventory'; import { KubernetesOperatorStatus } from './OperatorStatusItem/KubernetesOperatorStatus/KubernetesOperatorStatus.types'; @@ -54,33 +53,4 @@ describe('KubernetesInventory::', () => { await waitForElementToBeRemoved(() => screen.getByTestId('table-loading')); expect(screen.getAllByTestId('table-row')).toHaveLength(2); }); - - it('shows portal k8s free cluster promoting message when user has no clusters', async () => { - jest.spyOn(KubernetesService, 'getKubernetes').mockImplementation(() => - Promise.resolve({ - kubernetes_clusters: [], - }) - ); - render( - - - - ); - - expect(screen.queryByTestId('pmm-server-promote-portal-k8s-cluster-message')).not.toBeInTheDocument(); - await waitForElementToBeRemoved(() => screen.getByTestId('table-loading')); - expect(screen.getByTestId('pmm-server-promote-portal-k8s-cluster-message')).toBeInTheDocument(); - }); }); diff --git a/public/app/percona/dbaas/components/Kubernetes/KubernetesInventory.tsx b/public/app/percona/dbaas/components/Kubernetes/KubernetesInventory.tsx index cf352669baf4..3bde5afacd4f 100644 --- a/public/app/percona/dbaas/components/Kubernetes/KubernetesInventory.tsx +++ b/public/app/percona/dbaas/components/Kubernetes/KubernetesInventory.tsx @@ -22,6 +22,7 @@ import { useSelector } from 'app/types'; import { useAppDispatch } from '../../../../store/store'; import { useKubernetesList } from '../../hooks/useKubernetesList'; import { AddClusterButton } from '../AddClusterButton/AddClusterButton'; +import DbaasDeprecationWarning from '../DeprecationWarning'; import { clusterActionsRender } from './ColumnRenderers/ColumnRenderers'; import { K8sPageMode } from './K8sRouting/K8sRouting'; @@ -37,7 +38,6 @@ import { KubernetesClusterStatus as K8SStatus } from './KubernetesClusterStatus/ import { ManageComponentsVersionsModal } from './ManageComponentsVersionsModal/ManageComponentsVersionsModal'; import { UpdateOperatorModal } from './OperatorStatusItem/KubernetesOperatorStatus/UpdateOperatorModal/UpdateOperatorModal'; import { OperatorStatusRow } from './OperatorStatusRow/OperatorStatusRow'; -import { PortalK8sFreeClusterPromotingMessage } from './PortalK8sFreeClusterPromotingMessage/PortalK8sFreeClusterPromotingMessage'; import { ViewClusterConfigModal } from './ViewClusterConfigModal/ViewClusterConfigModal'; interface KubernetesInventoryProps { @@ -159,6 +159,7 @@ export const KubernetesInventory: FC = ({ setMode }) = +
@@ -231,7 +232,6 @@ export const KubernetesInventory: FC = ({ setMode }) = />
- {kubernetes && kubernetes.length === 0 && } ); diff --git a/public/app/percona/dbaas/components/Kubernetes/PortalK8sFreeClusterPromotingMessage/PortalK8sFreeClusterPromotingMessage.styles.ts b/public/app/percona/dbaas/components/Kubernetes/PortalK8sFreeClusterPromotingMessage/PortalK8sFreeClusterPromotingMessage.styles.ts deleted file mode 100644 index bcee9a464c90..000000000000 --- a/public/app/percona/dbaas/components/Kubernetes/PortalK8sFreeClusterPromotingMessage/PortalK8sFreeClusterPromotingMessage.styles.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { css } from '@emotion/css'; - -import { GrafanaTheme2 } from '@grafana/data'; - -export const getStyles = ({ v1: { spacing, palette } }: GrafanaTheme2) => ({ - link: css` - color: ${palette.gray4}; - padding-top: ${spacing.sm}; - text-decoration: underline; - &:hover { - color: white; - text-decoration: underline; - } - `, - alert: css` - margin-top: ${spacing.md}; - `, -}); diff --git a/public/app/percona/dbaas/components/Kubernetes/PortalK8sFreeClusterPromotingMessage/PortalK8sFreeClusterPromotingMessage.tsx b/public/app/percona/dbaas/components/Kubernetes/PortalK8sFreeClusterPromotingMessage/PortalK8sFreeClusterPromotingMessage.tsx deleted file mode 100644 index 083c66a0b932..000000000000 --- a/public/app/percona/dbaas/components/Kubernetes/PortalK8sFreeClusterPromotingMessage/PortalK8sFreeClusterPromotingMessage.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import React from 'react'; - -import { Alert, useStyles2 } from '@grafana/ui'; -import { useSelector } from 'app/types'; - -import { getPerconaServer } from '../../../../shared/core/selectors'; - -import { getStyles } from './PortalK8sFreeClusterPromotingMessage.styles'; - -export const PortalK8sFreeClusterPromotingMessage = () => { - const styles = useStyles2(getStyles); - const { saasHost } = useSelector(getPerconaServer); - - return ( - -

- Percona has a time-limited offer for testing DBaaS with a free k8s cluster. Please{' '} - - read more - {' '} - information about this offer. -

-
- ); -}; diff --git a/public/app/percona/settings/Settings.messages.ts b/public/app/percona/settings/Settings.messages.ts index 1f08cfd61c85..811ea8ef788e 100644 --- a/public/app/percona/settings/Settings.messages.ts +++ b/public/app/percona/settings/Settings.messages.ts @@ -47,6 +47,7 @@ export const Messages = { 'These are technical preview features, not recommended to be used in production environments. Read more\n' + ' about feature status', technicalPreviewLinkText: 'here', + deprecatedFeatures: 'Deprecated features', }, alertmanager: { warningPre: "Note: integration with Alertmanager is needed only in cases when you can't use", diff --git a/public/app/percona/settings/components/Advanced/Advanced.tsx b/public/app/percona/settings/components/Advanced/Advanced.tsx index 9c66924482f0..3001b4678caa 100644 --- a/public/app/percona/settings/components/Advanced/Advanced.tsx +++ b/public/app/percona/settings/components/Advanced/Advanced.tsx @@ -4,6 +4,7 @@ import { Field, withTypes } from 'react-final-form'; import { Button, Icon, Spinner, useStyles2 } from '@grafana/ui'; import { OldPage } from 'app/core/components/Page/Page'; +import DbaasDeprecationWarning from 'app/percona/dbaas/components/DeprecationWarning'; import { Messages } from 'app/percona/settings/Settings.messages'; import { getSettingsStyles } from 'app/percona/settings/Settings.styles'; import { FeatureLoader } from 'app/percona/shared/components/Elements/FeatureLoader'; @@ -104,6 +105,7 @@ export const Advanced: FC = () => { backupLabel, backupLink, backupTooltip, + deprecatedFeatures, }, tooltipLinkText, } = Messages; @@ -340,20 +342,6 @@ export const Advanced: FC = () => {

- , input: any) => { - dBaaSToggleOnChange(event, input, mutators); - }} - /> { component={SwitchRow} /> +
+ {deprecatedFeatures} + {!!values.dbaas && } + , input: any) => { + dBaaSToggleOnChange(event, input, mutators); + }} + /> +