mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-12 06:19:03 +08:00
FE: added more eslint rule (#2090)
* chore: arrow-body-style func-style is added in the rule * fix: linting issues fixed Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
This commit is contained in:
parent
2f1ca93eda
commit
e62e541fc4
@ -102,6 +102,8 @@ module.exports = {
|
||||
},
|
||||
],
|
||||
'@typescript-eslint/no-unused-vars': 'error',
|
||||
'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
|
||||
'arrow-body-style': ['error', 'as-needed'],
|
||||
|
||||
// eslint rules need to remove
|
||||
'@typescript-eslint/no-shadow': 'off',
|
||||
|
@ -29,8 +29,7 @@ const getOrCreateLegendList = (
|
||||
return listContainer;
|
||||
};
|
||||
|
||||
export const legend = (id: string, isLonger: boolean): Plugin<ChartType> => {
|
||||
return {
|
||||
export const legend = (id: string, isLonger: boolean): Plugin<ChartType> => ({
|
||||
id: 'htmlLegend',
|
||||
afterUpdate(chart): void {
|
||||
const ul = getOrCreateLegendList(chart, id || 'legend', isLonger);
|
||||
@ -60,7 +59,7 @@ export const legend = (id: string, isLonger: boolean): Plugin<ChartType> => {
|
||||
li.style.cursor = 'pointer';
|
||||
li.style.display = 'flex';
|
||||
li.style.marginLeft = '10px';
|
||||
// li.style.marginTop = '5px';
|
||||
li.style.marginTop = '5px';
|
||||
|
||||
li.onclick = (): void => {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
@ -84,9 +83,9 @@ export const legend = (id: string, isLonger: boolean): Plugin<ChartType> => {
|
||||
boxSpan.style.borderColor = `${item?.strokeStyle}`;
|
||||
boxSpan.style.borderWidth = `${item.lineWidth}px`;
|
||||
boxSpan.style.display = 'inline-block';
|
||||
boxSpan.style.minHeight = '0.75rem';
|
||||
boxSpan.style.marginRight = '0.5rem';
|
||||
boxSpan.style.minWidth = '0.75rem';
|
||||
boxSpan.style.minHeight = '20px';
|
||||
boxSpan.style.marginRight = '10px';
|
||||
boxSpan.style.minWidth = '20px';
|
||||
boxSpan.style.borderRadius = '50%';
|
||||
|
||||
if (item.text) {
|
||||
@ -105,5 +104,4 @@ export const legend = (id: string, isLonger: boolean): Plugin<ChartType> => {
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
};
|
||||
});
|
||||
|
@ -120,15 +120,15 @@ function LogItem({ logData }: LogItemProps): JSX.Element {
|
||||
{'}'}
|
||||
</div>
|
||||
<div>
|
||||
{map(selected, (field) => {
|
||||
return isValidLogField(flattenLogData[field.name] as never) ? (
|
||||
{map(selected, (field) =>
|
||||
isValidLogField(flattenLogData[field.name] as never) ? (
|
||||
<LogSelectedField
|
||||
key={field.name}
|
||||
fieldKey={field.name}
|
||||
fieldValue={flattenLogData[field.name] as never}
|
||||
/>
|
||||
) : null;
|
||||
})}
|
||||
) : null,
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<Divider style={{ padding: 0, margin: '0.4rem 0', opacity: 0.5 }} />
|
||||
|
@ -48,9 +48,9 @@ function ReleaseNote({ path }: ReleaseNoteProps): JSX.Element | null {
|
||||
(state) => state.app,
|
||||
);
|
||||
|
||||
const c = allComponentMap.find((item) => {
|
||||
return item.match(path, currentVersion, userFlags);
|
||||
});
|
||||
const c = allComponentMap.find((item) =>
|
||||
item.match(path, currentVersion, userFlags),
|
||||
);
|
||||
|
||||
if (!c) {
|
||||
return null;
|
||||
|
@ -6,8 +6,7 @@ import React from 'react';
|
||||
function TextToolTip({ text, url }: TextToolTipProps): JSX.Element {
|
||||
return (
|
||||
<Tooltip
|
||||
overlay={(): JSX.Element => {
|
||||
return (
|
||||
overlay={(): JSX.Element => (
|
||||
<div>
|
||||
{`${text} `}
|
||||
{url && (
|
||||
@ -16,8 +15,7 @@ function TextToolTip({ text, url }: TextToolTipProps): JSX.Element {
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}}
|
||||
)}
|
||||
>
|
||||
<QuestionCircleFilled style={{ fontSize: '1.3125rem' }} />
|
||||
</Tooltip>
|
||||
|
@ -8,7 +8,6 @@ export const TextContainer = styled.div<TextContainerProps>`
|
||||
display: flex;
|
||||
|
||||
> button {
|
||||
margin-left: ${({ noButtonMargin }): string => {
|
||||
return noButtonMargin ? '0' : '0.5rem';
|
||||
}}
|
||||
margin-left: ${({ noButtonMargin }): string =>
|
||||
noButtonMargin ? '0' : '0.5rem'}
|
||||
`;
|
||||
|
@ -184,8 +184,7 @@ function AllErrors(): JSX.Element {
|
||||
confirm,
|
||||
placeholder,
|
||||
filterKey,
|
||||
}: FilterDropdownExtendsProps) => {
|
||||
return (
|
||||
}: FilterDropdownExtendsProps) => (
|
||||
<Card size="small">
|
||||
<Space align="start" direction="vertical">
|
||||
<Input
|
||||
@ -212,8 +211,7 @@ function AllErrors(): JSX.Element {
|
||||
</Button>
|
||||
</Space>
|
||||
</Card>
|
||||
);
|
||||
},
|
||||
),
|
||||
[getUpdatedExceptionType, getUpdatedServiceName, handleSearch],
|
||||
);
|
||||
|
||||
|
@ -20,15 +20,14 @@ export const urlKey = {
|
||||
serviceName: 'serviceName',
|
||||
};
|
||||
|
||||
export const isOrderParams = (orderBy: string | null): orderBy is OrderBy => {
|
||||
return !!(
|
||||
export const isOrderParams = (orderBy: string | null): orderBy is OrderBy =>
|
||||
!!(
|
||||
orderBy === 'serviceName' ||
|
||||
orderBy === 'exceptionCount' ||
|
||||
orderBy === 'lastSeen' ||
|
||||
orderBy === 'firstSeen' ||
|
||||
orderBy === 'exceptionType'
|
||||
);
|
||||
};
|
||||
|
||||
export const getOrder = (order: string | null): Order => {
|
||||
if (isOrder(order)) {
|
||||
@ -82,12 +81,9 @@ export const getDefaultOrder = (
|
||||
return undefined;
|
||||
};
|
||||
|
||||
export const getNanoSeconds = (date: string): string => {
|
||||
return (
|
||||
export const getNanoSeconds = (date: string): string =>
|
||||
Math.floor(new Date(date).getTime() / 1e3).toString() +
|
||||
String(Timestamp.fromString(date).getNano().toString()).padStart(9, '0')
|
||||
);
|
||||
};
|
||||
String(Timestamp.fromString(date).getNano().toString()).padStart(9, '0');
|
||||
|
||||
export const getUpdatePageSize = (pageSize: string | null): number => {
|
||||
if (pageSize) {
|
||||
|
@ -78,16 +78,17 @@ function CreateAlertChannels({
|
||||
[type, selectedConfig],
|
||||
);
|
||||
|
||||
const prepareSlackRequest = useCallback(() => {
|
||||
return {
|
||||
const prepareSlackRequest = useCallback(
|
||||
() => ({
|
||||
api_url: selectedConfig?.api_url || '',
|
||||
channel: selectedConfig?.channel || '',
|
||||
name: selectedConfig?.name || '',
|
||||
send_resolved: true,
|
||||
text: selectedConfig?.text || '',
|
||||
title: selectedConfig?.title || '',
|
||||
};
|
||||
}, [selectedConfig]);
|
||||
}),
|
||||
[selectedConfig],
|
||||
);
|
||||
|
||||
const onSlackHandler = useCallback(async () => {
|
||||
setSavingState(true);
|
||||
|
@ -47,8 +47,8 @@ function EditAlertChannels({
|
||||
setType(value as ChannelType);
|
||||
}, []);
|
||||
|
||||
const prepareSlackRequest = useCallback(() => {
|
||||
return {
|
||||
const prepareSlackRequest = useCallback(
|
||||
() => ({
|
||||
api_url: selectedConfig?.api_url || '',
|
||||
channel: selectedConfig?.channel || '',
|
||||
name: selectedConfig?.name || '',
|
||||
@ -56,8 +56,9 @@ function EditAlertChannels({
|
||||
text: selectedConfig?.text || '',
|
||||
title: selectedConfig?.title || '',
|
||||
id,
|
||||
};
|
||||
}, [id, selectedConfig]);
|
||||
}),
|
||||
[id, selectedConfig],
|
||||
);
|
||||
|
||||
const onSlackEditHandler = useCallback(async () => {
|
||||
setSavingState(true);
|
||||
@ -143,8 +144,8 @@ function EditAlertChannels({
|
||||
setSavingState(false);
|
||||
}, [prepareWebhookRequest, t, notifications, selectedConfig]);
|
||||
|
||||
const preparePagerRequest = useCallback(() => {
|
||||
return {
|
||||
const preparePagerRequest = useCallback(
|
||||
() => ({
|
||||
name: selectedConfig.name || '',
|
||||
routing_key: selectedConfig.routing_key,
|
||||
client: selectedConfig.client,
|
||||
@ -157,8 +158,9 @@ function EditAlertChannels({
|
||||
details: selectedConfig.details,
|
||||
detailsArray: JSON.parse(selectedConfig.details || '{}'),
|
||||
id,
|
||||
};
|
||||
}, [id, selectedConfig]);
|
||||
}),
|
||||
[id, selectedConfig],
|
||||
);
|
||||
|
||||
const onPagerEditHandler = useCallback(async () => {
|
||||
setSavingState(true);
|
||||
|
@ -32,6 +32,8 @@ export const rawQueryToIChQuery = (
|
||||
// ClickHouseQueryBuilder format. The main difference is
|
||||
// use of rawQuery (in ClickHouseQueryBuilder)
|
||||
// and query (in alert builder)
|
||||
export const toIClickHouseQuery = (src: IChQuery): IClickHouseQuery => {
|
||||
return { ...src, name: 'A', rawQuery: src.query };
|
||||
};
|
||||
export const toIClickHouseQuery = (src: IChQuery): IClickHouseQuery => ({
|
||||
...src,
|
||||
name: 'A',
|
||||
rawQuery: src.query,
|
||||
});
|
||||
|
@ -211,34 +211,27 @@ function QuerySection({
|
||||
setFormulaQueries({ ...formulas });
|
||||
}, [formulaQueries, setFormulaQueries]);
|
||||
|
||||
const renderPromqlUI = (): JSX.Element => {
|
||||
return (
|
||||
const renderPromqlUI = (): JSX.Element => (
|
||||
<PromqlSection promQueries={promQueries} setPromQueries={setPromQueries} />
|
||||
);
|
||||
};
|
||||
|
||||
const renderChQueryUI = (): JSX.Element => {
|
||||
return <ChQuerySection chQueries={chQueries} setChQueries={setChQueries} />;
|
||||
};
|
||||
const renderChQueryUI = (): JSX.Element => (
|
||||
<ChQuerySection chQueries={chQueries} setChQueries={setChQueries} />
|
||||
);
|
||||
|
||||
const renderFormulaButton = (): JSX.Element => {
|
||||
return (
|
||||
const renderFormulaButton = (): JSX.Element => (
|
||||
<QueryButton onClick={addFormula} icon={<PlusOutlined />}>
|
||||
{t('button_formula')}
|
||||
</QueryButton>
|
||||
);
|
||||
};
|
||||
|
||||
const renderQueryButton = (): JSX.Element => {
|
||||
return (
|
||||
const renderQueryButton = (): JSX.Element => (
|
||||
<QueryButton onClick={addMetricQuery} icon={<PlusOutlined />}>
|
||||
{t('button_query')}
|
||||
</QueryButton>
|
||||
);
|
||||
};
|
||||
|
||||
const renderMetricUI = (): JSX.Element => {
|
||||
return (
|
||||
const renderMetricUI = (): JSX.Element => (
|
||||
<div>
|
||||
{metricQueries &&
|
||||
Object.keys(metricQueries).map((key: string) => {
|
||||
@ -282,7 +275,6 @@ function QuerySection({
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const handleRunQuery = (): void => {
|
||||
runQuery();
|
||||
|
@ -38,8 +38,7 @@ function RuleOptions({
|
||||
});
|
||||
};
|
||||
|
||||
const renderCompareOps = (): JSX.Element => {
|
||||
return (
|
||||
const renderCompareOps = (): JSX.Element => (
|
||||
<InlineSelect
|
||||
defaultValue={defaultCompareOp}
|
||||
value={alertDef.condition?.op}
|
||||
@ -62,10 +61,8 @@ function RuleOptions({
|
||||
<Option value="4">{t('option_notequal')}</Option>
|
||||
</InlineSelect>
|
||||
);
|
||||
};
|
||||
|
||||
const renderThresholdMatchOpts = (): JSX.Element => {
|
||||
return (
|
||||
const renderThresholdMatchOpts = (): JSX.Element => (
|
||||
<InlineSelect
|
||||
defaultValue={defaultMatchType}
|
||||
style={{ minWidth: '130px' }}
|
||||
@ -78,10 +75,8 @@ function RuleOptions({
|
||||
<Option value="4">{t('option_intotal')}</Option>
|
||||
</InlineSelect>
|
||||
);
|
||||
};
|
||||
|
||||
const renderPromMatchOpts = (): JSX.Element => {
|
||||
return (
|
||||
const renderPromMatchOpts = (): JSX.Element => (
|
||||
<InlineSelect
|
||||
defaultValue={defaultMatchType}
|
||||
style={{ minWidth: '130px' }}
|
||||
@ -91,10 +86,8 @@ function RuleOptions({
|
||||
<Option value="1">{t('option_atleastonce')}</Option>
|
||||
</InlineSelect>
|
||||
);
|
||||
};
|
||||
|
||||
const renderEvalWindows = (): JSX.Element => {
|
||||
return (
|
||||
const renderEvalWindows = (): JSX.Element => (
|
||||
<InlineSelect
|
||||
defaultValue={defaultEvalWindow}
|
||||
style={{ minWidth: '120px' }}
|
||||
@ -116,10 +109,8 @@ function RuleOptions({
|
||||
<Option value="24h0m0s">{t('option_24hours')}</Option>
|
||||
</InlineSelect>
|
||||
);
|
||||
};
|
||||
|
||||
const renderThresholdRuleOpts = (): JSX.Element => {
|
||||
return (
|
||||
const renderThresholdRuleOpts = (): JSX.Element => (
|
||||
<FormItem>
|
||||
<Typography.Text>
|
||||
{t('text_condition1')} {renderCompareOps()} {t('text_condition2')}{' '}
|
||||
@ -127,9 +118,7 @@ function RuleOptions({
|
||||
</Typography.Text>
|
||||
</FormItem>
|
||||
);
|
||||
};
|
||||
const renderPromRuleOptions = (): JSX.Element => {
|
||||
return (
|
||||
const renderPromRuleOptions = (): JSX.Element => (
|
||||
<FormItem>
|
||||
<Typography.Text>
|
||||
{t('text_condition1')} {renderCompareOps()} {t('text_condition2')}{' '}
|
||||
@ -137,7 +126,6 @@ function RuleOptions({
|
||||
</Typography.Text>
|
||||
</FormItem>
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
|
@ -15,8 +15,7 @@ function UserGuide({ queryType }: UserGuideProps): JSX.Element {
|
||||
// init namespace for translations
|
||||
const { t } = useTranslation('alerts');
|
||||
|
||||
const renderStep1QB = (): JSX.Element => {
|
||||
return (
|
||||
const renderStep1QB = (): JSX.Element => (
|
||||
<>
|
||||
<StyledTopic>{t('user_guide_qb_step1')}</StyledTopic>
|
||||
<StyledList>
|
||||
@ -27,9 +26,7 @@ function UserGuide({ queryType }: UserGuideProps): JSX.Element {
|
||||
</StyledList>
|
||||
</>
|
||||
);
|
||||
};
|
||||
const renderStep2QB = (): JSX.Element => {
|
||||
return (
|
||||
const renderStep2QB = (): JSX.Element => (
|
||||
<>
|
||||
<StyledTopic>{t('user_guide_qb_step2')}</StyledTopic>
|
||||
<StyledList>
|
||||
@ -38,10 +35,8 @@ function UserGuide({ queryType }: UserGuideProps): JSX.Element {
|
||||
</StyledList>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
const renderStep3QB = (): JSX.Element => {
|
||||
return (
|
||||
const renderStep3QB = (): JSX.Element => (
|
||||
<>
|
||||
<StyledTopic>{t('user_guide_qb_step3')}</StyledTopic>
|
||||
<StyledList>
|
||||
@ -50,19 +45,15 @@ function UserGuide({ queryType }: UserGuideProps): JSX.Element {
|
||||
</StyledList>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
const renderGuideForQB = (): JSX.Element => {
|
||||
return (
|
||||
const renderGuideForQB = (): JSX.Element => (
|
||||
<>
|
||||
{renderStep1QB()}
|
||||
{renderStep2QB()}
|
||||
{renderStep3QB()}
|
||||
</>
|
||||
);
|
||||
};
|
||||
const renderStep1PQL = (): JSX.Element => {
|
||||
return (
|
||||
const renderStep1PQL = (): JSX.Element => (
|
||||
<>
|
||||
<StyledTopic>{t('user_guide_pql_step1')}</StyledTopic>
|
||||
<StyledList>
|
||||
@ -71,9 +62,7 @@ function UserGuide({ queryType }: UserGuideProps): JSX.Element {
|
||||
</StyledList>
|
||||
</>
|
||||
);
|
||||
};
|
||||
const renderStep2PQL = (): JSX.Element => {
|
||||
return (
|
||||
const renderStep2PQL = (): JSX.Element => (
|
||||
<>
|
||||
<StyledTopic>{t('user_guide_pql_step2')}</StyledTopic>
|
||||
<StyledList>
|
||||
@ -82,10 +71,8 @@ function UserGuide({ queryType }: UserGuideProps): JSX.Element {
|
||||
</StyledList>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
const renderStep3PQL = (): JSX.Element => {
|
||||
return (
|
||||
const renderStep3PQL = (): JSX.Element => (
|
||||
<>
|
||||
<StyledTopic>{t('user_guide_pql_step3')}</StyledTopic>
|
||||
<StyledList>
|
||||
@ -94,20 +81,16 @@ function UserGuide({ queryType }: UserGuideProps): JSX.Element {
|
||||
</StyledList>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
const renderGuideForPQL = (): JSX.Element => {
|
||||
return (
|
||||
const renderGuideForPQL = (): JSX.Element => (
|
||||
<>
|
||||
{renderStep1PQL()}
|
||||
{renderStep2PQL()}
|
||||
{renderStep3PQL()}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
const renderStep1CH = (): JSX.Element => {
|
||||
return (
|
||||
const renderStep1CH = (): JSX.Element => (
|
||||
<>
|
||||
<StyledTopic>{t('user_guide_ch_step1')}</StyledTopic>
|
||||
<StyledList>
|
||||
@ -129,9 +112,7 @@ function UserGuide({ queryType }: UserGuideProps): JSX.Element {
|
||||
</StyledList>
|
||||
</>
|
||||
);
|
||||
};
|
||||
const renderStep2CH = (): JSX.Element => {
|
||||
return (
|
||||
const renderStep2CH = (): JSX.Element => (
|
||||
<>
|
||||
<StyledTopic>{t('user_guide_ch_step2')}</StyledTopic>
|
||||
<StyledList>
|
||||
@ -140,10 +121,8 @@ function UserGuide({ queryType }: UserGuideProps): JSX.Element {
|
||||
</StyledList>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
const renderStep3CH = (): JSX.Element => {
|
||||
return (
|
||||
const renderStep3CH = (): JSX.Element => (
|
||||
<>
|
||||
<StyledTopic>{t('user_guide_ch_step3')}</StyledTopic>
|
||||
<StyledList>
|
||||
@ -152,17 +131,14 @@ function UserGuide({ queryType }: UserGuideProps): JSX.Element {
|
||||
</StyledList>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
const renderGuideForCH = (): JSX.Element => {
|
||||
return (
|
||||
const renderGuideForCH = (): JSX.Element => (
|
||||
<>
|
||||
{renderStep1CH()}
|
||||
{renderStep2CH()}
|
||||
{renderStep3CH()}
|
||||
</>
|
||||
);
|
||||
};
|
||||
return (
|
||||
<StyledMainContainer>
|
||||
<Row>
|
||||
|
@ -436,8 +436,7 @@ function FormAlertRules({
|
||||
<BasicInfo alertDef={alertDef} setAlertDef={setAlertDef} />
|
||||
);
|
||||
|
||||
const renderQBChartPreview = (): JSX.Element => {
|
||||
return (
|
||||
const renderQBChartPreview = (): JSX.Element => (
|
||||
<ChartPreview
|
||||
headline={<PlotTag queryType={queryCategory} />}
|
||||
name=""
|
||||
@ -446,10 +445,8 @@ function FormAlertRules({
|
||||
selectedInterval={toChartInterval(alertDef.evalWindow)}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
const renderPromChartPreview = (): JSX.Element => {
|
||||
return (
|
||||
const renderPromChartPreview = (): JSX.Element => (
|
||||
<ChartPreview
|
||||
headline={<PlotTag queryType={queryCategory} />}
|
||||
name="Chart Preview"
|
||||
@ -457,10 +454,8 @@ function FormAlertRules({
|
||||
query={debouncedStagedQuery}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
const renderChQueryChartPreview = (): JSX.Element => {
|
||||
return (
|
||||
const renderChQueryChartPreview = (): JSX.Element => (
|
||||
<ChartPreview
|
||||
headline={<PlotTag queryType={queryCategory} />}
|
||||
name="Chart Preview"
|
||||
@ -470,7 +465,6 @@ function FormAlertRules({
|
||||
selectedInterval={toChartInterval(alertDef.evalWindow)}
|
||||
/>
|
||||
);
|
||||
};
|
||||
return (
|
||||
<>
|
||||
{Element}
|
||||
|
@ -119,17 +119,15 @@ function LabelSelect({
|
||||
{queries.length > 0 &&
|
||||
map(
|
||||
queries,
|
||||
(query): JSX.Element => {
|
||||
return (
|
||||
(query): JSX.Element => (
|
||||
<QueryChip key={query.key} queryData={query} onRemove={handleClose} />
|
||||
);
|
||||
},
|
||||
),
|
||||
)}
|
||||
</div>
|
||||
<div>
|
||||
{map(staging, (item) => {
|
||||
return <QueryChipItem key={uuid()}>{item}</QueryChipItem>;
|
||||
})}
|
||||
{map(staging, (item) => (
|
||||
<QueryChipItem key={uuid()}>{item}</QueryChipItem>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div style={{ display: 'flex', width: '100%' }}>
|
||||
|
@ -42,8 +42,7 @@ export const toMetricQueries = (b: IBuilderQueries): IMetricQueries => {
|
||||
|
||||
export const toIMetricsBuilderQuery = (
|
||||
q: IMetricQuery,
|
||||
): IMetricsBuilderQuery => {
|
||||
return {
|
||||
): IMetricsBuilderQuery => ({
|
||||
name: q.name,
|
||||
metricName: q.metricName,
|
||||
tagFilters: q.tagFilters,
|
||||
@ -51,8 +50,7 @@ export const toIMetricsBuilderQuery = (
|
||||
aggregateOperator: q.aggregateOperator,
|
||||
disabled: q.disabled,
|
||||
legend: q.legend,
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
export const prepareBuilderQueries = (
|
||||
m: IMetricQueries,
|
||||
|
@ -112,8 +112,7 @@ export const getNodeById = (
|
||||
|
||||
const getSpanWithoutChildren = (
|
||||
span: ITraceTree,
|
||||
): Omit<ITraceTree, 'children'> => {
|
||||
return {
|
||||
): Omit<ITraceTree, 'children'> => ({
|
||||
id: span.id,
|
||||
name: span.name,
|
||||
parent: span.parent,
|
||||
@ -125,8 +124,7 @@ const getSpanWithoutChildren = (
|
||||
value: span.value,
|
||||
event: span.event,
|
||||
hasError: span.hasError,
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
export const isSpanPresentInSearchString = (
|
||||
searchedString: string,
|
||||
|
@ -81,11 +81,10 @@ function FullView({
|
||||
const queryLength = widget.query.filter((e) => e.query.length !== 0);
|
||||
|
||||
const response = useQueries(
|
||||
queryLength.map((query) => {
|
||||
return {
|
||||
queryLength.map((query) => ({
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
||||
queryFn: () => {
|
||||
return getQueryResult({
|
||||
queryFn: () =>
|
||||
getQueryResult({
|
||||
end: queryMinMax.max.toString(),
|
||||
query: query.query,
|
||||
start: queryMinMax.min.toString(),
|
||||
@ -94,12 +93,10 @@ function FullView({
|
||||
end: queryMinMax.max,
|
||||
inputFormat: 's',
|
||||
})}`,
|
||||
});
|
||||
},
|
||||
}),
|
||||
queryHash: `${query.query}-${query.legend}-${selectedTime.enum}`,
|
||||
retryOnMount: false,
|
||||
};
|
||||
}),
|
||||
})),
|
||||
);
|
||||
|
||||
const isError =
|
||||
|
@ -101,8 +101,7 @@ function GridCardGraph({
|
||||
onToggleModal(setDeleteModal);
|
||||
}, [deleteWidget, layout, onToggleModal, setLayout, widget]);
|
||||
|
||||
const getModals = (): JSX.Element => {
|
||||
return (
|
||||
const getModals = (): JSX.Element => (
|
||||
<>
|
||||
<Modal
|
||||
destroyOnClose
|
||||
@ -126,16 +125,11 @@ function GridCardGraph({
|
||||
destroyOnClose
|
||||
>
|
||||
<FullViewContainer>
|
||||
<FullView
|
||||
name={`${name}expanded`}
|
||||
widget={widget}
|
||||
yAxisUnit={yAxisUnit}
|
||||
/>
|
||||
<FullView name={`${name}expanded`} widget={widget} yAxisUnit={yAxisUnit} />
|
||||
</FullViewContainer>
|
||||
</Modal>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
const handleOnView = (): void => {
|
||||
onToggleModal(setModal);
|
||||
|
@ -110,13 +110,11 @@ function ListAlert({ allAlertRules, refetch }: ListAlertProps): JSX.Element {
|
||||
|
||||
return (
|
||||
<>
|
||||
{withOutSeverityKeys.map((e) => {
|
||||
return (
|
||||
{withOutSeverityKeys.map((e) => (
|
||||
<StyledTag key={e} color="magenta">
|
||||
{e}: {value[e]}
|
||||
</StyledTag>
|
||||
);
|
||||
})}
|
||||
))}
|
||||
</>
|
||||
);
|
||||
},
|
||||
@ -128,8 +126,7 @@ function ListAlert({ allAlertRules, refetch }: ListAlertProps): JSX.Element {
|
||||
title: 'Action',
|
||||
dataIndex: 'id',
|
||||
key: 'action',
|
||||
render: (id: GettableAlert['id'], record): JSX.Element => {
|
||||
return (
|
||||
render: (id: GettableAlert['id'], record): JSX.Element => (
|
||||
<>
|
||||
<ToggleAlertState disabled={record.disabled} setData={setData} id={id} />
|
||||
|
||||
@ -142,8 +139,7 @@ function ListAlert({ allAlertRules, refetch }: ListAlertProps): JSX.Element {
|
||||
|
||||
<DeleteAlert notifications={notifications} setData={setData} id={id} />
|
||||
</>
|
||||
);
|
||||
},
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -40,8 +40,8 @@ function ToggleAlertState({
|
||||
});
|
||||
|
||||
if (response.statusCode === 200) {
|
||||
setData((state) => {
|
||||
return state.map((alert) => {
|
||||
setData((state) =>
|
||||
state.map((alert) => {
|
||||
if (alert.id === id) {
|
||||
return {
|
||||
...alert,
|
||||
@ -50,8 +50,8 @@ function ToggleAlertState({
|
||||
};
|
||||
}
|
||||
return alert;
|
||||
});
|
||||
});
|
||||
}),
|
||||
);
|
||||
|
||||
setAPIStatus((state) => ({
|
||||
...state,
|
||||
|
@ -184,16 +184,14 @@ function SearchFilter({
|
||||
{optionsData.options &&
|
||||
Array.isArray(optionsData.options) &&
|
||||
optionsData.options.map(
|
||||
(optionItem): JSX.Element => {
|
||||
return (
|
||||
(optionItem): JSX.Element => (
|
||||
<Select.Option
|
||||
key={(optionItem.value as string) || (optionItem.name as string)}
|
||||
value={optionItem.value || optionItem.name}
|
||||
>
|
||||
{optionItem.name}
|
||||
</Select.Option>
|
||||
);
|
||||
},
|
||||
),
|
||||
)}
|
||||
</Select>
|
||||
)}
|
||||
|
@ -19,9 +19,7 @@ export const convertQueriesToURLQuery = (
|
||||
|
||||
export const convertURLQueryStringToQuery = (
|
||||
queryString: string,
|
||||
): IQueryStructure[] => {
|
||||
return JSON.parse(decode(queryString));
|
||||
};
|
||||
): IQueryStructure[] => JSON.parse(decode(queryString));
|
||||
|
||||
export const resolveOperator = (
|
||||
result: unknown,
|
||||
|
@ -30,13 +30,11 @@ function TableView({ logData }: TableViewProps): JSX.Element | null {
|
||||
flattenLogData !== null &&
|
||||
Object.keys(flattenLogData)
|
||||
.filter((field) => fieldSearchFilter(field, fieldSearchInput))
|
||||
.map((key) => {
|
||||
return {
|
||||
.map((key) => ({
|
||||
key,
|
||||
field: key,
|
||||
value: JSON.stringify(flattenLogData[key]),
|
||||
};
|
||||
});
|
||||
}));
|
||||
|
||||
if (!dataSource) {
|
||||
return null;
|
||||
|
@ -157,8 +157,7 @@ function Login({
|
||||
}
|
||||
};
|
||||
|
||||
const renderSAMLAction = (): JSX.Element => {
|
||||
return (
|
||||
const renderSAMLAction = (): JSX.Element => (
|
||||
<Button
|
||||
type="primary"
|
||||
loading={isLoading}
|
||||
@ -168,7 +167,6 @@ function Login({
|
||||
{t('login_with_sso')}
|
||||
</Button>
|
||||
);
|
||||
};
|
||||
|
||||
const renderOnSsoError = (): JSX.Element | null => {
|
||||
if (!ssoerror) {
|
||||
|
@ -77,8 +77,8 @@ function LogsAggregate({ getLogsAggregate }: LogsAggregateProps): JSX.Element {
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [getLogsAggregate, maxTime, minTime, liveTail]);
|
||||
|
||||
const graphData = useMemo(() => {
|
||||
return {
|
||||
const graphData = useMemo(
|
||||
() => ({
|
||||
labels: logsAggregate.map((s) => new Date(s.timestamp / 1000000)),
|
||||
datasets: [
|
||||
{
|
||||
@ -86,8 +86,9 @@ function LogsAggregate({ getLogsAggregate }: LogsAggregateProps): JSX.Element {
|
||||
backgroundColor: blue[4],
|
||||
},
|
||||
],
|
||||
};
|
||||
}, [logsAggregate]);
|
||||
}),
|
||||
[logsAggregate],
|
||||
);
|
||||
|
||||
return (
|
||||
<Container>
|
||||
|
@ -25,9 +25,7 @@ export const Field = styled.div<{ isDarkMode: boolean }>`
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
&:hover {
|
||||
background: ${({ isDarkMode }): string => {
|
||||
return isDarkMode ? grey[7] : '#ddd';
|
||||
}};
|
||||
background: ${({ isDarkMode }): string => (isDarkMode ? grey[7] : '#ddd')};
|
||||
}
|
||||
`;
|
||||
|
||||
|
@ -44,8 +44,7 @@ export const getQueryBuilderQuerieswithFormula = ({
|
||||
}: BuilderQuerieswithFormulaProps): {
|
||||
formulas: IMetricsBuilderFormula[];
|
||||
queryBuilder: IMetricsBuilderQuery[];
|
||||
} => {
|
||||
return {
|
||||
} => ({
|
||||
formulas: [
|
||||
{
|
||||
disabled: false,
|
||||
@ -82,8 +81,7 @@ export const getQueryBuilderQuerieswithFormula = ({
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
interface BuilderQueriesProps {
|
||||
metricName: string;
|
||||
|
@ -164,24 +164,20 @@ function ResourceAttributesFilter(): JSX.Element | null {
|
||||
>
|
||||
{map(
|
||||
queries,
|
||||
(query): JSX.Element => {
|
||||
return (
|
||||
(query): JSX.Element => (
|
||||
<QueryChip
|
||||
disabled={disabled}
|
||||
key={query.id}
|
||||
queryData={query}
|
||||
onClose={handleClose}
|
||||
/>
|
||||
);
|
||||
},
|
||||
),
|
||||
)}
|
||||
{map(staging, (item, idx) => {
|
||||
return (
|
||||
{map(staging, (item, idx) => (
|
||||
<QueryChipItem key={uuid()}>
|
||||
{idx === 0 ? convertMetricKeyToTrace(item) : item}
|
||||
</QueryChipItem>
|
||||
);
|
||||
})}
|
||||
))}
|
||||
</div>
|
||||
{!disabled && (
|
||||
<Select
|
||||
|
@ -213,11 +213,10 @@ function Application({ getWidgetQueryBuilder }: DashboardProps): JSX.Element {
|
||||
pointRadius: 1.5,
|
||||
},
|
||||
],
|
||||
labels: serviceOverview.map((e) => {
|
||||
return new Date(
|
||||
parseFloat(convertToNanoSecondsToSecond(e.timestamp)),
|
||||
);
|
||||
}),
|
||||
labels: serviceOverview.map(
|
||||
(e) =>
|
||||
new Date(parseFloat(convertToNanoSecondsToSecond(e.timestamp))),
|
||||
),
|
||||
}}
|
||||
yAxisUnit="ms"
|
||||
onDragSelect={onDragSelect}
|
||||
|
@ -93,9 +93,7 @@ function TopOperationsTable(props: TopOperationsTableProps): JSX.Element {
|
||||
return (
|
||||
<Table
|
||||
showHeader
|
||||
title={(): string => {
|
||||
return 'Key Operations';
|
||||
}}
|
||||
title={(): string => 'Key Operations'}
|
||||
tableLayout="fixed"
|
||||
dataSource={data}
|
||||
columns={columns}
|
||||
|
@ -96,9 +96,7 @@ function VariablesSetting({
|
||||
setDeleteVariableModal(false);
|
||||
};
|
||||
|
||||
const validateVariableName = (name: string): boolean => {
|
||||
return !variables[name];
|
||||
};
|
||||
const validateVariableName = (name: string): boolean => !variables[name];
|
||||
|
||||
const columns = [
|
||||
{
|
||||
|
@ -118,9 +118,9 @@ function VariableItem({
|
||||
{variableData.multiSelect && variableData.showALLOption && (
|
||||
<Option value={ALL_SELECT_VALUE}>ALL</Option>
|
||||
)}
|
||||
{map(optionsData, (option) => {
|
||||
return <Option value={option}>{(option as string).toString()}</Option>;
|
||||
})}
|
||||
{map(optionsData, (option) => (
|
||||
<Option value={option}>{(option as string).toString()}</Option>
|
||||
))}
|
||||
</Select>
|
||||
)}
|
||||
{errorMessage && (
|
||||
|
@ -2,12 +2,10 @@ import { EAggregateOperator } from 'types/common/dashboard';
|
||||
|
||||
export const AggregateFunctions = Object.keys(EAggregateOperator)
|
||||
.filter((key) => Number.isNaN(parseInt(key, 10)))
|
||||
.map((key) => {
|
||||
return {
|
||||
.map((key) => ({
|
||||
label: key,
|
||||
value: EAggregateOperator[key as keyof typeof EAggregateOperator],
|
||||
};
|
||||
});
|
||||
}));
|
||||
|
||||
export const TagKeyOperator = [
|
||||
{ label: 'In', value: 'IN' },
|
||||
|
@ -154,17 +154,15 @@ function MetricTagKeyFilter({
|
||||
{queries.length > 0 &&
|
||||
map(
|
||||
queries,
|
||||
(query): JSX.Element => {
|
||||
return (
|
||||
(query): JSX.Element => (
|
||||
<QueryChip key={query.id} queryData={query} onClose={handleClose} />
|
||||
);
|
||||
},
|
||||
),
|
||||
)}
|
||||
</div>
|
||||
<div>
|
||||
{map(staging, (item) => {
|
||||
return <QueryChipItem key={uuid()}>{item}</QueryChipItem>;
|
||||
})}
|
||||
{map(staging, (item) => (
|
||||
<QueryChipItem key={uuid()}>{item}</QueryChipItem>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div style={{ display: 'flex', width: '100%' }}>
|
||||
|
@ -4,8 +4,7 @@ import { EQueryTypeToQueryKeyMapping } from '../types';
|
||||
|
||||
export const getQueryKey = (
|
||||
queryCategory: EQueryType,
|
||||
): EQueryTypeToQueryKeyMapping => {
|
||||
return EQueryTypeToQueryKeyMapping[
|
||||
): EQueryTypeToQueryKeyMapping =>
|
||||
EQueryTypeToQueryKeyMapping[
|
||||
EQueryType[queryCategory] as keyof typeof EQueryTypeToQueryKeyMapping
|
||||
];
|
||||
};
|
||||
|
@ -383,7 +383,5 @@ export const dataTypeCategories = [
|
||||
];
|
||||
|
||||
export const flattenedCategories = flattenDeep(
|
||||
dataTypeCategories.map((category) => {
|
||||
return category.formats;
|
||||
}),
|
||||
dataTypeCategories.map((category) => category.formats),
|
||||
);
|
||||
|
@ -30,9 +30,8 @@ export const TextContainer = styled.div<TextContainerProps>`
|
||||
margin-bottom: 1rem;
|
||||
|
||||
> button {
|
||||
margin-left: ${({ noButtonMargin }): string => {
|
||||
return noButtonMargin ? '0' : '0.5rem';
|
||||
}}
|
||||
margin-left: ${({ noButtonMargin }): string =>
|
||||
noButtonMargin ? '0' : '0.5rem'}
|
||||
`;
|
||||
|
||||
export const NullButtonContainer = styled.div`
|
||||
|
@ -57,9 +57,7 @@ function NewWidget({
|
||||
|
||||
const { search } = useLocation();
|
||||
|
||||
const query = useMemo(() => {
|
||||
return new URLSearchParams(search);
|
||||
}, [search]);
|
||||
const query = useMemo(() => new URLSearchParams(search), [search]);
|
||||
|
||||
const { dashboardId } = useParams<DashboardWidgetPageParams>();
|
||||
|
||||
|
@ -231,8 +231,7 @@ function AuthDomains(): JSX.Element {
|
||||
title: 'Action',
|
||||
dataIndex: 'action',
|
||||
key: 'action',
|
||||
render: (_, record): JSX.Element => {
|
||||
return (
|
||||
render: (_, record): JSX.Element => (
|
||||
<Button
|
||||
disabled={!SSOFlag}
|
||||
onClick={onDeleteHandler(record)}
|
||||
@ -241,8 +240,7 @@ function AuthDomains(): JSX.Element {
|
||||
>
|
||||
Delete
|
||||
</Button>
|
||||
);
|
||||
},
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
|
@ -26,9 +26,8 @@ function EditMembersDetails({
|
||||
const [isLoading, setIsLoading] = useState<boolean>(false);
|
||||
const [state, copyToClipboard] = useCopyToClipboard();
|
||||
|
||||
const getPasswordLink = (token: string): string => {
|
||||
return `${window.location.origin}${ROUTES.PASSWORD_RESET}?token=${token}`;
|
||||
};
|
||||
const getPasswordLink = (token: string): string =>
|
||||
`${window.location.origin}${ROUTES.PASSWORD_RESET}?token=${token}`;
|
||||
|
||||
const onChangeHandler = useCallback(
|
||||
(setFunc: React.Dispatch<React.SetStateAction<string>>, value: string) => {
|
||||
|
@ -11,8 +11,8 @@ const { Option } = Select;
|
||||
function InviteTeamMembers({ allMembers, setAllMembers }: Props): JSX.Element {
|
||||
const { t } = useTranslation('organizationsettings');
|
||||
|
||||
useEffect(() => {
|
||||
return (): void => {
|
||||
useEffect(
|
||||
() => (): void => {
|
||||
setAllMembers([
|
||||
{
|
||||
email: '',
|
||||
@ -20,8 +20,9 @@ function InviteTeamMembers({ allMembers, setAllMembers }: Props): JSX.Element {
|
||||
role: 'VIEWER',
|
||||
},
|
||||
]);
|
||||
};
|
||||
}, [setAllMembers]);
|
||||
},
|
||||
[setAllMembers],
|
||||
);
|
||||
|
||||
const onAddHandler = (): void => {
|
||||
setAllMembers((state) => [
|
||||
@ -36,16 +37,14 @@ function InviteTeamMembers({ allMembers, setAllMembers }: Props): JSX.Element {
|
||||
|
||||
const onChangeHandler = useCallback(
|
||||
(value: string, index: number, type: string): void => {
|
||||
setAllMembers((prev) => {
|
||||
return [
|
||||
setAllMembers((prev) => [
|
||||
...prev.slice(0, index),
|
||||
{
|
||||
...prev[index],
|
||||
[type]: value,
|
||||
},
|
||||
...prev.slice(index, prev.length - 1),
|
||||
];
|
||||
});
|
||||
]);
|
||||
},
|
||||
[setAllMembers],
|
||||
);
|
||||
|
@ -63,15 +63,17 @@ function PendingInvitesContainer(): JSX.Element {
|
||||
|
||||
const { hash } = useLocation();
|
||||
|
||||
const getParsedInviteData = useCallback((payload: PayloadProps = []) => {
|
||||
return payload?.map((data) => ({
|
||||
const getParsedInviteData = useCallback(
|
||||
(payload: PayloadProps = []) =>
|
||||
payload?.map((data) => ({
|
||||
key: data.createdAt,
|
||||
name: data.name,
|
||||
email: data.email,
|
||||
accessLevel: data.role,
|
||||
inviteLink: `${window.location.origin}${ROUTES.SIGN_UP}?token=${data.token}`,
|
||||
}));
|
||||
}, []);
|
||||
})),
|
||||
[],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (hash === INVITE_MEMBERS_HASH) {
|
||||
|
@ -20,11 +20,13 @@ function TraceGraph(): JSX.Element {
|
||||
|
||||
const { loading, error, errorMessage, payload } = spansGraph;
|
||||
|
||||
const ChartData = useMemo(() => {
|
||||
return selectedGroupBy.length === 0
|
||||
const ChartData = useMemo(
|
||||
() =>
|
||||
selectedGroupBy.length === 0
|
||||
? getChartData(payload)
|
||||
: getChartDataforGroupBy(payload);
|
||||
}, [payload, selectedGroupBy]);
|
||||
: getChartDataforGroupBy(payload),
|
||||
[payload, selectedGroupBy],
|
||||
);
|
||||
|
||||
if (error) {
|
||||
return (
|
||||
|
@ -77,9 +77,9 @@ export const parseTagsToQuery = (tags: Tags): PayloadProps<string> => {
|
||||
isError = true;
|
||||
}
|
||||
|
||||
return `${Key[0]} ${Operator} (${Values.map((e) => {
|
||||
return `"${e.replaceAll(/"/g, '')}"`;
|
||||
}).join(',')})`;
|
||||
return `${Key[0]} ${Operator} (${Values.map(
|
||||
(e) => `"${e.replaceAll(/"/g, '')}"`,
|
||||
).join(',')})`;
|
||||
})
|
||||
.join(' AND ');
|
||||
|
||||
|
@ -48,17 +48,16 @@ function TraceTable(): JSX.Element {
|
||||
|
||||
type TableType = FlatArray<TraceReducer['spansAggregate']['data'], 1>;
|
||||
|
||||
const getLink = (record: TableType): string => {
|
||||
return `${ROUTES.TRACE}/${record.traceID}${formUrlParams({
|
||||
const getLink = (record: TableType): string =>
|
||||
`${ROUTES.TRACE}/${record.traceID}${formUrlParams({
|
||||
spanId: record.spanID,
|
||||
levelUp: 0,
|
||||
levelDown: 0,
|
||||
})}`;
|
||||
};
|
||||
|
||||
const getValue = (value: string): JSX.Element => {
|
||||
return <Typography>{value}</Typography>;
|
||||
};
|
||||
const getValue = (value: string): JSX.Element => (
|
||||
<Typography>{value}</Typography>
|
||||
);
|
||||
|
||||
const getHttpMethodOrStatus = (
|
||||
value: TableType['statusCode'],
|
||||
|
@ -100,6 +100,11 @@ function TraceDetail({ response }: TraceDetailProps): JSX.Element {
|
||||
[activeSelectedId, treesData],
|
||||
);
|
||||
|
||||
// const onSearchHandler = (value: string) => {
|
||||
// setSearchSpanString(value);
|
||||
// setTreeData(spanToTreeUtil(response[0].events));
|
||||
// };
|
||||
|
||||
const onFocusSelectedSpanHandler = (): void => {
|
||||
const treeNode = getNodeById(activeSelectedId, tree);
|
||||
|
||||
|
@ -49,9 +49,7 @@ export const INTERVAL_UNITS: IIntervalUnit[] = [
|
||||
export const resolveTimeFromInterval = (
|
||||
intervalTime: number,
|
||||
intervalUnit: IIntervalUnit,
|
||||
): number => {
|
||||
return intervalTime * intervalUnit.multiplier;
|
||||
};
|
||||
): number => intervalTime * intervalUnit.multiplier;
|
||||
|
||||
export const convertTimeToRelevantUnit = (
|
||||
intervalTime: number,
|
||||
|
@ -52,9 +52,9 @@ function NoFilterTable({
|
||||
|
||||
return (
|
||||
<>
|
||||
{withOutSeverityKeys.map((e) => {
|
||||
return <Tag key={e} color="magenta">{`${e} : ${labels[e]}`}</Tag>;
|
||||
})}
|
||||
{withOutSeverityKeys.map((e) => (
|
||||
<Tag key={e} color="magenta">{`${e} : ${labels[e]}`}</Tag>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
},
|
||||
|
@ -7,9 +7,8 @@ const useComponentPermission = (
|
||||
role: ROLES | null,
|
||||
): boolean[] => {
|
||||
const getComponentPermission = useCallback(
|
||||
(component: ComponentTypes): boolean => {
|
||||
return !!componentPermission[component].find((roles) => role === roles);
|
||||
},
|
||||
(component: ComponentTypes): boolean =>
|
||||
!!componentPermission[component].find((roles) => role === roles),
|
||||
[role],
|
||||
);
|
||||
|
||||
|
@ -1,10 +1,9 @@
|
||||
const convertDateToAmAndPm = (date: Date): string => {
|
||||
return date.toLocaleString('en-US', {
|
||||
const convertDateToAmAndPm = (date: Date): string =>
|
||||
date.toLocaleString('en-US', {
|
||||
hour: '2-digit',
|
||||
minute: 'numeric',
|
||||
second: 'numeric',
|
||||
hour12: true,
|
||||
});
|
||||
};
|
||||
|
||||
export default convertDateToAmAndPm;
|
||||
|
@ -1,5 +1,4 @@
|
||||
const convertToNanoSecondsToSecond = (number: number): string => {
|
||||
return parseFloat((number / 1000000).toString()).toFixed(2);
|
||||
};
|
||||
const convertToNanoSecondsToSecond = (number: number): string =>
|
||||
parseFloat((number / 1000000).toString()).toFixed(2);
|
||||
|
||||
export default convertToNanoSecondsToSecond;
|
||||
|
@ -1,5 +1,4 @@
|
||||
const convertIntoEpoc = (number: number): string => {
|
||||
return number.toString().split('.').join('').toString();
|
||||
};
|
||||
const convertIntoEpoc = (number: number): string =>
|
||||
number.toString().split('.').join('').toString();
|
||||
|
||||
export default convertIntoEpoc;
|
||||
|
@ -17,8 +17,8 @@ const getChartData = ({ queryData }: GetChartDataProps): ChartData => {
|
||||
const labels = Array.from(uniqueTimeLabels).sort((a, b) => a - b);
|
||||
|
||||
const response = queryData.map(
|
||||
({ queryData, query: queryG, legend: legendG }) => {
|
||||
return queryData.map((e) => {
|
||||
({ queryData, query: queryG, legend: legendG }) =>
|
||||
queryData.map((e) => {
|
||||
const { values = [], metric, legend, queryName } = e || {};
|
||||
const labelNames = getLabelName(
|
||||
metric,
|
||||
@ -35,9 +35,7 @@ const getChartData = ({ queryData }: GetChartDataProps): ChartData => {
|
||||
// Fill the missing data with null
|
||||
const filledDataValues = Array.from(labels).map((e) => {
|
||||
const td1 = new Date(parseInt(convertIntoEpoc(e * 1000), 10));
|
||||
const data = dataValue.find((e1) => {
|
||||
return e1.first.getTime() === td1.getTime();
|
||||
});
|
||||
const data = dataValue.find((e1) => e1.first.getTime() === td1.getTime());
|
||||
return (
|
||||
data || {
|
||||
first: new Date(parseInt(convertIntoEpoc(e * 1000), 10)),
|
||||
@ -51,8 +49,7 @@ const getChartData = ({ queryData }: GetChartDataProps): ChartData => {
|
||||
first: filledDataValues.map((e) => e.first),
|
||||
second: filledDataValues.map((e) => e.second),
|
||||
};
|
||||
});
|
||||
},
|
||||
}),
|
||||
);
|
||||
const allLabels = response
|
||||
.map((e) => e.map((e) => e.label))
|
||||
@ -63,8 +60,7 @@ const getChartData = ({ queryData }: GetChartDataProps): ChartData => {
|
||||
.reduce((a, b) => [...a, ...b], []);
|
||||
|
||||
return {
|
||||
datasets: alldata.map((e, index) => {
|
||||
return {
|
||||
datasets: alldata.map((e, index) => ({
|
||||
data: e,
|
||||
label: allLabels[index],
|
||||
borderWidth: 1.5,
|
||||
@ -73,8 +69,7 @@ const getChartData = ({ queryData }: GetChartDataProps): ChartData => {
|
||||
borderColor: colors[index % colors.length] || 'red',
|
||||
showLine: true,
|
||||
pointRadius: 0,
|
||||
};
|
||||
}),
|
||||
})),
|
||||
labels: response
|
||||
.map((e) => e.map((e) => e.first))
|
||||
.reduce((a, b) => [...a, ...b], [])[0],
|
||||
|
@ -1,6 +1,5 @@
|
||||
const getMicroSeconds = ({ time }: GetMicroSecondsProps): string => {
|
||||
return (time / 1000).toString();
|
||||
};
|
||||
const getMicroSeconds = ({ time }: GetMicroSecondsProps): string =>
|
||||
(time / 1000).toString();
|
||||
|
||||
interface GetMicroSecondsProps {
|
||||
time: number;
|
||||
|
@ -11,9 +11,7 @@ function GetFormulaName(
|
||||
return null;
|
||||
}
|
||||
const formulasNameNumbered = sortBy(
|
||||
formulas.map(({ name }: { name: string }) => {
|
||||
return parseInt(name.slice(1), 10);
|
||||
}),
|
||||
formulas.map(({ name }: { name: string }) => parseInt(name.slice(1), 10)),
|
||||
(e) => e,
|
||||
);
|
||||
|
||||
|
@ -6,9 +6,7 @@ function GetQueryName(queries: { name: string }[] = []): string | null {
|
||||
if (queries.length === MAX_QUERIES) {
|
||||
return null;
|
||||
}
|
||||
const sortedQueries = sortBy(queries, (q) => {
|
||||
return q.name;
|
||||
});
|
||||
const sortedQueries = sortBy(queries, (q) => q.name);
|
||||
|
||||
let queryIteratorIdx = 0;
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
const convertObjectIntoParams = (
|
||||
props: Record<string, unknown>,
|
||||
stringify = false,
|
||||
): string => {
|
||||
return Object.keys(props)
|
||||
): string =>
|
||||
Object.keys(props)
|
||||
.map(
|
||||
(e) =>
|
||||
`${e}=${
|
||||
@ -10,6 +10,5 @@ const convertObjectIntoParams = (
|
||||
}`,
|
||||
)
|
||||
.join('&');
|
||||
};
|
||||
|
||||
export default convertObjectIntoParams;
|
||||
|
@ -23,25 +23,21 @@ export const convertTraceKeyToMetric = (key: string): string => {
|
||||
return `resource_${splittedKey.join('_')}`;
|
||||
};
|
||||
|
||||
export const convertOperatorLabelToMetricOperator = (label: string): string => {
|
||||
return (
|
||||
export const convertOperatorLabelToMetricOperator = (label: string): string =>
|
||||
OperatorConversions.find((operator) => operator.label === label)
|
||||
?.metricValue || ''
|
||||
);
|
||||
};
|
||||
?.metricValue || '';
|
||||
|
||||
export const convertOperatorLabelToTraceOperator = (
|
||||
label: string,
|
||||
): OperatorValues => {
|
||||
return OperatorConversions.find((operator) => operator.label === label)
|
||||
): OperatorValues =>
|
||||
OperatorConversions.find((operator) => operator.label === label)
|
||||
?.traceValue as OperatorValues;
|
||||
};
|
||||
|
||||
export const convertRawQueriesToTraceSelectedTags = (
|
||||
queries: IResourceAttributeQuery[],
|
||||
keyType: 'string' | 'array' = 'string',
|
||||
): Tags[] | TagsAPI[] => {
|
||||
return queries.map((query) => ({
|
||||
): Tags[] | TagsAPI[] =>
|
||||
queries.map((query) => ({
|
||||
Key:
|
||||
keyType === 'array'
|
||||
? [convertMetricKeyToTrace(query.tagKey)]
|
||||
@ -49,7 +45,6 @@ export const convertRawQueriesToTraceSelectedTags = (
|
||||
Operator: convertOperatorLabelToTraceOperator(query.operator),
|
||||
Values: query.tagValue,
|
||||
}));
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts Resource Attribute Queries to PromQL query string
|
||||
@ -74,11 +69,10 @@ export const resourceAttributesQueryToPromQL = (
|
||||
/* Convert resource attributes to tagFilter items for queryBuilder */
|
||||
export const resourceAttributesToTagFilterItems = (
|
||||
queries: IResourceAttributeQuery[],
|
||||
): IQueryBuilderTagFilterItems[] => {
|
||||
return queries.map((res) => ({
|
||||
): IQueryBuilderTagFilterItems[] =>
|
||||
queries.map((res) => ({
|
||||
id: `${res.id}`,
|
||||
key: `${res.tagKey}`,
|
||||
op: `${res.operator}`,
|
||||
value: `${res.tagValue}`.split(','),
|
||||
}));
|
||||
};
|
||||
|
@ -20,9 +20,7 @@ function SettingsPage(): JSX.Element {
|
||||
route: ROUTES.SETTINGS,
|
||||
},
|
||||
{
|
||||
Component: (): JSX.Element => {
|
||||
return <CreateAlertChannels preType="slack" />;
|
||||
},
|
||||
Component: (): JSX.Element => <CreateAlertChannels preType="slack" />,
|
||||
name: t('routes.alert_channels'),
|
||||
route: ROUTES.ALL_CHANNELS,
|
||||
},
|
||||
|
@ -11,9 +11,9 @@ function InstrumentationPage(): JSX.Element {
|
||||
Congrats, you have successfully installed SigNoz! Now lets get some data in
|
||||
and start deriving insights from them
|
||||
</Typography>
|
||||
{GetStartedContent().map((section) => {
|
||||
return <DocSection key={section.heading} sectionData={section} />;
|
||||
})}
|
||||
{GetStartedContent().map((section) => (
|
||||
<DocSection key={section.heading} sectionData={section} />
|
||||
))}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
@ -101,13 +101,14 @@ function Trace({
|
||||
isFilterExclude,
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
return (): void => {
|
||||
useEffect(
|
||||
() => (): void => {
|
||||
dispatch({
|
||||
type: RESET_TRACE_FILTER,
|
||||
});
|
||||
};
|
||||
}, [dispatch]);
|
||||
},
|
||||
[dispatch],
|
||||
);
|
||||
|
||||
const onClickHandler: React.MouseEventHandler<HTMLElement> = useCallback(
|
||||
(e) => {
|
||||
|
@ -4,13 +4,13 @@ import { Widgets } from 'types/api/dashboard/getAll';
|
||||
|
||||
export const ApplySettingsToPanel = (
|
||||
props: ApplySettingsToPanelProps,
|
||||
): ((dispatch: Dispatch<AppActions>) => void) => {
|
||||
return (dispatch: Dispatch<AppActions>): void => {
|
||||
): ((dispatch: Dispatch<AppActions>) => void) => (
|
||||
dispatch: Dispatch<AppActions>,
|
||||
): void => {
|
||||
dispatch({
|
||||
type: 'APPLY_SETTINGS_TO_PANEL',
|
||||
payload: props,
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
export interface ApplySettingsToPanelProps {
|
||||
|
@ -5,8 +5,9 @@ import { Dashboard } from 'types/api/dashboard/getAll';
|
||||
|
||||
export const DeleteDashboard = ({
|
||||
uuid,
|
||||
}: DeleteDashboardProps): ((dispatch: Dispatch<AppActions>) => void) => {
|
||||
return async (dispatch: Dispatch<AppActions>): Promise<void> => {
|
||||
}: DeleteDashboardProps): ((dispatch: Dispatch<AppActions>) => void) => async (
|
||||
dispatch: Dispatch<AppActions>,
|
||||
): Promise<void> => {
|
||||
try {
|
||||
const response = await deleteDashboardApi({
|
||||
uuid,
|
||||
@ -36,7 +37,6 @@ export const DeleteDashboard = ({
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export interface DeleteDashboardProps {
|
||||
|
@ -4,8 +4,9 @@ import { DeleteQueryProps } from 'types/actions/dashboard';
|
||||
|
||||
export const DeleteQuery = (
|
||||
props: DeleteQueryProps,
|
||||
): ((dispatch: Dispatch<AppActions>) => void) => {
|
||||
return (dispatch: Dispatch<AppActions>): void => {
|
||||
): ((dispatch: Dispatch<AppActions>) => void) => (
|
||||
dispatch: Dispatch<AppActions>,
|
||||
): void => {
|
||||
dispatch({
|
||||
type: 'DELETE_QUERY',
|
||||
payload: {
|
||||
@ -13,5 +14,4 @@ export const DeleteQuery = (
|
||||
widgetId: props.widgetId,
|
||||
},
|
||||
});
|
||||
};
|
||||
};
|
||||
|
@ -10,8 +10,9 @@ import { Dashboard, Widgets } from 'types/api/dashboard/getAll';
|
||||
export const DeleteWidget = ({
|
||||
widgetId,
|
||||
setLayout,
|
||||
}: DeleteWidgetProps): ((dispatch: Dispatch<AppActions>) => void) => {
|
||||
return async (dispatch: Dispatch<AppActions>): Promise<void> => {
|
||||
}: DeleteWidgetProps): ((dispatch: Dispatch<AppActions>) => void) => async (
|
||||
dispatch: Dispatch<AppActions>,
|
||||
): Promise<void> => {
|
||||
try {
|
||||
const { dashboards } = store.getState();
|
||||
const [selectedDashboard] = dashboards.dashboards;
|
||||
@ -61,7 +62,6 @@ export const DeleteWidget = ({
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export interface DeleteWidgetProps {
|
||||
|
@ -5,8 +5,7 @@ import AppActions from 'types/actions';
|
||||
|
||||
export const GetAllDashboards = (): ((
|
||||
dispatch: Dispatch<AppActions>,
|
||||
) => void) => {
|
||||
return async (dispatch: Dispatch<AppActions>): Promise<void> => {
|
||||
) => void) => async (dispatch: Dispatch<AppActions>): Promise<void> => {
|
||||
try {
|
||||
dispatch({
|
||||
type: 'GET_ALL_DASHBOARD_LOADING_START',
|
||||
@ -34,5 +33,4 @@ export const GetAllDashboards = (): ((
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -15,8 +15,9 @@ export const GetDashboard = ({
|
||||
uuid,
|
||||
widgetId,
|
||||
graphType,
|
||||
}: GetDashboardProps): ((dispatch: Dispatch<AppActions>) => void) => {
|
||||
return async (dispatch: Dispatch<AppActions>): Promise<void> => {
|
||||
}: GetDashboardProps): ((dispatch: Dispatch<AppActions>) => void) => async (
|
||||
dispatch: Dispatch<AppActions>,
|
||||
): Promise<void> => {
|
||||
try {
|
||||
dispatch({
|
||||
type: 'GET_DASHBOARD_LOADING_START',
|
||||
@ -98,7 +99,6 @@ export const GetDashboard = ({
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export interface GetDashboardProps {
|
||||
|
@ -21,9 +21,9 @@ export const SaveDashboard = ({
|
||||
widgetId,
|
||||
dashboardId,
|
||||
yAxisUnit,
|
||||
}: SaveDashboardProps): ((dispatch: Dispatch<AppActions>) => void) => {
|
||||
}: SaveDashboardProps): ((dispatch: Dispatch<AppActions>) => void) =>
|
||||
// eslint-disable-next-line sonarjs/cognitive-complexity
|
||||
return async (dispatch: Dispatch<AppActions>): Promise<void> => {
|
||||
async (dispatch: Dispatch<AppActions>): Promise<void> => {
|
||||
try {
|
||||
const dashboard = store.getState();
|
||||
const search = new URLSearchParams(history.location.search);
|
||||
@ -139,7 +139,6 @@ export const SaveDashboard = ({
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export interface SaveDashboardProps {
|
||||
uuid: Dashboard['uuid'];
|
||||
|
@ -3,15 +3,15 @@ import AppActions from 'types/actions';
|
||||
|
||||
export const ToggleAddWidget = (
|
||||
props: ToggleAddWidgetProps,
|
||||
): ((dispatch: Dispatch<AppActions>) => void) => {
|
||||
return (dispatch: Dispatch<AppActions>): void => {
|
||||
): ((dispatch: Dispatch<AppActions>) => void) => (
|
||||
dispatch: Dispatch<AppActions>,
|
||||
): void => {
|
||||
dispatch({
|
||||
type: 'IS_ADD_WIDGET',
|
||||
payload: {
|
||||
isAddWidget: props,
|
||||
},
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
export type ToggleAddWidgetProps = boolean;
|
||||
|
@ -1,12 +1,10 @@
|
||||
import { Dispatch } from 'react';
|
||||
import { Dispatch } from 'redux';
|
||||
import AppActions from 'types/actions';
|
||||
|
||||
export const ToggleEditMode = (): ((
|
||||
dispatch: Dispatch<AppActions>,
|
||||
) => void) => {
|
||||
return (dispatch: Dispatch<AppActions>): void => {
|
||||
) => void) => (dispatch: Dispatch<AppActions>): void => {
|
||||
dispatch({
|
||||
type: 'TOGGLE_EDIT_MODE',
|
||||
});
|
||||
};
|
||||
};
|
||||
|
@ -7,8 +7,7 @@ export const UpdateDashboardTitleDescriptionTags = ({
|
||||
dashboard, // @TODO need to grab the dashboard from the store
|
||||
}: UpdateDashboardTitleDescriptionTagsProps): ((
|
||||
dispatch: Dispatch<AppActions>,
|
||||
) => void) => {
|
||||
return async (dispatch: Dispatch<AppActions>): Promise<void> => {
|
||||
) => void) => async (dispatch: Dispatch<AppActions>): Promise<void> => {
|
||||
try {
|
||||
const { data } = dashboard;
|
||||
|
||||
@ -49,7 +48,6 @@ export const UpdateDashboardTitleDescriptionTags = ({
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export interface UpdateDashboardTitleDescriptionTagsProps {
|
||||
|
@ -4,8 +4,9 @@ import { Query } from 'types/api/dashboard/getAll';
|
||||
|
||||
export const UpdateQuery = (
|
||||
props: UpdateQueryProps,
|
||||
): ((dispatch: Dispatch<AppActions>) => void) => {
|
||||
return (dispatch: Dispatch<AppActions>): void => {
|
||||
): ((dispatch: Dispatch<AppActions>) => void) => (
|
||||
dispatch: Dispatch<AppActions>,
|
||||
): void => {
|
||||
dispatch({
|
||||
type: 'UPDATE_QUERY',
|
||||
payload: {
|
||||
@ -14,7 +15,6 @@ export const UpdateQuery = (
|
||||
yAxisUnit: props.yAxisUnit,
|
||||
},
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
export interface UpdateQueryProps {
|
||||
|
@ -8,8 +8,9 @@ import { IDashboardVariable } from 'types/api/dashboard/getAll';
|
||||
|
||||
export const UpdateDashboardVariables = (
|
||||
variables: Record<string, IDashboardVariable>,
|
||||
): ((dispatch: Dispatch<AppActions>) => void) => {
|
||||
return async (dispatch: Dispatch<AppActions>): Promise<void> => {
|
||||
): ((dispatch: Dispatch<AppActions>) => void) => async (
|
||||
dispatch: Dispatch<AppActions>,
|
||||
): Promise<void> => {
|
||||
try {
|
||||
dispatch({
|
||||
type: UPDATE_DASHBOARD_VARIABLES,
|
||||
@ -34,5 +35,4 @@ export const UpdateDashboardVariables = (
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -7,8 +7,9 @@ import { UPDATE_TIME_INTERVAL } from 'types/actions/globalTime';
|
||||
export const UpdateTimeInterval = (
|
||||
interval: Time,
|
||||
dateTimeRange: [number, number] = [0, 0],
|
||||
): ((dispatch: Dispatch<AppActions>) => void) => {
|
||||
return (dispatch: Dispatch<AppActions>): void => {
|
||||
): ((dispatch: Dispatch<AppActions>) => void) => (
|
||||
dispatch: Dispatch<AppActions>,
|
||||
): void => {
|
||||
const { maxTime, minTime } = GetMinMax(interval, dateTimeRange);
|
||||
|
||||
dispatch({
|
||||
@ -19,15 +20,12 @@ export const UpdateTimeInterval = (
|
||||
selectedTime: interval,
|
||||
},
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
export const GlobalTimeLoading = (): ((
|
||||
dispatch: Dispatch<AppActions>,
|
||||
) => void) => {
|
||||
return (dispatch: Dispatch<AppActions>): void => {
|
||||
) => void) => (dispatch: Dispatch<AppActions>): void => {
|
||||
dispatch({
|
||||
type: 'GLOBAL_TIME_LOADING_START',
|
||||
});
|
||||
};
|
||||
};
|
||||
|
@ -5,13 +5,11 @@ import { SET_FIELDS } from 'types/actions/logs';
|
||||
|
||||
export const AddToSelectedField = (): ((
|
||||
dispatch: Dispatch<AppActions>,
|
||||
) => void) => {
|
||||
return async (dispatch): Promise<void> => {
|
||||
) => void) => async (dispatch): Promise<void> => {
|
||||
const response = await GetSearchFields();
|
||||
if (response.payload)
|
||||
dispatch({
|
||||
type: SET_FIELDS,
|
||||
payload: response.payload,
|
||||
});
|
||||
};
|
||||
};
|
||||
|
@ -5,8 +5,9 @@ import { SET_FIELDS } from 'types/actions/logs';
|
||||
|
||||
const IGNORED_SELECTED_FIELDS = ['timestamp'];
|
||||
|
||||
export const GetLogsFields = (): ((dispatch: Dispatch<AppActions>) => void) => {
|
||||
return async (dispatch): Promise<void> => {
|
||||
export const GetLogsFields = (): ((
|
||||
dispatch: Dispatch<AppActions>,
|
||||
) => void) => async (dispatch): Promise<void> => {
|
||||
const response = await GetSearchFields();
|
||||
if (response.payload) {
|
||||
dispatch({
|
||||
@ -19,5 +20,4 @@ export const GetLogsFields = (): ((dispatch: Dispatch<AppActions>) => void) => {
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -6,8 +6,9 @@ import { Props } from 'types/api/logs/getLogs';
|
||||
|
||||
export const getLogs = (
|
||||
props: Props,
|
||||
): ((dispatch: Dispatch<AppActions>) => void) => {
|
||||
return async (dispatch): Promise<void> => {
|
||||
): ((dispatch: Dispatch<AppActions>) => void) => async (
|
||||
dispatch,
|
||||
): Promise<void> => {
|
||||
dispatch({
|
||||
type: SET_LOADING,
|
||||
payload: true,
|
||||
@ -30,5 +31,4 @@ export const getLogs = (
|
||||
type: SET_LOADING,
|
||||
payload: false,
|
||||
});
|
||||
};
|
||||
};
|
||||
|
@ -10,8 +10,9 @@ import { ILogsAggregate } from 'types/api/logs/logAggregate';
|
||||
|
||||
export const getLogsAggregate = (
|
||||
props: Props,
|
||||
): ((dispatch: Dispatch<AppActions>) => void) => {
|
||||
return async (dispatch): Promise<void> => {
|
||||
): ((dispatch: Dispatch<AppActions>) => void) => async (
|
||||
dispatch,
|
||||
): Promise<void> => {
|
||||
dispatch({
|
||||
type: SET_LOADING_AGGREGATE,
|
||||
payload: true,
|
||||
@ -19,11 +20,9 @@ export const getLogsAggregate = (
|
||||
|
||||
const response = await GetLogsAggregate(props);
|
||||
if (response.payload) {
|
||||
const convertedArray: ILogsAggregate[] = Object.values(response.payload).map(
|
||||
(data) => {
|
||||
return { ...data, time: new Date(data.timestamp / 1e6) };
|
||||
},
|
||||
);
|
||||
const convertedArray: ILogsAggregate[] = Object.values(
|
||||
response.payload,
|
||||
).map((data) => ({ ...data, time: new Date(data.timestamp / 1e6) }));
|
||||
|
||||
dispatch({
|
||||
type: SET_LOGS_AGGREGATE_SERIES,
|
||||
@ -40,5 +39,4 @@ export const getLogsAggregate = (
|
||||
type: SET_LOADING_AGGREGATE,
|
||||
payload: false,
|
||||
});
|
||||
};
|
||||
};
|
||||
|
@ -17,8 +17,10 @@ import { Tags } from 'types/reducer/trace';
|
||||
|
||||
export const GetInitialData = (
|
||||
props: GetInitialDataProps,
|
||||
): ((dispatch: Dispatch<AppActions>, getState: () => AppState) => void) => {
|
||||
return async (dispatch, getState): Promise<void> => {
|
||||
): ((
|
||||
dispatch: Dispatch<AppActions>,
|
||||
getState: () => AppState,
|
||||
) => void) => async (dispatch, getState): Promise<void> => {
|
||||
try {
|
||||
const { globalTime } = getState();
|
||||
|
||||
@ -125,7 +127,6 @@ export const GetInitialData = (
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export interface GetInitialDataProps {
|
||||
|
@ -9,8 +9,10 @@ import { Tags } from 'types/reducer/trace';
|
||||
|
||||
export const GetService = (
|
||||
props: GetServiceProps,
|
||||
): ((dispatch: Dispatch<AppActions>, getState: () => AppState) => void) => {
|
||||
return async (dispatch, getState): Promise<void> => {
|
||||
): ((
|
||||
dispatch: Dispatch<AppActions>,
|
||||
getState: () => AppState,
|
||||
) => void) => async (dispatch, getState): Promise<void> => {
|
||||
try {
|
||||
const { globalTime } = getState();
|
||||
|
||||
@ -57,7 +59,6 @@ export const GetService = (
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export type GetServiceProps = {
|
||||
|
@ -5,10 +5,8 @@ import AppActions from 'types/actions';
|
||||
export const ResetInitialData = (): ((
|
||||
dispatch: Dispatch<AppActions>,
|
||||
getState: () => AppState,
|
||||
) => void) => {
|
||||
return (dispatch): void => {
|
||||
) => void) => (dispatch): void => {
|
||||
dispatch({
|
||||
type: 'RESET_INITIAL_APPLICATION_DATA',
|
||||
});
|
||||
};
|
||||
};
|
||||
|
@ -30,8 +30,9 @@ export interface ServiceMapLoading {
|
||||
};
|
||||
}
|
||||
|
||||
export const getDetailedServiceMapItems = (globalTime: GlobalTime) => {
|
||||
return async (dispatch: Dispatch): Promise<void> => {
|
||||
export const getDetailedServiceMapItems = (globalTime: GlobalTime) => async (
|
||||
dispatch: Dispatch,
|
||||
): Promise<void> => {
|
||||
const start = `${globalTime.minTime}`;
|
||||
const end = `${globalTime.maxTime}`;
|
||||
|
||||
@ -55,5 +56,4 @@ export const getDetailedServiceMapItems = (globalTime: GlobalTime) => {
|
||||
loading: false,
|
||||
},
|
||||
});
|
||||
};
|
||||
};
|
||||
|
@ -32,9 +32,8 @@ export const GetInitialTraceFilter = (
|
||||
): ((
|
||||
dispatch: Dispatch<AppActions>,
|
||||
getState: Store<AppState>['getState'],
|
||||
) => void) => {
|
||||
// eslint-disable-next-line sonarjs/cognitive-complexity
|
||||
return async (dispatch, getState): Promise<void> => {
|
||||
) => void) => async (dispatch, getState): Promise<void> => {
|
||||
try {
|
||||
const query = window.location.search;
|
||||
|
||||
@ -55,15 +54,9 @@ export const GetInitialTraceFilter = (
|
||||
traces.filterToFetchData,
|
||||
);
|
||||
|
||||
const getUserSelected = parseSelectedFilter(
|
||||
query,
|
||||
traces.userSelectedFilter,
|
||||
);
|
||||
const getUserSelected = parseSelectedFilter(query, traces.userSelectedFilter);
|
||||
|
||||
const getIsFilterExcluded = parseFilterExclude(
|
||||
query,
|
||||
traces.isFilterExclude,
|
||||
);
|
||||
const getIsFilterExcluded = parseFilterExclude(query, traces.isFilterExclude);
|
||||
|
||||
const parsedQueryCurrent = parseQueryIntoCurrent(
|
||||
query,
|
||||
@ -205,5 +198,4 @@ export const GetInitialTraceFilter = (
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -15,8 +15,7 @@ export const GetSpansAggregate = (
|
||||
): ((
|
||||
dispatch: Dispatch<AppActions>,
|
||||
getState: Store<AppState>['getState'],
|
||||
) => void) => {
|
||||
return async (dispatch, getState): Promise<void> => {
|
||||
) => void) => async (dispatch, getState): Promise<void> => {
|
||||
const { traces, globalTime } = getState();
|
||||
const { spansAggregate } = traces;
|
||||
|
||||
@ -129,7 +128,6 @@ export const GetSpansAggregate = (
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export interface GetSpansAggregateProps {
|
||||
|
@ -11,8 +11,7 @@ export const SelectedTraceFilter = (props: {
|
||||
}): ((
|
||||
dispatch: Dispatch<AppActions>,
|
||||
getState: Store<AppState>['getState'],
|
||||
) => void) => {
|
||||
return (_, getState): void => {
|
||||
) => void) => (_, getState): void => {
|
||||
const { topic, value } = props;
|
||||
const { traces } = getState();
|
||||
|
||||
@ -50,5 +49,4 @@ export const SelectedTraceFilter = (props: {
|
||||
traces.spansAggregate.pageSize,
|
||||
traces.spansAggregate.orderParam,
|
||||
);
|
||||
};
|
||||
};
|
||||
|
@ -5,13 +5,11 @@ import { TraceReducer } from 'types/reducer/trace';
|
||||
|
||||
export const UpdateTagIsError = (
|
||||
isTagModalError: TraceReducer['isTagModalError'],
|
||||
): ((dispatch: Dispatch<AppActions>) => void) => {
|
||||
return (dispatch): void => {
|
||||
): ((dispatch: Dispatch<AppActions>) => void) => (dispatch): void => {
|
||||
dispatch({
|
||||
type: UPDATE_IS_TAG_ERROR,
|
||||
payload: {
|
||||
isTagModalError,
|
||||
},
|
||||
});
|
||||
};
|
||||
};
|
||||
|
@ -5,13 +5,11 @@ import { TraceReducer } from 'types/reducer/trace';
|
||||
|
||||
export const UpdateTagVisibility = (
|
||||
isTagModalOpen: TraceReducer['isTagModalOpen'],
|
||||
): ((dispatch: Dispatch<AppActions>) => void) => {
|
||||
return (dispatch): void => {
|
||||
): ((dispatch: Dispatch<AppActions>) => void) => (dispatch): void => {
|
||||
dispatch({
|
||||
type: UPDATE_TAG_MODAL_VISIBILITY,
|
||||
payload: {
|
||||
isTagModalOpen,
|
||||
},
|
||||
});
|
||||
};
|
||||
};
|
||||
|
@ -5,13 +5,11 @@ import { TraceReducer } from 'types/reducer/trace';
|
||||
|
||||
export const UpdateSelectedTags = (
|
||||
selectedTags: TraceReducer['selectedTags'],
|
||||
): ((dispatch: Dispatch<AppActions>) => void) => {
|
||||
return (dispatch): void => {
|
||||
): ((dispatch: Dispatch<AppActions>) => void) => (dispatch): void => {
|
||||
dispatch({
|
||||
type: UPDATE_SELECTED_TAGS,
|
||||
payload: {
|
||||
selectedTags,
|
||||
},
|
||||
});
|
||||
};
|
||||
};
|
||||
|
@ -19,8 +19,7 @@ export const getUsageData = (
|
||||
maxTime: number,
|
||||
step: number,
|
||||
service: string,
|
||||
) => {
|
||||
return async (dispatch: Dispatch): Promise<void> => {
|
||||
) => async (dispatch: Dispatch): Promise<void> => {
|
||||
const requesString = `/usage?start=${toUTCEpoch(minTime)}&end=${toUTCEpoch(
|
||||
maxTime,
|
||||
)}&step=${step}&service=${service || ''}`;
|
||||
@ -32,5 +31,4 @@ export const getUsageData = (
|
||||
payload: response.data,
|
||||
// PNOTE - response.data in the axios response has the actual API response
|
||||
});
|
||||
};
|
||||
};
|
||||
|
@ -1,6 +1,5 @@
|
||||
import getLocalStorage from 'api/browser/localstorage/get';
|
||||
import { SKIP_ONBOARDING } from 'constants/onboarding';
|
||||
|
||||
export const isOnboardingSkipped = (): boolean => {
|
||||
return getLocalStorage(SKIP_ONBOARDING) === 'true';
|
||||
};
|
||||
export const isOnboardingSkipped = (): boolean =>
|
||||
getLocalStorage(SKIP_ONBOARDING) === 'true';
|
||||
|
@ -4,8 +4,8 @@ import { ITraceForest, ITraceTree, Span } from 'types/api/trace/getTraceItem';
|
||||
|
||||
const getSpanReferences = (
|
||||
rawReferences: string[] = [],
|
||||
): Record<string, string>[] => {
|
||||
return rawReferences.map((rawRef) => {
|
||||
): Record<string, string>[] =>
|
||||
rawReferences.map((rawRef) => {
|
||||
const refObject: Record<string, string> = {};
|
||||
rawRef
|
||||
.replaceAll('{', '')
|
||||
@ -19,7 +19,6 @@ const getSpanReferences = (
|
||||
|
||||
return refObject;
|
||||
});
|
||||
};
|
||||
|
||||
// This getSpanTags is migrated from the previous implementation.
|
||||
const getSpanTags = (spanData: Span): { key: string; value: string }[] => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
export const toUTCEpoch = (time: number): number => {
|
||||
export function toUTCEpoch(time: number): number {
|
||||
const x = new Date();
|
||||
return time + x.getTimezoneOffset() * 60 * 1000;
|
||||
};
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
export const toFixed = (input: number, fixedCount: number): number | string => {
|
||||
export function toFixed(input: number, fixedCount: number): number | string {
|
||||
if (input.toString().split('.').length > 1) {
|
||||
return input.toFixed(fixedCount);
|
||||
}
|
||||
return input;
|
||||
};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user