Highlights of the OBS frontend development – Sprint 24

Here are the results the OBS frontend team has achieved in the last two weeks (2017-09-04 to 2017-09-18).

Features

Implement group request page

We have several different ways to view submit and review requests in the web interface, e.g. on the user or project pages. However, some users are members of several different groups, which makes their user page quite crowded.

Therefore it was requested by the openSUSE review team to have a dedicated page for the group requests and reviews which we implemented in this sprint.

Group requests show page

Make it easy to add OBS repositories in the kiwi editor

Now when adding a repository to a Kiwi image using the Kiwi editor you will land in an "easy" mode that autocompletes what you type searching for OBS repositories in the instance you are. If you still want to have the full control you only need to go to the 'Expert mode' and tweak things there.

The new dialog for adding repositories looks like this:

in comparison to the expert mode:

Kiwi Editor - use project repositories

In the Kiwi editor we added a checkbox to use the repositories from the current project. This option will remove the other repositories of the Kiwi image and also from the Kiwi file.

To know more about this feature I invite you to have look into the PR#3769

Kiwi Editor - user project repositories

Show dirty state flag in project/show build results

When the repository state is in a dirty state, a yellow triangle with an exclamation mark is shown in the icon. While this is already implemented on the project monitor page, Coolo reported that this is not the case on the project page. Repository dirty state

Build job history source change link

When viewing the build job history, if the job was a source change then you can click a link to view the source diff.

Repository dirty state

Refactoring

Introducing query objects for requests

Query requests can be difficult, because of many different possible conditions. For instance, if you want to fetch all requests for a user you have to consider all projects and packages the user is a maintainer and the groups the user is member of. Putting the different types and states of requests and reviews into the mix makes queries just really complicated.

So far, we had a class method in the request model which ate all the different query parameters and created the necessary SQL string from it. However, this had several disadvantages. First of all, these several hundred lines of code messed up the request model and made it really hard to test in isolation. Furthermore it violated badly the Single Responsibilty Principle and made use of inefficient raw SQL queries.

Therefore we decided to refactor it in several steps. The first step which we finished in this sprint was to move all this code from the request model to dedicated query classes. For now we introduced four different classes: BsRequest::FindFor::User, BsRequest::FindFor::Group, BsRequest::FindFor::Project and finally BsRequest::FindFor. Additionally we introduced also tests for the user and group classes to continue with refactoring the actual query code in a future sprint. Have a look at PR#3751 and PR#3762 if you want to learn more about query objects.

Bugfixes

Sticking with int datatype for id column

The new Ruby on Rails version 5.1 uses now the bigint datatype instead of int for the id column of new database tables. We invested some time and investigated how this change would impact OBS and decided to stick with int for now. However, recently we introduced a few new tables which we needed to migrate back because joining of tables which use the new type with tables with the old would not be possible. Furthermore we introduced a test in our CI to make sure that we don't introduce tables with bigint ids by accident in the future.

To quote Rob Cameron: If future me is reading this after getting our 4 billionth user: it seemed like a reasonable tradeoff at the time!

Test suite migration

We continued migrating tests to Rspec and fixing flickering tests:

  • Added a spec for BuildLogSupport mixins (PR#3813)
  • Set user on project tests (PR#3821)