chore: dashboard api
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import { Card, Col, Row, Space } from 'antd';
|
||||
import React from 'react';
|
||||
import _ from 'lodash';
|
||||
import React, { useContext } from 'react';
|
||||
import { overviewConfigs } from '../config';
|
||||
import { DashboardContext } from '../config/dashboard-context';
|
||||
import '../styles/index.less';
|
||||
import styles from './over-view.less';
|
||||
|
||||
@@ -23,23 +25,8 @@ const renderCardItem = (data: {
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
const Overview: React.FC = (props) => {
|
||||
// const { data = {} } = props;
|
||||
const data = {
|
||||
workers: 8,
|
||||
models: {
|
||||
healthy: 10,
|
||||
warning: 2,
|
||||
error: 1
|
||||
},
|
||||
gpus: 30,
|
||||
allocatedGpus: 12,
|
||||
instances: {
|
||||
healthy: 32,
|
||||
warning: 3,
|
||||
error: 2
|
||||
}
|
||||
};
|
||||
const Overview: React.FC = () => {
|
||||
const data = useContext(DashboardContext).resource_counts || {};
|
||||
|
||||
const renderValue = (
|
||||
value:
|
||||
@@ -75,7 +62,7 @@ const Overview: React.FC = (props) => {
|
||||
>
|
||||
{renderCardItem({
|
||||
label: config.label,
|
||||
value: renderValue(data[config.key] || 0),
|
||||
value: renderValue(_.get(data, config.key, 0)),
|
||||
bgColor: config.backgroundColor
|
||||
})}
|
||||
</Col>
|
||||
|
||||
Reference in New Issue
Block a user