From e58e489419d23fffbf6006d2a5420ee8fcec00a3 Mon Sep 17 00:00:00 2001 From: Lisa Kim Date: Thu, 14 Nov 2024 11:32:42 -0800 Subject: [PATCH] Web discover minor fixes (#48862) * Remove optional wording (no longer optional) * Fix incorrect log app name * Show already exists error messages instead of making it seem we are still searching * Address CRs --- .../DeployService/AutoDeploy/AutoDeploy.tsx | 2 +- .../EnrollEKSCluster/AgentWaitingDialog.tsx | 4 +- .../EnrollEksCluster.story.tsx | 40 +++++++++++++++++-- .../EnrollEKSCluster/EnrollEksCluster.tsx | 30 +++++++++----- .../EnrollEKSCluster/EnrollmentDialog.tsx | 9 +++-- 5 files changed, 67 insertions(+), 18 deletions(-) diff --git a/web/packages/teleport/src/Discover/Database/DeployService/AutoDeploy/AutoDeploy.tsx b/web/packages/teleport/src/Discover/Database/DeployService/AutoDeploy/AutoDeploy.tsx index 9439b9a174b93..79a0355e73816 100644 --- a/web/packages/teleport/src/Discover/Database/DeployService/AutoDeploy/AutoDeploy.tsx +++ b/web/packages/teleport/src/Discover/Database/DeployService/AutoDeploy/AutoDeploy.tsx @@ -249,7 +249,7 @@ export function AutoDeploy({ toggleDeployMethod }: DeployServiceProp) {
-

Step 3 (Optional)

+

Step 3

- kubectl logs -l app=teleport-agent -n teleport-agent + + kubectl logs -l app=teleport-kube-agent -n teleport-agent + diff --git a/web/packages/teleport/src/Discover/Kubernetes/EnrollEKSCluster/EnrollEksCluster.story.tsx b/web/packages/teleport/src/Discover/Kubernetes/EnrollEKSCluster/EnrollEksCluster.story.tsx index 9d56b991445f9..06dd72cf882ad 100644 --- a/web/packages/teleport/src/Discover/Kubernetes/EnrollEKSCluster/EnrollEksCluster.story.tsx +++ b/web/packages/teleport/src/Discover/Kubernetes/EnrollEKSCluster/EnrollEksCluster.story.tsx @@ -165,7 +165,6 @@ WithAwsPermissionsError.parameters = { }; export const WithEnrollmentError = () => ; - WithEnrollmentError.parameters = { msw: { handlers: [ @@ -194,6 +193,39 @@ WithEnrollmentError.parameters = { }, }; +export const WithAlreadyExistsError = () => ( + +); +WithAlreadyExistsError.parameters = { + msw: { + handlers: [ + tokenHandler, + http.post(cfg.getListEKSClustersUrl(integrationName), () => { + { + return HttpResponse.json({ clusters: eksClusters }); + } + }), + http.get( + cfg.getKubernetesUrl(getUserContext().cluster.clusterId, {}), + () => { + return HttpResponse.json({ items: kubeServers }); + } + ), + http.post(cfg.getEnrollEksClusterUrl(integrationName), async () => { + await delay(1000); + return HttpResponse.json({ + results: [ + { + clusterName: 'EKS1', + error: 'teleport-kube-agent is already installed on the cluster', + }, + ], + }); + }), + ], + }, +}; + export const WithOtherError = () => ; WithOtherError.parameters = { @@ -212,7 +244,7 @@ WithOtherError.parameters = { }, }; -const Component = () => { +const Component = ({ devInfoText = '' }) => { const ctx = createTeleportContext(); const discoverCtx: DiscoverContextState = { agentMeta: { @@ -268,7 +300,9 @@ const Component = () => { resourceKind={ResourceKind.Kubernetes} > - Devs: Select any region to see story state + + {devInfoText || 'Devs: Select any region to see story state'} + )} {(enrollmentState.status === 'enrolling' || - enrollmentState.status === 'error') && ( + enrollmentState.status === 'error' || + enrollmentState.status === 'alreadyExists') && ( @@ -70,9 +71,11 @@ export function EnrollmentDialog({ {error} - - Retry - + {status === 'error' && ( + + Retry + + )} Close