mirror of
https://github.com/ansible/awx.git
synced 2026-05-23 16:47:45 -02:30
add ObjectDetails for HTTP Headers display
This commit is contained in:
51
awx/ui_next/src/components/DetailList/ObjectDetail.jsx
Normal file
51
awx/ui_next/src/components/DetailList/ObjectDetail.jsx
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
import 'styled-components/macro';
|
||||||
|
import React from 'react';
|
||||||
|
import { shape, node, number } from 'prop-types';
|
||||||
|
import { TextListItemVariants } from '@patternfly/react-core';
|
||||||
|
import { DetailName, DetailValue } from './Detail';
|
||||||
|
import CodeMirrorInput from '../CodeMirrorInput';
|
||||||
|
|
||||||
|
function ObjectDetail({ value, label, rows, fullHeight }) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<DetailName
|
||||||
|
component={TextListItemVariants.dt}
|
||||||
|
fullWidth
|
||||||
|
css="grid-column: 1 / -1"
|
||||||
|
>
|
||||||
|
<div className="pf-c-form__label">
|
||||||
|
<span
|
||||||
|
className="pf-c-form__label-text"
|
||||||
|
css="font-weight: var(--pf-global--FontWeight--bold)"
|
||||||
|
>
|
||||||
|
{label}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</DetailName>
|
||||||
|
<DetailValue
|
||||||
|
component={TextListItemVariants.dd}
|
||||||
|
fullWidth
|
||||||
|
css="grid-column: 1 / -1; margin-top: -20px"
|
||||||
|
>
|
||||||
|
<CodeMirrorInput
|
||||||
|
mode="json"
|
||||||
|
value={JSON.stringify(value)}
|
||||||
|
readOnly
|
||||||
|
rows={rows}
|
||||||
|
fullHeight={fullHeight}
|
||||||
|
css="margin-top: 10px"
|
||||||
|
/>
|
||||||
|
</DetailValue>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
ObjectDetail.propTypes = {
|
||||||
|
value: shape.isRequired,
|
||||||
|
label: node.isRequired,
|
||||||
|
rows: number,
|
||||||
|
};
|
||||||
|
ObjectDetail.defaultProps = {
|
||||||
|
rows: null,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ObjectDetail;
|
||||||
@@ -3,3 +3,4 @@ export { default as Detail, DetailName, DetailValue } from './Detail';
|
|||||||
export { default as DeletedDetail } from './DeletedDetail';
|
export { default as DeletedDetail } from './DeletedDetail';
|
||||||
export { default as UserDateDetail } from './UserDateDetail';
|
export { default as UserDateDetail } from './UserDateDetail';
|
||||||
export { default as DetailBadge } from './DetailBadge';
|
export { default as DetailBadge } from './DetailBadge';
|
||||||
|
export { default as ObjectDetail } from './ObjectDetail';
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import {
|
|||||||
Detail,
|
Detail,
|
||||||
DetailList,
|
DetailList,
|
||||||
DeletedDetail,
|
DeletedDetail,
|
||||||
|
ObjectDetail,
|
||||||
} from '../../../components/DetailList';
|
} from '../../../components/DetailList';
|
||||||
import DeleteButton from '../../../components/DeleteButton';
|
import DeleteButton from '../../../components/DeleteButton';
|
||||||
import ErrorDetail from '../../../components/ErrorDetail';
|
import ErrorDetail from '../../../components/ErrorDetail';
|
||||||
@@ -310,11 +311,12 @@ function NotificationTemplateDetail({ i18n, template }) {
|
|||||||
value={configuration.http_method}
|
value={configuration.http_method}
|
||||||
dataCy="nt-detail-webhook-http-method"
|
dataCy="nt-detail-webhook-http-method"
|
||||||
/>
|
/>
|
||||||
{/* <Detail
|
<ObjectDetail
|
||||||
label={i18n._(t`HTTP Headers`)}
|
label={i18n._(t`HTTP Headers`)}
|
||||||
value={configuration.headers}
|
value={configuration.headers}
|
||||||
|
rows="6"
|
||||||
dataCy="nt-detail-webhook-headers"
|
dataCy="nt-detail-webhook-headers"
|
||||||
/> */}
|
/>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</DetailList>
|
</DetailList>
|
||||||
|
|||||||
Reference in New Issue
Block a user