Skip to content

Instantly share code, notes, and snippets.

@benjdlambert
Last active September 11, 2021 01:45
Show Gist options
  • Save benjdlambert/259dfca6849549376e2744233ad8b76a to your computer and use it in GitHub Desktop.
Save benjdlambert/259dfca6849549376e2744233ad8b76a to your computer and use it in GitHub Desktop.
Scaffolder Extension
//packages/app/src/scaffolder/extensions/index.ts
import { scaffolderPlugin, createScaffolderFieldExtension } from '@backstage/plugin-scaffolder';
import { BitbucketToken }
export const BitbucketFieldExtension = scaffolderPlugin.provide(
createScaffolderFieldExtension({
name: 'BitbucketToken',
component: BitbucketToken,
})
);
// packages/app/src/scaffolder/extensions/Bitbucket/index.tsx
import React, { useCallback, useEffect } from 'react';
import { FieldProps } from '@rjsf/core';
export const BitbucketToken = ({
onChange,
uiSchema,
rawErrors,
formData,
}: FieldProps<string>) => {
return (
<>
<FormControl
margin="normal"
required
error={rawErrors?.length > 0}
>
<InputLabel htmlFor="tokenInput">Organization</InputLabel>
<Input
id="tokenInput"
onChange={(e) => onChange(e.target.value)}
value={formData}
/>
<FormHelperText>the token</FormHelperText>
</FormControl>
</>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment