From b518ac451e8bb33c1b3295daad2c5fe7f3b66120 Mon Sep 17 00:00:00 2001 From: Wesley Date: Mon, 12 Sep 2022 05:03:33 +0200 Subject: [PATCH] yarn run prettier --write applied Signed-off-by: Wesley --- plugins/azure-functions-backend/README.md | 71 +++++----- plugins/azure-functions-backend/schema.d.ts | 36 ++--- .../src/api/AzureWebManagementApi.ts | 133 ++++++++++-------- .../azure-functions-backend/src/api/index.ts | 7 +- .../azure-functions-backend/src/api/types.ts | 22 +-- plugins/azure-functions-backend/src/index.ts | 2 +- .../src/service/router.ts | 6 +- .../src/service/standaloneServer.ts | 9 +- plugins/azure-functions/README.md | 4 +- plugins/azure-functions/dev/index.tsx | 4 +- .../src/api/AzureFunctionsBackendClient.ts | 9 +- plugins/azure-functions/src/api/index.ts | 2 +- plugins/azure-functions/src/api/types.ts | 18 +-- .../AzureFunctionsOverview.tsx | 15 +- .../OverviewTable.test.tsx | 15 +- .../OverviewTableComponent/OverviewTable.tsx | 28 ++-- .../azure-functions/src/hooks/useFunctions.ts | 11 +- .../src/hooks/useServiceEntityAnnotations.ts | 2 +- plugins/azure-functions/src/index.ts | 2 +- plugins/azure-functions/src/mocks/mocks.ts | 22 +-- plugins/azure-functions/src/plugin.ts | 12 +- 21 files changed, 232 insertions(+), 198 deletions(-) diff --git a/plugins/azure-functions-backend/README.md b/plugins/azure-functions-backend/README.md index 5bfc6a1062..abe1a7b148 100644 --- a/plugins/azure-functions-backend/README.md +++ b/plugins/azure-functions-backend/README.md @@ -2,7 +2,7 @@ Simple plugin that proxies requests to the Azure Portal API through Azure SDK JavaScript libraries. -*Inspired by [roadie.io AWS Lamda plugin](https://roadie.io/backstage/plugins/aws-lambda/)* +_Inspired by [roadie.io AWS Lamda plugin](https://roadie.io/backstage/plugins/aws-lambda/)_ ## Setup @@ -36,47 +36,52 @@ Here's how to get the backend plugin up and running: 1. First we need to add the `@backstage/plugin-azure-functions-backend` package to your backend: - ```sh - # From the Backstage root directory - cd packages/backend - yarn add @backstage/plugin-azure-functions-backend - ``` + ```sh + # From the Backstage root directory + cd packages/backend + yarn add @backstage/plugin-azure-functions-backend + ``` 2. Then we will create a new file named `packages/backend/src/plugins/azure-functions.ts`, and add the following to it: - ```ts - import { createRouter, AzureWebManagementApi } from '@backstage/plugin-azure-functions-backend'; - import { Router } from 'express'; - import { PluginEnvironment } from '../types'; + ```ts + import { + createRouter, + AzureWebManagementApi, + } from '@backstage/plugin-azure-functions-backend'; + import { Router } from 'express'; + import { PluginEnvironment } from '../types'; - export default async function createPlugin( - env: PluginEnvironment, - ): Promise { - return await createRouter({ - logger: env.logger, - azureWebManagementApi: AzureWebManagementApi.fromConfig(env.config) - }); - } - ``` + export default async function createPlugin( + env: PluginEnvironment, + ): Promise { + return await createRouter({ + logger: env.logger, + azureWebManagementApi: AzureWebManagementApi.fromConfig(env.config), + }); + } + ``` 3. Next we wire this into the overall backend router, edit `packages/backend/src/index.ts`: - ```ts - import azureFunctions from './plugins/azure-functions'; + ```ts + import azureFunctions from './plugins/azure-functions'; - // Removed for clairty... + // Removed for clairty... - async function main() { - // ... - // Add this line under the other lines that follow the useHotMemoize pattern - const azureFunctionsEnv = useHotMemoize(module, () => createEnv('azureFunctions')); - - // ... - // Insert this line under the other lines that add their routers to apiRouter in the same way - apiRouter.use('/azure-functions', await azureFunctions(azureFunctionsEnv)); - } - ``` + async function main() { + // ... + // Add this line under the other lines that follow the useHotMemoize pattern + const azureFunctionsEnv = useHotMemoize(module, () => + createEnv('azureFunctions'), + ); + + // ... + // Insert this line under the other lines that add their routers to apiRouter in the same way + apiRouter.use('/azure-functions', await azureFunctions(azureFunctionsEnv)); + } + ``` 4. Now run `yarn start-backend` from the repo root. -5. Finally, open `http://localhost:7007/api/azure-functions/health` in a browser, it should return `{"status":"ok"}`. \ No newline at end of file +5. Finally, open `http://localhost:7007/api/azure-functions/health` in a browser, it should return `{"status":"ok"}`. diff --git a/plugins/azure-functions-backend/schema.d.ts b/plugins/azure-functions-backend/schema.d.ts index 192aac8477..529665c1eb 100644 --- a/plugins/azure-functions-backend/schema.d.ts +++ b/plugins/azure-functions-backend/schema.d.ts @@ -15,21 +15,23 @@ */ export interface Config { - azureFunctions: { + azureFunctions: { + /** @visibility backend */ + tenantId: string; + /** @visibility backend */ + clientId: string; + /** @visibility secret */ + clientSecret: string; + /** @visibility backend */ + domain: string; + /** @visibility backend */ + allowedSubscriptions: [ + { + /** @visibility backend */ + name: string; /** @visibility backend */ - tenantId: string; - /** @visibility backend */ - clientId: string; - /** @visibility secret */ - clientSecret: string; - /** @visibility backend */ - domain: string; - /** @visibility backend */ - allowedSubscriptions: [{ - /** @visibility backend */ - name: string; - /** @visibility backend */ - id: string; - }] - }; -} \ No newline at end of file + id: string; + }, + ]; + }; +} diff --git a/plugins/azure-functions-backend/src/api/AzureWebManagementApi.ts b/plugins/azure-functions-backend/src/api/AzureWebManagementApi.ts index bc8722c342..a756130977 100644 --- a/plugins/azure-functions-backend/src/api/AzureWebManagementApi.ts +++ b/plugins/azure-functions-backend/src/api/AzureWebManagementApi.ts @@ -17,69 +17,90 @@ import { Config } from '@backstage/config'; import { ClientSecretCredential } from '@azure/identity'; import { WebSiteManagementClient } from '@azure/arm-appservice'; -import { AzureFunctionsAllowedSubscriptionsConfig, FunctionsData } from './types'; +import { + AzureFunctionsAllowedSubscriptionsConfig, + FunctionsData, +} from './types'; export class AzureFunctionsConfig { - constructor(public readonly tenantId: string, public readonly clientId: string, public readonly clientSecret: string, public readonly domain: string, public readonly allowedSubscriptions: AzureFunctionsAllowedSubscriptionsConfig[]) { } + constructor( + public readonly tenantId: string, + public readonly clientId: string, + public readonly clientSecret: string, + public readonly domain: string, + public readonly allowedSubscriptions: AzureFunctionsAllowedSubscriptionsConfig[], + ) {} - static fromConfig(config: Config): AzureFunctionsConfig { - const azfConfig = config.getConfig('azureFunctions'); + static fromConfig(config: Config): AzureFunctionsConfig { + const azfConfig = config.getConfig('azureFunctions'); - return new AzureFunctionsConfig( - azfConfig.getString('tenantId'), - azfConfig.getString('clientId'), - azfConfig.getString('clientSecret'), - azfConfig.getString('domain'), - azfConfig.getConfigArray('allowedSubscriptions').map(as => ({ id: as.getString('id'), name: as.getString('name') })) - ) - } + return new AzureFunctionsConfig( + azfConfig.getString('tenantId'), + azfConfig.getString('clientId'), + azfConfig.getString('clientSecret'), + azfConfig.getString('domain'), + azfConfig + .getConfigArray('allowedSubscriptions') + .map(as => ({ + id: as.getString('id'), + name: as.getString('name'), + })), + ); + } } export class AzureWebManagementApi { - private readonly baseHref = (domain: string) => `https://portal.azure.com/#@${domain}/resource`; - private readonly clients: WebSiteManagementClient[] = []; + private readonly baseHref = (domain: string) => + `https://portal.azure.com/#@${domain}/resource`; + private readonly clients: WebSiteManagementClient[] = []; - constructor(private readonly config: AzureFunctionsConfig) { - const creds = new ClientSecretCredential(config.tenantId, config.clientId, config.clientSecret); - for (const subscription of config.allowedSubscriptions) { - if (!this.clients.some(c => c.subscriptionId === subscription.id)) { - this.clients.push(new WebSiteManagementClient(creds, subscription.id)); - } + constructor(private readonly config: AzureFunctionsConfig) { + const creds = new ClientSecretCredential( + config.tenantId, + config.clientId, + config.clientSecret, + ); + for (const subscription of config.allowedSubscriptions) { + if (!this.clients.some(c => c.subscriptionId === subscription.id)) { + this.clients.push(new WebSiteManagementClient(creds, subscription.id)); + } + } + } + + static fromConfig(config: Config): AzureWebManagementApi { + return new AzureWebManagementApi(AzureFunctionsConfig.fromConfig(config)); + } + + async list({ + functionName, + }: { + functionName: string; + }): Promise { + const results = []; + for (const client of this.clients) { + try { + for await (const webApp of client.webApps.list()) { + if (!webApp.name!.startsWith(functionName)) { + continue; + } + const v = webApp!; + results.push({ + href: `${this.baseHref(this.config.domain)}${v.id!}`, + logstreamHref: `${this.baseHref( + this.config.domain, + )}${v.id!}/logStream`, + functionName: v.name!, + location: v.location!, + lastModifiedDate: v.lastModifiedTimeUtc!, + usageState: v.usageState!, + state: v.state!, + containerSize: v.containerSize!, + }); } + } catch (ex) { + console.log(ex); + } } - - static fromConfig(config: Config): AzureWebManagementApi { - return new AzureWebManagementApi(AzureFunctionsConfig.fromConfig(config)); - } - - async list({ - functionName, - }: { - functionName: string; - }): Promise { - const results = []; - for (const client of this.clients) { - try { - for await (const webApp of client.webApps.list()) { - if (!webApp.name!.startsWith(functionName)) { - continue; - } - const v = webApp!; - results.push({ - href: `${this.baseHref(this.config.domain)}${v.id!}`, - logstreamHref: `${this.baseHref(this.config.domain)}${v.id!}/logStream`, - functionName: v.name!, - location: v.location!, - lastModifiedDate: v.lastModifiedTimeUtc!, - usageState: v.usageState!, - state: v.state!, - containerSize: v.containerSize! - }) - } - } catch (ex) { - console.log(ex); - } - } - return results; - } -} \ No newline at end of file + return results; + } +} diff --git a/plugins/azure-functions-backend/src/api/index.ts b/plugins/azure-functions-backend/src/api/index.ts index db2bb3de27..bcd78290a5 100644 --- a/plugins/azure-functions-backend/src/api/index.ts +++ b/plugins/azure-functions-backend/src/api/index.ts @@ -14,5 +14,8 @@ * limitations under the License. */ -export { AzureWebManagementApi, AzureFunctionsConfig } from './AzureWebManagementApi' -export * from './types' \ No newline at end of file +export { + AzureWebManagementApi, + AzureFunctionsConfig, +} from './AzureWebManagementApi'; +export * from './types'; diff --git a/plugins/azure-functions-backend/src/api/types.ts b/plugins/azure-functions-backend/src/api/types.ts index 7aa79aa081..c560689c0b 100644 --- a/plugins/azure-functions-backend/src/api/types.ts +++ b/plugins/azure-functions-backend/src/api/types.ts @@ -15,17 +15,17 @@ */ export interface AzureFunctionsAllowedSubscriptionsConfig { - name: string; - id: string; + name: string; + id: string; } export type FunctionsData = { - href: string; - logstreamHref: string; - functionName: string; - location: string; - state: string; - usageState: string; - containerSize: number; - lastModifiedDate: Date; -}; \ No newline at end of file + href: string; + logstreamHref: string; + functionName: string; + location: string; + state: string; + usageState: string; + containerSize: number; + lastModifiedDate: Date; +}; diff --git a/plugins/azure-functions-backend/src/index.ts b/plugins/azure-functions-backend/src/index.ts index 0e8cedac61..2746fa2c7c 100644 --- a/plugins/azure-functions-backend/src/index.ts +++ b/plugins/azure-functions-backend/src/index.ts @@ -15,4 +15,4 @@ */ export * from './service/router'; -export * from './api'; \ No newline at end of file +export * from './api'; diff --git a/plugins/azure-functions-backend/src/service/router.ts b/plugins/azure-functions-backend/src/service/router.ts index 9d23a1294a..eb4f218a76 100644 --- a/plugins/azure-functions-backend/src/service/router.ts +++ b/plugins/azure-functions-backend/src/service/router.ts @@ -39,7 +39,11 @@ export async function createRouter( response.send({ status: 'ok' }); }); router.post('/list', async (request, response) => { - response.json(await azureWebManagementApi.list({ functionName: request.body.functionName!.toString() })) + response.json( + await azureWebManagementApi.list({ + functionName: request.body.functionName!.toString(), + }), + ); }); router.use(errorHandler()); return router; diff --git a/plugins/azure-functions-backend/src/service/standaloneServer.ts b/plugins/azure-functions-backend/src/service/standaloneServer.ts index 12a76b2d44..0ccffb311c 100644 --- a/plugins/azure-functions-backend/src/service/standaloneServer.ts +++ b/plugins/azure-functions-backend/src/service/standaloneServer.ts @@ -14,7 +14,10 @@ * limitations under the License. */ -import { createServiceBuilder, loadBackendConfig } from '@backstage/backend-common'; +import { + createServiceBuilder, + loadBackendConfig, +} from '@backstage/backend-common'; import { Server } from 'http'; import { Logger } from 'winston'; import { AzureWebManagementApi } from '../api'; @@ -30,11 +33,11 @@ export async function startStandaloneServer( options: ServerOptions, ): Promise { const logger = options.logger.child({ service: 'azure-functions-backend' }); - const config = await loadBackendConfig({ logger, argv: process.argv }) + const config = await loadBackendConfig({ logger, argv: process.argv }); logger.debug('Starting application server...'); const router = await createRouter({ logger, - azureWebManagementApi: AzureWebManagementApi.fromConfig(config) + azureWebManagementApi: AzureWebManagementApi.fromConfig(config), }); let service = createServiceBuilder(module) diff --git a/plugins/azure-functions/README.md b/plugins/azure-functions/README.md index 77d08ee5cf..712c0b16ff 100644 --- a/plugins/azure-functions/README.md +++ b/plugins/azure-functions/README.md @@ -2,7 +2,7 @@ ![preview of Azure Functions table](docs/functions-table.png) -*Inspired by [roadie.io AWS Lamda plugin](https://roadie.io/backstage/plugins/aws-lambda/)* +_Inspired by [roadie.io AWS Lamda plugin](https://roadie.io/backstage/plugins/aws-lambda/)_ ## Features @@ -71,4 +71,4 @@ const serviceEntityPage = ( ## Roadmap -- [ ] Metrics \ No newline at end of file +- [ ] Metrics diff --git a/plugins/azure-functions/dev/index.tsx b/plugins/azure-functions/dev/index.tsx index d34ef19bc7..715418cb73 100644 --- a/plugins/azure-functions/dev/index.tsx +++ b/plugins/azure-functions/dev/index.tsx @@ -17,6 +17,4 @@ import { createDevApp } from '@backstage/dev-utils'; import { azureFunctionsPlugin } from '../src/plugin'; -createDevApp() - .registerPlugin(azureFunctionsPlugin) - .render(); +createDevApp().registerPlugin(azureFunctionsPlugin).render(); diff --git a/plugins/azure-functions/src/api/AzureFunctionsBackendClient.ts b/plugins/azure-functions/src/api/AzureFunctionsBackendClient.ts index 056528c946..a7676e3b17 100644 --- a/plugins/azure-functions/src/api/AzureFunctionsBackendClient.ts +++ b/plugins/azure-functions/src/api/AzureFunctionsBackendClient.ts @@ -19,7 +19,6 @@ import { FunctionsData } from './types'; import { DiscoveryApi, IdentityApi } from '@backstage/core-plugin-api'; export class AzureFunctionsBackendClient implements AzureFunctionsApi { - private readonly identityApi: IdentityApi; private readonly discoveryApi: DiscoveryApi; constructor(options: { @@ -36,7 +35,9 @@ export class AzureFunctionsBackendClient implements AzureFunctionsApi { functionName: string; }): Promise { try { - const url = `${await this.discoveryApi.getBaseUrl('azure-functions')}/list`; + const url = `${await this.discoveryApi.getBaseUrl( + 'azure-functions', + )}/list`; const { token: idToken } = await this.identityApi.getCredentials(); const response = await fetch(url, { method: 'POST', @@ -44,11 +45,11 @@ export class AzureFunctionsBackendClient implements AzureFunctionsApi { 'Content-Type': 'application/json', ...(idToken && { Authorization: `Bearer ${idToken}` }), }, - body: JSON.stringify({ functionName: functionName }) + body: JSON.stringify({ functionName: functionName }), }); return await response.json(); } catch (e: any) { - throw new Error('MissingAzureBackendException') + throw new Error('MissingAzureBackendException'); } } } diff --git a/plugins/azure-functions/src/api/index.ts b/plugins/azure-functions/src/api/index.ts index 14bb548361..4ea99fb412 100644 --- a/plugins/azure-functions/src/api/index.ts +++ b/plugins/azure-functions/src/api/index.ts @@ -16,4 +16,4 @@ export * from './AzureFunctionsApi'; export * from './AzureFunctionsBackendClient'; -export * from './types'; \ No newline at end of file +export * from './types'; diff --git a/plugins/azure-functions/src/api/types.ts b/plugins/azure-functions/src/api/types.ts index 4e6e18df32..0585db10e6 100644 --- a/plugins/azure-functions/src/api/types.ts +++ b/plugins/azure-functions/src/api/types.ts @@ -15,12 +15,12 @@ */ export type FunctionsData = { - href: string; - logstreamHref: string; - functionName: string; - location: string; - state: string; - usageState: string; - containerSize: number; - lastModifiedDate: Date; -}; \ No newline at end of file + href: string; + logstreamHref: string; + functionName: string; + location: string; + state: string; + usageState: string; + containerSize: number; + lastModifiedDate: Date; +}; diff --git a/plugins/azure-functions/src/components/AzureFunctionsOverviewComponent/AzureFunctionsOverview.tsx b/plugins/azure-functions/src/components/AzureFunctionsOverviewComponent/AzureFunctionsOverview.tsx index 2198940c31..61ebac0c96 100644 --- a/plugins/azure-functions/src/components/AzureFunctionsOverviewComponent/AzureFunctionsOverview.tsx +++ b/plugins/azure-functions/src/components/AzureFunctionsOverviewComponent/AzureFunctionsOverview.tsx @@ -33,11 +33,16 @@ const AzureFunctionsOverview = ({ entity }: { entity: Entity }) => { const { functionsName } = useServiceEntityAnnotations(entity); const [functionsData] = useFunctions({ - functionsName + functionsName, }); return ( - <> + <> + + ); }; @@ -45,12 +50,14 @@ export const AzureFunctionsOverviewWidget = () => { const { entity } = useEntity(); if (!isAzureFunctionsAvailable(entity)) { - return (); + return ( + + ); } return ( - ) + ); }; diff --git a/plugins/azure-functions/src/components/OverviewTableComponent/OverviewTable.test.tsx b/plugins/azure-functions/src/components/OverviewTableComponent/OverviewTable.test.tsx index 7a3ae48d7d..7642b76db2 100644 --- a/plugins/azure-functions/src/components/OverviewTableComponent/OverviewTable.test.tsx +++ b/plugins/azure-functions/src/components/OverviewTableComponent/OverviewTable.test.tsx @@ -28,9 +28,7 @@ import { TestApiProvider, } from '@backstage/test-utils'; import { setupServer } from 'msw/node'; -import { - functionResponseMock, -} from '../../mocks/mocks'; +import { functionResponseMock } from '../../mocks/mocks'; import { azureFunctionsApiRef } from '../..'; import { OverviewTable } from './OverviewTable'; @@ -60,19 +58,16 @@ describe('AzureFunctionsOverviewWidget', () => { beforeEach(() => { worker.use( - rest.post( - '/list', - (_, res, ctx) => { - res(ctx.json(functionResponseMock)); - }, - ), + rest.post('/list', (_, res, ctx) => { + res(ctx.json(functionResponseMock)); + }), ); }); it('should display an overview table with the data from the requests', async () => { const rendered = render( - + , ); diff --git a/plugins/azure-functions/src/components/OverviewTableComponent/OverviewTable.tsx b/plugins/azure-functions/src/components/OverviewTableComponent/OverviewTable.tsx index 8ecb2a3ac9..3f1de1552d 100644 --- a/plugins/azure-functions/src/components/OverviewTableComponent/OverviewTable.tsx +++ b/plugins/azure-functions/src/components/OverviewTableComponent/OverviewTable.tsx @@ -15,15 +15,10 @@ */ import React from 'react'; -import { - Box, - Card, - Link, - LinearProgress -} from '@material-ui/core'; +import { Box, Card, Link, LinearProgress } from '@material-ui/core'; import { FunctionsData } from '../../api/types'; import { Table, TableColumn } from '@backstage/core-components'; -import FlashOnIcon from '@material-ui/icons/FlashOn' +import FlashOnIcon from '@material-ui/icons/FlashOn'; type States = 'Waiting' | 'Running' | 'Paused' | 'Failed'; @@ -61,7 +56,11 @@ const DEFAULT_COLUMNS: TableColumn[] = [ title: 'name', highlight: true, render: (func: FunctionsData) => { - return ({func.functionName}) + return ( + + {func.functionName} + + ); }, }, { @@ -74,13 +73,18 @@ const DEFAULT_COLUMNS: TableColumn[] = [ }, { title: 'last modified', - render: (func: FunctionsData) => new Date(func.lastModifiedDate).toUTCString(), + render: (func: FunctionsData) => + new Date(func.lastModifiedDate).toUTCString(), }, { title: 'logs', align: 'right', render: (func: FunctionsData) => { - return (View Logs) + return ( + + View Logs + + ); }, }, ]; @@ -104,9 +108,7 @@ export const OverviewTable = ({ data, loading }: FunctionTableProps) => { } options={{ paging: true, search: false, pageSize: 10 }} data={data} - emptyContent={ - - } + emptyContent={} isLoading={loading} columns={columns} /> diff --git a/plugins/azure-functions/src/hooks/useFunctions.ts b/plugins/azure-functions/src/hooks/useFunctions.ts index 9ed47f7997..e70c301edf 100644 --- a/plugins/azure-functions/src/hooks/useFunctions.ts +++ b/plugins/azure-functions/src/hooks/useFunctions.ts @@ -15,19 +15,12 @@ */ import useAsyncRetry from 'react-use/lib/useAsyncRetry'; -import { - useApi, - errorApiRef, -} from '@backstage/core-plugin-api'; +import { useApi, errorApiRef } from '@backstage/core-plugin-api'; import { FunctionsData } from '../api/types'; import { azureFunctionsApiRef } from '../api'; import { useCallback } from 'react'; -export function useFunctions({ - functionsName -}: { - functionsName: string; -}) { +export function useFunctions({ functionsName }: { functionsName: string }) { const azureFunctionsApi = useApi(azureFunctionsApiRef); const errorApi = useApi(errorApiRef); diff --git a/plugins/azure-functions/src/hooks/useServiceEntityAnnotations.ts b/plugins/azure-functions/src/hooks/useServiceEntityAnnotations.ts index 6bbe7f5f70..ea8e653583 100644 --- a/plugins/azure-functions/src/hooks/useServiceEntityAnnotations.ts +++ b/plugins/azure-functions/src/hooks/useServiceEntityAnnotations.ts @@ -25,6 +25,6 @@ export const useServiceEntityAnnotations = (entity: Entity) => { return { projectName, - functionsName + functionsName, }; }; diff --git a/plugins/azure-functions/src/index.ts b/plugins/azure-functions/src/index.ts index 7b091198ee..ea3b9a28e4 100644 --- a/plugins/azure-functions/src/index.ts +++ b/plugins/azure-functions/src/index.ts @@ -16,4 +16,4 @@ export * from './plugin'; export * from './api'; -export * from './components/AzureFunctionsOverviewComponent/AzureFunctionsOverview'; \ No newline at end of file +export * from './components/AzureFunctionsOverviewComponent/AzureFunctionsOverview'; diff --git a/plugins/azure-functions/src/mocks/mocks.ts b/plugins/azure-functions/src/mocks/mocks.ts index 9e601fda11..e0fe70cafd 100644 --- a/plugins/azure-functions/src/mocks/mocks.ts +++ b/plugins/azure-functions/src/mocks/mocks.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { FunctionsData } from "../api"; +import { FunctionsData } from '../api'; export const entityMock = { metadata: { @@ -23,8 +23,7 @@ export const entityMock = { 'portal.azure.com/functions-name': 'func-mock', }, name: 'sample-azure-function-service', - description: - 'A service for testing Backstage functionality.', + description: 'A service for testing Backstage functionality.', uid: 'c009b513-d053-4b3f-9429-8433a145e943', }, apiVersion: 'backstage.io/v1alpha1', @@ -38,12 +37,13 @@ export const entityMock = { // https://management.azure.com/subscriptions/{{subscriptionId}}/resourceGroups/{{resourceGroup}}/providers/Microsoft.Web/sites/{{functionsName}}?api-version=2022-03-01 export const functionResponseMock: FunctionsData = { - functionName: "func-mock", - location: "West Europe", - state: "Running", - href: "https://mockurl.api.azurewebsites.windows.net:454/subscriptions/00000000-0000-0000-0000-000000000000/webspaces/rg_mock-WestEuropewebspace/sites/func-mock", - logstreamHref: "https://mockurl.api.azurewebsites.windows.net:454/subscriptions/00000000-0000-0000-0000-000000000000/webspaces/rg_mock-WestEuropewebspace/sites/func-mock/logStream", - usageState: "Normal", - lastModifiedDate: new Date("2022-09-02T11:09:58.9033333"), - containerSize: 100 + functionName: 'func-mock', + location: 'West Europe', + state: 'Running', + href: 'https://mockurl.api.azurewebsites.windows.net:454/subscriptions/00000000-0000-0000-0000-000000000000/webspaces/rg_mock-WestEuropewebspace/sites/func-mock', + logstreamHref: + 'https://mockurl.api.azurewebsites.windows.net:454/subscriptions/00000000-0000-0000-0000-000000000000/webspaces/rg_mock-WestEuropewebspace/sites/func-mock/logStream', + usageState: 'Normal', + lastModifiedDate: new Date('2022-09-02T11:09:58.9033333'), + containerSize: 100, }; diff --git a/plugins/azure-functions/src/plugin.ts b/plugins/azure-functions/src/plugin.ts index b3e905e6af..ad160c340b 100644 --- a/plugins/azure-functions/src/plugin.ts +++ b/plugins/azure-functions/src/plugin.ts @@ -20,7 +20,7 @@ import { createPlugin, createRouteRef, discoveryApiRef, - identityApiRef + identityApiRef, } from '@backstage/core-plugin-api'; import { azureFunctionsApiRef, AzureFunctionsBackendClient } from './api'; @@ -39,7 +39,7 @@ export const azureFunctionsPlugin = createPlugin({ }, factory: ({ discoveryApi, identityApi }) => new AzureFunctionsBackendClient({ discoveryApi, identityApi }), - }) + }), ], routes: { entityContent: entityContentRouteRef, @@ -51,9 +51,9 @@ export const EntityAzureFunctionsOverviewCard = azureFunctionsPlugin.provide( name: 'EntityAzureFunctionsOverviewCard', component: { lazy: () => - import('./components/AzureFunctionsOverviewComponent/AzureFunctionsOverview').then( - m => m.AzureFunctionsOverviewWidget, - ), + import( + './components/AzureFunctionsOverviewComponent/AzureFunctionsOverview' + ).then(m => m.AzureFunctionsOverviewWidget), }, }), -); \ No newline at end of file +);