=> {
+ const token = await auth.getAccessToken();
+
+ const gqlEndpoint = graphql.defaults({
+ // Uncomment baseUrl if using enterprise
+ // baseUrl: 'https://github.MY-BIZ.com/api',
+ headers: {
+ authorization: `token ${token}`,
+ },
+ });
+ const { viewer } = await gqlEndpoint(query);
+ return viewer;
+ }, []);
+
+ if (loading) return ;
+ if (error) return {error.message} ;
+ if (value && value.repositories) return ;
+
+ return (
+
+ );
+};
+
+export default ExampleFetchComponent;
+```
diff --git a/docs/features/software-templates/installation.md b/docs/features/software-templates/installation.md
index 5453c4befa..90d25cab81 100644
--- a/docs/features/software-templates/installation.md
+++ b/docs/features/software-templates/installation.md
@@ -94,7 +94,7 @@ import {
GitlabPublisher,
CreateReactAppTemplater,
Templaters,
- RepoVisilityOptions,
+ RepoVisibilityOptions,
} from '@backstage/plugin-scaffolder-backend';
import { Octokit } from '@octokit/rest';
import { Gitlab } from '@gitbeaker/node';
@@ -126,7 +126,7 @@ export default async function createPlugin({
const githubToken = config.getString('scaffolder.github.token');
const repoVisibility = config.getString(
'scaffolder.github.visibility',
- ) as RepoVisilityOptions;
+ ) as RepoVisibilityOptions;
const githubClient = new Octokit({ auth: githubToken });
const githubPublisher = new GithubPublisher({
diff --git a/docs/overview/what-is-backstage.md b/docs/overview/what-is-backstage.md
index 0d16943c9b..1a5e80a302 100644
--- a/docs/overview/what-is-backstage.md
+++ b/docs/overview/what-is-backstage.md
@@ -1,7 +1,7 @@
---
id: what-is-backstage
title: What is Backstage?
-description: Backsatge is an open platform for building developer portals.
+description: Backstage is an open platform for building developer portals.
Powered by a centralized service catalog, Backstage restores order to your microservices and infrastructure
---
diff --git a/docs/reference/utility-apis/AlertApi.md b/docs/reference/utility-apis/AlertApi.md
index d000a6d6a2..d096276c3b 100644
--- a/docs/reference/utility-apis/AlertApi.md
+++ b/docs/reference/utility-apis/AlertApi.md
@@ -1,7 +1,7 @@
# AlertApi
The AlertApi type is defined at
-[packages/core-api/src/apis/definitions/AlertApi.ts:29](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/AlertApi.ts#L29).
+[packages/core-api/src/apis/definitions/AlertApi.ts:29](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/AlertApi.ts#L29).
The following Utility API implements this type: [alertApiRef](./README.md#alert)
@@ -38,7 +38,7 @@ export type AlertMessage = {
Defined at
-[packages/core-api/src/apis/definitions/AlertApi.ts:19](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/AlertApi.ts#L19).
+[packages/core-api/src/apis/definitions/AlertApi.ts:19](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/AlertApi.ts#L19).
Referenced by: [post](#post), [alert\$](#alert).
@@ -67,7 +67,7 @@ export type Observable<T> = {
Defined at
-[packages/core-api/src/types.ts:53](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/types.ts#L53).
+[packages/core-api/src/types.ts:53](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/types.ts#L53).
Referenced by: [alert\$](#alert).
@@ -86,7 +86,7 @@ export type Observer<T> = {
Defined at
-[packages/core-api/src/types.ts:24](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/types.ts#L24).
+[packages/core-api/src/types.ts:24](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/types.ts#L24).
Referenced by: [Observable](#observable).
@@ -109,6 +109,6 @@ export type Subscription = {
Defined at
-[packages/core-api/src/types.ts:33](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/types.ts#L33).
+[packages/core-api/src/types.ts:33](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/types.ts#L33).
Referenced by: [Observable](#observable).
diff --git a/docs/reference/utility-apis/AppThemeApi.md b/docs/reference/utility-apis/AppThemeApi.md
index e7d5296ceb..d37282adea 100644
--- a/docs/reference/utility-apis/AppThemeApi.md
+++ b/docs/reference/utility-apis/AppThemeApi.md
@@ -1,7 +1,7 @@
# AppThemeApi
The AppThemeApi type is defined at
-[packages/core-api/src/apis/definitions/AppThemeApi.ts:50](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/AppThemeApi.ts#L50).
+[packages/core-api/src/apis/definitions/AppThemeApi.ts:50](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/AppThemeApi.ts#L50).
The following Utility API implements this type:
[appThemeApiRef](./README.md#apptheme)
@@ -76,7 +76,7 @@ export type AppTheme = {
Defined at
-[packages/core-api/src/apis/definitions/AppThemeApi.ts:24](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/AppThemeApi.ts#L24).
+[packages/core-api/src/apis/definitions/AppThemeApi.ts:24](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/AppThemeApi.ts#L24).
Referenced by: [getInstalledThemes](#getinstalledthemes).
@@ -87,7 +87,7 @@ export type BackstagePalette = Palette & Palette
Defined at
-[packages/theme/src/types.ts:70](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/theme/src/types.ts#L70).
+[packages/theme/src/types.ts:70](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/theme/src/types.ts#L70).
Referenced by: [BackstageTheme](#backstagetheme).
@@ -100,7 +100,7 @@ export interface BackstageTheme extends Theme {
Defined at
-[packages/theme/src/types.ts:73](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/theme/src/types.ts#L73).
+[packages/theme/src/types.ts:73](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/theme/src/types.ts#L73).
Referenced by: [AppTheme](#apptheme).
@@ -129,7 +129,7 @@ export type Observable<T> = {
Defined at
-[packages/core-api/src/types.ts:53](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/types.ts#L53).
+[packages/core-api/src/types.ts:53](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/types.ts#L53).
Referenced by: [activeThemeId\$](#activethemeid).
@@ -148,7 +148,7 @@ export type Observer<T> = {
Defined at
-[packages/core-api/src/types.ts:24](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/types.ts#L24).
+[packages/core-api/src/types.ts:24](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/types.ts#L24).
Referenced by: [Observable](#observable).
@@ -204,7 +204,7 @@ type PaletteAdditions = {
Defined at
-[packages/theme/src/types.ts:23](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/theme/src/types.ts#L23).
+[packages/theme/src/types.ts:23](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/theme/src/types.ts#L23).
Referenced by: [BackstagePalette](#backstagepalette).
@@ -227,6 +227,6 @@ export type Subscription = {
Defined at
-[packages/core-api/src/types.ts:33](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/types.ts#L33).
+[packages/core-api/src/types.ts:33](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/types.ts#L33).
Referenced by: [Observable](#observable).
diff --git a/docs/reference/utility-apis/BackstageIdentityApi.md b/docs/reference/utility-apis/BackstageIdentityApi.md
index 87318ecff5..529b73c576 100644
--- a/docs/reference/utility-apis/BackstageIdentityApi.md
+++ b/docs/reference/utility-apis/BackstageIdentityApi.md
@@ -1,7 +1,7 @@
# BackstageIdentityApi
The BackstageIdentityApi type is defined at
-[packages/core-api/src/apis/definitions/auth.ts:144](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/auth.ts#L144).
+[packages/core-api/src/apis/definitions/auth.ts:134](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/auth.ts#L134).
The following Utility APIs implement this type:
@@ -15,6 +15,8 @@ The following Utility APIs implement this type:
- [microsoftAuthApiRef](./README.md#microsoftauth)
+- [oauth2ApiRef](./README.md#oauth2)
+
- [oktaAuthApiRef](./README.md#oktaauth)
## Members
@@ -66,7 +68,7 @@ export type AuthRequestOptions = {
Defined at
-[packages/core-api/src/apis/definitions/auth.ts:40](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/auth.ts#L40).
+[packages/core-api/src/apis/definitions/auth.ts:40](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/auth.ts#L40).
Referenced by: [getBackstageIdentity](#getbackstageidentity).
@@ -87,6 +89,6 @@ export type BackstageIdentity = {
Defined at
-[packages/core-api/src/apis/definitions/auth.ts:157](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/auth.ts#L157).
+[packages/core-api/src/apis/definitions/auth.ts:147](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/auth.ts#L147).
Referenced by: [getBackstageIdentity](#getbackstageidentity).
diff --git a/docs/reference/utility-apis/Config.md b/docs/reference/utility-apis/Config.md
index 9374fb9962..b54e122c03 100644
--- a/docs/reference/utility-apis/Config.md
+++ b/docs/reference/utility-apis/Config.md
@@ -1,7 +1,7 @@
# Config
The Config type is defined at
-[packages/config/src/types.ts:32](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/config/src/types.ts#L32).
+[packages/config/src/types.ts:32](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/config/src/types.ts#L32).
The following Utility API implements this type:
[configApiRef](./README.md#config)
@@ -140,7 +140,7 @@ export type Config = {
Defined at
-[packages/config/src/types.ts:32](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/config/src/types.ts#L32).
+[packages/config/src/types.ts:32](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/config/src/types.ts#L32).
Referenced by: [getConfig](#getconfig), [getOptionalConfig](#getoptionalconfig),
[getConfigArray](#getconfigarray),
@@ -153,7 +153,7 @@ export type JsonArray = JsonValue []
Defined at
-[packages/config/src/types.ts:18](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/config/src/types.ts#L18).
+[packages/config/src/types.ts:18](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/config/src/types.ts#L18).
Referenced by: [JsonValue](#jsonvalue).
@@ -164,7 +164,7 @@ export type JsonObject = { [key in string]?: JsonValue
Defined at
-[packages/config/src/types.ts:17](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/config/src/types.ts#L17).
+[packages/config/src/types.ts:17](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/config/src/types.ts#L17).
Referenced by: [JsonValue](#jsonvalue).
@@ -181,7 +181,7 @@ export type JsonValue =
Defined at
-[packages/config/src/types.ts:19](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/config/src/types.ts#L19).
+[packages/config/src/types.ts:19](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/config/src/types.ts#L19).
Referenced by: [get](#get), [getOptional](#getoptional),
[JsonObject](#jsonobject), [JsonArray](#jsonarray), [Config](#config).
diff --git a/docs/reference/utility-apis/DiscoveryApi.md b/docs/reference/utility-apis/DiscoveryApi.md
index 39902789cd..24371c1729 100644
--- a/docs/reference/utility-apis/DiscoveryApi.md
+++ b/docs/reference/utility-apis/DiscoveryApi.md
@@ -1,7 +1,7 @@
# DiscoveryApi
The DiscoveryApi type is defined at
-[packages/core-api/src/apis/definitions/DiscoveryApi.ts:30](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/DiscoveryApi.ts#L30).
+[packages/core-api/src/apis/definitions/DiscoveryApi.ts:30](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/DiscoveryApi.ts#L30).
The following Utility API implements this type:
[discoveryApiRef](./README.md#discovery)
diff --git a/docs/reference/utility-apis/ErrorApi.md b/docs/reference/utility-apis/ErrorApi.md
index c05f060ec3..4de58b34a1 100644
--- a/docs/reference/utility-apis/ErrorApi.md
+++ b/docs/reference/utility-apis/ErrorApi.md
@@ -1,7 +1,7 @@
# ErrorApi
The ErrorApi type is defined at
-[packages/core-api/src/apis/definitions/ErrorApi.ts:53](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/ErrorApi.ts#L53).
+[packages/core-api/src/apis/definitions/ErrorApi.ts:53](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/ErrorApi.ts#L53).
The following Utility API implements this type: [errorApiRef](./README.md#error)
@@ -41,7 +41,7 @@ type Error = {
Defined at
-[packages/core-api/src/apis/definitions/ErrorApi.ts:24](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/ErrorApi.ts#L24).
+[packages/core-api/src/apis/definitions/ErrorApi.ts:24](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/ErrorApi.ts#L24).
Referenced by: [post](#post), [error\$](#error).
@@ -58,7 +58,7 @@ export type ErrorContext = {
Defined at
-[packages/core-api/src/apis/definitions/ErrorApi.ts:33](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/ErrorApi.ts#L33).
+[packages/core-api/src/apis/definitions/ErrorApi.ts:33](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/ErrorApi.ts#L33).
Referenced by: [post](#post), [error\$](#error).
@@ -87,7 +87,7 @@ export type Observable<T> = {
Defined at
-[packages/core-api/src/types.ts:53](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/types.ts#L53).
+[packages/core-api/src/types.ts:53](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/types.ts#L53).
Referenced by: [error\$](#error).
@@ -106,7 +106,7 @@ export type Observer<T> = {
Defined at
-[packages/core-api/src/types.ts:24](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/types.ts#L24).
+[packages/core-api/src/types.ts:24](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/types.ts#L24).
Referenced by: [Observable](#observable).
@@ -129,6 +129,6 @@ export type Subscription = {
Defined at
-[packages/core-api/src/types.ts:33](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/types.ts#L33).
+[packages/core-api/src/types.ts:33](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/types.ts#L33).
Referenced by: [Observable](#observable).
diff --git a/docs/reference/utility-apis/FeatureFlagsApi.md b/docs/reference/utility-apis/FeatureFlagsApi.md
index 5efdb176a4..8fbcb794fb 100644
--- a/docs/reference/utility-apis/FeatureFlagsApi.md
+++ b/docs/reference/utility-apis/FeatureFlagsApi.md
@@ -1,7 +1,7 @@
# FeatureFlagsApi
The FeatureFlagsApi type is defined at
-[packages/core-api/src/apis/definitions/FeatureFlagsApi.ts:41](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/FeatureFlagsApi.ts#L41).
+[packages/core-api/src/apis/definitions/FeatureFlagsApi.ts:41](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/FeatureFlagsApi.ts#L41).
The following Utility API implements this type:
[featureFlagsApiRef](./README.md#featureflags)
diff --git a/docs/reference/utility-apis/IdentityApi.md b/docs/reference/utility-apis/IdentityApi.md
index 4e37ad5300..5ee5c582b6 100644
--- a/docs/reference/utility-apis/IdentityApi.md
+++ b/docs/reference/utility-apis/IdentityApi.md
@@ -1,7 +1,7 @@
# IdentityApi
The IdentityApi type is defined at
-[packages/core-api/src/apis/definitions/IdentityApi.ts:22](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/IdentityApi.ts#L22).
+[packages/core-api/src/apis/definitions/IdentityApi.ts:22](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/IdentityApi.ts#L22).
The following Utility API implements this type:
[identityApiRef](./README.md#identity)
@@ -40,12 +40,12 @@ identity, such as a demo user or mocked user for e2e tests.
getIdToken(): Promise<string | undefined>
-### logout()
+### signOut()
-Log out the current user
+Sign out the current user
-logout(): Promise<void>
+signOut(): Promise<void>
## Supporting types
@@ -76,6 +76,6 @@ export type ProfileInfo = {
Defined at
-[packages/core-api/src/apis/definitions/auth.ts:172](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/auth.ts#L172).
+[packages/core-api/src/apis/definitions/auth.ts:162](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/auth.ts#L162).
Referenced by: [getProfile](#getprofile).
diff --git a/docs/reference/utility-apis/OAuthApi.md b/docs/reference/utility-apis/OAuthApi.md
index e73d5f645f..a489db76c5 100644
--- a/docs/reference/utility-apis/OAuthApi.md
+++ b/docs/reference/utility-apis/OAuthApi.md
@@ -1,7 +1,7 @@
# OAuthApi
The OAuthApi type is defined at
-[packages/core-api/src/apis/definitions/auth.ts:67](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/auth.ts#L67).
+[packages/core-api/src/apis/definitions/auth.ts:67](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/auth.ts#L67).
The following Utility APIs implement this type:
@@ -50,14 +50,6 @@ getAccessToken(
): Promise<string>
-### logout()
-
-Log out the user's session. This will reload the page.
-
-
-logout(): Promise<void>
-
-
## Supporting types
These types are part of the API declaration, but may not be unique to this API.
@@ -90,7 +82,7 @@ export type AuthRequestOptions = {
Defined at
-[packages/core-api/src/apis/definitions/auth.ts:40](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/auth.ts#L40).
+[packages/core-api/src/apis/definitions/auth.ts:40](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/auth.ts#L40).
Referenced by: [getAccessToken](#getaccesstoken).
@@ -116,6 +108,6 @@ export type OAuthScope = string | string[]
Defined at
-[packages/core-api/src/apis/definitions/auth.ts:38](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/auth.ts#L38).
+[packages/core-api/src/apis/definitions/auth.ts:38](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/auth.ts#L38).
Referenced by: [getAccessToken](#getaccesstoken).
diff --git a/docs/reference/utility-apis/OAuthRequestApi.md b/docs/reference/utility-apis/OAuthRequestApi.md
index c6b9e09189..ac11764682 100644
--- a/docs/reference/utility-apis/OAuthRequestApi.md
+++ b/docs/reference/utility-apis/OAuthRequestApi.md
@@ -1,7 +1,7 @@
# OAuthRequestApi
The OAuthRequestApi type is defined at
-[packages/core-api/src/apis/definitions/OAuthRequestApi.ts:99](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/OAuthRequestApi.ts#L99).
+[packages/core-api/src/apis/definitions/OAuthRequestApi.ts:99](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/OAuthRequestApi.ts#L99).
The following Utility API implements this type:
[oauthRequestApiRef](./README.md#oauthrequest)
@@ -72,7 +72,7 @@ export type AuthProvider = {
Defined at
-[packages/core-api/src/apis/definitions/OAuthRequestApi.ts:27](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/OAuthRequestApi.ts#L27).
+[packages/core-api/src/apis/definitions/OAuthRequestApi.ts:27](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/OAuthRequestApi.ts#L27).
Referenced by: [AuthRequesterOptions](#authrequesteroptions),
[PendingAuthRequest](#pendingauthrequest).
@@ -96,7 +96,7 @@ export type AuthRequester<AuthResponse> = (
Defined at
-[packages/core-api/src/apis/definitions/OAuthRequestApi.ts:66](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/OAuthRequestApi.ts#L66).
+[packages/core-api/src/apis/definitions/OAuthRequestApi.ts:66](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/OAuthRequestApi.ts#L66).
Referenced by: [createAuthRequester](#createauthrequester).
@@ -121,7 +121,7 @@ export type AuthRequesterOptions<AuthResponse> = {
Defined at
-[packages/core-api/src/apis/definitions/OAuthRequestApi.ts:43](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/OAuthRequestApi.ts#L43).
+[packages/core-api/src/apis/definitions/OAuthRequestApi.ts:43](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/OAuthRequestApi.ts#L43).
Referenced by: [createAuthRequester](#createauthrequester).
@@ -150,7 +150,7 @@ export type Observable<T> = {
Defined at
-[packages/core-api/src/types.ts:53](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/types.ts#L53).
+[packages/core-api/src/types.ts:53](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/types.ts#L53).
Referenced by: [authRequest\$](#authrequest).
@@ -169,7 +169,7 @@ export type Observer<T> = {
Defined at
-[packages/core-api/src/types.ts:24](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/types.ts#L24).
+[packages/core-api/src/types.ts:24](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/types.ts#L24).
Referenced by: [Observable](#observable).
@@ -204,7 +204,7 @@ export type PendingAuthRequest = {
Defined at
-[packages/core-api/src/apis/definitions/OAuthRequestApi.ts:77](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/OAuthRequestApi.ts#L77).
+[packages/core-api/src/apis/definitions/OAuthRequestApi.ts:77](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/OAuthRequestApi.ts#L77).
Referenced by: [authRequest\$](#authrequest).
@@ -227,6 +227,6 @@ export type Subscription = {
Defined at
-[packages/core-api/src/types.ts:33](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/types.ts#L33).
+[packages/core-api/src/types.ts:33](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/types.ts#L33).
Referenced by: [Observable](#observable).
diff --git a/docs/reference/utility-apis/OpenIdConnectApi.md b/docs/reference/utility-apis/OpenIdConnectApi.md
index 41a3247af6..efd79593d6 100644
--- a/docs/reference/utility-apis/OpenIdConnectApi.md
+++ b/docs/reference/utility-apis/OpenIdConnectApi.md
@@ -1,7 +1,7 @@
# OpenIdConnectApi
The OpenIdConnectApi type is defined at
-[packages/core-api/src/apis/definitions/auth.ts:104](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/auth.ts#L104).
+[packages/core-api/src/apis/definitions/auth.ts:99](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/auth.ts#L99).
The following Utility APIs implement this type:
@@ -34,14 +34,6 @@ user rejects the login request.
getIdToken(options?: AuthRequestOptions ): Promise<string>
-### logout()
-
-Log out the user's session. This will reload the page.
-
-
-logout(): Promise<void>
-
-
## Supporting types
These types are part of the API declaration, but may not be unique to this API.
@@ -74,6 +66,6 @@ export type AuthRequestOptions = {
Defined at
-[packages/core-api/src/apis/definitions/auth.ts:40](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/auth.ts#L40).
+[packages/core-api/src/apis/definitions/auth.ts:40](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/auth.ts#L40).
Referenced by: [getIdToken](#getidtoken).
diff --git a/docs/reference/utility-apis/ProfileInfoApi.md b/docs/reference/utility-apis/ProfileInfoApi.md
index 09c0f88f83..402b5ba504 100644
--- a/docs/reference/utility-apis/ProfileInfoApi.md
+++ b/docs/reference/utility-apis/ProfileInfoApi.md
@@ -1,7 +1,7 @@
# ProfileInfoApi
The ProfileInfoApi type is defined at
-[packages/core-api/src/apis/definitions/auth.ts:127](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/auth.ts#L127).
+[packages/core-api/src/apis/definitions/auth.ts:117](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/auth.ts#L117).
The following Utility APIs implement this type:
@@ -65,7 +65,7 @@ export type AuthRequestOptions = {
Defined at
-[packages/core-api/src/apis/definitions/auth.ts:40](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/auth.ts#L40).
+[packages/core-api/src/apis/definitions/auth.ts:40](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/auth.ts#L40).
Referenced by: [getProfile](#getprofile).
@@ -93,6 +93,6 @@ export type ProfileInfo = {
Defined at
-[packages/core-api/src/apis/definitions/auth.ts:172](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/auth.ts#L172).
+[packages/core-api/src/apis/definitions/auth.ts:162](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/auth.ts#L162).
Referenced by: [getProfile](#getprofile).
diff --git a/docs/reference/utility-apis/README.md b/docs/reference/utility-apis/README.md
index cfdc3b6ef8..71931a5d5a 100644
--- a/docs/reference/utility-apis/README.md
+++ b/docs/reference/utility-apis/README.md
@@ -12,7 +12,7 @@ Used to report alerts and forward them to the app
Implemented type: [AlertApi](./AlertApi.md)
ApiRef:
-[alertApiRef](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/AlertApi.ts#L41)
+[alertApiRef](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/AlertApi.ts#L41)
### appTheme
@@ -21,7 +21,7 @@ API Used to configure the app theme, and enumerate options
Implemented type: [AppThemeApi](./AppThemeApi.md)
ApiRef:
-[appThemeApiRef](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/AppThemeApi.ts#L74)
+[appThemeApiRef](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/AppThemeApi.ts#L74)
### auth0Auth
@@ -29,11 +29,10 @@ Provides authentication towards Auth0 APIs
Implemented types: [OpenIdConnectApi](./OpenIdConnectApi.md),
[ProfileInfoApi](./ProfileInfoApi.md),
-[BackstageIdentityApi](./BackstageIdentityApi.md),
-[SessionStateApi](./SessionStateApi.md)
+[BackstageIdentityApi](./BackstageIdentityApi.md), [SessionApi](./SessionApi.md)
ApiRef:
-[auth0AuthApiRef](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/auth.ts#L273)
+[auth0AuthApiRef](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/auth.ts#L275)
### config
@@ -42,7 +41,7 @@ Used to access runtime configuration
Implemented type: [Config](./Config.md)
ApiRef:
-[configApiRef](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/ConfigApi.ts#L22)
+[configApiRef](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/ConfigApi.ts#L22)
### discovery
@@ -51,7 +50,7 @@ Provides service discovery of backend plugins
Implemented type: [DiscoveryApi](./DiscoveryApi.md)
ApiRef:
-[discoveryApiRef](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/DiscoveryApi.ts#L44)
+[discoveryApiRef](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/DiscoveryApi.ts#L44)
### error
@@ -60,7 +59,7 @@ Used to report errors and forward them to the app
Implemented type: [ErrorApi](./ErrorApi.md)
ApiRef:
-[errorApiRef](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/ErrorApi.ts#L65)
+[errorApiRef](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/ErrorApi.ts#L65)
### featureFlags
@@ -69,7 +68,7 @@ Used to toggle functionality in features across Backstage
Implemented type: [FeatureFlagsApi](./FeatureFlagsApi.md)
ApiRef:
-[featureFlagsApiRef](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/FeatureFlagsApi.ts#L58)
+[featureFlagsApiRef](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/FeatureFlagsApi.ts#L58)
### githubAuth
@@ -77,11 +76,10 @@ Provides authentication towards GitHub APIs
Implemented types: [OAuthApi](./OAuthApi.md),
[ProfileInfoApi](./ProfileInfoApi.md),
-[BackstageIdentityApi](./BackstageIdentityApi.md),
-[SessionStateApi](./SessionStateApi.md)
+[BackstageIdentityApi](./BackstageIdentityApi.md), [SessionApi](./SessionApi.md)
ApiRef:
-[githubAuthApiRef](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/auth.ts#L230)
+[githubAuthApiRef](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/auth.ts#L232)
### gitlabAuth
@@ -89,11 +87,10 @@ Provides authentication towards GitLab APIs
Implemented types: [OAuthApi](./OAuthApi.md),
[ProfileInfoApi](./ProfileInfoApi.md),
-[BackstageIdentityApi](./BackstageIdentityApi.md),
-[SessionStateApi](./SessionStateApi.md)
+[BackstageIdentityApi](./BackstageIdentityApi.md), [SessionApi](./SessionApi.md)
ApiRef:
-[gitlabAuthApiRef](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/auth.ts#L260)
+[gitlabAuthApiRef](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/auth.ts#L262)
### googleAuth
@@ -102,11 +99,10 @@ Provides authentication towards Google APIs and identities
Implemented types: [OAuthApi](./OAuthApi.md),
[OpenIdConnectApi](./OpenIdConnectApi.md),
[ProfileInfoApi](./ProfileInfoApi.md),
-[BackstageIdentityApi](./BackstageIdentityApi.md),
-[SessionStateApi](./SessionStateApi.md)
+[BackstageIdentityApi](./BackstageIdentityApi.md), [SessionApi](./SessionApi.md)
ApiRef:
-[googleAuthApiRef](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/auth.ts#L213)
+[googleAuthApiRef](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/auth.ts#L215)
### identity
@@ -115,7 +111,7 @@ Provides access to the identity of the signed in user
Implemented type: [IdentityApi](./IdentityApi.md)
ApiRef:
-[identityApiRef](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/IdentityApi.ts#L54)
+[identityApiRef](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/IdentityApi.ts#L54)
### microsoftAuth
@@ -124,11 +120,10 @@ Provides authentication towards Microsoft APIs and identities
Implemented types: [OAuthApi](./OAuthApi.md),
[OpenIdConnectApi](./OpenIdConnectApi.md),
[ProfileInfoApi](./ProfileInfoApi.md),
-[BackstageIdentityApi](./BackstageIdentityApi.md),
-[SessionStateApi](./SessionStateApi.md)
+[BackstageIdentityApi](./BackstageIdentityApi.md), [SessionApi](./SessionApi.md)
ApiRef:
-[microsoftAuthApiRef](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/auth.ts#L287)
+[microsoftAuthApiRef](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/auth.ts#L289)
### oauth2
@@ -136,10 +131,11 @@ Example of how to use oauth2 custom provider
Implemented types: [OAuthApi](./OAuthApi.md),
[OpenIdConnectApi](./OpenIdConnectApi.md),
-[ProfileInfoApi](./ProfileInfoApi.md), [SessionStateApi](./SessionStateApi.md)
+[ProfileInfoApi](./ProfileInfoApi.md),
+[BackstageIdentityApi](./BackstageIdentityApi.md), [SessionApi](./SessionApi.md)
ApiRef:
-[oauth2ApiRef](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/auth.ts#L301)
+[oauth2ApiRef](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/auth.ts#L303)
### oauthRequest
@@ -148,7 +144,7 @@ An API for implementing unified OAuth flows in Backstage
Implemented type: [OAuthRequestApi](./OAuthRequestApi.md)
ApiRef:
-[oauthRequestApiRef](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/OAuthRequestApi.ts#L130)
+[oauthRequestApiRef](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/OAuthRequestApi.ts#L130)
### oktaAuth
@@ -157,11 +153,10 @@ Provides authentication towards Okta APIs
Implemented types: [OAuthApi](./OAuthApi.md),
[OpenIdConnectApi](./OpenIdConnectApi.md),
[ProfileInfoApi](./ProfileInfoApi.md),
-[BackstageIdentityApi](./BackstageIdentityApi.md),
-[SessionStateApi](./SessionStateApi.md)
+[BackstageIdentityApi](./BackstageIdentityApi.md), [SessionApi](./SessionApi.md)
ApiRef:
-[oktaAuthApiRef](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/auth.ts#L243)
+[oktaAuthApiRef](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/auth.ts#L245)
### storage
@@ -170,4 +165,4 @@ Provides the ability to store data which is unique to the user
Implemented type: [StorageApi](./StorageApi.md)
ApiRef:
-[storageApiRef](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/StorageApi.ts#L68)
+[storageApiRef](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/StorageApi.ts#L68)
diff --git a/docs/reference/utility-apis/SessionApi.md b/docs/reference/utility-apis/SessionApi.md
new file mode 100644
index 0000000000..5e40b3317b
--- /dev/null
+++ b/docs/reference/utility-apis/SessionApi.md
@@ -0,0 +1,138 @@
+# SessionApi
+
+The SessionApi type is defined at
+[packages/core-api/src/apis/definitions/auth.ts:190](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/auth.ts#L190).
+
+The following Utility APIs implement this type:
+
+- [auth0AuthApiRef](./README.md#auth0auth)
+
+- [githubAuthApiRef](./README.md#githubauth)
+
+- [gitlabAuthApiRef](./README.md#gitlabauth)
+
+- [googleAuthApiRef](./README.md#googleauth)
+
+- [microsoftAuthApiRef](./README.md#microsoftauth)
+
+- [oauth2ApiRef](./README.md#oauth2)
+
+- [oktaAuthApiRef](./README.md#oktaauth)
+
+## Members
+
+### signIn()
+
+Sign in with a minimum set of permissions.
+
+
+signIn(): Promise<void>
+
+
+### signOut()
+
+Sign out from the current session. This will reload the page.
+
+
+signOut(): Promise<void>
+
+
+### sessionState\$()
+
+Observe the current state of the auth session. Emits the current state on
+subscription.
+
+
+sessionState$(): Observable <SessionState >
+
+
+## Supporting types
+
+These types are part of the API declaration, but may not be unique to this API.
+
+### Observable
+
+Observable sequence of values and errors, see TC39.
+
+https://github.com/tc39/proposal-observable
+
+This is used as a common return type for observable values and can be created
+using many different observable implementations, such as zen-observable or
+RxJS 5.
+
+
+export type Observable<T> = {
+ /**
+ * Subscribes to this observable to start receiving new values.
+ */
+ subscribe(observer: Observer <T>): Subscription ;
+ subscribe(
+ onNext: (value: T) => void,
+ onError?: (error: Error) => void,
+ onComplete?: () => void,
+ ): Subscription ;
+}
+
+
+Defined at
+[packages/core-api/src/types.ts:53](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/types.ts#L53).
+
+Referenced by: [sessionState\$](#sessionstate).
+
+### Observer
+
+This file contains non-react related core types used throught Backstage.
+
+Observer interface for consuming an Observer, see TC39.
+
+
+export type Observer<T> = {
+ next?(value: T): void;
+ error?(error: Error): void;
+ complete?(): void;
+}
+
+
+Defined at
+[packages/core-api/src/types.ts:24](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/types.ts#L24).
+
+Referenced by: [Observable](#observable).
+
+### SessionState
+
+Session state values passed to subscribers of the SessionApi.
+
+
+export enum SessionState {
+ SignedIn = 'SignedIn',
+ SignedOut = 'SignedOut',
+}
+
+
+Defined at
+[packages/core-api/src/apis/definitions/auth.ts:182](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/auth.ts#L182).
+
+Referenced by: [sessionState\$](#sessionstate).
+
+### Subscription
+
+Subscription returned when subscribing to an Observable, see TC39.
+
+
+export type Subscription = {
+ /**
+ * Cancels the subscription
+ */
+ unsubscribe(): void;
+
+ /**
+ * Value indicating whether the subscription is closed.
+ */
+ readonly closed: Boolean;
+}
+
+
+Defined at
+[packages/core-api/src/types.ts:33](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/types.ts#L33).
+
+Referenced by: [Observable](#observable).
diff --git a/docs/reference/utility-apis/StorageApi.md b/docs/reference/utility-apis/StorageApi.md
index bee52935da..3fd75a42d6 100644
--- a/docs/reference/utility-apis/StorageApi.md
+++ b/docs/reference/utility-apis/StorageApi.md
@@ -1,7 +1,7 @@
# StorageApi
The StorageApi type is defined at
-[packages/core-api/src/apis/definitions/StorageApi.ts:31](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/StorageApi.ts#L31).
+[packages/core-api/src/apis/definitions/StorageApi.ts:31](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/StorageApi.ts#L31).
The following Utility API implements this type:
[storageApiRef](./README.md#storage)
@@ -79,7 +79,7 @@ export type Observable<T> = {
Defined at
-[packages/core-api/src/types.ts:53](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/types.ts#L53).
+[packages/core-api/src/types.ts:53](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/types.ts#L53).
Referenced by: [observe\$](#observe), [StorageApi](#storageapi).
@@ -98,7 +98,7 @@ export type Observer<T> = {
Defined at
-[packages/core-api/src/types.ts:24](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/types.ts#L24).
+[packages/core-api/src/types.ts:24](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/types.ts#L24).
Referenced by: [Observable](#observable).
@@ -144,7 +144,7 @@ export interface StorageApi {
Defined at
-[packages/core-api/src/apis/definitions/StorageApi.ts:31](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/StorageApi.ts#L31).
+[packages/core-api/src/apis/definitions/StorageApi.ts:31](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/StorageApi.ts#L31).
Referenced by: [forBucket](#forbucket).
@@ -158,7 +158,7 @@ export type StorageValueChange<T = any> = {
Defined at
-[packages/core-api/src/apis/definitions/StorageApi.ts:21](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/apis/definitions/StorageApi.ts#L21).
+[packages/core-api/src/apis/definitions/StorageApi.ts:21](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/apis/definitions/StorageApi.ts#L21).
Referenced by: [observe\$](#observe), [StorageApi](#storageapi).
@@ -181,6 +181,6 @@ export type Subscription = {
Defined at
-[packages/core-api/src/types.ts:33](https://github.com/spotify/backstage/blob/82d329555c16af46db9b4e5cd2f44a3cc006a52e/packages/core-api/src/types.ts#L33).
+[packages/core-api/src/types.ts:33](https://github.com/spotify/backstage/blob/0406ace29aba7332a98ff9ef9feedd65adc75223/packages/core-api/src/types.ts#L33).
Referenced by: [Observable](#observable).
diff --git a/docs/tutorials/quickstart-app-auth.md b/docs/tutorials/quickstart-app-auth.md
index 2615e37633..82f9cab537 100644
--- a/docs/tutorials/quickstart-app-auth.md
+++ b/docs/tutorials/quickstart-app-auth.md
@@ -187,10 +187,11 @@ builder.add(
);
```
-> Start the backend and frontend as before. When the browser loads, you should
-> be presented with a login page for GitHub. Login as usual with your GitHub
-> account. If this is your first time, you will be asked to authorize and then
-> are redirected to the catalog page if all is well.
+8. Start the backend and frontend as before
+
+When the browser loads, you should be presented with a login page for GitHub.
+Login as usual with your GitHub account. If this is your first time, you will be
+asked to authorize and then are redirected to the catalog page if all is well.
# Where to go from here
diff --git a/docs/tutorials/quickstart-app-plugin.md b/docs/tutorials/quickstart-app-plugin.md
index 28efb2a007..51a7f8ded6 100644
--- a/docs/tutorials/quickstart-app-plugin.md
+++ b/docs/tutorials/quickstart-app-plugin.md
@@ -34,7 +34,7 @@ title: Adding Custom Plugin to Existing Monorepo App
1. When the process finishes, let's start the backend:
`yarn --cwd packages/backend start`
1. If you see errors starting, refer to
- [Auth Configuration](https://github.com/johnson-jesse/simple-backstage-app/blob/master/README.md#the-auth-configuration)
+ [Auth Configuration](https://backstage.io/docs/tutorials/quickstart-app-auth#the-auth-configuration)
for more information on environment variables.
1. And now the frontend, from a new terminal window and the root of your
project: `yarn start`
@@ -119,67 +119,10 @@ If everything is saved, you should see your name, id, and email on the
github-playground page. Our data accessed is synchronous. So we just grab and
go.
+https://github.com/spotify/backstage/tree/master/contrib
+
6. Here is the entire file for reference
-Complete ExampleComponent.tsx
-
-
-```tsx
-import React, { FC } from 'react';
-import { Typography, Grid } from '@material-ui/core';
-import {
- InfoCard,
- Header,
- Page,
- pageTheme,
- Content,
- ContentHeader,
- HeaderLabel,
- SupportButton,
- identityApiRef,
-} from '@backstage/core';
-import { useApi } from '@backstage/core-api';
-import ExampleFetchComponent from '../ExampleFetchComponent';
-
-const ExampleComponent: FC<{}> = () => {
- const identityApi = useApi(identityApiRef);
- const userId = identityApi.getUserId();
- const profile = identityApi.getProfile();
-
- return (
-
-
-
-
- A description of your plugin goes here.
-
-
-
-
-
- {`${profile.displayName} | ${profile.email}`}
-
-
-
-
-
-
-
-
-
- );
-};
-
-export default ExampleComponent;
-```
-
-
-
+ [ExampleComponent.tsx](https://github.com/spotify/backstage/tree/master/contrib/docs/tutorials/quickstart-app-plugin/ExampleComponent.md)
# The Wipe
@@ -188,7 +131,7 @@ changes, let's start by wiping this component clean.
1. Start by opening
`root: plugins > github-playground > src > components > ExampleFetchComponent > ExampleFetchComponent.tsx`
-1. Replace everyting in the file with the following:
+1. Replace everything in the file with the following:
```tsx
import React, { FC } from 'react';
@@ -329,8 +272,8 @@ const { value, loading, error } = useAsync(async (): Promise => {
}, []);
```
-4. The resolved data is conventiently destructured with value containing our
- Viewer type. loading as a boolean, self explainatory. And error which is
+4. The resolved data is conveniently destructured with `value` containing our
+ Viewer type. `loading` as a boolean, self explanatory. And `error` which is
present only if necessary. So let's use those as the first 3 of 4 multi
return statements.
5. Add the _if return_ blocks below our async block
@@ -358,123 +301,10 @@ return (
8. After saving that, and given we don't have any errors, you should see a table
with basic information on your repositories.
9. Here is the entire file for reference
-Complete ExampleFetchComponent.tsx
-
-
-```tsx
-import React, { FC } from 'react';
-import { useAsync } from 'react-use';
-import Alert from '@material-ui/lab/Alert';
-import {
- Table,
- TableColumn,
- Progress,
- githubAuthApiRef,
-} from '@backstage/core';
-import { useApi } from '@backstage/core-api';
-import { graphql } from '@octokit/graphql';
-
-const query = `{
-viewer {
- repositories(first: 100) {
- totalCount
- nodes {
- name
- createdAt
- description
- diskUsage
- isFork
- }
- pageInfo {
- endCursor
- hasNextPage
- }
- }
-}
-}`;
-
-type Node = {
- name: string;
- createdAt: string;
- description: string;
- diskUsage: number;
- isFork: boolean;
-};
-
-type Viewer = {
- repositories: {
- totalCount: number;
- nodes: Node[];
- pageInfo: {
- endCursor: string;
- hasNextPage: boolean;
- };
- };
-};
-
-type DenseTableProps = {
- viewer: Viewer;
-};
-
-export const DenseTable: FC = ({ viewer }) => {
- const columns: TableColumn[] = [
- { title: 'Name', field: 'name' },
- { title: 'Created', field: 'createdAt' },
- { title: 'Description', field: 'description' },
- { title: 'Disk Usage', field: 'diskUsage' },
- { title: 'Fork', field: 'isFork' },
- ];
-
- return (
-
- );
-};
-
-const ExampleFetchComponent: FC<{}> = () => {
- const auth = useApi(githubAuthApiRef);
-
- const { value, loading, error } = useAsync(async (): Promise => {
- const token = await auth.getAccessToken();
-
- const gqlEndpoint = graphql.defaults({
- // Uncomment baseUrl if using enterprise
- // baseUrl: 'https://github.MY-BIZ.com/api',
- headers: {
- authorization: `token ${token}`,
- },
- });
- const { viewer } = await gqlEndpoint(query);
- return viewer;
- }, []);
-
- if (loading) return ;
- if (error) return {error.message} ;
- if (value && value.repositories) return ;
-
- return (
-
- );
-};
-
-export default ExampleFetchComponent;
-```
-
-
-
-
-10. We finished! If there are no errors, you should see your own GitHub
- repoistory information displayed in a basic table. If you run into issues,
- you can compare the repo that backs this documdnt,
+ [ExampleFetchComponent.tsx](https://github.com/spotify/backstage/tree/master/contrib/docs/tutorials/quickstart-app-plugin/ExampleFetchComponent.md)
+10. We finished! You should see your own GitHub repository's information
+ displayed in a basic table. If you run into issues, you can compare the repo
+ that backs this document,
[simple-backstage-app-plugin](https://github.com/johnson-jesse/simple-backstage-app-plugin)
# Where to go from here
diff --git a/lerna.json b/lerna.json
index a018b1a289..d43d4ff160 100644
--- a/lerna.json
+++ b/lerna.json
@@ -2,5 +2,5 @@
"packages": ["packages/*", "plugins/*"],
"npmClient": "yarn",
"useWorkspaces": true,
- "version": "0.1.1-alpha.22"
+ "version": "0.1.1-alpha.23"
}
diff --git a/microsite/blog/2020-09-23-backstage-cncf-sandbox.md b/microsite/blog/2020-09-23-backstage-cncf-sandbox.md
new file mode 100644
index 0000000000..bcfd7c6245
--- /dev/null
+++ b/microsite/blog/2020-09-23-backstage-cncf-sandbox.md
@@ -0,0 +1,21 @@
+---
+title: Backstage has been accepted into the CNCF Sandbox
+author: Stefan Ã…lund
+authorURL: https://twitter.com/stalund
+---
+
+**TL;DR** The Cloud Native Computing Foundation (CNCF) announced that Backstage can begin incubating as an early stage project in the [CNCF Sandbox](https://www.cncf.io/sandbox-projects/). Released open source in March, the platform is built around an advanced service catalog and is designed to streamline software development from end to end.
+
+
+
+
+
+Backstage garnered quite a bit of interest from developers and organizations when it was first announced, and community interest continues to grow as plugins and new features are added with the open source community. We released the open source version of Backstage ‘early’. That was intentional. Because even though we’ve been using Backstage internally for years, we wanted the open source version to be developed with input and contributions from the community. And that’s exactly the product that’s going into the [CNCF Sandbox](https://www.cncf.io/sandbox-projects/) today.
+
+Backstage’s ability to simplify tooling and standardize engineering practices has attracted interest from other major tech companies, as well as airlines, auto manufacturers, investment firms, and global retailers. We know that Backstage solves a problem — infrastructure complexity — that’s common to a lot of large and growing companies today. But different companies work differently, use particular toolsets, and have unique use cases. By making Backstage open source, we can build it with people working inside a variety of engineering organizations all over the world. It makes for a better product that serves a wider group of users (beyond that of Spotify’s) and their needs.
+
+The Backstage community is healthy and growing quickly. Over [130 people](https://github.com/spotify/backstage/graphs/contributors) have contributed to the project, and roughly 40% of pull requests are now coming from external, non-Spotify, contributors. With companies now deciding to [adopt Backstage](https://github.com/spotify/backstage/blob/master/ADOPTERS.md) we are also seeing a shift in the kinds of contributions we are getting from the community. It is truly amazing to see contributions to core parts of the platform as well as significant functionality additions through working [plugins](https://backstage.io/plugins).
+
+We’re excited to embark on this journey with the CNCF community. There’s so much great tech being built here, and it’s about time we share it to build even greater products, together. Entering into the CNCF Sandbox is just the first step. We are committed to working with the community to bring Backstage through the Incubation step, and finally all the way to becoming a Graduated, top-level project.
+
+Thanks to everyone for your support so far. We hope you [join us](https://mailchi.mp/spotify/backstage-community) in this next chapter of Backstage's journey. If you have questions or feedback, feel free to [email](mailto:alund@spotify.com) me directly.
diff --git a/microsite/blog/assets/cncf-sandbox/cncf.png b/microsite/blog/assets/cncf-sandbox/cncf.png
new file mode 100644
index 0000000000..624094b016
Binary files /dev/null and b/microsite/blog/assets/cncf-sandbox/cncf.png differ
diff --git a/package.json b/package.json
index 2622f1e322..3a77fe6880 100644
--- a/package.json
+++ b/package.json
@@ -37,6 +37,7 @@
},
"version": "1.0.0",
"devDependencies": {
+ "@changesets/cli": "2.10.2",
"@spotify/eslint-config-oss": "^1.0.1",
"@spotify/prettier-config": "^8.0.0",
"concurrently": "^5.2.0",
diff --git a/packages/app/package.json b/packages/app/package.json
index cb61e1ed8c..77b1882b47 100644
--- a/packages/app/package.json
+++ b/packages/app/package.json
@@ -1,32 +1,33 @@
{
"name": "example-app",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"private": true,
"bundled": true,
"dependencies": {
- "@backstage/catalog-model": "^0.1.1-alpha.22",
- "@backstage/cli": "^0.1.1-alpha.22",
- "@backstage/core": "^0.1.1-alpha.22",
- "@backstage/plugin-api-docs": "^0.1.1-alpha.22",
- "@backstage/plugin-catalog": "^0.1.1-alpha.22",
- "@backstage/plugin-circleci": "^0.1.1-alpha.22",
- "@backstage/plugin-explore": "^0.1.1-alpha.22",
- "@backstage/plugin-gcp-projects": "^0.1.1-alpha.22",
- "@backstage/plugin-github-actions": "^0.1.1-alpha.22",
- "@backstage/plugin-gitops-profiles": "^0.1.1-alpha.22",
- "@backstage/plugin-graphiql": "^0.1.1-alpha.22",
- "@backstage/plugin-jenkins": "^0.1.1-alpha.22",
- "@backstage/plugin-lighthouse": "^0.1.1-alpha.22",
- "@backstage/plugin-newrelic": "^0.1.1-alpha.22",
- "@backstage/plugin-register-component": "^0.1.1-alpha.22",
- "@backstage/plugin-rollbar": "^0.1.1-alpha.22",
- "@backstage/plugin-scaffolder": "^0.1.1-alpha.22",
- "@backstage/plugin-sentry": "^0.1.1-alpha.22",
- "@backstage/plugin-tech-radar": "^0.1.1-alpha.22",
- "@backstage/plugin-techdocs": "^0.1.1-alpha.22",
- "@backstage/plugin-welcome": "^0.1.1-alpha.22",
- "@backstage/test-utils": "^0.1.1-alpha.22",
- "@backstage/theme": "^0.1.1-alpha.22",
+ "@backstage/catalog-model": "^0.1.1-alpha.23",
+ "@backstage/cli": "^0.1.1-alpha.23",
+ "@backstage/core": "^0.1.1-alpha.23",
+ "@backstage/plugin-api-docs": "^0.1.1-alpha.23",
+ "@backstage/plugin-catalog": "^0.1.1-alpha.23",
+ "@backstage/plugin-circleci": "^0.1.1-alpha.23",
+ "@backstage/plugin-explore": "^0.1.1-alpha.23",
+ "@backstage/plugin-gcp-projects": "^0.1.1-alpha.23",
+ "@backstage/plugin-github-actions": "^0.1.1-alpha.23",
+ "@backstage/plugin-gitops-profiles": "^0.1.1-alpha.23",
+ "@backstage/plugin-graphiql": "^0.1.1-alpha.23",
+ "@backstage/plugin-jenkins": "^0.1.1-alpha.23",
+ "@backstage/plugin-kubernetes": "^0.1.1-alpha.23",
+ "@backstage/plugin-lighthouse": "^0.1.1-alpha.23",
+ "@backstage/plugin-newrelic": "^0.1.1-alpha.23",
+ "@backstage/plugin-register-component": "^0.1.1-alpha.23",
+ "@backstage/plugin-rollbar": "^0.1.1-alpha.23",
+ "@backstage/plugin-scaffolder": "^0.1.1-alpha.23",
+ "@backstage/plugin-sentry": "^0.1.1-alpha.23",
+ "@backstage/plugin-tech-radar": "^0.1.1-alpha.23",
+ "@backstage/plugin-techdocs": "^0.1.1-alpha.23",
+ "@backstage/plugin-welcome": "^0.1.1-alpha.23",
+ "@backstage/test-utils": "^0.1.1-alpha.23",
+ "@backstage/theme": "^0.1.1-alpha.23",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@octokit/rest": "^18.0.0",
diff --git a/packages/app/src/components/catalog/EntityPage.tsx b/packages/app/src/components/catalog/EntityPage.tsx
index c382abc3a8..d96fe9841f 100644
--- a/packages/app/src/components/catalog/EntityPage.tsx
+++ b/packages/app/src/components/catalog/EntityPage.tsx
@@ -29,6 +29,7 @@ import {
import { Router as ApiDocsRouter } from '@backstage/plugin-api-docs';
import { Router as SentryRouter } from '@backstage/plugin-sentry';
import { EmbeddedDocsRouter as DocsRouter } from '@backstage/plugin-techdocs';
+import { Router as KubernetesRouter } from '@backstage/plugin-kubernetes';
import React from 'react';
import {
AboutCard,
@@ -99,6 +100,11 @@ const ServiceEntityPage = ({ entity }: { entity: Entity }) => (
title="Docs"
element={ }
/>
+ }
+ />
);
@@ -124,6 +130,11 @@ const WebsiteEntityPage = ({ entity }: { entity: Entity }) => (
title="Docs"
element={ }
/>
+ }
+ />
);
const DefaultEntityPage = ({ entity }: { entity: Entity }) => (
diff --git a/packages/app/src/plugins.ts b/packages/app/src/plugins.ts
index b36d0323e0..aa68bc5fad 100644
--- a/packages/app/src/plugins.ts
+++ b/packages/app/src/plugins.ts
@@ -33,3 +33,4 @@ export { plugin as Jenkins } from '@backstage/plugin-jenkins';
export { plugin as ApiDocs } from '@backstage/plugin-api-docs';
export { plugin as GithubPullRequests } from '@roadiehq/backstage-plugin-github-pull-requests';
export { plugin as GcpProjects } from '@backstage/plugin-gcp-projects';
+export { plugin as Kubernetes } from '@backstage/plugin-kubernetes';
diff --git a/packages/backend-common/package.json b/packages/backend-common/package.json
index 9d8a7061e0..72f047761d 100644
--- a/packages/backend-common/package.json
+++ b/packages/backend-common/package.json
@@ -1,7 +1,7 @@
{
"name": "@backstage/backend-common",
"description": "Common functionality library for Backstage backends",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"main": "src/index.ts",
"types": "src/index.ts",
"private": false,
@@ -29,9 +29,9 @@
"clean": "backstage-cli clean"
},
"dependencies": {
- "@backstage/cli-common": "^0.1.1-alpha.22",
- "@backstage/config": "^0.1.1-alpha.22",
- "@backstage/config-loader": "^0.1.1-alpha.22",
+ "@backstage/cli-common": "^0.1.1-alpha.23",
+ "@backstage/config": "^0.1.1-alpha.23",
+ "@backstage/config-loader": "^0.1.1-alpha.23",
"@types/cors": "^2.8.6",
"@types/express": "^4.17.6",
"compression": "^1.7.4",
@@ -58,7 +58,7 @@
}
},
"devDependencies": {
- "@backstage/cli": "^0.1.1-alpha.22",
+ "@backstage/cli": "^0.1.1-alpha.23",
"@types/compression": "^1.7.0",
"@types/http-errors": "^1.6.3",
"@types/morgan": "^1.9.0",
diff --git a/packages/backend-common/src/config.ts b/packages/backend-common/src/config.ts
index 6f7500bb86..247eb593cc 100644
--- a/packages/backend-common/src/config.ts
+++ b/packages/backend-common/src/config.ts
@@ -23,7 +23,7 @@ import { loadConfig } from '@backstage/config-loader';
export async function loadBackendConfig() {
const paths = findPaths(__dirname);
const configs = await loadConfig({
- env: process.env.NODE_ENV,
+ env: process.env.NODE_ENV ?? 'development',
rootPaths: [paths.targetRoot, paths.targetDir],
shouldReadSecrets: true,
});
diff --git a/packages/backend/package.json b/packages/backend/package.json
index aa6f0ad0bf..e1b8665b57 100644
--- a/packages/backend/package.json
+++ b/packages/backend/package.json
@@ -1,6 +1,6 @@
{
"name": "example-backend",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"main": "dist/index.cjs.js",
"types": "src/index.ts",
"private": true,
@@ -18,23 +18,24 @@
"migrate:create": "knex migrate:make -x ts"
},
"dependencies": {
- "@backstage/backend-common": "^0.1.1-alpha.22",
- "@backstage/catalog-model": "^0.1.1-alpha.22",
- "@backstage/config": "^0.1.1-alpha.22",
- "@backstage/plugin-app-backend": "^0.1.1-alpha.22",
- "@backstage/plugin-auth-backend": "^0.1.1-alpha.22",
- "@backstage/plugin-catalog-backend": "^0.1.1-alpha.22",
- "@backstage/plugin-graphql-backend": "^0.1.1-alpha.22",
- "@backstage/plugin-identity-backend": "^0.1.1-alpha.22",
- "@backstage/plugin-proxy-backend": "^0.1.1-alpha.22",
- "@backstage/plugin-rollbar-backend": "^0.1.1-alpha.22",
- "@backstage/plugin-scaffolder-backend": "^0.1.1-alpha.22",
- "@backstage/plugin-sentry-backend": "^0.1.1-alpha.22",
- "@backstage/plugin-techdocs-backend": "^0.1.1-alpha.22",
+ "@backstage/backend-common": "^0.1.1-alpha.23",
+ "@backstage/catalog-model": "^0.1.1-alpha.23",
+ "@backstage/config": "^0.1.1-alpha.23",
+ "@backstage/plugin-app-backend": "^0.1.1-alpha.23",
+ "@backstage/plugin-auth-backend": "^0.1.1-alpha.23",
+ "@backstage/plugin-catalog-backend": "^0.1.1-alpha.23",
+ "@backstage/plugin-graphql-backend": "^0.1.1-alpha.23",
+ "@backstage/plugin-identity-backend": "^0.1.1-alpha.23",
+ "@backstage/plugin-kubernetes-backend": "^0.1.1-alpha.23",
+ "@backstage/plugin-proxy-backend": "^0.1.1-alpha.23",
+ "@backstage/plugin-rollbar-backend": "^0.1.1-alpha.23",
+ "@backstage/plugin-scaffolder-backend": "^0.1.1-alpha.23",
+ "@backstage/plugin-sentry-backend": "^0.1.1-alpha.23",
+ "@backstage/plugin-techdocs-backend": "^0.1.1-alpha.23",
"@gitbeaker/node": "^23.5.0",
"@octokit/rest": "^18.0.0",
"dockerode": "^3.2.0",
- "example-app": "^0.1.1-alpha.22",
+ "example-app": "^0.1.1-alpha.23",
"express": "^4.17.1",
"knex": "^0.21.1",
"pg": "^8.3.0",
@@ -43,7 +44,7 @@
"winston": "^3.2.1"
},
"devDependencies": {
- "@backstage/cli": "^0.1.1-alpha.22",
+ "@backstage/cli": "^0.1.1-alpha.23",
"@types/dockerode": "^2.5.32",
"@types/express": "^4.17.6",
"@types/express-serve-static-core": "^4.17.5",
diff --git a/packages/backend/src/index.ts b/packages/backend/src/index.ts
index ab32822769..7c52175d76 100644
--- a/packages/backend/src/index.ts
+++ b/packages/backend/src/index.ts
@@ -34,6 +34,7 @@ import healthcheck from './plugins/healthcheck';
import auth from './plugins/auth';
import catalog from './plugins/catalog';
import identity from './plugins/identity';
+import kubernetes from './plugins/kubernetes';
import rollbar from './plugins/rollbar';
import scaffolder from './plugins/scaffolder';
import sentry from './plugins/sentry';
@@ -73,6 +74,7 @@ async function main() {
const rollbarEnv = useHotMemoize(module, () => createEnv('rollbar'));
const sentryEnv = useHotMemoize(module, () => createEnv('sentry'));
const techdocsEnv = useHotMemoize(module, () => createEnv('techdocs'));
+ const kubernetesEnv = useHotMemoize(module, () => createEnv('kubernetes'));
const graphqlEnv = useHotMemoize(module, () => createEnv('graphql'));
const appEnv = useHotMemoize(module, () => createEnv('app'));
@@ -86,6 +88,7 @@ async function main() {
.addRouter('/auth', await auth(authEnv))
.addRouter('/identity', await identity(identityEnv))
.addRouter('/techdocs', await techdocs(techdocsEnv))
+ .addRouter('/kubernetes', await kubernetes(kubernetesEnv))
.addRouter('/proxy', await proxy(proxyEnv, '/proxy'))
.addRouter('/graphql', await graphql(graphqlEnv))
.addRouter('', await app(appEnv));
diff --git a/packages/backend/src/plugins/kubernetes.ts b/packages/backend/src/plugins/kubernetes.ts
new file mode 100644
index 0000000000..42b7722ff6
--- /dev/null
+++ b/packages/backend/src/plugins/kubernetes.ts
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2020 Spotify AB
+ *
+ * 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 { createRouter } from '@backstage/plugin-kubernetes-backend';
+import { PluginEnvironment } from '../types';
+
+export default async function createPlugin({ logger }: PluginEnvironment) {
+ return await createRouter({ logger });
+}
diff --git a/packages/backend/src/plugins/scaffolder.ts b/packages/backend/src/plugins/scaffolder.ts
index 2793a38459..f902ee76f0 100644
--- a/packages/backend/src/plugins/scaffolder.ts
+++ b/packages/backend/src/plugins/scaffolder.ts
@@ -26,7 +26,7 @@ import {
GitlabPublisher,
CreateReactAppTemplater,
Templaters,
- RepoVisilityOptions,
+ RepoVisibilityOptions,
} from '@backstage/plugin-scaffolder-backend';
import { Octokit } from '@octokit/rest';
import { Gitlab } from '@gitbeaker/node';
@@ -61,7 +61,7 @@ export default async function createPlugin({
try {
const repoVisibility = githubConfig.getString(
'visibility',
- ) as RepoVisilityOptions;
+ ) as RepoVisibilityOptions;
const githubToken = githubConfig.getString('token');
const githubClient = new Octokit({ auth: githubToken });
diff --git a/packages/catalog-model/package.json b/packages/catalog-model/package.json
index d683eec68d..96433a0f0e 100644
--- a/packages/catalog-model/package.json
+++ b/packages/catalog-model/package.json
@@ -1,6 +1,6 @@
{
"name": "@backstage/catalog-model",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -20,7 +20,7 @@
"clean": "backstage-cli clean"
},
"dependencies": {
- "@backstage/config": "^0.1.1-alpha.22",
+ "@backstage/config": "^0.1.1-alpha.23",
"@types/json-schema": "^7.0.5",
"@types/yup": "^0.28.2",
"json-schema": "^0.2.5",
@@ -29,7 +29,7 @@
"yup": "^0.29.1"
},
"devDependencies": {
- "@backstage/cli": "^0.1.1-alpha.22",
+ "@backstage/cli": "^0.1.1-alpha.23",
"@types/express": "^4.17.6",
"@types/jest": "^26.0.7",
"@types/lodash": "^4.14.151",
diff --git a/packages/cli-common/package.json b/packages/cli-common/package.json
index 1340b46ae3..bbd9a67387 100644
--- a/packages/cli-common/package.json
+++ b/packages/cli-common/package.json
@@ -1,7 +1,7 @@
{
"name": "@backstage/cli-common",
"description": "Common functionality used by cli, backend, and create-app",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"private": false,
"main": "src/index.ts",
"types": "src/index.ts",
diff --git a/packages/cli/package.json b/packages/cli/package.json
index e1f51be5b7..6f65658539 100644
--- a/packages/cli/package.json
+++ b/packages/cli/package.json
@@ -1,7 +1,7 @@
{
"name": "@backstage/cli",
"description": "CLI for developing Backstage plugins and apps",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"private": false,
"publishConfig": {
"access": "public"
@@ -28,9 +28,9 @@
"backstage-cli": "bin/backstage-cli"
},
"dependencies": {
- "@backstage/cli-common": "^0.1.1-alpha.22",
- "@backstage/config": "^0.1.1-alpha.22",
- "@backstage/config-loader": "^0.1.1-alpha.22",
+ "@backstage/cli-common": "^0.1.1-alpha.23",
+ "@backstage/config": "^0.1.1-alpha.23",
+ "@backstage/config-loader": "^0.1.1-alpha.23",
"@hot-loader/react-dom": "^16.13.0",
"@lerna/package-graph": "^3.18.5",
"@lerna/project": "^3.18.0",
diff --git a/packages/config-loader/package.json b/packages/config-loader/package.json
index 5960b553f7..09f8da3b70 100644
--- a/packages/config-loader/package.json
+++ b/packages/config-loader/package.json
@@ -1,7 +1,7 @@
{
"name": "@backstage/config-loader",
"description": "Config loading functionality used by Backstage backend, and CLI",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"private": false,
"publishConfig": {
"access": "public",
@@ -30,7 +30,7 @@
"clean": "backstage-cli clean"
},
"dependencies": {
- "@backstage/config": "^0.1.1-alpha.22",
+ "@backstage/config": "^0.1.1-alpha.23",
"fs-extra": "^9.0.0",
"yaml": "^1.9.2",
"yup": "^0.29.1"
diff --git a/packages/config/package.json b/packages/config/package.json
index 0b61e50ac6..58c86d6e96 100644
--- a/packages/config/package.json
+++ b/packages/config/package.json
@@ -1,7 +1,7 @@
{
"name": "@backstage/config",
"description": "Config API used by Backstage core, backend, and CLI",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"private": false,
"publishConfig": {
"access": "public",
diff --git a/packages/core-api/package.json b/packages/core-api/package.json
index 72d0748183..7d338c944d 100644
--- a/packages/core-api/package.json
+++ b/packages/core-api/package.json
@@ -1,7 +1,7 @@
{
"name": "@backstage/core-api",
"description": "Internal Core API used by Backstage plugins and apps",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"private": false,
"publishConfig": {
"access": "public",
@@ -29,8 +29,8 @@
"clean": "backstage-cli clean"
},
"dependencies": {
- "@backstage/config": "^0.1.1-alpha.22",
- "@backstage/theme": "^0.1.1-alpha.22",
+ "@backstage/config": "^0.1.1-alpha.23",
+ "@backstage/theme": "^0.1.1-alpha.23",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@types/react": "^16.9",
@@ -41,8 +41,8 @@
"zen-observable": "^0.8.15"
},
"devDependencies": {
- "@backstage/cli": "^0.1.1-alpha.22",
- "@backstage/test-utils-core": "^0.1.1-alpha.22",
+ "@backstage/cli": "^0.1.1-alpha.23",
+ "@backstage/test-utils-core": "^0.1.1-alpha.23",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^10.4.1",
"@testing-library/user-event": "^12.0.7",
diff --git a/packages/core-api/src/apis/definitions/IdentityApi.ts b/packages/core-api/src/apis/definitions/IdentityApi.ts
index 13f4cd24bc..2684422b1e 100644
--- a/packages/core-api/src/apis/definitions/IdentityApi.ts
+++ b/packages/core-api/src/apis/definitions/IdentityApi.ts
@@ -46,9 +46,9 @@ export type IdentityApi = {
// TODO: getProfile(): Promise - We want this to be async when added, but needs more work.
/**
- * Log out the current user
+ * Sign out the current user
*/
- logout(): Promise;
+ signOut(): Promise;
};
export const identityApiRef = createApiRef({
diff --git a/packages/core-api/src/apis/definitions/auth.ts b/packages/core-api/src/apis/definitions/auth.ts
index 1ff8c46dad..800a865fea 100644
--- a/packages/core-api/src/apis/definitions/auth.ts
+++ b/packages/core-api/src/apis/definitions/auth.ts
@@ -90,11 +90,6 @@ export type OAuthApi = {
scope?: OAuthScope,
options?: AuthRequestOptions,
): Promise;
-
- /**
- * Log out the user's session. This will reload the page.
- */
- logout(): Promise;
};
/**
@@ -114,11 +109,6 @@ export type OpenIdConnectApi = {
* The returned promise can be rejected, but only if the user rejects the login request.
*/
getIdToken(options?: AuthRequestOptions): Promise;
-
- /**
- * Log out the user's session. This will reload the page.
- */
- logout(): Promise;
};
/**
@@ -187,7 +177,7 @@ export type ProfileInfo = {
};
/**
- * Session state values passed to subscribers of the SessionStateApi.
+ * Session state values passed to subscribers of the SessionApi.
*/
export enum SessionState {
SignedIn = 'SignedIn',
@@ -195,10 +185,22 @@ export enum SessionState {
}
/**
- * This API provides access to an sessionState$ observable which provides an update when the
- * user performs a sign in or sign out from an auth provider.
+ * The SessionApi provides basic controls for any auth provider that is tied to a persistent session.
*/
-export type SessionStateApi = {
+export type SessionApi = {
+ /**
+ * Sign in with a minimum set of permissions.
+ */
+ signIn(): Promise;
+
+ /**
+ * Sign out from the current session. This will reload the page.
+ */
+ signOut(): Promise;
+
+ /**
+ * Observe the current state of the auth session. Emits the current state on subscription.
+ */
sessionState$(): Observable;
};
@@ -215,7 +217,7 @@ export const googleAuthApiRef = createApiRef<
OpenIdConnectApi &
ProfileInfoApi &
BackstageIdentityApi &
- SessionStateApi
+ SessionApi
>({
id: 'core.auth.google',
description: 'Provides authentication towards Google APIs and identities',
@@ -228,7 +230,7 @@ export const googleAuthApiRef = createApiRef<
* for a full list of supported scopes.
*/
export const githubAuthApiRef = createApiRef<
- OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionStateApi
+ OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi
>({
id: 'core.auth.github',
description: 'Provides authentication towards GitHub APIs',
@@ -245,7 +247,7 @@ export const oktaAuthApiRef = createApiRef<
OpenIdConnectApi &
ProfileInfoApi &
BackstageIdentityApi &
- SessionStateApi
+ SessionApi
>({
id: 'core.auth.okta',
description: 'Provides authentication towards Okta APIs',
@@ -258,7 +260,7 @@ export const oktaAuthApiRef = createApiRef<
* for a full list of supported scopes.
*/
export const gitlabAuthApiRef = createApiRef<
- OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionStateApi
+ OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionApi
>({
id: 'core.auth.gitlab',
description: 'Provides authentication towards GitLab APIs',
@@ -271,7 +273,7 @@ export const gitlabAuthApiRef = createApiRef<
* for a full list of supported scopes.
*/
export const auth0AuthApiRef = createApiRef<
- OpenIdConnectApi & ProfileInfoApi & BackstageIdentityApi & SessionStateApi
+ OpenIdConnectApi & ProfileInfoApi & BackstageIdentityApi & SessionApi
>({
id: 'core.auth.auth0',
description: 'Provides authentication towards Auth0 APIs',
@@ -289,7 +291,7 @@ export const microsoftAuthApiRef = createApiRef<
OpenIdConnectApi &
ProfileInfoApi &
BackstageIdentityApi &
- SessionStateApi
+ SessionApi
>({
id: 'core.auth.microsoft',
description: 'Provides authentication towards Microsoft APIs and identities',
@@ -302,8 +304,8 @@ export const oauth2ApiRef = createApiRef<
OAuthApi &
OpenIdConnectApi &
ProfileInfoApi &
- SessionStateApi &
- BackstageIdentityApi
+ BackstageIdentityApi &
+ SessionApi
>({
id: 'core.auth.oauth2',
description: 'Example of how to use oauth2 custom provider',
diff --git a/packages/core-api/src/apis/implementations/auth/github/GithubAuth.ts b/packages/core-api/src/apis/implementations/auth/github/GithubAuth.ts
index 8b9f807cd8..1d87ff3720 100644
--- a/packages/core-api/src/apis/implementations/auth/github/GithubAuth.ts
+++ b/packages/core-api/src/apis/implementations/auth/github/GithubAuth.ts
@@ -19,7 +19,7 @@ import { DefaultAuthConnector } from '../../../../lib/AuthConnector';
import { GithubSession } from './types';
import {
OAuthApi,
- SessionStateApi,
+ SessionApi,
SessionState,
ProfileInfo,
BackstageIdentity,
@@ -61,7 +61,7 @@ const DEFAULT_PROVIDER = {
icon: GithubIcon,
};
-class GithubAuth implements OAuthApi, SessionStateApi {
+class GithubAuth implements OAuthApi, SessionApi {
static create({
discoveryApi,
environment = 'development',
@@ -102,12 +102,20 @@ class GithubAuth implements OAuthApi, SessionStateApi {
return new GithubAuth(authSessionStore);
}
+ constructor(private readonly sessionManager: SessionManager) {}
+
+ async signIn() {
+ await this.getAccessToken();
+ }
+
+ async signOut() {
+ await this.sessionManager.removeSession();
+ }
+
sessionState$(): Observable {
return this.sessionManager.sessionState$();
}
- constructor(private readonly sessionManager: SessionManager) {}
-
async getAccessToken(scope?: string, options?: AuthRequestOptions) {
const session = await this.sessionManager.getSession({
...options,
@@ -128,10 +136,6 @@ class GithubAuth implements OAuthApi, SessionStateApi {
return session?.profile;
}
- async logout() {
- await this.sessionManager.removeSession();
- }
-
static normalizeScope(scope?: string): Set {
if (!scope) {
return new Set();
diff --git a/packages/core-api/src/apis/implementations/auth/oauth2/OAuth2.ts b/packages/core-api/src/apis/implementations/auth/oauth2/OAuth2.ts
index 27626aac5a..d088ca9798 100644
--- a/packages/core-api/src/apis/implementations/auth/oauth2/OAuth2.ts
+++ b/packages/core-api/src/apis/implementations/auth/oauth2/OAuth2.ts
@@ -32,7 +32,7 @@ import {
ProfileInfo,
ProfileInfoApi,
SessionState,
- SessionStateApi,
+ SessionApi,
BackstageIdentityApi,
} from '../../../definitions/auth';
import { OAuth2Session } from './types';
@@ -75,7 +75,7 @@ class OAuth2
OpenIdConnectApi,
ProfileInfoApi,
BackstageIdentityApi,
- SessionStateApi {
+ SessionApi {
static create({
discoveryApi,
environment = 'development',
@@ -129,6 +129,14 @@ class OAuth2
this.scopeTransform = options.scopeTransform;
}
+ async signIn() {
+ await this.getAccessToken();
+ }
+
+ async signOut() {
+ await this.sessionManager.removeSession();
+ }
+
sessionState$(): Observable {
return this.sessionManager.sessionState$();
}
@@ -150,10 +158,6 @@ class OAuth2
return session?.providerInfo.idToken ?? '';
}
- async logout() {
- await this.sessionManager.removeSession();
- }
-
async getBackstageIdentity(
options: AuthRequestOptions = {},
): Promise {
diff --git a/packages/core-api/src/app/AppIdentity.ts b/packages/core-api/src/app/AppIdentity.ts
index 69ee5d28ac..d3e5fe567a 100644
--- a/packages/core-api/src/app/AppIdentity.ts
+++ b/packages/core-api/src/app/AppIdentity.ts
@@ -26,7 +26,7 @@ export class AppIdentity implements IdentityApi {
private userId?: string;
private profile?: ProfileInfo;
private idTokenFunc?: () => Promise;
- private logoutFunc?: () => Promise;
+ private signOutFunc?: () => Promise;
getUserId(): string {
if (!this.hasIdentity) {
@@ -55,13 +55,13 @@ export class AppIdentity implements IdentityApi {
return this.idTokenFunc?.();
}
- async logout(): Promise {
+ async signOut(): Promise {
if (!this.hasIdentity) {
throw new Error(
- 'Tried to access IdentityApi logoutFunc before app was loaded',
+ 'Tried to access IdentityApi signOutFunc before app was loaded',
);
}
- await this.logoutFunc?.();
+ await this.signOutFunc?.();
location.reload();
}
@@ -80,6 +80,6 @@ export class AppIdentity implements IdentityApi {
this.userId = result.userId;
this.profile = result.profile;
this.idTokenFunc = result.getIdToken;
- this.logoutFunc = result.logout;
+ this.signOutFunc = result.signOut;
}
}
diff --git a/packages/core-api/src/app/types.ts b/packages/core-api/src/app/types.ts
index 565e073aed..882ecd3d8b 100644
--- a/packages/core-api/src/app/types.ts
+++ b/packages/core-api/src/app/types.ts
@@ -38,10 +38,11 @@ export type SignInResult = {
* Function used to retrieve an ID token for the signed in user.
*/
getIdToken?: () => Promise;
+
/**
- * Logout handler that will be called if the user requests a logout.
+ * Sign out handler that will be called if the user requests to sign out.
*/
- logout?: () => Promise;
+ signOut?: () => Promise;
};
export type SignInPageProps = {
diff --git a/packages/core/package.json b/packages/core/package.json
index 440f9f05b0..8749a37b92 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -1,7 +1,7 @@
{
"name": "@backstage/core",
"description": "Core API used by Backstage plugins and apps",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"private": false,
"publishConfig": {
"access": "public",
@@ -29,9 +29,9 @@
"clean": "backstage-cli clean"
},
"dependencies": {
- "@backstage/config": "^0.1.1-alpha.22",
- "@backstage/core-api": "0.1.1-alpha.22",
- "@backstage/theme": "^0.1.1-alpha.22",
+ "@backstage/config": "^0.1.1-alpha.23",
+ "@backstage/core-api": "^0.1.1-alpha.23",
+ "@backstage/theme": "^0.1.1-alpha.23",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "4.0.0-alpha.45",
@@ -54,8 +54,8 @@
"react-use": "^15.3.3"
},
"devDependencies": {
- "@backstage/cli": "^0.1.1-alpha.22",
- "@backstage/test-utils": "^0.1.1-alpha.22",
+ "@backstage/cli": "^0.1.1-alpha.23",
+ "@backstage/test-utils": "^0.1.1-alpha.23",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^10.4.1",
"@testing-library/user-event": "^12.0.7",
diff --git a/packages/core/src/layout/InfoCard/InfoCard.tsx b/packages/core/src/layout/InfoCard/InfoCard.tsx
index 6914d396b1..09d31735cd 100644
--- a/packages/core/src/layout/InfoCard/InfoCard.tsx
+++ b/packages/core/src/layout/InfoCard/InfoCard.tsx
@@ -37,6 +37,7 @@ const useStyles = makeStyles(theme => ({
},
},
header: {
+ display: 'inline-block',
padding: theme.spacing(2, 2, 2, 2.5),
},
headerTitle: {
@@ -202,7 +203,7 @@ export const InfoCard = ({
}}
title={title}
subheader={subheader}
- style={{ display: 'inline-block', ...headerStyle }}
+ style={{ ...headerStyle }}
{...headerProps}
/>
diff --git a/packages/core/src/layout/Sidebar/DefaultProviderSettings.tsx b/packages/core/src/layout/Sidebar/DefaultProviderSettings.tsx
index 293cefb19a..f96c6adb2f 100644
--- a/packages/core/src/layout/Sidebar/DefaultProviderSettings.tsx
+++ b/packages/core/src/layout/Sidebar/DefaultProviderSettings.tsx
@@ -25,7 +25,7 @@ import {
} from '@backstage/core-api';
import Star from '@material-ui/icons/Star';
import React from 'react';
-import { OAuthProviderSettings, OIDCProviderSettings } from './Settings';
+import { ProviderSettingsItem } from './Settings';
export const DefaultProviderSettings = () => {
const configApi = useApi(configApiRef);
@@ -35,42 +35,42 @@ export const DefaultProviderSettings = () => {
return (
<>
{providers.includes('google') && (
-
)}
{providers.includes('microsoft') && (
-
)}
{providers.includes('github') && (
-
)}
{providers.includes('gitlab') && (
-
)}
{providers.includes('okta') && (
-
)}
{providers.includes('oauth2') && (
- ;
-};
-
-export const OAuthProviderSettings: FC = ({
- title,
- icon,
- apiRef,
-}) => {
- const api = useApi(apiRef);
- const [signedIn, setSignedIn] = useState(false);
-
- useEffect(() => {
- let didCancel = false;
-
- const checkSession = async () => {
- const session = await api.getAccessToken('', { optional: true });
- if (!didCancel) {
- setSignedIn(!!session);
- }
- };
- let subscription: Subscription;
- const observeSession = () => {
- subscription = api
- .sessionState$()
- .subscribe((sessionState: SessionState) => {
- if (!didCancel) {
- setSignedIn(sessionState === SessionState.SignedIn);
- }
- });
- };
-
- checkSession();
- observeSession();
- return () => {
- didCancel = true;
- subscription.unsubscribe();
- };
- }, [api]);
-
- return (
- api.getAccessToken()}
- />
- );
-};
diff --git a/packages/core/src/layout/Sidebar/Settings/OIDCProviderSettings.tsx b/packages/core/src/layout/Sidebar/Settings/OIDCProviderSettings.tsx
deleted file mode 100644
index 19ee00eee1..0000000000
--- a/packages/core/src/layout/Sidebar/Settings/OIDCProviderSettings.tsx
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright 2020 Spotify AB
- *
- * 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 {
- ApiRef,
- OpenIdConnectApi,
- SessionStateApi,
- useApi,
- Subscription,
- IconComponent,
- SessionState,
-} from '@backstage/core-api';
-import React, { FC, useState, useEffect } from 'react';
-import { ProviderSettingsItem } from './ProviderSettingsItem';
-
-export type OIDCProviderSidebarProps = {
- title: string;
- icon: IconComponent;
- apiRef: ApiRef;
-};
-
-export const OIDCProviderSettings: FC = ({
- title,
- icon,
- apiRef,
-}) => {
- const api = useApi(apiRef);
- const [signedIn, setSignedIn] = useState(false);
-
- useEffect(() => {
- let didCancel = false;
-
- const checkSession = async () => {
- const session = await api.getIdToken({ optional: true });
- if (!didCancel) {
- setSignedIn(!!session);
- }
- };
-
- let subscription: Subscription;
- const observeSession = () => {
- subscription = api
- .sessionState$()
- .subscribe((sessionState: SessionState) => {
- if (!didCancel) {
- setSignedIn(sessionState === SessionState.SignedIn);
- }
- });
- };
-
- checkSession();
- observeSession();
- return () => {
- didCancel = true;
- subscription.unsubscribe();
- };
- }, [api]);
-
- return (
- api.getIdToken()}
- />
- );
-};
diff --git a/packages/core/src/layout/Sidebar/Settings/ProviderSettingsItem.tsx b/packages/core/src/layout/Sidebar/Settings/ProviderSettingsItem.tsx
index 653c64575b..4db7ea0823 100644
--- a/packages/core/src/layout/Sidebar/Settings/ProviderSettingsItem.tsx
+++ b/packages/core/src/layout/Sidebar/Settings/ProviderSettingsItem.tsx
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-import React from 'react';
-import { IconComponent, OAuthApi, OpenIdConnectApi } from '@backstage/core-api';
+import React, { FC, useState, useEffect } from 'react';
import {
ListItem,
ListItemIcon,
@@ -25,42 +24,67 @@ import {
} from '@material-ui/core';
import PowerButton from '@material-ui/icons/PowerSettingsNew';
import { ToggleButton } from '@material-ui/lab';
+import {
+ ApiRef,
+ SessionApi,
+ useApi,
+ IconComponent,
+ SessionState,
+} from '@backstage/core-api';
-type Props = {
+type OAuthProviderSidebarProps = {
title: string;
icon: IconComponent;
- signedIn: boolean;
- api: OAuthApi | OpenIdConnectApi;
- signInHandler: Function;
+ apiRef: ApiRef;
};
-export const ProviderSettingsItem = ({
+export const ProviderSettingsItem: FC = ({
title,
icon: Icon,
- signedIn,
- api,
- signInHandler,
-}: Props) => (
-
-
-
-
-
-
- (signedIn ? api.logout() : signInHandler())}
- >
- {
+ const api = useApi(apiRef);
+ const [signedIn, setSignedIn] = useState(false);
+
+ useEffect(() => {
+ let didCancel = false;
+
+ const subscription = api
+ .sessionState$()
+ .subscribe((sessionState: SessionState) => {
+ if (!didCancel) {
+ setSignedIn(sessionState === SessionState.SignedIn);
+ }
+ });
+
+ return () => {
+ didCancel = true;
+ subscription.unsubscribe();
+ };
+ }, [api]);
+
+ return (
+
+
+
+
+
+
+ (signedIn ? api.signOut() : api.signIn())}
>
-
-
-
-
-
-);
+
+
+
+
+
+
+ );
+};
diff --git a/packages/core/src/layout/Sidebar/Settings/UserSettingsMenu.tsx b/packages/core/src/layout/Sidebar/Settings/UserSettingsMenu.tsx
index 9ac287c57e..151ddb6e75 100644
--- a/packages/core/src/layout/Sidebar/Settings/UserSettingsMenu.tsx
+++ b/packages/core/src/layout/Sidebar/Settings/UserSettingsMenu.tsx
@@ -43,7 +43,7 @@ export const UserSettingsMenu = () => {
- identityApi.logout()}>
+ identityApi.signOut()}>
diff --git a/packages/core/src/layout/Sidebar/Settings/index.ts b/packages/core/src/layout/Sidebar/Settings/index.ts
index 7abf061620..15042dc85d 100644
--- a/packages/core/src/layout/Sidebar/Settings/index.ts
+++ b/packages/core/src/layout/Sidebar/Settings/index.ts
@@ -15,6 +15,4 @@
*/
export { ProviderSettingsItem } from './ProviderSettingsItem';
-export { OAuthProviderSettings } from './OAuthProviderSettings';
-export { OIDCProviderSettings } from './OIDCProviderSettings';
export { SidebarUserSettings } from './UserSettings';
diff --git a/packages/core/src/layout/Sidebar/Sidebar.stories.tsx b/packages/core/src/layout/Sidebar/Sidebar.stories.tsx
index d7451965fe..61975a728a 100644
--- a/packages/core/src/layout/Sidebar/Sidebar.stories.tsx
+++ b/packages/core/src/layout/Sidebar/Sidebar.stories.tsx
@@ -23,7 +23,7 @@ import {
SidebarSearchField,
SidebarSpace,
SidebarUserSettings,
- OAuthProviderSettings,
+ ProviderSettingsItem,
} from '.';
import HomeOutlinedIcon from '@material-ui/icons/HomeOutlined';
import AddCircleOutlineIcon from '@material-ui/icons/AddCircleOutline';
@@ -60,7 +60,7 @@ export const SampleSidebar = () => (
{
profile: profile!,
getIdToken: () =>
auth0AuthApi.getBackstageIdentity().then(i => i!.idToken),
- logout: async () => {
- await auth0AuthApi.logout();
+ signOut: async () => {
+ await auth0AuthApi.signOut();
},
});
} catch (error) {
@@ -79,8 +79,8 @@ const loader: ProviderLoader = async apis => {
userId: identity.id,
profile: profile!,
getIdToken: () => auth0AuthApi.getBackstageIdentity().then(i => i!.idToken),
- logout: async () => {
- await auth0AuthApi.logout();
+ signOut: async () => {
+ await auth0AuthApi.signOut();
},
};
};
diff --git a/packages/core/src/layout/SignInPage/commonProvider.tsx b/packages/core/src/layout/SignInPage/commonProvider.tsx
index de9452a850..b7480afa49 100644
--- a/packages/core/src/layout/SignInPage/commonProvider.tsx
+++ b/packages/core/src/layout/SignInPage/commonProvider.tsx
@@ -44,8 +44,8 @@ const Component: ProviderComponent = ({ config, onResult }) => {
getIdToken: () => {
return authApi.getBackstageIdentity().then(i => i!.idToken);
},
- logout: async () => {
- await authApi.logout();
+ signOut: async () => {
+ await authApi.signOut();
},
});
} catch (error) {
@@ -87,8 +87,8 @@ const loader: ProviderLoader = async (apis, apiRef) => {
userId: identity.id,
profile: profile!,
getIdToken: () => authApi.getBackstageIdentity().then(i => i!.idToken),
- logout: async () => {
- await authApi.logout();
+ signOut: async () => {
+ await authApi.signOut();
},
};
};
diff --git a/packages/core/src/layout/SignInPage/providers.tsx b/packages/core/src/layout/SignInPage/providers.tsx
index ff60eba228..e2c17ab80d 100644
--- a/packages/core/src/layout/SignInPage/providers.tsx
+++ b/packages/core/src/layout/SignInPage/providers.tsx
@@ -83,14 +83,14 @@ export const useSignInProviders = (
const apiHolder = useApiHolder();
const [loading, setLoading] = useState(true);
- // This decorates the result with logout logic from this hook
+ // This decorates the result with sign out logic from this hook
const handleWrappedResult = useCallback(
(result: SignInResult) => {
onResult({
...result,
- logout: async () => {
+ signOut: async () => {
localStorage.removeItem(PROVIDER_STORAGE_KEY);
- await result.logout?.();
+ await result.signOut?.();
},
});
},
diff --git a/packages/core/src/layout/SignInPage/types.ts b/packages/core/src/layout/SignInPage/types.ts
index 9c501e8095..48945e6988 100644
--- a/packages/core/src/layout/SignInPage/types.ts
+++ b/packages/core/src/layout/SignInPage/types.ts
@@ -20,19 +20,16 @@ import {
SignInResult,
ApiHolder,
ApiRef,
- OAuthApi,
ProfileInfoApi,
BackstageIdentityApi,
- SessionStateApi,
+ SessionApi,
} from '@backstage/core-api';
export type SignInConfig = {
id: string;
title: string;
message: string;
- apiRef: ApiRef<
- OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionStateApi
- >;
+ apiRef: ApiRef;
};
export type IdentityProviders = ('guest' | 'custom' | SignInConfig)[];
@@ -43,9 +40,7 @@ export type ProviderComponent = ComponentType<
export type ProviderLoader = (
apis: ApiHolder,
- apiRef: ApiRef<
- OAuthApi & ProfileInfoApi & BackstageIdentityApi & SessionStateApi
- >,
+ apiRef: ApiRef,
) => Promise;
export type SignInProvider = {
diff --git a/packages/create-app/package.json b/packages/create-app/package.json
index b303c2423b..46ccfa0b40 100644
--- a/packages/create-app/package.json
+++ b/packages/create-app/package.json
@@ -1,7 +1,7 @@
{
"name": "@backstage/create-app",
"description": "Create app package for Backstage",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"private": false,
"publishConfig": {
"access": "public"
@@ -27,7 +27,7 @@
"start": "nodemon --"
},
"dependencies": {
- "@backstage/cli-common": "^0.1.1-alpha.22",
+ "@backstage/cli-common": "^0.1.1-alpha.23",
"chalk": "^4.0.0",
"commander": "^6.1.0",
"fs-extra": "^9.0.0",
diff --git a/packages/create-app/templates/default-app/packages/backend/src/plugins/scaffolder.ts b/packages/create-app/templates/default-app/packages/backend/src/plugins/scaffolder.ts
index df5e0a79c1..cfdfbb0a78 100644
--- a/packages/create-app/templates/default-app/packages/backend/src/plugins/scaffolder.ts
+++ b/packages/create-app/templates/default-app/packages/backend/src/plugins/scaffolder.ts
@@ -10,7 +10,7 @@ import {
GitlabPublisher,
CreateReactAppTemplater,
Templaters,
- RepoVisilityOptions,
+ RepoVisibilityOptions,
} from '@backstage/plugin-scaffolder-backend';
import { Octokit } from '@octokit/rest';
import { Gitlab } from '@gitbeaker/node';
@@ -42,7 +42,7 @@ export default async function createPlugin({
const githubToken = config.getString('scaffolder.github.token');
const repoVisibility = config.getString(
'scaffolder.github.visibility',
- ) as RepoVisilityOptions;
+ ) as RepoVisibilityOptions;
const githubClient = new Octokit({ auth: githubToken });
const githubPublisher = new GithubPublisher({
diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json
index 0b6e04f322..54880cee21 100644
--- a/packages/dev-utils/package.json
+++ b/packages/dev-utils/package.json
@@ -1,7 +1,7 @@
{
"name": "@backstage/dev-utils",
"description": "Utilities for developing Backstage plugins.",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"private": false,
"publishConfig": {
"access": "public",
@@ -29,10 +29,10 @@
"clean": "backstage-cli clean"
},
"dependencies": {
- "@backstage/cli": "^0.1.1-alpha.22",
- "@backstage/core": "^0.1.1-alpha.22",
- "@backstage/test-utils": "^0.1.1-alpha.22",
- "@backstage/theme": "^0.1.1-alpha.22",
+ "@backstage/cli": "^0.1.1-alpha.23",
+ "@backstage/core": "^0.1.1-alpha.23",
+ "@backstage/test-utils": "^0.1.1-alpha.23",
+ "@backstage/theme": "^0.1.1-alpha.23",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@testing-library/jest-dom": "^5.10.1",
diff --git a/packages/docgen/package.json b/packages/docgen/package.json
index 3836af6542..a60a4d1d70 100644
--- a/packages/docgen/package.json
+++ b/packages/docgen/package.json
@@ -1,7 +1,7 @@
{
"name": "docgen",
"description": "Tool for generating API Documentation for itself",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"private": true,
"homepage": "https://backstage.io",
"repository": {
diff --git a/packages/e2e-test/package.json b/packages/e2e-test/package.json
index e518d4f710..fdd8d089c7 100644
--- a/packages/e2e-test/package.json
+++ b/packages/e2e-test/package.json
@@ -1,7 +1,7 @@
{
"name": "e2e-test",
"description": "E2E test for verifying Backstage packages",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"private": true,
"homepage": "https://backstage.io",
"repository": {
@@ -21,7 +21,7 @@
"test:e2e": "yarn start"
},
"devDependencies": {
- "@backstage/cli-common": "^0.1.1-alpha.22",
+ "@backstage/cli-common": "^0.1.1-alpha.23",
"@types/fs-extra": "^9.0.1",
"@types/node": "^13.7.2",
"fs-extra": "^9.0.0",
diff --git a/packages/storybook/.storybook/apis.js b/packages/storybook/.storybook/apis.js
index a0a220d3de..878256ff5c 100644
--- a/packages/storybook/.storybook/apis.js
+++ b/packages/storybook/.storybook/apis.js
@@ -36,7 +36,7 @@ builder.add(identityApiRef, {
getUserId: () => 'guest',
getProfile: () => ({ email: 'guest@example.com' }),
getIdToken: () => undefined,
- logout: async () => {},
+ signOut: async () => {},
});
const oauthRequestApi = builder.add(
diff --git a/packages/storybook/package.json b/packages/storybook/package.json
index a1decf279a..87d41d47d1 100644
--- a/packages/storybook/package.json
+++ b/packages/storybook/package.json
@@ -1,6 +1,6 @@
{
"name": "storybook",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"description": "Storybook build for core package",
"private": true,
"scripts": {
@@ -14,7 +14,7 @@
]
},
"dependencies": {
- "@backstage/theme": "^0.1.1-alpha.22"
+ "@backstage/theme": "^0.1.1-alpha.23"
},
"devDependencies": {
"@storybook/addon-actions": "^6.0.21",
diff --git a/packages/techdocs-cli/package.json b/packages/techdocs-cli/package.json
index 340d9e2aff..6b31b4aae7 100644
--- a/packages/techdocs-cli/package.json
+++ b/packages/techdocs-cli/package.json
@@ -1,7 +1,7 @@
{
"name": "@techdocs/cli",
"description": "CLI for running TechDocs locally.",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"private": false,
"publishConfig": {
"access": "public"
@@ -44,7 +44,7 @@
"ext": "ts"
},
"dependencies": {
- "@backstage/cli": "^0.1.1-alpha.22",
+ "@backstage/cli": "^0.1.1-alpha.23",
"commander": "^6.1.0",
"fs-extra": "^9.0.1",
"http-proxy": "^1.18.1",
diff --git a/packages/techdocs-container/techdocs-core/setup.py b/packages/techdocs-container/techdocs-core/setup.py
index e5a8206150..00e49dd366 100644
--- a/packages/techdocs-container/techdocs-core/setup.py
+++ b/packages/techdocs-container/techdocs-core/setup.py
@@ -14,13 +14,19 @@ See the License for the specific language governing permissions and
limitations under the License.
"""
from setuptools import setup, find_packages
+from os import path
+# read the contents of the README file in the current directory
+this_dir = path.abspath(path.dirname(__file__))
+with open(path.join(this_dir, "README.md"), encoding="utf-8") as file:
+ long_description = file.read()
setup(
name="mkdocs-techdocs-core",
version="0.0.8",
description="A Mkdocs package that contains TechDocs defaults",
- long_description="",
+ long_description=long_description,
+ long_description_content_type="text/markdown",
keywords="mkdocs",
url="https://github.com/spotify/backstage",
author="TechDocs Core",
diff --git a/packages/test-utils-core/package.json b/packages/test-utils-core/package.json
index d79acf80a8..e30a1e9409 100644
--- a/packages/test-utils-core/package.json
+++ b/packages/test-utils-core/package.json
@@ -1,7 +1,7 @@
{
"name": "@backstage/test-utils-core",
"description": "Utilities to test Backstage core",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"private": false,
"publishConfig": {
"access": "public",
diff --git a/packages/test-utils/package.json b/packages/test-utils/package.json
index cb115fe633..2ca946e028 100644
--- a/packages/test-utils/package.json
+++ b/packages/test-utils/package.json
@@ -1,7 +1,7 @@
{
"name": "@backstage/test-utils",
"description": "Utilities to test Backstage plugins and apps.",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"private": false,
"publishConfig": {
"access": "public",
@@ -29,10 +29,10 @@
"clean": "backstage-cli clean"
},
"dependencies": {
- "@backstage/cli": "^0.1.1-alpha.22",
- "@backstage/core-api": "^0.1.1-alpha.22",
- "@backstage/test-utils-core": "^0.1.1-alpha.22",
- "@backstage/theme": "^0.1.1-alpha.22",
+ "@backstage/cli": "^0.1.1-alpha.23",
+ "@backstage/core-api": "^0.1.1-alpha.23",
+ "@backstage/test-utils-core": "^0.1.1-alpha.23",
+ "@backstage/theme": "^0.1.1-alpha.23",
"@material-ui/core": "^4.11.0",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^10.4.1",
diff --git a/packages/theme/package.json b/packages/theme/package.json
index a1a3d6d111..bd8705933f 100644
--- a/packages/theme/package.json
+++ b/packages/theme/package.json
@@ -1,7 +1,7 @@
{
"name": "@backstage/theme",
"description": "material-ui theme for use with Backstage.",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"private": false,
"publishConfig": {
"access": "public",
@@ -31,7 +31,7 @@
"@material-ui/core": "^4.11.0"
},
"devDependencies": {
- "@backstage/cli": "^0.1.1-alpha.22"
+ "@backstage/cli": "^0.1.1-alpha.23"
},
"files": [
"dist"
diff --git a/plugins/api-docs/package.json b/plugins/api-docs/package.json
index ee86e29183..b9e37d6d7a 100644
--- a/plugins/api-docs/package.json
+++ b/plugins/api-docs/package.json
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-api-docs",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -20,10 +20,10 @@
"clean": "backstage-cli clean"
},
"dependencies": {
- "@backstage/catalog-model": "^0.1.1-alpha.22",
- "@backstage/core": "^0.1.1-alpha.22",
- "@backstage/plugin-catalog": "^0.1.1-alpha.22",
- "@backstage/theme": "^0.1.1-alpha.22",
+ "@backstage/catalog-model": "^0.1.1-alpha.23",
+ "@backstage/core": "^0.1.1-alpha.23",
+ "@backstage/plugin-catalog": "^0.1.1-alpha.23",
+ "@backstage/theme": "^0.1.1-alpha.23",
"@kyma-project/asyncapi-react": "^0.11.0",
"@material-icons/font": "^1.0.2",
"@material-ui/core": "^4.11.0",
@@ -39,9 +39,9 @@
"swagger-ui-react": "^3.31.1"
},
"devDependencies": {
- "@backstage/cli": "^0.1.1-alpha.22",
- "@backstage/dev-utils": "^0.1.1-alpha.22",
- "@backstage/test-utils": "^0.1.1-alpha.22",
+ "@backstage/cli": "^0.1.1-alpha.23",
+ "@backstage/dev-utils": "^0.1.1-alpha.23",
+ "@backstage/test-utils": "^0.1.1-alpha.23",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^10.4.1",
"@testing-library/user-event": "^12.0.7",
diff --git a/plugins/app-backend/package.json b/plugins/app-backend/package.json
index 2854425e75..d403580f86 100644
--- a/plugins/app-backend/package.json
+++ b/plugins/app-backend/package.json
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-app-backend",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -20,8 +20,8 @@
"clean": "backstage-cli clean"
},
"dependencies": {
- "@backstage/backend-common": "^0.1.1-alpha.22",
- "@backstage/config-loader": "^0.1.1-alpha.22",
+ "@backstage/backend-common": "^0.1.1-alpha.23",
+ "@backstage/config-loader": "^0.1.1-alpha.23",
"@types/express": "^4.17.6",
"express": "^4.17.1",
"express-promise-router": "^3.0.3",
@@ -30,7 +30,7 @@
"yn": "^4.0.0"
},
"devDependencies": {
- "@backstage/cli": "^0.1.1-alpha.22",
+ "@backstage/cli": "^0.1.1-alpha.23",
"@types/supertest": "^2.0.8",
"msw": "^0.20.5",
"supertest": "^4.0.2"
diff --git a/plugins/auth-backend/package.json b/plugins/auth-backend/package.json
index aff6470e71..8a9bfadca1 100644
--- a/plugins/auth-backend/package.json
+++ b/plugins/auth-backend/package.json
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-auth-backend",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -20,8 +20,8 @@
"clean": "backstage-cli clean"
},
"dependencies": {
- "@backstage/backend-common": "^0.1.1-alpha.22",
- "@backstage/config": "^0.1.1-alpha.22",
+ "@backstage/backend-common": "^0.1.1-alpha.23",
+ "@backstage/config": "^0.1.1-alpha.23",
"@types/express": "^4.17.6",
"compression": "^1.7.4",
"cookie-parser": "^1.4.5",
@@ -49,7 +49,7 @@
"yn": "^4.0.0"
},
"devDependencies": {
- "@backstage/cli": "^0.1.1-alpha.22",
+ "@backstage/cli": "^0.1.1-alpha.23",
"@types/body-parser": "^1.19.0",
"@types/cookie-parser": "^1.4.2",
"@types/jwt-decode": "2.2.1",
diff --git a/plugins/catalog-backend/package.json b/plugins/catalog-backend/package.json
index f443ff362f..7e3134a012 100644
--- a/plugins/catalog-backend/package.json
+++ b/plugins/catalog-backend/package.json
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-catalog-backend",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -20,9 +20,9 @@
"clean": "backstage-cli clean"
},
"dependencies": {
- "@backstage/backend-common": "^0.1.1-alpha.22",
- "@backstage/catalog-model": "^0.1.1-alpha.22",
- "@backstage/config": "^0.1.1-alpha.22",
+ "@backstage/backend-common": "^0.1.1-alpha.23",
+ "@backstage/catalog-model": "^0.1.1-alpha.23",
+ "@backstage/config": "^0.1.1-alpha.23",
"@types/express": "^4.17.6",
"express": "^4.17.1",
"express-promise-router": "^3.0.3",
@@ -40,7 +40,7 @@
"yup": "^0.29.1"
},
"devDependencies": {
- "@backstage/cli": "^0.1.1-alpha.22",
+ "@backstage/cli": "^0.1.1-alpha.23",
"@types/git-url-parse": "^9.0.0",
"@types/lodash": "^4.14.151",
"@types/node-fetch": "^2.5.7",
diff --git a/plugins/catalog-graphql/package.json b/plugins/catalog-graphql/package.json
index 505f7bb4df..8597f3aa3c 100644
--- a/plugins/catalog-graphql/package.json
+++ b/plugins/catalog-graphql/package.json
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-catalog-graphql",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -20,9 +20,9 @@
"clean": "backstage-cli clean"
},
"dependencies": {
- "@backstage/catalog-model": "^0.1.1-alpha.22",
- "@backstage/backend-common": "^0.1.1-alpha.22",
- "@backstage/config": "^0.1.1-alpha.22",
+ "@backstage/backend-common": "^0.1.1-alpha.23",
+ "@backstage/catalog-model": "^0.1.1-alpha.23",
+ "@backstage/config": "^0.1.1-alpha.23",
"@graphql-modules/core": "^0.7.17",
"apollo-server": "^2.16.1",
"graphql": "^15.3.0",
@@ -32,16 +32,16 @@
"winston": "^3.2.1"
},
"devDependencies": {
- "@backstage/cli": "^0.1.1-alpha.22",
- "@types/express": "^4.17.7",
- "@types/supertest": "^2.0.8",
+ "@backstage/cli": "^0.1.1-alpha.23",
"@graphql-codegen/cli": "^1.17.7",
"@graphql-codegen/typescript": "^1.17.7",
"@graphql-codegen/typescript-resolvers": "^1.17.7",
- "ts-node": "^8.10.2",
+ "@types/express": "^4.17.7",
+ "@types/supertest": "^2.0.8",
"eslint-plugin-graphql": "^4.0.0",
"msw": "^0.20.5",
- "supertest": "^4.0.2"
+ "supertest": "^4.0.2",
+ "ts-node": "^8.10.2"
},
"files": [
"dist"
diff --git a/plugins/catalog-graphql/src/graphql/module.ts b/plugins/catalog-graphql/src/graphql/module.ts
index 06b2ea3f2b..be5fed11ef 100644
--- a/plugins/catalog-graphql/src/graphql/module.ts
+++ b/plugins/catalog-graphql/src/graphql/module.ts
@@ -22,6 +22,7 @@ import { Config } from '@backstage/config';
import { CatalogClient } from '../service/client';
import GraphQLJSON, { GraphQLJSONObject } from 'graphql-type-json';
import { Entity } from '@backstage/catalog-model';
+import typeDefs from '../schema';
export interface ModuleOptions {
logger: Logger;
@@ -31,8 +32,6 @@ export interface ModuleOptions {
export async function createModule(
options: ModuleOptions,
): Promise {
- const { default: typeDefs } = require('../schema');
-
const catalogClient = new CatalogClient(
options.config.getString('backend.baseUrl'),
);
diff --git a/plugins/catalog/package.json b/plugins/catalog/package.json
index 9d777c9bcd..d3241ec10d 100644
--- a/plugins/catalog/package.json
+++ b/plugins/catalog/package.json
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-catalog",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -21,11 +21,11 @@
"clean": "backstage-cli clean"
},
"dependencies": {
- "@backstage/catalog-model": "^0.1.1-alpha.22",
- "@backstage/core": "^0.1.1-alpha.22",
- "@backstage/plugin-scaffolder": "^0.1.1-alpha.22",
- "@backstage/plugin-techdocs": "^0.1.1-alpha.22",
- "@backstage/theme": "^0.1.1-alpha.22",
+ "@backstage/catalog-model": "^0.1.1-alpha.23",
+ "@backstage/core": "^0.1.1-alpha.23",
+ "@backstage/plugin-scaffolder": "^0.1.1-alpha.23",
+ "@backstage/plugin-techdocs": "^0.1.1-alpha.23",
+ "@backstage/theme": "^0.1.1-alpha.23",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "4.0.0-alpha.45",
@@ -41,9 +41,9 @@
"swr": "^0.3.0"
},
"devDependencies": {
- "@backstage/cli": "^0.1.1-alpha.22",
- "@backstage/dev-utils": "^0.1.1-alpha.22",
- "@backstage/test-utils": "^0.1.1-alpha.22",
+ "@backstage/cli": "^0.1.1-alpha.23",
+ "@backstage/dev-utils": "^0.1.1-alpha.23",
+ "@backstage/test-utils": "^0.1.1-alpha.23",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^10.4.1",
"@testing-library/react-hooks": "^3.3.0",
diff --git a/plugins/circleci/package.json b/plugins/circleci/package.json
index 7dce54f8b3..a661c2562f 100644
--- a/plugins/circleci/package.json
+++ b/plugins/circleci/package.json
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-circleci",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -21,10 +21,10 @@
"postpack": "backstage-cli postpack"
},
"dependencies": {
- "@backstage/catalog-model": "^0.1.1-alpha.22",
- "@backstage/core": "^0.1.1-alpha.22",
- "@backstage/plugin-catalog": "^0.1.1-alpha.22",
- "@backstage/theme": "^0.1.1-alpha.22",
+ "@backstage/catalog-model": "^0.1.1-alpha.23",
+ "@backstage/core": "^0.1.1-alpha.23",
+ "@backstage/plugin-catalog": "^0.1.1-alpha.23",
+ "@backstage/theme": "^0.1.1-alpha.23",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "4.0.0-alpha.45",
@@ -38,8 +38,8 @@
"react-use": "^15.3.3"
},
"devDependencies": {
- "@backstage/cli": "^0.1.1-alpha.22",
- "@backstage/dev-utils": "^0.1.1-alpha.22",
+ "@backstage/cli": "^0.1.1-alpha.23",
+ "@backstage/dev-utils": "^0.1.1-alpha.23",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^10.4.1",
"@testing-library/user-event": "^12.0.7",
diff --git a/plugins/circleci/src/components/Router.tsx b/plugins/circleci/src/components/Router.tsx
index 282eac9111..41764b3d7d 100644
--- a/plugins/circleci/src/components/Router.tsx
+++ b/plugins/circleci/src/components/Router.tsx
@@ -24,8 +24,7 @@ import { Entity } from '@backstage/catalog-model';
import { WarningPanel } from '@backstage/core';
export const isPluginApplicableToEntity = (entity: Entity) =>
- Boolean(entity.metadata.annotations?.[CIRCLECI_ANNOTATION]) &&
- entity.metadata.annotations?.[CIRCLECI_ANNOTATION] !== '';
+ Boolean(entity.metadata.annotations?.[CIRCLECI_ANNOTATION]);
export const Router = ({ entity }: { entity: Entity }) =>
!isPluginApplicableToEntity(entity) ? (
diff --git a/plugins/explore/package.json b/plugins/explore/package.json
index 7a46a2954f..2f25b4f137 100644
--- a/plugins/explore/package.json
+++ b/plugins/explore/package.json
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-explore",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -21,8 +21,8 @@
"start": "backstage-cli plugin:serve"
},
"dependencies": {
- "@backstage/core": "^0.1.1-alpha.22",
- "@backstage/theme": "^0.1.1-alpha.22",
+ "@backstage/core": "^0.1.1-alpha.23",
+ "@backstage/theme": "^0.1.1-alpha.23",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "4.0.0-alpha.45",
@@ -33,9 +33,9 @@
"react-use": "^15.3.3"
},
"devDependencies": {
- "@backstage/cli": "^0.1.1-alpha.22",
- "@backstage/dev-utils": "^0.1.1-alpha.22",
- "@backstage/test-utils": "^0.1.1-alpha.22",
+ "@backstage/cli": "^0.1.1-alpha.23",
+ "@backstage/dev-utils": "^0.1.1-alpha.23",
+ "@backstage/test-utils": "^0.1.1-alpha.23",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^10.4.1",
"@testing-library/user-event": "^12.0.7",
diff --git a/plugins/gcp-projects/package.json b/plugins/gcp-projects/package.json
index c6424056c8..6669e1230d 100644
--- a/plugins/gcp-projects/package.json
+++ b/plugins/gcp-projects/package.json
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-gcp-projects",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -21,8 +21,8 @@
"clean": "backstage-cli clean"
},
"dependencies": {
- "@backstage/core": "^0.1.1-alpha.22",
- "@backstage/theme": "^0.1.1-alpha.22",
+ "@backstage/core": "^0.1.1-alpha.23",
+ "@backstage/theme": "^0.1.1-alpha.23",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "4.0.0-alpha.45",
@@ -32,8 +32,8 @@
"react-use": "^15.3.3"
},
"devDependencies": {
- "@backstage/cli": "^0.1.1-alpha.22",
- "@backstage/dev-utils": "^0.1.1-alpha.22",
+ "@backstage/cli": "^0.1.1-alpha.23",
+ "@backstage/dev-utils": "^0.1.1-alpha.23",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^10.4.1",
"@testing-library/user-event": "^12.0.7",
diff --git a/plugins/github-actions/package.json b/plugins/github-actions/package.json
index 8ee00bef06..5d85d8b3fa 100644
--- a/plugins/github-actions/package.json
+++ b/plugins/github-actions/package.json
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-github-actions",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -21,11 +21,11 @@
"clean": "backstage-cli clean"
},
"dependencies": {
- "@backstage/catalog-model": "^0.1.1-alpha.22",
- "@backstage/core": "^0.1.1-alpha.22",
- "@backstage/core-api": "^0.1.1-alpha.22",
- "@backstage/plugin-catalog": "^0.1.1-alpha.22",
- "@backstage/theme": "^0.1.1-alpha.22",
+ "@backstage/catalog-model": "^0.1.1-alpha.23",
+ "@backstage/core": "^0.1.1-alpha.23",
+ "@backstage/core-api": "^0.1.1-alpha.23",
+ "@backstage/plugin-catalog": "^0.1.1-alpha.23",
+ "@backstage/theme": "^0.1.1-alpha.23",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "4.0.0-alpha.45",
@@ -40,8 +40,8 @@
"react-use": "^15.3.3"
},
"devDependencies": {
- "@backstage/cli": "^0.1.1-alpha.22",
- "@backstage/dev-utils": "^0.1.1-alpha.22",
+ "@backstage/cli": "^0.1.1-alpha.23",
+ "@backstage/dev-utils": "^0.1.1-alpha.23",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^10.4.1",
"@testing-library/user-event": "^12.0.7",
diff --git a/plugins/github-actions/src/components/Router.tsx b/plugins/github-actions/src/components/Router.tsx
index 7d340fb8b8..fae56a0480 100644
--- a/plugins/github-actions/src/components/Router.tsx
+++ b/plugins/github-actions/src/components/Router.tsx
@@ -23,13 +23,12 @@ import { GITHUB_ACTIONS_ANNOTATION } from './useProjectName';
import { WarningPanel } from '@backstage/core';
export const isPluginApplicableToEntity = (entity: Entity) =>
- Boolean(entity.metadata.annotations?.[GITHUB_ACTIONS_ANNOTATION]) &&
- entity.metadata.annotations?.[GITHUB_ACTIONS_ANNOTATION] !== '';
+ Boolean(entity.metadata.annotations?.[GITHUB_ACTIONS_ANNOTATION]);
export const Router = ({ entity }: { entity: Entity }) =>
// TODO(shmidt-i): move warning to a separate standardized component
!isPluginApplicableToEntity(entity) ? (
-
+
{GITHUB_ACTIONS_ANNOTATION} annotation is missing on the
entity.
diff --git a/plugins/gitops-profiles/package.json b/plugins/gitops-profiles/package.json
index 79b9b3a708..a58ba6576a 100644
--- a/plugins/gitops-profiles/package.json
+++ b/plugins/gitops-profiles/package.json
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-gitops-profiles",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -21,8 +21,8 @@
"clean": "backstage-cli clean"
},
"dependencies": {
- "@backstage/core": "^0.1.1-alpha.22",
- "@backstage/theme": "^0.1.1-alpha.22",
+ "@backstage/core": "^0.1.1-alpha.23",
+ "@backstage/theme": "^0.1.1-alpha.23",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "4.0.0-alpha.45",
@@ -32,8 +32,8 @@
"react-use": "^15.3.3"
},
"devDependencies": {
- "@backstage/cli": "^0.1.1-alpha.22",
- "@backstage/dev-utils": "^0.1.1-alpha.22",
+ "@backstage/cli": "^0.1.1-alpha.23",
+ "@backstage/dev-utils": "^0.1.1-alpha.23",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^10.4.1",
"@testing-library/user-event": "^12.0.7",
diff --git a/plugins/graphiql/package.json b/plugins/graphiql/package.json
index ab80901fa0..1db4bba978 100644
--- a/plugins/graphiql/package.json
+++ b/plugins/graphiql/package.json
@@ -1,7 +1,7 @@
{
"name": "@backstage/plugin-graphiql",
"description": "Backstage plugin for browsing GraphQL APIs",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"private": false,
"publishConfig": {
"access": "public",
@@ -31,8 +31,8 @@
"clean": "backstage-cli clean"
},
"dependencies": {
- "@backstage/core": "^0.1.1-alpha.22",
- "@backstage/theme": "^0.1.1-alpha.22",
+ "@backstage/core": "^0.1.1-alpha.23",
+ "@backstage/theme": "^0.1.1-alpha.23",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "4.0.0-alpha.45",
@@ -43,9 +43,9 @@
"react-use": "^15.3.3"
},
"devDependencies": {
- "@backstage/cli": "^0.1.1-alpha.22",
- "@backstage/dev-utils": "^0.1.1-alpha.22",
- "@backstage/test-utils": "^0.1.1-alpha.22",
+ "@backstage/cli": "^0.1.1-alpha.23",
+ "@backstage/dev-utils": "^0.1.1-alpha.23",
+ "@backstage/test-utils": "^0.1.1-alpha.23",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^10.4.1",
"@testing-library/user-event": "^12.0.7",
diff --git a/plugins/graphql/package.json b/plugins/graphql/package.json
index 9ba972bd22..f008e6f51e 100644
--- a/plugins/graphql/package.json
+++ b/plugins/graphql/package.json
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-graphql-backend",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -19,10 +19,10 @@
"clean": "backstage-cli clean"
},
"dependencies": {
- "@backstage/config": "^0.1.1-alpha.22",
- "@backstage/plugin-catalog-graphql": "^0.1.1-alpha.22",
+ "@backstage/backend-common": "^0.1.1-alpha.23",
+ "@backstage/config": "^0.1.1-alpha.23",
+ "@backstage/plugin-catalog-graphql": "^0.1.1-alpha.23",
"@graphql-modules/core": "^0.7.17",
- "@backstage/backend-common": "^0.1.1-alpha.22",
"@types/express": "^4.17.6",
"apollo-server": "^2.16.1",
"apollo-server-express": "^2.16.1",
@@ -36,7 +36,7 @@
"yn": "^4.0.0"
},
"devDependencies": {
- "@backstage/cli": "^0.1.1-alpha.22",
+ "@backstage/cli": "^0.1.1-alpha.23",
"@types/supertest": "^2.0.8",
"eslint-plugin-graphql": "^4.0.0",
"msw": "^0.20.5",
diff --git a/plugins/identity-backend/package.json b/plugins/identity-backend/package.json
index ab006d3ecc..63ecb65d1e 100644
--- a/plugins/identity-backend/package.json
+++ b/plugins/identity-backend/package.json
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-identity-backend",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -20,7 +20,7 @@
"clean": "backstage-cli clean"
},
"dependencies": {
- "@backstage/backend-common": "^0.1.1-alpha.22",
+ "@backstage/backend-common": "^0.1.1-alpha.23",
"@types/express": "^4.17.6",
"compression": "^1.7.4",
"cors": "^2.8.5",
@@ -33,7 +33,7 @@
"yn": "^4.0.0"
},
"devDependencies": {
- "@backstage/cli": "^0.1.1-alpha.22",
+ "@backstage/cli": "^0.1.1-alpha.23",
"jest-fetch-mock": "^3.0.3",
"msw": "^0.20.5"
},
diff --git a/plugins/jenkins/package.json b/plugins/jenkins/package.json
index 091ef9356a..84e8a47664 100644
--- a/plugins/jenkins/package.json
+++ b/plugins/jenkins/package.json
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-jenkins",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -21,10 +21,10 @@
"clean": "backstage-cli clean"
},
"dependencies": {
- "@backstage/catalog-model": "^0.1.1-alpha.22",
- "@backstage/core": "^0.1.1-alpha.22",
- "@backstage/plugin-catalog": "^0.1.1-alpha.22",
- "@backstage/theme": "^0.1.1-alpha.22",
+ "@backstage/catalog-model": "^0.1.1-alpha.23",
+ "@backstage/core": "^0.1.1-alpha.23",
+ "@backstage/plugin-catalog": "^0.1.1-alpha.23",
+ "@backstage/theme": "^0.1.1-alpha.23",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "4.0.0-alpha.45",
@@ -36,8 +36,8 @@
"react-use": "^15.3.3"
},
"devDependencies": {
- "@backstage/cli": "^0.1.1-alpha.22",
- "@backstage/dev-utils": "^0.1.1-alpha.22",
+ "@backstage/cli": "^0.1.1-alpha.23",
+ "@backstage/dev-utils": "^0.1.1-alpha.23",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^10.4.1",
"@testing-library/user-event": "^12.0.7",
diff --git a/plugins/jenkins/src/components/Router.tsx b/plugins/jenkins/src/components/Router.tsx
index 56df5456bc..a4c7314691 100644
--- a/plugins/jenkins/src/components/Router.tsx
+++ b/plugins/jenkins/src/components/Router.tsx
@@ -23,8 +23,7 @@ import { WarningPanel } from '@backstage/core';
import { CITable } from './BuildsPage/lib/CITable';
export const isPluginApplicableToEntity = (entity: Entity) =>
- Boolean(entity.metadata.annotations?.[JENKINS_ANNOTATION]) &&
- entity.metadata.annotations?.[JENKINS_ANNOTATION] !== '';
+ Boolean(entity.metadata.annotations?.[JENKINS_ANNOTATION]);
export const Router = ({ entity }: { entity: Entity }) => {
return !isPluginApplicableToEntity(entity) ? (
diff --git a/plugins/kubernetes-backend/.eslintrc.js b/plugins/kubernetes-backend/.eslintrc.js
new file mode 100644
index 0000000000..16a033dbc6
--- /dev/null
+++ b/plugins/kubernetes-backend/.eslintrc.js
@@ -0,0 +1,3 @@
+module.exports = {
+ extends: [require.resolve('@backstage/cli/config/eslint.backend')],
+};
diff --git a/plugins/kubernetes-backend/README.md b/plugins/kubernetes-backend/README.md
new file mode 100644
index 0000000000..0246da24ed
--- /dev/null
+++ b/plugins/kubernetes-backend/README.md
@@ -0,0 +1,11 @@
+# Kubernetes Backend
+
+WORK IN PROGRESS
+
+This is the backend part of the Kubernetes plugin.
+
+It responds to Kubernetes requests from the frontend.
+
+## Links
+
+- [The Backstage homepage](https://backstage.io)
diff --git a/plugins/kubernetes-backend/package.json b/plugins/kubernetes-backend/package.json
new file mode 100644
index 0000000000..406d9c8d7f
--- /dev/null
+++ b/plugins/kubernetes-backend/package.json
@@ -0,0 +1,42 @@
+{
+ "name": "@backstage/plugin-kubernetes-backend",
+ "version": "0.1.1-alpha.23",
+ "main": "src/index.ts",
+ "types": "src/index.ts",
+ "license": "Apache-2.0",
+ "private": false,
+ "publishConfig": {
+ "access": "public",
+ "main": "dist/index.cjs.js",
+ "types": "dist/index.d.ts"
+ },
+ "scripts": {
+ "start": "backstage-cli backend:dev",
+ "build": "backstage-cli backend:build",
+ "lint": "backstage-cli lint",
+ "test": "backstage-cli test",
+ "prepack": "backstage-cli prepack",
+ "postpack": "backstage-cli postpack",
+ "clean": "backstage-cli clean"
+ },
+ "dependencies": {
+ "@backstage/backend-common": "^0.1.1-alpha.23",
+ "@types/express": "^4.17.6",
+ "compression": "^1.7.4",
+ "cors": "^2.8.5",
+ "express": "^4.17.1",
+ "express-promise-router": "^3.0.3",
+ "fs-extra": "^9.0.0",
+ "helmet": "^4.0.0",
+ "morgan": "^1.10.0",
+ "winston": "^3.2.1",
+ "yn": "^4.0.0"
+ },
+ "devDependencies": {
+ "@backstage/cli": "^0.1.1-alpha.23",
+ "jest-fetch-mock": "^3.0.3"
+ },
+ "files": [
+ "dist"
+ ]
+}
diff --git a/plugins/kubernetes-backend/src/index.test.ts b/plugins/kubernetes-backend/src/index.test.ts
new file mode 100644
index 0000000000..4fca4ca746
--- /dev/null
+++ b/plugins/kubernetes-backend/src/index.test.ts
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2020 Spotify AB
+ *
+ * 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 '@backstage/backend-common';
+
+describe('test', () => {
+ it('unbreaks the test runner', () => {
+ expect(true).toBeTruthy();
+ });
+});
diff --git a/plugins/kubernetes-backend/src/index.ts b/plugins/kubernetes-backend/src/index.ts
new file mode 100644
index 0000000000..7612c392a2
--- /dev/null
+++ b/plugins/kubernetes-backend/src/index.ts
@@ -0,0 +1,17 @@
+/*
+ * Copyright 2020 Spotify AB
+ *
+ * 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.
+ */
+
+export * from './service/router';
diff --git a/plugins/kubernetes-backend/src/run.ts b/plugins/kubernetes-backend/src/run.ts
new file mode 100644
index 0000000000..995adaff10
--- /dev/null
+++ b/plugins/kubernetes-backend/src/run.ts
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2020 Spotify AB
+ *
+ * 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 yn from 'yn';
+import { getRootLogger } from '@backstage/backend-common';
+import { startStandaloneServer } from './service/standaloneServer';
+
+const port = process.env.PLUGIN_PORT ? Number(process.env.PLUGIN_PORT) : 3004;
+const enableCors = yn(process.env.PLUGIN_CORS, { default: false });
+const logger = getRootLogger();
+
+startStandaloneServer({ port, enableCors, logger }).catch(err => {
+ logger.error(err);
+ process.exit(1);
+});
+
+process.on('SIGINT', () => {
+ logger.info('CTRL+C pressed; exiting.');
+ process.exit(0);
+});
diff --git a/plugins/kubernetes-backend/src/service/router.ts b/plugins/kubernetes-backend/src/service/router.ts
new file mode 100644
index 0000000000..b200896887
--- /dev/null
+++ b/plugins/kubernetes-backend/src/service/router.ts
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2020 Spotify AB
+ *
+ * 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 express from 'express';
+import Router from 'express-promise-router';
+import { Logger } from 'winston';
+
+export interface RouterOptions {
+ logger: Logger;
+}
+
+const makeRouter = (logger: Logger): express.Router => {
+ const router = Router();
+ router.use(express.json());
+
+ router.get('/services/:serviceId', async (req, res) => {
+ const serviceId = req.params.serviceId;
+ logger.info(`HERE ${serviceId}`);
+ res.send({ serviceId });
+ });
+
+ return router;
+};
+
+export async function createRouter(
+ options: RouterOptions,
+): Promise {
+ const logger = options.logger;
+
+ logger.info('Initializing Kubernetes backend');
+ return makeRouter(logger);
+}
diff --git a/plugins/kubernetes-backend/src/service/standaloneApplication.ts b/plugins/kubernetes-backend/src/service/standaloneApplication.ts
new file mode 100644
index 0000000000..5eea4fb8f5
--- /dev/null
+++ b/plugins/kubernetes-backend/src/service/standaloneApplication.ts
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2020 Spotify AB
+ *
+ * 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 {
+ errorHandler,
+ notFoundHandler,
+ requestLoggingHandler,
+} from '@backstage/backend-common';
+import compression from 'compression';
+import cors from 'cors';
+import express from 'express';
+import helmet from 'helmet';
+import { Logger } from 'winston';
+import { createRouter } from './router';
+
+export interface ApplicationOptions {
+ enableCors: boolean;
+ logger: Logger;
+}
+
+export async function createStandaloneApplication(
+ options: ApplicationOptions,
+): Promise {
+ const { enableCors, logger } = options;
+ const app = express();
+
+ app.use(helmet());
+ if (enableCors) {
+ app.use(cors());
+ }
+ app.use(compression());
+ app.use(express.json());
+ app.use(requestLoggingHandler());
+ app.use('/', await createRouter({ logger }));
+ app.use(notFoundHandler());
+ app.use(errorHandler());
+
+ return app;
+}
diff --git a/plugins/kubernetes-backend/src/service/standaloneServer.ts b/plugins/kubernetes-backend/src/service/standaloneServer.ts
new file mode 100644
index 0000000000..9831bc986b
--- /dev/null
+++ b/plugins/kubernetes-backend/src/service/standaloneServer.ts
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2020 Spotify AB
+ *
+ * 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 { Server } from 'http';
+import { Logger } from 'winston';
+import { createStandaloneApplication } from './standaloneApplication';
+
+export interface ServerOptions {
+ port: number;
+ enableCors: boolean;
+ logger: Logger;
+}
+
+export async function startStandaloneServer(
+ options: ServerOptions,
+): Promise {
+ const logger = options.logger.child({ service: 'kubernetes-backend' });
+
+ logger.debug('Creating application...');
+ const app = await createStandaloneApplication({
+ enableCors: options.enableCors,
+ logger,
+ });
+
+ logger.debug('Starting application server...');
+ return await new Promise((resolve, reject) => {
+ const server = app.listen(options.port, (err?: Error) => {
+ if (err) {
+ reject(err);
+ return;
+ }
+
+ logger.info(`Listening on port ${options.port}`);
+ resolve(server);
+ });
+ });
+}
diff --git a/plugins/kubernetes-backend/src/setupTests.ts b/plugins/kubernetes-backend/src/setupTests.ts
new file mode 100644
index 0000000000..f7b6ca962d
--- /dev/null
+++ b/plugins/kubernetes-backend/src/setupTests.ts
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2020 Spotify AB
+ *
+ * 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.
+ */
+
+require('jest-fetch-mock').enableMocks();
+
+export {};
diff --git a/plugins/kubernetes/.eslintrc.js b/plugins/kubernetes/.eslintrc.js
new file mode 100644
index 0000000000..13573efa9c
--- /dev/null
+++ b/plugins/kubernetes/.eslintrc.js
@@ -0,0 +1,3 @@
+module.exports = {
+ extends: [require.resolve('@backstage/cli/config/eslint')],
+};
diff --git a/plugins/kubernetes/README.md b/plugins/kubernetes/README.md
new file mode 100644
index 0000000000..678c9a96a6
--- /dev/null
+++ b/plugins/kubernetes/README.md
@@ -0,0 +1,13 @@
+# kubernetes
+
+Welcome to the kubernetes plugin!
+
+_This plugin was created through the Backstage CLI_
+
+## Getting started
+
+Your plugin has been added to the example app in this repository, meaning you'll be able to access it by running `yarn start` in the root directory, and then navigating to [/kubernetes](http://localhost:3000/kubernetes).
+
+You can also serve the plugin in isolation by running `yarn start` in the plugin directory.
+This method of serving the plugin provides quicker iteration speed and a faster startup and hot reloads.
+It is only meant for local development, and the setup for it can be found inside the [/dev](./dev) directory.
diff --git a/plugins/kubernetes/dev/index.tsx b/plugins/kubernetes/dev/index.tsx
new file mode 100644
index 0000000000..f352fb9c34
--- /dev/null
+++ b/plugins/kubernetes/dev/index.tsx
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2020 Spotify AB
+ *
+ * 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 { createDevApp } from '@backstage/dev-utils';
+import { plugin } from '../src';
+
+createDevApp().registerPlugin(plugin).render();
diff --git a/plugins/kubernetes/package.json b/plugins/kubernetes/package.json
new file mode 100644
index 0000000000..d9311deb85
--- /dev/null
+++ b/plugins/kubernetes/package.json
@@ -0,0 +1,47 @@
+{
+ "name": "@backstage/plugin-kubernetes",
+ "version": "0.1.1-alpha.23",
+ "main": "src/index.ts",
+ "types": "src/index.ts",
+ "license": "Apache-2.0",
+ "publishConfig": {
+ "access": "public",
+ "main": "dist/index.esm.js",
+ "types": "dist/index.d.ts"
+ },
+ "scripts": {
+ "build": "backstage-cli plugin:build",
+ "start": "backstage-cli plugin:serve",
+ "lint": "backstage-cli lint",
+ "test": "backstage-cli test",
+ "diff": "backstage-cli plugin:diff",
+ "prepack": "backstage-cli prepack",
+ "postpack": "backstage-cli postpack",
+ "clean": "backstage-cli clean"
+ },
+ "dependencies": {
+ "@backstage/catalog-model": "^0.1.1-alpha.23",
+ "@backstage/core": "^0.1.1-alpha.23",
+ "@backstage/theme": "^0.1.1-alpha.23",
+ "@material-ui/core": "^4.11.0",
+ "@material-ui/icons": "^4.9.1",
+ "@material-ui/lab": "4.0.0-alpha.45",
+ "react": "^16.13.1",
+ "react-dom": "^16.13.1",
+ "react-router-dom": "6.0.0-beta.0",
+ "react-use": "^15.3.3"
+ },
+ "devDependencies": {
+ "@backstage/cli": "^0.1.1-alpha.23",
+ "@backstage/dev-utils": "^0.1.1-alpha.23",
+ "@testing-library/jest-dom": "^5.10.1",
+ "@testing-library/react": "^10.4.1",
+ "@testing-library/user-event": "^12.0.7",
+ "@types/jest": "^26.0.7",
+ "@types/node": "^12.0.0",
+ "jest-fetch-mock": "^3.0.3"
+ },
+ "files": [
+ "dist"
+ ]
+}
diff --git a/plugins/kubernetes/src/Router.tsx b/plugins/kubernetes/src/Router.tsx
new file mode 100644
index 0000000000..994788bf72
--- /dev/null
+++ b/plugins/kubernetes/src/Router.tsx
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2020 Spotify AB
+ *
+ * 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 { Entity } from '@backstage/catalog-model';
+import { Route, Routes } from 'react-router-dom';
+
+import { rootCatalogKubernetesRouteRef } from './plugin';
+import { KubernetesContent } from './components/KubernetesContent';
+import { WarningPanel } from '@backstage/core';
+
+const KUBERNETES_ANNOTATION = 'backstage.io/kubernetes';
+
+export const Router = ({ entity }: { entity: Entity }) => {
+ const kubernetesAnnotationValue =
+ entity.metadata.annotations?.[KUBERNETES_ANNOTATION];
+
+ if (!kubernetesAnnotationValue) {
+ return (
+
+ {KUBERNETES_ANNOTATION} annotation is missing on the entity.
+
+ );
+ }
+
+ return (
+
+ }
+ />
+
+ );
+};
diff --git a/plugins/kubernetes/src/api/KubernetesBackendClient.ts b/plugins/kubernetes/src/api/KubernetesBackendClient.ts
new file mode 100644
index 0000000000..fed3cd2ed0
--- /dev/null
+++ b/plugins/kubernetes/src/api/KubernetesBackendClient.ts
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2020 Spotify AB
+ *
+ * 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 { DiscoveryApi } from '@backstage/core';
+import { KubernetesApi } from './types';
+
+export class KubernetesBackendClient implements KubernetesApi {
+ private readonly discoveryApi: DiscoveryApi;
+
+ constructor(options: { discoveryApi: DiscoveryApi }) {
+ this.discoveryApi = options.discoveryApi;
+ }
+
+ private async getRequired(path: string): Promise {
+ const url = `${await this.discoveryApi.getBaseUrl('kubernetes')}${path}`;
+ const response = await fetch(url);
+
+ if (!response.ok) {
+ const payload = await response.text();
+ const message = `Request failed with ${response.status} ${response.statusText}, ${payload}`;
+ throw new Error(message);
+ }
+
+ return await response.json();
+ }
+
+ async getObjectsByServiceId(serviceId: String): Promise<{}> {
+ return await this.getRequired(`/services/${serviceId}`);
+ }
+}
diff --git a/plugins/kubernetes/src/api/types.ts b/plugins/kubernetes/src/api/types.ts
new file mode 100644
index 0000000000..2ad6e567f9
--- /dev/null
+++ b/plugins/kubernetes/src/api/types.ts
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2020 Spotify AB
+ *
+ * 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 { createApiRef } from '@backstage/core';
+
+export const kubernetesApiRef = createApiRef({
+ id: 'plugin.kubernetes.service',
+ description:
+ 'Used by the Kubernetes plugin to make requests to accompanying backend',
+});
+
+export interface KubernetesApi {
+ getObjectsByServiceId(serviceId: String): Promise<{}>;
+}
diff --git a/plugins/kubernetes/src/components/KubernetesContent/KubernetesContent.tsx b/plugins/kubernetes/src/components/KubernetesContent/KubernetesContent.tsx
new file mode 100644
index 0000000000..d79454a5d1
--- /dev/null
+++ b/plugins/kubernetes/src/components/KubernetesContent/KubernetesContent.tsx
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2020 Spotify AB
+ *
+ * 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, { FC, useEffect, useState } from 'react';
+import { Typography, Grid } from '@material-ui/core';
+import {
+ InfoCard,
+ Page,
+ pageTheme,
+ Content,
+ ContentHeader,
+ useApi,
+} from '@backstage/core';
+import { Entity } from '@backstage/catalog-model';
+import { kubernetesApiRef } from '../../api/types';
+
+// TODO this is a temporary component used to construct the Kubernetes plugin boilerplate
+
+export const KubernetesContent: FC<{ entity: Entity }> = ({ entity }) => {
+ const kubernetesApi = useApi(kubernetesApiRef);
+ const [kubernetesObjects, setKubernetesObjects] = useState<{} | undefined>(
+ undefined,
+ );
+ const [error, setError] = useState(undefined);
+
+ useEffect(() => {
+ kubernetesApi
+ .getObjectsByServiceId(entity.metadata.name)
+ .then(result => {
+ setKubernetesObjects(result);
+ })
+ .catch(e => {
+ setError(e.message);
+ });
+ }, [entity.metadata.name, kubernetesApi]);
+
+ return (
+
+
+
+
+
+
+
+ {kubernetesObjects === undefined && loading....
}
+ {error !== undefined && {error}
}
+ {kubernetesObjects !== undefined && (
+
+ backend response: {JSON.stringify(kubernetesObjects)}
+
+ )}
+
+
+
+
+
+
+ );
+};
diff --git a/plugins/kubernetes/src/components/KubernetesContent/index.ts b/plugins/kubernetes/src/components/KubernetesContent/index.ts
new file mode 100644
index 0000000000..dc10b08927
--- /dev/null
+++ b/plugins/kubernetes/src/components/KubernetesContent/index.ts
@@ -0,0 +1,16 @@
+/*
+ * Copyright 2020 Spotify AB
+ *
+ * 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.
+ */
+export { KubernetesContent } from './KubernetesContent';
diff --git a/plugins/kubernetes/src/index.ts b/plugins/kubernetes/src/index.ts
new file mode 100644
index 0000000000..8b5969666c
--- /dev/null
+++ b/plugins/kubernetes/src/index.ts
@@ -0,0 +1,17 @@
+/*
+ * Copyright 2020 Spotify AB
+ *
+ * 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.
+ */
+export { plugin } from './plugin';
+export { Router } from './Router';
diff --git a/plugins/kubernetes/src/plugin.test.ts b/plugins/kubernetes/src/plugin.test.ts
new file mode 100644
index 0000000000..20c50a813a
--- /dev/null
+++ b/plugins/kubernetes/src/plugin.test.ts
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2020 Spotify AB
+ *
+ * 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 { plugin } from './plugin';
+
+describe('kubernetes', () => {
+ it('should export plugin', () => {
+ expect(plugin).toBeDefined();
+ });
+});
diff --git a/plugins/kubernetes/src/plugin.ts b/plugins/kubernetes/src/plugin.ts
new file mode 100644
index 0000000000..b7ad9615f5
--- /dev/null
+++ b/plugins/kubernetes/src/plugin.ts
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2020 Spotify AB
+ *
+ * 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 {
+ createApiFactory,
+ createPlugin,
+ createRouteRef,
+ discoveryApiRef,
+} from '@backstage/core';
+import { KubernetesBackendClient } from './api/KubernetesBackendClient';
+import { kubernetesApiRef } from './api/types';
+
+export const rootCatalogKubernetesRouteRef = createRouteRef({
+ path: '*',
+ title: 'Kubernetes',
+});
+
+export const plugin = createPlugin({
+ id: 'kubernetes',
+ apis: [
+ createApiFactory({
+ api: kubernetesApiRef,
+ deps: { discoveryApi: discoveryApiRef },
+ factory: ({ discoveryApi }) =>
+ new KubernetesBackendClient({ discoveryApi }),
+ }),
+ ],
+});
diff --git a/plugins/kubernetes/src/setupTests.ts b/plugins/kubernetes/src/setupTests.ts
new file mode 100644
index 0000000000..4b4cdbdaaf
--- /dev/null
+++ b/plugins/kubernetes/src/setupTests.ts
@@ -0,0 +1,18 @@
+/*
+ * Copyright 2020 Spotify AB
+ *
+ * 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 '@testing-library/jest-dom';
+
+require('jest-fetch-mock').enableMocks();
diff --git a/plugins/lighthouse/package.json b/plugins/lighthouse/package.json
index a5e7ae7b62..6ca1495a05 100644
--- a/plugins/lighthouse/package.json
+++ b/plugins/lighthouse/package.json
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-lighthouse",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -21,9 +21,9 @@
"start": "backstage-cli plugin:serve"
},
"dependencies": {
- "@backstage/config": "^0.1.1-alpha.22",
- "@backstage/core": "^0.1.1-alpha.22",
- "@backstage/theme": "^0.1.1-alpha.22",
+ "@backstage/config": "^0.1.1-alpha.23",
+ "@backstage/core": "^0.1.1-alpha.23",
+ "@backstage/theme": "^0.1.1-alpha.23",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "4.0.0-alpha.45",
@@ -34,9 +34,9 @@
"react-use": "^15.3.3"
},
"devDependencies": {
- "@backstage/cli": "^0.1.1-alpha.22",
- "@backstage/dev-utils": "^0.1.1-alpha.22",
- "@backstage/test-utils": "^0.1.1-alpha.22",
+ "@backstage/cli": "^0.1.1-alpha.23",
+ "@backstage/dev-utils": "^0.1.1-alpha.23",
+ "@backstage/test-utils": "^0.1.1-alpha.23",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^10.4.1",
"@testing-library/user-event": "^12.0.7",
diff --git a/plugins/newrelic/package.json b/plugins/newrelic/package.json
index 7ad697a254..38a5c437a4 100644
--- a/plugins/newrelic/package.json
+++ b/plugins/newrelic/package.json
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-newrelic",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -21,8 +21,8 @@
"clean": "backstage-cli clean"
},
"dependencies": {
- "@backstage/core": "^0.1.1-alpha.22",
- "@backstage/theme": "^0.1.1-alpha.22",
+ "@backstage/core": "^0.1.1-alpha.23",
+ "@backstage/theme": "^0.1.1-alpha.23",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "4.0.0-alpha.45",
@@ -31,8 +31,8 @@
"react-use": "^15.3.3"
},
"devDependencies": {
- "@backstage/cli": "^0.1.1-alpha.22",
- "@backstage/dev-utils": "^0.1.1-alpha.22",
+ "@backstage/cli": "^0.1.1-alpha.23",
+ "@backstage/dev-utils": "^0.1.1-alpha.23",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^10.4.1",
"@testing-library/user-event": "^12.0.7",
diff --git a/plugins/proxy-backend/package.json b/plugins/proxy-backend/package.json
index fb1b82f3ea..10024fcd42 100644
--- a/plugins/proxy-backend/package.json
+++ b/plugins/proxy-backend/package.json
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-proxy-backend",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -19,8 +19,8 @@
"clean": "backstage-cli clean"
},
"dependencies": {
- "@backstage/backend-common": "^0.1.1-alpha.22",
- "@backstage/config": "^0.1.1-alpha.22",
+ "@backstage/backend-common": "^0.1.1-alpha.23",
+ "@backstage/config": "^0.1.1-alpha.23",
"@types/express": "^4.17.6",
"@types/http-proxy-middleware": "^0.19.3",
"express": "^4.17.1",
@@ -35,7 +35,7 @@
"yup": "^0.29.1"
},
"devDependencies": {
- "@backstage/cli": "^0.1.1-alpha.22",
+ "@backstage/cli": "^0.1.1-alpha.23",
"@types/node-fetch": "^2.5.7",
"@types/supertest": "^2.0.8",
"@types/uuid": "^8.0.0",
diff --git a/plugins/register-component/package.json b/plugins/register-component/package.json
index 58fe9855a2..9e3ef7e307 100644
--- a/plugins/register-component/package.json
+++ b/plugins/register-component/package.json
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-register-component",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -21,10 +21,10 @@
"clean": "backstage-cli clean"
},
"dependencies": {
- "@backstage/catalog-model": "^0.1.1-alpha.22",
- "@backstage/core": "^0.1.1-alpha.22",
- "@backstage/plugin-catalog": "^0.1.1-alpha.22",
- "@backstage/theme": "^0.1.1-alpha.22",
+ "@backstage/catalog-model": "^0.1.1-alpha.23",
+ "@backstage/core": "^0.1.1-alpha.23",
+ "@backstage/plugin-catalog": "^0.1.1-alpha.23",
+ "@backstage/theme": "^0.1.1-alpha.23",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "4.0.0-alpha.45",
@@ -36,8 +36,8 @@
"react-use": "^15.3.3"
},
"devDependencies": {
- "@backstage/cli": "^0.1.1-alpha.22",
- "@backstage/dev-utils": "^0.1.1-alpha.22",
+ "@backstage/cli": "^0.1.1-alpha.23",
+ "@backstage/dev-utils": "^0.1.1-alpha.23",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^10.4.1",
"@testing-library/user-event": "^12.0.7",
diff --git a/plugins/register-component/src/components/RegisterComponentForm/RegisterComponentForm.test.tsx b/plugins/register-component/src/components/RegisterComponentForm/RegisterComponentForm.test.tsx
index df179ca219..10c3d9fcd1 100644
--- a/plugins/register-component/src/components/RegisterComponentForm/RegisterComponentForm.test.tsx
+++ b/plugins/register-component/src/components/RegisterComponentForm/RegisterComponentForm.test.tsx
@@ -14,57 +14,38 @@
* limitations under the License.
*/
-import { cleanup, fireEvent, render } from '@testing-library/react';
+import { act, render, screen } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
import React from 'react';
-import { act } from 'react-dom/test-utils';
-import RegisterComponentForm, { Props } from './RegisterComponentForm';
+import { RegisterComponentForm } from './RegisterComponentForm';
-const setup = (props?: Partial) => {
- return {
- rendered: render(
- ,
- ),
- };
-};
describe('RegisterComponentForm', () => {
- afterEach(() => cleanup());
-
it('should initially render a disabled button', async () => {
- const { rendered } = setup();
+ render( );
+
expect(
- await rendered.findByText(
- 'Enter the full path to the component.yaml file in GitHub, GitLab, Bitbucket or Azure to start tracking your component.',
- ),
+ await screen.findByText(/Enter the full path to the catalog-info.yaml/),
).toBeInTheDocument();
- const submit = (await rendered.getByTestId(
- 'registerComponentFormSubmit',
- )) as HTMLButtonElement;
- expect(submit.disabled).toBeTruthy();
+ expect(screen.getByText('Submit').closest('button')).toBeDisabled();
});
- it('should enable a submit form when data when component url is set ', async () => {
- const { rendered } = setup();
- const input = (await rendered.getByRole('textbox')) as HTMLInputElement;
+ it('should enable a submit button when the target url is set ', async () => {
+ render( );
+
await act(async () => {
- // react-hook-form uses `input` event for changes
- fireEvent.input(input, {
- target: { value: 'https://example.com/blob/master/component.yaml' },
- });
+ await userEvent.type(
+ await screen.findByLabelText('Entity file URL', { exact: false }),
+ 'https://example.com/blob/master/component.yaml',
+ );
});
- const submit = (await rendered.getByTestId(
- 'registerComponentFormSubmit',
- )) as HTMLButtonElement;
- expect(submit.disabled).toBeFalsy();
+ expect(screen.getByText('Submit').closest('button')).not.toBeDisabled();
+ });
+
+ it('should show spinner while submitting', async () => {
+ render( );
+
+ expect(screen.getByTestId('loading-progress')).toBeInTheDocument();
});
});
-
-it('should show spinner while submitting', async () => {
- const { rendered } = setup({ submitting: true });
- expect(rendered.getByTestId('loading-progress')).toBeInTheDocument();
-});
diff --git a/plugins/register-component/src/components/RegisterComponentForm/RegisterComponentForm.tsx b/plugins/register-component/src/components/RegisterComponentForm/RegisterComponentForm.tsx
index 294f4db801..bc433e1c36 100644
--- a/plugins/register-component/src/components/RegisterComponentForm/RegisterComponentForm.tsx
+++ b/plugins/register-component/src/components/RegisterComponentForm/RegisterComponentForm.tsx
@@ -19,15 +19,15 @@ import {
Button,
FormControl,
FormHelperText,
- LinearProgress,
- TextField,
- Select,
- MenuItem,
InputLabel,
+ LinearProgress,
+ MenuItem,
+ Select,
+ TextField,
} from '@material-ui/core';
import { makeStyles } from '@material-ui/core/styles';
-import React, { FC } from 'react';
-import { useForm, Controller } from 'react-hook-form';
+import React from 'react';
+import { Controller, useForm } from 'react-hook-form';
import { ComponentIdValidators } from '../../util/validate';
const useStyles = makeStyles(theme => ({
@@ -39,14 +39,17 @@ const useStyles = makeStyles(theme => ({
submit: {
marginTop: theme.spacing(1),
},
+ select: {
+ minWidth: 120,
+ },
}));
export type Props = {
onSubmit: (formData: Record) => Promise;
- submitting: boolean;
+ submitting?: boolean;
};
-const RegisterComponentForm: FC = ({ onSubmit, submitting }) => {
+export const RegisterComponentForm = ({ onSubmit, submitting }: Props) => {
const { control, register, handleSubmit, errors, formState } = useForm({
mode: 'onChange',
});
@@ -67,14 +70,14 @@ const RegisterComponentForm: FC = ({ onSubmit, submitting }) => {
= ({ onSubmit, submitting }) => {
)}
-
- SCM Detection
+
+ Host type
= ({ onSubmit, submitting }) => {
/>
= ({ onSubmit, submitting }) => {
);
};
-
-export default RegisterComponentForm;
diff --git a/plugins/register-component/src/components/RegisterComponentForm/index.ts b/plugins/register-component/src/components/RegisterComponentForm/index.ts
index beb0d00ecc..1e479a73eb 100644
--- a/plugins/register-component/src/components/RegisterComponentForm/index.ts
+++ b/plugins/register-component/src/components/RegisterComponentForm/index.ts
@@ -14,4 +14,4 @@
* limitations under the License.
*/
-export { default } from './RegisterComponentForm';
+export { RegisterComponentForm } from './RegisterComponentForm';
diff --git a/plugins/register-component/src/components/RegisterComponentPage/RegisterComponentPage.test.tsx b/plugins/register-component/src/components/RegisterComponentPage/RegisterComponentPage.test.tsx
index 32fa4a85c0..e5496d1ea5 100644
--- a/plugins/register-component/src/components/RegisterComponentPage/RegisterComponentPage.test.tsx
+++ b/plugins/register-component/src/components/RegisterComponentPage/RegisterComponentPage.test.tsx
@@ -14,21 +14,24 @@
* limitations under the License.
*/
-import React from 'react';
-import { render, cleanup } from '@testing-library/react';
-import { RegisterComponentPage } from './RegisterComponentPage';
-import { ThemeProvider } from '@material-ui/core';
-import { lightTheme } from '@backstage/theme';
import {
- errorApiRef,
ApiProvider,
ApiRegistry,
createRouteRef,
+ errorApiRef,
} from '@backstage/core';
import { catalogApiRef } from '@backstage/plugin-catalog';
+import { lightTheme } from '@backstage/theme';
+import { ThemeProvider } from '@material-ui/core';
+import { render, screen } from '@testing-library/react';
+import React from 'react';
import { MemoryRouter } from 'react-router-dom';
+import { RegisterComponentPage } from './RegisterComponentPage';
-const errorApi = { post: () => {} };
+const errorApi: jest.Mocked = {
+ post: jest.fn(),
+ error$: jest.fn(),
+};
const catalogApi: jest.Mocked = {
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
@@ -40,35 +43,31 @@ const catalogApi: jest.Mocked = {
getEntityByName: jest.fn(),
};
-const setup = () => ({
- rendered: render(
-
-
-
-
-
-
- ,
- ),
-});
+const Wrapper = ({ children }: { children?: React.ReactNode }) => (
+
+
+ {children}
+
+
+);
describe('RegisterComponentPage', () => {
- afterEach(() => cleanup());
-
it('should render', () => {
- const { rendered } = setup();
- expect(
- rendered.getByText('Register existing component'),
- ).toBeInTheDocument();
+ render(
+ ,
+ { wrapper: Wrapper },
+ );
+
+ expect(screen.getByText('Register existing component')).toBeInTheDocument();
});
});
diff --git a/plugins/register-component/src/components/RegisterComponentPage/RegisterComponentPage.tsx b/plugins/register-component/src/components/RegisterComponentPage/RegisterComponentPage.tsx
index 19ee22b8e0..0d90569574 100644
--- a/plugins/register-component/src/components/RegisterComponentPage/RegisterComponentPage.tsx
+++ b/plugins/register-component/src/components/RegisterComponentPage/RegisterComponentPage.tsx
@@ -28,7 +28,7 @@ import {
ContentHeader,
RouteRef,
} from '@backstage/core';
-import RegisterComponentForm from '../RegisterComponentForm';
+import { RegisterComponentForm } from '../RegisterComponentForm';
import { catalogApiRef } from '@backstage/plugin-catalog';
import { useMountedState } from 'react-use';
import { Entity, Location } from '@backstage/catalog-model';
@@ -55,6 +55,7 @@ const FormStates = {
} as const;
type ValuesOf = T extends Record ? V : never;
+
export const RegisterComponentPage = ({
catalogRouteRef,
}: {
@@ -85,9 +86,9 @@ export const RegisterComponentPage = ({
const { scmType, componentLocation: target } = formData;
try {
const typeMapping = [
- { url: /https:\/\/gitlab\.com\/.*/, type: 'gitlab' },
- { url: /https:\/\/bitbucket\.org\/.*/, type: 'bitbucket/api' },
- { url: /https:\/\/dev\.azure\.com\/.*/, type: 'azure/api' },
+ { url: /^https:\/\/gitlab\.com\/.*/, type: 'gitlab' },
+ { url: /^https:\/\/bitbucket\.org\/.*/, type: 'bitbucket/api' },
+ { url: /^https:\/\/dev\.azure\.com\/.*/, type: 'azure/api' },
{ url: /.*/, type: 'github' },
];
diff --git a/plugins/register-component/src/components/RegisterComponentResultDialog/RegisterComponentResultDialog.test.tsx b/plugins/register-component/src/components/RegisterComponentResultDialog/RegisterComponentResultDialog.test.tsx
index ae262ab866..5e5e1c52ce 100644
--- a/plugins/register-component/src/components/RegisterComponentResultDialog/RegisterComponentResultDialog.test.tsx
+++ b/plugins/register-component/src/components/RegisterComponentResultDialog/RegisterComponentResultDialog.test.tsx
@@ -14,47 +14,40 @@
* limitations under the License.
*/
+import { Entity } from '@backstage/catalog-model';
+import { createRouteRef } from '@backstage/core';
import { lightTheme } from '@backstage/theme';
import { ThemeProvider } from '@material-ui/core';
-import { cleanup, render } from '@testing-library/react';
-import React, { ComponentProps } from 'react';
+import { render, screen } from '@testing-library/react';
+import React from 'react';
import { MemoryRouter } from 'react-router-dom';
import { RegisterComponentResultDialog } from './RegisterComponentResultDialog';
-import { createRouteRef } from '@backstage/core';
-const setup = (
- props?: Partial>,
-) => ({
- rendered: render(
-
-
- {}}
- entities={[]}
- catalogRouteRef={createRouteRef({
- path: '/catalog',
- title: 'Service Catalog',
- })}
- {...props}
- />
-
- ,
- ),
-});
+const Wrapper = ({ children }: { children?: React.ReactNode }) => (
+
+ {children}
+
+);
+
describe('RegisterComponentResultDialog', () => {
- afterEach(() => cleanup());
-
it('should render', () => {
- const { rendered } = setup();
- expect(
- rendered.getByText('Component Registration Result'),
- ).toBeInTheDocument();
- });
-});
+ render(
+ {}}
+ entities={[]}
+ catalogRouteRef={createRouteRef({
+ path: '/catalog',
+ title: 'Service Catalog',
+ })}
+ />,
+ { wrapper: Wrapper },
+ );
-it('should show a list of components if success', async () => {
- const { rendered } = setup({
- entities: [
+ expect(screen.getByText('Registration Result')).toBeInTheDocument();
+ });
+
+ it('should show a list of components if success', async () => {
+ const entities: Entity[] = [
{
apiVersion: 'backstage.io/v1alpha1',
kind: 'Component',
@@ -75,14 +68,26 @@ it('should show a list of components if success', async () => {
type: 'service',
},
},
- ],
- });
+ ];
- expect(
- rendered.getByText(
- 'The following components have been succefully created:',
- ),
- ).toBeInTheDocument();
- expect(rendered.getByText('Component1')).toBeInTheDocument();
- expect(rendered.getByText('Component2')).toBeInTheDocument();
+ render(
+ {}}
+ entities={entities}
+ catalogRouteRef={createRouteRef({
+ path: '/catalog',
+ title: 'Service Catalog',
+ })}
+ />,
+ { wrapper: Wrapper },
+ );
+
+ expect(
+ screen.getByText(
+ 'The following entities have been successfully created:',
+ ),
+ ).toBeInTheDocument();
+ expect(screen.getByText('Component1')).toBeInTheDocument();
+ expect(screen.getByText('Component2')).toBeInTheDocument();
+ });
});
diff --git a/plugins/register-component/src/components/RegisterComponentResultDialog/RegisterComponentResultDialog.tsx b/plugins/register-component/src/components/RegisterComponentResultDialog/RegisterComponentResultDialog.tsx
index 57b7fae9c3..c75235c6cb 100644
--- a/plugins/register-component/src/components/RegisterComponentResultDialog/RegisterComponentResultDialog.tsx
+++ b/plugins/register-component/src/components/RegisterComponentResultDialog/RegisterComponentResultDialog.tsx
@@ -73,10 +73,10 @@ export const RegisterComponentResultDialog = ({
catalogRouteRef,
}: Props) => (
- Component Registration Result
+ Registration Result
- The following components have been succefully created:
+ The following entities have been successfully created:
{entities.map((entity: any, index: number) => {
diff --git a/plugins/rollbar-backend/package.json b/plugins/rollbar-backend/package.json
index 969d3c79b9..2ed15b7aff 100644
--- a/plugins/rollbar-backend/package.json
+++ b/plugins/rollbar-backend/package.json
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-rollbar-backend",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -20,8 +20,8 @@
"clean": "backstage-cli clean"
},
"dependencies": {
- "@backstage/backend-common": "^0.1.1-alpha.22",
- "@backstage/config": "^0.1.1-alpha.22",
+ "@backstage/backend-common": "^0.1.1-alpha.23",
+ "@backstage/config": "^0.1.1-alpha.23",
"@types/express": "^4.17.6",
"axios": "^0.20.0",
"camelcase-keys": "^6.2.2",
@@ -37,7 +37,7 @@
"yn": "^4.0.0"
},
"devDependencies": {
- "@backstage/cli": "^0.1.1-alpha.22",
+ "@backstage/cli": "^0.1.1-alpha.23",
"@types/supertest": "^2.0.8",
"jest-fetch-mock": "^3.0.3",
"supertest": "^4.0.2"
diff --git a/plugins/rollbar/package.json b/plugins/rollbar/package.json
index 3faa06d0d3..18f13c3969 100644
--- a/plugins/rollbar/package.json
+++ b/plugins/rollbar/package.json
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-rollbar",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -21,10 +21,10 @@
"clean": "backstage-cli clean"
},
"dependencies": {
- "@backstage/catalog-model": "^0.1.1-alpha.22",
- "@backstage/core": "^0.1.1-alpha.22",
- "@backstage/plugin-catalog": "^0.1.1-alpha.22",
- "@backstage/theme": "^0.1.1-alpha.22",
+ "@backstage/catalog-model": "^0.1.1-alpha.23",
+ "@backstage/core": "^0.1.1-alpha.23",
+ "@backstage/plugin-catalog": "^0.1.1-alpha.23",
+ "@backstage/theme": "^0.1.1-alpha.23",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "4.0.0-alpha.45",
@@ -37,9 +37,9 @@
"react-use": "^15.3.3"
},
"devDependencies": {
- "@backstage/cli": "^0.1.1-alpha.22",
- "@backstage/dev-utils": "^0.1.1-alpha.22",
- "@backstage/test-utils": "^0.1.1-alpha.22",
+ "@backstage/cli": "^0.1.1-alpha.23",
+ "@backstage/dev-utils": "^0.1.1-alpha.23",
+ "@backstage/test-utils": "^0.1.1-alpha.23",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^10.4.1",
"@testing-library/react-hooks": "^3.3.0",
diff --git a/plugins/rollbar/src/components/Router.tsx b/plugins/rollbar/src/components/Router.tsx
index bcf325f281..192ef33a61 100644
--- a/plugins/rollbar/src/components/Router.tsx
+++ b/plugins/rollbar/src/components/Router.tsx
@@ -23,7 +23,7 @@ import { ROLLBAR_ANNOTATION } from '../constants';
import { EntityPageRollbar } from './EntityPageRollbar/EntityPageRollbar';
export const isPluginApplicableToEntity = (entity: Entity) =>
- entity.metadata.annotations?.[ROLLBAR_ANNOTATION] !== '';
+ Boolean(entity.metadata.annotations?.[ROLLBAR_ANNOTATION]);
type Props = {
entity: Entity;
diff --git a/plugins/scaffolder-backend/package.json b/plugins/scaffolder-backend/package.json
index 0eaa33e1f8..90d1af4b5f 100644
--- a/plugins/scaffolder-backend/package.json
+++ b/plugins/scaffolder-backend/package.json
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-scaffolder-backend",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -20,9 +20,9 @@
"clean": "backstage-cli clean"
},
"dependencies": {
- "@backstage/backend-common": "^0.1.1-alpha.22",
- "@backstage/catalog-model": "^0.1.1-alpha.22",
- "@backstage/config": "^0.1.1-alpha.22",
+ "@backstage/backend-common": "^0.1.1-alpha.23",
+ "@backstage/catalog-model": "^0.1.1-alpha.23",
+ "@backstage/config": "^0.1.1-alpha.23",
"@gitbeaker/core": "^23.5.0",
"@gitbeaker/node": "^23.5.0",
"@octokit/rest": "^18.0.0",
@@ -46,7 +46,7 @@
"yaml": "^1.10.0"
},
"devDependencies": {
- "@backstage/cli": "^0.1.1-alpha.22",
+ "@backstage/cli": "^0.1.1-alpha.23",
"@octokit/types": "^5.4.1",
"@types/fs-extra": "^9.0.1",
"@types/git-url-parse": "^9.0.0",
diff --git a/plugins/scaffolder-backend/src/scaffolder/stages/publish/github.ts b/plugins/scaffolder-backend/src/scaffolder/stages/publish/github.ts
index d3aafb1e07..60ed86daa1 100644
--- a/plugins/scaffolder-backend/src/scaffolder/stages/publish/github.ts
+++ b/plugins/scaffolder-backend/src/scaffolder/stages/publish/github.ts
@@ -21,18 +21,18 @@ import { JsonValue } from '@backstage/config';
import { RequiredTemplateValues } from '../templater';
import { Repository, Remote, Signature, Cred } from 'nodegit';
-export type RepoVisilityOptions = 'private' | 'internal' | 'public';
+export type RepoVisibilityOptions = 'private' | 'internal' | 'public';
interface GithubPublisherParams {
client: Octokit;
token: string;
- repoVisibility: RepoVisilityOptions;
+ repoVisibility: RepoVisibilityOptions;
}
export class GithubPublisher implements PublisherBase {
private client: Octokit;
private token: string;
- private repoVisibility: RepoVisilityOptions;
+ private repoVisibility: RepoVisibilityOptions;
constructor({
client,
diff --git a/plugins/scaffolder/package.json b/plugins/scaffolder/package.json
index db8f335156..2abd3feb8f 100644
--- a/plugins/scaffolder/package.json
+++ b/plugins/scaffolder/package.json
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-scaffolder",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -21,10 +21,10 @@
"clean": "backstage-cli clean"
},
"dependencies": {
- "@backstage/catalog-model": "^0.1.1-alpha.22",
- "@backstage/core": "^0.1.1-alpha.22",
- "@backstage/plugin-catalog": "^0.1.1-alpha.22",
- "@backstage/theme": "^0.1.1-alpha.22",
+ "@backstage/catalog-model": "^0.1.1-alpha.23",
+ "@backstage/core": "^0.1.1-alpha.23",
+ "@backstage/plugin-catalog": "^0.1.1-alpha.23",
+ "@backstage/theme": "^0.1.1-alpha.23",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "4.0.0-alpha.45",
@@ -41,9 +41,9 @@
"swr": "^0.3.0"
},
"devDependencies": {
- "@backstage/cli": "^0.1.1-alpha.22",
- "@backstage/dev-utils": "^0.1.1-alpha.22",
- "@backstage/test-utils": "^0.1.1-alpha.22",
+ "@backstage/cli": "^0.1.1-alpha.23",
+ "@backstage/dev-utils": "^0.1.1-alpha.23",
+ "@backstage/test-utils": "^0.1.1-alpha.23",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^10.4.1",
"@testing-library/user-event": "^12.0.7",
diff --git a/plugins/sentry-backend/package.json b/plugins/sentry-backend/package.json
index dbc7b48a1b..68b94ce7d8 100644
--- a/plugins/sentry-backend/package.json
+++ b/plugins/sentry-backend/package.json
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-sentry-backend",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -20,7 +20,7 @@
"clean": "backstage-cli clean"
},
"dependencies": {
- "@backstage/backend-common": "^0.1.1-alpha.22",
+ "@backstage/backend-common": "^0.1.1-alpha.23",
"@types/express": "^4.17.6",
"axios": "^0.20.0",
"compression": "^1.7.4",
@@ -34,7 +34,7 @@
"yn": "^4.0.0"
},
"devDependencies": {
- "@backstage/cli": "^0.1.1-alpha.22",
+ "@backstage/cli": "^0.1.1-alpha.23",
"jest-fetch-mock": "^3.0.3"
},
"files": [
diff --git a/plugins/sentry/package.json b/plugins/sentry/package.json
index 8ac1ab2838..143a2dfc12 100644
--- a/plugins/sentry/package.json
+++ b/plugins/sentry/package.json
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-sentry",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -21,9 +21,9 @@
"clean": "backstage-cli clean"
},
"dependencies": {
- "@backstage/catalog-model": "^0.1.1-alpha.22",
- "@backstage/core": "^0.1.1-alpha.22",
- "@backstage/theme": "^0.1.1-alpha.22",
+ "@backstage/catalog-model": "^0.1.1-alpha.23",
+ "@backstage/core": "^0.1.1-alpha.23",
+ "@backstage/theme": "^0.1.1-alpha.23",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "4.0.0-alpha.45",
@@ -36,8 +36,8 @@
"timeago.js": "^4.0.2"
},
"devDependencies": {
- "@backstage/cli": "^0.1.1-alpha.22",
- "@backstage/dev-utils": "^0.1.1-alpha.22",
+ "@backstage/cli": "^0.1.1-alpha.23",
+ "@backstage/dev-utils": "^0.1.1-alpha.23",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^10.4.1",
"@testing-library/user-event": "^12.0.7",
diff --git a/plugins/tech-radar/package.json b/plugins/tech-radar/package.json
index a8eded052c..c9950cdc95 100644
--- a/plugins/tech-radar/package.json
+++ b/plugins/tech-radar/package.json
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-tech-radar",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -21,9 +21,9 @@
"start": "backstage-cli plugin:serve"
},
"dependencies": {
- "@backstage/core": "^0.1.1-alpha.22",
- "@backstage/test-utils": "^0.1.1-alpha.22",
- "@backstage/theme": "^0.1.1-alpha.22",
+ "@backstage/core": "^0.1.1-alpha.23",
+ "@backstage/test-utils": "^0.1.1-alpha.23",
+ "@backstage/theme": "^0.1.1-alpha.23",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "4.0.0-alpha.45",
@@ -35,8 +35,8 @@
"react-use": "^15.3.3"
},
"devDependencies": {
- "@backstage/cli": "^0.1.1-alpha.22",
- "@backstage/dev-utils": "^0.1.1-alpha.22",
+ "@backstage/cli": "^0.1.1-alpha.23",
+ "@backstage/dev-utils": "^0.1.1-alpha.23",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^10.4.1",
"@testing-library/user-event": "^12.0.7",
diff --git a/plugins/techdocs-backend/package.json b/plugins/techdocs-backend/package.json
index 1ca8b3ee44..0ff9722718 100644
--- a/plugins/techdocs-backend/package.json
+++ b/plugins/techdocs-backend/package.json
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-techdocs-backend",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -20,9 +20,9 @@
"clean": "backstage-cli clean"
},
"dependencies": {
- "@backstage/backend-common": "^0.1.1-alpha.22",
- "@backstage/catalog-model": "^0.1.1-alpha.22",
- "@backstage/config": "^0.1.1-alpha.22",
+ "@backstage/backend-common": "^0.1.1-alpha.23",
+ "@backstage/catalog-model": "^0.1.1-alpha.23",
+ "@backstage/config": "^0.1.1-alpha.23",
"@types/dockerode": "^2.5.34",
"@types/express": "^4.17.6",
"command-exists-promise": "^2.0.2",
@@ -38,7 +38,7 @@
"winston": "^3.2.1"
},
"devDependencies": {
- "@backstage/cli": "^0.1.1-alpha.22",
+ "@backstage/cli": "^0.1.1-alpha.23",
"@types/node-fetch": "^2.5.7",
"supertest": "^4.0.2"
},
diff --git a/plugins/techdocs/package.json b/plugins/techdocs/package.json
index ab2e0dd038..e376202a41 100644
--- a/plugins/techdocs/package.json
+++ b/plugins/techdocs/package.json
@@ -1,6 +1,6 @@
{
"name": "@backstage/plugin-techdocs",
- "version": "0.1.1-alpha.22",
+ "version": "0.1.1-alpha.23",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
@@ -22,12 +22,12 @@
"clean": "backstage-cli clean"
},
"dependencies": {
- "@backstage/catalog-model": "^0.1.1-alpha.22",
- "@backstage/core": "^0.1.1-alpha.22",
- "@backstage/core-api": "^0.1.1-alpha.22",
- "@backstage/plugin-catalog": "^0.1.1-alpha.22",
- "@backstage/test-utils": "^0.1.1-alpha.22",
- "@backstage/theme": "^0.1.1-alpha.22",
+ "@backstage/catalog-model": "^0.1.1-alpha.23",
+ "@backstage/core": "^0.1.1-alpha.23",
+ "@backstage/core-api": "^0.1.1-alpha.23",
+ "@backstage/plugin-catalog": "^0.1.1-alpha.23",
+ "@backstage/test-utils": "^0.1.1-alpha.23",
+ "@backstage/theme": "^0.1.1-alpha.23",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "4.0.0-alpha.45",
@@ -40,8 +40,8 @@
"sanitize-html": "^1.27.0"
},
"devDependencies": {
- "@backstage/cli": "^0.1.1-alpha.22",
- "@backstage/dev-utils": "^0.1.1-alpha.22",
+ "@backstage/cli": "^0.1.1-alpha.23",
+ "@backstage/dev-utils": "^0.1.1-alpha.23",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^10.4.1",
"@testing-library/user-event": "^12.0.7",
diff --git a/plugins/techdocs/src/reader/components/Reader.tsx b/plugins/techdocs/src/reader/components/Reader.tsx
index 8ae3273e12..2aa87ea1ee 100644
--- a/plugins/techdocs/src/reader/components/Reader.tsx
+++ b/plugins/techdocs/src/reader/components/Reader.tsx
@@ -21,6 +21,8 @@ import { useAsync } from 'react-use';
import { techdocsStorageApiRef } from '../../api';
import { useParams, useNavigate } from 'react-router-dom';
import { ParsedEntityId } from '../../types';
+import { useTheme } from '@material-ui/core';
+import { BackstageTheme } from '@backstage/theme';
import transformer, {
addBaseUrl,
@@ -30,6 +32,7 @@ import transformer, {
modifyCss,
onCssReady,
sanitizeDOM,
+ injectCss,
} from '../transformers';
import { TechDocsNotFound } from './TechDocsNotFound';
@@ -40,6 +43,7 @@ type Props = {
export const Reader = ({ entityId }: Props) => {
const { kind, namespace, name } = entityId;
const { '*': path } = useParams();
+ const theme = useTheme();
const techdocsStorageApi = useApi(techdocsStorageApiRef);
const [shadowDomRef, shadowRoot] = useShadowDom();
@@ -73,6 +77,18 @@ export const Reader = ({ entityId }: Props) => {
},
}),
removeMkdocsHeader(),
+ injectCss({
+ css: `
+ body {
+ font-family: ${theme.typography.fontFamily};
+ --md-text-color: ${theme.palette.text.primary};
+ --md-text-link-color: ${theme.palette.primary.main};
+
+ --md-code-fg-color: ${theme.palette.text.primary};
+ --md-code-bg-color: ${theme.palette.background.paper};
+ }
+ `,
+ }),
]);
if (!transformedElement) {
@@ -125,6 +141,7 @@ export const Reader = ({ entityId }: Props) => {
entityId,
navigate,
techdocsStorageApi,
+ theme,
]);
if (error) {
diff --git a/plugins/techdocs/src/reader/transformers/index.ts b/plugins/techdocs/src/reader/transformers/index.ts
index c8568282cf..ddbaadd071 100644
--- a/plugins/techdocs/src/reader/transformers/index.ts
+++ b/plugins/techdocs/src/reader/transformers/index.ts
@@ -21,6 +21,7 @@ export * from './removeMkdocsHeader';
export * from './modifyCss';
export * from './onCssReady';
export * from './sanitizeDOM';
+export * from './injectCss';
export type Transformer = (dom: Element) => Element;
diff --git a/plugins/techdocs/src/reader/transformers/injectCss.test.ts b/plugins/techdocs/src/reader/transformers/injectCss.test.ts
new file mode 100644
index 0000000000..afad9bbd2c
--- /dev/null
+++ b/plugins/techdocs/src/reader/transformers/injectCss.test.ts
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2020 Spotify AB
+ *
+ * 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 { createTestShadowDom } from '../../test-utils';
+import { injectCss } from '../transformers';
+
+describe('injectCss', () => {
+ it('should inject style with passed css in head', () => {
+ const html = `
+
+
+
+
+ `;
+ const injectedCss = '* {background-color: #fff}';
+
+ const shadowDom = createTestShadowDom(html, {
+ preTransformers: [injectCss({ css: injectedCss })],
+ postTransformers: [],
+ });
+
+ const styleElement = shadowDom.querySelector('head > style');
+
+ expect(styleElement).toBeTruthy();
+ expect(styleElement!.innerHTML).toEqual(injectedCss);
+ });
+});
diff --git a/plugins/techdocs/src/reader/transformers/injectCss.ts b/plugins/techdocs/src/reader/transformers/injectCss.ts
new file mode 100644
index 0000000000..2f6aa46bb6
--- /dev/null
+++ b/plugins/techdocs/src/reader/transformers/injectCss.ts
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2020 Spotify AB
+ *
+ * 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 type { Transformer } from './index';
+
+type InjectCssOptions = {
+ css: string;
+};
+
+export const injectCss = ({ css }: InjectCssOptions): Transformer => {
+ return dom => {
+ dom
+ .getElementsByTagName('head')[0]
+ .insertAdjacentHTML('beforeend', ``);
+
+ return dom;
+ };
+};
diff --git a/plugins/techdocs/src/reader/transformers/sanitizeDOM/index.test.ts b/plugins/techdocs/src/reader/transformers/sanitizeDOM/index.test.ts
index 9754437c1a..691984ecab 100644
--- a/plugins/techdocs/src/reader/transformers/sanitizeDOM/index.test.ts
+++ b/plugins/techdocs/src/reader/transformers/sanitizeDOM/index.test.ts
@@ -62,4 +62,42 @@ describe('sanitizeDOM', () => {
shadowDom.querySelector('#test-malicious-link')?.hasAttribute('onclick'),
).toBeFalsy();
});
+
+ it('removes style tags', () => {
+ const html = `
+
+
+