diff --git a/plugins/scaffolder-backend/sample-templates/remote-templates.yaml b/plugins/scaffolder-backend/sample-templates/remote-templates.yaml
index b89b21d5e3..7846a0994e 100644
--- a/plugins/scaffolder-backend/sample-templates/remote-templates.yaml
+++ b/plugins/scaffolder-backend/sample-templates/remote-templates.yaml
@@ -6,4 +6,4 @@ metadata:
spec:
type: url
targets:
- # - https://github.com/spotify/cookiecutter-golang/blob/master/template.yaml
+ - https://github.com/spotify/cookiecutter-golang/blob/master/template.yaml
diff --git a/plugins/scaffolder/src/components/ScaffolderPage/ScaffolderPage.tsx b/plugins/scaffolder/src/components/ScaffolderPage/ScaffolderPage.tsx
index 1d16e50568..29758f4ac3 100644
--- a/plugins/scaffolder/src/components/ScaffolderPage/ScaffolderPage.tsx
+++ b/plugins/scaffolder/src/components/ScaffolderPage/ScaffolderPage.tsx
@@ -14,7 +14,17 @@
* limitations under the License.
*/
-import { EntityMeta, TemplateEntityV1alpha1 } from '@backstage/catalog-model';
+import { EntityMeta, TemplateEntityV1beta2 } from '@backstage/catalog-model';
+import {
+ Content,
+ ContentHeader,
+ Header,
+ ItemCardGrid,
+ Lifecycle,
+ Page,
+ Progress,
+ SupportButton,
+} from '@backstage/core-components';
import { useStarredEntities } from '@backstage/plugin-catalog-react';
import { Button, Link, makeStyles, Typography } from '@material-ui/core';
import StarIcon from '@material-ui/icons/Star';
@@ -30,18 +40,6 @@ import { TemplateCard } from '../TemplateCard';
import { configApiRef, useApi, useRouteRef } from '@backstage/core-plugin-api';
-import {
- Content,
- ContentHeader,
- Header,
- ItemCardGrid,
- Lifecycle,
- Page,
- Progress,
- SupportButton,
- WarningPanel,
-} from '@backstage/core-components';
-
const useStyles = makeStyles(theme => ({
contentWrapper: {
display: 'grid',
@@ -90,7 +88,7 @@ export const ScaffolderPageContents = () => {
);
const [search, setSearch] = useState('');
const [matchingEntities, setMatchingEntities] = useState(
- [] as TemplateEntityV1alpha1[],
+ [] as TemplateEntityV1beta2[],
);
const matchesQuery = (metadata: EntityMeta, query: string) =>
@@ -175,11 +173,7 @@ export const ScaffolderPageContents = () => {
{matchingEntities &&
matchingEntities?.length > 0 &&
matchingEntities.map((template, i) => (
-
+
))}
diff --git a/plugins/scaffolder/src/components/TemplatePage/TemplatePage.tsx b/plugins/scaffolder/src/components/TemplatePage/TemplatePage.tsx
index 3caece4878..b6cab5b620 100644
--- a/plugins/scaffolder/src/components/TemplatePage/TemplatePage.tsx
+++ b/plugins/scaffolder/src/components/TemplatePage/TemplatePage.tsx
@@ -16,7 +16,6 @@
import { JsonObject, JsonValue } from '@backstage/config';
import { LinearProgress } from '@material-ui/core';
import { FieldValidation, FormValidation, IChangeEvent } from '@rjsf/core';
-import parseGitUrl from 'git-url-parse';
import React, { useCallback, useState } from 'react';
import { generatePath, Navigate, useNavigate } from 'react-router';
import { useParams } from 'react-router-dom';
@@ -99,39 +98,6 @@ export const createValidator = (
};
};
-const storePathValidator = (
- formData: { storePath?: string },
- errors: FormValidation,
-) => {
- const { storePath } = formData;
- if (!storePath) {
- errors.storePath.addError('Store path is required and not present');
- return errors;
- }
-
- try {
- const parsedUrl = parseGitUrl(storePath);
-
- if (!parsedUrl.resource || !parsedUrl.owner || !parsedUrl.name) {
- if (parsedUrl.resource === 'dev.azure.com') {
- errors.storePath.addError(
- "The store path should be formatted like https://dev.azure.com/{org}/{project}/_git/{repo} for Azure URL's",
- );
- } else {
- errors.storePath.addError(
- 'The store path should be a complete Git URL to the new repository location. For example: https://github.com/{owner}/{repo}',
- );
- }
- }
- } catch (ex) {
- errors.storePath.addError(
- `Failed validation of the store path with message ${ex.message}`,
- );
- }
-
- return errors;
-};
-
export const TemplatePage = ({
customFieldExtensions = [],
}: {
@@ -203,15 +169,6 @@ export const TemplatePage = ({
onReset={handleFormReset}
onFinish={handleCreate}
steps={schema.steps.map(step => {
- // TODO: Can delete this function when the migration from v1 to v2 beta is completed
- // And just have the default validator for all fields.
- if ((step.schema as any)?.properties?.storePath) {
- return {
- ...step,
- validate: (a, b) => storePathValidator(a, b),
- };
- }
-
return {
...step,
validate: createValidator(step.schema, customFieldValidators),
diff --git a/plugins/scaffolder/src/filter/EntityFilterGroupsProvider.tsx b/plugins/scaffolder/src/filter/EntityFilterGroupsProvider.tsx
index 7aa1a21643..a5be11380f 100644
--- a/plugins/scaffolder/src/filter/EntityFilterGroupsProvider.tsx
+++ b/plugins/scaffolder/src/filter/EntityFilterGroupsProvider.tsx
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { TemplateEntityV1alpha1 } from '@backstage/catalog-model';
+import { TemplateEntityV1beta2 } from '@backstage/catalog-model';
import { catalogApiRef } from '@backstage/plugin-catalog-react';
import React, { useCallback, useEffect, useRef, useState } from 'react';
import { useAsyncFn } from 'react-use';
@@ -50,7 +50,7 @@ function useProvideEntityFilters(): FilterGroupsContext {
const response = await catalogApi.getEntities({
filter: { kind: 'Template' },
});
- return response.items as TemplateEntityV1alpha1[];
+ return response.items as TemplateEntityV1beta2[];
});
const filterGroups = useRef<{
@@ -64,7 +64,7 @@ function useProvideEntityFilters(): FilterGroupsContext {
[filterGroupId: string]: FilterGroupStates;
}>({});
const [filteredEntities, setFilteredEntities] = useState<
- TemplateEntityV1alpha1[]
+ TemplateEntityV1beta2[]
>([]);
const [availableCategories, setAvailableCategories] = useState([]);
const [isCatalogEmpty, setCatalogEmpty] = useState(false);
@@ -161,7 +161,7 @@ function buildStates(
filterGroups: { [filterGroupId: string]: FilterGroup },
selectedFilterKeys: { [filterGroupId: string]: Set },
selectedCategories: string[],
- entities?: TemplateEntityV1alpha1[],
+ entities?: TemplateEntityV1beta2[],
error?: Error,
): { [filterGroupId: string]: FilterGroupStates } {
// On error - all entries are an error state
@@ -208,7 +208,7 @@ function buildStates(
}
// Given all entites, find all possible categories and provide them in a sorted list.
-function collectCategories(entities?: TemplateEntityV1alpha1[]): string[] {
+function collectCategories(entities?: TemplateEntityV1beta2[]): string[] {
const categories = new Set();
(entities || []).forEach(e => {
if (e.spec?.type) {
@@ -224,9 +224,9 @@ function buildMatchingEntities(
filterGroups: { [filterGroupId: string]: FilterGroup },
selectedFilterKeys: { [filterGroupId: string]: Set },
selectedCategories: string[],
- entities?: TemplateEntityV1alpha1[],
+ entities?: TemplateEntityV1beta2[],
excludeFilterGroupId?: string,
-): TemplateEntityV1alpha1[] {
+): TemplateEntityV1beta2[] {
// Build one filter fn per filter group
const allFilters: EntityFilterFn[] = [];
for (const [filterGroupId, filterGroup] of Object.entries(filterGroups)) {
diff --git a/plugins/scaffolder/src/filter/context.ts b/plugins/scaffolder/src/filter/context.ts
index ee66e3d9da..385d3f6eb5 100644
--- a/plugins/scaffolder/src/filter/context.ts
+++ b/plugins/scaffolder/src/filter/context.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { TemplateEntityV1alpha1 } from '@backstage/catalog-model';
+import { TemplateEntityV1beta2 } from '@backstage/catalog-model';
import { createContext } from 'react';
import { FilterGroup, FilterGroupStates } from './types';
@@ -32,7 +32,7 @@ export type FilterGroupsContext = {
loading: boolean;
error?: Error;
filterGroupStates: { [filterGroupId: string]: FilterGroupStates };
- filteredEntities: TemplateEntityV1alpha1[];
+ filteredEntities: TemplateEntityV1beta2[];
availableCategories: string[];
isCatalogEmpty: boolean;
};