formatDirectory() function print id instead label

Hello, I have a problem with displaying vocabulary. I have the Id displayed instead of the labels. type an image title

Do you have an idea

0 votes

3 answers

1176 views

ANSWER

Can you provide the code of your element please?
05/19/2020

Thank you for your reply,

This is the default nuxeo element nuxeo-workspace-view-layout.html which uses nuxeo-document-content

05/19/2020

I had this problem on an infra nuxeo docker with mongodb and elasticsearch and I can't reproduce it in a dev all in one instance
05/19/2020



The problem is related to ngnix configuration.

see https://doc.nuxeo.com/nxdoc/http-and-https-reverse-proxy-configuration/#ngnix-issue for more details

0 votes



Hello,

I cannot reproduce your issue with a standard installation, even switching from EN to FR language (see screenshot).

It doesn't depend on your database, it is pure i18n issue.

Regards

0 votes



nuxeo-workspace-view-layout.html

<dom-module id="nuxeo-workspace-view-layout">

  <template>
    <nuxeo-document-content document="[[document]]"></nuxeo-document-content>
  </template>

  <script>
    Polymer({
      is: 'nuxeo-workspace-view-layout',
      behaviors: [Nuxeo.LayoutBehavior],
      properties: {
        /**
         * @doctype Workspace
         */
        document: {
          type: Object
        }
      }
    });
  </script>

</dom-module>

nuxeo-document-content from elements.html

