All files / modules/75-ce/components/COGatewayList COGatewayAnalytics.tsx

89.74% Statements 105/117
58.29% Branches 253/434
70.83% Functions 17/24
89.38% Lines 101/113

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592              2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x                 2x 2x 2x 2x 2x   2x 2x 2x 2x 2x               2x   2x 2x 2x 2x                                   1x                                                                                                                                       2x 14x 7x 7x   2x 8x 8x   8x       8x     2x 5x 5x 5x   5x 5x 5x   5x                       5x             5x                       5x             5x             5x       5x 3x 3x                   5x                                         1x             1x                                                                                                                                                                                         3x                                                                                                               2x 5x 5x   5x               5x                                                                           2x 7x 7x   7x 7x 7x 7x 7x   7x                     7x 3x     3x 3x 3x 3x 3x 3x 3x 1x 1x 1x     1x 1x   3x 3x 3x 3x 3x     7x                                                 2x 5x 5x                                             2x 5x 5x   5x             5x 5x   5x                                                             2x  
/*
 * Copyright 2021 Harness Inc. All rights reserved.
 * Use of this source code is governed by the PolyForm Shield 1.0.0 license
 * that can be found in the licenses directory at the root of this repository, also available at
 * https://polyformproject.org/wp-content/uploads/2020/06/PolyForm-Shield-1.0.0.txt.
 */
 
import React, { useEffect, useState } from 'react'
import { isEmpty as _isEmpty, defaultTo as _defaultTo } from 'lodash-es'
import { Switch, Tab } from '@blueprintjs/core'
import copy from 'copy-to-clipboard'
import { Layout, Container, Text, Icon, Link, Tabs, Heading, IconName } from '@wings-software/uicore'
import { Color } from '@harness/design-system'
import Highcharts from 'highcharts'
import HighchartsReact from 'highcharts-react-official'
import { useParams, Link as RouterLink } from 'react-router-dom'
import moment from 'moment'
import {
  AllResourcesOfAccountResponse,
  Service,
  ServiceSavings,
  useAllServiceResources,
  useDescribeServiceInContainerServiceCluster,
  useHealthOfService,
  useSavingsOfService
} from 'services/lw'
import routes from '@common/RouteDefinitions'
import { useStrings } from 'framework/strings'
import { useToaster } from '@common/exports'
import useDeleteServiceHook from '@ce/common/useDeleteService'
import { Utils } from '@ce/common/Utils'
import type { AccountPathProps } from '@common/interfaces/RouteInterfaces'
import { useGetConnector } from 'services/cd-ng'
import { allProviders, ceConnectorTypes } from '@ce/constants'
import COGatewayLogs from './COGatewayLogs'
import COGatewayUsageTime from './COGatewayUsageTime'
import {
  getInstancesLink,
  getRelativeTime,
  getStateTag,
  getRiskGaugeChartOptions,
  getDay,
  roundToPrecision
} from './Utils'
import useToggleRuleState from './useToggleRuleState'
// import SpotvsODChart from './SpotvsODChart'
import DownloadCLI from '../DownloadCLI/DownloadCLI'
import FixedScheduleAccordion from './components/FixedScheduleAccordion/FixedScheduleAccordion'
import ComputeType from './components/ComputeType'
import css from './COGatewayList.module.scss'
 
interface COGatewayAnalyticsProps {
  service: { data: Service; index: number } | null | undefined
  handleServiceToggle: (type: 'SUCCESS' | 'FAILURE', data: Service | any, index?: number) => void
  handleServiceDeletion: (type: 'SUCCESS' | 'FAILURE', data: Service | any) => void
  handleServiceEdit: (_service: Service) => void
}
 
