Skip to content

Commit 7ee79ba

Browse files
authored
[Feature]: Show Quickstart button if user don't have any runs #2754 (#2770)
1 parent 2365a2b commit 7ee79ba

3 files changed

Lines changed: 22 additions & 2 deletions

File tree

frontend/src/locale/en.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@
4646
"discord": "Discord",
4747
"danger_zone": "Danger Zone",
4848
"control_plane": "Control plane",
49-
"refresh": "Refresh"
49+
"refresh": "Refresh",
50+
"quickstart": "Quickstart"
5051
},
5152

5253
"auth": {
@@ -318,6 +319,7 @@
318319
"search_placeholder": "Find runs",
319320
"empty_message_title": "No runs",
320321
"empty_message_text": "No runs to display.",
322+
"quickstart_message_text": "No runs to display. Create a new one using the guide",
321323
"nomatch_message_title": "No matches",
322324
"nomatch_message_text": "We can't find a match. Try to change project or clear filter",
323325
"project": "Project",

frontend/src/pages/Runs/List/hooks/useEmptyMessages.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,32 @@ import { useTranslation } from 'react-i18next';
33

44
import { Button, ListEmptyMessage } from 'components';
55

6+
import { QUICK_START_URL } from 'consts';
7+
import { goToUrl } from 'libs';
8+
69
export const useEmptyMessages = ({
710
clearFilter,
11+
noData,
812
isDisabledClearFilter,
913
}: {
1014
clearFilter?: () => void;
15+
noData?: boolean;
1116
isDisabledClearFilter?: boolean;
1217
}) => {
1318
const { t } = useTranslation();
1419

1520
const renderEmptyMessage = useCallback<() => React.ReactNode>(() => {
21+
if (noData && isDisabledClearFilter) {
22+
return (
23+
<ListEmptyMessage
24+
title={t('projects.run.empty_message_title')}
25+
message={t('projects.run.quickstart_message_text')}
26+
>
27+
<Button onClick={() => goToUrl(QUICK_START_URL, true)}>{t('common.quickstart')}</Button>
28+
</ListEmptyMessage>
29+
);
30+
}
31+
1632
return (
1733
<ListEmptyMessage title={t('projects.run.nomatch_message_title')} message={t('projects.run.nomatch_message_text')}>
1834
<Button disabled={isDisabledClearFilter} onClick={clearFilter}>

frontend/src/pages/Runs/List/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import { useTranslation } from 'react-i18next';
33

4-
import { Button, Header, Loader, PropertyFilter, SpaceBetween, Table } from 'components';
4+
import { Button, Header, ListEmptyMessage, Loader, PropertyFilter, SpaceBetween, Table } from 'components';
55

66
import { DEFAULT_TABLE_PAGE_SIZE } from 'consts';
77
import { useBreadcrumbs, useCollection, useInfiniteScroll } from 'hooks';
@@ -61,6 +61,8 @@ export const RunList: React.FC = () => {
6161

6262
const { renderEmptyMessage, renderNoMatchMessage } = useEmptyMessages({
6363
clearFilter,
64+
noData: !data.length,
65+
isDisabledClearFilter: Object.keys(filteringRequestParams).length <= 1 && !filteringRequestParams.only_active,
6466
});
6567

6668
const { items, actions, collectionProps } = useCollection(data ?? [], {

0 commit comments

Comments
 (0)