<dom-module id="nuxeo-document-content" assetpath="nuxeo-results/">
  <template>

    <style include="nuxeo-styles">
      :host {
        display: block;
      }

      .results {
        @apply --layout-vertical;
        @apply --layout-flex;
        min-height: var(--nuxeo-document-content-min-height, calc(100vh - 216px - var(--nuxeo-app-top)));
        margin-bottom: var(--nuxeo-document-content-margin-bottom, 0);
      }

      .results.dragging {
        border: 2px dashed var(--nuxeo-primary-color);
      }

      .ellipsis {
        text-overflow: ellipsis;
        overflow: hidden;
        white-space: nowrap;
        display: block;
        width: calc(100% - 38px);
      }

      .capitalize {
        text-transform: capitalize;
      }

      nuxeo-tag {
        margin-right: 2px;
      }
    </style>

    <nuxeo-connection id="nxcon"></nuxeo-connection>

    <nuxeo-page-provider id="nxProvider" provider="[[provider]]" page-size="[[pageSize]]" aggregations="{{aggregations}}" enrichers="[[enrichers]]" params="[[params]]" schemas="[[schemas]]" headers="[[headers]]" fetch-aggregates="">
    </nuxeo-page-provider>

    <nuxeo-results id="results" display-mode="table" name="[[document.uid]]" nx-provider="[[nxProvider]]" selected-items="{{selectedItems}}" document="[[document]]" display-quick-filters="" display-sort="[[_canSort(document, sortOptions)]]" sort-options="[[sortOptions]]">
      <nuxeo-data-grid name="grid" icon="nuxeo:view-thumbnails" class="results" empty-label="[[emptyLabel]]" empty-label-when-filtered="[[emptyLabelWhenFiltered]]" selection-enabled="" draggable$="[[_hasWritePermission(document)]]" drop-target-filter="[[_dropTargetFilter]]">
        <template>
          <nuxeo-document-grid-thumbnail class="grid-box" tabindex$="{{tabIndex}}" selected$="{{selected}}" index="[[index]]" doc="[[item]]" on-navigate="_navigate" selected-items="[[selectedItems]]">
          </nuxeo-document-grid-thumbnail>
        </template>
      </nuxeo-data-grid>

      <nuxeo-data-table name="table" icon="nuxeo:view-list" class="results" settings-enabled="" empty-label="[[emptyLabel]]" empty-label-when-filtered="[[emptyLabelWhenFiltered]]" selection-enabled="" on-row-clicked="_navigate" draggable$="[[_hasWritePermission(document)]]" drop-target-filter="[[_dropTargetFilter]]">
        <nuxeo-data-table-column name="[[i18n('documentContentView.datatable.header.title')]]" field="dc:title" sort-by="[[_displaySort(document, 'dc:title')]]" filter-by="title" flex="100">
          <template>
            <nuxeo-document-thumbnail document="[[item]]"></nuxeo-document-thumbnail>
            <a class="title ellipsis" href$="[[urlFor('browse', item.path)]]" on-tap="_navigate">[[item.title]]</a>
          </template>
        </nuxeo-data-table-column>
        <nuxeo-data-table-column name="[[i18n('documentContentView.datatable.header.type')]]" field="type" hidden="">
          <template>
            <nuxeo-tag>[[formatDocType(item.type)]]</nuxeo-tag>
          </template>
        </nuxeo-data-table-column>
        <nuxeo-data-table-column name="[[i18n('documentContentView.datatable.header.modified')]]" field="dc:modified" sort-by="[[_displaySort(document, 'dc:modified')]]" filter-by="dc_modified_agg" flex="50">
          <template is="header">
            <nuxeo-dropdown-aggregation placeholder="[[i18n('documentContentView.datatable.header.modified')]]" data="[[aggregations.dc_modified_agg]]" value="{{column.filterValue}}" multiple="">
            </nuxeo-dropdown-aggregation>
          </template>
          <template>
            <nuxeo-date datetime="[[item.properties.dc:modified]]"></nuxeo-date>
          </template>
        </nuxeo-data-table-column>
        <nuxeo-data-table-column name="[[i18n('documentContentView.datatable.header.lastContributor')]]" filter-by="dc_last_contributor_agg" field="dc:lastContributor" sort-by="[[_displaySort(document, 'dc:lastContributor')]]" flex="50">
          <template is="header">
            <nuxeo-dropdown-aggregation placeholder="[[i18n('documentContentView.datatable.header.lastContributor')]]" data="[[aggregations.dc_last_contributor_agg]]" value="{{column.filterValue}}" multiple="">
            </nuxeo-dropdown-aggregation>
          </template>
          <template>
            <nuxeo-user-tag user="[[item.properties.dc:lastContributor]]"></nuxeo-user-tag>
          </template>
        </nuxeo-data-table-column>
        <nuxeo-data-table-column name="[[i18n('documentContentView.datatable.header.state')]]" field="currentLifeCycleState" hidden="">
          <template><span class="capitalize">[[formatLifecycleState(item.state)]]</span></template>
        </nuxeo-data-table-column>
        <nuxeo-data-table-column name="[[i18n('documentContentView.datatable.header.version')]]" field="versionLabel" hidden="">
          <template>
            [[formatVersion(item)]]
          </template>
        </nuxeo-data-table-column>
        <nuxeo-data-table-column name="[[i18n('documentContentView.datatable.header.created')]]" field="dc:created" sort-by="[[_displaySort(document, 'dc:created')]]" flex="50" hidden="">
          <template>
            <nuxeo-date datetime="[[item.properties.dc:created]]"></nuxeo-date>
          </template>
        </nuxeo-data-table-column>
        <nuxeo-data-table-column name="[[i18n('documentContentView.datatable.header.author')]]" field="dc:creator" sort-by="[[_displaySort(document, 'dc:creator')]]" hidden="">
          <template>
            <nuxeo-user-tag user="[[item.properties.dc:creator]]"></nuxeo-user-tag>
          </template>
        </nuxeo-data-table-column>
        <nuxeo-data-table-column name="[[i18n('documentContentView.datatable.header.nature')]]" field="dc:nature" hidden="">
          <template>
            <nuxeo-tag hidden$="[[!item.properties.dc:nature]]">
              [[formatDirectory(item.properties.dc:nature)]]
            </nuxeo-tag>
          </template>
        </nuxeo-data-table-column>
        <nuxeo-data-table-column name="[[i18n('documentContentView.datatable.header.coverage')]]" field="dc:coverage" hidden="">
          <template>
            <nuxeo-tag hidden$="[[!item.properties.dc:coverage]]">
              [[formatDirectory(item.properties.dc:coverage)]]
            </nuxeo-tag>
          </template>
        </nuxeo-data-table-column>
        <nuxeo-data-table-column name="[[i18n('documentContentView.datatable.header.subjects')]]" field="dc:subjects" hidden="" flex="60">
          <template>
            <template is="dom-repeat" items="[[item.properties.dc:subjects]]" as="subject">
              <nuxeo-tag>[[formatDirectory(subject)]]</nuxeo-tag>
            </template>
          </template>
        </nuxeo-data-table-column>
      </nuxeo-data-table>
    </nuxeo-results>

  </template>

  <script>
    Polymer({
      is: 'nuxeo-document-content',
      behaviors: [Nuxeo.DocumentContentBehavior],
      properties: {
        /**
         * The parameters to be passed on to `provider`.
         */
        params: {
          type: Object
        },
        /**
         * The name of the page provider to be used.
         */
        provider: {
          type: String,
          value: 'advanced_document_content'
        },
        /**
         * The number of results per page.
         */
        pageSize: {
          type: Number,
          value: 40
        },
        /**
         * List of comma separated values of the document schemas to be returned.
         * All document schemas are returned by default.
         */
        schemas: {
          type: String,
          value: 'dublincore,common,uid,file'
        },
        /**
         * List of content enrichers passed on to `provider`.
         * Already set by default are thumbnail, permissions and highlight.
         */
        enrichers: {
          type: String,
          value: 'thumbnail, permissions'
        },
        /**
         * The headers passed on to `provider`.
         * Already set by default are 'X-NXfetch.document': 'properties' and 'X-NXtranslate.directoryEntry': 'label'.
         */
        headers: {
          type: String,
          value: {'X-NXfetch.document': 'properties', 'X-NXtranslate.directoryEntry': 'label'}
        },
        /**
         * The label to be dislayed when there are no results.
         */
        emptyLabel: String,
        /**
         * The label to be dislayed when there are no results with filtering applied.
         */
        emptyLabelWhenFiltered: String
      },

      _computeParams: function(document) {
        if (document) {
          if (this.hasFacet(document, 'Orderable')) {
            this.$.nxProvider.set('sort', { 'ecm:pos': 'ASC' });
          } else {
            this.$.nxProvider.set('sort', {});
          }
          return { 'ecm_parentId': document.uid, 'ecm_trashed': this.isTrashed(document) }
        }
        return {};
      }
    });
  </script>

</dom-module>
0 votes



I still cannot understand this weird behavior.

In addition I have a nuxeo accessible via two DNS, I had this problem accessing via a DNS and no problem with the other.

01/22/2021