I plan to create an extension, and in that extension, I wish to add a presentation field if another extension is already present, but if possible, without having to deal with two versions of the module.
How I'm able to do that to my knowledge : Version A doesn't add the presentation field at all Version B with a dependency to the other module and adding every time the presentation field.
I don't see in the different delta="..." values a solution for this external dependencies.
That would be a _delta="define if 'ClassA' exists"
OTOH, I imagine (but never tested it) that if my new module has to extend another optional complementary module (implementting the class "ClassA"), I could write in the ModuleB definition :
Hello,
_delta="if_exists" on the right node (not the class but lower) would fit the need I think. Can you explain which presentation field you want to override ? We need to see if it's really applicable (host node need to have an id attribute)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I can't see an "easier sample" to explain my quest.
Say I am creating a whole new device witch is rackable.
but I'm also a fan of molkobain's datacenterview.
So I wish to propose the 'vertical_u' option in my device presentation if the molkobain-datacenter extension is present.
In pseudo-code, that could give something like that in the xml file :
by not having this option (I think !) I only see two solutions :
1) two differents versions of the same package (ugly)
2) One version of the package, + a delta package depending on my package and on molkobain's.
Multiply that situation by 5 or 6 possibles extensions... That create an interesting plan of installation/update :)
Thanks,
Pascal
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Many thanks for this comprehensive example.
That was read by lots of people at Combodo, from product team and dev.
We don't have an answer right now of course but this is a very interesting use case that we need to address.
👍
1
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
May I propose another approch? Using the auto-select feature of a module.
If you look at the itop-full-itil module in iTop, you will see that it is selected/installed automatically when both itop-request-mgmt-itil and itop-incident-mgmt-itil are selected/installed.
The same could be done with your case maybe? You could make a separate module including only datamodel changes relative to the molkobain-datacenter-view and put a similar condition.
In the end, you will have to different modules, but you won't have to worry about the presence of the datacenter view one, making it more flexible and robust.
Note: For info on how to package several modules as one extension, take a look a this folder and post your questions here if necessary.
Hope this helps! 😊
Guillaume
👍
3
Last edit: Molkobain 2019-11-10
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
unfortunatelly, this doesnn't seems to work (at least to my understanding).
What i did :
I created à new (empty at this time) extension named schirrms-generic-connection-to-Datacenter-view
Here is the module file :
SetupWebPage::AddModule(__FILE__, //Pathtothecurrentfile, allotherfilenamesarerelativetothedirectorycontainingthisfile'schirrms-generic-connection-to-Datacenter-view/0.1.0',
array(//Identification//'label'=>'Extensions for integrating Schirrms-Generic-Connection to Molkobain-Datacenter-View',
'category'=>'business',
//Setup//'dependencies'=>array(//'schirrms-generic-connection/0.7.2',
//'molkobain-datacenter-view/1.5.1'),
'mandatory'=>false,
'visible'=>true,
'auto_select'=>'SetupInfo::ModuleIsSelected("schirrms-generic-connection") && SetupInfo::ModuleIsSelected("molkobain-datacenter-view")',
//Components//
....
With that and my existing extension, I built an 'extension bundle' (can we call it this way ?)
Usinf itop-full-itil as an example, at first try, I add the two components as needed dependencies, and I tried an installtion on a system without molkobain-datacenter-view.
Then I commented the dependencies and the installtion went fine, but, in the iTop information for the support, I see that in the --Actual Modules installed ---
OK, trying to go a little urther, I put some little thing in the extension.
First, the toolkit complaints because of a dependencies on my main extension (witch wad bad itself , as I tougth that the 'auto_select( funct will block the installtion because of one missing dependency)
Then, after repositionneing the dependency, the toolkit complains loudly :
I made another extension to deal with the (two !) display fields that I wanted to add in my case, but didn't finf time to test it (Week-End was already full of iTop !)
Not very nice, indeed... But should do the work. I have so many other points until 'my' iTop is complete. (That is maybe the biggest strength of iTop being so much customizable, but it's also a weakness : It can be a never ending story!)
Pascal
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I plan to create an extension, and in that extension, I wish to add a presentation field if another extension is already present, but if possible, without having to deal with two versions of the module.
How I'm able to do that to my knowledge :
Version A doesn't add the presentation field at all
Version B with a dependency to the other module and adding every time the presentation field.
I don't see in the different delta="..." values a solution for this external dependencies.
That would be a
_delta="define if 'ClassA' exists"
OTOH, I imagine (but never tested it) that if my new module has to extend another optional complementary module (implementting the class "ClassA"), I could write in the ModuleB definition :
What did I miss ?
Thanks,
Pascal
Last edit: schirrms 2019-10-17
Hello,
_delta="if_exists" on the right node (not the class but lower) would fit the need I think. Can you explain which presentation field you want to override ? We need to see if it's really applicable (host node need to have an id attribute)
Hi Pierre,
OK, I'll write a more precise sample, let me think of the good way of doing this.
Thanks,
Pascal
Hi Pierre,
I can't see an "easier sample" to explain my quest.
Say I am creating a whole new device witch is rackable.
but I'm also a fan of molkobain's datacenterview.
So I wish to propose the 'vertical_u' option in my device presentation if the molkobain-datacenter extension is present.
In pseudo-code, that could give something like that in the xml file :
by not having this option (I think !) I only see two solutions :
1) two differents versions of the same package (ugly)
2) One version of the package, + a delta package depending on my package and on molkobain's.
Multiply that situation by 5 or 6 possibles extensions... That create an interesting plan of installation/update :)
Thanks,
Pascal
Many thanks for this comprehensive example.
That was read by lots of people at Combodo, from product team and dev.
We don't have an answer right now of course but this is a very interesting use case that we need to address.
Hi Pierre,
Thanks for pushing our ideas inside Combodo. I really like the fact that the Combodo team try to stay in touch with the users.
Thanks,
Pascal
We've had the same thing; and did end up with an additional package which adds more specific changes upon a generic extension :)
There's at least one other option, Pascal.
3) One version but with a lot more PHP programming rather than XML. Actually playing with that myself to add a brand new attribute type to Person.
Hi Jeffrey,
Sounds interresting !
Can you somewhat explains a little bit more the way for doing that ?
Thanks,
Pascal
Not much yet, still experimenting myself with it to see if there are any other unwanted consequences.
Hello Pascal, I hope you are well!
May I propose another approch? Using the auto-select feature of a module.
If you look at the itop-full-itil module in iTop, you will see that it is selected/installed automatically when both itop-request-mgmt-itil and itop-incident-mgmt-itil are selected/installed.
File datamodels/2.x/itop-full-itil/module.itop-full-itil.php:
The condition HAS to be a PHP expression.
The same could be done with your case maybe? You could make a separate module including only datamodel changes relative to the molkobain-datacenter-view and put a similar condition.
In the end, you will have to different modules, but you won't have to worry about the presence of the datacenter view one, making it more flexible and robust.
Note: For info on how to package several modules as one extension, take a look a this folder and post your questions here if necessary.
Hope this helps! 😊
Guillaume
Last edit: Molkobain 2019-11-10
Thanks for pointing this one out, it seems interesting! :)
Hi Guillaume,
Glad to see you here again :)
I'll try this solution this WE, hopefuly :) Still, an embedded 'define if exists classs' delta would be much simpler :)
I'll let you know.
Thanks,
Pascal
Hi,
unfortunatelly, this doesnn't seems to work (at least to my understanding).
What i did :
I created à new (empty at this time) extension named schirrms-generic-connection-to-Datacenter-view
Here is the module file :
With that and my existing extension, I built an 'extension bundle' (can we call it this way ?)
Usinf itop-full-itil as an example, at first try, I add the two components as needed dependencies, and I tried an installtion on a system without molkobain-datacenter-view.
I ran the setup, and got that :
Then I commented the dependencies and the installtion went fine, but, in the iTop information for the support, I see that in the --Actual Modules installed ---
So I believe this doesn't work
Other informations about my installation :
Thanks,
Pascal
OK, trying to go a little urther, I put some little thing in the extension.
First, the toolkit complaints because of a dependencies on my main extension (witch wad bad itself , as I tougth that the 'auto_select( funct will block the installtion because of one missing dependency)
Then, after repositionneing the dependency, the toolkit complains loudly :
Any ideas ?
Not such a big deal, I'll just deliver the two extensions separately. But it's a little annoying :)
Thanks,
Pascal
Hello Pascal,
Did you managed to deal with this?
Hi Guillaume,
I gave up :)
I made another extension to deal with the (two !) display fields that I wanted to add in my case, but didn't finf time to test it (Week-End was already full of iTop !)
Not very nice, indeed... But should do the work. I have so many other points until 'my' iTop is complete. (That is maybe the biggest strength of iTop being so much customizable, but it's also a weakness : It can be a never ending story!)
Pascal
I totally understand you when you are saying that iTop can be time consumming on your spare time... 😇