fixed yarn.lock
build api-report's changed annotation to match 'arm' name prettier applied Signed-off-by: Wesley <wpattison08@gmail.com>
This commit is contained in:
@@ -4,4 +4,4 @@
|
||||
'@backstage/plugin-azure-common': minor
|
||||
---
|
||||
|
||||
Azure Functions Plugin support based on annotation supplied by the entity.
|
||||
Generic azure plugin based on an annotation supplied by a given entity.
|
||||
|
||||
@@ -70,9 +70,7 @@ Here's how to get the backend plugin up and running:
|
||||
async function main() {
|
||||
// ...
|
||||
// Add this line under the other lines that follow the useHotMemoize pattern
|
||||
const azureEnv = useHotMemoize(module, () =>
|
||||
createEnv('azure'),
|
||||
);
|
||||
const azureEnv = useHotMemoize(module, () => createEnv('azure'));
|
||||
|
||||
// ...
|
||||
// Insert this line under the other lines that add their routers to apiRouter in the same way
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
## API Report File for "@backstage/plugin-azure-backend"
|
||||
|
||||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
||||
|
||||
```ts
|
||||
import { Config } from '@backstage/config';
|
||||
import express from 'express';
|
||||
import { Logger } from 'winston';
|
||||
import { SiteList } from '@backstage/plugin-azure-common';
|
||||
|
||||
// @public (undocumented)
|
||||
export class AzureConfig {
|
||||
constructor(
|
||||
domain: string,
|
||||
tenantId: string,
|
||||
subscriptions?: string[] | undefined,
|
||||
clientId?: string | undefined,
|
||||
clientSecret?: string | undefined,
|
||||
);
|
||||
// (undocumented)
|
||||
readonly clientId?: string | undefined;
|
||||
// (undocumented)
|
||||
readonly clientSecret?: string | undefined;
|
||||
// (undocumented)
|
||||
readonly domain: string;
|
||||
// (undocumented)
|
||||
static fromConfig(config: Config): AzureConfig;
|
||||
// (undocumented)
|
||||
readonly subscriptions?: string[] | undefined;
|
||||
// (undocumented)
|
||||
readonly tenantId: string;
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
export class AzureSitesApi {
|
||||
constructor(config: AzureConfig);
|
||||
// (undocumented)
|
||||
static fromConfig(config: Config): AzureSitesApi;
|
||||
// (undocumented)
|
||||
list({ name }: { name: string }): Promise<SiteList>;
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
export function createRouter(options: RouterOptions): Promise<express.Router>;
|
||||
|
||||
// @public (undocumented)
|
||||
export interface RouterOptions {
|
||||
// (undocumented)
|
||||
azureSitesApi: AzureSitesApi;
|
||||
// (undocumented)
|
||||
logger: Logger;
|
||||
}
|
||||
|
||||
// (No @packageDocumentation comment for this package)
|
||||
```
|
||||
@@ -38,7 +38,7 @@
|
||||
"@backstage/backend-common": "^0.15.1-next.3",
|
||||
"@backstage/config": "^1.0.2-next.0",
|
||||
"@backstage/plugin-azure-common": "^0.0.0",
|
||||
"@types/express": "*",
|
||||
"@types/express": "^4.17.6",
|
||||
"express": "^4.17.1",
|
||||
"express-promise-router": "^4.1.0",
|
||||
"node-fetch": "^2.6.7",
|
||||
@@ -46,9 +46,9 @@
|
||||
"yn": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/cli": "^0.19.0-next.2",
|
||||
"@backstage/cli": "^0.19.0-next.3",
|
||||
"@types/supertest": "^2.0.8",
|
||||
"msw": "^0.44.0"
|
||||
"msw": "^0.47.0"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
|
||||
@@ -16,3 +16,4 @@
|
||||
|
||||
export * from './service/router';
|
||||
export * from './api';
|
||||
export * from './config';
|
||||
|
||||
@@ -10,9 +10,9 @@ _Inspired by [roadie.io AWS Lamda plugin](https://roadie.io/backstage/plugins/aw
|
||||
|
||||
## Plugin Setup
|
||||
|
||||
The following sections will help you get the Azure Functions plugin setup and running
|
||||
The following sections will help you get the Azure plugin setup and running
|
||||
|
||||
### Azure Functions Backend
|
||||
### Azure Backend
|
||||
|
||||
You need to set up the Azure backend plugin before you move forward with any of these steps if you haven't already.
|
||||
|
||||
@@ -21,10 +21,10 @@ You need to set up the Azure backend plugin before you move forward with any of
|
||||
To be able to use the Azure plugin you need to add the following annotation to any entities you want to use it with:
|
||||
|
||||
```yaml
|
||||
portal.azure.com/resource-name: <resource-name>
|
||||
azure.com/microsoft.web/sites: <name>
|
||||
```
|
||||
|
||||
`<resource-name>` can be an exact or partial name for the site.
|
||||
`<name>` supports case-insensitive exact / partial value.
|
||||
|
||||
Example of Partial Matching:
|
||||
|
||||
@@ -39,7 +39,7 @@ func-testapp-us
|
||||
The annotation you will use to have the three functions' app appear in the overview table would look like this:
|
||||
|
||||
```yaml
|
||||
portal.azure.com/resource-name: func-testapp
|
||||
azure.com/microsoft.web/sites: func-testapp
|
||||
```
|
||||
|
||||
### Install the component
|
||||
@@ -54,14 +54,14 @@ yarn add @backstage/plugin-azure
|
||||
|
||||
```ts
|
||||
// In packages/app/src/components/catalog/EntityPage.tsx
|
||||
import { EntityAzureSitesOverviewWidget, isAzureResourceNameAvailable } from '@backstage/plugin-azure';
|
||||
import { EntityAzureSitesOverviewWidget, isAzureWebSiteNameAvailable } from '@backstage/plugin-azure';
|
||||
|
||||
...
|
||||
|
||||
const serviceEntityPage = (
|
||||
<EntityLayout>
|
||||
//...
|
||||
<EntityLayout.Route if={e => Boolean(isAzureResourceNameAvailable(e))} path="/azure" title="Azure">
|
||||
<EntityLayout.Route if={e => Boolean(isAzureWebSiteNameAvailable(e))} path="/azure" title="Azure">
|
||||
<EntityAzureSitesOverviewWidget />
|
||||
</EntityLayout.Route>
|
||||
//...
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
## API Report File for "@backstage/plugin-azure"
|
||||
|
||||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
||||
|
||||
```ts
|
||||
/// <reference types="react" />
|
||||
|
||||
import { ApiRef } from '@backstage/core-plugin-api';
|
||||
import { BackstagePlugin } from '@backstage/core-plugin-api';
|
||||
import { DiscoveryApi } from '@backstage/core-plugin-api';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { IdentityApi } from '@backstage/core-plugin-api';
|
||||
import { RouteRef } from '@backstage/core-plugin-api';
|
||||
import { SiteList } from '@backstage/plugin-azure-common';
|
||||
|
||||
// @public (undocumented)
|
||||
export const azureSiteApiRef: ApiRef<AzureSitesApi>;
|
||||
|
||||
// @public (undocumented)
|
||||
export type AzureSitesApi = {
|
||||
list: ({ name }: { name: string }) => Promise<SiteList>;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export class AzureSitesApiBackendClient implements AzureSitesApi {
|
||||
constructor(options: {
|
||||
discoveryApi: DiscoveryApi;
|
||||
identityApi: IdentityApi;
|
||||
});
|
||||
// (undocumented)
|
||||
list({ name }: { name: string }): Promise<SiteList>;
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
export const AzureSitesOverviewWidget: () => JSX.Element;
|
||||
|
||||
// @public (undocumented)
|
||||
export const azureSitesPlugin: BackstagePlugin<
|
||||
{
|
||||
entityContent: RouteRef<undefined>;
|
||||
},
|
||||
{},
|
||||
{}
|
||||
>;
|
||||
|
||||
// @public (undocumented)
|
||||
export const EntityAzureSitesOverviewWidget: () => JSX.Element;
|
||||
|
||||
// @public (undocumented)
|
||||
export const entityContentRouteRef: RouteRef<undefined>;
|
||||
|
||||
// @public (undocumented)
|
||||
export const isAzureWebSiteNameAvailable: (
|
||||
entity: Entity,
|
||||
) => string | undefined;
|
||||
|
||||
// (No @packageDocumentation comment for this package)
|
||||
```
|
||||
+11
-12
@@ -34,32 +34,31 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@backstage/catalog-model": "^1.1.1-next.0",
|
||||
"@backstage/core-components": "^0.11.1-next.2",
|
||||
"@backstage/core-plugin-api": "^1.0.6-next.2",
|
||||
"@backstage/core-components": "^0.11.1-next.3",
|
||||
"@backstage/core-plugin-api": "^1.0.6-next.3",
|
||||
"@backstage/plugin-azure-common": "^0.0.0",
|
||||
"@backstage/plugin-catalog-react": "^1.1.4-next.1",
|
||||
"@backstage/plugin-catalog-react": "^1.1.4-next.2",
|
||||
"@backstage/theme": "^0.2.16",
|
||||
"@material-ui/core": "^4.9.13",
|
||||
"@material-ui/core": "^4.12.2",
|
||||
"@material-ui/icons": "^4.9.1",
|
||||
"@material-ui/lab": "4.0.0-alpha.57",
|
||||
"luxon": "^3.0.3",
|
||||
"luxon": "^3.0.0",
|
||||
"react-use": "^17.2.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^16.13.1 || ^17.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/cli": "^0.19.0-next.2",
|
||||
"@backstage/core-app-api": "^1.1.0-next.2",
|
||||
"@backstage/dev-utils": "^1.0.6-next.1",
|
||||
"@backstage/test-utils": "^1.2.0-next.2",
|
||||
"@backstage/cli": "^0.19.0-next.3",
|
||||
"@backstage/core-app-api": "^1.1.0-next.3",
|
||||
"@backstage/dev-utils": "^1.0.6-next.2",
|
||||
"@backstage/test-utils": "^1.2.0-next.3",
|
||||
"@testing-library/jest-dom": "^5.10.1",
|
||||
"@testing-library/react": "^12.1.3",
|
||||
"@testing-library/user-event": "^14.0.0",
|
||||
"@types/jest": "*",
|
||||
"@types/node": "*",
|
||||
"@types/node": "^16.11.26",
|
||||
"cross-fetch": "^3.1.5",
|
||||
"msw": "^0.44.0"
|
||||
"msw": "^0.47.0"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
|
||||
@@ -18,7 +18,7 @@ import React from 'react';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { useSites } from '../../hooks/useSites';
|
||||
import {
|
||||
AZURE_RESOURCE_NAME_ANNOTATION,
|
||||
AZURE_WEB_SITE_NAME_ANNOTATION,
|
||||
useServiceEntityAnnotations,
|
||||
} from '../../hooks/useServiceEntityAnnotations';
|
||||
import {
|
||||
@@ -30,14 +30,14 @@ import { useEntity } from '@backstage/plugin-catalog-react';
|
||||
import { AzureSitesOverviewTable } from '../AzureSitesOverviewTableComponent/AzureSitesOverviewTable';
|
||||
|
||||
/** @public */
|
||||
export const isAzureResourceNameAvailable = (entity: Entity) =>
|
||||
entity?.metadata.annotations?.[AZURE_RESOURCE_NAME_ANNOTATION];
|
||||
export const isAzureWebSiteNameAvailable = (entity: Entity) =>
|
||||
entity?.metadata.annotations?.[AZURE_WEB_SITE_NAME_ANNOTATION];
|
||||
|
||||
const AzureSitesOverview = ({ entity }: { entity: Entity }) => {
|
||||
const { resourceName } = useServiceEntityAnnotations(entity);
|
||||
const { webSiteName } = useServiceEntityAnnotations(entity);
|
||||
|
||||
const [sites] = useSites({
|
||||
name: resourceName,
|
||||
name: webSiteName,
|
||||
});
|
||||
|
||||
if (sites.error) {
|
||||
@@ -60,10 +60,10 @@ const AzureSitesOverview = ({ entity }: { entity: Entity }) => {
|
||||
export const AzureSitesOverviewWidget = () => {
|
||||
const { entity } = useEntity();
|
||||
|
||||
if (!isAzureResourceNameAvailable(entity)) {
|
||||
if (!isAzureWebSiteNameAvailable(entity)) {
|
||||
return (
|
||||
<MissingAnnotationEmptyState
|
||||
annotation={AZURE_RESOURCE_NAME_ANNOTATION}
|
||||
annotation={AZURE_WEB_SITE_NAME_ANNOTATION}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -16,12 +16,12 @@
|
||||
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
|
||||
export const AZURE_RESOURCE_NAME_ANNOTATION = 'portal.azure.com/resource-name';
|
||||
export const AZURE_WEB_SITE_NAME_ANNOTATION = 'azure.com/microsoft.web/sites';
|
||||
export const useServiceEntityAnnotations = (entity: Entity) => {
|
||||
const resourceName =
|
||||
entity?.metadata.annotations?.[AZURE_RESOURCE_NAME_ANNOTATION] ?? '';
|
||||
const webSiteName =
|
||||
entity?.metadata.annotations?.[AZURE_WEB_SITE_NAME_ANNOTATION] ?? '';
|
||||
|
||||
return {
|
||||
resourceName,
|
||||
webSiteName,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -20,7 +20,7 @@ export const entityMock = {
|
||||
metadata: {
|
||||
namespace: 'default',
|
||||
annotations: {
|
||||
'portal.azure.com/resource-name': 'func-mock',
|
||||
'azure.com/microsoft.web/sites': 'func-mock',
|
||||
},
|
||||
name: 'sample-azure-service',
|
||||
description: 'A service for testing Backstage functionality.',
|
||||
|
||||
Reference in New Issue
Block a user