Skip to content

Commit

Permalink
Adding wizards.enabled config option
Browse files Browse the repository at this point in the history
  • Loading branch information
oomIRL committed Feb 12, 2025
1 parent 2feda20 commit aeb7cb6
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 38 deletions.
2 changes: 2 additions & 0 deletions app-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ app:
snowplow:
enabled: true
collectorUrl: https://spm.apps.gov.bc.ca
wizards:
enabled: false

organization:
name: BCDevExchange
Expand Down
11 changes: 11 additions & 0 deletions packages/app/config.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export interface Config {
app: {
wizards?: {
/**
*
* @visibility frontend
*/
enabled?: boolean;
};
};
}
6 changes: 4 additions & 2 deletions packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@
]
},
"files": [
"dist"
]
"dist",
"config.d.ts"
],
"configSchema": "config.d.ts"
}
9 changes: 8 additions & 1 deletion packages/app/src/components/Root/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import MenuIcon from '@material-ui/icons/Menu';
import SearchIcon from '@material-ui/icons/Search';
import LibraryAddIcon from '@material-ui/icons/LibraryAdd';
import { CustomSearchModal } from '../search/CustomModal';
import { configApiRef, useApi } from '@backstage/core-plugin-api';

const storedTheme = localStorage.getItem('theme');

