Surf Extension Module file generates conflict in Document Library UI for custom actions

cancel
Showing results for 
Search instead for 
Did you mean: 
zlucy82
Active Member II

Surf Extension Module file generates conflict in Document Library UI for custom actions

Jump to solution

Hi all,
I have created two repo and share amps to implement two news different actions that calls two different webscripts in Alfresco and i need to view them in the Document Library UI. I've followed this link: https://docs.alfresco.com/5.1/tasks/dev-extensions-share-tutorials-add-action-doclib.html I have followed the approach to develop a new Surf Extension Module for every action; but, after i have installed them in Alfresco, i've notice that only one action is visible in Document Library UI. I've resolved it by configuring the share-config-custom.xml in one of the two share amp, but i would like to know why two Surf Extension Module files have conflicts when overriding the DocLibActions ?
Thank you much.

1 Solution

Accepted Solutions
douglascrp
Advanced II

Re: Surf Extension Module file generates conflict in Document Library UI for custom actions

Jump to solution

You used the same module id "Aggiunta Azioni custom alla Library Actions" for both modules.

I guess that is why you are facing that problem.

View solution in original post

5 Replies
afaust
Master

Re: Surf Extension Module file generates conflict in Document Library UI for custom actions

Jump to solution

It depends on how you configured the actions. Do they have the same ID? Does the inclusion in the action group(s) have the same index? Did you use replace="true" on any configuration?

Unless you have configured some aspects of the actions to be identical, action definitions from different Surf extension modules should not conflict with each other.

zlucy82
Active Member II

Re: Surf Extension Module file generates conflict in Document Library UI for custom actions

Jump to solution

I have configured the actions to be different, they have a different id, a different index in action group and neither has the tag replace = "true".

I post below the code of the configurations files.

The first file is  "print-pdf-actions-share-extensions.xml" placed in print-pdf-actions-share/src/main/amp/config/alfresco/web-extension/site-data/extensions/

<extension>
  <modules>
    <module>
      <id>Aggiunta Azioni custom alla Library Actions</id>
      <version>1.0</version>
      <auto-deploy>true</auto-deploy>
      <configurations>
               <config evaluator="string-compare" condition="DocLibActions">
                    <actions>
                         <action id="print-pdf" type="javascript" label="actions.print.pdf" icon="print-pdf">
                              <param name="function">onViewPrintablePDF</param>
                              <param name="action">print-pdf</param>
                              <param name="active">true</param>
                              <param name="successMessage">message.print-pdf.success</param>
                              <param name="failureMessage">message.print-pdf.failure</param>
                         </action>
                    </actions>
                    
                    <actionGroups>
                              <actionGroup id="document-browse">
                                   <action index="400" id="print-pdf" />
                              </actionGroup>
                              <actionGroup id="document-details">
                                   <action index="400" id="print-pdf" />
                              </actionGroup>
                         </actionGroups>
               </config>
               
               <config evaluator="string-compare" condition="DocLibCustom">
                    <dependencies>
                        <js src="resources/print-pdf-actions-share/components/documentlibrary/custom-doclib-actions.js" />
                    </dependencies>
                </config>
          </configurations>
          
    </module>
  </modules>
</extension>

The second file is "printProtocol-share-extensions.xml" placed in printProtocol-share/src/main/amp/config/alfresco/web-extension/site-data/extensions/

<extension>
  <modules>
    <module>
      <id>Aggiunta Azioni custom alla Library Actions</id>
      <version>1.0</version>
      <auto-deploy>true</auto-deploy>
      <configurations>
               <config evaluator="string-compare" condition="DocLibActions">
                    <actions>
                         <action id="print-protocol" type="javascript" label="printProtocol.label" icon="print-protocol">
                              <param name="function">onViewPrintableProtocol</param>
                              <param name="action">print-protocol</param>
                              <param name="active">true</param>
                              <param name="successMessage">printProtocol.msg.success</param>
                              <param name="failureMessage">printProtocol.msg.failure</param>
                        <evaluator>evaluator.doclib.action.isProtocolloPosta</evaluator>
                         </action>
                    </actions>
                    
                    <actionGroups>
                              <actionGroup id="document-browse">
                                   <action index="401" id="print-protocol" />
                              </actionGroup>
                              <actionGroup id="document-details">
                                   <action index="401" id="print-protocol" />
                              </actionGroup>
                         </actionGroups>
               </config>
               
               <config evaluator="string-compare" condition="DocLibCustom">
                     <dependencies>
                        <js src="resources/printProtocol-share/components/documentlibrary/prinProtocol-doclib-actions.js" />
                    </dependencies>
               </config>
          </configurations>
          
    </module>
  </modules>
</extension>

What did i do wrong?

douglascrp
Advanced II

Re: Surf Extension Module file generates conflict in Document Library UI for custom actions

Jump to solution

You used the same module id "Aggiunta Azioni custom alla Library Actions" for both modules.

I guess that is why you are facing that problem.

afaust
Master

Re: Surf Extension Module file generates conflict in Document Library UI for custom actions

Jump to solution

Yes, extremely likely that is the problem. Those IDs must be universally unique between all Surf extension modules to not cause conflicts.

zlucy82
Active Member II

Re: Surf Extension Module file generates conflict in Document Library UI for custom actions

Jump to solution

Yes, this was the problem, i have changed the id in one module and now see all actions! Thank you