@backstage/cli 0.36.0-next.2 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +95 -0
- package/config/eslint-factory.js +1 -0
- package/config/getJestEnvironment.js +7 -29
- package/config/jest-environment-jsdom/index.js +9 -43
- package/config/jest.js +7 -401
- package/config/jestCacheResultProcessor.cjs +10 -6
- package/config/jestCachingModuleLoader.js +11 -19
- package/config/jestFileTransform.js +11 -28
- package/config/jestRejectNetworkRequests.js +10 -53
- package/config/jestSucraseTransform.js +10 -70
- package/config/jestSwcTransform.js +10 -27
- package/config/jestYamlTransform.js +11 -24
- package/config/nodeTransform.cjs +10 -70
- package/config/nodeTransformHooks.mjs +4 -278
- package/config/webpack-public-path.js +10 -14
- package/dist/cli-internal/src/InternalCliModule.cjs.js +11 -0
- package/dist/cli-internal/src/InternalCommandNode.cjs.js +25 -0
- package/dist/cli-internal/src/knownPluginPackages.cjs.js +40 -0
- package/dist/index.cjs.js +21 -11
- package/dist/wiring/CliInitializer.cjs.js +61 -30
- package/dist/wiring/CommandGraph.cjs.js +81 -23
- package/dist/wiring/discoverCliModules.cjs.js +44 -0
- package/package.json +27 -160
- package/dist/modules/auth/commands/list.cjs.js +0 -23
- package/dist/modules/auth/commands/login.cjs.js +0 -316
- package/dist/modules/auth/commands/logout.cjs.js +0 -55
- package/dist/modules/auth/commands/printToken.cjs.js +0 -41
- package/dist/modules/auth/commands/select.cjs.js +0 -32
- package/dist/modules/auth/commands/show.cjs.js +0 -59
- package/dist/modules/auth/index.cjs.js +0 -44
- package/dist/modules/auth/lib/auth.cjs.js +0 -60
- package/dist/modules/auth/lib/http.cjs.js +0 -26
- package/dist/modules/auth/lib/localServer.cjs.js +0 -80
- package/dist/modules/auth/lib/pkce.cjs.js +0 -23
- package/dist/modules/auth/lib/prompt.cjs.js +0 -44
- package/dist/modules/auth/lib/secretStore.cjs.js +0 -81
- package/dist/modules/auth/lib/storage.cjs.js +0 -152
- package/dist/modules/build/commands/buildWorkspace.cjs.js +0 -53
- package/dist/modules/build/commands/package/build/command.cjs.js +0 -136
- package/dist/modules/build/commands/package/build/index.cjs.js +0 -10
- package/dist/modules/build/commands/package/clean.cjs.js +0 -21
- package/dist/modules/build/commands/package/postpack.cjs.js +0 -15
- package/dist/modules/build/commands/package/prepack.cjs.js +0 -29
- package/dist/modules/build/commands/package/start/command.cjs.js +0 -80
- package/dist/modules/build/commands/package/start/index.cjs.js +0 -10
- package/dist/modules/build/commands/package/start/resolveLinkedWorkspace.cjs.js +0 -34
- package/dist/modules/build/commands/package/start/startBackend.cjs.js +0 -46
- package/dist/modules/build/commands/package/start/startFrontend.cjs.js +0 -50
- package/dist/modules/build/commands/package/start/startPackage.cjs.js +0 -53
- package/dist/modules/build/commands/repo/build.cjs.js +0 -149
- package/dist/modules/build/commands/repo/clean.cjs.js +0 -41
- package/dist/modules/build/commands/repo/start.cjs.js +0 -199
- package/dist/modules/build/index.cjs.js +0 -68
- package/dist/modules/build/lib/buildBackend.cjs.js +0 -81
- package/dist/modules/build/lib/buildFrontend.cjs.js +0 -50
- package/dist/modules/build/lib/builder/config.cjs.js +0 -257
- package/dist/modules/build/lib/builder/packager.cjs.js +0 -131
- package/dist/modules/build/lib/builder/plugins.cjs.js +0 -125
- package/dist/modules/build/lib/builder/types.cjs.js +0 -10
- package/dist/modules/build/lib/bundler/ConfigInjectingHtmlWebpackPlugin.cjs.js +0 -43
- package/dist/modules/build/lib/bundler/bundle.cjs.js +0 -189
- package/dist/modules/build/lib/bundler/config.cjs.js +0 -308
- package/dist/modules/build/lib/bundler/hasReactDomClient.cjs.js +0 -17
- package/dist/modules/build/lib/bundler/linkWorkspaces.cjs.js +0 -34
- package/dist/modules/build/lib/bundler/moduleFederation.cjs.js +0 -135
- package/dist/modules/build/lib/bundler/optimization.cjs.js +0 -68
- package/dist/modules/build/lib/bundler/packageDetection.cjs.js +0 -124
- package/dist/modules/build/lib/bundler/paths.cjs.js +0 -62
- package/dist/modules/build/lib/bundler/server.cjs.js +0 -231
- package/dist/modules/build/lib/bundler/transforms.cjs.js +0 -145
- package/dist/modules/build/lib/config.cjs.js +0 -94
- package/dist/modules/build/lib/entryPoints.cjs.js +0 -49
- package/dist/modules/build/lib/ipc/IpcServer.cjs.js +0 -60
- package/dist/modules/build/lib/ipc/ServerDataStore.cjs.js +0 -36
- package/dist/modules/build/lib/optionsParser.cjs.js +0 -22
- package/dist/modules/build/lib/packager/createDistWorkspace.cjs.js +0 -235
- package/dist/modules/build/lib/packager/productionPack.cjs.js +0 -160
- package/dist/modules/build/lib/publishing.cjs.js +0 -40
- package/dist/modules/build/lib/role.cjs.js +0 -24
- package/dist/modules/build/lib/runner/runBackend.cjs.js +0 -136
- package/dist/modules/build/lib/typeDistProject.cjs.js +0 -89
- package/dist/modules/build/lib/urls.cjs.js +0 -13
- package/dist/modules/config/commands/docs.cjs.js +0 -63
- package/dist/modules/config/commands/print.cjs.js +0 -81
- package/dist/modules/config/commands/schema.cjs.js +0 -56
- package/dist/modules/config/commands/validate.cjs.js +0 -50
- package/dist/modules/config/index.cjs.js +0 -51
- package/dist/modules/config/lib/config.cjs.js +0 -94
- package/dist/modules/create-github-app/commands/create-github-app/GithubCreateAppServer.cjs.js +0 -127
- package/dist/modules/create-github-app/commands/create-github-app/index.cjs.js +0 -126
- package/dist/modules/create-github-app/index.cjs.js +0 -19
- package/dist/modules/info/commands/info.cjs.js +0 -182
- package/dist/modules/info/index.cjs.js +0 -19
- package/dist/modules/lint/commands/package/lint.cjs.js +0 -78
- package/dist/modules/lint/commands/repo/lint.cjs.js +0 -282
- package/dist/modules/lint/index.cjs.js +0 -24
- package/dist/modules/lint/lib/optionsParser.cjs.js +0 -22
- package/dist/modules/maintenance/commands/repo/fix.cjs.js +0 -426
- package/dist/modules/maintenance/commands/repo/list-deprecations.cjs.js +0 -90
- package/dist/modules/maintenance/index.cjs.js +0 -24
- package/dist/modules/migrate/commands/packageExports.cjs.js +0 -15
- package/dist/modules/migrate/commands/packageLintConfigs.cjs.js +0 -77
- package/dist/modules/migrate/commands/packageRole.cjs.js +0 -57
- package/dist/modules/migrate/commands/packageScripts.cjs.js +0 -87
- package/dist/modules/migrate/commands/reactRouterDeps.cjs.js +0 -51
- package/dist/modules/migrate/commands/versions/bump.cjs.js +0 -403
- package/dist/modules/migrate/commands/versions/migrate.cjs.js +0 -133
- package/dist/modules/migrate/index.cjs.js +0 -59
- package/dist/modules/migrate/lib/utils.cjs.js +0 -44
- package/dist/modules/migrate/lib/versioning/packages.cjs.js +0 -71
- package/dist/modules/migrate/lib/versioning/yarn.cjs.js +0 -28
- package/dist/modules/new/commands/new.cjs.js +0 -115
- package/dist/modules/new/index.cjs.js +0 -40
- package/dist/modules/new/lib/codeowners/codeowners.cjs.js +0 -92
- package/dist/modules/new/lib/createNewPackage.cjs.js +0 -32
- package/dist/modules/new/lib/defaultTemplates.cjs.js +0 -17
- package/dist/modules/new/lib/execution/PortableTemplater.cjs.js +0 -89
- package/dist/modules/new/lib/execution/executePortableTemplate.cjs.js +0 -66
- package/dist/modules/new/lib/execution/installNewPackage.cjs.js +0 -127
- package/dist/modules/new/lib/execution/writeTemplateContents.cjs.js +0 -116
- package/dist/modules/new/lib/preparation/collectPortableTemplateInput.cjs.js +0 -157
- package/dist/modules/new/lib/preparation/loadPortableTemplate.cjs.js +0 -81
- package/dist/modules/new/lib/preparation/loadPortableTemplateConfig.cjs.js +0 -132
- package/dist/modules/new/lib/preparation/resolvePackageParams.cjs.js +0 -40
- package/dist/modules/new/lib/preparation/selectTemplateInteractively.cjs.js +0 -38
- package/dist/modules/new/lib/tasks.cjs.js +0 -51
- package/dist/modules/new/lib/types.cjs.js +0 -19
- package/dist/modules/new/lib/version.cjs.js +0 -91
- package/dist/modules/test/commands/package/test.cjs.js +0 -59
- package/dist/modules/test/commands/repo/test.cjs.js +0 -299
- package/dist/modules/test/index.cjs.js +0 -24
- package/dist/modules/translations/commands/export.cjs.js +0 -128
- package/dist/modules/translations/commands/import.cjs.js +0 -165
- package/dist/modules/translations/index.cjs.js +0 -24
- package/dist/modules/translations/lib/discoverPackages.cjs.js +0 -121
- package/dist/modules/translations/lib/extractTranslations.cjs.js +0 -71
- package/dist/modules/translations/lib/messageFilePath.cjs.js +0 -43
- package/dist/packages/backend-defaults/package.json.cjs.js +0 -6
- package/dist/packages/backend-plugin-api/package.json.cjs.js +0 -6
- package/dist/packages/backend-test-utils/package.json.cjs.js +0 -6
- package/dist/packages/catalog-client/package.json.cjs.js +0 -6
- package/dist/packages/cli/package.json.cjs.js +0 -159
- package/dist/packages/config/package.json.cjs.js +0 -6
- package/dist/packages/core-app-api/package.json.cjs.js +0 -6
- package/dist/packages/core-components/package.json.cjs.js +0 -6
- package/dist/packages/core-plugin-api/package.json.cjs.js +0 -6
- package/dist/packages/dev-utils/package.json.cjs.js +0 -6
- package/dist/packages/errors/package.json.cjs.js +0 -6
- package/dist/packages/frontend-defaults/package.json.cjs.js +0 -6
- package/dist/packages/frontend-plugin-api/package.json.cjs.js +0 -6
- package/dist/packages/frontend-plugin-api/src/routing/describeParentCallSite.cjs.js +0 -26
- package/dist/packages/frontend-test-utils/package.json.cjs.js +0 -6
- package/dist/packages/test-utils/package.json.cjs.js +0 -6
- package/dist/packages/theme/package.json.cjs.js +0 -6
- package/dist/packages/types/package.json.cjs.js +0 -6
- package/dist/plugins/auth-backend/package.json.cjs.js +0 -6
- package/dist/plugins/auth-backend-module-guest-provider/package.json.cjs.js +0 -6
- package/dist/plugins/catalog-node/package.json.cjs.js +0 -6
- package/dist/plugins/scaffolder-node/package.json.cjs.js +0 -6
- package/dist/plugins/scaffolder-node-test-utils/package.json.cjs.js +0 -6
- package/dist/wiring/CommandRegistry.cjs.js +0 -14
- package/dist/wiring/factory.cjs.js +0 -15
- package/dist/wiring/types.cjs.js +0 -11
- package/templates/backend-plugin/.eslintrc.js.hbs +0 -1
- package/templates/backend-plugin/README.md.hbs +0 -28
- package/templates/backend-plugin/dev/index.ts.hbs +0 -60
- package/templates/backend-plugin/package.json.hbs +0 -44
- package/templates/backend-plugin/portable-template.yaml +0 -5
- package/templates/backend-plugin/src/index.ts.hbs +0 -1
- package/templates/backend-plugin/src/plugin.test.ts.hbs +0 -129
- package/templates/backend-plugin/src/plugin.ts.hbs +0 -32
- package/templates/backend-plugin/src/router.test.ts +0 -67
- package/templates/backend-plugin/src/router.ts +0 -51
- package/templates/backend-plugin/src/services/TodoListService.ts +0 -155
- package/templates/backend-plugin/src/setupTests.ts +0 -1
- package/templates/backend-plugin-module/.eslintrc.js.hbs +0 -1
- package/templates/backend-plugin-module/README.md.hbs +0 -5
- package/templates/backend-plugin-module/package.json.hbs +0 -34
- package/templates/backend-plugin-module/portable-template.yaml +0 -5
- package/templates/backend-plugin-module/src/index.ts.hbs +0 -8
- package/templates/backend-plugin-module/src/module.ts.hbs +0 -17
- package/templates/catalog-provider-module/.eslintrc.js.hbs +0 -1
- package/templates/catalog-provider-module/README.md.hbs +0 -5
- package/templates/catalog-provider-module/config.d.ts.hbs +0 -34
- package/templates/catalog-provider-module/package.json.hbs +0 -36
- package/templates/catalog-provider-module/portable-template.yaml +0 -9
- package/templates/catalog-provider-module/src/index.ts.hbs +0 -8
- package/templates/catalog-provider-module/src/module.ts.hbs +0 -29
- package/templates/catalog-provider-module/src/provider/readProviderConfigs.ts.hbs +0 -78
- package/templates/catalog-provider-module/src/provider/{{providerClass}}.test.ts.hbs +0 -18
- package/templates/catalog-provider-module/src/provider/{{providerClass}}.ts.hbs +0 -109
- package/templates/frontend-plugin/.eslintrc.js.hbs +0 -1
- package/templates/frontend-plugin/README.md.hbs +0 -13
- package/templates/frontend-plugin/dev/index.tsx.hbs +0 -11
- package/templates/frontend-plugin/package.json.hbs +0 -54
- package/templates/frontend-plugin/portable-template.yaml +0 -6
- package/templates/frontend-plugin/src/components/ExampleComponent/ExampleComponent.test.tsx.hbs +0 -28
- package/templates/frontend-plugin/src/components/ExampleComponent/ExampleComponent.tsx.hbs +0 -37
- package/templates/frontend-plugin/src/components/ExampleComponent/index.ts +0 -1
- package/templates/frontend-plugin/src/components/ExampleFetchComponent/ExampleFetchComponent.test.tsx.hbs +0 -19
- package/templates/frontend-plugin/src/components/ExampleFetchComponent/ExampleFetchComponent.tsx.hbs +0 -308
- package/templates/frontend-plugin/src/components/ExampleFetchComponent/index.ts +0 -1
- package/templates/frontend-plugin/src/index.ts.hbs +0 -1
- package/templates/frontend-plugin/src/plugin.test.ts.hbs +0 -7
- package/templates/frontend-plugin/src/plugin.ts.hbs +0 -22
- package/templates/frontend-plugin/src/routes.ts.hbs +0 -5
- package/templates/frontend-plugin/src/setupTests.ts +0 -1
- package/templates/new-frontend-plugin/.eslintrc.js.hbs +0 -1
- package/templates/new-frontend-plugin/README.md.hbs +0 -20
- package/templates/new-frontend-plugin/dev/index.tsx +0 -10
- package/templates/new-frontend-plugin/package.json.hbs +0 -49
- package/templates/new-frontend-plugin/portable-template.yaml +0 -5
- package/templates/new-frontend-plugin/src/components/ExampleComponent/ExampleComponent.test.tsx.hbs +0 -28
- package/templates/new-frontend-plugin/src/components/ExampleComponent/ExampleComponent.tsx.hbs +0 -37
- package/templates/new-frontend-plugin/src/components/ExampleComponent/index.ts +0 -1
- package/templates/new-frontend-plugin/src/components/ExampleFetchComponent/ExampleFetchComponent.test.tsx.hbs +0 -19
- package/templates/new-frontend-plugin/src/components/ExampleFetchComponent/ExampleFetchComponent.tsx.hbs +0 -308
- package/templates/new-frontend-plugin/src/components/ExampleFetchComponent/index.ts +0 -1
- package/templates/new-frontend-plugin/src/index.ts.hbs +0 -1
- package/templates/new-frontend-plugin/src/plugin.test.ts.hbs +0 -7
- package/templates/new-frontend-plugin/src/plugin.tsx.hbs +0 -25
- package/templates/new-frontend-plugin/src/routes.ts +0 -3
- package/templates/new-frontend-plugin/src/setupTests.ts +0 -1
- package/templates/new-frontend-plugin-module/.eslintrc.js.hbs +0 -1
- package/templates/new-frontend-plugin-module/README.md.hbs +0 -5
- package/templates/new-frontend-plugin-module/package.json.hbs +0 -35
- package/templates/new-frontend-plugin-module/portable-template.yaml +0 -5
- package/templates/new-frontend-plugin-module/src/index.ts.hbs +0 -1
- package/templates/new-frontend-plugin-module/src/module.tsx.hbs +0 -8
- package/templates/new-frontend-plugin-module/src/setupTests.ts +0 -1
- package/templates/node-library/.eslintrc.js.hbs +0 -1
- package/templates/node-library/README.md.hbs +0 -12
- package/templates/node-library/package.json.hbs +0 -29
- package/templates/node-library/portable-template.yaml +0 -3
- package/templates/node-library/src/index.ts.hbs +0 -1
- package/templates/node-library/src/setupTests.ts +0 -1
- package/templates/plugin-common-library/.eslintrc.js.hbs +0 -1
- package/templates/plugin-common-library/README.md.hbs +0 -5
- package/templates/plugin-common-library/package.json.hbs +0 -31
- package/templates/plugin-common-library/portable-template.yaml +0 -3
- package/templates/plugin-common-library/src/index.ts.hbs +0 -19
- package/templates/plugin-common-library/src/setupTests.ts +0 -1
- package/templates/plugin-node-library/.eslintrc.js.hbs +0 -1
- package/templates/plugin-node-library/README.md.hbs +0 -5
- package/templates/plugin-node-library/package.json.hbs +0 -30
- package/templates/plugin-node-library/portable-template.yaml +0 -3
- package/templates/plugin-node-library/src/index.ts.hbs +0 -18
- package/templates/plugin-node-library/src/setupTests.ts +0 -1
- package/templates/plugin-web-library/.eslintrc.js.hbs +0 -1
- package/templates/plugin-web-library/README.md.hbs +0 -5
- package/templates/plugin-web-library/package.json.hbs +0 -42
- package/templates/plugin-web-library/portable-template.yaml +0 -3
- package/templates/plugin-web-library/src/components/ExampleComponent/ExampleComponent.test.tsx +0 -17
- package/templates/plugin-web-library/src/components/ExampleComponent/ExampleComponent.tsx +0 -28
- package/templates/plugin-web-library/src/components/ExampleComponent/index.ts +0 -2
- package/templates/plugin-web-library/src/components/index.ts +0 -5
- package/templates/plugin-web-library/src/hooks/index.ts +0 -5
- package/templates/plugin-web-library/src/hooks/useExample/index.ts +0 -1
- package/templates/plugin-web-library/src/hooks/useExample/useExample.ts +0 -15
- package/templates/plugin-web-library/src/index.ts.hbs +0 -12
- package/templates/plugin-web-library/src/setupTests.ts +0 -1
- package/templates/scaffolder-backend-module/.eslintrc.js.hbs +0 -1
- package/templates/scaffolder-backend-module/README.md.hbs +0 -5
- package/templates/scaffolder-backend-module/package.json.hbs +0 -36
- package/templates/scaffolder-backend-module/portable-template.yaml +0 -6
- package/templates/scaffolder-backend-module/src/actions/example.test.ts +0 -24
- package/templates/scaffolder-backend-module/src/actions/example.ts +0 -39
- package/templates/scaffolder-backend-module/src/index.ts.hbs +0 -8
- package/templates/scaffolder-backend-module/src/module.ts +0 -21
- package/templates/web-library/.eslintrc.js.hbs +0 -1
- package/templates/web-library/README.md.hbs +0 -12
- package/templates/web-library/package.json.hbs +0 -30
- package/templates/web-library/portable-template.yaml +0 -3
- package/templates/web-library/src/index.ts.hbs +0 -1
- package/templates/web-library/src/setupTests.ts +0 -1
- /package/dist/{packages/opaque-internal → opaque-internal}/src/OpaqueType.cjs.js +0 -0
package/templates/frontend-plugin/src/components/ExampleComponent/ExampleComponent.test.tsx.hbs
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { ExampleComponent } from './ExampleComponent';
|
|
2
|
-
import { rest } from 'msw';
|
|
3
|
-
import { setupServer } from 'msw/node';
|
|
4
|
-
import { screen } from '@testing-library/react';
|
|
5
|
-
import {
|
|
6
|
-
registerMswTestHooks,
|
|
7
|
-
renderInTestApp,
|
|
8
|
-
} from '@backstage/test-utils';
|
|
9
|
-
|
|
10
|
-
describe('ExampleComponent', () => {
|
|
11
|
-
const server = setupServer();
|
|
12
|
-
// Enable sane handlers for network requests
|
|
13
|
-
registerMswTestHooks(server);
|
|
14
|
-
|
|
15
|
-
// setup mock response
|
|
16
|
-
beforeEach(() => {
|
|
17
|
-
server.use(
|
|
18
|
-
rest.get('/*', (_, res, ctx) => res(ctx.status(200), ctx.json({}))),
|
|
19
|
-
);
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('should render', async () => {
|
|
23
|
-
await renderInTestApp(<ExampleComponent />);
|
|
24
|
-
expect(
|
|
25
|
-
screen.getByText('Welcome to {{pluginId}}!'),
|
|
26
|
-
).toBeInTheDocument();
|
|
27
|
-
});
|
|
28
|
-
});
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { Typography, Grid } from '@material-ui/core';
|
|
2
|
-
import {
|
|
3
|
-
InfoCard,
|
|
4
|
-
Header,
|
|
5
|
-
Page,
|
|
6
|
-
Content,
|
|
7
|
-
ContentHeader,
|
|
8
|
-
HeaderLabel,
|
|
9
|
-
SupportButton,
|
|
10
|
-
} from '@backstage/core-components';
|
|
11
|
-
import { ExampleFetchComponent } from '../ExampleFetchComponent';
|
|
12
|
-
|
|
13
|
-
export const ExampleComponent = () => (
|
|
14
|
-
<Page themeId="tool">
|
|
15
|
-
<Header title="Welcome to {{pluginId}}!" subtitle="Optional subtitle">
|
|
16
|
-
<HeaderLabel label="Owner" value="Team X" />
|
|
17
|
-
<HeaderLabel label="Lifecycle" value="Alpha" />
|
|
18
|
-
</Header>
|
|
19
|
-
<Content>
|
|
20
|
-
<ContentHeader title="Plugin title">
|
|
21
|
-
<SupportButton>A description of your plugin goes here.</SupportButton>
|
|
22
|
-
</ContentHeader>
|
|
23
|
-
<Grid container spacing={3} direction="column">
|
|
24
|
-
<Grid item>
|
|
25
|
-
<InfoCard title="Information card">
|
|
26
|
-
<Typography variant="body1">
|
|
27
|
-
All content should be wrapped in a card like this.
|
|
28
|
-
</Typography>
|
|
29
|
-
</InfoCard>
|
|
30
|
-
</Grid>
|
|
31
|
-
<Grid item>
|
|
32
|
-
<ExampleFetchComponent />
|
|
33
|
-
</Grid>
|
|
34
|
-
</Grid>
|
|
35
|
-
</Content>
|
|
36
|
-
</Page>
|
|
37
|
-
);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ExampleComponent } from './ExampleComponent';
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { renderInTestApp } from '@backstage/test-utils';
|
|
2
|
-
import { ExampleFetchComponent } from './ExampleFetchComponent';
|
|
3
|
-
|
|
4
|
-
describe('ExampleFetchComponent', () => {
|
|
5
|
-
it('renders the user table', async () => {
|
|
6
|
-
const { getAllByText, getByAltText, getByText, findByRole } =
|
|
7
|
-
await renderInTestApp(<ExampleFetchComponent />);
|
|
8
|
-
|
|
9
|
-
// Wait for the table to render
|
|
10
|
-
const table = await findByRole('table');
|
|
11
|
-
const nationality = getAllByText('GB');
|
|
12
|
-
// Assert that the table contains the expected user data
|
|
13
|
-
expect(table).toBeInTheDocument();
|
|
14
|
-
expect(getByAltText('Carolyn')).toBeInTheDocument();
|
|
15
|
-
expect(getByText('Carolyn Moore')).toBeInTheDocument();
|
|
16
|
-
expect(getByText('carolyn.moore@example.com')).toBeInTheDocument();
|
|
17
|
-
expect(nationality[0]).toBeInTheDocument();
|
|
18
|
-
});
|
|
19
|
-
});
|
package/templates/frontend-plugin/src/components/ExampleFetchComponent/ExampleFetchComponent.tsx.hbs
DELETED
|
@@ -1,308 +0,0 @@
|
|
|
1
|
-
import { makeStyles } from '@material-ui/core/styles';
|
|
2
|
-
import {
|
|
3
|
-
Table,
|
|
4
|
-
TableColumn,
|
|
5
|
-
Progress,
|
|
6
|
-
ResponseErrorPanel,
|
|
7
|
-
} from '@backstage/core-components';
|
|
8
|
-
import useAsync from 'react-use/lib/useAsync';
|
|
9
|
-
|
|
10
|
-
export const exampleUsers = {
|
|
11
|
-
results: [
|
|
12
|
-
{
|
|
13
|
-
gender: 'female',
|
|
14
|
-
name: {
|
|
15
|
-
title: 'Miss',
|
|
16
|
-
first: 'Carolyn',
|
|
17
|
-
last: 'Moore',
|
|
18
|
-
},
|
|
19
|
-
email: 'carolyn.moore@example.com',
|
|
20
|
-
picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Carolyn',
|
|
21
|
-
nat: 'GB',
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
gender: 'female',
|
|
25
|
-
name: {
|
|
26
|
-
title: 'Ms',
|
|
27
|
-
first: 'Esma',
|
|
28
|
-
last: 'Berberoğlu',
|
|
29
|
-
},
|
|
30
|
-
email: 'esma.berberoglu@example.com',
|
|
31
|
-
picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Esma',
|
|
32
|
-
nat: 'TR',
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
gender: 'female',
|
|
36
|
-
name: {
|
|
37
|
-
title: 'Ms',
|
|
38
|
-
first: 'Isabella',
|
|
39
|
-
last: 'Rhodes',
|
|
40
|
-
},
|
|
41
|
-
email: 'isabella.rhodes@example.com',
|
|
42
|
-
picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Isabella',
|
|
43
|
-
nat: 'GB',
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
gender: 'male',
|
|
47
|
-
name: {
|
|
48
|
-
title: 'Mr',
|
|
49
|
-
first: 'Derrick',
|
|
50
|
-
last: 'Carter',
|
|
51
|
-
},
|
|
52
|
-
email: 'derrick.carter@example.com',
|
|
53
|
-
picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Derrick',
|
|
54
|
-
nat: 'IE',
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
gender: 'female',
|
|
58
|
-
name: {
|
|
59
|
-
title: 'Miss',
|
|
60
|
-
first: 'Mattie',
|
|
61
|
-
last: 'Lambert',
|
|
62
|
-
},
|
|
63
|
-
email: 'mattie.lambert@example.com',
|
|
64
|
-
picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Mattie',
|
|
65
|
-
nat: 'AU',
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
gender: 'male',
|
|
69
|
-
name: {
|
|
70
|
-
title: 'Mr',
|
|
71
|
-
first: 'Mijat',
|
|
72
|
-
last: 'Rakić',
|
|
73
|
-
},
|
|
74
|
-
email: 'mijat.rakic@example.com',
|
|
75
|
-
picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Mijat',
|
|
76
|
-
nat: 'RS',
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
gender: 'male',
|
|
80
|
-
name: {
|
|
81
|
-
title: 'Mr',
|
|
82
|
-
first: 'Javier',
|
|
83
|
-
last: 'Reid',
|
|
84
|
-
},
|
|
85
|
-
email: 'javier.reid@example.com',
|
|
86
|
-
picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Javier',
|
|
87
|
-
nat: 'US',
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
gender: 'female',
|
|
91
|
-
name: {
|
|
92
|
-
title: 'Ms',
|
|
93
|
-
first: 'Isabella',
|
|
94
|
-
last: 'Li',
|
|
95
|
-
},
|
|
96
|
-
email: 'isabella.li@example.com',
|
|
97
|
-
picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Isabella',
|
|
98
|
-
nat: 'CA',
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
gender: 'female',
|
|
102
|
-
name: {
|
|
103
|
-
title: 'Mrs',
|
|
104
|
-
first: 'Stephanie',
|
|
105
|
-
last: 'Garrett',
|
|
106
|
-
},
|
|
107
|
-
email: 'stephanie.garrett@example.com',
|
|
108
|
-
picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Stephanie',
|
|
109
|
-
nat: 'AU',
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
gender: 'female',
|
|
113
|
-
name: {
|
|
114
|
-
title: 'Ms',
|
|
115
|
-
first: 'Antonia',
|
|
116
|
-
last: 'Núñez',
|
|
117
|
-
},
|
|
118
|
-
email: 'antonia.nunez@example.com',
|
|
119
|
-
picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Antonia',
|
|
120
|
-
nat: 'ES',
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
gender: 'male',
|
|
124
|
-
name: {
|
|
125
|
-
title: 'Mr',
|
|
126
|
-
first: 'Donald',
|
|
127
|
-
last: 'Young',
|
|
128
|
-
},
|
|
129
|
-
email: 'donald.young@example.com',
|
|
130
|
-
picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Donald',
|
|
131
|
-
nat: 'US',
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
gender: 'male',
|
|
135
|
-
name: {
|
|
136
|
-
title: 'Mr',
|
|
137
|
-
first: 'Iegor',
|
|
138
|
-
last: 'Holodovskiy',
|
|
139
|
-
},
|
|
140
|
-
email: 'iegor.holodovskiy@example.com',
|
|
141
|
-
picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Iegor',
|
|
142
|
-
nat: 'UA',
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
gender: 'female',
|
|
146
|
-
name: {
|
|
147
|
-
title: 'Madame',
|
|
148
|
-
first: 'Jessica',
|
|
149
|
-
last: 'David',
|
|
150
|
-
},
|
|
151
|
-
email: 'jessica.david@example.com',
|
|
152
|
-
picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Jessica',
|
|
153
|
-
nat: 'CH',
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
gender: 'female',
|
|
157
|
-
name: {
|
|
158
|
-
title: 'Ms',
|
|
159
|
-
first: 'Eve',
|
|
160
|
-
last: 'Martinez',
|
|
161
|
-
},
|
|
162
|
-
email: 'eve.martinez@example.com',
|
|
163
|
-
picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Eve',
|
|
164
|
-
nat: 'FR',
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
gender: 'male',
|
|
168
|
-
name: {
|
|
169
|
-
title: 'Mr',
|
|
170
|
-
first: 'Caleb',
|
|
171
|
-
last: 'Silva',
|
|
172
|
-
},
|
|
173
|
-
email: 'caleb.silva@example.com',
|
|
174
|
-
picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Caleb',
|
|
175
|
-
nat: 'US',
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
gender: 'female',
|
|
179
|
-
name: {
|
|
180
|
-
title: 'Miss',
|
|
181
|
-
first: 'Marcia',
|
|
182
|
-
last: 'Jenkins',
|
|
183
|
-
},
|
|
184
|
-
email: 'marcia.jenkins@example.com',
|
|
185
|
-
picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Marcia',
|
|
186
|
-
nat: 'US',
|
|
187
|
-
},
|
|
188
|
-
{
|
|
189
|
-
gender: 'female',
|
|
190
|
-
name: {
|
|
191
|
-
title: 'Mrs',
|
|
192
|
-
first: 'Mackenzie',
|
|
193
|
-
last: 'Jones',
|
|
194
|
-
},
|
|
195
|
-
email: 'mackenzie.jones@example.com',
|
|
196
|
-
picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Mackenzie',
|
|
197
|
-
nat: 'NZ',
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
gender: 'male',
|
|
201
|
-
name: {
|
|
202
|
-
title: 'Mr',
|
|
203
|
-
first: 'Jeremiah',
|
|
204
|
-
last: 'Gutierrez',
|
|
205
|
-
},
|
|
206
|
-
email: 'jeremiah.gutierrez@example.com',
|
|
207
|
-
picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Jeremiah',
|
|
208
|
-
nat: 'AU',
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
gender: 'female',
|
|
212
|
-
name: {
|
|
213
|
-
title: 'Ms',
|
|
214
|
-
first: 'Luciara',
|
|
215
|
-
last: 'Souza',
|
|
216
|
-
},
|
|
217
|
-
email: 'luciara.souza@example.com',
|
|
218
|
-
picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Luciara',
|
|
219
|
-
nat: 'BR',
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
gender: 'male',
|
|
223
|
-
name: {
|
|
224
|
-
title: 'Mr',
|
|
225
|
-
first: 'Valgi',
|
|
226
|
-
last: 'da Cunha',
|
|
227
|
-
},
|
|
228
|
-
email: 'valgi.dacunha@example.com',
|
|
229
|
-
picture: 'https://api.dicebear.com/6.x/open-peeps/svg?seed=Valgi',
|
|
230
|
-
nat: 'BR',
|
|
231
|
-
},
|
|
232
|
-
],
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
const useStyles = makeStyles({
|
|
236
|
-
avatar: {
|
|
237
|
-
height: 32,
|
|
238
|
-
width: 32,
|
|
239
|
-
borderRadius: '50%',
|
|
240
|
-
},
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
type User = {
|
|
244
|
-
gender: string; // "male"
|
|
245
|
-
name: {
|
|
246
|
-
title: string; // "Mr",
|
|
247
|
-
first: string; // "Duane",
|
|
248
|
-
last: string; // "Reed"
|
|
249
|
-
};
|
|
250
|
-
email: string; // "duane.reed@example.com"
|
|
251
|
-
picture: string; // "https://api.dicebear.com/6.x/open-peeps/svg?seed=Duane"
|
|
252
|
-
nat: string; // "AU"
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
type DenseTableProps = {
|
|
256
|
-
users: User[];
|
|
257
|
-
};
|
|
258
|
-
|
|
259
|
-
export const DenseTable = ({ users }: DenseTableProps) => {
|
|
260
|
-
const classes = useStyles();
|
|
261
|
-
|
|
262
|
-
const columns: TableColumn[] = [
|
|
263
|
-
{ title: 'Avatar', field: 'avatar' },
|
|
264
|
-
{ title: 'Name', field: 'name' },
|
|
265
|
-
{ title: 'Email', field: 'email' },
|
|
266
|
-
{ title: 'Nationality', field: 'nationality' },
|
|
267
|
-
];
|
|
268
|
-
|
|
269
|
-
const data = users.map(user => {
|
|
270
|
-
return {
|
|
271
|
-
avatar: (
|
|
272
|
-
<img
|
|
273
|
-
src={user.picture}
|
|
274
|
-
className={classes.avatar}
|
|
275
|
-
alt={user.name.first}
|
|
276
|
-
/>
|
|
277
|
-
),
|
|
278
|
-
name: `${user.name.first} ${user.name.last}`,
|
|
279
|
-
email: user.email,
|
|
280
|
-
nationality: user.nat,
|
|
281
|
-
};
|
|
282
|
-
});
|
|
283
|
-
|
|
284
|
-
return (
|
|
285
|
-
<Table
|
|
286
|
-
title="Example User List"
|
|
287
|
-
options=\{{ search: false, paging: false }}
|
|
288
|
-
columns={columns}
|
|
289
|
-
data={data}
|
|
290
|
-
/>
|
|
291
|
-
);
|
|
292
|
-
};
|
|
293
|
-
|
|
294
|
-
export const ExampleFetchComponent = () => {
|
|
295
|
-
|
|
296
|
-
const { value, loading, error } = useAsync(async (): Promise<User[]> => {
|
|
297
|
-
// Would use fetch in a real world example
|
|
298
|
-
return exampleUsers.results;
|
|
299
|
-
}, []);
|
|
300
|
-
|
|
301
|
-
if (loading) {
|
|
302
|
-
return <Progress />;
|
|
303
|
-
} else if (error) {
|
|
304
|
-
return <ResponseErrorPanel error={error} />;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
return <DenseTable users={value || []} />;
|
|
308
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ExampleFetchComponent } from './ExampleFetchComponent';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { {{ pluginVar }}, {{ extensionName }} } from './plugin';
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createPlugin,
|
|
3
|
-
createRoutableExtension,
|
|
4
|
-
} from '@backstage/core-plugin-api';
|
|
5
|
-
|
|
6
|
-
import { rootRouteRef } from './routes';
|
|
7
|
-
|
|
8
|
-
export const {{ pluginVar }} = createPlugin({
|
|
9
|
-
id: '{{pluginId}}',
|
|
10
|
-
routes: {
|
|
11
|
-
root: rootRouteRef,
|
|
12
|
-
},
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
export const {{ extensionName }} = {{ pluginVar }}.provide(
|
|
16
|
-
createRoutableExtension({
|
|
17
|
-
name: '{{ extensionName }}',
|
|
18
|
-
component: () =>
|
|
19
|
-
import('./components/ExampleComponent').then(m => m.ExampleComponent),
|
|
20
|
-
mountPoint: rootRouteRef,
|
|
21
|
-
}),
|
|
22
|
-
);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@testing-library/jest-dom';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname);
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# {{pluginId}}
|
|
2
|
-
|
|
3
|
-
Welcome to the {{pluginId}} plugin!
|
|
4
|
-
|
|
5
|
-
_This plugin was created through the Backstage CLI_
|
|
6
|
-
|
|
7
|
-
## Getting started
|
|
8
|
-
|
|
9
|
-
Your plugin has been added to the app in this repository, meaning you'll be able
|
|
10
|
-
to access it by running `yarn start` in the root directory, and then navigating
|
|
11
|
-
to [/{{pluginId}}](http://localhost:3000/{{pluginId}}).
|
|
12
|
-
|
|
13
|
-
This plugin is built with Backstage's [new frontend
|
|
14
|
-
system](https://backstage.io/docs/frontend-system/architecture/index), and you
|
|
15
|
-
can find more information about building plugins in the [plugin builder
|
|
16
|
-
documentation](https://backstage.io/docs/frontend-system/building-plugins/index).
|
|
17
|
-
|
|
18
|
-
You can also serve the plugin in isolation by running `yarn start` in the plugin directory.
|
|
19
|
-
This method of serving the plugin provides quicker iteration speed and a faster startup and hot reloads.
|
|
20
|
-
It is only meant for local development, and the setup for it can be found inside the [/dev](./dev) directory.
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "{{packageName}}",
|
|
3
|
-
"main": "src/index.ts",
|
|
4
|
-
"types": "src/index.ts",
|
|
5
|
-
"publishConfig": {
|
|
6
|
-
"access": "public",
|
|
7
|
-
"main": "dist/index.esm.js",
|
|
8
|
-
"types": "dist/index.d.ts"
|
|
9
|
-
},
|
|
10
|
-
"backstage": {
|
|
11
|
-
"role": "frontend-plugin",
|
|
12
|
-
"pluginId": "{{pluginId}}"
|
|
13
|
-
},
|
|
14
|
-
"sideEffects": false,
|
|
15
|
-
"scripts": {
|
|
16
|
-
"start": "backstage-cli package start",
|
|
17
|
-
"build": "backstage-cli package build",
|
|
18
|
-
"lint": "backstage-cli package lint",
|
|
19
|
-
"test": "backstage-cli package test",
|
|
20
|
-
"clean": "backstage-cli package clean",
|
|
21
|
-
"prepack": "backstage-cli package prepack",
|
|
22
|
-
"postpack": "backstage-cli package postpack"
|
|
23
|
-
},
|
|
24
|
-
"dependencies": {
|
|
25
|
-
"@backstage/core-components": "{{versionQuery '@backstage/core-components'}}",
|
|
26
|
-
"@backstage/frontend-plugin-api": "{{versionQuery '@backstage/frontend-plugin-api'}}",
|
|
27
|
-
"@backstage/theme": "{{versionQuery '@backstage/theme'}}",
|
|
28
|
-
"@material-ui/core": "{{versionQuery '@material-ui/core' '4.12.2'}}",
|
|
29
|
-
"@material-ui/icons": "{{versionQuery '@material-ui/icons' '4.9.1'}}",
|
|
30
|
-
"@material-ui/lab": "{{versionQuery '@material-ui/lab' '4.0.0-alpha.61'}}",
|
|
31
|
-
"react-use": "{{versionQuery 'react-use' '17.2.4'}}"
|
|
32
|
-
},
|
|
33
|
-
"peerDependencies": {
|
|
34
|
-
"react": "{{versionQuery 'react' '^16.13.1 || ^17.0.0 || ^18.0.0'}}"
|
|
35
|
-
},
|
|
36
|
-
"devDependencies": {
|
|
37
|
-
"@backstage/cli": "{{versionQuery '@backstage/cli'}}",
|
|
38
|
-
"@backstage/frontend-defaults": "{{versionQuery '@backstage/frontend-defaults'}}",
|
|
39
|
-
"@backstage/frontend-test-utils": "{{versionQuery '@backstage/frontend-test-utils'}}",
|
|
40
|
-
"@testing-library/jest-dom": "{{versionQuery '@testing-library/jest-dom' '6.0.0'}}",
|
|
41
|
-
"@testing-library/react": "{{versionQuery '@testing-library/react' '14.0.0'}}",
|
|
42
|
-
"@testing-library/user-event": "{{versionQuery '@testing-library/user-event' '14.0.0'}}",
|
|
43
|
-
"msw": "{{versionQuery 'msw' '1.0.0'}}",
|
|
44
|
-
"react": "{{versionQuery 'react' '^16.13.1 || ^17.0.0 || ^18.0.0'}}"
|
|
45
|
-
},
|
|
46
|
-
"files": [
|
|
47
|
-
"dist"
|
|
48
|
-
]
|
|
49
|
-
}
|
package/templates/new-frontend-plugin/src/components/ExampleComponent/ExampleComponent.test.tsx.hbs
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { ExampleComponent } from './ExampleComponent';
|
|
2
|
-
import { rest } from 'msw';
|
|
3
|
-
import { setupServer } from 'msw/node';
|
|
4
|
-
import { screen } from '@testing-library/react';
|
|
5
|
-
import {
|
|
6
|
-
registerMswTestHooks,
|
|
7
|
-
renderInTestApp,
|
|
8
|
-
} from '@backstage/frontend-test-utils';
|
|
9
|
-
|
|
10
|
-
describe('ExampleComponent', () => {
|
|
11
|
-
const server = setupServer();
|
|
12
|
-
// Enable sane handlers for network requests
|
|
13
|
-
registerMswTestHooks(server);
|
|
14
|
-
|
|
15
|
-
// setup mock response
|
|
16
|
-
beforeEach(() => {
|
|
17
|
-
server.use(
|
|
18
|
-
rest.get('/*', (_, res, ctx) => res(ctx.status(200), ctx.json({}))),
|
|
19
|
-
);
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('should render', async () => {
|
|
23
|
-
await renderInTestApp(<ExampleComponent />);
|
|
24
|
-
expect(
|
|
25
|
-
screen.getByText('Welcome to {{pluginId}}!'),
|
|
26
|
-
).toBeInTheDocument();
|
|
27
|
-
});
|
|
28
|
-
});
|
package/templates/new-frontend-plugin/src/components/ExampleComponent/ExampleComponent.tsx.hbs
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { Typography, Grid } from '@material-ui/core';
|
|
2
|
-
import {
|
|
3
|
-
InfoCard,
|
|
4
|
-
Header,
|
|
5
|
-
Page,
|
|
6
|
-
Content,
|
|
7
|
-
ContentHeader,
|
|
8
|
-
HeaderLabel,
|
|
9
|
-
SupportButton,
|
|
10
|
-
} from '@backstage/core-components';
|
|
11
|
-
import { ExampleFetchComponent } from '../ExampleFetchComponent';
|
|
12
|
-
|
|
13
|
-
export const ExampleComponent = () => (
|
|
14
|
-
<Page themeId="tool">
|
|
15
|
-
<Header title="Welcome to {{pluginId}}!" subtitle="Optional subtitle">
|
|
16
|
-
<HeaderLabel label="Owner" value="Team X" />
|
|
17
|
-
<HeaderLabel label="Lifecycle" value="Alpha" />
|
|
18
|
-
</Header>
|
|
19
|
-
<Content>
|
|
20
|
-
<ContentHeader title="Plugin title">
|
|
21
|
-
<SupportButton>A description of your plugin goes here.</SupportButton>
|
|
22
|
-
</ContentHeader>
|
|
23
|
-
<Grid container spacing={3} direction="column">
|
|
24
|
-
<Grid item>
|
|
25
|
-
<InfoCard title="Information card">
|
|
26
|
-
<Typography variant="body1">
|
|
27
|
-
All content should be wrapped in a card like this.
|
|
28
|
-
</Typography>
|
|
29
|
-
</InfoCard>
|
|
30
|
-
</Grid>
|
|
31
|
-
<Grid item>
|
|
32
|
-
<ExampleFetchComponent />
|
|
33
|
-
</Grid>
|
|
34
|
-
</Grid>
|
|
35
|
-
</Content>
|
|
36
|
-
</Page>
|
|
37
|
-
);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ExampleComponent } from './ExampleComponent';
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { renderInTestApp } from '@backstage/frontend-test-utils';
|
|
2
|
-
import { ExampleFetchComponent } from './ExampleFetchComponent';
|
|
3
|
-
|
|
4
|
-
describe('ExampleFetchComponent', () => {
|
|
5
|
-
it('renders the user table', async () => {
|
|
6
|
-
const { getAllByText, getByAltText, getByText, findByRole } =
|
|
7
|
-
await renderInTestApp(<ExampleFetchComponent />);
|
|
8
|
-
|
|
9
|
-
// Wait for the table to render
|
|
10
|
-
const table = await findByRole('table');
|
|
11
|
-
const nationality = getAllByText('GB');
|
|
12
|
-
// Assert that the table contains the expected user data
|
|
13
|
-
expect(table).toBeInTheDocument();
|
|
14
|
-
expect(getByAltText('Carolyn')).toBeInTheDocument();
|
|
15
|
-
expect(getByText('Carolyn Moore')).toBeInTheDocument();
|
|
16
|
-
expect(getByText('carolyn.moore@example.com')).toBeInTheDocument();
|
|
17
|
-
expect(nationality[0]).toBeInTheDocument();
|
|
18
|
-
});
|
|
19
|
-
});
|