Skip to content

Commit

Permalink
scaffolder: add DescriptionField override to support markdown
Browse files Browse the repository at this point in the history
Signed-off-by: Bret Hubbard <hubbard.bret@gmail.com>
  • Loading branch information
brethubbard committed Dec 15, 2021
1 parent 1115165 commit 111dcae
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright 2021 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 React from 'react';
import { MarkdownContent } from '@backstage/core-components';
import { FieldProps } from '@rjsf/core';

export const DescriptionField = ({ description }: FieldProps) =>
description && <MarkdownContent content={description} />;
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright 2021 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.
*/
export { DescriptionField } from './DescriptionField';
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { Theme as MuiTheme } from '@rjsf/material-ui';
import React, { useState } from 'react';
import { transformSchemaToProps } from './schema';
import { Content, StructuredMetadataTable } from '@backstage/core-components';
import * as fieldOverrides from './FieldOverrides';

const Form = withTheme(MuiTheme);
type Step = {
Expand Down Expand Up @@ -152,7 +153,7 @@ export const MultistepJsonForm = ({
<StepContent key={title}>
<Form
showErrorList={false}
fields={fields}
fields={{ ...fieldOverrides, ...fields }}
widgets={widgets}
noHtml5Validate
formData={formData}
Expand Down

0 comments on commit 111dcae

Please sign in to comment.