From 77748284446866374f5404d7b93532743afd15b8 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 11 Sep 2024 16:20:05 +0000 Subject: [PATCH 1/5] fix(deps): update dependency @smithy/node-http-handler to v3 Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .changeset/renovate-7874fad.md | 5 +++ plugins/techdocs-node/package.json | 2 +- yarn.lock | 66 +----------------------------- 3 files changed, 8 insertions(+), 65 deletions(-) create mode 100644 .changeset/renovate-7874fad.md diff --git a/.changeset/renovate-7874fad.md b/.changeset/renovate-7874fad.md new file mode 100644 index 0000000000..b7ccd5fe95 --- /dev/null +++ b/.changeset/renovate-7874fad.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-techdocs-node': patch +--- + +Updated dependency `@smithy/node-http-handler` to `^3.0.0`. diff --git a/plugins/techdocs-node/package.json b/plugins/techdocs-node/package.json index 079beba786..cf1253a17d 100644 --- a/plugins/techdocs-node/package.json +++ b/plugins/techdocs-node/package.json @@ -62,7 +62,7 @@ "@backstage/plugin-search-common": "workspace:^", "@backstage/plugin-techdocs-common": "workspace:^", "@google-cloud/storage": "^7.0.0", - "@smithy/node-http-handler": "^2.1.7", + "@smithy/node-http-handler": "^3.0.0", "@trendyol-js/openstack-swift-sdk": "^0.0.7", "@types/express": "^4.17.6", "dockerode": "^4.0.0", diff --git a/yarn.lock b/yarn.lock index eda2edf116..8ba7984659 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7935,7 +7935,7 @@ __metadata: "@backstage/plugin-search-common": "workspace:^" "@backstage/plugin-techdocs-common": "workspace:^" "@google-cloud/storage": ^7.0.0 - "@smithy/node-http-handler": ^2.1.7 + "@smithy/node-http-handler": ^3.0.0 "@trendyol-js/openstack-swift-sdk": ^0.0.7 "@types/express": ^4.17.6 "@types/fs-extra": ^11.0.0 @@ -14864,16 +14864,6 @@ __metadata: languageName: node linkType: hard -"@smithy/abort-controller@npm:^2.2.0": - version: 2.2.0 - resolution: "@smithy/abort-controller@npm:2.2.0" - dependencies: - "@smithy/types": ^2.12.0 - tslib: ^2.6.2 - checksum: d0d7fcaa7b67b04c9ad825017110cc294ff06af07f8054ac3b75d8de88ff5fbef1d08f5c1ae672db1839d14ce25f277c459d2b7b7263cbe9e6c3d4518a19230e - languageName: node - linkType: hard - "@smithy/abort-controller@npm:^3.1.2": version: 3.1.2 resolution: "@smithy/abort-controller@npm:3.1.2" @@ -15164,20 +15154,7 @@ __metadata: languageName: node linkType: hard -"@smithy/node-http-handler@npm:^2.1.7": - version: 2.5.0 - resolution: "@smithy/node-http-handler@npm:2.5.0" - dependencies: - "@smithy/abort-controller": ^2.2.0 - "@smithy/protocol-http": ^3.3.0 - "@smithy/querystring-builder": ^2.2.0 - "@smithy/types": ^2.12.0 - tslib: ^2.6.2 - checksum: 2e63fafdac5bef62181994af2ec065b0f7f04eaed88fb2990a21a9925226fead5013cf4f232b527f3f4d9ffb68ccbe8cd263ad22a7351d36b0dc23e975929a0c - languageName: node - linkType: hard - -"@smithy/node-http-handler@npm:^3.2.0": +"@smithy/node-http-handler@npm:^3.0.0, @smithy/node-http-handler@npm:^3.2.0": version: 3.2.0 resolution: "@smithy/node-http-handler@npm:3.2.0" dependencies: @@ -15200,16 +15177,6 @@ __metadata: languageName: node linkType: hard -"@smithy/protocol-http@npm:^3.3.0": - version: 3.3.0 - resolution: "@smithy/protocol-http@npm:3.3.0" - dependencies: - "@smithy/types": ^2.12.0 - tslib: ^2.6.2 - checksum: 6c1aaaee9f6ecfb841766938312268f30cbda253f172de7467463aae7d7bfea19a801ab570f3737334e992d2d0ee7446e6af6a6fd82b08533790c489289dff76 - languageName: node - linkType: hard - "@smithy/protocol-http@npm:^4.1.1": version: 4.1.1 resolution: "@smithy/protocol-http@npm:4.1.1" @@ -15220,17 +15187,6 @@ __metadata: languageName: node linkType: hard -"@smithy/querystring-builder@npm:^2.2.0": - version: 2.2.0 - resolution: "@smithy/querystring-builder@npm:2.2.0" - dependencies: - "@smithy/types": ^2.12.0 - "@smithy/util-uri-escape": ^2.2.0 - tslib: ^2.6.2 - checksum: db492903302a694a0e982c37b9a74314160c5ee485742f24f8b6d0da66f121e7ff8588742a3a1964f6b983c15cacd52b883c5efa714882a754f575da7a7e014d - languageName: node - linkType: hard - "@smithy/querystring-builder@npm:^3.0.4": version: 3.0.4 resolution: "@smithy/querystring-builder@npm:3.0.4" @@ -15310,15 +15266,6 @@ __metadata: languageName: node linkType: hard -"@smithy/types@npm:^2.12.0": - version: 2.12.0 - resolution: "@smithy/types@npm:2.12.0" - dependencies: - tslib: ^2.6.2 - checksum: 2dd93746624d87afbf51c22116fc69f82e95004b78cf681c4a283d908155c22a2b7a3afbd64a3aff7deefb6619276f186e212422ad200df3b42c32ef5330374e - languageName: node - linkType: hard - "@smithy/types@npm:^3.4.0": version: 3.4.0 resolution: "@smithy/types@npm:3.4.0" @@ -15482,15 +15429,6 @@ __metadata: languageName: node linkType: hard -"@smithy/util-uri-escape@npm:^2.2.0": - version: 2.2.0 - resolution: "@smithy/util-uri-escape@npm:2.2.0" - dependencies: - tslib: ^2.6.2 - checksum: bade35312d75d1c84226f2a81b70dfef91766c02ecb6c6854b6f920cddb423e01963f7d0c183d523b5991f8e7ca93bcf73f8b3c6923979152b8350c9f3c24fd6 - languageName: node - linkType: hard - "@smithy/util-uri-escape@npm:^3.0.0": version: 3.0.0 resolution: "@smithy/util-uri-escape@npm:3.0.0" From 88d03d85dfac1c9f0948e78f316d260fe1f1240f Mon Sep 17 00:00:00 2001 From: Sydney Achinger <78113809+squid-ney@users.noreply.github.com> Date: Wed, 2 Oct 2024 15:24:27 -0400 Subject: [PATCH 2/5] SearchType.Accordion UX improvement (#26935) * Update default SearchType.Accordion behavior to NOT close accordion after selection. Signed-off-by: Sydney Achinger --- .changeset/shy-plants-retire.md | 5 +++++ .../SearchType/SearchType.Accordion.test.tsx | 12 ------------ .../components/SearchType/SearchType.Accordion.tsx | 1 - 3 files changed, 5 insertions(+), 13 deletions(-) create mode 100644 .changeset/shy-plants-retire.md diff --git a/.changeset/shy-plants-retire.md b/.changeset/shy-plants-retire.md new file mode 100644 index 0000000000..77427452f5 --- /dev/null +++ b/.changeset/shy-plants-retire.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-search': patch +--- + +Updated the default SearchType.Accordion behavior to remain open after result type selection. This is a UX improvement to reduce the number of clicks needed when toggling result type filters. diff --git a/plugins/search/src/components/SearchType/SearchType.Accordion.test.tsx b/plugins/search/src/components/SearchType/SearchType.Accordion.test.tsx index 556a9550a0..453b766791 100644 --- a/plugins/search/src/components/SearchType/SearchType.Accordion.test.tsx +++ b/plugins/search/src/components/SearchType/SearchType.Accordion.test.tsx @@ -140,18 +140,6 @@ describe('SearchType.Accordion', () => { expect(setPageCursorMock).toHaveBeenCalledWith(undefined); }); - it('should collapse when a new type is selected', async () => { - const { getByText, queryByText } = render( - - - , - ); - - await user.click(getByText(expectedType.name)); - - expect(queryByText('Collapse')).not.toBeInTheDocument(); - }); - it('should show result counts if enabled', async () => { const { getAllByText } = render( diff --git a/plugins/search/src/components/SearchType/SearchType.Accordion.tsx b/plugins/search/src/components/SearchType/SearchType.Accordion.tsx index f9a07b6dcd..bdd13f2fb2 100644 --- a/plugins/search/src/components/SearchType/SearchType.Accordion.tsx +++ b/plugins/search/src/components/SearchType/SearchType.Accordion.tsx @@ -96,7 +96,6 @@ export const SearchTypeAccordion = (props: SearchTypeAccordionProps) => { return () => { setTypes(type !== '' ? [type] : []); setPageCursor(undefined); - setExpanded(false); }; }; From e8b4966a18eb94c301314ac6fd082cfe0aa3a342 Mon Sep 17 00:00:00 2001 From: Thomas Cardonne Date: Wed, 2 Oct 2024 21:30:10 +0200 Subject: [PATCH 3/5] feat(techdocs): use more of the available space for navigation sidebar (#26819) Signed-off-by: Thomas Cardonne --- .changeset/thirty-pianos-mix.md | 6 ++++++ .../ExpandableNavigation.tsx | 3 ++- .../transformers/styles/rules/layout.ts | 21 +++++++++++++------ 3 files changed, 23 insertions(+), 7 deletions(-) create mode 100644 .changeset/thirty-pianos-mix.md diff --git a/.changeset/thirty-pianos-mix.md b/.changeset/thirty-pianos-mix.md new file mode 100644 index 0000000000..147307ac9e --- /dev/null +++ b/.changeset/thirty-pianos-mix.md @@ -0,0 +1,6 @@ +--- +'@backstage/plugin-techdocs-module-addons-contrib': patch +'@backstage/plugin-techdocs': patch +--- + +Use more of the available space for the navigation sidebar. diff --git a/plugins/techdocs-module-addons-contrib/src/ExpandableNavigation/ExpandableNavigation.tsx b/plugins/techdocs-module-addons-contrib/src/ExpandableNavigation/ExpandableNavigation.tsx index 802e377f42..6cdf87a49f 100644 --- a/plugins/techdocs-module-addons-contrib/src/ExpandableNavigation/ExpandableNavigation.tsx +++ b/plugins/techdocs-module-addons-contrib/src/ExpandableNavigation/ExpandableNavigation.tsx @@ -30,8 +30,9 @@ const EXPANDABLE_NAVIGATION_LOCAL_STORAGE = const StyledButton = withStyles({ root: { position: 'absolute', - left: '220px', + left: '13.7rem', // Sidebar inner width (15.1em) minus the different margins/paddings top: '19px', + zIndex: 2, padding: 0, minWidth: 0, }, diff --git a/plugins/techdocs/src/reader/transformers/styles/rules/layout.ts b/plugins/techdocs/src/reader/transformers/styles/rules/layout.ts index 590f2a114b..1a326c62b8 100644 --- a/plugins/techdocs/src/reader/transformers/styles/rules/layout.ts +++ b/plugins/techdocs/src/reader/transformers/styles/rules/layout.ts @@ -86,9 +86,14 @@ export default ({ theme, sidebar }: RuleOptions) => ` scrollbar-width: thin; } .md-sidebar .md-sidebar__scrollwrap { - width: calc(12.1rem); + width: calc(16rem); overflow-y: hidden; } +@supports selector(::-webkit-scrollbar) { + [dir=ltr] .md-sidebar__inner { + padding-right: calc(100% - 15.1rem); + } +} .md-sidebar--secondary { right: ${theme.spacing(3)}px; } @@ -202,18 +207,22 @@ export default ({ theme, sidebar }: RuleOptions) => ` height: 100%; } .md-sidebar--primary { - width: 12.1rem !important; + width: 16rem !important; z-index: 200; left: ${ sidebar.isPinned - ? `calc(-12.1rem + ${SIDEBAR_WIDTH})` - : 'calc(-12.1rem + 72px)' + ? `calc(-16rem + ${SIDEBAR_WIDTH})` + : 'calc(-16rem + 72px)' } !important; } .md-sidebar--secondary:not([hidden]) { display: none; } + [data-md-toggle=drawer]:checked~.md-container .md-sidebar--primary { + transform: translateX(16rem); + } + .md-content { max-width: 100%; margin-left: 0; @@ -241,8 +250,8 @@ export default ({ theme, sidebar }: RuleOptions) => ` @media screen and (max-width: 600px) { .md-sidebar--primary { - left: -12.1rem !important; - width: 12.1rem; + left: -16rem !important; + width: 16rem; } } From 7e3f1acd5d438bcfbb24cc4a28a3cd0199fe5a73 Mon Sep 17 00:00:00 2001 From: Raghunandan Balachandran Date: Thu, 3 Oct 2024 11:10:27 +0200 Subject: [PATCH 4/5] Propose new end user sponsor. Move Helen to end user sponsor emeritus. Signed-off-by: Raghunandan Balachandran --- OWNERS.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/OWNERS.md b/OWNERS.md index b145205539..44f4755b8e 100644 --- a/OWNERS.md +++ b/OWNERS.md @@ -185,11 +185,11 @@ Scope: The Backstage Documentation ## Sponsors -| Name | Organization | GitHub | Email | -| ----------------- | ------------ | ------------------------------------------- | ------------------ | -| Niklas Gustavsson | Spotify | [protocol7](https://github.com/protocol7) | ngn@spotify.com | -| Dave Zolotusky | Spotify | [dzolotusky](https://github.com/dzolotusky) | dzolo@spotify.com | -| Helen Greul | Spotify | [helengreul](https://github.com/helengreul) | heleng@spotify.com | +| Name | Organization | GitHub | Email | +| ----------------- | ------------ | ------------------------------------------- | ----------------- | +| Niklas Gustavsson | Spotify | [protocol7](https://github.com/protocol7) | ngn@spotify.com | +| Dave Zolotusky | Spotify | [dzolotusky](https://github.com/dzolotusky) | dzolo@spotify.com | +| Pia Nilsson | Spotify | [pianilsson](https://github.com/pianilsson) | pia@spotify.com | ## Organization Members @@ -224,9 +224,10 @@ Scope: The Backstage Documentation ## Emeritus End User Sponsors -| Name | Organization | GitHub | Discord | -| --------- | ------------ | ------------------------------------------- | -------------- | -| Lee Mills | Spotify | [leemills83](https://github.com/leemills83) | `.binarypoint` | +| Name | Organization | GitHub | Discord | +| ----------- | ------------ | ------------------------------------------- | -------------- | +| Lee Mills | Spotify | [leemills83](https://github.com/leemills83) | `.binarypoint` | +| Helen Greul | Spotify | [helengreul](https://github.com/helengreul) | `helen_greul` | ## Emeritus Project Area Maintainers From 2c4ee265c7caa0c3cceb26fdd770aa2ade1bfea0 Mon Sep 17 00:00:00 2001 From: Vincenzo Scamporlino Date: Thu, 3 Oct 2024 15:58:09 +0200 Subject: [PATCH 5/5] app-backend: validate env config against schema Signed-off-by: Vincenzo Scamporlino --- .changeset/friendly-coins-approve.md | 5 + .../src/lib/config/readFrontendConfig.test.ts | 99 +++++++++++++++++++ .../src/lib/config/readFrontendConfig.ts | 10 +- 3 files changed, 108 insertions(+), 6 deletions(-) create mode 100644 .changeset/friendly-coins-approve.md create mode 100644 plugins/app-backend/src/lib/config/readFrontendConfig.test.ts diff --git a/.changeset/friendly-coins-approve.md b/.changeset/friendly-coins-approve.md new file mode 100644 index 0000000000..71a8240089 --- /dev/null +++ b/.changeset/friendly-coins-approve.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-app-backend': patch +--- + +Fixed unexpected behaviour where configuration supplied with `APP_CONFIG_*` environment variables where not filtered by the configuration schema. diff --git a/plugins/app-backend/src/lib/config/readFrontendConfig.test.ts b/plugins/app-backend/src/lib/config/readFrontendConfig.test.ts new file mode 100644 index 0000000000..a4089b848a --- /dev/null +++ b/plugins/app-backend/src/lib/config/readFrontendConfig.test.ts @@ -0,0 +1,99 @@ +/* + * 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 { createMockDirectory } from '@backstage/backend-test-utils'; +import { readFrontendConfig } from './readFrontendConfig'; +import { ConfigReader } from '@backstage/config'; + +describe('readFrontendConfig', () => { + const mockDir = createMockDirectory(); + + afterEach(() => { + mockDir.clear(); + }); + + it('should validate env config', async () => { + mockDir.setContent({ + 'appDir/.config-schema.json': JSON.stringify({ + schemas: [ + { + value: { + type: 'object', + + properties: { + app: { + type: 'object', + properties: { + secretOfLife: { + type: 'string', + visibility: 'secret', + }, + backendConfig: { + type: 'string', + visibility: 'backend', + }, + publicValue: { + type: 'string', + visibility: 'frontend', + }, + }, + }, + }, + }, + }, + ], + backstageConfigSchemaVersion: 1, + }), + }); + + const config = new ConfigReader({ + app: { + secretOfLife: '42', + backendConfig: 'backend', + publicValue: 'public', + }, + }); + + const frontendConfig = await readFrontendConfig({ + env: { + APP_CONFIG_app_secretOfLife: 'ignored', + APP_CONFIG_app_backendConfig: 'ignored', + APP_CONFIG_app_publicValue: 'injected', + }, + appDistDir: `${mockDir.path}/appDir`, + config, + }); + + expect(frontendConfig).toEqual([ + { + context: 'env', + data: { + app: { + publicValue: 'injected', + }, + }, + deprecatedKeys: [], + filteredKeys: undefined, + }, + { + context: 'app', + data: { app: { publicValue: 'public' } }, + deprecatedKeys: [], + filteredKeys: undefined, + }, + ]); + }); +}); diff --git a/plugins/app-backend/src/lib/config/readFrontendConfig.ts b/plugins/app-backend/src/lib/config/readFrontendConfig.ts index becd1c2f52..f2b22b720f 100644 --- a/plugins/app-backend/src/lib/config/readFrontendConfig.ts +++ b/plugins/app-backend/src/lib/config/readFrontendConfig.ts @@ -36,10 +36,9 @@ export async function readFrontendConfig(options: { }): Promise { const { env, appDistDir, config } = options; - const appConfigs = readEnvConfig(env); - const schemaPath = resolvePath(appDistDir, '.config-schema.json'); if (await fs.pathExists(schemaPath)) { + const envConfigs = readEnvConfig(env); const serializedSchema = await fs.readJson(schemaPath); try { @@ -49,11 +48,10 @@ export async function readFrontendConfig(options: { serialized: serializedSchema, })); - const frontendConfigs = await schema.process( - [{ data: config.get() as JsonObject, context: 'app' }], + return await schema.process( + [...envConfigs, { data: config.get() as JsonObject, context: 'app' }], { visibility: ['frontend'], withDeprecatedKeys: true }, ); - appConfigs.push(...frontendConfigs); } catch (error) { throw new Error( 'Invalid app bundle schema. If this error is unexpected you need to run `yarn build` in the app. ' + @@ -63,5 +61,5 @@ export async function readFrontendConfig(options: { } } - return appConfigs; + return []; }