Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
1,023 additions
and
226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 0 additions & 5 deletions
5
frontend/packages/console-app/src/components/dashboards-page/operator-status.scss
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
frontend/packages/console-app/src/components/nodes/node-dashboard/ActivityCard.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import * as React from 'react'; | ||
import DashboardCard from '@console/shared/src/components/dashboard/dashboard-card/DashboardCard'; | ||
import DashboardCardHeader from '@console/shared/src/components/dashboard/dashboard-card/DashboardCardHeader'; | ||
import DashboardCardTitle from '@console/shared/src/components/dashboard/dashboard-card/DashboardCardTitle'; | ||
import DashboardCardLink from '@console/shared/src/components/dashboard/dashboard-card/DashboardCardLink'; | ||
import DashboardCardBody from '@console/shared/src/components/dashboard/dashboard-card/DashboardCardBody'; | ||
import ActivityBody, { | ||
RecentEventsBody, | ||
OngoingActivityBody, | ||
} from '@console/shared/src/components/dashboard/activity-card/ActivityBody'; | ||
import { EventModel, NodeModel } from '@console/internal/models'; | ||
import { EventKind, NodeKind } from '@console/internal/module/k8s'; | ||
import { resourcePathFromModel } from '@console/internal/components/utils'; | ||
import { useK8sWatchResource } from '@console/internal/components/utils/k8s-watch-hook'; | ||
|
||
import { NodeDashboardContext } from './NodeDashboardContext'; | ||
|
||
const eventsResource = { | ||
isList: true, | ||
kind: EventModel.kind, | ||
}; | ||
|
||
const nodeEventsFilter = (event: EventKind, uid: string, kind: string, name: string): boolean => { | ||
const { uid: objectUID, kind: objectKind, name: objectName } = event?.involvedObject || {}; | ||
return objectUID === uid && objectKind === kind && objectName === name; | ||
}; | ||
|
||
const RecentEvent: React.FC<RecentEventProps> = ({ node }) => { | ||
const [data, loaded, loadError] = useK8sWatchResource<EventKind[]>(eventsResource); | ||
const { uid, name } = node.metadata; | ||
const eventsFilter = React.useCallback( | ||
(event) => nodeEventsFilter(event, uid, NodeModel.kind, name), | ||
[uid, name], | ||
); | ||
return <RecentEventsBody events={{ data, loaded, loadError }} filter={eventsFilter} />; | ||
}; | ||
|
||
const ActivityCard: React.FC = () => { | ||
const { obj } = React.useContext(NodeDashboardContext); | ||
const eventsLink = `${resourcePathFromModel(NodeModel, obj.metadata.name)}/events`; | ||
return ( | ||
<DashboardCard gradient data-test-id="activity-card"> | ||
<DashboardCardHeader> | ||
<DashboardCardTitle>Activity</DashboardCardTitle> | ||
<DashboardCardLink to={eventsLink}>View events</DashboardCardLink> | ||
</DashboardCardHeader> | ||
<DashboardCardBody> | ||
<ActivityBody className="co-project-dashboard__activity-body"> | ||
<OngoingActivityBody loaded /> | ||
<RecentEvent node={obj} /> | ||
</ActivityBody> | ||
</DashboardCardBody> | ||
</DashboardCard> | ||
); | ||
}; | ||
|
||
type RecentEventProps = { | ||
node: NodeKind; | ||
}; | ||
|
||
export default ActivityCard; |
51 changes: 51 additions & 0 deletions
51
frontend/packages/console-app/src/components/nodes/node-dashboard/DetailsCard.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import * as React from 'react'; | ||
import DashboardCard from '@console/shared/src/components/dashboard/dashboard-card/DashboardCard'; | ||
import DashboardCardHeader from '@console/shared/src/components/dashboard/dashboard-card/DashboardCardHeader'; | ||
import DashboardCardTitle from '@console/shared/src/components/dashboard/dashboard-card/DashboardCardTitle'; | ||
import DashboardCardBody from '@console/shared/src/components/dashboard/dashboard-card/DashboardCardBody'; | ||
import DetailsBody from '@console/shared/src/components/dashboard/details-card/DetailsBody'; | ||
import DetailItem from '@console/shared/src/components/dashboard/details-card/DetailItem'; | ||
import DashboardCardLink from '@console/shared/src/components/dashboard/dashboard-card/DashboardCardLink'; | ||
import { getNodeAddresses } from '@console/shared/src/selectors/node'; | ||
import { resourcePathFromModel } from '@console/internal/components/utils'; | ||
import { NodeModel } from '@console/internal/models'; | ||
|
||
import NodeIPList from '../NodeIPList'; | ||
import NodeRoles from '../NodeRoles'; | ||
import { NodeDashboardContext } from './NodeDashboardContext'; | ||
|
||
const DetailsCard: React.FC = () => { | ||
const { obj } = React.useContext(NodeDashboardContext); | ||
const detailsLink = `${resourcePathFromModel(NodeModel, obj.metadata.name)}/details`; | ||
const instanceType = obj.metadata.labels?.['beta.kubernetes.io/instance-type']; | ||
const zone = obj.metadata.labels?.['topology.kubernetes.io/region']; | ||
return ( | ||
<DashboardCard data-test-id="details-card"> | ||
<DashboardCardHeader> | ||
<DashboardCardTitle>Details</DashboardCardTitle> | ||
<DashboardCardLink to={detailsLink}>View all</DashboardCardLink> | ||
</DashboardCardHeader> | ||
<DashboardCardBody> | ||
<DetailsBody> | ||
<DetailItem isLoading={!obj} title="Node Name"> | ||
{obj.metadata.name} | ||
</DetailItem> | ||
<DetailItem isLoading={!obj} title="Role"> | ||
<NodeRoles node={obj} /> | ||
</DetailItem> | ||
<DetailItem isLoading={!obj} title="Instance Type" error={!instanceType}> | ||
{instanceType} | ||
</DetailItem> | ||
<DetailItem isLoading={!obj} title="Zone" error={!zone}> | ||
{zone} | ||
</DetailItem> | ||
<DetailItem isLoading={!obj} title="Node Addresses"> | ||
<NodeIPList ips={getNodeAddresses(obj)} expand /> | ||
</DetailItem> | ||
</DetailsBody> | ||
</DashboardCardBody> | ||
</DashboardCard> | ||
); | ||
}; | ||
|
||
export default DetailsCard; |
Oops, something went wrong.