Skip to content

Commit

Permalink
Merge branch 'kubernetes' of github.com:pluralsh/console into kubernetes
Browse files Browse the repository at this point in the history
  • Loading branch information
floreks committed Mar 27, 2024
2 parents 3f8f595 + fef2ba0 commit b55cdbd
Show file tree
Hide file tree
Showing 27 changed files with 262 additions and 55 deletions.
1 change: 0 additions & 1 deletion assets/src/components/kubernetes/access/ClusterRoles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { ClusterTinyFragment } from '../../../generated/graphql'
import {
CLUSTER_ROLES_REL_PATH,
getAccessAbsPath,
getKubernetesAbsPath,
} from '../../../routes/kubernetesRoutesConsts'
import { useKubernetesContext } from '../Kubernetes'

Expand Down
1 change: 0 additions & 1 deletion assets/src/components/kubernetes/access/RoleBindings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { ClusterTinyFragment } from '../../../generated/graphql'
import {
ROLE_BINDINGS_REL_PATH,
getAccessAbsPath,
getKubernetesAbsPath,
} from '../../../routes/kubernetesRoutesConsts'
import { useKubernetesContext } from '../Kubernetes'

Expand Down
1 change: 0 additions & 1 deletion assets/src/components/kubernetes/access/Roles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { ClusterTinyFragment } from '../../../generated/graphql'
import {
ROLES_REL_PATH,
getAccessAbsPath,
getKubernetesAbsPath,
} from '../../../routes/kubernetesRoutesConsts'
import { useKubernetesContext } from '../Kubernetes'

Expand Down
1 change: 0 additions & 1 deletion assets/src/components/kubernetes/cluster/Events.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import { InlineLink } from '../../utils/typography/InlineLink'
import {
EVENTS_REL_PATH,
getClusterAbsPath,
getKubernetesAbsPath,
getResourceDetailsAbsPath,
} from '../../../routes/kubernetesRoutesConsts'

Expand Down
1 change: 0 additions & 1 deletion assets/src/components/kubernetes/cluster/Namespaces.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { ClusterTinyFragment } from '../../../generated/graphql'
import {
NAMESPACES_REL_PATH,
getClusterAbsPath,
getKubernetesAbsPath,
} from '../../../routes/kubernetesRoutesConsts'

import { useKubernetesContext } from '../Kubernetes'
Expand Down
1 change: 0 additions & 1 deletion assets/src/components/kubernetes/cluster/Nodes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { ClusterTinyFragment } from '../../../generated/graphql'
import {
NODES_REL_PATH,
getClusterAbsPath,
getKubernetesAbsPath,
} from '../../../routes/kubernetesRoutesConsts'

import { useKubernetesContext } from '../Kubernetes'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
import {
CONFIG_MAPS_REL_PATH,
getConfigurationAbsPath,
getKubernetesAbsPath,
} from '../../../routes/kubernetesRoutesConsts'
import { ClusterTinyFragment } from '../../../generated/graphql'
import { useKubernetesContext } from '../Kubernetes'
Expand Down
1 change: 0 additions & 1 deletion assets/src/components/kubernetes/configuration/Secrets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { ClusterTinyFragment } from '../../../generated/graphql'
import {
SECRETS_REL_PATH,
getConfigurationAbsPath,
getKubernetesAbsPath,
} from '../../../routes/kubernetesRoutesConsts'
import { useKubernetesContext } from '../Kubernetes'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,34 @@
import { createColumnHelper } from '@tanstack/react-table'
import React, { useMemo } from 'react'
import { useTheme } from 'styled-components'
import { ChipList } from '@pluralsh/design-system'
import { ChipList, useSetBreadcrumbs } from '@pluralsh/design-system'

import {
CustomResourceDefinitionsQuery,
CustomResourceDefinitionsQueryVariables,
Types_CustomResourceDefinitionList as CustomResourceListT,
Types_CustomResourceDefinition as CustomResourceT,
Maybe,
useCustomResourceDefinitionsQuery,
} from '../../../generated/graphql-kubernetes'
import { useDefaultColumns } from '../utils'
import { getBaseBreadcrumbs, useDefaultColumns } from '../utils'
import { ResourceList } from '../ResourceList'

