Skip to content

Commit

Permalink
Merge branch 'maintenance-3.1.x' into 2023-snapshot-gnerate
Browse files Browse the repository at this point in the history
  • Loading branch information
alokhyland authored Jul 8, 2024
2 parents d224f13 + aa8327f commit eac8b7e
Show file tree
Hide file tree
Showing 16 changed files with 40 additions and 61 deletions.
2 changes: 1 addition & 1 deletion .env.sample
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
NUXEO_WEB_UI_VERSION=3.1.10-SNAPSHOT
NUXEO_WEB_UI_VERSION=3.1.11-SNAPSHOT
NUXEO_VERSION=master
NUXEO_PACKAGES=nuxeo-drive nuxeo-liveconnect nuxeo-template-rendering
NUXEO_DEV_MODE=true
Expand Down
2 changes: 1 addition & 1 deletion charts/preview/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ apiVersion: v1
description: A Helm chart for Web UI preview
icon: https://media.licdn.com/dms/image/C4D0BAQFPXiXFrp4LBA/company-logo_200_200/0?e=2159024400&v=beta&t=RW9EU0QUciUVuPSpLySd9FtJ2yG-O37_hAAvc32f6ro
name: preview
version: 3.1.10-SNAPSHOT
version: 3.1.11-SNAPSHOT
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ Polymer({

_openDialog() {
this.dialog.open();
this.fire('dialog-opened');
},

_closeDialog() {
Expand Down
38 changes: 1 addition & 37 deletions elements/routing.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,36 +27,6 @@ function scrollToTop(ctx, next) {
next();
}

function createUrlFromString(str) {
const httpRegex = /^https?:\/\//;
const wwwRegex = /www\./;
str = httpRegex.test(str) ? str : `http://${str}`;
str = wwwRegex.test(str) ? str : str.replace(/^(https?:\/\/)?/, '$1www.');
return str;
}

function isTrustedDomain(path) {
const trustedDomains = Nuxeo && Nuxeo.UI && Nuxeo.UI.config && Nuxeo.UI.config.trustedDomains;
if (!trustedDomains) return true;
const modifiedPathUrl = createUrlFromString(path);
const pathUrl = new URL(modifiedPathUrl);
const { hostname: userHostName } = pathUrl;
const trustedDomainList = trustedDomains.split(',');
const isValidUrl = trustedDomainList.some((url) => {
const updatedUrl = createUrlFromString(url);
const { hostname: currentUrlHostName } = new URL(updatedUrl);
return currentUrlHostName?.toLowerCase() === userHostName?.toLowerCase();
});
return isValidUrl;
}

function encodeQueryParams(path) {
const pathUrl = new URL(path);
const queryParams = pathUrl.search.split('?')[1];
const encodepath = queryParams ? `${pathUrl.origin}?${encodeURIComponent(queryParams)}` : path;
return encodepath;
}

function _routeAdmin(selectedAdminTab, errorPath, routeData) {
const hasPermission =
app.currentUser.isAdministrator || app.currentUser.extendedGroups.find((grp) => grp.name === 'powerusers');
Expand Down Expand Up @@ -226,13 +196,7 @@ app.router = {
}
const isFullpath = /^http(s)?:\/\//.test(path);
if (isFullpath) {
const isValidUrl = isTrustedDomain(path);
if (isValidUrl) {
const encodepath = encodeQueryParams(path);
const link = document.createElement('a');
link.setAttribute('href', encodepath);
link.click();
}
window.location = path;
} else {
page(path);
}
Expand Down
27 changes: 22 additions & 5 deletions elements/search/nuxeo-search-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import { Polymer } from '@polymer/polymer/lib/legacy/polymer-fn.js';
import { html } from '@polymer/polymer/lib/utils/html-tag.js';
import { Debouncer } from '@polymer/polymer/lib/utils/debounce.js';
import { timeOut } from '@polymer/polymer/lib/utils/async.js';
import { FormatBehavior } from '@nuxeo/nuxeo-ui-elements/nuxeo-format-behavior.js';

/**
`nuxeo-search-form`
Expand Down Expand Up @@ -431,7 +432,7 @@ Polymer({
`,

is: 'nuxeo-search-form',
behaviors: [NotifyBehavior, I18nBehavior, RoutingBehavior, IronResizableBehavior],
behaviors: [NotifyBehavior, I18nBehavior, RoutingBehavior, IronResizableBehavior, FormatBehavior],
importMeta: import.meta,

properties: {
Expand Down Expand Up @@ -489,7 +490,7 @@ Polymer({
*/
headers: {
type: Object,
value: { 'fetch-document': 'properties', 'translate-directoryEntry': 'label' },
value: { 'fetch-document': 'properties', 'fetch-directoryEntry': 'parent', 'translate-directoryEntry': 'label' },
},
/**
* The schemas passed on to `provider` (like `dublincore`, `uid`, `file`...).
Expand Down Expand Up @@ -554,9 +555,14 @@ Polymer({
const value = params[param];
if (value !== null && param !== 'dc:title') {
if (modifyPayload && Array.isArray(value)) {
result[param] = value.map((item) =>
item && item['entity-type'] ? item.uid || `${item.properties.parent}/${item.id}` : item,
);
result[param] = value.map((item) => {
let output = item.id ? item.id : item;
while (item && item.properties && item.properties.parent) {
output = `${item.properties.parent.id}`.concat('/', `${output}`);
item = item.properties.parent;
}
return output;
});
} else {
result[param] = typeof value === 'boolean' ? value.toString() : value;
}
Expand Down Expand Up @@ -814,6 +820,17 @@ Polymer({
},

_search() {
if (this.form && this.form.searchTerm) {
this.set('params.ecm_fulltext', this.formatFulltext(this.form.searchTerm));
this.set(
'params.highlight',
'dc:title.fulltext,ecm:binarytext,dc:description.fulltext,ecm:tag,note:note.fulltext,file:content.name',
);
} else if (this.params && this.params.ecm_fulltext) {
this.set('params.ecm_fulltext', '');
delete this.params.ecm_fulltext;
delete this.params.highlight;
}
if (this.results && this._validate()) {
this.results.reset();
return this._fetch(this.results).then(this._navigateToResults.bind(this));
Expand Down
2 changes: 1 addition & 1 deletion ftest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.nuxeo.web.ui</groupId>
<artifactId>nuxeo-web-ui-parent</artifactId>
<version>3.1.10-SNAPSHOT</version>
<version>3.1.11-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"repository": "nuxeo/nuxeo-web-ui.git",
"homepage": "http://www.nuxeo.com",
"name": "@nuxeo/nuxeo-web-ui",
"version": "3.1.10-SNAPSHOT",
"version": "3.1.11-SNAPSHOT",
"license": "Apache-2.0",
"vendor": "Nuxeo",
"engines": {
Expand All @@ -14,7 +14,7 @@
},
"devDependencies": {
"@nuxeo/nuxeo-web-ui-ftest": "file:./packages/nuxeo-web-ui-ftest",
"@nuxeo/testing-helpers": "~3.1.10-rc",
"@nuxeo/testing-helpers": "~3.1.11-rc",
"@open-wc/eslint-config": "^0.3.0",
"@open-wc/karma-esm": "^2.13.21",
"@open-wc/prettier-config": "^0.1.0",
Expand Down Expand Up @@ -109,9 +109,9 @@
"@material/mwc-snackbar": "^0.26.1",
"@nuxeo/chart-elements": "^4.0.0-nx.1",
"@nuxeo/moment": "^2.24.0-nx.0",
"@nuxeo/nuxeo-dataviz-elements": "~3.1.10-rc",
"@nuxeo/nuxeo-elements": "~3.1.10-rc",
"@nuxeo/nuxeo-ui-elements": "~3.1.10-rc",
"@nuxeo/nuxeo-dataviz-elements": "~3.1.11-rc",
"@nuxeo/nuxeo-elements": "~3.1.11-rc",
"@nuxeo/nuxeo-ui-elements": "~3.1.11-rc",
"@nuxeo/page": "^1.11.4-nx.0",
"@polymer/app-layout": "^3.1.0",
"@polymer/iron-a11y-announcer": "^3.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxeo-web-ui-ftest/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nuxeo/nuxeo-web-ui-ftest",
"version": "3.1.10-SNAPSHOT",
"version": "3.1.11-SNAPSHOT",
"bin": {
"nuxeo-web-ui-ftest": "./bin/nuxeo-web-ui-ftest.js"
},
Expand Down
2 changes: 1 addition & 1 deletion plugin/a11y/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.nuxeo.web.ui</groupId>
<artifactId>nuxeo-web-ui-parent</artifactId>
<version>3.1.10-SNAPSHOT</version>
<version>3.1.11-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion plugin/itests/addon/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.nuxeo.web.ui</groupId>
<artifactId>nuxeo-web-ui-parent</artifactId>
<version>3.1.10-SNAPSHOT</version>
<version>3.1.11-SNAPSHOT</version>
<relativePath>../../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion plugin/itests/marketplace/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.nuxeo.web.ui</groupId>
<artifactId>nuxeo-web-ui-parent</artifactId>
<version>3.1.10-SNAPSHOT</version>
<version>3.1.11-SNAPSHOT</version>
<relativePath>../../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion plugin/metrics/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.nuxeo.web.ui</groupId>
<artifactId>nuxeo-web-ui-parent</artifactId>
<version>3.1.10-SNAPSHOT</version>
<version>3.1.11-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion plugin/web-ui/addon/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.nuxeo.web.ui</groupId>
<artifactId>nuxeo-web-ui-parent</artifactId>
<version>3.1.10-SNAPSHOT</version>
<version>3.1.11-SNAPSHOT</version>
<relativePath>../../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,5 @@
<!-- Properties to be fetched when loading the user object in user management, default is empty -->
<property name="org.nuxeo.web.ui.user.management.fetch.document" list="true"></property>

<!-- allowed url to redirect -->
<property name="org.nuxeo.web.ui.trustedDomains">${org.nuxeo.web.ui.trustedDomains:=''}</property>

</extension>
</component>
2 changes: 1 addition & 1 deletion plugin/web-ui/marketplace/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.nuxeo.web.ui</groupId>
<artifactId>nuxeo-web-ui-parent</artifactId>
<version>3.1.10-SNAPSHOT</version>
<version>3.1.11-SNAPSHOT</version>
<relativePath>../../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<packaging>pom</packaging>
<name>Nuxeo Web UI - Parent</name>
<description>Nuxeo Web UI - Parent</description>
<version>3.1.10-SNAPSHOT</version>
<version>3.1.11-SNAPSHOT</version>

<properties>
<nuxeo.target.version>2023.*</nuxeo.target.version>
Expand Down

0 comments on commit eac8b7e

Please sign in to comment.