diff --git a/docs/auth/index.md b/docs/auth/index.md index 0fa8de3280..aed3a580b0 100644 --- a/docs/auth/index.md +++ b/docs/auth/index.md @@ -35,6 +35,13 @@ full list of providers, see the ### Identity - WIP +> NOTE: Identity management and the `SignInPage` in Backstage is NOT a method +> for blocking access for unauthorized users, that either requires additional +> backend implementation or a separate service like Google's Identity-Aware +> Proxy. The identity system only serves to provide a personalized experience +> and access to a Backstage Identity Token, which can be passed to backend +> plugins. + Identity management is still work in progress, but there are already a couple of pieces in place that can be used. diff --git a/packages/create-app/templates/default-app/.gitignore b/packages/create-app/templates/default-app/.gitignore.hbs similarity index 96% rename from packages/create-app/templates/default-app/.gitignore rename to packages/create-app/templates/default-app/.gitignore.hbs index 4f9065c60b..5f5cc739f4 100644 --- a/packages/create-app/templates/default-app/.gitignore +++ b/packages/create-app/templates/default-app/.gitignore.hbs @@ -1,4 +1,3 @@ - # Logs logs *.log @@ -31,4 +30,4 @@ dist-types site # Local configuration files -*.local.yaml +*.local.yaml \ No newline at end of file diff --git a/packages/techdocs-container/Dockerfile b/packages/techdocs-container/Dockerfile index e910935baf..b34fcbd861 100644 --- a/packages/techdocs-container/Dockerfile +++ b/packages/techdocs-container/Dockerfile @@ -18,7 +18,7 @@ FROM python:3.8-alpine RUN apk update && apk --no-cache add gcc musl-dev openjdk11-jdk curl graphviz ttf-dejavu fontconfig RUN curl -L http://sourceforge.net/projects/plantuml/files/plantuml.1.2020.16.jar/download > /opt/plantuml.jar -RUN pip install --upgrade pip && pip install mkdocs-techdocs-core==0.0.7 +RUN pip install --upgrade pip && pip install mkdocs-techdocs-core==0.0.8 # Create script to call plantuml.jar from a location in path diff --git a/packages/techdocs-container/mock-docs/docs/index.md b/packages/techdocs-container/mock-docs/docs/index.md index 2586b86cfb..3c323d6fc1 100644 --- a/packages/techdocs-container/mock-docs/docs/index.md +++ b/packages/techdocs-container/mock-docs/docs/index.md @@ -3,10 +3,9 @@ !!! test Testing somethin +Abbreviations: Some text about MOCDOC -\*[MOCDOC]: Mock Documentation - This is a paragraph. {: #test_id .test_class } @@ -61,3 +60,40 @@ digraph G { ``` :bulb: + +=== "JavaScript" + + ```javascript + import { test } from 'something'; + + const addThingToThing = (a, b) a + b; + ``` + +=== "Java" + + ```java + public void function() { + test(); + } + ``` + +```java tab="java" + public void function() { + test(); + } +``` + +```java tab="java 2" + public void function() { + test(); + } +``` + +```javascript +import { test } from 'something'; + +const addThingToThing = (a, b) a + b; +``` + + +*[MOCDOC]: Mock Documentation diff --git a/packages/techdocs-container/techdocs-core/README.md b/packages/techdocs-container/techdocs-core/README.md index 36f1437a54..49b9fce4e4 100644 --- a/packages/techdocs-container/techdocs-core/README.md +++ b/packages/techdocs-container/techdocs-core/README.md @@ -48,8 +48,72 @@ python -m black src/ **Note:** This will write to all Python files in `src/` with the formatted code. If you would like to only check to see if it passes, simply append the `--check` flag. +## MkDocs plugins and extensions + +The TechDocs Core MkDocs plugin comes with a set of extensions and plugins that mkdocs supports. Below you can find a list of all extensions and plugins that are included in the +TechDocs Core plugin: + +Plugins: + +- [search](https://www.mkdocs.org/user-guide/configuration/#search) +- [mkdocs-monorepo-plugin](https://github.com/spotify/mkdocs-monorepo-plugin) + +Extensions: + +- [admonition](https://squidfunk.github.io/mkdocs-material/reference/admonitions/#admonitions) +- [toc](https://python-markdown.github.io/extensions/toc/) +- [pymdown](https://facelessuser.github.io/pymdown-extensions/) + - caret + - critic + - details + - emoji + - superfences + - inlinehilite + - magiclink + - mark + - smartsymobls + - highlight + - extra + - tabbed + - tasklist + - tilde +- [markdown_inline_graphviz](https://pypi.org/project/markdown-inline-graphviz/) +- [plantuml_markdown](https://pypi.org/project/plantuml-markdown/) + ## Changelog +### 0.0.8 + +- Superfences and Codehilite doesn't work very well together (squidfunk/mkdocs-material#1604) so therefore the codehilite extension is replaced by pymdownx.highlight + +* Uses pymdownx extensions v.7.1 instead of 8.0.0 to allow legacy_tab_classes config. This makes the techdocs core plugin compatible with the usage of tabs for grouping markdown with the following syntax: + +```` + ```java tab="java 2" + public void function() { + .... + } + ``` +```` + +as well as the new + +```` + === "Java" + + ```java + public void function() { + .... + } + ``` +```` + +The pymdownx extension will be bumped too 8.0.0 in the near future. + +- pymdownx.tabbed is added to support tabs to group markdown content, such as codeblocks. + +- "PyMdown Extensions includes three extensions that are meant to replace their counterpart in the default Python Markdown extensions." Therefore some extensions has been taken away in this version that comes by default from pymdownx.extra which is added now (https://facelessuser.github.io/pymdown-extensions/usage_notes/#incompatible-extensions) + ### 0.0.7 - Fix an issue with configuration of emoji support diff --git a/packages/techdocs-container/techdocs-core/requirements.txt b/packages/techdocs-container/techdocs-core/requirements.txt index 36daaab4d7..75546fa992 100644 --- a/packages/techdocs-container/techdocs-core/requirements.txt +++ b/packages/techdocs-container/techdocs-core/requirements.txt @@ -7,7 +7,7 @@ mkdocs-monorepo-plugin==0.4.5 plantuml-markdown==3.1.2 markdown_inline_graphviz_extension==1.1 pygments==2.6.1 -pymdown-extensions==8.0.0 +pymdown-extensions==7.1 # The linter using for Python # Note: This requires Python 3.6+ to run, but can format Python 2 code too. diff --git a/packages/techdocs-container/techdocs-core/setup.py b/packages/techdocs-container/techdocs-core/setup.py index 3e3fa47caa..e5a8206150 100644 --- a/packages/techdocs-container/techdocs-core/setup.py +++ b/packages/techdocs-container/techdocs-core/setup.py @@ -17,38 +17,34 @@ from setuptools import setup, find_packages setup( - name='mkdocs-techdocs-core', - version='0.0.7', - description='A Mkdocs package that contains TechDocs defaults', - long_description='', - keywords='mkdocs', - url='https://github.com/spotify/backstage', - author='TechDocs Core', - author_email='pulp-fiction@spotify.com', - license='Apache-2.0', - python_requires='>=3.7', + name="mkdocs-techdocs-core", + version="0.0.8", + description="A Mkdocs package that contains TechDocs defaults", + long_description="", + keywords="mkdocs", + url="https://github.com/spotify/backstage", + author="TechDocs Core", + author_email="pulp-fiction@spotify.com", + license="Apache-2.0", + python_requires=">=3.7", install_requires=[ - 'mkdocs>=1.1.2', - 'mkdocs-material==5.3.2', - 'mkdocs-monorepo-plugin==0.4.5', - 'plantuml-markdown==3.1.2', - 'markdown_inline_graphviz_extension==1.1', - 'pygments==2.6.1', - 'pymdown-extensions==8.0.0' + "mkdocs>=1.1.2", + "mkdocs-material==5.3.2", + "mkdocs-monorepo-plugin==0.4.5", + "plantuml-markdown==3.1.2", + "markdown_inline_graphviz_extension==1.1", + "pygments==2.6.1", + "pymdown-extensions==7.1", ], classifiers=[ - 'Development Status :: 1 - Planning', - 'Intended Audience :: Developers', - 'Intended Audience :: Information Technology', - 'License :: OSI Approved :: Apache Software License', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3 :: Only', - 'Programming Language :: Python :: 3.7' + "Development Status :: 1 - Planning", + "Intended Audience :: Developers", + "Intended Audience :: Information Technology", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.7", ], packages=find_packages(), - entry_points={ - 'mkdocs.plugins': [ - 'techdocs-core = src.core:TechDocsCore' - ] - } + entry_points={"mkdocs.plugins": ["techdocs-core = src.core:TechDocsCore"]}, ) diff --git a/packages/techdocs-container/techdocs-core/src/core.py b/packages/techdocs-container/techdocs-core/src/core.py index 69e39d401b..ed1eb7c6f6 100644 --- a/packages/techdocs-container/techdocs-core/src/core.py +++ b/packages/techdocs-container/techdocs-core/src/core.py @@ -14,7 +14,7 @@ * limitations under the License. """ -from mkdocs.plugins import BasePlugin, PluginCollection +from mkdocs.plugins import BasePlugin from mkdocs.theme import Theme from mkdocs.contrib.search import SearchPlugin from mkdocs_monorepo_plugin.plugin import MonorepoPlugin @@ -54,25 +54,11 @@ class TechDocsCore(BasePlugin): # Markdown Extensions config["markdown_extensions"].append("admonition") - config["markdown_extensions"].append("abbr") - config["markdown_extensions"].append("attr_list") - config["markdown_extensions"].append("def_list") - config["markdown_extensions"].append("codehilite") - config["mdx_configs"]["codehilite"] = { - "linenums": True, - "guess_lang": False, - "pygments_style": "friendly", - } config["markdown_extensions"].append("toc") config["mdx_configs"]["toc"] = { "permalink": True, } - config["markdown_extensions"].append("footnotes") - config["markdown_extensions"].append("markdown.extensions.tables") - config["markdown_extensions"].append("pymdownx.betterem") - config["mdx_configs"]["pymdownx.betterem"] = { - "smart_enable": "all", - } + config["markdown_extensions"].append("pymdownx.caret") config["markdown_extensions"].append("pymdownx.critic") config["markdown_extensions"].append("pymdownx.details") @@ -83,6 +69,18 @@ class TechDocsCore(BasePlugin): config["markdown_extensions"].append("pymdownx.mark") config["markdown_extensions"].append("pymdownx.smartsymbols") config["markdown_extensions"].append("pymdownx.superfences") + config["mdx_configs"]["pymdownx.superfences"] = { + "legacy_tab_classes": True, + } + config["markdown_extensions"].append("pymdownx.highlight") + config["mdx_configs"]["pymdownx.highlight"] = { + "linenums": True, + } + config["markdown_extensions"].append("pymdownx.extra") + config["mdx_configs"]["pymdownx.betterem"] = { + "smart_enable": "all", + } + config["markdown_extensions"].append("pymdownx.tabbed") config["markdown_extensions"].append("pymdownx.tasklist") config["mdx_configs"]["pymdownx.tasklist"] = { "custom_checkbox": True, diff --git a/plugins/catalog/src/components/CatalogFilter/CatalogFilter.test.tsx b/plugins/catalog/src/components/CatalogFilter/CatalogFilter.test.tsx index a98eec0875..bc23d61d9c 100644 --- a/plugins/catalog/src/components/CatalogFilter/CatalogFilter.test.tsx +++ b/plugins/catalog/src/components/CatalogFilter/CatalogFilter.test.tsx @@ -58,7 +58,7 @@ describe('Catalog Filter', () => { ] as Entity[]), }; - const indentityApi: Partial = { + const identityApi: Partial = { getUserId: () => 'tools@example.com', }; @@ -68,7 +68,7 @@ describe('Catalog Filter', () => { diff --git a/plugins/register-component/src/components/RegisterComponentForm/RegisterComponentForm.test.tsx b/plugins/register-component/src/components/RegisterComponentForm/RegisterComponentForm.test.tsx index bb7faabc9d..df179ca219 100644 --- a/plugins/register-component/src/components/RegisterComponentForm/RegisterComponentForm.test.tsx +++ b/plugins/register-component/src/components/RegisterComponentForm/RegisterComponentForm.test.tsx @@ -41,7 +41,9 @@ describe('RegisterComponentForm', () => { ), ).toBeInTheDocument(); - const submit = (await rendered.getByRole('button')) as HTMLButtonElement; + const submit = (await rendered.getByTestId( + 'registerComponentFormSubmit', + )) as HTMLButtonElement; expect(submit.disabled).toBeTruthy(); }); @@ -54,7 +56,9 @@ describe('RegisterComponentForm', () => { target: { value: 'https://example.com/blob/master/component.yaml' }, }); }); - const submit = (await rendered.getByRole('button')) as HTMLButtonElement; + const submit = (await rendered.getByTestId( + 'registerComponentFormSubmit', + )) as HTMLButtonElement; expect(submit.disabled).toBeFalsy(); }); diff --git a/plugins/register-component/src/components/RegisterComponentForm/RegisterComponentForm.tsx b/plugins/register-component/src/components/RegisterComponentForm/RegisterComponentForm.tsx index 4090b2af9c..294f4db801 100644 --- a/plugins/register-component/src/components/RegisterComponentForm/RegisterComponentForm.tsx +++ b/plugins/register-component/src/components/RegisterComponentForm/RegisterComponentForm.tsx @@ -21,10 +21,13 @@ import { FormHelperText, LinearProgress, TextField, + Select, + MenuItem, + InputLabel, } from '@material-ui/core'; import { makeStyles } from '@material-ui/core/styles'; import React, { FC } from 'react'; -import { useForm } from 'react-hook-form'; +import { useForm, Controller } from 'react-hook-form'; import { ComponentIdValidators } from '../../util/validate'; const useStyles = makeStyles(theme => ({ @@ -44,7 +47,7 @@ export type Props = { }; const RegisterComponentForm: FC = ({ onSubmit, submitting }) => { - const { register, handleSubmit, errors, formState } = useForm({ + const { control, register, handleSubmit, errors, formState } = useForm({ mode: 'onChange', }); const classes = useStyles(); @@ -84,8 +87,33 @@ const RegisterComponentForm: FC = ({ onSubmit, submitting }) => { )} + + + SCM Detection + ( + + )} + /> +