import { ClusterTinyFragment } from '../../../generated/graphql'
import { getCustomResourcesAbsPath } from '../../../routes/kubernetesRoutesConsts'

import { useKubernetesContext } from '../Kubernetes'

import { CRDEstablishedChip } from './utils'

export const getBreadcrumbs = (cluster?: Maybe<ClusterTinyFragment>) => [
...getBaseBreadcrumbs(cluster),
{
label: 'custom resources',
url: getCustomResourcesAbsPath(cluster?.id),
},
]

const columnHelper = createColumnHelper<CustomResourceT>()

const colName = columnHelper.accessor((r) => r?.objectMeta.name, {
Expand Down Expand Up @@ -78,6 +92,9 @@ const colCategories = columnHelper.accessor((crd) => crd?.names.categories, {

export default function CustomResourceDefinitions() {
const theme = useTheme()
const { cluster } = useKubernetesContext()

useSetBreadcrumbs(useMemo(() => getBreadcrumbs(cluster), [cluster]))

const { colLabels, colCreationTimestamp } = useDefaultColumns(columnHelper)
const columns = useMemo(
Expand Down
1 change: 0 additions & 1 deletion assets/src/components/kubernetes/discovery/Ingresses.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { ClusterTinyFragment } from '../../../generated/graphql'
import {
INGRESSES_REL_PATH,
getDiscoveryAbsPath,
getKubernetesAbsPath,
} from '../../../routes/kubernetesRoutesConsts'

import { useKubernetesContext } from '../Kubernetes'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { ClusterTinyFragment } from '../../../generated/graphql'
import {
NETWORK_POLICIES_REL_PATH,
getDiscoveryAbsPath,
getKubernetesAbsPath,
} from '../../../routes/kubernetesRoutesConsts'
import { useKubernetesContext } from '../Kubernetes'

Expand Down
1 change: 0 additions & 1 deletion assets/src/components/kubernetes/discovery/Services.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { ClusterTinyFragment } from '../../../generated/graphql'
import {
SERVICES_REL_PATH,
getDiscoveryAbsPath,
getKubernetesAbsPath,
} from '../../../routes/kubernetesRoutesConsts'

import { useKubernetesContext } from '../Kubernetes'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
} from '../../../generated/graphql-kubernetes'
import { KubernetesClient } from '../../../helpers/kubernetes.client'
import LoadingIndicator from '../../utils/LoadingIndicator'
import { SubTitle } from '../../cluster/nodes/SubTitle'
import { MetadataSidecar, useKubernetesCluster } from '../utils'
import { getResourceDetailsAbsPath } from '../../../routes/kubernetesRoutesConsts'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { ClusterTinyFragment } from '../../../generated/graphql'
import { InlineLink } from '../../utils/typography/InlineLink'
import {
PERSISTENT_VOLUME_CLAIMS_REL_PATH,
getKubernetesAbsPath,
getResourceDetailsAbsPath,
getStorageAbsPath,
} from '../../../routes/kubernetesRoutesConsts'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { ClusterTinyFragment } from '../../../generated/graphql'
import { InlineLink } from '../../utils/typography/InlineLink'
import {
PERSISTENT_VOLUMES_REL_PATH,
getKubernetesAbsPath,
getResourceDetailsAbsPath,
getStorageAbsPath,
} from '../../../routes/kubernetesRoutesConsts'
Expand Down
30 changes: 29 additions & 1 deletion assets/src/components/kubernetes/workloads/CronJobs.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,43 @@
import { createColumnHelper } from '@tanstack/react-table'
import { useMemo } from 'react'

import { useSetBreadcrumbs } from '@pluralsh/design-system'

import {
Cronjob_CronJobList as CronJobListT,
Cronjob_CronJob as CronJobT,
CronJobsQuery,
CronJobsQueryVariables,
Maybe,
useCronJobsQuery,
} from '../../../generated/graphql-kubernetes'
import { useDefaultColumns } from '../utils'
import { getBaseBreadcrumbs, useDefaultColumns } from '../utils'
import { ResourceList } from '../ResourceList'
import { DateTimeCol } from '../../utils/table/DateTimeCol'

import { ClusterTinyFragment } from '../../../generated/graphql'
import {
CRON_JOBS_REL_PATH,
getConfigurationAbsPath,
getWorkloadsAbsPath,
} from '../../../routes/kubernetesRoutesConsts'

import { useKubernetesContext } from '../Kubernetes'

import { CronJobSuspendChip, WorkloadImages } from './utils'

export const getBreadcrumbs = (cluster?: Maybe<ClusterTinyFragment>) => [
...getBaseBreadcrumbs(cluster),
{
label: 'workloads',
url: getWorkloadsAbsPath(cluster?.id),
},
{
label: 'cron jobs',
url: `${getConfigurationAbsPath(cluster?.id)}/${CRON_JOBS_REL_PATH}`,
},
]

const columnHelper = createColumnHelper<CronJobT>()

const colSchedule = columnHelper.accessor((cj) => cj.schedule, {
Expand Down Expand Up @@ -47,6 +71,10 @@ const colLastSchedule = columnHelper.accessor((cj) => cj.lastSchedule, {
})

export default function CronJobs() {
const { cluster } = useKubernetesContext()

useSetBreadcrumbs(useMemo(() => getBreadcrumbs(cluster), [cluster]))

const { colName, colNamespace, colLabels, colCreationTimestamp } =
useDefaultColumns(columnHelper)
const columns = useMemo(
Expand Down
30 changes: 29 additions & 1 deletion assets/src/components/kubernetes/workloads/DaemonSets.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,44 @@
import { createColumnHelper } from '@tanstack/react-table'
import { useMemo } from 'react'

import { useSetBreadcrumbs } from '@pluralsh/design-system'

import {
Daemonset_DaemonSetList as DaemonSetListT,
Daemonset_DaemonSet as DaemonSetT,
DaemonSetsQuery,
DaemonSetsQueryVariables,
Maybe,
useDaemonSetsQuery,
} from '../../../generated/graphql-kubernetes'
import { useDefaultColumns } from '../utils'
import { getBaseBreadcrumbs, useDefaultColumns } from '../utils'
import { ResourceList } from '../ResourceList'

import { UsageText } from '../../cluster/TableElements'

import { ClusterTinyFragment } from '../../../generated/graphql'
import {
DAEMON_SETS_REL_PATH,
getConfigurationAbsPath,
getWorkloadsAbsPath,
} from '../../../routes/kubernetesRoutesConsts'

import { useKubernetesContext } from '../Kubernetes'

import { WorkloadImages, WorkloadStatusChip } from './utils'

export const getBreadcrumbs = (cluster?: Maybe<ClusterTinyFragment>) => [
...getBaseBreadcrumbs(cluster),
{
label: 'workloads',
url: getWorkloadsAbsPath(cluster?.id),
},
{
label: 'daemon sets',
url: `${getConfigurationAbsPath(cluster?.id)}/${DAEMON_SETS_REL_PATH}`,
},
]

const columnHelper = createColumnHelper<DaemonSetT>()

const colImages = columnHelper.accessor((ds) => ds, {
Expand Down Expand Up @@ -52,6 +76,10 @@ const colStatus = columnHelper.accessor((ds) => ds.podInfo, {
})

export default function CronJobs() {
const { cluster } = useKubernetesContext()

useSetBreadcrumbs(useMemo(() => getBreadcrumbs(cluster), [cluster]))

const { colName, colNamespace, colLabels, colCreationTimestamp } =
useDefaultColumns(columnHelper)
const columns = useMemo(
Expand Down
30 changes: 29 additions & 1 deletion assets/src/components/kubernetes/workloads/Deployments.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,44 @@
import { createColumnHelper } from '@tanstack/react-table'
import { useMemo } from 'react'

import { useSetBreadcrumbs } from '@pluralsh/design-system'

import {
Deployment_DeploymentList as DeploymentListT,
Deployment_Deployment as DeploymentT,
DeploymentsQuery,
DeploymentsQueryVariables,
Maybe,
useDeploymentsQuery,
} from '../../../generated/graphql-kubernetes'
import { ResourceList } from '../ResourceList'
import { useDefaultColumns } from '../utils'
import { getBaseBreadcrumbs, useDefaultColumns } from '../utils'

import { UsageText } from '../../cluster/TableElements'

import { ClusterTinyFragment } from '../../../generated/graphql'
import {
DEPLOYMENTS_REL_PATH,
getConfigurationAbsPath,
getWorkloadsAbsPath,
} from '../../../routes/kubernetesRoutesConsts'

import { useKubernetesContext } from '../Kubernetes'

import { WorkloadImages, WorkloadStatusChip } from './utils'

export const getBreadcrumbs = (cluster?: Maybe<ClusterTinyFragment>) => [
...getBaseBreadcrumbs(cluster),
{
label: 'workloads',
url: getWorkloadsAbsPath(cluster?.id),
},
{
label: ' deployments',
url: `${getConfigurationAbsPath(cluster?.id)}/${DEPLOYMENTS_REL_PATH}}`,
},
]

const columnHelper = createColumnHelper<DeploymentT>()

const colImages = columnHelper.accessor((deployment) => deployment, {
Expand Down Expand Up @@ -52,6 +76,10 @@ const colStatus = columnHelper.accessor((deployment) => deployment.pods, {
})

export default function Deployments() {
const { cluster } = useKubernetesContext()

useSetBreadcrumbs(useMemo(() => getBreadcrumbs(cluster), [cluster]))

const { colName, colNamespace, colLabels, colCreationTimestamp } =
useDefaultColumns(columnHelper)
const columns = useMemo(
Expand Down
30 changes: 29 additions & 1 deletion assets/src/components/kubernetes/workloads/Jobs.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,43 @@
import { createColumnHelper } from '@tanstack/react-table'
import { useMemo } from 'react'

import { useSetBreadcrumbs } from '@pluralsh/design-system'

import {
Job_JobList as JobListT,
Job_Job as JobT,
JobsQuery,
JobsQueryVariables,
Maybe,
useJobsQuery,
} from '../../../generated/graphql-kubernetes'
import { useDefaultColumns } from '../utils'
import { getBaseBreadcrumbs, useDefaultColumns } from '../utils'
import { ResourceList } from '../ResourceList'
import { UsageText } from '../../cluster/TableElements'

import { ClusterTinyFragment } from '../../../generated/graphql'
import {
JOBS_REL_PATH,
getConfigurationAbsPath,
getWorkloadsAbsPath,
} from '../../../routes/kubernetesRoutesConsts'

import { useKubernetesContext } from '../Kubernetes'

import { WorkloadImages, WorkloadStatusChip } from './utils'

export const getBreadcrumbs = (cluster?: Maybe<ClusterTinyFragment>) => [
...getBaseBreadcrumbs(cluster),
{
label: 'workloads',
url: getWorkloadsAbsPath(cluster?.id),
},
{
label: 'jobs',
url: `${getConfigurationAbsPath(cluster?.id)}/${JOBS_REL_PATH}`,
},
]

const columnHelper = createColumnHelper<JobT>()

const colImages = columnHelper.accessor((job) => job, {
Expand Down Expand Up @@ -51,6 +75,10 @@ const colStatus = columnHelper.accessor((job) => job.podInfo, {
})

export default function CronJobs() {
const { cluster } = useKubernetesContext()

useSetBreadcrumbs(useMemo(() => getBreadcrumbs(cluster), [cluster]))

const { colName, colNamespace, colLabels, colCreationTimestamp } =
useDefaultColumns(columnHelper)
const columns = useMemo(
Expand Down
Loading

0 comments on commit b55cdbd

Please sign in to comment.