sphinx-needs icon indicating copy to clipboard operation
sphinx-needs copied to clipboard

Display name for needs_extra_options

Open twodrops opened this issue 4 years ago • 7 comments

It would be nice to have a possibility to specify an additional name for needs_extra_options. For example, an internal name (as of now) and an external name which is then displayed in, for instance, needtable.

This might require the specification of needs_extra_options similar to needs_types

needs_extra_options= [dict(option="sec-asm, title="Security Assumption") ]

This could be extended with additional attributes in the future.

twodrops avatar Jun 23 '21 08:06 twodrops

Also thought about this in the past.

Another solution would be to allow custom names for columns in needtable and co.:

.. needtable::
   :filter: status == "open"
   :columns: id, title, option_1, option_2
   :titles: ID, Title, Number 1, Another option

I sometimes have the use case, where I need really short names for a table, as it has many (>10) columns. On another table, the same columns names could be longer, as I only need 2-3 columns.

I'm just thinking, which solution would be more helpful. But I came to the conclusion that maybe having both of it would be perfect.

What do you think, would custom column names in needtable and co. be helpful also for your cases? If yes, I will create a new feature request.

danwos avatar Jun 24 '21 06:06 danwos

I also feel both options are good.

I am wondering if the feature in needtable could result in some "confusions" because of the duplication within needtable.

For example, someone starts with

.. needtable::
   :filter: status == "open"
   :columns: id, title, option_1, option_2
   :titles: ID, Title, Number 1, Another option

Later changes the option to be displayed from option_2 to option_3 to but forgets to rename the title of option_3 from Another option to something else.

.. needtable::
   :filter: status == "open"
   :columns: id, title, option_1, option_3
   :titles: ID, Title, Number 1, Another option

This could lead to some unforeseen debugging efforts. Having it central in needs_extra_options ONLY avoids this.

I don't know if this is technical possible but if something like below is possible, it could minimize this

.. needtable::
   :filter: status == "open"
   :columns: id as "ID", title, option_1 as "Number 1", option_3

twodrops avatar Jun 24 '21 07:06 twodrops

Have created #299 for the needtable column title feature.

danwos avatar Jun 24 '21 10:06 danwos

I would also love to have this feature needs_extra_options= [dict(option="sec-asm, title="Security Assumption") ] looks like a good canditate.

StephanKuempel avatar May 05 '22 08:05 StephanKuempel

The change will not be so easy, as a lot of code is working with needs_extra_options. So changing the allowed data types would affect a lot of code, which is not related to this new feature.

Maybe it is easier to introduce a new config variable, like needs_option_titles = {"new_option": "Another Name"}. It's not the best solution for user experience, but it would have the lowest impact on our code.

Just to be clear, to add a new option with a custom name, both config vars needs_extra_options and needs_option_titles need to be configured!

danwos avatar May 09 '22 06:05 danwos

@danwos I think the needs_option_titles could be a good compromise. @twodrops, what do you think ? I had another idea as a workaround: Since it is something which is defining the view of the data, it might also be feasible to just define a needs_layout. But that is too much overhead to achieve this.

StephanKuempel avatar May 09 '22 07:05 StephanKuempel

@danwos @StephanKuempel I find needs_option_titles = {"new_option": "Another Name"} not the most ideal, but as you both mentioned, the most low impact solution for now.

twodrops avatar May 10 '22 10:05 twodrops