mirror of
https://github.com/ansible/awx.git
synced 2026-05-10 10:57:35 -02:30
Add Inventory detail edit button
This commit is contained in:
23
awx/ui_next/src/components/Card/CardActionsRow.jsx
Normal file
23
awx/ui_next/src/components/Card/CardActionsRow.jsx
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { CardActions } from '@patternfly/react-core';
|
||||||
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
const CardActionsWrapper = styled.div`
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
margin-top: 20px;
|
||||||
|
|
||||||
|
& > :not(:first-child) {
|
||||||
|
margin-left: 20px;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
function CardActionsRow({ children }) {
|
||||||
|
return (
|
||||||
|
<CardActionsWrapper>
|
||||||
|
<CardActions>{children}</CardActions>
|
||||||
|
</CardActionsWrapper>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default CardActionsRow;
|
||||||
@@ -1,2 +1,3 @@
|
|||||||
export { default as TabbedCardHeader } from './TabbedCardHeader';
|
export { default as TabbedCardHeader } from './TabbedCardHeader';
|
||||||
export { default as CardBody } from './CardBody';
|
export { default as CardBody } from './CardBody';
|
||||||
|
export { default as CardActionsRow } from './CardActionsRow';
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ import React, { useState, useEffect } from 'react';
|
|||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import { withI18n } from '@lingui/react';
|
import { withI18n } from '@lingui/react';
|
||||||
import { t } from '@lingui/macro';
|
import { t } from '@lingui/macro';
|
||||||
import { CardBody } from '@components/Card';
|
import { Button } from '@patternfly/react-core';
|
||||||
|
import { CardBody, CardActionsRow } from '@components/Card';
|
||||||
import { DetailList, Detail, UserDateDetail } from '@components/DetailList';
|
import { DetailList, Detail, UserDateDetail } from '@components/DetailList';
|
||||||
import { ChipGroup, Chip } from '@components/Chip';
|
import { ChipGroup, Chip } from '@components/Chip';
|
||||||
import { VariablesDetail } from '@components/CodeMirrorInput';
|
import { VariablesDetail } from '@components/CodeMirrorInput';
|
||||||
@@ -84,6 +85,16 @@ function InventoryDetail({ inventory, i18n }) {
|
|||||||
user={inventory.summary_fields.modified_by}
|
user={inventory.summary_fields.modified_by}
|
||||||
/>
|
/>
|
||||||
</DetailList>
|
</DetailList>
|
||||||
|
{inventory.summary_fields.user_capabilities.edit && (
|
||||||
|
<CardActionsRow>
|
||||||
|
<Button
|
||||||
|
component={Link}
|
||||||
|
to={`/inventories/inventory/${inventory.id}/edit`}
|
||||||
|
>
|
||||||
|
{i18n._(t`Edit`)}
|
||||||
|
</Button>
|
||||||
|
</CardActionsRow>
|
||||||
|
)}
|
||||||
</CardBody>
|
</CardBody>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user