From dc0d284419732fde05aa4c1dbecf71a1bb3ec3ca Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Mon, 5 Aug 2024 09:53:54 +0200 Subject: [PATCH] backend-plugin-api: fix feature loader description Signed-off-by: Patrik Oldsberg --- .../src/wiring/createBackendFeatureLoader.ts | 3 ++- .../src/wiring/describeParentCallSite.ts | 20 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 packages/backend-plugin-api/src/wiring/describeParentCallSite.ts diff --git a/packages/backend-plugin-api/src/wiring/createBackendFeatureLoader.ts b/packages/backend-plugin-api/src/wiring/createBackendFeatureLoader.ts index de26b5154d..cfa3e96c65 100644 --- a/packages/backend-plugin-api/src/wiring/createBackendFeatureLoader.ts +++ b/packages/backend-plugin-api/src/wiring/createBackendFeatureLoader.ts @@ -16,6 +16,7 @@ import { ServiceRef } from '../services'; import { BackendFeature } from '../types'; +import { describeParentCallSite } from './describeParentCallSite'; import { InternalBackendFeatureLoader } from './types'; /** @@ -47,7 +48,7 @@ export function createBackendFeatureLoader< $$type: '@backstage/BackendFeature', version: 'v1', featureType: 'loader', - description: `created at '${new Date().toISOString()}'`, + description: `created at '${describeParentCallSite()}'`, deps: options.deps, async loader(deps: TDeps) { const it = await options.loader(deps); diff --git a/packages/backend-plugin-api/src/wiring/describeParentCallSite.ts b/packages/backend-plugin-api/src/wiring/describeParentCallSite.ts new file mode 100644 index 0000000000..35603e33b0 --- /dev/null +++ b/packages/backend-plugin-api/src/wiring/describeParentCallSite.ts @@ -0,0 +1,20 @@ +/* + * Copyright 2023 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Single re-export to avoid doing this import in multiple places, but still +// avoid duplicate declarations because this one is a bit tricky. +// eslint-disable-next-line @backstage/no-relative-monorepo-imports +export { describeParentCallSite } from '../../../frontend-plugin-api/src/routing/describeParentCallSite';