From bc69406f31b61078b82a1826f2a2bc60f238ceca Mon Sep 17 00:00:00 2001 From: Alex Corey Date: Mon, 6 Jul 2020 14:27:33 -0400 Subject: [PATCH] removes unneeded select all checkbox --- .../screens/Template/Survey/SurveyList.jsx | 36 ++++++++++++++----- .../Template/Survey/SurveyList.test.jsx | 2 +- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/awx/ui_next/src/screens/Template/Survey/SurveyList.jsx b/awx/ui_next/src/screens/Template/Survey/SurveyList.jsx index 5d6b738a41..8c296f0c44 100644 --- a/awx/ui_next/src/screens/Template/Survey/SurveyList.jsx +++ b/awx/ui_next/src/screens/Template/Survey/SurveyList.jsx @@ -1,11 +1,21 @@ import React, { useState } from 'react'; import { withI18n } from '@lingui/react'; import { t } from '@lingui/macro'; -import { DataList, Button as _Button } from '@patternfly/react-core'; +import { useRouteMatch } from 'react-router-dom'; +import { + DataList, + Button as _Button, + Title, + EmptyState, + EmptyStateIcon, + EmptyStateBody, +} from '@patternfly/react-core'; +import { CubesIcon } from '@patternfly/react-icons'; import styled from 'styled-components'; import ContentLoading from '../../../components/ContentLoading'; -import ContentEmpty from '../../../components/ContentEmpty'; +// import ContentEmpty from '../../../components/ContentEmpty'; import AlertModal from '../../../components/AlertModal'; +import { ToolbarAddButton } from '../../../components/PaginatedDataList'; import SurveyListItem from './SurveyListItem'; import SurveyToolbar from './SurveyToolbar'; @@ -25,6 +35,8 @@ function SurveyList({ canEdit, i18n, }) { + const match = useRouteMatch(); + const questions = survey?.spec || []; const [selected, setSelected] = useState([]); const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false); @@ -78,13 +90,6 @@ function SurveyList({ let content; if (isLoading) { content = ; - } else if (!questions || questions?.length <= 0) { - content = ( - - ); } else { content = ( @@ -163,8 +168,21 @@ function SurveyList({ ); } + return ( <> + {(!questions || questions?.length <= 0) && ( + + + + {i18n._(t`No survey questions found.`)} + + + {i18n._(t`Please add survey questions.`)} + + + + )} { ); }); - expect(wrapper.find('ContentEmpty').length).toBe(1); + expect(wrapper.find('EmptyState').length).toBe(1); expect(wrapper.find('SurveyListItem').length).toBe(0); }); });