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

chore: update frontend dependencies #2195

Merged
merged 3 commits into from
Jan 12, 2025
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
30 changes: 14 additions & 16 deletions frontend/webapp/components/overview/all-drawers/cli-drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,25 +51,23 @@ export const CliDrawer: React.FC<Props> = () => {
{ columnKey: 'token', value: `${new Array(15).fill('•').join('')}` },
{
columnKey: 'actions',
component: () => (
<FlexRow $gap={0}>
<IconButton size={32} onClick={() => clickCopy(token, idx)}>
{isCopied && copiedIndex === idx ? getStatusIcon(NOTIFICATION_TYPE.SUCCESS)({}) : <CopyIcon />}
</IconButton>
component: () => {
const SuccessIcon = getStatusIcon(NOTIFICATION_TYPE.SUCCESS);

{/* <Divider orientation='vertical' length='12px' />
return (
<FlexRow $gap={0}>
<IconButton size={32} onClick={() => clickCopy(token, idx)}>
{isCopied && copiedIndex === idx ? <SuccessIcon /> : <CopyIcon />}
</IconButton>

<IconButton size={32} onClick={() => {}}>
<EditIcon />
</IconButton> */}
{/* <Divider orientation='vertical' length='12px' />

{/* <Divider orientation='vertical' length='12px' />

<IconButton size={32} onClick={() => {}}>
<TrashIcon />
</IconButton> */}
</FlexRow>
),
<IconButton size={32} onClick={() => {}}>
<EditIcon />
</IconButton> */}
</FlexRow>
);
},
},
]),
},
Expand Down
5 changes: 1 addition & 4 deletions frontend/webapp/hooks/common/useOnClickOutside.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { useEffect } from 'react';

