Adding the ability to not render the change events tab for the PD card when viewing an entity
Signed-off-by: Chris James <chris@lattice.com>
This commit is contained in:
@@ -30,12 +30,19 @@ export const isPluginApplicableToEntity = (entity: Entity) =>
|
||||
/** @public */
|
||||
export type EntityPagerDutyCardProps = {
|
||||
readOnly?: boolean;
|
||||
disableChangeEvents?: boolean;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export const EntityPagerDutyCard = (props: EntityPagerDutyCardProps) => {
|
||||
const { readOnly } = props;
|
||||
const { readOnly, disableChangeEvents } = props;
|
||||
const { entity } = useEntity();
|
||||
const pagerDutyEntity = getPagerDutyEntity(entity);
|
||||
return <PagerDutyCard {...pagerDutyEntity} readOnly={readOnly} />;
|
||||
return (
|
||||
<PagerDutyCard
|
||||
{...pagerDutyEntity}
|
||||
readOnly={readOnly}
|
||||
disableChangeEvents={disableChangeEvents}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -46,11 +46,12 @@ const BasicCard = ({ children }: { children: ReactNode }) => (
|
||||
/** @public */
|
||||
export type PagerDutyCardProps = PagerDutyEntity & {
|
||||
readOnly?: boolean;
|
||||
disableChangeEvents?: boolean;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export const PagerDutyCard = (props: PagerDutyCardProps) => {
|
||||
const { readOnly, integrationKey, name } = props;
|
||||
const { readOnly, disableChangeEvents, integrationKey, name } = props;
|
||||
const api = useApi(pagerDutyApiRef);
|
||||
const [refreshIncidents, setRefreshIncidents] = useState<boolean>(false);
|
||||
const [refreshChangeEvents, setRefreshChangeEvents] =
|
||||
@@ -169,12 +170,16 @@ export const PagerDutyCard = (props: PagerDutyCardProps) => {
|
||||
refreshIncidents={refreshIncidents}
|
||||
/>
|
||||
</CardTab>
|
||||
<CardTab label="Change Events">
|
||||
<ChangeEvents
|
||||
serviceId={service!.id}
|
||||
refreshEvents={refreshChangeEvents}
|
||||
/>
|
||||
</CardTab>
|
||||
<>
|
||||
{disableChangeEvents === true && (
|
||||
<CardTab label="Change Events">
|
||||
<ChangeEvents
|
||||
serviceId={service!.id}
|
||||
refreshEvents={refreshChangeEvents}
|
||||
/>
|
||||
</CardTab>
|
||||
)}
|
||||
</>
|
||||
</TabbedCard>
|
||||
<EscalationPolicy policyId={service!.policyId} />
|
||||
</CardContent>
|
||||
|
||||
Reference in New Issue
Block a user