Merge branch 'backstage:master' into bug/ado-scopes
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-stack-overflow': patch
|
||||
---
|
||||
|
||||
fix: fix decode issues in title and author fields in `StackOverflowSearchResultListItem`
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
'@backstage/plugin-devtools': patch
|
||||
'@backstage/plugin-linguist': patch
|
||||
---
|
||||
|
||||
Updated to use `fetchApi` as per [ADR013](https://backstage.io/docs/architecture-decisions/adrs-adr013)
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-tech-radar': patch
|
||||
---
|
||||
|
||||
Fixed an issue with the "moved in direction" table header cell getting squished and becoming unreadable if a timeline description is too long
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
'@backstage/plugin-azure-devops': minor
|
||||
---
|
||||
|
||||
**BREAKING** The `AzureDevOpsClient` no longer requires `identityAPi` but now requires `fetchApi`.
|
||||
|
||||
Updated to use `fetchApi` as per [ADR013](https://backstage.io/docs/architecture-decisions/adrs-adr013)
|
||||
+5
-2
@@ -23,8 +23,11 @@ module.exports = {
|
||||
'notice/notice': [
|
||||
'error',
|
||||
{
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
templateFile: path.resolve(__dirname, './scripts/copyright-header.txt'),
|
||||
templateFile: path.resolve(
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
__dirname,
|
||||
'./scripts/templates/copyright-header.txt'
|
||||
),
|
||||
onNonMatchingHeader: 'replace',
|
||||
},
|
||||
],
|
||||
|
||||
@@ -11,6 +11,7 @@ cli-report.md
|
||||
plugins/scaffolder-backend/sample-templates
|
||||
.vscode
|
||||
dist-types
|
||||
.eslintrc.js
|
||||
|
||||
# reduce the barrier for adopters to add themselves
|
||||
ADOPTERS.md
|
||||
|
||||
@@ -107,6 +107,20 @@ Scope: The TechDocs plugin and related tooling
|
||||
|
||||
These incubating project areas have shared ownership with @backstage/maintainers.
|
||||
|
||||
### Community Plugins
|
||||
|
||||
Team: @backstage/community-plugins-maintainers
|
||||
|
||||
Scope: Tooling and Community Repo Maintainers for the Backstage [Community Plugins repository](https://github.com/backstage/community-plugins)
|
||||
|
||||
| Name | Organization | GitHub | Discord |
|
||||
| -------------------- | ------------ | ------------------------------------------- | ------------ |
|
||||
| Bethany Griggs | Red Hat | [BethGriggs](https://github.com/BethGriggs) | `bethgriggs` |
|
||||
| Tomas Kral | Red Hat | [kadel](https://github.com/kadel) | `tomkral` |
|
||||
| André Wanlin | Spotify | [awanlin](https://github.com/awanlin) | `ahhhndre` |
|
||||
| Philipp Hugenroth | Spotify | [tudi2d](https://github.com/tudi2d) | `tudi2d` |
|
||||
| Vincenzo Scamporlino | Spotify | [vinzscam](https://github.com/vinzscam) | `vinzscam` |
|
||||
|
||||
### OpenAPI Tooling
|
||||
|
||||
Team: @backstage/openapi-tooling-maintainers
|
||||
|
||||
@@ -96,7 +96,6 @@ The notification backend stores notification using the [database service](https:
|
||||
|
||||
- ID
|
||||
- Read date
|
||||
- Done date
|
||||
- Saved status
|
||||
- Creation date
|
||||
- Updated date (optional, for scoped notifications)
|
||||
@@ -104,7 +103,8 @@ The notification backend stores notification using the [database service](https:
|
||||
- Title
|
||||
- Description (optional)
|
||||
- Origin
|
||||
- Link
|
||||
- Link (optional)
|
||||
- Additional links (optional)
|
||||
- Recipients
|
||||
- Severity (optional, default normal)
|
||||
- Topic (optional)
|
||||
@@ -113,6 +113,10 @@ The notification backend stores notification using the [database service](https:
|
||||
|
||||
The recipients is **not** a list of users, but rather a filter that describes who should receive the notification. It must be possible to evaluate this filter in a database query, so that we can efficiently fetch all notifications for a given user. The same filter will also be used by the signal backend to determine which users should receive a signal.
|
||||
|
||||
The read date is a timestamp of marking the notifications as read by the user. If missing, the notification is still unread.
|
||||
|
||||
The saved status is a timestamp indicating when/if the user marked the notification for better visibility in the future (to "pin" the message). Can be undefined.
|
||||
|
||||
The title is mandatory human-readable text shortly describing the notifications.
|
||||
|
||||
The description is an optional human-readable text providing more details to the user.
|
||||
@@ -143,6 +147,8 @@ The link is a relative or absolute URL. As an example, it can be used:
|
||||
- by an external system to request an action within an asynchronous task
|
||||
- by a BE plugin to provide link to other part of the Backstage UI (i.e. to the Catalog)
|
||||
|
||||
The additional links are an array of title-URL pairs. They can represent immediate actions on the notification (i.e. yes-no) or lead the user to additional details.
|
||||
|
||||
The `notification-backend` does not provide any new permissions, since creating notifications can only be done by other backend plugins, while reading notifications can only be done by the authenticated user. It is possible that we want to add a permissions for reading notifications, in particular for admin and impersonation use cases, but that is not part of this proposal or the initial implementation.
|
||||
|
||||
The `notification-backend` shall provide necessary parameters for paging and filtering notifications from the frontend.
|
||||
@@ -228,7 +234,7 @@ interface NotificationService {
|
||||
|
||||
Each notification is always routed to individual users unless it's a broadcast. The `notification-backend` will figure out which users will receive a notification based on the `recipients` parameter, resolving it to the concrete list of users at the time of sending the notification.
|
||||
|
||||
Each notification contains a `title` and a `link` for user to see further information. The `created`, `id`, `read` and `saved` properties are handled by the backend based and cannot be changed during the notification creation.
|
||||
Each notification contains a human readable `title`, `origin` and optionally `link` for additional details. The `created`, `id`, `read` and `saved` properties are handled by the backend based and cannot be passed during the notification creation.
|
||||
|
||||
Calling `sendNotification` should never throw an error so that it doesn't block the current processing. Notifications should be considered as second-level citizens that are not critical if not delivered.
|
||||
|
||||
@@ -273,37 +279,31 @@ Example signal payload for a new notification:
|
||||
|
||||
Notification frontend shows users their own notifications in its own page and the number of unread notifications in the main menu item.
|
||||
|
||||
By default, notifications that are `undone` will be shown in the notifications view. The notification `read` status is indicated by the UI.
|
||||
Notifications are set to `read` when the `Mark as read` action is triggered by the user (bulk or single).
|
||||
|
||||
Notifications are set to `read` when the notification link is opened or the notification is set as `done` by the user.
|
||||
Notifications can be saved for better visibility in the future.
|
||||
|
||||
Notifications can be set to `done` by the user, and they are filtered out of the main view.
|
||||
Notifications can be filtered by `read`, `saved`, `content` (text search in title or description), `created` (since multiple predefined options) and `severity`.
|
||||
|
||||
Notifications can be saved for later use by the user.
|
||||
|
||||
Notifications can be filtered by their `read`, `done` and `saved` statuses.
|
||||
|
||||
Notifications are displayed in pages.
|
||||
|
||||
User can search for notifications based on their title and description.
|
||||
Notifications are displayed in pages. To do so, the backend needs to implement filtering and sorting.
|
||||
|
||||
The following frontend API is added as part of this proposal.
|
||||
|
||||
#### `NotificationsApi`
|
||||
|
||||
```ts
|
||||
export type NotificationType = 'undone' | 'done' | 'saved';
|
||||
export type NotificationSeverity = 'critical' | 'high' | 'normal' | 'low';
|
||||
|
||||
export type GetNotificationsOptions = {
|
||||
type?: NotificationType;
|
||||
offset?: number;
|
||||
limit?: number;
|
||||
search?: string;
|
||||
createdSince?: Date;
|
||||
severity?: NotificationSeverity;
|
||||
};
|
||||
|
||||
export type NotificationUpdateOptions = {
|
||||
ids: string[];
|
||||
done?: boolean;
|
||||
read?: boolean;
|
||||
saved?: boolean;
|
||||
};
|
||||
@@ -358,7 +358,7 @@ interface SignalApi {
|
||||
|
||||
- Replace absent signal service with long polling. This requires changes to the `signals` plugin as well.
|
||||
- Render dynamic values with various different React elements such as the `EntityRefLink` for entity references (for example `{{ user:default/john.doe }}`) in the notification payload
|
||||
- Handle `link` values that use route references. For example instead hard-coding link to `/catalog/default/component/artist-web` it should be possible to use `catalogPlugin.catalogEntity` route reference as a link of the notification. This should also allow using parameters to be passed to the route reference
|
||||
- Handle `link` values that use route references. For example instead hard-coding link to `/catalog/default/component/artist-web` it should be possible to use `catalogPlugin.catalogEntity` route reference as a link of the notification. This should also allow using parameters to be passed to the route reference. Links to external systems are still supported.
|
||||
- Add support for `analyticsApi` to notification actions like marking notifications done, saved or opening links in the notifications
|
||||
- Add support for user settings to control how notifications are shown to the user and which notifications user wants to receive. This should also include support for different `NotificationProcessor`s that can send notification to external systems
|
||||
- Add a sound to be played when notification is received
|
||||
|
||||
+33
-9
@@ -84,13 +84,16 @@ receive schema validation and autocompletion. For example:
|
||||
## Visibility
|
||||
|
||||
The `https://backstage.io/schema/config-v1` meta schema is a superset of JSON
|
||||
Schema Draft 07. The single addition is a custom `visibility` keyword, which is
|
||||
used to indicate whether the given config value should be visible in the
|
||||
frontend or not. The possible values are `frontend`, `backend`, and `secret`,
|
||||
where `backend` is the default. A visibility of `secret` has the same scope at
|
||||
runtime, but it will be treated with more care in certain contexts, and defining
|
||||
both `frontend` and `secret` for the same value in two different schemas will
|
||||
result in an error during schema merging.
|
||||
Schema Draft 07. The only additions are the custom `visibility` and
|
||||
`deepVisibility` keywords, which are used to indicate whether the given config
|
||||
value should be visible in the frontend or not. The `visibility` marker applies
|
||||
only to the field it's on, while the `deepVisibility` marker applies to the
|
||||
field it's on and downwards in the hierarchy as well. The possible values are
|
||||
`frontend`, `backend`, and `secret`, where `backend` is the default. A
|
||||
visibility of `secret` has the same scope at runtime, but it will be treated
|
||||
with more care in certain contexts, and defining both `frontend` and `secret`
|
||||
for the same value in two different schemas will result in an error during
|
||||
schema merging.
|
||||
|
||||
The visibility only applies to the direct parent of where the keyword is placed
|
||||
in the schema. For example, if you set the visibility to `frontend` for a subset
|
||||
@@ -105,17 +108,38 @@ declare the visibility of a leaf node of `type: "string"`.
|
||||
| `backend` | (Default) Only in backend |
|
||||
| `secret` | Only in backend and may be excluded from logs for security reasons |
|
||||
|
||||
You can set visibility with an `@visibility` comment in the `Config` Typescript
|
||||
interface.
|
||||
You can set visibility with a `@visibility` or `@deepVisibility` comment in the
|
||||
`Config` Typescript interface.
|
||||
|
||||
```ts
|
||||
export interface Config {
|
||||
app: {
|
||||
/**
|
||||
* Frontend root URL
|
||||
* NOTE: Visibility applies to only this field
|
||||
* @visibility frontend
|
||||
*/
|
||||
baseUrl: string;
|
||||
|
||||
/**
|
||||
* Some custom complex type
|
||||
* NOTE: Visibility applies recursively downward
|
||||
* This is particularly useful for complex types like durations
|
||||
* @deepVisibility frontend
|
||||
*/
|
||||
customSchedule: HumanDuration;
|
||||
};
|
||||
|
||||
backend: {
|
||||
/**
|
||||
* Some custom credentials type
|
||||
* NOTE: Visibility applies recursively downward, and this would NOT have
|
||||
* been safe if the regular visibility keyword had been used
|
||||
* @deepVisibility secret
|
||||
*/
|
||||
customCredentials: {
|
||||
password: string;
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2021 The Backstage Authors
|
||||
* Copyright 2024 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,13 +14,26 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// This file makes it possible to run "yarn knex migrate:make some_file_name"
|
||||
// to assist in making new migrations
|
||||
// To create a new migration in a plugin, run:
|
||||
//
|
||||
// yarn workspace <package> knex migrate:make <name_with_underscores>
|
||||
//
|
||||
// for example:
|
||||
//
|
||||
// yarn workspace @backstage/plugin-catalog-backend knex migrate:make add_feature_foo
|
||||
//
|
||||
// This creates a file similar to
|
||||
//
|
||||
// plugins/catalog-backend/migrations/20240206160252_add_feature_foo.js
|
||||
|
||||
module.exports = {
|
||||
client: 'better-sqlite3',
|
||||
connection: ':memory:',
|
||||
useNullAsDefault: true,
|
||||
migrations: {
|
||||
directory: './migrations',
|
||||
// unfortunately this needs to be relative to the TARGET, not this file, and
|
||||
// it just so happens to work to make it go up two steps due to our repo
|
||||
// layout
|
||||
stub: '../../scripts/templates/knex-migration.stub.js',
|
||||
},
|
||||
};
|
||||
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Copyright 2020 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
development: {
|
||||
client: 'better-sqlite3',
|
||||
connection: {
|
||||
filename: './dev.sqlite3',
|
||||
},
|
||||
},
|
||||
|
||||
/*
|
||||
staging: {
|
||||
client: 'postgresql',
|
||||
connection: {
|
||||
database: 'my_db',
|
||||
user: 'username',
|
||||
password: 'password',
|
||||
},
|
||||
pool: {
|
||||
min: 2,
|
||||
max: 10,
|
||||
},
|
||||
migrations: {
|
||||
tableName: 'knex_migrations',
|
||||
},
|
||||
},
|
||||
|
||||
production: {
|
||||
client: 'postgresql',
|
||||
connection: {
|
||||
database: 'my_db',
|
||||
user: 'username',
|
||||
password: 'password',
|
||||
},
|
||||
pool: {
|
||||
min: 2,
|
||||
max: 10,
|
||||
},
|
||||
migrations: {
|
||||
tableName: 'knex_migrations',
|
||||
},
|
||||
},
|
||||
*/
|
||||
};
|
||||
@@ -12,8 +12,8 @@ import { BuildRunOptions } from '@backstage/plugin-azure-devops-common';
|
||||
import { DashboardPullRequest } from '@backstage/plugin-azure-devops-common';
|
||||
import { DiscoveryApi } from '@backstage/core-plugin-api';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { FetchApi } from '@backstage/core-plugin-api';
|
||||
import { GitTag } from '@backstage/plugin-azure-devops-common';
|
||||
import { IdentityApi } from '@backstage/core-plugin-api';
|
||||
import { JSX as JSX_2 } from 'react';
|
||||
import { PullRequest } from '@backstage/plugin-azure-devops-common';
|
||||
import { PullRequestOptions } from '@backstage/plugin-azure-devops-common';
|
||||
@@ -121,10 +121,7 @@ export const azureDevOpsApiRef: ApiRef<AzureDevOpsApi>;
|
||||
|
||||
// @public (undocumented)
|
||||
export class AzureDevOpsClient implements AzureDevOpsApi {
|
||||
constructor(options: {
|
||||
discoveryApi: DiscoveryApi;
|
||||
identityApi: IdentityApi;
|
||||
});
|
||||
constructor(options: { discoveryApi: DiscoveryApi; fetchApi: FetchApi });
|
||||
// (undocumented)
|
||||
getAllTeams(): Promise<Team[]>;
|
||||
// (undocumented)
|
||||
|
||||
@@ -21,7 +21,7 @@ import {
|
||||
createPageExtension,
|
||||
createPlugin,
|
||||
discoveryApiRef,
|
||||
identityApiRef,
|
||||
fetchApiRef,
|
||||
} from '@backstage/frontend-plugin-api';
|
||||
import { azureDevOpsApiRef, AzureDevOpsClient } from '../api';
|
||||
import {
|
||||
@@ -38,9 +38,12 @@ import { azurePullRequestDashboardRouteRef } from '../routes';
|
||||
export const azureDevOpsApi = createApiExtension({
|
||||
factory: createApiFactory({
|
||||
api: azureDevOpsApiRef,
|
||||
deps: { discoveryApi: discoveryApiRef, identityApi: identityApiRef },
|
||||
factory: ({ discoveryApi, identityApi }) =>
|
||||
new AzureDevOpsClient({ discoveryApi, identityApi }),
|
||||
deps: {
|
||||
discoveryApi: discoveryApiRef,
|
||||
fetchApi: fetchApiRef,
|
||||
},
|
||||
factory: ({ discoveryApi, fetchApi }) =>
|
||||
new AzureDevOpsClient({ discoveryApi, fetchApi }),
|
||||
}),
|
||||
});
|
||||
|
||||
|
||||
@@ -27,21 +27,21 @@ import {
|
||||
RepoBuildOptions,
|
||||
Team,
|
||||
} from '@backstage/plugin-azure-devops-common';
|
||||
import { DiscoveryApi, IdentityApi } from '@backstage/core-plugin-api';
|
||||
import { DiscoveryApi, FetchApi } from '@backstage/core-plugin-api';
|
||||
import { ResponseError } from '@backstage/errors';
|
||||
import { AzureDevOpsApi } from './AzureDevOpsApi';
|
||||
|
||||
/** @public */
|
||||
export class AzureDevOpsClient implements AzureDevOpsApi {
|
||||
private readonly discoveryApi: DiscoveryApi;
|
||||
private readonly identityApi: IdentityApi;
|
||||
private readonly fetchApi: FetchApi;
|
||||
|
||||
public constructor(options: {
|
||||
discoveryApi: DiscoveryApi;
|
||||
identityApi: IdentityApi;
|
||||
fetchApi: FetchApi;
|
||||
}) {
|
||||
this.discoveryApi = options.discoveryApi;
|
||||
this.identityApi = options.identityApi;
|
||||
this.fetchApi = options.fetchApi;
|
||||
}
|
||||
|
||||
public async getRepoBuilds(
|
||||
@@ -203,10 +203,7 @@ export class AzureDevOpsClient implements AzureDevOpsApi {
|
||||
const baseUrl = `${await this.discoveryApi.getBaseUrl('azure-devops')}/`;
|
||||
const url = new URL(path, baseUrl);
|
||||
|
||||
const { token: idToken } = await this.identityApi.getCredentials();
|
||||
const response = await fetch(url.toString(), {
|
||||
headers: idToken ? { Authorization: `Bearer ${idToken}` } : {},
|
||||
});
|
||||
const response = await this.fetchApi.fetch(url.toString());
|
||||
|
||||
if (!response.ok) {
|
||||
throw await ResponseError.fromResponse(response);
|
||||
|
||||
@@ -26,7 +26,7 @@ import {
|
||||
createRoutableExtension,
|
||||
createComponentExtension,
|
||||
discoveryApiRef,
|
||||
identityApiRef,
|
||||
fetchApiRef,
|
||||
} from '@backstage/core-plugin-api';
|
||||
|
||||
import { AzureDevOpsClient } from './api/AzureDevOpsClient';
|
||||
@@ -56,9 +56,12 @@ export const azureDevOpsPlugin = createPlugin({
|
||||
apis: [
|
||||
createApiFactory({
|
||||
api: azureDevOpsApiRef,
|
||||
deps: { discoveryApi: discoveryApiRef, identityApi: identityApiRef },
|
||||
factory: ({ discoveryApi, identityApi }) =>
|
||||
new AzureDevOpsClient({ discoveryApi, identityApi }),
|
||||
deps: {
|
||||
discoveryApi: discoveryApiRef,
|
||||
fetchApi: fetchApiRef,
|
||||
},
|
||||
factory: ({ discoveryApi, fetchApi }) =>
|
||||
new AzureDevOpsClient({ discoveryApi, fetchApi }),
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
@@ -22,7 +22,7 @@ import {
|
||||
createPageExtension,
|
||||
createPlugin,
|
||||
discoveryApiRef,
|
||||
identityApiRef,
|
||||
fetchApiRef,
|
||||
} from '@backstage/frontend-plugin-api';
|
||||
|
||||
import { devToolsApiRef, DevToolsClient } from '../api';
|
||||
@@ -37,9 +37,12 @@ import { rootRouteRef } from '../routes';
|
||||
export const devToolsApi = createApiExtension({
|
||||
factory: createApiFactory({
|
||||
api: devToolsApiRef,
|
||||
deps: { discoveryApi: discoveryApiRef, identityApi: identityApiRef },
|
||||
factory: ({ discoveryApi, identityApi }) =>
|
||||
new DevToolsClient({ discoveryApi, identityApi }),
|
||||
deps: {
|
||||
discoveryApi: discoveryApiRef,
|
||||
fetchApi: fetchApiRef,
|
||||
},
|
||||
factory: ({ discoveryApi, fetchApi }) =>
|
||||
new DevToolsClient({ discoveryApi, fetchApi }),
|
||||
}),
|
||||
});
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { DiscoveryApi, IdentityApi } from '@backstage/core-plugin-api';
|
||||
import { DiscoveryApi, FetchApi } from '@backstage/core-plugin-api';
|
||||
import {
|
||||
ConfigInfo,
|
||||
DevToolsInfo,
|
||||
@@ -25,14 +25,14 @@ import { DevToolsApi } from './DevToolsApi';
|
||||
|
||||
export class DevToolsClient implements DevToolsApi {
|
||||
private readonly discoveryApi: DiscoveryApi;
|
||||
private readonly identityApi: IdentityApi;
|
||||
private readonly fetchApi: FetchApi;
|
||||
|
||||
public constructor(options: {
|
||||
discoveryApi: DiscoveryApi;
|
||||
identityApi: IdentityApi;
|
||||
fetchApi: FetchApi;
|
||||
}) {
|
||||
this.discoveryApi = options.discoveryApi;
|
||||
this.identityApi = options.identityApi;
|
||||
this.fetchApi = options.fetchApi;
|
||||
}
|
||||
|
||||
public async getConfig(): Promise<ConfigInfo | undefined> {
|
||||
@@ -64,10 +64,7 @@ export class DevToolsClient implements DevToolsApi {
|
||||
const baseUrl = `${await this.discoveryApi.getBaseUrl('devtools')}/`;
|
||||
const url = new URL(path, baseUrl);
|
||||
|
||||
const { token } = await this.identityApi.getCredentials();
|
||||
const response = await fetch(url.toString(), {
|
||||
headers: token ? { Authorization: `Bearer ${token}` } : {},
|
||||
});
|
||||
const response = await this.fetchApi.fetch(url.toString());
|
||||
|
||||
if (!response.ok) {
|
||||
throw await ResponseError.fromResponse(response);
|
||||
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
createPlugin,
|
||||
createRoutableExtension,
|
||||
discoveryApiRef,
|
||||
identityApiRef,
|
||||
fetchApiRef,
|
||||
} from '@backstage/core-plugin-api';
|
||||
import { devToolsApiRef, DevToolsClient } from './api';
|
||||
|
||||
@@ -31,9 +31,12 @@ export const devToolsPlugin = createPlugin({
|
||||
apis: [
|
||||
createApiFactory({
|
||||
api: devToolsApiRef,
|
||||
deps: { discoveryApi: discoveryApiRef, identityApi: identityApiRef },
|
||||
factory: ({ discoveryApi, identityApi }) =>
|
||||
new DevToolsClient({ discoveryApi, identityApi }),
|
||||
deps: {
|
||||
discoveryApi: discoveryApiRef,
|
||||
fetchApi: fetchApiRef,
|
||||
},
|
||||
factory: ({ discoveryApi, fetchApi }) =>
|
||||
new DevToolsClient({ discoveryApi, fetchApi }),
|
||||
}),
|
||||
],
|
||||
routes: {
|
||||
|
||||
@@ -20,7 +20,7 @@ import {
|
||||
createApiFactory,
|
||||
createPlugin,
|
||||
discoveryApiRef,
|
||||
identityApiRef,
|
||||
fetchApiRef,
|
||||
} from '@backstage/frontend-plugin-api';
|
||||
|
||||
import { LinguistClient, linguistApiRef } from '../api';
|
||||
@@ -40,9 +40,12 @@ export const entityLinguistCard = createEntityCardExtension({
|
||||
export const linguistApi = createApiExtension({
|
||||
factory: createApiFactory({
|
||||
api: linguistApiRef,
|
||||
deps: { discoveryApi: discoveryApiRef, identityApi: identityApiRef },
|
||||
factory: ({ discoveryApi, identityApi }) =>
|
||||
new LinguistClient({ discoveryApi, identityApi }),
|
||||
deps: {
|
||||
discoveryApi: discoveryApiRef,
|
||||
fetchApi: fetchApiRef,
|
||||
},
|
||||
factory: ({ discoveryApi, fetchApi }) =>
|
||||
new LinguistClient({ discoveryApi, fetchApi }),
|
||||
}),
|
||||
});
|
||||
|
||||
|
||||
@@ -14,21 +14,21 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { DiscoveryApi, IdentityApi } from '@backstage/core-plugin-api';
|
||||
import { DiscoveryApi, FetchApi } from '@backstage/core-plugin-api';
|
||||
import { ResponseError } from '@backstage/errors';
|
||||
import { Languages } from '@backstage/plugin-linguist-common';
|
||||
import { LinguistApi } from './LinguistApi';
|
||||
|
||||
export class LinguistClient implements LinguistApi {
|
||||
private readonly discoveryApi: DiscoveryApi;
|
||||
private readonly identityApi: IdentityApi;
|
||||
private readonly fetchApi: FetchApi;
|
||||
|
||||
public constructor(options: {
|
||||
discoveryApi: DiscoveryApi;
|
||||
identityApi: IdentityApi;
|
||||
fetchApi: FetchApi;
|
||||
}) {
|
||||
this.discoveryApi = options.discoveryApi;
|
||||
this.identityApi = options.identityApi;
|
||||
this.fetchApi = options.fetchApi;
|
||||
}
|
||||
|
||||
public async getLanguages(entityRef: string): Promise<Languages> {
|
||||
@@ -45,10 +45,7 @@ export class LinguistClient implements LinguistApi {
|
||||
const baseUrl = `${await this.discoveryApi.getBaseUrl('linguist')}/`;
|
||||
const url = new URL(path, baseUrl);
|
||||
|
||||
const { token } = await this.identityApi.getCredentials();
|
||||
const response = await fetch(url.toString(), {
|
||||
headers: token ? { Authorization: `Bearer ${token}` } : {},
|
||||
});
|
||||
const response = await this.fetchApi.fetch(url.toString());
|
||||
|
||||
if (!response.ok) {
|
||||
throw await ResponseError.fromResponse(response);
|
||||
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
createComponentExtension,
|
||||
createPlugin,
|
||||
discoveryApiRef,
|
||||
identityApiRef,
|
||||
fetchApiRef,
|
||||
} from '@backstage/core-plugin-api';
|
||||
import { linguistApiRef, LinguistClient } from './api';
|
||||
import { LINGUIST_ANNOTATION } from '@backstage/plugin-linguist-common';
|
||||
@@ -35,9 +35,12 @@ export const linguistPlugin = createPlugin({
|
||||
apis: [
|
||||
createApiFactory({
|
||||
api: linguistApiRef,
|
||||
deps: { discoveryApi: discoveryApiRef, identityApi: identityApiRef },
|
||||
factory: ({ discoveryApi, identityApi }) =>
|
||||
new LinguistClient({ discoveryApi, identityApi }),
|
||||
deps: {
|
||||
discoveryApi: discoveryApiRef,
|
||||
fetchApi: fetchApiRef,
|
||||
},
|
||||
factory: ({ discoveryApi, fetchApi }) =>
|
||||
new LinguistClient({ discoveryApi, fetchApi }),
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
@@ -10,7 +10,7 @@ import { BackstagePlugin } from '@backstage/core-plugin-api';
|
||||
import { CardExtensionProps } from '@backstage/plugin-home-react';
|
||||
import { JSX as JSX_2 } from 'react';
|
||||
import { default as React_2 } from 'react';
|
||||
import { ResultHighlight } from '@backstage/plugin-search-common';
|
||||
import type { ResultHighlight } from '@backstage/plugin-search-common';
|
||||
import { SearchResultListItemExtensionProps } from '@backstage/plugin-search-react';
|
||||
|
||||
// @public
|
||||
|
||||
+7
-6
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import _unescape from 'lodash/unescape';
|
||||
import { Link } from '@backstage/core-components';
|
||||
import {
|
||||
Divider,
|
||||
@@ -26,8 +25,9 @@ import {
|
||||
Chip,
|
||||
} from '@material-ui/core';
|
||||
import { useAnalytics } from '@backstage/core-plugin-api';
|
||||
import { ResultHighlight } from '@backstage/plugin-search-common';
|
||||
import type { ResultHighlight } from '@backstage/plugin-search-common';
|
||||
import { HighlightedSearchResultText } from '@backstage/plugin-search-react';
|
||||
import { decodeHtml } from '../../util';
|
||||
|
||||
/**
|
||||
* Props for {@link StackOverflowSearchResultListItem}
|
||||
@@ -45,6 +45,7 @@ export const StackOverflowSearchResultListItem = (
|
||||
props: StackOverflowSearchResultListItemProps,
|
||||
) => {
|
||||
const { result, highlight } = props;
|
||||
|
||||
const analytics = useAnalytics();
|
||||
|
||||
const handleClick = () => {
|
||||
@@ -69,12 +70,12 @@ export const StackOverflowSearchResultListItem = (
|
||||
<Link to={result.location} noTrack onClick={handleClick}>
|
||||
{highlight?.fields?.title ? (
|
||||
<HighlightedSearchResultText
|
||||
text={highlight.fields.title}
|
||||
text={decodeHtml(highlight.fields.title)}
|
||||
preTag={highlight.preTag}
|
||||
postTag={highlight.postTag}
|
||||
/>
|
||||
) : (
|
||||
_unescape(result.title)
|
||||
decodeHtml(result.title)
|
||||
)}
|
||||
</Link>
|
||||
}
|
||||
@@ -83,13 +84,13 @@ export const StackOverflowSearchResultListItem = (
|
||||
<>
|
||||
Author:{' '}
|
||||
<HighlightedSearchResultText
|
||||
text={highlight.fields.text}
|
||||
text={decodeHtml(highlight.fields.text)}
|
||||
preTag={highlight.preTag}
|
||||
postTag={highlight.postTag}
|
||||
/>
|
||||
</>
|
||||
) : (
|
||||
`Author: ${result.text}`
|
||||
`Author: ${decodeHtml(result.text)}`
|
||||
)
|
||||
}
|
||||
/>
|
||||
|
||||
+6
-11
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2021 The Backstage Authors
|
||||
* Copyright 2024 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,13 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// This file makes it possible to run "yarn knex migrate:make some_file_name"
|
||||
// to assist in making new migrations
|
||||
module.exports = {
|
||||
client: 'better-sqlite3',
|
||||
connection: ':memory:',
|
||||
useNullAsDefault: true,
|
||||
migrations: {
|
||||
directory: './migrations',
|
||||
},
|
||||
};
|
||||
export function decodeHtml(input: string) {
|
||||
const textContainer = document.createElement('textarea');
|
||||
textContainer.innerHTML = input;
|
||||
return textContainer.value;
|
||||
}
|
||||
@@ -47,7 +47,9 @@ const RadarTimeline = (props: Props): JSX.Element => {
|
||||
<Table aria-label="simple table">
|
||||
<TableHead>
|
||||
<TableRow>
|
||||
<TableCell align="left">Moved in direction</TableCell>
|
||||
<TableCell align="left" style={{ wordBreak: 'normal' }}>
|
||||
Moved in direction
|
||||
</TableCell>
|
||||
<TableCell align="left">Moved to ring</TableCell>
|
||||
<TableCell align="left">Moved on date</TableCell>
|
||||
<TableCell align="left">Description</TableCell>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2022 The Backstage Authors
|
||||
* Copyright 2024 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,15 +14,20 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// Update with your config settings.
|
||||
// @ts-check
|
||||
|
||||
// This file makes it possible to run "yarn knex migrate:make some_file_name"
|
||||
// to assist in making new migrations
|
||||
module.exports = {
|
||||
client: 'better-sqlite3',
|
||||
connection: ':memory:',
|
||||
useNullAsDefault: true,
|
||||
migrations: {
|
||||
directory: './migrations',
|
||||
},
|
||||
/**
|
||||
* @param { import("knex").Knex } knex
|
||||
* @returns { Promise<void> }
|
||||
*/
|
||||
exports.up = async function up(knex) {
|
||||
// await knex.schema...
|
||||
};
|
||||
|
||||
/**
|
||||
* @param { import("knex").Knex } knex
|
||||
* @returns { Promise<void> }
|
||||
*/
|
||||
exports.down = async function down(knex) {
|
||||
// await knex.schema...
|
||||
};
|
||||
@@ -20089,9 +20089,9 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@uiw/codemirror-extensions-basic-setup@npm:4.21.21":
|
||||
version: 4.21.21
|
||||
resolution: "@uiw/codemirror-extensions-basic-setup@npm:4.21.21"
|
||||
"@uiw/codemirror-extensions-basic-setup@npm:4.21.23":
|
||||
version: 4.21.23
|
||||
resolution: "@uiw/codemirror-extensions-basic-setup@npm:4.21.23"
|
||||
dependencies:
|
||||
"@codemirror/autocomplete": ^6.0.0
|
||||
"@codemirror/commands": ^6.0.0
|
||||
@@ -20108,19 +20108,19 @@ __metadata:
|
||||
"@codemirror/search": ">=6.0.0"
|
||||
"@codemirror/state": ">=6.0.0"
|
||||
"@codemirror/view": ">=6.0.0"
|
||||
checksum: 5d96ec930be286b5e324ee8dd57128171c72a8e333b4b991a5c4f33a05420a638def3776bd1a77c5b88184f7d3cbc6828b5c9a42b3b490f51908bedf69eaa0f0
|
||||
checksum: cd17481d9d9a9b620f961a4df6e8208bcabe98652ca6c18366a8688fbcc09d37a030694a70dcc010aaabe02c85c342acf9f80357c6853b57f1081af5b130bd26
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@uiw/react-codemirror@npm:^4.9.3":
|
||||
version: 4.21.21
|
||||
resolution: "@uiw/react-codemirror@npm:4.21.21"
|
||||
version: 4.21.23
|
||||
resolution: "@uiw/react-codemirror@npm:4.21.23"
|
||||
dependencies:
|
||||
"@babel/runtime": ^7.18.6
|
||||
"@codemirror/commands": ^6.1.0
|
||||
"@codemirror/state": ^6.1.1
|
||||
"@codemirror/theme-one-dark": ^6.0.0
|
||||
"@uiw/codemirror-extensions-basic-setup": 4.21.21
|
||||
"@uiw/codemirror-extensions-basic-setup": 4.21.23
|
||||
codemirror: ^6.0.0
|
||||
peerDependencies:
|
||||
"@babel/runtime": ">=7.11.0"
|
||||
@@ -20130,7 +20130,7 @@ __metadata:
|
||||
codemirror: ">=6.0.0"
|
||||
react: ">=16.8.0"
|
||||
react-dom: ">=16.8.0"
|
||||
checksum: 6a8500290bf0a739fd345221465b10112e0f758914bc8aa28ce0b9904b76489ae018d390f6a2d7dd7752b21f0ed87ba3fedb45b4185d04e4985abf0eb22e6d75
|
||||
checksum: 7d0209d947e1e57cf80ef44a097bb3af04d2bab2d6fc57deed91619a0db77e3d4289db8f03fb43906b2e324496d25c872fa99b83834f085c40ad95137ea4459c
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -21993,13 +21993,13 @@ __metadata:
|
||||
linkType: hard
|
||||
|
||||
"better-sqlite3@npm:^9.0.0":
|
||||
version: 9.4.1
|
||||
resolution: "better-sqlite3@npm:9.4.1"
|
||||
version: 9.4.3
|
||||
resolution: "better-sqlite3@npm:9.4.3"
|
||||
dependencies:
|
||||
bindings: ^1.5.0
|
||||
node-gyp: latest
|
||||
prebuild-install: ^7.1.1
|
||||
checksum: 4d14a95c9ec62eb76321aaf085fd08e9dae10527149f5b54e9f9868feb50ae6fbf6f7eed52f52e6126472938aa789f7e82f5ad9357c88b4efeaf8f7d958c5c11
|
||||
checksum: 09e8d52e52e42f7175fd71fb8856873e9e39714a31b7739e0c6c2017b020bfa3f1cdd255ad1fe4d68140b0c74a5d043eca4d1ed8be9a080e172557bbea0deaf5
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -25659,7 +25659,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"dompurify@npm:=3.0.8, dompurify@npm:^3.0.0":
|
||||
"dompurify@npm:=3.0.8":
|
||||
version: 3.0.8
|
||||
resolution: "dompurify@npm:3.0.8"
|
||||
checksum: cac660ccae15a9603f06a85344da868a4c3732d8b57f7998de0f421eb4b9e67d916be52e9bb2a57b2f95b49e994cc50bcd06bb87f2cb2849cf058bdf15266237
|
||||
@@ -25673,6 +25673,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"dompurify@npm:^3.0.0":
|
||||
version: 3.0.9
|
||||
resolution: "dompurify@npm:3.0.9"
|
||||
checksum: 09794f2e40a0003d36e3cd70be1036f83de39d9d4a0f199c45e0b9962ce8ae5f9fe424d7edc4c8ff9ec615be9744a140d66788f0925913ac482d4628b283cae5
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"domutils@npm:^2.5.2, domutils@npm:^2.8.0":
|
||||
version: 2.8.0
|
||||
resolution: "domutils@npm:2.8.0"
|
||||
@@ -28734,19 +28741,19 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"gaxios@npm:^6.0.0, gaxios@npm:^6.0.2":
|
||||
version: 6.1.1
|
||||
resolution: "gaxios@npm:6.1.1"
|
||||
"gaxios@npm:^6.0.0, gaxios@npm:^6.0.2, gaxios@npm:^6.1.1":
|
||||
version: 6.3.0
|
||||
resolution: "gaxios@npm:6.3.0"
|
||||
dependencies:
|
||||
extend: ^3.0.2
|
||||
https-proxy-agent: ^7.0.1
|
||||
is-stream: ^2.0.0
|
||||
node-fetch: ^2.6.9
|
||||
checksum: bb4a4e6c81847b690ee29e01294d2093eb9bb4f9e60bbf81fcc6cd3b274f3c551c50a9bc134e7e7019a9b116eac9d9df6af9f2519c695da7ddd785f36564da72
|
||||
checksum: 4d4a8db32d833f8012435e2016cb0c919cac288e821bf81f877504e4284ef12b444cd903448e738c4031cd5219adf1e8d68e7df2b3dba774db9fde27f71109d4
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"gcp-metadata@npm:^6.0.0":
|
||||
"gcp-metadata@npm:^6.1.0":
|
||||
version: 6.1.0
|
||||
resolution: "gcp-metadata@npm:6.1.0"
|
||||
dependencies:
|
||||
@@ -29131,16 +29138,16 @@ __metadata:
|
||||
linkType: hard
|
||||
|
||||
"google-auth-library@npm:^9.0.0":
|
||||
version: 9.2.0
|
||||
resolution: "google-auth-library@npm:9.2.0"
|
||||
version: 9.6.3
|
||||
resolution: "google-auth-library@npm:9.6.3"
|
||||
dependencies:
|
||||
base64-js: ^1.3.0
|
||||
ecdsa-sig-formatter: ^1.0.11
|
||||
gaxios: ^6.0.0
|
||||
gcp-metadata: ^6.0.0
|
||||
gaxios: ^6.1.1
|
||||
gcp-metadata: ^6.1.0
|
||||
gtoken: ^7.0.0
|
||||
jws: ^4.0.0
|
||||
checksum: 0da686964a769c79b5a1f7e518cb885f7c433edd50c8adf5cc310bfce607235184ebe6f9bc5290618d760c25e4ce1e273d444c9914c815353faa9d9dea37d1b3
|
||||
checksum: 46174191de15ec56110ac0394ae9d1c56fb6aa293809d45170b2ff570130d7e3f3e82fa78d413908862a2d0da3fa946b72f1074000f4d52579eb17367e49e44d
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -32158,9 +32165,9 @@ __metadata:
|
||||
linkType: hard
|
||||
|
||||
"js-base64@npm:^3.6.0":
|
||||
version: 3.7.6
|
||||
resolution: "js-base64@npm:3.7.6"
|
||||
checksum: 4e1e82443c22f3f8f24902b071ea824069a28a16a86c3d8706e8c0741cace92cfb4affd093f52d13981369e10df840e54df8d0a59ede6dd2204a1f0aa4b64deb
|
||||
version: 3.7.7
|
||||
resolution: "js-base64@npm:3.7.7"
|
||||
checksum: d1b02971db9dc0fd35baecfaf6ba499731fb44fe3373e7e1d6681fbd3ba665f29e8d9d17910254ef8104e2cb8b44117fe4202d3dc54c7cafe9ba300fe5433358
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -33689,7 +33696,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"lodash@npm:4.17.21, lodash@npm:^4.15.0, lodash@npm:^4.16.4, lodash@npm:^4.17.10, lodash@npm:^4.17.11, lodash@npm:^4.17.14, lodash@npm:^4.17.15, lodash@npm:^4.17.19, lodash@npm:^4.17.20, lodash@npm:^4.17.21, lodash@npm:^4.17.4, lodash@npm:^4.7.0, lodash@npm:~4.17.15, lodash@npm:~4.17.21":
|
||||
"lodash@npm:4.17.21, lodash@npm:^4.15.0, lodash@npm:^4.16.4, lodash@npm:^4.17.10, lodash@npm:^4.17.11, lodash@npm:^4.17.14, lodash@npm:^4.17.15, lodash@npm:^4.17.20, lodash@npm:^4.17.21, lodash@npm:^4.17.4, lodash@npm:^4.7.0, lodash@npm:~4.17.15, lodash@npm:~4.17.21":
|
||||
version: 4.17.21
|
||||
resolution: "lodash@npm:4.17.21"
|
||||
checksum: eb835a2e51d381e561e508ce932ea50a8e5a68f4ebdd771ea240d3048244a8d13658acbd502cd4829768c56f2e16bdd4340b9ea141297d472517b83868e677f7
|
||||
@@ -39860,12 +39867,12 @@ __metadata:
|
||||
linkType: hard
|
||||
|
||||
"react-virtualized-auto-sizer@npm:^1.0.11":
|
||||
version: 1.0.22
|
||||
resolution: "react-virtualized-auto-sizer@npm:1.0.22"
|
||||
version: 1.0.23
|
||||
resolution: "react-virtualized-auto-sizer@npm:1.0.23"
|
||||
peerDependencies:
|
||||
react: ^15.3.0 || ^16.0.0-alpha || ^17.0.0 || ^18.0.0
|
||||
react-dom: ^15.3.0 || ^16.0.0-alpha || ^17.0.0 || ^18.0.0
|
||||
checksum: dc3fc29437b7179de71f77e5be3514e8789944132d7eb03f7157f783ec167ad9bebf1d371c135cf74fc5787dfac313a2914a5d23b45e978ae77be36c673342e5
|
||||
checksum: a5b37b2201f09f957d2398f1415fcec9b2aa0cbfb75ae193bd324a0bc5ef00dc30d3a40f60b31fe5a450d8ec66c0911213f9f3be0e8410ae1b180547030fd8e8
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -40075,12 +40082,12 @@ __metadata:
|
||||
linkType: hard
|
||||
|
||||
"recharts@npm:^2.5.0":
|
||||
version: 2.12.0
|
||||
resolution: "recharts@npm:2.12.0"
|
||||
version: 2.12.1
|
||||
resolution: "recharts@npm:2.12.1"
|
||||
dependencies:
|
||||
clsx: ^2.0.0
|
||||
eventemitter3: ^4.0.1
|
||||
lodash: ^4.17.19
|
||||
lodash: ^4.17.21
|
||||
react-is: ^16.10.2
|
||||
react-smooth: ^4.0.0
|
||||
recharts-scale: ^0.4.4
|
||||
@@ -40089,7 +40096,7 @@ __metadata:
|
||||
peerDependencies:
|
||||
react: ^16.0.0 || ^17.0.0 || ^18.0.0
|
||||
react-dom: ^16.0.0 || ^17.0.0 || ^18.0.0
|
||||
checksum: 13fc3f8405a16dc8555b5aba9928e7339549b1db2da4821e659df8ac59cbdccec044b985be21093a546c2b2c231113103064c6ea4799322ca360805aede0358b
|
||||
checksum: 768024e18bab43de2378241891748c562c57ddedfc31c3cec932a21a8b41cd662555d7c2bc26e86e7534c5e5c7ef2ebc0faa6d5fdc34d28057020837b4e3bf50
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
||||
Reference in New Issue
Block a user