Skip to content

Commit

Permalink
Merge branch 'backstage:master' into jordans/addFilterNegation
Browse files Browse the repository at this point in the history
  • Loading branch information
SnowBlitzer authored Oct 3, 2024
2 parents 3337936 + 323e612 commit 1ca088e
Show file tree
Hide file tree
Showing 13 changed files with 153 additions and 99 deletions.
5 changes: 5 additions & 0 deletions .changeset/friendly-coins-approve.md
Original file line number Diff line number Diff line change
@@ -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.
5 changes: 5 additions & 0 deletions .changeset/renovate-7874fad.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@backstage/plugin-techdocs-node': patch
---

Updated dependency `@smithy/node-http-handler` to `^3.0.0`.
5 changes: 5 additions & 0 deletions .changeset/shy-plants-retire.md
Original file line number Diff line number Diff line change
@@ -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.
6 changes: 6 additions & 0 deletions .changeset/thirty-pianos-mix.md
Original file line number Diff line number Diff line change
@@ -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.
17 changes: 9 additions & 8 deletions OWNERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,11 @@ Scope: The Backstage Documentation

## Sponsors

| Name | Organization | GitHub | Email |
| ----------------- | ------------ | ------------------------------------------- | ------------------ |
| Niklas Gustavsson | Spotify | [protocol7](https://github.com/protocol7) | [email protected] |
| Dave Zolotusky | Spotify | [dzolotusky](https://github.com/dzolotusky) | [email protected] |
| Helen Greul | Spotify | [helengreul](https://github.com/helengreul) | heleng@spotify.com |
| Name | Organization | GitHub | Email |
| ----------------- | ------------ | ------------------------------------------- | ----------------- |
| Niklas Gustavsson | Spotify | [protocol7](https://github.com/protocol7) | [email protected] |
| Dave Zolotusky | Spotify | [dzolotusky](https://github.com/dzolotusky) | [email protected] |
| Pia Nilsson | Spotify | [pianilsson](https://github.com/pianilsson) | pia@spotify.com |

## Organization Members

Expand Down Expand Up @@ -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

Expand Down
99 changes: 99 additions & 0 deletions plugins/app-backend/src/lib/config/readFrontendConfig.test.ts
Original file line number Diff line number Diff line change
@@ -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,
},
]);
});
});
10 changes: 4 additions & 6 deletions plugins/app-backend/src/lib/config/readFrontendConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ export async function readFrontendConfig(options: {
}): Promise<AppConfig[]> {
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 {
Expand All @@ -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. ' +
Expand All @@ -63,5 +61,5 @@ export async function readFrontendConfig(options: {
}
}

return appConfigs;
return [];
}
Original file line number Diff line number Diff line change
Expand Up @@ -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(
<Wrapper>
<SearchType.Accordion name={expectedLabel} types={[expectedType]} />
</Wrapper>,
);

await user.click(getByText(expectedType.name));

expect(queryByText('Collapse')).not.toBeInTheDocument();
});

it('should show result counts if enabled', async () => {
const { getAllByText } = render(
<Wrapper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ export const SearchTypeAccordion = (props: SearchTypeAccordionProps) => {
return () => {
setTypes(type !== '' ? [type] : []);
setPageCursor(undefined);
setExpanded(false);
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down
2 changes: 1 addition & 1 deletion plugins/techdocs-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
21 changes: 15 additions & 6 deletions plugins/techdocs/src/reader/transformers/styles/rules/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
}
Expand Down
Loading

0 comments on commit 1ca088e

Please sign in to comment.