pkiraly / qa-catalogue-web

QA Catalogue / A data quality dashboard for MARC catalogues
GNU General Public License v3.0
9 stars 7 forks source link

Uniform configure which tabs to show #186

Closed nichtich closed 1 month ago

nichtich commented 1 month ago

The https://github.com/pkiraly/qa-catalogue-web?tab=readme-ov-file#configuration list default-tab, display-shacl, and display-network but the other tabs cannot be toggled the same way. There should be display-* for every tab to explicitly disable, e.g display-history=false.

This should affects the corresponding download categories. If display-issues is false then don't show the issues files in download tab.

pkiraly commented 1 month ago

I agree with the principle, but I have a problem in implementation. I would expect that a display property should have an array input with the name of tabs to display/hide. We use parse_ini_file that supports arrays, but only in one level depth. It is enough for a general setup, but does not for the multi tenant setup. (We want to use this feature to hide tabs, so instead of display=true I use hide here. It can be a follow up discussion which one is preferred.)

hide[]=completeness
hide[]=validate
hide[]=term

it works

hide[k10plus][]=completeness
hide[k10plus][]=validate
hide[k10plus][]=term

it is invalid, parser throws an error message.

We can add sections:

; general properties
hide[]=completeness
hide[]=validate
hide[]=term

; overwrite for a catalogue
[hide]
k10plus[]=completeness
k10plus[]=validate
k10plus[]=term

it somehow works:

I see two solutions:

1) adding a general property

[hide]
; general properties
general[]=completeness
general[]=validate
general[]=term
; overwrite for a catalogue
k10plus[]=completeness
k10plus[]=validate

2) parsing the list inside the Config class

either splitting the value

; general properties
hide=completeness,validate,term
; overwrite for a catalogue
hide[k10plus]=completeness,validate

or splitting the keys:

; general properties
hide[]=completeness
hide[]=validate
hide[]=term
; overwrite for a catalogue
hide.k10plus[]=completeness
hide.k10plus[]=validate
nichtich commented 1 month ago

INI files are no great configuration format, but it's doable.

I would expect that a display property should have an array input with the name of tabs to display/hide.

Sure this could be done but the current names are display-shacl and display-network so why not add display-xy for any other tab xy? I'd be surprised if mapping from these to an array is more then a couple of line in PHP.

nichtich commented 1 month ago

I've implemented the feature, so individual tabs can be hidden. Some are still shown by default also if not available, only for history there is a check whether the tab can be shown at all. All checks have been moved from template to class.