From 0e6d484fc255e16f73599d19e29dcd752e78e4c3 Mon Sep 17 00:00:00 2001 From: imedina Date: Mon, 11 Mar 2024 00:42:28 +0000 Subject: [PATCH 1/8] Fix Job parameter disaplay --- src/webcomponents/job/job-grid.js | 93 +++++++++++++++++-------------- 1 file changed, 51 insertions(+), 42 deletions(-) diff --git a/src/webcomponents/job/job-grid.js b/src/webcomponents/job/job-grid.js index bcca9d7928..56c39e87fe 100644 --- a/src/webcomponents/job/job-grid.js +++ b/src/webcomponents/job/job-grid.js @@ -90,7 +90,7 @@ export default class JobGrid extends LitElement { } propertyObserver() { - // With each property change we must updated config and create the columns again. No extra checks are needed. + // With each property change we must update config and create the columns again. No extra checks are needed. this._config = { ...this.getDefaultConfig(), ...this.config, @@ -107,21 +107,21 @@ export default class JobGrid extends LitElement { toolId: this.toolId, resource: "JOB", columns: this._getDefaultColumns(), - create: { - display: { - modalTitle: "Job Create", - modalDraggable: true, - disabled: true, - disabledTooltip: "This operation will be implemented soon. Thanks for your patience.", - modalCyDataName: "modal-create", - }, - render: () => html ` - - ` - }, // Uncomment in case we need to change defaults + // create: { + // display: { + // modalTitle: "Job Create", + // modalDraggable: true, + // disabled: true, + // disabledTooltip: "This operation will be implemented soon. Thanks for your patience.", + // modalCyDataName: "modal-create", + // }, + // render: () => html ` + // + // ` + // }, // export: { // display: { // modalTitle: "Job Export", @@ -443,25 +443,46 @@ export default class JobGrid extends LitElement { if (UtilsNew.isNotEmpty(params)) { html = "
"; for (const key of Object.keys(params)) { - let nestedObject = ""; - if (typeof params[key] === "object") { - for (const subKey of Object.keys(params[key])) { - nestedObject += ` -
- ${subKey}: ${params[key][subKey]} + html += `
`; + // 1. Normal parameter + if (typeof params[key] !== "object") { + if (params[key].length > 100) { + html += ` + ${key}: ${params[key].substring(0, 100) + "..." || "true"} + `; + } else { + html += ` + ${key}: ${params[key] || "true"} + `; + } + } else { + // 2. This parameter is an Object, we need to loop its internal subparams. + let nestedObject = ""; + // 2.1 It can contain some subparams, or ... + if (UtilsNew.isNotEmpty(params[key])) { + for (const subKey of Object.keys(params[key])) { + nestedObject += ` +
+ ${subKey}: ${params[key][subKey]} +
+ `; + } + html += ` +
+ ${key}: +
+
+ ${nestedObject}
`; + } else { + // 2.2 ... it can be an empty object. + html += ` + ${key}:none + `; } } - html += ` -
- ${nestedObject ? ` -
${key}:
-
- ${nestedObject} -
` : - `${key}: ${params[key]}`} -
`; + html += "
"; } html += "
"; } @@ -630,18 +651,6 @@ export default class JobGrid extends LitElement { }); } - getRightToolbar() { - return [ - { - render: () => html` - - `, - } - ]; - } - render() { return html` ${this._config.showToolbar ? html` From 2f02dc265dd8ee1ed9b98c41a59c29fe37ee30d3 Mon Sep 17 00:00:00 2001 From: Josemi Date: Wed, 3 Apr 2024 13:40:03 +0200 Subject: [PATCH 2/8] pkg: remove unused dependencies #TASK-5666 --- package.json | 1 - src/sites/api/index.html | 3 --- src/sites/iva/index.html | 4 ---- 3 files changed, 8 deletions(-) diff --git a/package.json b/package.json index 8bb72077ee..e9212e6364 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,6 @@ "@polymer/polymer": "2.6.1", "@svgdotjs/svg.js": "^3.0.16", "@vaadin/router": "^1.7.2", - "@webcomponents/webcomponentsjs": "^1.1.0", "animate.css": "^3.5.2", "backbone": "~1.3.3", "bootstrap": "3.3.6", diff --git a/src/sites/api/index.html b/src/sites/api/index.html index 9a19d331a9..e4c4dc8fa9 100644 --- a/src/sites/api/index.html +++ b/src/sites/api/index.html @@ -55,9 +55,6 @@ - - diff --git a/src/sites/iva/index.html b/src/sites/iva/index.html index 0ba84271fa..e46364a22d 100644 --- a/src/sites/iva/index.html +++ b/src/sites/iva/index.html @@ -83,10 +83,6 @@ - - - - From 0f806140d16ebd099d6d5868d60bb6e53dcf69a2 Mon Sep 17 00:00:00 2001 From: Josemi Date: Wed, 3 Apr 2024 13:43:03 +0200 Subject: [PATCH 3/8] pkg: disable husky #TASK-5666 --- .husky/.gitignore | 1 - .husky/pre-commit | 5 ----- package.json | 2 -- 3 files changed, 8 deletions(-) delete mode 100644 .husky/.gitignore delete mode 100755 .husky/pre-commit diff --git a/.husky/.gitignore b/.husky/.gitignore deleted file mode 100644 index 31354ec138..0000000000 --- a/.husky/.gitignore +++ /dev/null @@ -1 +0,0 @@ -_ diff --git a/.husky/pre-commit b/.husky/pre-commit deleted file mode 100755 index 169fc556e7..0000000000 --- a/.husky/pre-commit +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" - -npm run lint:js -# npm test diff --git a/package.json b/package.json index e9212e6364..afa96b8068 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,6 @@ "serve:build": "vite preview", "clean": "rm -rf build", "build": "npm run clean && rollup -c && npm run package", - "prepare": "husky install", "test:open": "cypress open", "test:prepare": "./prepare-test.sh", "test:run": "cypress run --spec cypress/e2e/commons/data-form.cy.js,cypress/e2e/iva/**/*.cy.js", @@ -106,7 +105,6 @@ "grunt": "^1.4.0", "grunt-shell": "^3.0.1", "highlight.js": "^10.6.0", - "husky": "^6.0.0", "lint-staged": "^11.0.0", "regenerator-runtime": "^0.13.3", "rollup": "^2.56.3", From 334c698da99d20f81ab927d6689eef285767e875 Mon Sep 17 00:00:00 2001 From: Josemi Date: Wed, 3 Apr 2024 14:12:01 +0200 Subject: [PATCH 4/8] wc: add cypress tags to toolbar buttons #TASK-5666 --- src/webcomponents/commons/opencb-grid-toolbar.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/webcomponents/commons/opencb-grid-toolbar.js b/src/webcomponents/commons/opencb-grid-toolbar.js index 663ac44c00..a7a444429c 100644 --- a/src/webcomponents/commons/opencb-grid-toolbar.js +++ b/src/webcomponents/commons/opencb-grid-toolbar.js @@ -150,7 +150,7 @@ export default class OpencbGridToolbar extends LitElement { `) : nothing} ${this._settings.showRefresh ? html` - ` :nothing} @@ -163,12 +163,12 @@ export default class OpencbGridToolbar extends LitElement { As a workaround, the tooltip will be displayed from a wrapper --> ${isCreateDisabled ? html ` - ` : html ` - @@ -188,7 +188,7 @@ export default class OpencbGridToolbar extends LitElement { ${this._settings?.showSettings ? html`
-
From 89716967080053e9000af9deba4c544d050cdbd4 Mon Sep 17 00:00:00 2001 From: Josemi Date: Wed, 3 Apr 2024 14:12:16 +0200 Subject: [PATCH 5/8] test: fix job browser tests #TASK-5666 --- cypress/e2e/iva/job-browser-grid.cy.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/cypress/e2e/iva/job-browser-grid.cy.js b/cypress/e2e/iva/job-browser-grid.cy.js index 897e742a5e..27aae2033a 100644 --- a/cypress/e2e/iva/job-browser-grid.cy.js +++ b/cypress/e2e/iva/job-browser-grid.cy.js @@ -31,8 +31,6 @@ context("Job Browser Grid", () => { // TOOLBAR context("Job Toolbar", () => { - const toolbarComponent = ""; - beforeEach(() => { cy.get(browserGrid) .find(`div[data-cy="toolbar"]`) @@ -47,10 +45,22 @@ context("Job Browser Grid", () => { .find(`div[data-cy="toolbar-wrapper"]`) .should("be.visible"); }); - // 1.1. If configured, it should render a New button - it("should render New button", () => { + + it("should render Refresh button", () => { + cy.get(browserGrid) + .find(`button[data-cy="toolbar-btn-refresh"]`) + .should("be.visible"); + }); + + it("should render Export button", () => { + cy.get(browserGrid) + .find(`button[data-cy="toolbar-btn-export"]`) + .should("be.visible"); + }); + + it("should render Settings button", () => { cy.get(browserGrid) - .find(`button[data-action="create"]`) + .find(`button[data-cy="toolbar-btn-settings"]`) .should("be.visible"); }); }); From b33b67d29af435cb431f3be579d8d531142e95e9 Mon Sep 17 00:00:00 2001 From: Josemi Date: Wed, 3 Apr 2024 14:13:37 +0200 Subject: [PATCH 6/8] test: clean job-grid tests #TASK-5666 --- cypress/e2e/iva/job-browser-grid.cy.js | 130 +++++++------------------ 1 file changed, 35 insertions(+), 95 deletions(-) diff --git a/cypress/e2e/iva/job-browser-grid.cy.js b/cypress/e2e/iva/job-browser-grid.cy.js index 27aae2033a..c54be937b8 100644 --- a/cypress/e2e/iva/job-browser-grid.cy.js +++ b/cypress/e2e/iva/job-browser-grid.cy.js @@ -37,92 +37,32 @@ context("Job Browser Grid", () => { .as("toolbar"); }); - //1. Render the toolbar - context("render", () => { - // 1.1. It should render a div with the toolbar - it("should render toolbar", () => { - cy.get(browserGrid) - .find(`div[data-cy="toolbar-wrapper"]`) - .should("be.visible"); - }); - - it("should render Refresh button", () => { - cy.get(browserGrid) - .find(`button[data-cy="toolbar-btn-refresh"]`) - .should("be.visible"); - }); - - it("should render Export button", () => { - cy.get(browserGrid) - .find(`button[data-cy="toolbar-btn-export"]`) - .should("be.visible"); - }); + it("should render toolbar", () => { + cy.get(browserGrid) + .find(`div[data-cy="toolbar-wrapper"]`) + .should("be.visible"); + }); - it("should render Settings button", () => { - cy.get(browserGrid) - .find(`button[data-cy="toolbar-btn-settings"]`) - .should("be.visible"); - }); + it("should render Refresh button", () => { + cy.get(browserGrid) + .find(`button[data-cy="toolbar-btn-refresh"]`) + .should("be.visible"); }); - }); - // MODAL CREATE - context("Modal Create", () => { - beforeEach(() => { - // eslint-disable-next-line cypress/unsafe-to-chain-command + it("should render Export button", () => { cy.get(browserGrid) - .find(`button[data-action="create"]`) - .should("be.disabled"); + .find(`button[data-cy="toolbar-btn-export"]`) + .should("be.visible"); + }); + + it("should render Settings button", () => { cy.get(browserGrid) - .find(`div[data-cy="modal-create"]`) - .as("modal-create"); + .find(`button[data-cy="toolbar-btn-settings"]`) + .should("be.visible"); }); - // 1. Open modal and render create - // it("should render create modal", () => { - // // eslint-disable-next-line cypress/unsafe-to-chain-command - // cy.get("@modal-create") - // .find("div.modal-dialog") - // .should("be.visible"); - // }); - // 2. Render title - // it("should render create title", () => { - // // eslint-disable-next-line cypress/unsafe-to-chain-command - // cy.get("@modal-create") - // .find("h4.modal-title") - // .should("contain.text", "Job Create"); - // }); - // 3. Render button clear - // it("should render button clear", () => { - // // eslint-disable-next-line cypress/unsafe-to-chain-command - // cy.get("@modal-create") - // .contains('button', 'Clear') - // .should("be.visible"); - // }); - // 4. Render button create - // it("should render button create", () => { - // // eslint-disable-next-line cypress/unsafe-to-chain-command - // cy.get("@modal-create") - // .contains('button', 'Create') - // .should("be.visible"); - // }); - // 5. Render tabs - // it("should render form tabs", () => { - // // eslint-disable-next-line cypress/unsafe-to-chain-command - // cy.get("@modal-create") - // .find("ul.nav.nav-tabs > li") - // .should("have.length.at.least", 1); - // }); - // 6. Render File ID - // it("should have form field ID", () => { - // // eslint-disable-next-line cypress/unsafe-to-chain-command - // cy.get("@modal-create") - // .find(`data-form div.form-horizontal div.row.form-group label.control-label`) - // .should("contain.text", "Job ID"); - // }); }); context("Modal Setting", () => { - it("should move modal setting", () => { cy.get("button[data-action='settings']") .click(); @@ -214,27 +154,27 @@ context("Job Browser Grid", () => { }); }); - context("Row", () => { - it("should display row #3 as selected", () => { - // eslint-disable-next-line cypress/unsafe-to-chain-command - cy.get("tbody tr") - .eq(3) - .click() - .should("have.class","success"); - }); + context("Row", () => { + it("should display row #3 as selected", () => { + // eslint-disable-next-line cypress/unsafe-to-chain-command + cy.get("tbody tr") + .eq(3) + .click() + .should("have.class","success"); + }); - it("should download job Json", () => { - cy.get("tbody tr:first > td") - .eq(-2) - .within(() => { - cy.get("button") - .click(); - cy.get("ul[class='dropdown-menu dropdown-menu-right']") - .contains("a","Download JSON") - .click(); - }); + it("should download job Json", () => { + cy.get("tbody tr:first > td") + .eq(-2) + .within(() => { + cy.get("button") + .click(); + cy.get("ul[class='dropdown-menu dropdown-menu-right']") + .contains("a","Download JSON") + .click(); }); }); + }); context("extension", () => { it("should display 'Extra Column' column", () => { From 95c2a5e832217de2512618f62d6ff9da7bfea126 Mon Sep 17 00:00:00 2001 From: Josemi Date: Wed, 10 Apr 2024 13:53:25 +0200 Subject: [PATCH 7/8] wc: add test attribute in job refresh button #TASK-5666 --- src/webcomponents/job/job-grid.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/webcomponents/job/job-grid.js b/src/webcomponents/job/job-grid.js index 449833e5b1..02c05dfd63 100644 --- a/src/webcomponents/job/job-grid.js +++ b/src/webcomponents/job/job-grid.js @@ -661,7 +661,7 @@ export default class JobGrid extends LitElement { return [ { render: () => html` - `, From 63299ca00b79566f792481d53757946377d9f8ad Mon Sep 17 00:00:00 2001 From: Josemi Date: Wed, 10 Apr 2024 13:53:42 +0200 Subject: [PATCH 8/8] test: fix job-browser tests #TASK-5666 --- cypress/e2e/iva/job-browser-grid.cy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/e2e/iva/job-browser-grid.cy.js b/cypress/e2e/iva/job-browser-grid.cy.js index c54be937b8..d7450c509e 100644 --- a/cypress/e2e/iva/job-browser-grid.cy.js +++ b/cypress/e2e/iva/job-browser-grid.cy.js @@ -45,7 +45,7 @@ context("Job Browser Grid", () => { it("should render Refresh button", () => { cy.get(browserGrid) - .find(`button[data-cy="toolbar-btn-refresh"]`) + .find(`button[data-cy="job-refresh"]`) .should("be.visible"); });