Custom contribution in Studio UI is not updating

This is related to a question I posted a few weeks ago, https://answers.nuxeo.com/general/q/2b7e0103f3a84092af278beb46e2dbbf/Can-I-hide-Empty-Trash-from-some-users. We wanted to hide the “Empty Trash” button from everyone that is not an admin. The solution was great until we realized that users with manage permission could still see the button. We changed our filter, we are currently trying this:

<nuxeo-slot-content name="hardDeleteSelectionAction" slot="TRASH_RESULTS_SELECTION_ACTIONS" order="20">
  <template>
    <nuxeo-filter document="[[document]]" permission="Everything" user="[[user]]">
      <template>
        <nuxeo-delete-documents-button documents="[[selectedItems]]" hard></nuxeo-delete-documents-button>
      </template>
    </nuxeo-filter>
</nuxeo-slot-content>

But we can't get our changes to reflect locally. We have tried to filter to users with ReadWrite as a test and it still didn't change, users with manage could still see the button and when we changed them to edit they couldn't see the button. We tried removing the code entirely and we had the same results. We figure something is cached or somehow stuck but we don't know what to do to get our changes to reflect. Any help on knocking something loose so we can see our changes?

0 votes

3 answers

781 views

ANSWER



We were able to figure out how to hide the “Empty Trash” action from all non-admin users. Here is what we did:

  1. Created a new custom element for nuxeo-document-trash-content starting with the default code.

  2. Added a line in that element for <nuxeo-connection role="widget" user="{{user}}"></nuxeo-connection>

  3. With that, we can filter the code that specifies the “Empty Trash” action (can only use the user.isAdministrator with the nuxeo-connection listed above:

    <div slot="actions">
    <template is="dom-if" if="[[user.isAdministrator]]">
    <paper-button noink on-tap="_emptyTrash">[[i18n('documentTrashContent.emptyTrash')]]</paper-button>
    </template>
    </div>
    
  4. Then we made an override of the documentTrashPage slot content to point to our custom element; and with that our code works as expected (note the order is bumped to 49 from 50 to have it show before the default contribution).

    <link rel="import" href="elements/nuxeo-results/custom-document-trash-content.html">
    <nuxeo-slot-content name="documentTrashPage" slot="DOCUMENT_VIEWS_PAGES" order="49">
    <template>
    <nuxeo-filter document="[[document]]" facet="Folderish">
      <template>
        <custom-document-trash-content name="trash" document="[[document]]" provider="advanced_document_content"></custom-document-trash-content>
      </template>
    </nuxeo-filter>
    </template>
    </nuxeo-slot-content>
    

Hope this helps someone else.

0 votes



Hello Eric,

So yes, that's typically something related to cache. Personally, I recommend Clear Cache chrome extension (https://chrome.google.com/webstore/detail/clear-cache/cppjkneekbjaeellbfkmgnhonkkjfpdn?hl=en). It also exists in FF. In the settings, just keep selected:

  • App Cache
  • Cache

BTW, you can add multiple entries on a filter for a slot contribution :

<nuxeo-filter document="[[document]]" permission="Everything,ReadWrite" user="[[user]]">

It will work.

Good luck

0 votes



Here are some things that you can try to get the update unstuck.

1) Check the nxserver/bundles folder for duplicate JARs of your nuxeo package. I have often had issues where Nuxeo's reload mechanism leaves an old package in there from another branch. 2) Completly uninstall the package and reinstall from the command line 3) Make a completely separate change and see if that shows up. This is more of a sanity check

0 votes