import React from 'react'
import { dbaasUrl } from 'apiClient/endpoint'

// /proxy/cluster/{tidb_cluster_ID}/kubernetes_dashboard/#/overview?namespace=tidb{tidb_cluster_ID}
function buildDashboardUrl(clusterId: string) {
  return `${dbaasUrl}/proxy/cluster/${clusterId}/kubernetes_dashboard/#/overview?namespace=tidb${clusterId}`
}

export const K8sDashboardLink = ({ clusterId }: { clusterId: string }) => {
  return (
    <a
      target="_blank"
      rel="noopener noreferrer"
      href={buildDashboardUrl(clusterId)}
    >
      K8s Dashboard Link
    </a>
  )
}