function getBarChartOptions(
  title: string,
  categories: string[],
  yAxisText: string,
  savingsData: number[],
  spendData: number[],
  idleHoursData: number[],
  actualHoursData: number[]
): Highcharts.Options {
  return {
    chart: {
      type: 'column'
    },
    colors: ['rgba(71, 213, 223)', 'rgba(124, 77, 211)'],
    title: {
      text: title
    },
    xAxis: {
      categories: categories
    },
    yAxis: {
      min: 0,
      title: {
        text: yAxisText
      },
      stackLabels: {
        enabled: true,
        style: {
          fontWeight: 'bold',
          color: 'gray'
        }
      }
    },
    credits: {
      enabled: false
    },
    legend: {
      align: 'right',
      x: -30,
      verticalAlign: 'top',
      y: 25,
      floating: true,
      backgroundColor: 'white',
      borderColor: '#CCC',
      borderWidth: 1,
      shadow: false
    },
    tooltip: {
      formatter() {
        const total = savingsData[this.point.x] + spendData[this.point.x]
        const idle = idleHoursData[this.point.x]
        const actual = actualHoursData[this.point.x]
        return `<b>${this.x}</b><br/>${this.series.name}: ${this.y}<br/>Total: ${total}<br>Idle Hours: ${idle}<br>Actual Hours: ${actual}`
      }
    },
    plotOptions: {
      column: {
        stacking: 'normal',
        dataLabels: {
          enabled: false
        }
      }
    },
    series: [
      {
        name: 'Savings',
        type: 'column',
        data: savingsData
      },
      {
        name: 'Spend',
        type: 'column',
        data: spendData
      }
    ]
  }
}
const DATE_FORMAT = 'YYYY-MM-DDTHH:mm:ssZ'
const today = () => moment()
const startOfDay = (time: moment.Moment) => time.startOf('day').toDate()
const endOfDay = (time: moment.Moment) => time.endOf('day').toDate()
 
const CopyURL = (props: { textToCopy: string }) => {
  const { showError, showSuccess } = useToaster()
  const { getString } = useStrings()
 
  const copyToClipboard = () => {
    copy(props.textToCopy) ? showSuccess(getString('clipboardCopySuccess')) : showError(getString('clipboardCopyFail'))
  }
 
  return <Icon name="copy" size={20} color="blue500" onClick={copyToClipboard} style={{ cursor: 'pointer' }} />
}
 
