Skip to content

Commit

Permalink
Merge branch 'maintenance-3.1.x' of https://github.com/nuxeo/nuxeo-we…
Browse files Browse the repository at this point in the history
…b-ui into lts-2025
  • Loading branch information
madhurkulshrestha-hyland committed Jan 6, 2025
2 parents a81618b + 728e5bc commit 333d572
Show file tree
Hide file tree
Showing 21 changed files with 114 additions and 43 deletions.
5 changes: 3 additions & 2 deletions addons/nuxeo-csv/elements/nuxeo-document-import-csv.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ Polymer({
<template is="dom-if" if="[[!hasFile]]">
<div class="vertical layout center center-justified flex">
<div class="dropzone-label horizontal layout center center-justified">
<a href="javascript:undefined" on-tap="_showUploadDialog"> [[i18n('csv.import.clickOrDrop')]]</a>
<a href="#" on-tap="_showUploadDialog"> [[i18n('csv.import.clickOrDrop')]]</a>
</div>
</div>
</template>
Expand Down Expand Up @@ -581,7 +581,8 @@ Polymer({
}
},

_showUploadDialog() {
_showUploadDialog(e) {
e.preventDefault();
this.$.uploadFiles.click();
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Polymer({
is-available="{{isProviderAvailable}}"
></nuxeo-liveconnect-box-provider>
<template is="dom-if" if="[[isProviderAvailable]]">
<a href="javascript:undefined" on-tap="_openPicker">
<a href="#" on-tap="_openPicker">
<iron-icon src="[[importPath]]images/box.png"></iron-icon>
[[i18n('liveconnectImportActions.box', 'Box')]]
</a>
Expand All @@ -78,7 +78,8 @@ Polymer({
this.$.provider.updateProviderInfo();
},

_openPicker() {
_openPicker(e) {
e.preventDefault();
this.$.provider.openPicker();
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Polymer({
is-available="{{isProviderAvailable}}"
></nuxeo-liveconnect-google-drive-provider>
<template is="dom-if" if="[[isProviderAvailable]]">
<a href="javascript:undefined" on-tap="_openPicker">
<a href="#" on-tap="_openPicker">
<iron-icon src="[[importPath]]images/google_drive.png"></iron-icon>
[[i18n('liveconnectImportActions.googledrive', 'Google Drive')]]
</a>
Expand All @@ -78,7 +78,8 @@ Polymer({
this.$.provider.updateProviderInfo();
},

_openPicker() {
_openPicker(e) {
e.preventDefault();
this.$.provider.openPicker();
},
});
11 changes: 8 additions & 3 deletions elements/nuxeo-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,10 @@ Polymer({
value: '52px',
},

sidebarWidth: {
type: String,
},

drawerOpened: {
type: Boolean,
value: false,
Expand Down Expand Up @@ -638,7 +642,7 @@ Polymer({

ready() {
this.$.drawerPanel.closeDrawer();

this.drawerWidth = this.sidebarWidth = getComputedStyle(this).getPropertyValue('--nuxeo-sidebar-width');
this.$.drawerPanel.$.drawer.addEventListener('transitionend', () => {
this.$.drawerPanel.notifyResize();
});
Expand Down Expand Up @@ -1001,7 +1005,8 @@ Polymer({
},

_openDrawer() {
this.drawerWidth = '350px';
const pixelsSuffix = 'px';
this.drawerWidth = 298 + Math.round(this.sidebarWidth.substring(0, this.sidebarWidth.length - 2)) + pixelsSuffix;
this.drawerOpened = true;
const { drawerPanel } = this.$;
if (drawerPanel.narrow) {
Expand All @@ -1017,7 +1022,7 @@ Polymer({
},

_closeDrawer() {
this.drawerWidth = '52px';
this.drawerWidth = this.sidebarWidth;
this.drawerOpened = false;
this.$.drawerPanel.closeDrawer();
this.selectedTab = '';
Expand Down
14 changes: 11 additions & 3 deletions elements/nuxeo-results/nuxeo-results.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,9 +455,17 @@ Polymer({
},

_computeCountLabel() {
return this.resultsCount < 0
? this.i18n('results.heading.count.unknown')
: this.i18n('results.heading.count', this.resultsCount);
// Fetch the property value from web-ui-properties.xml
const isNumberFormattingEnabled =
(Nuxeo && Nuxeo.UI && Nuxeo.UI.config && Nuxeo.UI.config.numberFormattingEnabled) || false;
if (this.resultsCount < 0) {
return this.i18n('results.heading.count.unknown');
}
if (isNumberFormattingEnabled) {
const formattedCount = new Intl.NumberFormat().format(this.resultsCount);
return this.i18n('results.heading.count', formattedCount);
}
return this.i18n('results.heading.count', this.resultsCount);
},

_sortOptions() {
Expand Down
10 changes: 6 additions & 4 deletions elements/nuxeo-selection/nuxeo-selection-toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ Polymer({
<span class="count" aria-live="polite">
[[i18n('selectionToolbar.selected.items', selectedItems.length)]]
</span>
<a class="selectionLink" on-tap="toogleSelectedItemsPopup" href="javascript:void(0)">
<a class="selectionLink" on-tap="toogleSelectedItemsPopup" href="#">
<span>[[i18n('selectionToolbar.display.selection')]]</span>
</a>
</template>
Expand All @@ -121,7 +121,7 @@ Polymer({
<template is="dom-if" if="[[selectAllActive]]">
<span class="count" aria-live="polite">[[i18n('selectionToolbar.selected.all', _resultsCount)]]</span>
</template>
<a class="selectionLink" on-tap="clearSelection" href="javascript:void(0)">
<a class="selectionLink" on-tap="clearSelection" href="#">
<span>[[i18n('command.clear')]]</span>
</a>
</div>
Expand Down Expand Up @@ -188,11 +188,13 @@ Polymer({
this.hidden = !this.selectedItems || this.selectedItems.length === 0;
},

toogleSelectedItemsPopup() {
toogleSelectedItemsPopup(e) {
e.preventDefault();
this.$$('#selectedItemsPopup').toggle();
},

clearSelection() {
clearSelection(e) {
e.preventDefault();
this.fire('clear-selected-items');
},
});
5 changes: 3 additions & 2 deletions elements/workflow/nuxeo-document-task.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ Polymer({
</div>
</template>
</div>
<a href="javascript:undefined" on-tap="_toggleGraphDialog" class="view-graph">[[i18n('tasks.viewGraph')]]</a>
<a href="#" on-tap="_toggleGraphDialog" class="view-graph">[[i18n('tasks.viewGraph')]]</a>
<div class="horizontal spaced">
<span>[[i18n(tasks.directive)]]</span>
</div>
Expand Down Expand Up @@ -314,7 +314,8 @@ Polymer({
.finally(() => this._setProcessing(false));
},

_toggleGraphDialog() {
_toggleGraphDialog(e) {
e.preventDefault();
this.$.graph.show();
},

Expand Down
2 changes: 1 addition & 1 deletion ftest/features/publication.feature
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,4 @@ Feature: Internal Publication
Then I can see the document is a publication
And I cannot see to publication pill
And I can unpublish the document
And I can see the document has 2 children
And I can see the document has 2 children
5 changes: 5 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@
<script src="vendor/web-animations/web-animations-next-lite.min.js"></script>

<script nonce="dummy">

function generateNonce(){
return window.crypto.randomUUID().toString('base64')
}
/* eslint-disable no-var, no-unused-vars */
var Nuxeo = {
UI: {
Expand Down Expand Up @@ -128,6 +132,7 @@
hrefBase: 'elements/search/',
},
},
nonce: generateNonce()
/* analytics: {
documentDistribution: {
disableThreshold: 100, // uncomment to set the threshold value that disables the distribution analytics
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ Then(/^I can perform the following publications$/, async function(table) {
check = override ? newCount === 1 : newCount > pubCount;
}
if (check) {
pubCount = page.publicationsCount;
pubCount = await page.publicationsCount;
}
}
});
Expand Down
11 changes: 6 additions & 5 deletions packages/nuxeo-web-ui-ftest/features/step_definitions/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,14 @@ Then('I edit the results columns to show {string}', async function(heading) {
});

Then(/^I save my search as "(.+)"$/, async function(searchName) {
const saveAsButton = await this.ui.searchResults.saveSearchAsButton;
const searchResults = await this.ui.searchResults;
const saveAsButton = await searchResults.saveSearchAsButton;
await saveAsButton.waitForVisible();
await saveAsButton.click();
await this.ui.searchResults.enterInput(searchName);
const confirmSaveButton = await this.ui.searchResults.confirmSaveSearchButton;
await confirmSaveButton.waitForEnabled();
await confirmSaveButton.waitForClickable();
await driver.pause(2000);
await searchResults.enterInput(searchName);
await driver.pause(2000);
const confirmSaveButton = await searchResults.confirmSaveSearchButton;
await confirmSaveButton.click();
});

Expand Down
2 changes: 2 additions & 0 deletions packages/nuxeo-web-ui-ftest/pages/ui/admin/cloudServices.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ export default class CloudServices extends BasePage {
}

async deleteClient(clientId) {
const dataTable = await driver.$('nuxeo-data-table nuxeo-data-table-row [name="id"]');
await dataTable.waitForVisible();
const rows = await browser.$$('nuxeo-data-table[name="table"] nuxeo-data-table-row:not([header])');
const deleted = await browser
.$$('nuxeo-data-table[name="table"] nuxeo-data-table-row:not([header])')
Expand Down
9 changes: 2 additions & 7 deletions packages/nuxeo-web-ui-ftest/pages/ui/browser/document_page.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,8 @@ export default class DocumentPage extends BasePage {
}
}
if (pub) {
return parseInt(
pub
.$('div')
.getText()
.trim(),
10,
);
const pubText = await pub.$('div').getText();
return parseInt(pubText.trim(), 10);
}
}
return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ export default class DocumentPublications extends BasePage {
let index;
for (let i = 0; i < rows.length; i++) {
const row = rows[i];
if (row.isVisible('nuxeo-data-table-cell a.path')) {
const isRowVisible = await row.isVisible('nuxeo-data-table-cell a.path');
if (isRowVisible) {
const foundPathEle = await row.$('nuxeo-data-table-cell a.path');
const foundPath = await foundPathEle.getText();
const foundPathLowerCase = await foundPath.trim().toLowerCase();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ export default class DocumentVersions extends BasePage {
return true;
}
const listItems = await this.listItems;
await listItems.$('div[name="version-item"] .title').waitForVisible();
const versionItem = await listItems.$('div[name="version-item"] .title');
await versionItem.waitForVisible();
const listItems1 = await this.listItems.$$('div[name="version-item"]');
const itemsTitle = await browser.$$('div[name="version-item"]').map((img) => img.$('.title').getText());
const index = itemsTitle.findIndex((currenTitle) => currenTitle === label);
Expand Down
5 changes: 3 additions & 2 deletions packages/nuxeo-web-ui-ftest/pages/ui/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,9 @@ export default class Search extends Results {
return dropdownElenent;
}

enterInput(text) {
return driver.keys(text);
async enterInput(text) {
const isInputEntered = await driver.keys(text);
return isInputEntered;
}

async getField(field) {
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxeo-web-ui-ftest/wdio.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const capability = {
maxInstances: 1,
browserName: process.env.BROWSER,
acceptInsecureCerts: true,
browserVersion: 'stable',
browserVersion: '130.0.6723.116',
};

const options = {};
Expand Down
1 change: 0 additions & 1 deletion plugin/a11y/wdio.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const capability = {
};
const options = {
args: ['--no-sandbox'],
w3c: false,
};
if (process.env.HEADLESS) {
options.args.push('--window-size=1920,1080');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,8 @@
<!-- allowed url to redirect -->
<property name="org.nuxeo.web.ui.trustedDomains">${org.nuxeo.web.ui.trustedDomains:=}</property>

<!-- Search result numberFormatting -->
<property name="org.nuxeo.web.ui.numberFormatting.enabled">${org.nuxeo.web.ui.numberFormatting.enabled:=}</property>

</extension>
</component>
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
var Nuxeo = Nuxeo || {};
Nuxeo.UI = Nuxeo.UI || {};
Nuxeo.UI.config = <%= cs.getPropertiesAsJson("org.nuxeo.web.ui") %>;
Nuxeo.UI.config.nonce = NuxeoNonce;
Nuxeo.UI.bundles = [
<% for (Resource resource : wrm.getResources(new ResourceContextImpl(), "web-ui", "import")) { %>
'<%= context %><%= resource.getURI() %>',
Expand Down
Loading

0 comments on commit 333d572

Please sign in to comment.