fix: use CatalogModelSources.static for model registration
Signed-off-by: benjdlambert <ben@blam.sh>
This commit is contained in:
+3
-8
@@ -117,24 +117,19 @@ export const isSkillAIResourceEntity = (
|
||||
): entity is SkillAIResourceEntityV1alpha1 =>
|
||||
isAIResourceEntity(entity) && entity.spec?.type === 'skill';
|
||||
|
||||
/**
|
||||
* Extends the catalog model with the AIResource kind.
|
||||
*
|
||||
* @alpha
|
||||
*/
|
||||
const baseRelationFields = [
|
||||
{
|
||||
selector: { path: 'spec.owner' },
|
||||
relation: 'ownedBy',
|
||||
defaultKind: 'Group',
|
||||
defaultNamespace: 'inherit' as const,
|
||||
defaultNamespace: 'inherit',
|
||||
allowedKinds: ['Group', 'User'],
|
||||
},
|
||||
{
|
||||
selector: { path: 'spec.system' },
|
||||
relation: 'partOf',
|
||||
defaultKind: 'System',
|
||||
defaultNamespace: 'inherit' as const,
|
||||
defaultNamespace: 'inherit',
|
||||
},
|
||||
];
|
||||
|
||||
@@ -172,7 +167,7 @@ export const aiResourceEntityModel = createCatalogModelLayer({
|
||||
selector: { path: 'spec.dependsOn' },
|
||||
relation: 'dependsOn',
|
||||
defaultKind: 'AIResource',
|
||||
defaultNamespace: 'inherit' as const,
|
||||
defaultNamespace: 'inherit',
|
||||
},
|
||||
],
|
||||
schema: {
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
|
||||
import { createBackendModule } from '@backstage/backend-plugin-api';
|
||||
import { CatalogModelSources } from '@backstage/catalog-model/alpha';
|
||||
import { catalogModelExtensionPoint } from '@backstage/plugin-catalog-node/alpha';
|
||||
import { aiResourceEntityModel } from './AIResourceEntityV1alpha1';
|
||||
|
||||
@@ -32,11 +33,9 @@ export const catalogModuleAIResourceEntityModel = createBackendModule({
|
||||
model: catalogModelExtensionPoint,
|
||||
},
|
||||
async init({ model }) {
|
||||
model.addModelSource({
|
||||
async *read() {
|
||||
yield { data: [{ layer: aiResourceEntityModel }] };
|
||||
},
|
||||
});
|
||||
model.addModelSource(
|
||||
CatalogModelSources.static([aiResourceEntityModel]),
|
||||
);
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user