const COGatewayAnalytics: React.FC<COGatewayAnalyticsProps> = props => {
  const { accountId } = useParams<AccountPathProps>()
  const { getString } = useStrings()
  const { showError } = useToaster()
 
  const isK8sRule = Utils.isK8sRule(props.service?.data as Service)
  const isEcsRule = !_isEmpty(props.service?.data.routing?.container_svc)
  const isRdsRule = !_isEmpty(props.service?.data.routing?.database)
 
  const { data: healthData, loading: healthDataLoading } = useHealthOfService({
    account_id: accountId,
    rule_id: props.service?.data.id as number,
    queryParams: {
      accountIdentifier: accountId
    },
    debounce: 300
  })
  const {
    data: resources,
    loading: resourcesLoading,
    error: resourceError
  } = useAllServiceResources({
    account_id: accountId,
    rule_id: props.service?.data.id as number, // eslint-disable-line
    debounce: 300,
    lazy: isK8sRule || isEcsRule
  })
 
  const { data: serviceDescribeData } = useDescribeServiceInContainerServiceCluster({
    account_id: accountId,
    cluster_name: _defaultTo(props.service?.data.routing?.container_svc?.cluster, ''),
    service_name: _defaultTo(props.service?.data.routing?.container_svc?.service, ''),
    lazy: !isEcsRule,
    queryParams: {
      accountIdentifier: accountId,
      cloud_account_id: _defaultTo(props.service?.data.cloud_account_id, ''),
      region: _defaultTo(props.service?.data.routing?.container_svc?.region, '')
    }
  })
 
  const { triggerToggle } = useToggleRuleState({
    accountId,
    serviceData: props.service?.data as Service,
    onSuccess: (updatedServiceData: Service) =>
      props.handleServiceToggle('SUCCESS', updatedServiceData, props.service?.index),
    onFailure: error => props.handleServiceToggle('FAILURE', error)
  })
  const { triggerDelete } = useDeleteServiceHook({
    accountId,
    serviceData: props.service?.data as Service,
    onSuccess: (_data: Service) => props.handleServiceDeletion('SUCCESS', _data),
    onFailure: err => props.handleServiceDeletion('FAILURE', err)
  })
 
  Iif (resourceError) {
    showError(`could not load resources for rule`, undefined, 'ce.load.resource.error')
  }
 
  const renderCustomDomainLink = (link: string, index = 0) => {
    const hrefLink = `http://${link}`
    return (
      <Layout.Horizontal spacing="small" key={`custom_domain${index}`}>
        <Link key={`custom_domain${index}`} href={hrefLink} target="_blank">
          {link}
        </Link>
        <CopyURL textToCopy={hrefLink} />
      </Layout.Horizontal>
    )
  }
 
  return (
    <Container>
      <Layout.Vertical spacing="large" padding="xlarge">
        <Container className={css.analyticsHeader}>
          <Layout.Horizontal flex={{ justifyContent: 'space-between' }}>
            <Layout.Horizontal flex={{ alignItems: 'center' }}>
              <Heading level={1} font={{ weight: 'semi-bold' }}>
                {props.service?.data.name}
              </Heading>
              <Switch
                className={css.ruleToggle}
                checked={!props.service?.data.disabled}
                onChange={() => triggerToggle()}
              ></Switch>
            </Layout.Horizontal>
            <Layout.Horizontal spacing="large" className={css.headerLayout}>
              <Layout.Horizontal flex spacing="large">
                <Icon
                  name="Edit"
                  size={20}
                  style={{ cursor: 'pointer' }}
                  onClick={() => props.handleServiceEdit(props.service?.data as Service)}
                  data-testid="editRuleIcon"
                ></Icon>
                <Icon
                  name="main-trash"
                  size={20}
                  style={{ cursor: 'pointer' }}
                  onClick={() => triggerDelete()}
                  data-testid="deleteRuleIcon"
                ></Icon>
              </Layout.Horizontal>
            </Layout.Horizontal>
          </Layout.Horizontal>
          <Text font={{ size: 'small' }}>
            {`Created ${getRelativeTime(props.service?.data.created_at as string, 'YYYY-MM-DDTHH:mm:ssZ')}`}
            {/* <Avatar email="john.doe@harnes.io" size={'small'} />
            {'John Doe '} */}
          </Text>
        </Container>
        <Container className={css.analyticsHeader}>
          <Heading level={2} font={{ weight: 'bold' }}>
            Rule Details
          </Heading>
          <Layout.Vertical spacing="medium" padding={{ top: 'medium', bottom: 'medium' }}>
            <Container className={css.serviceDetailsItemContainer}>
              <Text className={css.detailItemHeader}>{getString('ce.co.ruleDetailsHeader.idleTime')}</Text>
              <Text className={css.detailItemValue}>{`${props.service?.data.idle_time_mins} min`}</Text>
            </Container>
            {!isK8sRule && (
              <Container className={css.serviceDetailsItemContainer}>
                <Text className={css.detailItemHeader}>{isEcsRule ? 'Tasks running' : 'Resources managed'}</Text>
                <Layout.Horizontal spacing="medium" className={css.detailItemValue}>
                  {isEcsRule ? (
                    <>
                      <Link
                        href={getInstancesLink(props.service?.data as Service)}
                        target="_blank"
                        style={{ textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}
                      >
                        {`${_defaultTo(serviceDescribeData?.response?.task_count, 0)} tasks`}
                      </Link>
                      {getStateTag(serviceDescribeData?.response?.task_count ? 'active' : 'down')}
                    </>
                  ) : (
                    <>
                      {!resourcesLoading && resources && props.service?.data ? (
                        <Link
                          href={getInstancesLink(
                            props.service?.data as Service,
                            resources as AllResourcesOfAccountResponse
                          )}
                          target="_blank"
                        >
                          <Text>{`${resources?.response?.length} ${
                            isRdsRule
                              ? Utils.getConditionalResult(
                                  (resources?.response?.length as number) > 1,
                                  getString('ce.co.ruleDrawer.dbInstancesPlural'),
                                  getString('ce.co.ruleDrawer.dbInstances')
                                )
                              : getString('common.instanceLabel')
                          }`}</Text>
                        </Link>
                      ) : (
                        <Icon name="spinner" size={12} color="blue500" />
                      )}
                      {healthDataLoading ? (
                        <Icon name="spinner" size={12} color="blue500" />
                      ) : healthData?.response?.['state'] != null ? (
                        getStateTag(healthData?.response?.['state'])
                      ) : null}
                    </>
                  )}
                </Layout.Horizontal>
              </Container>
            )}
            <Container className={css.serviceDetailsItemContainer}>
              <Text className={css.detailItemHeader}>{getString('ce.co.ruleDetailsHeader.hostName')}</Text>
              <Layout.Horizontal spacing="small" className={css.detailItemValue}>
                {isK8sRule ? (
                  <Text style={{ maxWidth: 350, textAlign: 'left' }}>{props.service?.data.host_name}</Text>
                ) : (
                  <Link
                    href={`http://${props.service?.data.host_name}`}
                    target="_blank"
                    style={{ maxWidth: 350, textAlign: 'left' }}
                  >
                    {props.service?.data.host_name}
                  </Link>
                )}
                <CopyURL textToCopy={`http://${props.service?.data.host_name}`} />
              </Layout.Horizontal>
            </Container>
            <ConnectorDetails service={props.service?.data} />
            {(!_isEmpty(props.service?.data.custom_domains) || props.service?.data?.routing?.k8s?.CustomDomain) && (
              <Container className={css.serviceDetailsItemContainer}>
                <Text className={css.detailItemHeader}>{getString('ce.co.ruleDetailsHeader.customDomain')}</Text>
                <div className={css.detailItemValue}>
                  {props.service?.data?.routing?.k8s?.CustomDomain
                    ? renderCustomDomainLink(props.service?.data?.routing?.k8s?.CustomDomain)
                    : props.service?.data.custom_domains?.map((d, i) => renderCustomDomainLink(d, i))}
                </div>
              </Container>
            )}
            <Container className={css.serviceDetailsItemContainer}>
              <Text className={css.detailItemHeader}>{getString('ce.co.ruleDetailsHeader.computeType')}</Text>
              <ComputeType data={props.service?.data as Service} className={css.detailItemValue} />
            </Container>
            {/* <Layout.Vertical spacing="large" padding="medium">
            <Text>Connector</Text>
            <Layout.Horizontal spacing="xsmall">
              <Icon name="service-aws" />
              <Text>{props.service?.data.metadata?.cloud_provider_details?.name}</Text>
            </Layout.Horizontal>
            <Layout.Horizontal spacing="xsmall">
              <Icon name="deployment-timeout-legacy" />
            </Layout.Horizontal>
          </Layout.Vertical>
          <Layout.Vertical spacing="large" padding="medium">
            <Text>Instances managed by the Rule</Text>
            {props.service?.data.custom_domains?.length ? (
              <>
              </>
            ) : null}
          </Layout.Vertical> */}
          </Layout.Vertical>
        </Container>
        <Container className={css.analyticsHeader}>
          <Layout.Vertical spacing="medium">
            <Heading level={2} font={{ weight: 'bold' }}>
              {getString('ce.co.autoStoppingRule.configuration.step4.advancedConfiguration')}
            </Heading>
            <FixedScheduleAccordion service={props.service?.data} />
          </Layout.Vertical>
        </Container>
        {props.service?.data.fulfilment !== 'kubernetes' && !isEcsRule && (
          <Container className={css.analyticsHeader}>
            <Layout.Vertical spacing="medium">
              <Heading level={2} font={{ weight: 'bold' }} className={css.analyticsSubHeader}>
                {getString('ce.co.autoStoppingRule.setupAccess.helpText.ssh.setup.download')}
              </Heading>
              <DownloadCLI />
            </Layout.Vertical>
          </Container>
        )}
        <CumulativeSavingsSection service={props.service?.data} />
        <Layout.Horizontal spacing="small" style={{ alignSelf: 'center' }}>
          <Text>Showing data for Last 7 days</Text>
        </Layout.Horizontal>
        <SpendVsSavingsGraph service={props.service?.data} />
        <LogsAndUsage service={props.service?.data} />
      </Layout.Vertical>
    </Container>
  )
}
 
const CumulativeSavingsSection = (props: { service?: Service }) => {
  const { accountId } = useParams<AccountPathProps>()
  const { getString } = useStrings()
 
  const { data, loading } = useSavingsOfService({
    account_id: accountId,
    rule_id: props.service?.id as number,
    queryParams: {
      accountIdentifier: accountId
    }
  })
 
  return (
    <Container padding="medium" style={{ backgroundColor: 'var(--blue-50)' }}>
      <Layout.Horizontal spacing="large">
        {loading ? (
          <Icon name="spinner" size={12} color={Color.BLUE_500} />
        ) : (
          <>
            {/* <Layout.Horizontal spacing="medium">
                  {props.service.fulfilment == 'spot' ? <SpotvsODChart spotPercent={76}></SpotvsODChart> : null} */}
            <Layout.Horizontal spacing="medium">
              <div style={{ alignSelf: 'center' }}>
                <HighchartsReact
                  highchart={Highcharts}
                  options={
                    data?.response != null
                      ? getRiskGaugeChartOptions((data?.response as ServiceSavings).savings_percentage as number)
                      : getRiskGaugeChartOptions(0)
                  }
                />
              </div>
              <Layout.Vertical spacing="xsmall" padding="large">
                <Heading level={2}>
                  $
                  {data?.response != null
                    ? Math.round(((data?.response as ServiceSavings).actual_savings as number) * 100) / 100
                    : 0}
                </Heading>
                <Text>{getString('ce.co.rulesTableHeaders.savings')}</Text>
              </Layout.Vertical>
            </Layout.Horizontal>
            {/* </Layout.Horizontal> */}
          </>
        )}
      </Layout.Horizontal>
    </Container>
  )
}
 
const SpendVsSavingsGraph = (props: { service?: Service }) => {
  const { accountId } = useParams<AccountPathProps>()
  const { getString } = useStrings()
 
  const [categories, setCategories] = useState<string[]>([])
  const [savingsSeries, setSavingsSeries] = useState<number[]>([])
  const [spendSeries, setSpendSeries] = useState<number[]>([])
  const [idleHourSeries, setIdleHourSeries] = useState<number[]>([])
  const [actualHoursSeries, setActualHoursSeries] = useState<number[]>([])
 
  const { data: graphData, loading: graphLoading } = useSavingsOfService({
    account_id: accountId,
    rule_id: props.service?.id as number,
    queryParams: {
      accountIdentifier: accountId,
      from: moment(startOfDay(today().subtract(7, 'days'))).format(DATE_FORMAT),
      to: moment(endOfDay(today())).format(DATE_FORMAT),
      group_by: 'date'
    }
  })
 
  useEffect(() => {
    Iif (graphLoading) {
      return
    }
    const newCategroies: string[] = []
    const newSavings: number[] = []
    const newSpends: number[] = []
    const newIdleHours: number[] = []
    const newActualHours: number[] = []
    const savingsEntries: ServiceSavings[] = _defaultTo(graphData?.response as ServiceSavings[], [])
    savingsEntries.forEach(element => {
      newCategroies.push(getDay(element.usage_date as string, DATE_FORMAT))
      newSavings.push(roundToPrecision(element.actual_savings as number))
      newSpends.push(
        roundToPrecision(element.potential_cost as number) - roundToPrecision(element.actual_savings as number)
      )
      newActualHours.push(roundToPrecision(element.actual_hours as number))
      newIdleHours.push(roundToPrecision(element.idle_hours as number))
    })
    setCategories(newCategroies)
    setSavingsSeries(newSavings)
    setSpendSeries(newSpends)
    setIdleHourSeries(newIdleHours)
    setActualHoursSeries(newActualHours)
  }, [graphData])
 
  return (
    <>
      <Heading level={3}>{getString('ce.co.ruleDrawer.spendVsSavings').toUpperCase()}</Heading>
      {graphLoading ? (
        <Icon name="spinner" size={24} color="blue500" style={{ alignSelf: 'center' }} />
      ) : categories.length ? (
        <HighchartsReact
          highchart={Highcharts}
          options={getBarChartOptions(
            '',
            categories,
            '',
            savingsSeries,
            spendSeries,
            idleHourSeries,
            actualHoursSeries
          )}
        />
      ) : (
        <Text style={{ alignSelf: 'center', fontSize: 'var(--font-size-medium)' }}>{getString('ce.co.noData')}</Text>
      )}
    </>
  )
}
 
const LogsAndUsage = (props: { service?: Service }) => {
  const { getString } = useStrings()
  return (
    <>
      <Heading level={3}>
        {`${getString('ce.co.ruleDrawer.logs')} ${getString('and')} ${getString(
          'ce.co.ruleDrawer.usageTime'
        )}`.toUpperCase()}
      </Heading>
      <Tabs id="logsAndUsage">
        <Tab
          id="name"
          title={getString('ce.co.ruleDrawer.usageTime')}
          panel={<COGatewayUsageTime service={props.service} />}
        ></Tab>
        <Tab
          id="logs"
          title={getString('ce.co.ruleDrawer.logs')}
          panel={<COGatewayLogs service={props.service} />}
        ></Tab>
      </Tabs>
    </>
  )
}
 
const ConnectorDetails = (props: { service?: Service }) => {
  const { getString } = useStrings()
  const { accountId } = useParams<AccountPathProps>()
 
  const { data: connectorData } = useGetConnector({
    identifier: props.service?.cloud_account_id || '',
    queryParams: {
      accountIdentifier: accountId
    }
  })
 
  const providerType = connectorData?.data?.connector?.type && ceConnectorTypes[connectorData?.data?.connector?.type]
  const providerIcon = providerType ? allProviders.find(provider => provider.value === providerType)?.icon : null
 
  return (
    <Container className={css.serviceDetailsItemContainer}>
      <Text className={css.detailItemHeader}>{getString('connectorsLabel')}</Text>
      <Layout.Horizontal className={css.detailItemValue}>
        {props.service?.routing?.k8s?.ConnectorID ? (
          <Layout.Horizontal spacing={'small'}>
            <Icon name="app-kubernetes" size={18} />
            <RouterLink
              target="_blank"
              to={routes.toConnectorDetails({ accountId, connectorId: props.service?.routing?.k8s?.ConnectorID })}
            >
              {props.service?.routing?.k8s?.ConnectorID}
            </RouterLink>
            <Text>{`(${getString('common.cluster')}) / `}</Text>
          </Layout.Horizontal>
        ) : null}
        <Layout.Horizontal spacing={'small'}>
          {providerIcon && <Icon name={providerIcon as IconName} size={18} />}
          <RouterLink
            target="_blank"
            to={routes.toConnectorDetails({ accountId, connectorId: props.service?.cloud_account_id })}
          >
            {props.service?.metadata?.cloud_provider_details?.name}
          </RouterLink>
          <Text>{`(${getString('ce.co.accessPoint.cloudAccount')})`}</Text>
        </Layout.Horizontal>
      </Layout.Horizontal>
    </Container>
  )
}
 
export default COGatewayAnalytics