Skip to content

Commit

Permalink
Merge branch 'release-2.12.x' into TASK-5855
Browse files Browse the repository at this point in the history
  • Loading branch information
jmjuanes authored Apr 9, 2024
2 parents c5b7de8 + 16bad8a commit 49487d2
Show file tree
Hide file tree
Showing 20 changed files with 836 additions and 874 deletions.
19 changes: 18 additions & 1 deletion src/core/bioinfo/bioinfo-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,23 @@ export default class BioinfoUtils {
});
}

static getIdName(id, name) {
let text = "";
if (name) {
text = name;
}

if (id) {
if (name) {
text += ` (${id})`;
} else {
text = id;
}
}

return text;
}

// Generate Variant ID in Varsome format
// https://varsome.com/how-do-i-create-link-varsome/
static getVariantInVarsomeFormat(variantId) {
Expand Down Expand Up @@ -255,7 +272,7 @@ export default class BioinfoUtils {

static getOboLink(ontologyId) {
const ontologyShort = ontologyId.replace(":", "_");
return `http://purl.obolibrary.org/obo/${ontologyShort}`;
return `https://purl.obolibrary.org/obo/${ontologyShort}`;
}

static getHpoLink(hpoTerm) {
Expand Down
222 changes: 55 additions & 167 deletions src/webcomponents/clinical/clinical-analysis-grid.js

Large diffs are not rendered by default.

86 changes: 31 additions & 55 deletions src/webcomponents/cohort/cohort-grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,24 @@ export default class CohortGrid extends LitElement {
this.gridId = this._prefix + this.COMPONENT_ID;
this.active = true;
this._config = this.getDefaultConfig();
this.displayConfigDefault = {
header: {
horizontalAlign: "center",
verticalAlign: "bottom",
},
};
}

updated(changedProperties) {
if ((changedProperties.has("opencgaSession") ||
update(changedProperties) {
if (changedProperties.has("opencgaSession") ||
changedProperties.has("toolId") ||
changedProperties.has("query") ||
changedProperties.has("config") ||
changedProperties.has("active")) && this.active) {
changedProperties.has("config")) {
this.propertyObserver();
}

super.update(changedProperties);
}


updated(changedProperties) {
if (changedProperties.size > 0 && this.active) {
this.renderTable();
}
}

propertyObserver() {
Expand Down Expand Up @@ -142,16 +144,14 @@ export default class CohortGrid extends LitElement {
// </catalog-browser-grid-config>`
// }
};
this.renderTable(this.active);
}

renderTable(active) {
renderTable() {
if (this.cohorts?.length > 0) {
this.renderLocalTable();
} else {
this.renderRemoteTable(active);
this.renderRemoteTable();
}
this.requestUpdate();
}

renderLocalTable() {
Expand All @@ -163,7 +163,6 @@ export default class CohortGrid extends LitElement {
sidePagination: "local",
iconsPrefix: GridCommons.GRID_ICONS_PREFIX,
icons: GridCommons.GRID_ICONS,
// Set table properties, these are read from config property
uniqueId: "id",
pagination: this._config.pagination,
pageSize: this._config.pageSize,
Expand All @@ -180,22 +179,8 @@ export default class CohortGrid extends LitElement {
});
}

renderRemoteTable(active) {
if (!active) {
return;
}

this.cohorts = [];
renderRemoteTable() {
if (this.opencgaSession?.opencgaClient && this.opencgaSession?.study?.fqn) {
// const filters = {...this.query};

// Make a copy of the cohorts (if they exist), we will use this private copy until it is assigned to this.cohorts
if (UtilsNew.isNotUndefined(this.cohorts)) {
this._cohorts = this.cohorts;
} else {
this._cohorts = [];
}

this._columns = this._getDefaultColumns();
this.table = $("#" + this.gridId);
this.table.bootstrapTable("destroy");
Expand All @@ -206,7 +191,6 @@ export default class CohortGrid extends LitElement {
iconsPrefix: GridCommons.GRID_ICONS_PREFIX,
icons: GridCommons.GRID_ICONS,
uniqueId: "id",
// Table properties
pagination: this._config.pagination,
pageSize: this._config.pageSize,
pageList: this._config.pageList,
Expand All @@ -216,10 +200,6 @@ export default class CohortGrid extends LitElement {
detailView: this._config.detailView,
formatLoadingMessage: () => "<div><loading-spinner></loading-spinner></div>",
ajax: params => {
const sort = this.table.bootstrapTable("getOptions").sortName ? {
sort: this.table.bootstrapTable("getOptions").sortName,
order: this.table.bootstrapTable("getOptions").sortOrder
} : {};
this.filters = {
study: this.opencgaSession.study.fqn,
limit: params.data.limit,
Expand Down Expand Up @@ -272,7 +252,6 @@ export default class CohortGrid extends LitElement {
onLoadError: (e, restResponse) => this.gridCommons.onLoadError(e, restResponse)
});
}
this.requestUpdate();
}

onColumnChange(e) {
Expand All @@ -297,30 +276,28 @@ export default class CohortGrid extends LitElement {
id: "id",
title: "Cohort ID",
field: "id",
formatter: (cohortId, cohort) => {
return `
<div>
<span style="font-weight: bold; margin: 5px 0">${cohortId}</span>
${cohort.name ? `<span class="help-block" style="margin: 5px 0">${cohort.name}</span>` : ""}
</div>`;
},
halign: this.displayConfigDefault.header.horizontalAlign,
formatter: (cohortId, cohort) => `
<div>
<span style="font-weight: bold; margin: 5px 0">${cohortId}</span>
${cohort.name ? `<span class="help-block" style="margin: 5px 0">${cohort.name}</span>` : ""}
</div>
`,
halign: "center",
visible: this.gridCommons.isColumnVisible("id")
},
{
id: "numSamples",
title: "Number of Samples",
field: "numSamples",
// formatter: (value, row) => row.numSamples ?? 0,
halign: this.displayConfigDefault.header.horizontalAlign,
halign: "center",
visible: this.gridCommons.isColumnVisible("numSamples")
},
{
id: "creationDate",
title: "Creation Date",
field: "creationDate",
formatter: CatalogGridFormatter.dateFormatter,
halign: this.displayConfigDefault.header.horizontalAlign,
halign: "center",
visible: this.gridCommons.isColumnVisible("creationDate")
},
];
Expand All @@ -335,32 +312,31 @@ export default class CohortGrid extends LitElement {
title: "Actions",
field: "actions",
formatter: () => `
<div class="dropdown">
<div class="inline-block dropdown">
<button class="btn btn-default btn-sm dropdown-toggle" type="button" data-toggle="dropdown">
<i class="fas fa-toolbox icon-padding" aria-hidden="true"></i>
<span>Actions</span>
<span class="caret" style="margin-left: 5px"></span>
</button>
<ul class="dropdown-menu dropdown-menu-right">
<li role="separator" class="divider"></li>
<li>
<a data-action="edit" class="btn force-text-left ${OpencgaCatalogUtils.isAdmin(this.opencgaSession.study, this.opencgaSession.user.id) || "disabled" }">
<i class="fas fa-edit icon-padding" aria-hidden="true"></i> Edit ...
</a>
</li>
<li>
<a data-action="delete" href="javascript: void 0" class="btn force-text-left disabled">
<i class="fas fa-trash icon-padding" aria-hidden="true"></i> Delete
</a>
</li>
</ul>
</div>`,
// valign: "middle",
</div>
`,
align: "center",
events: {
"click a": this.onActionClick.bind(this)
"click a": this.onActionClick.bind(this),
},
visible: !this._config.columns?.hidden?.includes("actions")
visible: this.gridCommons.isColumnVisible("actions"),
});
}

Expand Down Expand Up @@ -445,7 +421,7 @@ export default class CohortGrid extends LitElement {
</opencb-grid-toolbar>
` : nothing}
<div id="${this._prefix}GridTableDiv">
<div id="${this._prefix}GridTableDiv" class="force-overflow">
<table id="${this.gridId}"></table>
</div>
Expand Down
13 changes: 8 additions & 5 deletions src/webcomponents/commons/filters/sample-genotype-filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,20 @@ export default class SampleGenotypeFilter extends LitElement {
id: "0/1", name: "HET"
},
{
id: "1/1", name: "HOM ALT"
id: "1/1", name: "HOM_ALT"
},
{
separator: true
},
{
id: "./.", name: "Missing"
id: "1/2", name: "BIALLELIC (1/2)"
},
{
id: "NA", name: "NA"
}
// {
// id: "./.", name: "Missing"
// },
// {
// id: "NA", name: "NA"
// }
]
};
}
Expand Down
16 changes: 8 additions & 8 deletions src/webcomponents/commons/modal/modal-utils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {html, nothing} from "lit";
import LitUtils from "../utils/lit-utils";
import UtilsNew from "../../../core/utils-new";


export default class ModalUtils {
Expand Down Expand Up @@ -28,10 +27,8 @@ export default class ModalUtils {
const modalDraggable = config.display?.modalDraggable || false;
const modalCyDataName = config.display?.modalCyDataName || "";

return html `
<div class="modal fade" id="${id}" data-draggable="${modalDraggable}"
tabindex="-1" role="dialog"
aria-labelledby="DataModalLabel" aria-hidden="true" data-cy="${modalCyDataName}">
return html`
<div id="${id}" class="modal fade" data-draggable="${modalDraggable}" tabindex="-1" role="dialog" aria-labelledby="DataModalLabel" aria-hidden="true" data-cy="${modalCyDataName}">
<div class="modal-dialog" style="width: ${modalWidth}">
<div class="modal-content">
<div class="modal-header">
Expand All @@ -49,9 +46,13 @@ export default class ModalUtils {
${btnsVisible? html`
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal"
@click="${e => LitUtils.dispatchCustomEvent(self, "modalCancel", null, e)}">Cancel</button>
@click="${e => config.onCancel ? config.onCancel(e) : LitUtils.dispatchCustomEvent(self, "modalCancel", null, e)}">
Cancel
</button>
<button type="button" class="btn btn-primary" data-dismiss="modal"
@click="${e => LitUtils.dispatchCustomEvent(self, "modalOk", null, e)}">Save</button>
@click="${e => config.onOk ? config.onOk(e) : LitUtils.dispatchCustomEvent(self, "modalOk", null, e)}">
Save
</button>
</div>`: nothing}
</div>
</div>
Expand Down Expand Up @@ -124,5 +125,4 @@ export default class ModalUtils {
modalHeader.style.cursor = "move";
}


}
7 changes: 0 additions & 7 deletions src/webcomponents/commons/opencb-grid-toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,6 @@ export default class OpencbGridToolbar extends LitElement {
</div>
`) : nothing}
${this._settings.showRefresh ? html`
<button type="button" class="btn btn-default btn-sm" @click="${() => LitUtils.dispatchCustomEvent(this, "refresh")}">
<i class="fas fa-sync-alt icon-padding"></i> Refresh
</button>
` :nothing}
<!-- Second, display elements configured -->
${this._config?.create && (this._settings.showCreate || this._settings.showNew) ? html`
<div class="btn-group">
Expand Down
Loading

0 comments on commit 49487d2

Please sign in to comment.