export function useOnClickOutside(
ref: React.RefObject<HTMLElement>,
handler: () => void
) {
export function useOnClickOutside(ref: React.RefObject<HTMLElement | null>, handler: () => void) {
useEffect(() => {
const listener = (event: MouseEvent | TouchEvent) => {
// Do nothing if clicking ref's element or descendent elements
Expand Down
33 changes: 16 additions & 17 deletions frontend/webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,29 @@
"cy:open": "cypress open --e2e -b electron"
},
"dependencies": {
"@apollo/client": "^3.11.10",
"@apollo/experimental-nextjs-app-support": "^0.11.6",
"@keyval-dev/design-system": "^2.3.3",
"@xyflow/react": "^12.3.5",
"graphql": "^16.9.0",
"@apollo/client": "^3.12.5",
"@apollo/experimental-nextjs-app-support": "^0.11.7",
"@xyflow/react": "^12.3.6",
"graphql": "^16.10.0",
"javascript-time-ago": "^2.5.11",
"next": "15.0.3",
"next": "15.1.4",
"prism-react-renderer": "^2.4.1",
"react": "18.3.1",
"react-dom": "18.3.1",
"react": "19.0.0",
"react-dom": "19.0.0",
"react-flow-renderer": "^10.3.17",
"styled-components": "^6.1.13",
"zustand": "^5.0.1"
"styled-components": "^6.1.14",
"zustand": "^5.0.3"
},
"devDependencies": {
"@types/node": "22.9.0",
"@types/react": "18.3.12",
"@types/react-dom": "18.3.1",
"@types/node": "22.10.5",
"@types/react": "19.0.4",
"@types/react-dom": "19.0.2",
"autoprefixer": "^10.4.20",
"babel-plugin-styled-components": "^2.1.4",
"cypress": "^13.16.1",
"eslint": "9.15.0",
"eslint-config-next": "15.0.3",
"cypress": "^13.17.0",
"eslint": "9.18.0",
"eslint-config-next": "15.1.4",
"postcss": "^8.4.49",
"typescript": "5.6.3"
"typescript": "5.7.3"
}
}
3 changes: 2 additions & 1 deletion frontend/webapp/reuseable-components/badge/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from 'react';
import styled from 'styled-components';

interface Props {
label: string | number | JSX.Element;
label: string | number | React.ReactNode;
filled?: boolean;
}

Expand Down
4 changes: 2 additions & 2 deletions frontend/webapp/reuseable-components/data-tab/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ interface Props {
isError?: boolean;
withExtend?: boolean;
isExtended?: boolean;
renderExtended?: () => JSX.Element;
renderActions?: () => JSX.Element;
renderExtended?: () => React.ReactNode;
renderActions?: () => React.ReactNode;
onClick?: () => void;
}

Expand Down
15 changes: 4 additions & 11 deletions frontend/webapp/reuseable-components/fade-loader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import theme from '@/styles/theme';

export type LengthType = number | string;

interface CommonProps
extends DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement> {
interface CommonProps extends DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement> {
color?: string;
loading?: boolean;
cssOverride?: CSSProperties;
Expand All @@ -21,11 +20,7 @@ interface LoaderHeightWidthRadiusProps extends CommonProps {
margin?: LengthType;
}

const fade = createAnimation(
'FadeLoader',
'50% {opacity: 0.3} 100% {opacity: 1}',
'fade'
);
const fade = createAnimation('FadeLoader', '50% {opacity: 0.3} 100% {opacity: 1}', 'fade');

function FadeLoader({
loading = true,
Expand All @@ -37,7 +32,7 @@ function FadeLoader({
radius = 2,
margin = 2,
...additionalprops
}: LoaderHeightWidthRadiusProps): JSX.Element | null {
}: LoaderHeightWidthRadiusProps): React.ReactNode | null {
const { value } = parseLengthAndUnit(margin);
const radiusValue = value + 4.2;
const quarter = radiusValue / 2 + radiusValue / 5.5;
Expand All @@ -63,9 +58,7 @@ function FadeLoader({
borderRadius: cssValue(radius),
transition: '2s',
animationFillMode: 'both',
animation: `${fade} ${1.2 / speedMultiplier}s ${
i * 0.12
}s infinite ease-in-out`,
animation: `${fade} ${1.2 / speedMultiplier}s ${i * 0.12}s infinite ease-in-out`,
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ interface RowCell {
columnKey: string; // used to bind the row cell to the column
icon?: SVG;
value?: string;
component?: () => JSX.Element;
component?: () => React.ReactNode;
}

interface Props {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect, useRef, useState } from 'react';
import styled, { css } from 'styled-components';
import { Checkbox, FieldError, FieldLabel } from '@/reuseable-components';
import { MONITORING_OPTIONS, SignalLowercase, SignalUppercase } from '@/utils';
import { MONITORS_OPTIONS, SignalLowercase, SignalUppercase } from '@/utils';

interface Props {
isVertical?: boolean;
Expand All @@ -26,7 +26,7 @@ const ListContainer = styled.div<{ $isVertical?: Props['isVertical']; $hasError:
`}
`;

const monitors = MONITORING_OPTIONS;
const monitors = MONITORS_OPTIONS;

const isAllowed = (type: SignalLowercase, allowedSignals: Props['allowedSignals']) => {
return !allowedSignals?.length || !!allowedSignals?.find((str) => str === type.toUpperCase());
Expand All @@ -44,9 +44,9 @@ export const MonitoringCheckboxes: React.FC<Props> = ({ isVertical, title = 'Mon
const payload: SignalUppercase[] = selectedSignals;

if (!payload.length) {
monitors.forEach(({ type }) => {
if (isAllowed(type, allowedSignals)) {
payload.push(type.toUpperCase() as SignalUppercase);
monitors.forEach(({ id }) => {
if (isAllowed(id, allowedSignals)) {
payload.push(id.toUpperCase() as SignalUppercase);
}
});
}
Expand Down Expand Up @@ -79,12 +79,12 @@ export const MonitoringCheckboxes: React.FC<Props> = ({ isVertical, title = 'Mon

<ListContainer $isVertical={isVertical} $hasError={!!errorMessage}>
{monitors.map((monitor) => {
const allowed = isAllowed(monitor.type, allowedSignals);
const selected = isSelected(monitor.type, selectedSignals);
const allowed = isAllowed(monitor.id, allowedSignals);
const selected = isSelected(monitor.id, selectedSignals);

if (!allowed) return null;

return <Checkbox key={monitor.id} title={monitor.title} disabled={!allowed || (isLastSelection && selected)} value={selected} onChange={(value) => handleChange(monitor.type, value)} />;
return <Checkbox key={monitor.id} title={monitor.value} disabled={!allowed || (isLastSelection && selected)} value={selected} onChange={(value) => handleChange(monitor.id, value)} />;
})}
</ListContainer>

Expand Down
52 changes: 6 additions & 46 deletions frontend/webapp/utils/constants/monitors.tsx
Original file line number Diff line number Diff line change
@@ -1,64 +1,24 @@
import { SETUP } from '@/utils/constants';
import { LogsFocusIcon, LogsIcon, MetricsFocusIcon, MetricsIcon, TraceFocusIcon, TraceIcon } from '@keyval-dev/design-system';

export type SignalUppercase = 'TRACES' | 'METRICS' | 'LOGS';
export type SignalLowercase = 'traces' | 'metrics' | 'logs';

export type MonitoringOption = {
id: number;
type: SignalLowercase;
title: string;
tapped: boolean;
icons: {
notFocus: () => JSX.Element;
focus: () => JSX.Element;
};
id: SignalLowercase;
value: string;
};

export const MONITORING_OPTIONS: MonitoringOption[] = [
{
id: 1,
icons: {
notFocus: () => <LogsIcon />,
focus: () => <LogsFocusIcon />,
},
title: SETUP.MONITORS.LOGS,
type: 'logs',
tapped: true,
},
{
id: 2,
icons: {
notFocus: () => <MetricsIcon />,
focus: () => <MetricsFocusIcon />,
},
title: SETUP.MONITORS.METRICS,
type: 'metrics',
tapped: true,
},
{
id: 3,
icons: {
notFocus: () => <TraceIcon />,
focus: () => <TraceFocusIcon />,
},
title: SETUP.MONITORS.TRACES,
type: 'traces',
tapped: true,
},
];

export const MONITORS_OPTIONS = [
export const MONITORS_OPTIONS: MonitoringOption[] = [
{
id: 'logs',
value: 'Logs',
value: SETUP.MONITORS.LOGS,
},
{
id: 'metrics',
value: 'Metrics',
value: SETUP.MONITORS.METRICS,
},
{
id: 'traces',
value: 'Traces',
value: SETUP.MONITORS.TRACES,
},
];
Loading
Loading