Skip to content

Commit

Permalink
[Merged after v4.1.1] fix: cluster alias name (kubesphere#3914) (kube…
Browse files Browse the repository at this point in the history
…sphere#4147)

* fix: cluster alias name

* fix: add useGetClusterAliasName useGetProjectAliasName
  • Loading branch information
51wangping authored Jul 10, 2024
1 parent edda42e commit e2282e2
Show file tree
Hide file tree
Showing 27 changed files with 168 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
formatTime,
gatewayStore,
} from '@ks-console/shared';
import { useCacheStore as useStore } from '@ks-console/shared';
import { useCacheStore as useStore, ClusterAliasName } from '@ks-console/shared';
import { GatewayConfig } from '..';
import GatewaySetting from '../GatewaySetting';

Expand Down Expand Up @@ -83,7 +83,7 @@ const Detail = () => {
return [
{
label: t('CLUSTER'),
value: currentCluster || '',
value: <ClusterAliasName cluster={currentCluster} />,
},
{
label: t('CREATION_TIME'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ import React, { useRef } from 'react';
import { useParams } from 'react-router-dom';
import { Select } from '@kubed/icons';
import { isEmpty } from 'lodash';
import { crdStore, DetailPage, FormattedCRD, formatTime } from '@ks-console/shared';
import {
crdStore,
DetailPage,
FormattedCRD,
formatTime,
ClusterAliasName,
} from '@ks-console/shared';

const Detail = () => {
const { cluster, name } = useParams();
Expand All @@ -16,7 +22,7 @@ const Detail = () => {
return [
{
label: t('CLUSTER'),
value: cluster || '',
value: <ClusterAliasName cluster={cluster} />,
},
{
label: t('SCOPE_TCAP'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
useCommonActions,
quotaStore,
limitRangesStore,
ClusterAliasName,
} from '@ks-console/shared';
import { notify } from '@kubed/components';
import { Pen, Project, Trash } from '@kubed/icons';
Expand Down Expand Up @@ -108,7 +109,7 @@ const ProjectDetail = () => {
},
{
label: t('CLUSTER'),
value: cluster!,
value: <ClusterAliasName cluster={cluster} />,
},
{
label: t('WORKSPACE'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {
getComponentStatus,
StatusIndicator,
SystemComponent,
ClusterAliasName,
ProjectAliasName,
} from '@ks-console/shared';
import { Components } from '@kubed/icons';

Expand All @@ -27,11 +29,11 @@ function ServiceComponentDetail() {
},
{
label: t('CLUSTER'),
value: params.cluster,
value: <ClusterAliasName cluster={params.cluster} />,
},
{
label: t('PROJECT'),
value: data?.namespace,
value: <ProjectAliasName project={data?.namespace} />,
},
{
label: t('REPLICA_COUNT'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { isEmpty, get } from 'lodash';
import React, { useEffect, useMemo, useState } from 'react';
import { useNavigate, useParams } from 'react-router-dom';
import { Loading, notify } from '@kubed/components';
import { useCacheStore as useStore } from '@ks-console/shared';
import { useCacheStore as useStore, ClusterAliasName, ProjectAliasName } from '@ks-console/shared';
import {
Icon,
EditYamlModal,
Expand Down Expand Up @@ -149,11 +149,11 @@ const DaemonSetDetail = () => {
return [
{
label: t('CLUSTER'),
value: cluster,
value: <ClusterAliasName cluster={cluster} />,
},
{
label: t('PROJECT'),
value: namespace,
value: <ProjectAliasName project={namespace} />,
},
{
label: t('STATUS'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import {
getDisplayName,
formatTime,
yaml,
ClusterAliasName,
ProjectAliasName,
} from '@ks-console/shared';
import { useRollbackModal, useBaseInfoModal } from '../../../../hooks/useModal';
import type { FormattedWorkload } from '@ks-console/shared';
Expand Down Expand Up @@ -175,11 +177,11 @@ const DaemonSetDetail = () => {
return [
{
label: t('CLUSTER'),
value: cluster,
value: <ClusterAliasName cluster={cluster} />,
},
{
label: t('PROJECT'),
value: namespace,
value: <ProjectAliasName project={namespace} />,
},
{
label: t('APP'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import {
getDisplayName,
formatTime,
yaml,
ClusterAliasName,
ProjectAliasName,
} from '@ks-console/shared';
import {
useBaseInfoModal,
Expand Down Expand Up @@ -211,11 +213,11 @@ const DeploymentDetail = () => {
return [
{
label: t('CLUSTER'),
value: cluster,
value: <ClusterAliasName cluster={cluster} />,
},
{
label: t('PROJECT'),
value: namespace,
value: <ProjectAliasName project={namespace} />,
},
{
label: t('APP'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import {
formatTime,
yaml,
getJobStatus,
ClusterAliasName,
ProjectAliasName,
} from '@ks-console/shared';
import type { FormattedWorkload } from '@ks-console/shared';
import type { EditYamlConfig, ModalBaseConfig } from '../../../../types/workload';
Expand Down Expand Up @@ -147,11 +149,11 @@ const DaemonSetDetail = () => {
return [
{
label: t('CLUSTER'),
value: cluster,
value: <ClusterAliasName cluster={cluster} />,
},
{
label: t('PROJECT'),
value: namespace,
value: <ProjectAliasName project={namespace} />,
},
{
label: t('STATUS'),
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import {
formatTime,
yaml,
useBaseInfoModal,
ClusterAliasName,
ProjectAliasName,
} from '@ks-console/shared';
import type { IngressDetail } from '@ks-console/shared';
import type { EditYamlConfig, ModalBaseConfig } from '../../../../types/workload';
Expand Down Expand Up @@ -125,11 +127,11 @@ const PodsDetail = () => {
return [
{
label: t('CLUSTER'),
value: cluster,
value: <ClusterAliasName cluster={cluster} />,
},
{
label: t('PROJECT'),
value: namespace,
value: <ProjectAliasName project={namespace} />,
},
{
label: t('APP'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import {
joinSelector,
IFormatEndPoint,
useBaseInfoModal,
ClusterAliasName,
ProjectAliasName,
} from '@ks-console/shared';
import type { IServiceDetail } from '@ks-console/shared';
import type { EditYamlConfig, ModalBaseConfig } from '../../../../types/workload';
Expand Down Expand Up @@ -174,11 +176,11 @@ const PodsDetail = () => {
return [
{
label: t('CLUSTER'),
value: cluster,
value: <ClusterAliasName cluster={cluster} />,
},
{
label: t('PROJECT'),
value: namespace,
value: <ProjectAliasName project={namespace} />,
},
{
label: t('TYPE'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import {
getDisplayName,
formatTime,
yaml,
ClusterAliasName,
ProjectAliasName,
} from '@ks-console/shared';
import { useBaseInfoModal, useRollbackModal } from '../../../../hooks/useModal';
import type { FormattedWorkload } from '@ks-console/shared';
Expand Down Expand Up @@ -173,11 +175,11 @@ const DaemonSetDetail = () => {
return [
{
label: t('CLUSTER'),
value: cluster,
value: <ClusterAliasName cluster={cluster} />,
},
{
label: t('PROJECT'),
value: namespace,
value: <ProjectAliasName project={namespace} />,
},
{
label: t('APP'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import {
getCronJobStatus,
useCommonActions,
ClusterDetail,
ClusterAliasName,
ProjectAliasName,
} from '@ks-console/shared';

const WORKLOAD_TYPE = 'CRONJOB';
Expand Down Expand Up @@ -103,11 +105,11 @@ const DaemonSetDetail = () => {
return [
{
label: t('CLUSTER'),
value: cluster,
value: <ClusterAliasName cluster={cluster} />,
},
{
label: t('PROJECT'),
value: namespace,
value: <ProjectAliasName workspace={workspace} project={namespace} />,
},
{
label: t('STATUS'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import {
formatTime,
getJobStatus,
useCommonActions,
ClusterAliasName,
ProjectAliasName,
} from '@ks-console/shared';

const WORKLOAD_TYPE = 'JOB';
Expand Down Expand Up @@ -104,11 +106,11 @@ const DaemonSetDetail = () => {
return [
{
label: t('CLUSTER'),
value: cluster,
value: <ClusterAliasName cluster={cluster} />,
},
{
label: t('PROJECT'),
value: namespace,
value: <ProjectAliasName project={namespace} />,
},
{
label: t('STATUS'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import {
getDisplayName,
formatTime,
useCommonActions,
ClusterAliasName,
ProjectAliasName,
} from '@ks-console/shared';
import type { IngressDetail } from '@ks-console/shared';
import useRoutesAnnotations from '../../../../../clusters/hooks/useRoutesAnnotations';
Expand Down Expand Up @@ -93,11 +95,11 @@ const IngressRoutesDetail = () => {
return [
{
label: t('CLUSTER'),
value: cluster,
value: <ClusterAliasName cluster={cluster} />,
},
{
label: t('PROJECT'),
value: namespace,
value: <ProjectAliasName project={namespace} />,
},
{
label: t('APP'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import {
joinSelector,
IFormatEndPoint,
useCommonActions,
ClusterAliasName,
ProjectAliasName,
} from '@ks-console/shared';
import useServiceGateway from '../../../../../clusters/hooks/useServiceGateway';
import useServiceModal from '../../../../../clusters/hooks/useServiceModal';
Expand Down Expand Up @@ -138,11 +140,11 @@ const ServiceDetail = () => {
return [
{
label: t('CLUSTER'),
value: cluster,
value: <ClusterAliasName cluster={cluster} />,
},
{
label: t('PROJECT'),
value: namespace,
value: <ProjectAliasName project={namespace} />,
},
{
label: t('TYPE'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import {
getDisplayName,
formatTime,
useCommonActions,
ClusterAliasName,
ProjectAliasName,
} from '@ks-console/shared';
import { useRollbackModal, useBaseInfoModal } from '../../../../../../clusters/hooks/useModal';
import type { FormattedWorkload } from '@ks-console/shared';
Expand Down Expand Up @@ -168,11 +170,11 @@ const DaemonSetDetail = () => {
return [
{
label: t('CLUSTER'),
value: cluster,
value: <ClusterAliasName cluster={cluster} />,
},
{
label: t('PROJECT'),
value: namespace,
value: <ProjectAliasName project={namespace} />,
},
{
label: t('APP'),
Expand Down
Loading

0 comments on commit e2282e2

Please sign in to comment.