Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linkerd: Add support for new frontend system under /alpha #1497

Merged
merged 2 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions workspaces/linkerd/.changeset/dirty-kangaroos-listen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@backstage-community/plugin-linkerd': patch
---

Add support for New Frontend System under `/alpha`
2 changes: 1 addition & 1 deletion workspaces/linkerd/backstage.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "1.31.1"
"version": "1.31.3"
}
14 changes: 7 additions & 7 deletions workspaces/linkerd/packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@
"@backstage/core-app-api": "^1.15.0",
"@backstage/core-components": "^0.15.0",
"@backstage/core-plugin-api": "^1.9.4",
"@backstage/integration-react": "^1.1.31",
"@backstage/plugin-api-docs": "^0.11.9",
"@backstage/plugin-catalog": "^1.23.0",
"@backstage/integration-react": "^1.1.32",
"@backstage/plugin-api-docs": "^0.11.10",
"@backstage/plugin-catalog": "^1.23.1",
"@backstage/plugin-catalog-common": "^1.1.0",
"@backstage/plugin-catalog-graph": "^0.4.9",
"@backstage/plugin-catalog-react": "^1.13.0",
"@backstage/plugin-kubernetes": "^0.11.14",
"@backstage/plugin-catalog-graph": "^0.4.10",
"@backstage/plugin-catalog-react": "^1.13.1",
"@backstage/plugin-kubernetes": "^0.11.15",
"@backstage/plugin-permission-react": "^0.4.26",
"@backstage/plugin-search-react": "^1.8.0",
"@backstage/plugin-user-settings": "^0.8.12",
"@backstage/plugin-user-settings": "^0.8.13",
"@backstage/theme": "^0.5.7",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
Expand Down
4 changes: 2 additions & 2 deletions workspaces/linkerd/packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
"@backstage/backend-defaults": "^0.5.0",
"@backstage/backend-tasks": "^0.6.1",
"@backstage/config": "^1.2.0",
"@backstage/plugin-app-backend": "^0.3.74",
"@backstage/plugin-app-backend": "^0.3.75",
"@backstage/plugin-auth-backend": "^0.23.0",
"@backstage/plugin-auth-backend-module-github-provider": "^0.2.0",
"@backstage/plugin-auth-backend-module-guest-provider": "^0.2.0",
"@backstage/plugin-auth-node": "^0.5.2",
"@backstage/plugin-catalog-backend": "^1.26.0",
"@backstage/plugin-catalog-backend": "^1.26.1",
"@backstage/plugin-catalog-backend-module-scaffolder-entity-model": "^0.2.0",
"@backstage/plugin-kubernetes-backend": "^0.18.6",
"@backstage/plugin-permission-backend": "^0.5.49",
Expand Down
113 changes: 113 additions & 0 deletions workspaces/linkerd/plugins/linkerd/api-report-alpha.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
## API Report File for "@backstage-community/plugin-linkerd"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).