Expand Down Expand Up @@ -92,6 +93,10 @@ const SidebarLogo = () => {

export const Root = ({ children }: PropsWithChildren<{}>) => {
const { state, toggleModal } = useSearchModal();
const config = useApi(configApiRef);
const wizardsEnabled =
config.getOptionalConfig('app.wizards') &&
config.getBoolean('app.wizards.enabled');

return (
<SidebarPage>
Expand Down Expand Up @@ -154,7 +159,9 @@ export const Root = ({ children }: PropsWithChildren<{}>) => {
</SidebarItem>
<SidebarItem icon={ExtensionIcon} to="api-docs" text="APIs" /> */}
<SidebarItem icon={LibraryBooks} to="docs" text="Docs" />
<SidebarItem icon={LibraryAddIcon} to="create" text="Wizards" />
{wizardsEnabled ? (
<SidebarItem icon={LibraryAddIcon} to="create" text="Wizards" />
) : null}
{/* <SidebarItem icon={CreateComponentIcon} to="create" text="Create..." /> */}
{/* End global nav */}
{/* <SidebarDivider />
Expand Down
19 changes: 13 additions & 6 deletions packages/app/src/components/home/HomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Link } from 'react-router-dom';
import { BCGovBannerText, BCGovHeaderText } from './HomeHeaderText';
import { HomePageCards } from './HomePageCards';
import { AnnounceBanner } from './AnnounceBanner';
import { configApiRef, useApi } from '@backstage/core-plugin-api';
import * as tokens from '@bcgov/design-tokens/js';

const useStyles = makeStyles({
Expand Down Expand Up @@ -67,17 +68,23 @@ const GlobalStyle = createGlobalStyle`

const HomePage = () => {
const classes = useStyles();
const config = useApi(configApiRef);
const wizardsEnabled =
config.getOptionalConfig('app.wizards') &&
config.getBoolean('app.wizards.enabled');

return (
<Page themeId="home">
<GlobalStyle />
<Content>
<AnnounceBanner id={0} title="Quickstart wizards launch">
<Typography>
reduce startup times for new apps with the{' '}
<Link to="/create">OpenShift quickstart wizard</Link>
</Typography>
</AnnounceBanner>
{wizardsEnabled ? (
<AnnounceBanner id={0} title="Quickstart wizards launch">
<Typography>
reduce startup times for new apps with the{' '}
<Link to="/create">OpenShift quickstart wizard</Link>
</Typography>
</AnnounceBanner>
) : null}

<div className={classes.root}>
<BCGovBannerText variant="h2" gutterBottom>
Expand Down
37 changes: 8 additions & 29 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10030,17 +10030,10 @@
resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.7.tgz#50ae4353eaaddc04044279812f52c8c65857dbcb"
integrity sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==

"@types/react-dom@*", "@types/react-dom@^18.0.0":
version "18.3.1"
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.3.1.tgz#1e4654c08a9cdcfb6594c780ac59b55aad42fe07"
integrity sha512-qW1Mfv8taImTthu4KoXgDfLuk4bydU6Q/TkADnDWWHwi4NX4BR+LWfTp2sVmTqRrsHvyDDTelgelxJ+SsejKKQ==
dependencies:
"@types/react" "*"

"@types/react-dom@<18.0.0":
version "17.0.26"
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-17.0.26.tgz#fa7891ba70fd39ddbaa7e85b6ff9175bb546bc1b"
integrity sha512-Z+2VcYXJwOqQ79HreLU/1fyQ88eXSSFh6I3JdrEHQIfYSI0kCQpTGvOrbE6jFGGYXKsHuwY9tBa/w5Uo6KzrEg==
"@types/react-dom@*", "@types/react-dom@<18.0.0", "@types/react-dom@^18", "@types/react-dom@^18.0.0":
version "18.3.5"
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.3.5.tgz#45f9f87398c5dcea085b715c58ddcf1faf65f716"
integrity sha512-P4t6saawp+b/dFrUr2cvkVsfvPguwsxtH6dNIYRllMsefqFzkZk5UIjzyDOv5g1dXIPdG4Sp1yCR4Z6RCUsG/Q==

"@types/react-redux@^7.1.20":
version "7.1.34"
Expand Down Expand Up @@ -10073,23 +10066,14 @@
dependencies:
"@types/react" "*"

"@types/react@*", "@types/react@^16.13.1 || ^17.0.0 || ^18.0.0":
version "18.3.12"
resolved "https://registry.yarnpkg.com/@types/react/-/react-18.3.12.tgz#99419f182ccd69151813b7ee24b792fe08774f60"
integrity sha512-D2wOSq/d6Agt28q7rSI3jhU7G6aiuzljDGZ2hTZHIkrTLUI+AF3WMeKkEZ9nN2fkBAlcktT6vcZjDFiIhMYEQw==
"@types/react@*", "@types/react@^16.13.1 || ^17.0.0", "@types/react@^16.13.1 || ^17.0.0 || ^18.0.0", "@types/react@^18":
version "18.3.18"
resolved "https://registry.yarnpkg.com/@types/react/-/react-18.3.18.tgz#9b382c4cd32e13e463f97df07c2ee3bbcd26904b"
integrity sha512-t4yC+vtgnkYjNSKlFx1jkAhH8LgTo2N/7Qvi83kdEaUtMDiwpbLAktKDaAMlRcJ5eSxZkH74eEGt1ky31d7kfQ==
dependencies:
"@types/prop-types" "*"
csstype "^3.0.2"

"@types/react@^16.13.1 || ^17.0.0":
version "17.0.83"
resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.83.tgz#b477c56387b74279281149dcf5ba2a1e2216d131"
integrity sha512-l0m4ArKJvmFtR4e8UmKrj1pB4tUgOhJITf+mADyF/p69Ts1YAR/E+G9XEM0mHXKVRa1dQNHseyyDNzeuAXfXQw==
dependencies:
"@types/prop-types" "*"
"@types/scheduler" "^0.16"
csstype "^3.0.2"

"@types/request@^2.47.1", "@types/request@^2.48.8":
version "2.48.12"
resolved "https://registry.yarnpkg.com/@types/request/-/request-2.48.12.tgz#0f590f615a10f87da18e9790ac94c29ec4c5ef30"
Expand Down Expand Up @@ -10117,11 +10101,6 @@
resolved "https://registry.yarnpkg.com/@types/retry/-/retry-0.12.2.tgz#ed279a64fa438bb69f2480eda44937912bb7480a"
integrity sha512-XISRgDJ2Tc5q4TRqvgJtzsRkFYNJzZrhTdtMoGVBttwzzQJkPnS3WWTFc7kuDRoPtPakl+T+OfdEUjYJj7Jbow==

"@types/scheduler@^0.16":
version "0.16.8"
resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.8.tgz#ce5ace04cfeabe7ef87c0091e50752e36707deff"
integrity sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A==

"@types/semver@7.5.8", "@types/semver@^7.5.0":
version "7.5.8"
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.8.tgz#8268a8c57a3e4abd25c165ecd36237db7948a55e"
Expand Down

0 comments on commit aeb7cb6

Please sign in to comment.