From e1ebaff47a1f6e73437495eb1d6da6d015431012 Mon Sep 17 00:00:00 2001 From: Andre Wanlin Date: Sun, 24 Oct 2021 08:09:00 -0500 Subject: [PATCH] Removed router Signed-off-by: Andre Wanlin --- .../azure-devops/src/components/Router.tsx | 43 ------------------- plugins/azure-devops/src/index.ts | 7 ++- plugins/azure-devops/src/plugin.ts | 15 +++++-- 3 files changed, 17 insertions(+), 48 deletions(-) delete mode 100644 plugins/azure-devops/src/components/Router.tsx diff --git a/plugins/azure-devops/src/components/Router.tsx b/plugins/azure-devops/src/components/Router.tsx deleted file mode 100644 index 3000deb5cc..0000000000 --- a/plugins/azure-devops/src/components/Router.tsx +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2021 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. - */ -import React from 'react'; -import { Routes, Route } from 'react-router'; -import { azureDevOpsRouteRef } from '../routes'; -import { EntityPageAzurePipelines } from './EntityPageAzurePipelines'; -import { AZURE_DEVOPS_ANNOTATION } from '../constants'; -import { Entity } from '@backstage/catalog-model'; -import { useEntity } from '@backstage/plugin-catalog-react'; -import { MissingAnnotationEmptyState } from '@backstage/core-components'; - -export const isAzureDevOpsAvailable = (entity: Entity) => - Boolean(entity.metadata.annotations?.[AZURE_DEVOPS_ANNOTATION]); - -export const Router = ({ defaultLimit }: { defaultLimit?: number }) => { - const { entity } = useEntity(); - - if (!isAzureDevOpsAvailable(entity)) { - return ; - } - - return ( - - } - /> - - ); -}; diff --git a/plugins/azure-devops/src/index.ts b/plugins/azure-devops/src/index.ts index 9a90d6ed6a..71d3b654fe 100644 --- a/plugins/azure-devops/src/index.ts +++ b/plugins/azure-devops/src/index.ts @@ -13,5 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -export { azureDevOpsPlugin, EntityAzurePipelinesContent } from './plugin'; -export { isAzureDevOpsAvailable } from './components/Router'; +export { + azureDevOpsPlugin, + EntityAzurePipelinesContent, + isAzureDevOpsAvailable, +} from './plugin'; diff --git a/plugins/azure-devops/src/plugin.ts b/plugins/azure-devops/src/plugin.ts index 1cf6e680d0..ab6d816460 100644 --- a/plugins/azure-devops/src/plugin.ts +++ b/plugins/azure-devops/src/plugin.ts @@ -14,8 +14,6 @@ * limitations under the License. */ -import { azureDevOpsApiRef } from './api/AzureDevOpsApi'; -import { AzureDevOpsClient } from './api/AzureDevOpsClient'; import { createApiFactory, createPlugin, @@ -23,8 +21,16 @@ import { discoveryApiRef, identityApiRef, } from '@backstage/core-plugin-api'; + +import { AZURE_DEVOPS_ANNOTATION } from './constants'; +import { AzureDevOpsClient } from './api/AzureDevOpsClient'; +import { Entity } from '@backstage/catalog-model'; +import { azureDevOpsApiRef } from './api/AzureDevOpsApi'; import { azureDevOpsRouteRef } from './routes'; +export const isAzureDevOpsAvailable = (entity: Entity) => + Boolean(entity.metadata.annotations?.[AZURE_DEVOPS_ANNOTATION]); + export const azureDevOpsPlugin = createPlugin({ id: 'azureDevOps', apis: [ @@ -43,7 +49,10 @@ export const azureDevOpsPlugin = createPlugin({ export const EntityAzurePipelinesContent = azureDevOpsPlugin.provide( createRoutableExtension({ name: 'EntityAzurePipelinesContent', - component: () => import('./components/Router').then(m => m.Router), + component: () => + import('./components/EntityPageAzurePipelines').then( + m => m.EntityPageAzurePipelines, + ), mountPoint: azureDevOpsRouteRef, }), );