mirror of
https://github.com/ansible/awx.git
synced 2026-01-19 21:51:26 -03:30
Add Inventory detail edit button
This commit is contained in:
parent
7ff4d821ce
commit
6c439bb9ae
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 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 { withI18n } from '@lingui/react';
|
||||
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 { ChipGroup, Chip } from '@components/Chip';
|
||||
import { VariablesDetail } from '@components/CodeMirrorInput';
|
||||
@ -84,6 +85,16 @@ function InventoryDetail({ inventory, i18n }) {
|
||||
user={inventory.summary_fields.modified_by}
|
||||
/>
|
||||
</DetailList>
|
||||
{inventory.summary_fields.user_capabilities.edit && (
|
||||
<CardActionsRow>
|
||||
<Button
|
||||
component={Link}
|
||||
to={`/inventories/inventory/${inventory.id}/edit`}
|
||||
>
|
||||
{i18n._(t`Edit`)}
|
||||
</Button>
|
||||
</CardActionsRow>
|
||||
)}
|
||||
</CardBody>
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user