iTop icon indicating copy to clipboard operation
iTop copied to clipboard

N°2783 - Add support for custom zlists

Open Hipska opened this issue 5 years ago • 25 comments

This is a discussion with @dflaven about the possibility to let extensions add new types of ZList to be used if that extension creates a new type of presentation of the objects. I saw it is supported by MetaModel class under RegisterZList to register new types: Standard attribute lists

The only problem is that the setup compiler only compiles some predefined ZLists. I already made some changes to that, but it needs to be tested and reviewed by @Combodo.

Hipska avatar Nov 27 '19 16:11 Hipska

Any update?

Hipska avatar Jan 06 '20 10:01 Hipska

Since it is too late to integrate this properly to the 2.7, I think that we will not work on your PR until we have released the 2.7.

bruno-ds avatar Jan 06 '20 17:01 bruno-ds

Okay not work, but can someone give any actual feedback?

Hipska avatar Jan 06 '20 22:01 Hipska

Actually I like the idea of having more types of "Zlists" for many different use cases (tooltips, autocomplete...). However there is a method MetaModel::RegisterZList(...) which was supposed to be used for declaring new ZLists, so we'd better review its use (maybe obsolete the method) and check for the consequences of arbitrary ZLists before merging this PR.

dflaven avatar Feb 10 '20 10:02 dflaven

As said in the initial description, the only problem currently is that the compiler only processes a few predefined items. And this PR is fixing that.

Hipska avatar Feb 10 '20 10:02 Hipska

Hello @Hipska ,

We discussed this today with the R&D team. This indeed looks like a great idea to have more zlists and a way to define your own. However we might use a different approch, so I'm closing this PR and opening a new enhancement on the Combodo support portal (N°2783) so we can plan it and maybe have in iTop 2.8.

Feel free to open a ticket to the support, if you want the enhancement to be linked so you can be notified of its progress.

Guillaume

Molkobain avatar Feb 14 '20 12:02 Molkobain

Hi, now that 3.0 is out and the referenced bug is planned for 3.1, this PR can maybe be reconsidered?

Hipska avatar Mar 25 '22 09:03 Hipska

Hello, Indeed N°2783 isn't part of the 3.0.0 version. We have in mind a functionality to have "cards" on extkey hover (which would requires its own zlist or equivalent), and had a different design in mind... I'm setting this PR to be reviewed again so we can discuss about this again.

piRGoif avatar Apr 06 '22 14:04 piRGoif

Great to hear this!

In the meantime, I resolved the conflicts..

Hipska avatar Apr 06 '22 15:04 Hipska

Discussed today in functional review, everybody seems opened to it but:

  • Discussion must take place within the dev team to choose what would be the best implementation for this as it is creating a new extension point for the framework. Will try to make it happen before June.
  • No bandwidth for this internally for iTop 3.1, so if you (@Hipska ) feels like discussing about our future proposition and finishing the implementation it will be consider.

Molkobain avatar Apr 12 '22 15:04 Molkobain

Okay, what exactly are you expecting from me in that case? For me the PR is a finished implementation that works..

Hipska avatar Apr 12 '22 16:04 Hipska

Okay, what exactly are you expecting from me in that case? For me the PR is a finished implementation that works..

[...] Discussion must take place within the dev team to choose what would be the best implementation [...] Will try to make it happen before June.

Molkobain avatar Apr 12 '22 18:04 Molkobain

Discussion planned for Thursday

Molkobain avatar May 03 '22 14:05 Molkobain

Going forward with this, still some under laying questions that will be discussed monday or tuesday. Will do an update here then.

Molkobain avatar May 06 '22 09:05 Molkobain

Hello Thomas,

Discussion took place and decision was made about how we would like this to be implemented. This is not part of the roadmap yet so I don't know if it will ever be done but I'll put the specs below in case you want to push the PR forward.

Collection

  • Custom zlists must be defined under the /itop_design/classes/class/presentation/customs which will contain zlists brought by customizations (extensions, Designer, ...)
  • This collection node must be added empty to all standard DM classes
  • This collection node must be added empty by the compiler on XML datamodel files during the version upgrade (see iTopDesignFormat::From30To31())

