Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(kiali): update dark theme #1434

Merged
merged 7 commits into from
Apr 3, 2024
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 @@ -5,7 +5,7 @@ import { Breadcrumbs } from '@material-ui/core';

import { HistoryManager } from '../../app/History';
import { isMultiCluster, Paths } from '../../config';
import { kialiStyle, linkStyle } from '../../styles/StyleUtils';
import { kialiStyle, useLinkStyle } from '../../styles/StyleUtils';
import { dicIstioType } from '../../types/IstioConfigList';
import { FilterSelected } from '../Filters/StatefulFilters';

Expand Down Expand Up @@ -83,6 +83,7 @@ export const BreadcrumbView = () => {
const item = path ? path.item : '';
const istioType = path ? path.istioType : '';
const pathItem = path ? path.pathItem : '';
const linkStyle = useLinkStyle();

const isIstio = isIstioF();
const linkItem = isIstio ? (
Expand All @@ -97,6 +98,7 @@ export const BreadcrumbView = () => {
// @ts-ignore
dicIstioType[path?.istioType || '']
}`;

return (
<div className={breadcrumStyle}>
<Breadcrumbs>
Expand Down
14 changes: 9 additions & 5 deletions plugins/kiali/src/components/Charts/SparklineChart.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react';

import { useTheme } from '@material-ui/core/styles';
import {
Chart,
ChartArea,
Expand Down Expand Up @@ -32,10 +33,6 @@ type Props = ChartProps & {
thresholds?: VCLines<RichDataPoint>;
};

const axisStyle = {
tickLabels: { fill: PFColors.Color100 },
};

export const INTERPOLATION_STRATEGY = 'monotoneX';

export const SparklineChart = (props: Props) => {
Expand All @@ -45,6 +42,13 @@ export const SparklineChart = (props: Props) => {
);
const containerRef: React.RefObject<HTMLDivElement> | undefined =
props.width === undefined ? React.createRef<HTMLDivElement>() : undefined;
const theme = useTheme();
const axisStyle = {
tickLabels: { fill: theme.palette.type === 'dark' ? '#dcdcdc' : '#000' },
};
const labelStyle = {
fill: theme.palette.type === 'dark' ? '#dcdcdc' : '#000',
};

const handleResize = () => {
if (containerRef?.current) {
Expand Down Expand Up @@ -156,7 +160,7 @@ export const SparklineChart = (props: Props) => {
x={15}
angle={0}
renderInPortal
style={{ fill: PFColors.Color100 }}
style={labelStyle}
/>
}
tickCount={2}
Expand Down
8 changes: 6 additions & 2 deletions plugins/kiali/src/components/Overview/TLSInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import * as React from 'react';

import { Chip, Tooltip } from '@material-ui/core';
import { useTheme } from '@material-ui/core/styles';

import { KialiIcon } from '../../config/KialiIcon';
import { infoStyle } from '../../pages/Overview/OverviewCard/OverviewCardControlPlaneNamespace';
import { kialiStyle } from '../../styles/StyleUtils';
import { getChipStyle, kialiStyle } from '../../styles/StyleUtils';
import { CertsInfo } from '../../types/CertsInfo';

type Props = {
Expand Down Expand Up @@ -60,6 +61,9 @@ function LockIcon(props: Props) {
}

export const TLSInfo = (props: Props) => {
const theme = useTheme();
const chipStyle = getChipStyle(theme);

return (
<div style={{ textAlign: 'left' }}>
<div>
Expand All @@ -75,7 +79,7 @@ export const TLSInfo = (props: Props) => {

<Chip
size="small"
style={{ backgroundColor: '#e7f1fa' }}
style={chipStyle}
data-test="label-TLS"
label={
<div style={{ display: '-webkit-box' }}>
Expand Down
1 change: 1 addition & 0 deletions plugins/kiali/src/components/VirtualList/Config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export type Renderer<R extends RenderResource> = (
health?: Health,
statefulFilter?: React.RefObject<StatefulFilters>,
view?: string,
linkColor?: string,
) => JSX.Element | undefined;

export type ResourceType<R extends RenderResource> = {
Expand Down
7 changes: 4 additions & 3 deletions plugins/kiali/src/components/VirtualList/Renderers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { isWaypoint } from '../../helpers/LabelFilterHelper';
import { infoStyle } from '../../pages/Overview/OverviewCard/CanaryUpgradeProgress';
import { ControlPlaneBadge } from '../../pages/Overview/OverviewCard/ControlPlaneBadge';
import { OverviewCardSparklineCharts } from '../../pages/Overview/OverviewCard/OverviewCardSparklineCharts';
import { linkStyle } from '../../styles/StyleUtils';
import { Health } from '../../types/Health';
import { IstioConfigItem } from '../../types/IstioConfigList';
import { ValidationStatus } from '../../types/IstioObjects';
Expand Down Expand Up @@ -93,9 +92,11 @@ export const item: Renderer<TResource> = (
_?: Health,
__?: React.RefObject<StatefulFilters>,
view?: string,
) => {
linkColor?: string,
): React.ReactElement => {
const key = `link_definition_${config.name}_${resource.namespace}_${resource.name}`;
let serviceBadge = badge;

if ('serviceRegistry' in resource && resource.serviceRegistry) {
switch (resource.serviceRegistry) {
case 'External':
Expand All @@ -119,7 +120,7 @@ export const item: Renderer<TResource> = (
{view !== ENTITY && (
<PFBadge badge={serviceBadge} position={topPosition} />
)}
<Link key={key} to={getLink(resource, config)} className={linkStyle}>
<Link key={key} to={getLink(resource, config)} className={linkColor}>
{resource.name}
</Link>
</TableCell>
Expand Down
4 changes: 4 additions & 0 deletions plugins/kiali/src/components/VirtualList/VirtualItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { CSSProperties } from 'react';

import { TableRow } from '@material-ui/core';

import { useLinkStyle } from '../../styles/StyleUtils';
import { hasHealth, Health } from '../../types/Health';
import { StatefulFiltersProps } from '../Filters/StatefulFilters';
import { PFBadgeType } from '../Pf/PfBadges';
Expand Down Expand Up @@ -41,6 +42,8 @@ export const VirtualItem = (props: VirtualItemProps) => {
: IstioTypes[istioType].badge;
};

const linkColor = useLinkStyle();

const renderDetails = (
item: RenderResource,
health?: Health,
Expand All @@ -55,6 +58,7 @@ export const VirtualItem = (props: VirtualItemProps) => {
health,
props.statefulFilterProps,
props.view,
linkColor,
),
);
};
Expand Down
25 changes: 7 additions & 18 deletions plugins/kiali/src/pages/AppDetails/AppDescription.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
import * as React from 'react';

import {
Card,
CardBody,
CardHeader,
Title,
TitleSizes,
TooltipPosition,
} from '@patternfly/react-core';
import { Card, CardContent, CardHeader, Typography } from '@material-ui/core';

import { DetailDescription } from '../../components/DetailDescription/DetailDescription';
import { HealthIndicator } from '../../components/Health/HealthIndicator';
Expand Down Expand Up @@ -44,29 +37,25 @@ export const AppDescription: React.FC<AppDescriptionProps> = (
return props.app ? (
<Card id="AppDescriptionCard" data-test="app-description-card">
<CardHeader>
<Title headingLevel="h5" size={TitleSizes.lg}>
<Typography variant="h6" style={{ margin: '10px' }}>
<div key="service-icon" className={iconStyle}>
<PFBadge badge={PFBadges.App} position={TooltipPosition.top} />
<PFBadge badge={PFBadges.App} />
</div>

{props.app.name}

<span className={healthIconStyle}>
<HealthIndicator id={props.app.name} health={props.health} />
</span>
</Title>
</Typography>

{props.app.cluster && isMultiCluster && (
<div key="cluster-icon" style={{ paddingBottom: '0.5rem' }}>
<PFBadge
badge={PFBadges.Cluster}
position={TooltipPosition.right}
/>{' '}
{props.app.cluster}
<PFBadge badge={PFBadges.Cluster} /> {props.app.cluster}
</div>
)}
</CardHeader>
<CardBody>
<CardContent>
<Labels
labels={appLabels}
tooltipMessage={`Workloads and Services grouped by ${serverConfig.istioLabels.appLabelName} label`}
Expand All @@ -79,7 +68,7 @@ export const AppDescription: React.FC<AppDescriptionProps> = (
health={props.health}
cluster={props.app?.cluster}
/>
</CardBody>
</CardContent>
</Card>
) : (
<>Loading</>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import * as React from 'react';

import { Tooltip } from '@material-ui/core';
import { Tooltip, useTheme } from '@material-ui/core';
import {
ChartDonutUtilization,
ChartLabel,
ChartThemeColor,
} from '@patternfly/react-charts';

Expand All @@ -26,6 +27,7 @@ export const CanaryUpgradeProgress = (props: Props) => {
total > 0
? (props.canaryUpgradeStatus.migratedNamespaces.length * 100) / total
: 0;
const theme = useTheme().palette.type;
return (
<div
style={{ textAlign: 'center', paddingTop: '10px' }}
Expand Down Expand Up @@ -56,6 +58,14 @@ export const CanaryUpgradeProgress = (props: Props) => {
title={`${migrated.toFixed(2)}%`}
height={170}
themeColor={ChartThemeColor.green}
titleComponent={
<ChartLabel
style={{
fill: theme === 'dark' ? '#fff' : '#151515',
fontSize: 24,
}}
/>
}
/>
</div>
<div>
Expand Down
Loading
Loading