Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,40 @@
padding: 0px 5px;
}

.ant-tooltip {
.ant-tooltip-inner {
background-color: rgba(0, 0, 0, 0.85);
}
}

.ant-statistic-title {
font-size: 12px;
}

// This is for the suffix part of the value ex: TB, GB etc
.ant-statistic-content-suffix {
font-family: Roboto;
font-size: 14px;
font-weight: normal;
font-stretch: normal;
font-style: normal;
line-height: 1.43;
letter-spacing: normal;
text-align: left;
vertical-align: text-top;
color: rgba(0, 0, 0, 0.85);
margin: 3px 0 0 1px;
}

.ant-divider-horizontal {
margin: 16px 0;
}

.ant-card-body {
// This is to enforce 16px padding for card body which is 12px by default
padding: 16px !important;
}

.content-layout {
margin-left: 200px;
&.sidebar-collapsed {
Expand Down Expand Up @@ -77,12 +111,6 @@ body {
color: gray;
}

.ant-tooltip {
.ant-tooltip-inner {
background-color: rgba(0, 0, 0, 0.85);
}
}

.hexagon-shape(@width, @height, @bg-color) {
@half-width: @width/2;
@half-height: @height/2;
Expand Down Expand Up @@ -171,8 +199,93 @@ body {
height: 80vh;
}

.health-availability {
display: inline-flex;
flex-direction: column;

.health-availability-value {
font-size: 18px;
font-weight: 400;
}
}

#error-icon {
font-size: 24px;
width: 100%;
color: #5A656D;
}

.cluster-card-data-container {
display: flex;
justify-content: space-between;
gap: 16px;

&.vertical-layout {
flex-direction: column;
gap: 0px;
}

.cluster-card-statistic {
flex: 2 1 10em;
}

.data-detail-item {
display: flex;
width: 100%;
flex-direction: column;
justify-content: flex-start;
align-items: stretch;
border-radius: 3px;

.data-detail-breakdown-container {
justify-content: flex-end;
flex-wrap: wrap;
.data-detail-breakdown-item {
margin-left: 20px;
.data-detail-breakdown-label {
font-size: 12px;
color: #5a656d;
margin-right: 4px;
}

.data-detail-breakdown-value {
font-size: 14px;
font-weight: 500;
}

}
}
}

.data-detail-breakdown-container {
.ant-statistic-title {
margin-bottom: 0;
}

.ant-statistic-content {
.ant-statistic-content-prefix {
margin-right: 1px;
}
.ant-statistic-content-value {
font-size: 16px;
}
}
}
}

.stacked-progress {
display: flex;
width: 100%;
height: 8px;
border-radius: 100px;
overflow: hidden;
margin: 24px auto 8px auto;
}

.stacked-progress-empty {
width: 100%;
height: 8px;
border-radius: 100px;
background-color: #f4f5f6;
margin: 24px auto 8px auto;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import React, { HTMLAttributes } from 'react';
import { Card, Col, Row, Table } from 'antd';

import { ColumnType } from 'antd/es/table';
import { Link } from 'react-router-dom';
import ErrorCard from '@/v2/components/errors/errorCard';
import { CheckCircleFilled, WarningFilled } from '@ant-design/icons';

// ------------- Types -------------- //
type TableData = {
key: React.Key;
name: string;
value: string;
action?: React.ReactElement | string;
}

type OverviewTableCardProps = {
title: string;
loading?: boolean;
available: number;
total: number;
linkToUrl?: string;
showHeader?: boolean;
error?: string | null;
}

// ------------- Styles -------------- //
const cardStyle: React.CSSProperties = {
height: '100%'
}
const cardHeadStyle: React.CSSProperties = {
fontSize: '14px'
}
const cardBodyStyle: React.CSSProperties = {
padding: '16px',
justifyTracks: 'space-between'
}


// ------------- Component -------------- //
const OverviewSummaryCard: React.FC<OverviewTableCardProps> = ({
available,
total,
title = '',
loading = false,
linkToUrl = '',
error
}) => {

if (error || available === undefined || total === undefined) {
return <ErrorCard title={title} />;
}

const titleElement = (linkToUrl)
? (
<div className='card-title-div'>
{title}
<Link
to={{
pathname: linkToUrl
}}
style={{
fontWeight: 400
}}>View More</Link>
</div>)
: title;

const healthCheck = available == total;
const healthIndicator = (
<div className={`icon-${healthCheck? 'success' : 'warning'}`} style={{
fontSize: '20px',
alignItems: 'center'
}}>
{
!healthCheck ? (
<>
<WarningFilled style={{
marginRight: '5px'
}} />
Unhealthy
</>
) : (
<>
<CheckCircleFilled style={{
marginRight: '5px'
}} />
Healthy
</>
)
}
</div>
)

return (
<Card
size='small'
className={'overview-card'}
loading={loading}
title={titleElement}
headStyle={cardHeadStyle}
bodyStyle={cardBodyStyle}
style={cardStyle}>
<Row gutter={[11, 0]}>
<Col span={12}>
Health
{healthIndicator}
</Col>
<Col className='health-availability' span={10}>
Availability
<span className='health-availability-value'>
{available}/{total}
</span>
</Col>
</Row>
</Card>
)
}

export default OverviewSummaryCard;
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { DisconnectOutlined } from "@ant-design/icons"
import { Card } from 'antd';

type ErrorCardProps = {
title: string;
title: string | React.ReactNode;
compact?: boolean;
};

Expand Down
Loading