question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Boolean fields doesn't work properly in scaffolder templates after Start Over

See original GitHub issue

Expected Behavior

Consider the following piece of scaffolder template:

spec:
  owner: dx-team
  type: website

  # these are the steps which are rendered in the frontend with the form input
  parameters:
    - title: Docker registry
      properties:
        setup_docker_registry:
          title: Setup Docker registry
          type: boolean
          default: false

If we do not select this checkbox (false state), and after creating the project from the template we press the “start over” button, then the checkbox will become active.

Снимок экрана 2022-01-25 в 08 26 19

Expected Behavior: checkmark in false state

Current Behavior

In the picture above, you can see that setup_docker_registry URL param is set to false, but the checkbox is set to true.

Possible Solution

I think the problem is the wrong typecasting. All parameters from the URL are read as strings, and in this case the string must be converted to boolean.

Steps to Reproduce

  1. Create template from the following manifest
apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
metadata:
  name: react
  title: React project template
  description: Template from which you can create a frontend application
  tags:
    - frontend
    - template
spec:
  owner: dx-team
  type: website
  parameters:
    - title: Docker registry
      properties:
        setup_docker_registry:
          title: Setup Docker registry
          type: boolean
          default: false
  1. Register this template in your backstage app
  2. go to the page for creating a project from this template
  3. Leave checkbox unchecked (false state)
  4. start project creating
  5. Press “Start Over” button

Context

This bug leads to bad UX when using project templates

Your Environment

$ /app/node_modules/.bin/backstage-cli info
OS:   Linux 4.18.0-305.7.1.el8_4.x86_64 - linux/x64
node: v16.13.2
yarn: 1.22.15
cli:  0.11.0 (installed)

Dependencies:
  @backstage/app-defaults                                  0.1.4
  @backstage/backend-common                                0.10.3
  @backstage/backend-tasks                                 0.1.3
  @backstage/catalog-client                                0.5.4
  @backstage/catalog-model                                 0.9.9
  @backstage/cli-common                                    0.1.6
  @backstage/cli                                           0.11.0
  @backstage/config-loader                                 0.9.2
  @backstage/config                                        0.1.12
  @backstage/core-app-api                                  0.4.0
  @backstage/core-components                               0.7.6, 0.8.4
  @backstage/core-plugin-api                               0.1.13, 0.2.2, 0.5.0
  @backstage/dev-utils                                     0.2.17
  @backstage/errors                                        0.1.5, 0.2.0
  @backstage/integration-react                             0.1.18
  @backstage/integration                                   0.7.1
  @backstage/plugin-api-docs                               0.6.22
  @backstage/plugin-app-backend                            0.3.21
  @backstage/plugin-auth-backend                           0.6.2
  @backstage/plugin-catalog-backend                        0.20.0
  @backstage/plugin-catalog-common                         0.1.0
  @backstage/plugin-catalog-import                         0.7.9
  @backstage/plugin-catalog-react                          0.6.11
  @backstage/plugin-catalog                                0.7.8
  @backstage/plugin-github-actions                         0.4.31
  @backstage/plugin-org                                    0.3.34
  @backstage/plugin-permission-common                      0.3.1
  @backstage/plugin-permission-node                        0.3.0
  @backstage/plugin-permission-react                       0.2.2
  @backstage/plugin-proxy-backend                          0.2.15
  @backstage/plugin-scaffolder-backend-module-cookiecutter 0.1.8
  @backstage/plugin-scaffolder-backend                     0.15.20
  @backstage/plugin-scaffolder-common                      0.1.2
  @backstage/plugin-scaffolder                             0.11.18
  @backstage/plugin-search-backend-node                    0.4.4
  @backstage/plugin-search-backend                         0.3.0
  @backstage/plugin-search                                 0.5.5
  @backstage/plugin-sentry                                 0.3.33
  @backstage/plugin-tech-radar                             0.5.2
  @backstage/plugin-techdocs-backend                       0.12.3
  @backstage/plugin-techdocs                               0.12.14
  @backstage/plugin-todo-backend                           0.1.18
  @backstage/plugin-todo                                   0.1.18
  @backstage/plugin-user-settings                          0.3.16
  @backstage/search-common                                 0.2.1
  @backstage/techdocs-common                               0.11.3
  @backstage/test-utils                                    0.2.2
  @backstage/theme                                         0.2.14
  @backstage/types                                         0.1.1
  @backstage/version-bridge                                0.1.1
Done in 1.10s.
  • Browser Information: Chrome, Safari (last versions)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
snehaljoscommented, Jan 25, 2022

Hi, @benjdlambert am interested to contribute, can I?

0reactions
benjdlambertcommented, Feb 17, 2022

Yes, sorry just something I forgot to clean up!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Writing Templates · Backstage Software Catalog and ...
You can create your own templates with a small yaml definition which describes the template and its metadata, along with some input variables...
Read more >
ASP.NET MVC - Override the Default Scaffold Templates
Explore the CRUD Scaffold Workflow. Let's first examine the default scaffold's function. I'll add a controller by right-clicking the Web project's Controllers ...
Read more >
SilverStripe 4.3.1 - Convert default boolean value to Yes or No ...
I have managed to identify the code that is causing the error. In the private static $summary_fields I have a Boolean and this...
Read more >
ASP.NET MVC Interview Questions - C# Corner
NET classes derived from System.Attribute which can be attached to classes, methods, properties, and fields. ASP.NET MVC provides the following ...
Read more >
Lightning Aura Components Developer Guide
To work with Lightning apps and components, create a Developer Edition org. Note: For this quick start tutorial, you don't need to create...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found