Skip to content

Commit

Permalink
fix:Field clusterResourceName instead of clusterName (#244)
Browse files Browse the repository at this point in the history
* fix:Field clusterResourceName instead of clusterName

* fix:replace clusterName
  • Loading branch information
yang1666204 authored Mar 14, 2024
1 parent 0cec638 commit 8343be3
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions ui/src/components/customModal/ModifyUnitDetailModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export type UnitDetailType = {

type UnitConfigType = {
clusterList?: API.SimpleClusterList;
clusterName?: string;
clusterResourceName?: string;
essentialParameter?: API.EssentialParametersType;
setClusterList: React.Dispatch<React.SetStateAction<API.SimpleClusterList>>;
};
Expand All @@ -41,7 +41,7 @@ export default function ModifyUnitDetailModal({
clusterList = [],
setClusterList,
essentialParameter = {},
clusterName = '',
clusterResourceName = '',
}: CommonModalType & UnitConfigType) {
const [form] = Form.useForm<UnitDetailType>();
const [minMemory, setMinMemory] = useState<number>(2);
Expand Down Expand Up @@ -76,14 +76,14 @@ export default function ModifyUnitDetailModal({
setSelectZones([...selectZones, name]);
}
setClusterList(
getNewClusterList(clusterList, name, checked, { name: clusterName }),
getNewClusterList(clusterList, name, checked, { name: clusterResourceName }),
);
};

const targetZoneList = clusterList
.filter((cluster) => cluster.clusterName === clusterName)[0]
.filter((cluster) => cluster.name === clusterResourceName)[0]
?.topology.map((zone) => ({ zone: zone.zone, checked: zone.checked }));

useEffect(() => {
if (essentialParameter) {
setMinMemory(essentialParameter.minPoolMemory / (1 << 30));
Expand Down
8 changes: 4 additions & 4 deletions ui/src/pages/Tenant/Detail/Overview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,10 @@ export default function TenantOverview() {
tenantDetail: API.TenantBasicInfo | undefined,
) => {
if (!tenantDetail) return clusters;
const { clusterName } = tenantDetail.info;
const { clusterResourceName } = tenantDetail.info;
const { replicas } = tenantDetail;
const cluster = clusters.find(
(cluster) => cluster.clusterName === clusterName,
(cluster) => cluster.name === clusterResourceName,
);
if (cluster && cluster.topology) {
cluster.topology = cluster.topology.filter((zone) =>
Expand All @@ -259,7 +259,7 @@ export default function TenantOverview() {
useEffect(() => {
if (tenantDetail && clusterList) {
const cluster = clusterList.find(
(cluster) => cluster.clusterName === tenantDetail.info.clusterName,
(cluster) => cluster.name === tenantDetail.info.clusterResourceName,
);
if (cluster) {
const { name, namespace } = cluster;
Expand Down Expand Up @@ -300,7 +300,7 @@ export default function TenantOverview() {
defaultValueForUnitDetail={{
clusterList:formatClustersTopology(clusterList,tenantDetail),
essentialParameter,
clusterName:tenantDetail?.info.clusterName,
clusterResourceName:tenantDetail?.info.clusterResourceName,
setClusterList,
}}
/>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/pages/Tenant/Detail/Topo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default function Topo() {
{tenantTopoData && (
<TopoComponent
tenantReplicas={tenantTopoData.replicas}
clusterNameOfKubectl={tenantTopoData.info.clusterName}
clusterNameOfKubectl={tenantTopoData.info.clusterResourceName}
namespace={tenantTopoData.info.namespace}
header={
<BasicInfo
Expand Down
2 changes: 1 addition & 1 deletion ui/src/pages/Tenant/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export const getNewClusterList = (
for (let cluster of _clusterList) {
if (
cluster.clusterId === target.id ||
cluster.clusterName === target.name
cluster.name === target.name
) {
cluster.topology.forEach((zoneItem) => {
if (zoneItem.zone === zone) {
Expand Down
2 changes: 1 addition & 1 deletion ui/src/services/tenant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export async function getTenant({
});
let infoKeys = [
'charset',
'clusterName',
'clusterResourceName',
'tenantName',
'tenantRole',
'unitNumber',
Expand Down
2 changes: 1 addition & 1 deletion ui/src/services/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ declare namespace API {

type InfoType = {
charset: string;
clusterName: string;
clusterResourceName: string;
tenantName: string;
tenantRole: TenantRole;
unitNumber: number;
Expand Down

0 comments on commit 8343be3

Please sign in to comment.