mirror of
https://github.com/ansible/awx.git
synced 2026-05-05 00:25:29 -02:30
Remove unnecessary project template add option
This commit is contained in:
@@ -13,11 +13,10 @@ import AlertModal from '@components/AlertModal';
|
|||||||
import DatalistToolbar from '@components/DataListToolbar';
|
import DatalistToolbar from '@components/DataListToolbar';
|
||||||
import ErrorDetail from '@components/ErrorDetail';
|
import ErrorDetail from '@components/ErrorDetail';
|
||||||
import PaginatedDataList, {
|
import PaginatedDataList, {
|
||||||
|
ToolbarAddButton,
|
||||||
ToolbarDeleteButton,
|
ToolbarDeleteButton,
|
||||||
} from '@components/PaginatedDataList';
|
} from '@components/PaginatedDataList';
|
||||||
import { getQSConfig, parseQueryString } from '@util/qs';
|
import { getQSConfig, parseQueryString } from '@util/qs';
|
||||||
|
|
||||||
import AddDropDownButton from '@components/AddDropDownButton';
|
|
||||||
import ProjectTemplatesListItem from './ProjectJobTemplatesListItem';
|
import ProjectTemplatesListItem from './ProjectJobTemplatesListItem';
|
||||||
|
|
||||||
// The type value in const QS_CONFIG below does not have a space between job_template and
|
// The type value in const QS_CONFIG below does not have a space between job_template and
|
||||||
@@ -139,26 +138,14 @@ function ProjectJobTemplatesList({ i18n }) {
|
|||||||
|
|
||||||
const canAddJT =
|
const canAddJT =
|
||||||
jtActions && Object.prototype.hasOwnProperty.call(jtActions, 'POST');
|
jtActions && Object.prototype.hasOwnProperty.call(jtActions, 'POST');
|
||||||
const canAddWFJT =
|
|
||||||
wfjtActions && Object.prototype.hasOwnProperty.call(wfjtActions, 'POST');
|
const addButton = (
|
||||||
const addButtonOptions = [];
|
<ToolbarAddButton key="add" linkTo="/templates/job_template/add/" />
|
||||||
if (canAddJT) {
|
);
|
||||||
addButtonOptions.push({
|
|
||||||
label: i18n._(t`Template`),
|
|
||||||
url: `/templates/job_template/add/`,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (canAddWFJT) {
|
|
||||||
addButtonOptions.push({
|
|
||||||
label: i18n._(t`Workflow Template`),
|
|
||||||
url: `/templates/workflow_job_template/add/`,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
const isAllSelected =
|
const isAllSelected =
|
||||||
selected.length === templates.length && selected.length > 0;
|
selected.length === templates.length && selected.length > 0;
|
||||||
const addButton = (
|
|
||||||
<AddDropDownButton key="add" dropdownItems={addButtonOptions} />
|
|
||||||
);
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Card>
|
<Card>
|
||||||
@@ -232,13 +219,13 @@ function ProjectJobTemplatesList({ i18n }) {
|
|||||||
onSelectAll={handleSelectAll}
|
onSelectAll={handleSelectAll}
|
||||||
qsConfig={QS_CONFIG}
|
qsConfig={QS_CONFIG}
|
||||||
additionalControls={[
|
additionalControls={[
|
||||||
|
...(canAddJT ? [addButton] : []),
|
||||||
<ToolbarDeleteButton
|
<ToolbarDeleteButton
|
||||||
key="delete"
|
key="delete"
|
||||||
onDelete={handleTemplateDelete}
|
onDelete={handleTemplateDelete}
|
||||||
itemsToDelete={selected}
|
itemsToDelete={selected}
|
||||||
pluralizedItemName="Templates"
|
pluralizedItemName="Templates"
|
||||||
/>,
|
/>,
|
||||||
...(canAddJT || canAddWFJT ? [addButton] : []),
|
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
@@ -252,7 +239,7 @@ function ProjectJobTemplatesList({ i18n }) {
|
|||||||
isSelected={selected.some(row => row.id === template.id)}
|
isSelected={selected.some(row => row.id === template.id)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
emptyStateControls={(canAddJT || canAddWFJT) && addButton}
|
emptyStateControls={canAddJT && addButton}
|
||||||
/>
|
/>
|
||||||
</Card>
|
</Card>
|
||||||
<AlertModal
|
<AlertModal
|
||||||
|
|||||||
Reference in New Issue
Block a user