Skip to content

Commit

Permalink
Merge branch 'develop' into TASK-5963
Browse files Browse the repository at this point in the history
  • Loading branch information
jmjuanes authored Jul 10, 2024
2 parents 30aa080 + c188290 commit 9a5ce24
Show file tree
Hide file tree
Showing 18 changed files with 76 additions and 229 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/iva/cohort-browser-grid.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ context("Cohort Browser Grid", () => {
// eslint-disable-next-line cypress/unsafe-to-chain-command
cy.get("@modal-create")
.find("h4.modal-title")
.should("contain.text", "Cohort create");
.should("contain.text", "Cohort Create");
});
// 3. Render button clear
it("should render button clear", () => {
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/iva/disease-panel-browser-grid.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ context("Disease Panel Browser Grid", () => {
// eslint-disable-next-line cypress/unsafe-to-chain-command
cy.get("@modal-create")
.find("h4.modal-title")
.should("contain.text", "Disease panel create");
.should("contain.text", "Disease Panel Create");
});
// 3. Render button clear
it("should render button clear", () => {
Expand Down Expand Up @@ -137,7 +137,7 @@ context("Disease Panel Browser Grid", () => {
// eslint-disable-next-line cypress/unsafe-to-chain-command
cy.get("@modal-update")
.find("h4.modal-title")
.should("contain.text", "Disease panel update");
.should("contain.text", "Disease Panel Update");
});
// 3. Render button clear
it("should render button clear", () => {
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/iva/family-browser-grid.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ context("Family Browser Grid", () => {
// eslint-disable-next-line cypress/unsafe-to-chain-command
cy.get("@modal-create")
.find("h4.modal-title")
.should("contain.text", "Family create");
.should("contain.text", "Family Create");
});
// 3. Render button clear
it("should render button clear", () => {
Expand Down Expand Up @@ -138,7 +138,7 @@ context("Family Browser Grid", () => {
// eslint-disable-next-line cypress/unsafe-to-chain-command
cy.get("@modal-update")
.find("h4.modal-title")
.should("contain.text", "Family update");
.should("contain.text", "Family Update");
});
// 3. Render button clear
it("should render button clear", () => {
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/iva/individual-browser-grid.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ context("Individual Browser Grid", () => {
// eslint-disable-next-line cypress/unsafe-to-chain-command
cy.get("@modal-create")
.find("h4.modal-title")
.should("contain.text", "Individual create");
.should("contain.text", "Individual Create");
});
// 3. Render button clear
it("should render button clear", () => {
Expand Down Expand Up @@ -181,7 +181,7 @@ context("Individual Browser Grid", () => {
// eslint-disable-next-line cypress/unsafe-to-chain-command
cy.get("@modal-update")
.find("h4.modal-title")
.should("contain.text", "Individual update");
.should("contain.text", "Individual Update");
});
// 3. Render button clear
it("should render button clear", () => {
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/iva/sample-browser-grid.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ context("Sample Browser Grid", () => {
// eslint-disable-next-line cypress/unsafe-to-chain-command
cy.get("@modal-create")
.find("h4.modal-title")
.should("contain.text", "Sample create");
.should("contain.text", "Sample Create");
});
// 3. Render button clear
it("should render button clear", () => {
Expand Down Expand Up @@ -138,7 +138,7 @@ context("Sample Browser Grid", () => {
// eslint-disable-next-line cypress/unsafe-to-chain-command
cy.get("@modal-update")
.find("h4.modal-title")
.should("contain.text", "Sample update");
.should("contain.text", "Sample Update");
});
// 3. Render button clear
it("should render button clear", () => {
Expand Down
1 change: 0 additions & 1 deletion src/core/clients/opencga/opencga-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,6 @@ export class OpenCGAClient {
if (this._config.cookies.active) {
this.#setCookies();
}
return Promise.resolve();
}

#setCookies(userId, token) {
Expand Down
20 changes: 15 additions & 5 deletions src/sites/iva/iva-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -676,12 +676,22 @@ class IvaApp extends LitElement {
this.opencgaClient.refresh();
}

async logout() {
// this delete token in the client and removes the Cookies
await this.opencgaClient.logout();
logout() {
// 1. Check if logged user is a local user
// This is only needed if SSO mode is enabled. If not, logged user is always local
let isLocalUser = true;
if (this.opencgaClient?._config?.sso?.active && this.opencgaClient?._config?.token) {
// eslint-disable-next-line no-undef
const decoded = jwt_decode(this.opencgaClient._config.token);
isLocalUser = decoded?.authOrigin === "OPENCGA";
}

// 2. Delete token and remove cookies
this.opencgaClient.logout();

// Check if sso is active: we will redirect to 'meta/sso/logout' endpoint
if (this.opencgaClient?._config?.sso?.active) {
// 3. Check if sso is active and logged user is not local
// In this case, we will redirect to 'meta/sso/logout' endpoint
if (this.opencgaClient?._config?.sso?.active && !isLocalUser) {
// eslint-disable-next-line no-undef
Cookies.expire(this.opencgaClient._config.sso.cookie);

Expand Down
14 changes: 5 additions & 9 deletions src/webcomponents/clinical/clinical-analysis-create.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,9 +458,7 @@ export default class ClinicalAnalysisCreate extends LitElement {
display: {
render: (panels, dataFormFilterChange) => {
const handlePanelsFilterChange = e => {
// eslint-disable-next-line no-param-reassign
const panelList = e.detail.value
?.split(",")
const panelList = (e.detail?.value?.split(",") || [])
.filter(panelId => panelId)
.map(panelId => ({id: panelId}));
dataFormFilterChange(panelList);
Expand Down Expand Up @@ -496,8 +494,7 @@ export default class ClinicalAnalysisCreate extends LitElement {
display: {
render: (flags, dataFormFilterChange) => {
const handleFlagsFilterChange = e => {
const flagList = e.detail.value
?.split(",")
const flagList = (e.detail?.value?.split(",") || [])
.filter(flagId => flagId)
.map(flagId => ({id: flagId}));
dataFormFilterChange(flagList);
Expand All @@ -506,7 +503,7 @@ export default class ClinicalAnalysisCreate extends LitElement {
<clinical-flag-filter
.flag="${flags?.map(f => f.id).join(",")}"
.flags="${this.opencgaSession.study.internal?.configuration?.clinical?.flags[this.clinicalAnalysis.type?.toUpperCase()]}"
.multiple=${true}
.multiple="${true}"
@filterChange="${e => handleFlagsFilterChange(e, "flags.id")}">
</clinical-flag-filter>
`;
Expand Down Expand Up @@ -899,8 +896,7 @@ export default class ClinicalAnalysisCreate extends LitElement {
display: {
render: (analysts, dataFormFilterChange) => {
const handleAnalystsFilterChange = e => {
const analystList = e.detail.value
?.split(",")
const analystList = (e.detail?.value?.split(",") || [])
.filter(analystId => analystId)
.map(analystId => ({id: analystId}));
dataFormFilterChange(analystList);
Expand All @@ -909,7 +905,7 @@ export default class ClinicalAnalysisCreate extends LitElement {
<clinical-analyst-filter
.analyst="${analysts?.map(f => f.id).join(",")}"
.analysts="${this._users}"
.multiple=${true}
.multiple="${true}"
@filterChange="${e => handleAnalystsFilterChange(e, "analyst.id")}">
</clinical-analyst-filter>
`;
Expand Down
15 changes: 5 additions & 10 deletions src/webcomponents/clinical/clinical-analysis-update.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,18 +323,16 @@ export default class ClinicalAnalysisUpdate extends LitElement {
render: (analysts, dataFormFilterChange, updateParams, clinicalAnalysis) => {
const handleAnalystsFilterChange = e => {
// We need to convert value from a string wth commas to an array of IDs
const analystList = e.detail.value
?.split(",")
const analystList = (e.detail?.value?.split(",") || [])
.filter(analystId => analystId)
.map(analystId => ({id: analystId}));
dataFormFilterChange(analystList);
};

return html `
<clinical-analyst-filter
.analyst="${analysts?.map(f => f.id).join(",")}"
.analysts="${this._users}"
.multiple=${true}
.multiple="${true}"
.classes="${updateParams?.analysts ? "selection-updated" : ""}"
.disabled="${!!clinicalAnalysis?.locked}"
@filterChange="${e => handleAnalystsFilterChange(e)}">
Expand Down Expand Up @@ -374,7 +372,7 @@ export default class ClinicalAnalysisUpdate extends LitElement {
display: {
render: (panels, dataFormFilterChange, updateParams, clinicalAnalysis) => {
const handlePanelsFilterChange = e => {
const panels = (e.detail.value?.split(",") || [])
const panels = (e.detail?.value?.split(",") || [])
.filter(panelId => panelId)
.map(panelId => ({id: panelId}));
dataFormFilterChange(panels);
Expand Down Expand Up @@ -433,19 +431,16 @@ export default class ClinicalAnalysisUpdate extends LitElement {
render: (flags, dataFormFilterChange, updateParams, clinicalAnalysis) => {
const handleFlagsFilterChange = e => {
// We need to convert value from a string wth commas to an array of IDs
// eslint-disable-next-line no-param-reassign
const flagList = e.detail.value
?.split(",")
const flagList = (e.detail?.value?.split(",") || [])
.filter(flagId => flagId)
.map(flagId => ({id: flagId}));
dataFormFilterChange(flagList);
};

return html `
<clinical-flag-filter
.flag="${flags?.map(f => f.id).join(",")}"
.flags="${this.opencgaSession.study.internal?.configuration?.clinical?.flags[clinicalAnalysis?.type?.toUpperCase()]}"
.multiple=${true}
.multiple="${true}"
.classes="${updateParams?.flags ? "selection-updated" : ""}"
.disabled="${!!clinicalAnalysis?.locked}"
@filterChange="${e => handleFlagsFilterChange(e)}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,7 @@ export default class ClinicalInterpretationCreate extends LitElement {
const panelLock = !!this.clinicalAnalysis?.panelLock;
const panelList = panelLock ? this.clinicalAnalysis.panels : this.opencgaSession.study?.panels;
const handlePanelsFilterChange = e => {
const panelList = e.detail.value
?.split(",")
const panelList = (e.detail?.value?.split(",") || [])
.filter(panelId => panelId)
.map(panelId => ({id: panelId}));
dataFormFilterChange(panelList);
Expand Down Expand Up @@ -284,7 +283,7 @@ export default class ClinicalInterpretationCreate extends LitElement {
<div class="text-muted">Tags: ${(comment.tags || []).join(" ") || "-"}</div>
</div>
</div>
`;
`;
}
},
elements: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,7 @@ export default class ClinicalInterpretationUpdate extends LitElement {
const panelLock = !!this.clinicalAnalysis?.panelLock;
const panelList = panelLock ? this.clinicalAnalysis?.panels : this.opencgaSession.study?.panels;
const handlePanelsFilterChange = e => {
const panelList = e.detail.value
?.split(",")
const panelList = (e.detail?.value?.split(",") || [])
.filter(panelId => panelId)
.map(panelId => ({id: panelId}));
dataFormFilterChange(panelList);
Expand Down
6 changes: 1 addition & 5 deletions src/webcomponents/cohort/cohort-update.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,13 @@ export default class CohortUpdate extends LitElement {
const sampleIds = Array.isArray(samples) ?
samples?.map(sample => sample.id).join(",") :
samples;

const handleSamplesFilterChange = e => {
// We need to convert value from a string wth commas to an array of IDs
// eslint-disable-next-line no-param-reassign
const sampleList = e.detail.value
?.split(",")
const sampleList = (e.detail?.value?.split(",") || [])
.filter(sampleId => sampleId)
.map(sampleId => ({id: sampleId}));
dataFormFilterChange(sampleList);
};

return html `
<catalog-search-autocomplete
.value="${sampleIds}"
Expand Down
6 changes: 0 additions & 6 deletions src/webcomponents/commons/forms/data-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -954,26 +954,20 @@ export default class DataForm extends LitElement {
_createToggleSwitchElement(element) {
const value = this.getValue(element.field);
const disabled = this._getBooleanValue(element.display?.disabled, false, element);
const activeClassName = element.display?.activeClassName ?? element.display?.activeClass ?? "";
const inactiveClassName = element.display?.inactiveClassName ?? element.display?.inactiveClass ?? "";

const content = html`
<div class="">
<toggle-switch
.disabled="${disabled}"
.value="${value}"
.onText="${element.display?.onText}"
.offText="${element.display?.offText}"
.activeClass="${activeClassName}"
.inactiveClass="${inactiveClassName}"
.classes="${this._isUpdated(element) ? "updated" : ""}"
@filterChange="${e => this.onFilterChange(element, e.detail.value)}">
</toggle-switch>
</div>
`;

return this._createElementTemplate(element, value, content);

}

_createToggleButtonsElement(element) {
Expand Down
Loading

0 comments on commit 9a5ce24

Please sign in to comment.