fix(scaffolder): make integration work

This commit is contained in:
Ivan Shmidt
2020-06-29 14:55:00 +02:00
parent 3e0916ad05
commit 97f3d6b056
4 changed files with 62 additions and 46 deletions
@@ -11,8 +11,17 @@ spec:
processor: cookiecutter
type: website
path: '.'
parameters:
component_name:
title: Component name
type: string
description: Name of the component
schema:
required:
- component_id
- description
properties:
component_id:
title: Name
type: string
description: Unique name of the component
description:
title: Description
type: string
description: Description of the component
@@ -98,6 +98,7 @@ export class JobProcessor implements Processor {
try {
// Run the handler with the context created for the Job and some
// Additional logging helpers.
stage.status = 'STARTED';
const handlerResponse = await stage.handler({
...job.context,
logger,
@@ -1,3 +1,18 @@
/*
* Copyright 2020 Spotify AB
*
* 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, { useState } from 'react';
import useStaleWhileRevalidate from 'swr';
import { useParams } from 'react-router-dom';
@@ -43,8 +58,9 @@ export const CreatePage = () => {
const [jobId, setJobId] = useState<string | null>(null);
const handleClose = () => setJobId(null);
if (!template && isValidating) return <LinearProgress />;
if (!template || !template?.spec?.parameters) return null;
if (!template || !template?.spec?.schema) return null;
const handleCreate = async () => {
const job = await scaffolderApi.scaffold(template, formState);
@@ -63,10 +79,9 @@ export const CreatePage = () => {
subtitle="Create new software components using standard templates"
/>
<Content>
<ContentHeader
title={template.metadata.title as string}
></ContentHeader>
<ContentHeader title={template.metadata.title as string} />
{jobId && <JobStatusModal jobId={jobId} onClose={handleClose} />}
{/* <JSSONFormsStepper schemas={} */}
<SimpleStepper
onStepChange={(_prevStep, nextStep) => {
if (nextStep === 2) {
@@ -80,7 +95,7 @@ export const CreatePage = () => {
onChange={handleChange}
schema={{
$schema: 'http://json-schema.org/draft-07/schema#',
properties: template?.spec?.parameters,
...template?.spec?.schema,
}}
>
<Button hidden />