Skip to content

Removed the template type selector

Denys Mishunov requested to merge 358212-template-type-selector into master

What does this MR do and why?

  1. Completely removes the template type selector as per #358212 (comment 1230417217)
  2. Refactors a couple of inefficient JS functions to avoid unnecessarily parsing all of the template types
  3. Introduces the logic to hide the template selector when the file name doesn't match any of the predefined template types (even though we do not show the type selector)

Screenshots or screen recordings

Before After
Screenshot_2023-01-11_at_15.57.20 Screenshot_2023-01-11_at_15.57.54

How to set up and validate locally

  1. Create a new file in a repository. Try the following:
  • give the file a random name like foo. The template selector should not be shown
  • while on the edit page, rename the file to something, covered by the template types, for example LICENSE. Observe the "Apply template" dropdown to be rendered. It should contain the list of the license templates
  • while still on the edit page, rename the file to another name, covered by the template types, for example Dockerfile. Observe the "Apply templates" dropdown containing the templates for the Dockerfile now
  • save the file
  1. Click 'Edit' on the newly-created file or any other type-covered file (.gitlab-ci.yml, LICENSE, etc.). Observe the "Apply template" dropdown to be rendered right away

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #358212 (closed)

Edited by Denys Mishunov

Merge request reports