openSUSE / open-build-service

Build and distribute Linux packages from sources in an automatic, consistent and reproducible way #obs
https://openbuildservice.org
GNU General Public License v2.0
907 stars 436 forks source link

plugable tabs in project view #2726

Open lnussel opened 7 years ago

lnussel commented 7 years ago

The project view shows a number of tabs as can be seen here: https://build.opensuse.org/project/show/openSUSE:Factory

The available tabs are hardcoded in https://github.com/openSUSE/open-build-service/blob/master/src/api/app/views/webui/project/_tabs.html.erb so plugable engines like the Factory dashboard can't add more.

Please provide hooks to allow adding tabs via engine

mschnitzer commented 7 years ago

@lnussel could you make an example of how you would like to add tabs?

lnussel commented 7 years ago

I have no clue about rails, so don't ask me about the how :) There's for example the dashboard engine (https://github.com/openSUSE/obs_factory) which may want to add a tab for itself for projects it cares for.

hennevogel commented 7 years ago

There is no non-hackish way to do that. Only nasty ways like conditional rendering of tab entries based on if an engine is there or not...

lnussel commented 7 years ago

maybe something like

<% @extra_tabs.each do |args| %> <%= tab args %> <% end %>

where the arguments for @extra_tabs could be populated by an engine during init?

lnussel commented 7 years ago

actually if a loop works there the logic what to put in the array could be moved from the view to the controller.

coolo commented 7 years ago

that's not the challenge - the challenge is how to give the engine a way to change the data