Skip to content

Commit

Permalink
feat: WorkloadPodsTable add loading
Browse files Browse the repository at this point in the history
  • Loading branch information
bowen tan authored and bowen tan committed Oct 30, 2024
1 parent 4d6d08d commit 55a634b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Space } from '@cloudtower/eagle';
import { Loading, Space } from '@cloudtower/eagle';
import { css } from '@linaria/core';
import { LabelSelector } from 'kubernetes-types/meta/v1';
import React, { useState, useContext } from 'react';
Expand Down Expand Up @@ -73,6 +73,10 @@ export const WorkloadPodsTable: React.FC<WorkloadPodsTableProps> = ({
}
});

if (tableProps.loading) {
return <Loading />;
}

if (tableProps.data?.length === 0) {
return <ErrorContent
errorText={i18n.t('dovetail.no_resource', { kind: ` ${i18n.t('dovetail.pod')}` })}
Expand Down
30 changes: 30 additions & 0 deletions packages/refine/src/pages/nodes/show/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { IResourceComponentsProps } from '@refinedev/core';
import { Unstructured } from 'k8s-api-provider';
import React from 'react';
import { useTranslation } from 'react-i18next';
import { WorkloadPodsTable } from 'src/components';
import K8sDropdown from 'src/components/Dropdowns/K8sDropdown';
import { PageShow } from 'src/components/PageShow';
import { BasicGroup, ConditionsGroup, NodeTaintsGroup } from 'src/components/ShowContent';
Expand All @@ -26,6 +27,35 @@ export const NodeShow: React.FC<IResourceComponentsProps> = () => {
ConditionsGroup(i18n),
],
},
{
key: 'pods',
title: 'Pod',
groups: [
{
areas: [
{
fields: [
{
key: 'pods',
path: [],
renderContent: (_, record) => {
return (
<div style={{ padding: '0 24px', height: '100%' }}>
<WorkloadPodsTable
filter={pod => pod.spec?.nodeName === record.name}
namespace={record.metadata.namespace}
hideToolbar
/>
</div>
);
},
},
],
},
],
},
],
},
],
}}
Dropdown={K8sDropdown}
Expand Down

0 comments on commit 55a634b

Please sign in to comment.