Skip to content

Commit 2480b2b

Browse files
committed
Changed all
Signed-off-by: cs-308-2023 <adityaruhela2003@gmail.com>
1 parent 3c623b9 commit 2480b2b

File tree

14 files changed

+79
-122
lines changed

14 files changed

+79
-122
lines changed

packages/jaeger-ui/src/components/SearchTracePage/SearchForm.jsx

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -262,12 +262,12 @@ export class SearchFormImpl extends React.PureComponent {
262262
render() {
263263
const {
264264
handleSubmit,
265-
invalid,
265+
invalid = false,
266266
searchMaxLookback,
267-
selectedLookback,
268-
selectedService = '-',
269-
services,
270-
submitting: disabled,
267+
selectedLookback = null,
268+
selectedService = null,
269+
services = [],
270+
submitting = false,
271271
} = this.props;
272272
const selectedServicePayload = services.find(s => s.name === selectedService);
273273
const opsForSvc = (selectedServicePayload && selectedServicePayload.operations) || [];
@@ -555,14 +555,6 @@ SearchFormImpl.propTypes = {
555555
selectedLookback: PropTypes.string,
556556
};
557557

558-
SearchFormImpl.defaultProps = {
559-
invalid: false,
560-
services: [],
561-
submitting: false,
562-
selectedService: null,
563-
selectedLookback: null,
564-
};
565-
566558
export const searchSideBarFormSelector = formValueSelector('searchSideBar');
567559

568560
export function mapStateToProps(state) {

packages/jaeger-ui/src/components/SearchTracePage/SearchResults/ScatterPlot.jsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ import { ONE_MILLISECOND, formatDuration } from '../../../utils/date';
2323
import 'react-vis/dist/style.css';
2424
import './ScatterPlot.css';
2525

26-
export default function ScatterPlot(props) {
27-
const { data, onValueClick, calculateContainerWidth } = props;
28-
26+
export default function ScatterPlot({
27+
data,
28+
onValueClick,
29+
calculateContainerWidth = container => container.clientWidth,
30+
}) {
2931
const containerRef = useRef(null);
3032
const [containerWidth, setContainerWidth] = useState(0);
3133

@@ -103,8 +105,3 @@ ScatterPlot.propTypes = {
103105
onValueClick: PropTypes.func.isRequired,
104106
calculateContainerWidth: PropTypes.func,
105107
};
106-
107-
ScatterPlot.defaultProps = {
108-
// JSDOM does not, as of 2023, have a layout engine, so allow tests to supply a mock width as a workaround.
109-
calculateContainerWidth: container => container.clientWidth,
110-
};

packages/jaeger-ui/src/components/TraceDiff/TraceDiffHeader/TraceHeader.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,15 @@ export function Attrs(props: AttrsProps) {
7575
);
7676
}
7777

78-
export default function TraceHeader(props: Props) {
79-
const { duration, error, startTime, state, traceID, totalSpans, traceName } = props;
78+
export default function TraceHeader({
79+
duration,
80+
error = undefined,
81+
startTime,
82+
state,
83+
traceID,
84+
totalSpans,
85+
traceName,
86+
}: Props) {
8087
const AttrsComponent = state === fetchedState.DONE ? Attrs : EmptyAttrs;
8188

8289
return (
@@ -101,7 +108,3 @@ export default function TraceHeader(props: Props) {
101108
</div>
102109
);
103110
}
104-
105-
TraceHeader.defaultProps = {
106-
error: undefined,
107-
};

packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/SpanDetail/AccordianKeyValues.tsx

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ type AccordianKeyValuesProps = {
3535
};
3636

3737
// export for tests
38-
export function KeyValuesSummary(props: { data?: KeyValuePair[] }) {
39-
const { data } = props;
38+
export function KeyValuesSummary({ data = null }: { data?: KeyValuePair[] | null }) {
4039
if (!Array.isArray(data) || !data.length) {
4140
return null;
4241
}
@@ -55,12 +54,16 @@ export function KeyValuesSummary(props: { data?: KeyValuePair[] }) {
5554
);
5655
}
5756

58-
KeyValuesSummary.defaultProps = {
59-
data: null,
60-
};
61-
62-
export default function AccordianKeyValues(props: AccordianKeyValuesProps) {
63-
const { className, data, highContrast, interactive, isOpen, label, linksGetter, onToggle } = props;
57+
export default function AccordianKeyValues({
58+
className = null,
59+
data,
60+
highContrast = false,
61+
interactive = true,
62+
isOpen,
63+
label,
64+
linksGetter,
65+
onToggle = null,
66+
}: AccordianKeyValuesProps) {
6467
const isEmpty = !Array.isArray(data) || !data.length;
6568
const iconCls = cx('u-align-icon', { 'AccordianKeyValues--emptyIcon': isEmpty });
6669
let arrow: React.ReactNode | null = null;
@@ -94,10 +97,3 @@ export default function AccordianKeyValues(props: AccordianKeyValuesProps) {
9497
</div>
9598
);
9699
}
97-
98-
AccordianKeyValues.defaultProps = {
99-
className: null,
100-
highContrast: false,
101-
interactive: true,
102-
onToggle: null,
103-
};

packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/SpanDetail/AccordianLogs.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,24 @@ import './AccordianLogs.css';
2727
type AccordianLogsProps = {
2828
interactive?: boolean;
2929
isOpen: boolean;
30-
linksGetter: ((pairs: KeyValuePair[], index: number) => Link[]) | TNil;
30+
linksGetter?: ((pairs: KeyValuePair[], index: number) => Link[]) | TNil; // Optional
3131
logs: Log[];
3232
onItemToggle?: (log: Log) => void;
3333
onToggle?: () => void;
3434
openedItems?: Set<Log>;
3535
timestamp: number;
3636
};
3737

38-
export default function AccordianLogs(props: AccordianLogsProps) {
39-
const { interactive, isOpen, linksGetter, logs, openedItems, onItemToggle, onToggle, timestamp } = props;
38+
export default function AccordianLogs({
39+
interactive = true,
40+
isOpen,
41+
linksGetter,
42+
logs,
43+
openedItems = undefined,
44+
onItemToggle = undefined,
45+
onToggle = undefined,
46+
timestamp,
47+
}: AccordianLogsProps) {
4048
let arrow: React.ReactNode | null = null;
4149
let HeaderComponent: 'span' | 'a' = 'span';
4250
let headerProps: object | null = null;
@@ -84,11 +92,3 @@ export default function AccordianLogs(props: AccordianLogsProps) {
8492
</div>
8593
);
8694
}
87-
88-
AccordianLogs.defaultProps = {
89-
interactive: true,
90-
linksGetter: undefined,
91-
onItemToggle: undefined,
92-
onToggle: undefined,
93-
openedItems: undefined,
94-
};

packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/SpanDetail/AccordianText.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,16 @@ type AccordianTextProps = {
3131
onToggle?: null | (() => void);
3232
};
3333

34-
export default function AccordianText(props: AccordianTextProps) {
35-
const { className, data, headerClassName, highContrast, interactive, isOpen, label, onToggle } = props;
34+
export default function AccordianText({
35+
className = null,
36+
data,
37+
headerClassName,
38+
highContrast = false,
39+
interactive = true,
40+
isOpen,
41+
label,
42+
onToggle = null,
43+
}: AccordianTextProps) {
3644
const isEmpty = !Array.isArray(data) || !data.length;
3745
const iconCls = cx('u-align-icon', { 'AccordianKeyValues--emptyIcon': isEmpty });
3846

@@ -64,10 +72,3 @@ export default function AccordianText(props: AccordianTextProps) {
6472
</div>
6573
);
6674
}
67-
68-
AccordianText.defaultProps = {
69-
className: null,
70-
highContrast: false,
71-
interactive: true,
72-
onToggle: null,
73-
};

packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/SpanDetail/KeyValuesTable.tsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,16 +116,20 @@ function formatValue(key: string, value: any) {
116116
return <div className="ub-inline-block">{content}</div>;
117117
}
118118

119-
export const LinkValue = (props: { href: string; title?: string; children: React.ReactNode }) => (
120-
<a href={props.href} title={props.title} target="_blank" rel="noopener noreferrer">
121-
{props.children} <IoOpenOutline className="KeyValueTable--linkIcon" />
119+
export const LinkValue = ({
120+
href,
121+
title = '',
122+
children,
123+
}: {
124+
href: string;
125+
title?: string;
126+
children: React.ReactNode;
127+
}) => (
128+
<a href={href} title={title} target="_blank" rel="noopener noreferrer">
129+
{children} <IoOpenOutline className="KeyValueTable--linkIcon" />
122130
</a>
123131
);
124132

125-
LinkValue.defaultProps = {
126-
title: '',
127-
};
128-
129133
const linkValueList = (links: Link[]) => {
130134
const dropdownItems = links.map(({ text, url }, index) => ({
131135
label: <LinkValue href={url}>{text}</LinkValue>,

packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/Ticks.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ type TicksProps = {
2626
startTime?: number | TNil;
2727
};
2828

29-
export default function Ticks(props: TicksProps) {
30-
const { endTime, numTicks, showLabels, startTime } = props;
31-
29+
export default function Ticks({ endTime = null, numTicks, showLabels = null, startTime = null }: TicksProps) {
3230
let labels: undefined | string[];
3331
if (showLabels) {
3432
labels = [];
@@ -57,9 +55,3 @@ export default function Ticks(props: TicksProps) {
5755
}
5856
return <div className="Ticks">{ticks}</div>;
5957
}
60-
61-
Ticks.defaultProps = {
62-
endTime: null,
63-
showLabels: null,
64-
startTime: null,
65-
};

packages/jaeger-ui/src/components/TracePage/TraceTimelineViewer/TimelineRow.tsx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,15 @@ interface ITimelineRowCellProps extends React.HTMLAttributes<HTMLDivElement> {
2828
style?: object;
2929
}
3030

31-
export default function TimelineRow(props: TTimelineRowProps) {
32-
const { children, className = '', ...rest } = props;
31+
export default function TimelineRow({ children, className = '', ...rest }: TTimelineRowProps) {
3332
return (
3433
<div className={`flex-row ${className}`} {...rest}>
3534
{children}
3635
</div>
3736
);
3837
}
3938

40-
TimelineRow.defaultProps = {
41-
className: '',
42-
};
43-
44-
function TimelineRowCell(props: ITimelineRowCellProps) {
45-
const { children, className = '', width, style, ...rest } = props;
39+
function TimelineRowCell({ children, className = '', width, style = {}, ...rest }: ITimelineRowCellProps) {
4640
const widthPercent = `${width * 100}%`;
4741
const mergedStyle = { ...style, flexBasis: widthPercent, maxWidth: widthPercent };
4842
return (
@@ -52,6 +46,4 @@ function TimelineRowCell(props: ITimelineRowCellProps) {
5246
);
5347
}
5448

55-
TimelineRowCell.defaultProps = { className: '', style: {} };
56-
5749
TimelineRow.Cell = TimelineRowCell;

packages/jaeger-ui/src/components/common/BreakableText.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type Props = {
2424
wordRegexp?: RegExp;
2525
};
2626

27-
export default function BreakableText({className,text = 'BreakableText',wordRegexp = WORD_RX}: Props) {
27+
export default function BreakableText({ className, text = 'BreakableText', wordRegexp = WORD_RX }: Props) {
2828
if (!text) {
2929
return typeof text === 'string' ? text : null;
3030
}

packages/jaeger-ui/src/components/common/ErrorMessage.tsx

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,12 @@ export function Message({
7070
return msg;
7171
}
7272

73-
74-
export function Details(props: SubPartProps) {
75-
const { className, error, wrap, wrapperClassName } = props;
76-
73+
export function Details({
74+
className = undefined,
75+
error,
76+
wrap = false,
77+
wrapperClassName = undefined,
78+
}: SubPartProps) {
7779
if (typeof error === 'string') {
7880
return null;
7981
}
@@ -112,17 +114,11 @@ export function Details(props: SubPartProps) {
112114
return details;
113115
}
114116

115-
Details.defaultProps = {
116-
className: undefined,
117-
wrap: false,
118-
wrapperClassName: undefined,
119-
};
120-
121117
export default function ErrorMessage({
122-
className,
123-
detailClassName,
118+
className = undefined,
119+
detailClassName = undefined,
124120
error,
125-
messageClassName,
121+
messageClassName = undefined,
126122
}: ErrorMessageProps) {
127123
if (!error) {
128124
return null;
@@ -139,9 +135,3 @@ export default function ErrorMessage({
139135
</div>
140136
);
141137
}
142-
143-
ErrorMessage.defaultProps = {
144-
className: undefined,
145-
detailClassName: undefined,
146-
messageClassName: undefined,
147-
};

packages/jaeger-ui/src/components/common/LoadingIndicator.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ export default function LoadingIndicator({
4040
${className || ''}
4141
`;
4242
return <LuLoader2 className={cls} {...rest} />;
43-
}
43+
}

packages/jaeger-ui/src/components/common/NewWindowIcon.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,7 @@ type Props = {
2222
isLarge?: boolean;
2323
};
2424

25-
export default function NewWindowIcon(props: Props) {
26-
const { isLarge, ...rest } = props;
25+
export default function NewWindowIcon({ isLarge = false, ...rest }: Props) {
2726
const cls = cx('NewWindowIcon', { 'is-large': isLarge });
2827
return <IoOpenOutline className={cls} {...rest} data-testid="NewWindowIcon" />;
2928
}
30-
31-
NewWindowIcon.defaultProps = {
32-
isLarge: false,
33-
};

packages/plexus/src/zoom/MiniMap.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ function getClassNames(props: TProps) {
8181
};
8282
}
8383

84-
export function MiniMap(props: TProps) {
85-
const css = getClassNames(props);
84+
export function MiniMap({ className = '', classNamePrefix = 'plexus', ...props }: TProps) {
85+
const css = getClassNames({ className, classNamePrefix, ...props });
8686
const mapSize = getMapSize(props);
8787
const activeXform = getViewTransform(props, mapSize);
8888
return (
@@ -103,9 +103,4 @@ export function MiniMap(props: TProps) {
103103
);
104104
}
105105

106-
MiniMap.defaultProps = {
107-
className: '',
108-
classNamePrefix: 'plexus',
109-
};
110-
111106
export default React.memo(MiniMap);

0 commit comments

Comments
 (0)