```ts
/// <reference types="react" />

import { AnyApiFactory } from '@backstage/core-plugin-api';
import { AnyRouteRefParams } from '@backstage/frontend-plugin-api';
import { ConfigurableExtensionDataRef } from '@backstage/frontend-plugin-api';
import { Entity } from '@backstage/catalog-model';
import { ExtensionDefinition } from '@backstage/frontend-plugin-api';
import { FrontendPlugin } from '@backstage/frontend-plugin-api';
import { JSX as JSX_2 } from 'react';
import { RouteRef } from '@backstage/frontend-plugin-api';

// @alpha
const plugin: FrontendPlugin<
{},
{},
{
'api:linkerd': ExtensionDefinition<{
kind: 'api';
namespace: undefined;
name: undefined;
config: {};
configInput: {};
output: ConfigurableExtensionDataRef<
AnyApiFactory,
'core.api.factory',
{}
>;
inputs: {};
}>;
'entity-card:linkerd': ExtensionDefinition<{
kind: 'entity-card';
namespace: undefined;
name: undefined;
config: {
filter: string | undefined;
};
configInput: {
filter?: string | undefined;
};
output:
| ConfigurableExtensionDataRef<JSX_2.Element, 'core.reactElement', {}>
| ConfigurableExtensionDataRef<
(entity: Entity) => boolean,
'catalog.entity-filter-function',
{
optional: true;
}
>
| ConfigurableExtensionDataRef<
string,
'catalog.entity-filter-expression',
{
optional: true;
}
>;
inputs: {};
}>;
'entity-content:linkerd': ExtensionDefinition<{
kind: 'entity-content';
namespace: undefined;
name: undefined;
config: {
path: string | undefined;
title: string | undefined;
filter: string | undefined;
};
configInput: {
filter?: string | undefined;
title?: string | undefined;
path?: string | undefined;
};
output:
| ConfigurableExtensionDataRef<JSX_2.Element, 'core.reactElement', {}>
| ConfigurableExtensionDataRef<string, 'core.routing.path', {}>
| ConfigurableExtensionDataRef<
RouteRef<AnyRouteRefParams>,
'core.routing.ref',
{
optional: true;
}
>
| ConfigurableExtensionDataRef<
string,
'catalog.entity-content-title',
{}
>
| ConfigurableExtensionDataRef<
(entity: Entity) => boolean,
'catalog.entity-filter-function',
{
optional: true;
}
>
| ConfigurableExtensionDataRef<
string,
'catalog.entity-filter-expression',
{
optional: true;
}
>;
inputs: {};
}>;
}
>;
export default plugin;

// (No @packageDocumentation comment for this package)
```
25 changes: 20 additions & 5 deletions workspaces/linkerd/plugins/linkerd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
"types": "src/index.ts",
"license": "Apache-2.0",
"publishConfig": {
"access": "public",
"main": "dist/index.esm.js",
"types": "dist/index.d.ts"
"access": "public"
},
"repository": {
"type": "git",
Expand All @@ -22,6 +20,21 @@
"@backstage-community/plugin-linkerd-backend"
]
},
"exports": {
".": "./src/index.ts",
"./alpha": "./src/alpha/index.ts",
"./package.json": "./package.json"
},
"typesVersions": {
"*": {
"alpha": [
"src/alpha/index.ts"
],
"package.json": [
"package.json"
]
}
},
"sideEffects": false,
"scripts": {
"start": "backstage-cli package start",
Expand All @@ -36,7 +49,8 @@
"@backstage/catalog-model": "^1.7.0",
"@backstage/core-plugin-api": "^1.9.4",
"@backstage/errors": "^1.2.4",
"@backstage/plugin-catalog-react": "^1.13.0",
"@backstage/frontend-plugin-api": "^0.8.0",
"@backstage/plugin-catalog-react": "^1.13.1",
"@backstage/theme": "^0.5.7",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
Expand All @@ -46,12 +60,13 @@
"reactflow": "^11.11.0"
},
"peerDependencies": {
"@backstage/plugin-kubernetes": "^0.11.15",
"react": "^16.13.1 || ^17.0.0 || ^18.0.0"
},
"devDependencies": {
"@backstage/cli": "^0.27.1",
"@backstage/core-app-api": "^1.15.0",
"@backstage/dev-utils": "^1.1.0",
"@backstage/dev-utils": "^1.1.1",
"@backstage/test-utils": "^1.6.0",
"@testing-library/jest-dom": "^6.0.0",
"@testing-library/react": "^14.0.0",
Expand Down
34 changes: 34 additions & 0 deletions workspaces/linkerd/plugins/linkerd/src/alpha/api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* 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.
* 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 {
ApiBlueprint,
createApiFactory,
discoveryApiRef,
fetchApiRef,
} from '@backstage/frontend-plugin-api';
import { linkerdPluginRef } from '../plugin';
import { LinkerdClient } from '../api/client';

export const linkerdApi = ApiBlueprint.make({
params: {
factory: createApiFactory({
api: linkerdPluginRef,
deps: { discoveryApi: discoveryApiRef, fetchApi: fetchApiRef },
factory: ({ discoveryApi, fetchApi }) =>
new LinkerdClient({ discoveryApi, fetchApi }),
}),
},
});
53 changes: 53 additions & 0 deletions workspaces/linkerd/plugins/linkerd/src/alpha/extensions.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* 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.
* 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 {
EntityCardBlueprint,
EntityContentBlueprint,
} from '@backstage/plugin-catalog-react/alpha';
import { isKubernetesAvailable } from '@backstage/plugin-kubernetes';

export const IsMeshedEntityCard = EntityCardBlueprint.make({
params: {
loader: async () => {
const m = await import('../components/IsMeshedBanner');
return <m.IsMeshedBanner />;
},
filter: isKubernetesAvailable,
},
});

export const EdgesTableEntityCard = EntityCardBlueprint.make({
params: {
loader: async () => {
const m = await import('../components/EdgesTable');
return <m.EdgesTable />;
},
filter: isKubernetesAvailable,
},
});

export const LinkerdEntityContent = EntityContentBlueprint.make({
params: {
defaultPath: '/linkerd',
defaultTitle: 'Linkerd',
filter: isKubernetesAvailable,
loader: async () => {
const m = await import('../components/DependenciesCard');
return <m.DependenciesCard />;
},
},
});
16 changes: 16 additions & 0 deletions workspaces/linkerd/plugins/linkerd/src/alpha/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* 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.
* 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 as default } from './plugin';
36 changes: 36 additions & 0 deletions workspaces/linkerd/plugins/linkerd/src/alpha/plugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* 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.
* 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 { createFrontendPlugin } from '@backstage/frontend-plugin-api';
import {
IsMeshedEntityCard,
EdgesTableEntityCard,
LinkerdEntityContent,
} from './extensions';
import { linkerdApi } from './api';

/**
* @alpha
* The Linkerd plugin with support for new frontend system
*/
export const plugin = createFrontendPlugin({
id: 'linkerd',
extensions: [
linkerdApi,
IsMeshedEntityCard,
EdgesTableEntityCard,
LinkerdEntityContent,
],
});
Loading
Loading