Definition of the zlist

  • Each custom zlist will be represented by a <custom id="ZLIST_ID">[...]</custom> node
  • The node must contain the same XML structure as other zlists (no particular test to do at compile time)
  • Custom zlist can (optional) expose a description of their purpose so it will be displayed in the Designer as they will be no specific UI display (nothing to there for you Thomas, just to explain why it's in the example below)

Implementation

  • Compiler should append custom zlist to the standard ones (= same PHP structure)
  • Compiler should throw an exception if a custom zlist has the same name (ID) as a standard one (need for explicit ID will be added in the documentation)
  • MetaModel::GetZListItems() will be used to retrieve both standard and custom zlists. If a custom zlist does not exist, it will return an empty array as it already does.

Example

<itop_design>
    <classes>
        <class id="UserRequest">
            <presentation>
                <details>[...]</details>
                <list>[...</list>
                [...]
                <custom_presentations>
                    <custom_presentation id="webhook-action-slack">
                        <items>
                            <item id="caller_id">
                                <rank>10</rank>
                            </item>
                            <item id="org_id">
                                <rank>20</rank>
                            </item>
                        </items>
                    </custom_presentation>
                </custom_presentations>
            </presentation>
        </class>
        <class id="Incident">
            <presentation>
                <custom_presentations>
                    <custom_presentation id="webhook-action-slack">
                        <items>
                            <item id="caller_id">
                                <rank>10</rank>
                            </item>
                        </items>
                    </custom_presentation>
                </custom_presentations>
            </presentation>
        </class>
    </classes>
    <meta>
        <presentation>
            <custom_presentations>
                <custom_presentation id="webhook-action-slack">
                    <description><![CDATA[Will be used by the "Slack notification" Action to display the corresponding attributes in the Slack message. Refer to the "Webhooks integration" extension documentation for more information.]]></description>
                </custom_presentation>
            </custom_presentations>
        </presentation>
    </meta>
</itop_design>

Molkobain avatar May 18 '22 14:05 Molkobain

PS: Please let me know if you want to go forward with that or not so I can move the PR to "pending contributor" or close it, thanks.

Molkobain avatar May 18 '22 14:05 Molkobain

You can move it to Pending, I will close if I give up. Thanks for the detailed requirements, will need to have a look at it when I have some time..

Hipska avatar May 18 '22 15:05 Hipska

Thanks. I think it is really close to what you already done.

Molkobain avatar May 18 '22 15:05 Molkobain

While looking into it, I don't think customs is a correct naming as that means something totally different (douane).

Hipska avatar Jun 30 '22 09:06 Hipska

Thanks Hipska, you're right ! I'm setting this PR to be reviewed in the technical meeting today so that we can update our specs :)

piRGoif avatar Jul 05 '22 06:07 piRGoif

Can't we just do this?

<presentation>
    <details/>
    <search/>
    <list/>
    <custom id="webhook-action-slack"><items/></custom>
    <custom id="foobar"><items/></custom>
</presentation>

Hipska avatar Jul 05 '22 08:07 Hipska

Hello Thomas,

Generally, we keep node collections (items with an ID, eg. <custom id="abc">) in a container node (<customs>). I understand the "customs" word is ambiguous, could you suggest an alternative? 😁

Thanks

Molkobain avatar Jul 05 '22 14:07 Molkobain

Yeah, I know it is usually done in a container node, but this way is perfectly valid xml and makes all sub-nodes of <presentation> have the exact same structure.

What about <custom_presentation> or <custom_lists>?

Hipska avatar Jul 05 '22 15:07 Hipska

Yeah, I know it is usually done in a container node, but this way is perfectly valid xml and makes all sub-nodes of <presentation> have the exact same structure.

What about <custom_presentation> or <custom_lists>?

I'll discuss it with the team and Romain next tuesday when he'll come back. He is very picky about XML 😁

Molkobain avatar Aug 03 '22 14:08 Molkobain

Just discussed with Romain, we are ok with

<presentation>
  <details/>
  <search/>
  <list/>
  <custom_presentations>
    <custom_presentation id="slack">
      ...
    </custom_presentation>
  </custom_presentations>
</presentation>

Molkobain avatar Aug 11 '22 12:08 Molkobain

Hello Thomas, any update? If you need some info from us please let me know, if it's lack of time on your end we understand.

Molkobain avatar Nov 02 '22 18:11 Molkobain

Lack of time indeed, don’t have much time to work on these kind of projects lately.

Hipska avatar Nov 03 '22 05:11 Hipska

Closing PR as Thomas lacks time and we need to move forward with this. See #389

Molkobain avatar Jan 17 '23 19:01 Molkobain