mirror of
https://github.com/ansible/awx.git
synced 2026-03-10 05:59:28 -02:30
removes unneeded select all checkbox
This commit is contained in:
@@ -1,11 +1,21 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { withI18n } from '@lingui/react';
|
import { withI18n } from '@lingui/react';
|
||||||
import { t } from '@lingui/macro';
|
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 styled from 'styled-components';
|
||||||
import ContentLoading from '../../../components/ContentLoading';
|
import ContentLoading from '../../../components/ContentLoading';
|
||||||
import ContentEmpty from '../../../components/ContentEmpty';
|
// import ContentEmpty from '../../../components/ContentEmpty';
|
||||||
import AlertModal from '../../../components/AlertModal';
|
import AlertModal from '../../../components/AlertModal';
|
||||||
|
import { ToolbarAddButton } from '../../../components/PaginatedDataList';
|
||||||
|
|
||||||
import SurveyListItem from './SurveyListItem';
|
import SurveyListItem from './SurveyListItem';
|
||||||
import SurveyToolbar from './SurveyToolbar';
|
import SurveyToolbar from './SurveyToolbar';
|
||||||
@@ -25,6 +35,8 @@ function SurveyList({
|
|||||||
canEdit,
|
canEdit,
|
||||||
i18n,
|
i18n,
|
||||||
}) {
|
}) {
|
||||||
|
const match = useRouteMatch();
|
||||||
|
|
||||||
const questions = survey?.spec || [];
|
const questions = survey?.spec || [];
|
||||||
const [selected, setSelected] = useState([]);
|
const [selected, setSelected] = useState([]);
|
||||||
const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);
|
const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);
|
||||||
@@ -78,13 +90,6 @@ function SurveyList({
|
|||||||
let content;
|
let content;
|
||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
content = <ContentLoading />;
|
content = <ContentLoading />;
|
||||||
} else if (!questions || questions?.length <= 0) {
|
|
||||||
content = (
|
|
||||||
<ContentEmpty
|
|
||||||
title={i18n._(t`No Survey Questions Found`)}
|
|
||||||
message={i18n._(t`Please add survey questions.`)}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
content = (
|
content = (
|
||||||
<DataList aria-label={i18n._(t`Survey List`)}>
|
<DataList aria-label={i18n._(t`Survey List`)}>
|
||||||
@@ -163,8 +168,21 @@ function SurveyList({
|
|||||||
</AlertModal>
|
</AlertModal>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
{(!questions || questions?.length <= 0) && (
|
||||||
|
<EmptyState variant="full">
|
||||||
|
<EmptyStateIcon icon={CubesIcon} />
|
||||||
|
<Title size="lg" headingLevel="h3">
|
||||||
|
{i18n._(t`No survey questions found.`)}
|
||||||
|
</Title>
|
||||||
|
<EmptyStateBody>
|
||||||
|
{i18n._(t`Please add survey questions.`)}
|
||||||
|
</EmptyStateBody>
|
||||||
|
<ToolbarAddButton isDisabled={!canEdit} linkTo={`${match.url}/add`} />
|
||||||
|
</EmptyState>
|
||||||
|
)}
|
||||||
<SurveyToolbar
|
<SurveyToolbar
|
||||||
isAllSelected={isAllSelected}
|
isAllSelected={isAllSelected}
|
||||||
onSelectAll={handleSelectAll}
|
onSelectAll={handleSelectAll}
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ describe('Survey with no questions', () => {
|
|||||||
<SurveyList template={mockJobTemplateData} />
|
<SurveyList template={mockJobTemplateData} />
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
expect(wrapper.find('ContentEmpty').length).toBe(1);
|
expect(wrapper.find('EmptyState').length).toBe(1);
|
||||||
expect(wrapper.find('SurveyListItem').length).toBe(0);
|
expect(wrapper.find('SurveyListItem').length).toBe(0);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user