Merge pull request #12474 from sblausten/extend-fact-retriever-model

Extend FactRetriever model so we can represent them in the UI
This commit is contained in:
Patrik Oldsberg
2022-07-07 09:47:22 +02:00
committed by GitHub
7 changed files with 29 additions and 0 deletions
+6
View File
@@ -0,0 +1,6 @@
---
'@backstage/plugin-tech-insights-node': patch
'@backstage/plugin-tech-insights-backend': patch
---
The `FactRetriever` model has been extended by adding optional title and description fields, allowing you to display them in the UI.
@@ -36,6 +36,8 @@ jest.useFakeTimers();
const testFactRetriever: FactRetriever = {
id: 'test_factretriever',
version: '0.0.1',
title: 'Test 1',
description: 'testing',
entityFilter: [{ kind: 'component' }],
schema: {
testnumberfact: {
@@ -30,6 +30,9 @@ import isEmpty from 'lodash/isEmpty';
export const entityMetadataFactRetriever: FactRetriever = {
id: 'entityMetadataFactRetriever',
version: '0.0.1',
title: 'Entity Metadata',
description:
'Generates facts which indicate the completeness of entity metadata',
schema: {
hasTitle: {
type: 'boolean',
@@ -29,6 +29,9 @@ import { Entity } from '@backstage/catalog-model';
export const entityOwnershipFactRetriever: FactRetriever = {
id: 'entityOwnershipFactRetriever',
version: '0.0.1',
title: 'Entity Ownership',
description:
'Generates facts which indicate the quality of data in the spec.owner field',
entityFilter: [
{ kind: ['component', 'domain', 'system', 'api', 'resource', 'template'] },
],
@@ -34,6 +34,9 @@ const techdocsAnnotationFactName =
export const techdocsFactRetriever: FactRetriever = {
id: 'techdocsFactRetriever',
version: '0.0.1',
title: 'Tech Docs',
description:
'Generates facts related to the completeness of techdocs configuration for entities',
schema: {
[techdocsAnnotationFactName]: {
type: 'boolean',
+2
View File
@@ -46,12 +46,14 @@ export type FactLifecycle = TTL | MaxItems;
// @public
export interface FactRetriever {
description?: string;
entityFilter?:
| Record<string, string | symbol | (string | symbol)[]>[]
| Record<string, string | symbol | (string | symbol)[]>;
handler: (ctx: FactRetrieverContext) => Promise<TechInsightFact[]>;
id: string;
schema: FactSchema;
title?: string;
version: string;
}
+10
View File
@@ -174,6 +174,16 @@ export interface FactRetriever {
*/
version: string;
/**
* A short display title for the fact retriever to be used in the interface
*/
title?: string;
/**
* A short display description for the fact retriever to be used in the interface.
*/
description?: string;
/**
* Handler function that needs to be implemented to retrieve fact values for entities.
*