/*! Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0 */
import { EntityCreatedKV, EntityUpdatedKV, SqlViewer } from '$common/components';
import { GOVERNABLE_GROUPS } from '$common/entity/ontology';
import { OntologyIdentifier } from '@ada/api';
import { Skeletons, SummarySection } from '$northstar-plus/components';
import { SummaryRenderer } from '$northstar-plus/components/SummaryRenderer';
import { apiHooks } from '$api';
import { groupDisplayName } from '$common/entity/group/utils';
import { isEmpty, startCase, upperCase } from 'lodash';
import { ontologyLensDisplay } from '$common/utils';
import { useI18nContext } from '$strings';
import { useOntologyGovernance } from '../hooks';
import React from 'react';
export const OntologySummary: React.FC<{ id: OntologyIdentifier }> = ({ id }) => {
const { LL } = useI18nContext();
const [ontology] = apiHooks.useOntology(id);
const [governance] = useOntologyGovernance(id);
if (ontology == null || governance == null) {
return ;
}
return (
name),
},
],
[
{
value: ,
},
{
value: ,
},
],
],
},
{
title: LL.VIEW.GOVERNANCE.summary.section.defaultGovernance.title(),
subtitle: LL.VIEW.GOVERNANCE.summary.section.defaultGovernance.subtitle(),
properties: [
{
label: LL.ENTITY['Ontology@'].defaultLens.label(),
value: ontology.defaultLens && upperCase(ontology.defaultLens),
},
],
},
...GOVERNABLE_GROUPS.map((groupId): SummarySection => {
const { column, row } = governance[groupId];
return {
title: LL.VIEW.GOVERNANCE.summary.section.groupGovernance.title({
group: groupDisplayName(groupId),
}),
subtitle: LL.VIEW.GOVERNANCE.summary.section.groupGovernance.subtitle({
group: groupDisplayName(groupId),
}),
properties: [
{
label: LL.ENTITY.AttributePolicy(),
value: column && ontologyLensDisplay(column, ontology.defaultLens),
},
{
label: LL.ENTITY.AttributeValuePolicy(),
value: isEmpty(row) ? null : (
),
},
],
};
}),
]}
/>
);
};