Skip to content

Commit

Permalink
wc - Removed and refactored config header
Browse files Browse the repository at this point in the history
  • Loading branch information
gpveronica committed Nov 24, 2023
1 parent e04b5e5 commit 23b2ea2
Show file tree
Hide file tree
Showing 21 changed files with 105 additions and 140 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,6 @@ class VariantInterpreterGridTest extends LitElement {
nucleotideGenotype: true,
alleleStringLengthMax: 10,

header: {
horizontalAlign: "center",
verticalAlign: "bottom"
},

quality: {
qual: 30,
dp: 20
Expand Down
4 changes: 0 additions & 4 deletions src/webcomponents/alignment/gene-coverage-grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,6 @@ export default class GeneCoverageGrid extends LitElement {
nucleotideGenotype: true,
alleleStringLengthMax: 15,
showToolbar: true,
header: {
horizontalAlign: "center",
verticalAlign: "bottom"
}
};
}

Expand Down
28 changes: 15 additions & 13 deletions src/webcomponents/clinical/clinical-analysis-grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ export default class ClinicalAnalysisGrid 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) {
Expand Down Expand Up @@ -612,7 +618,7 @@ export default class ClinicalAnalysisGrid extends LitElement {
id: "caseId",
title: "Case",
field: "id",
halign: this._config.header.horizontalAlign,
halign: this.displayConfigDefault.header.horizontalAlign,
valign: "middle",
formatter: (value, row) => this.caseFormatter(value, row),
visible: this.gridCommons.isColumnVisible("caseId")
Expand All @@ -621,7 +627,7 @@ export default class ClinicalAnalysisGrid extends LitElement {
id: "probandId",
title: "Proband (Sample) and Family",
field: "proband",
halign: this._config.header.horizontalAlign,
halign: this.displayConfigDefault.header.horizontalAlign,
valign: "middle",
formatter: (value, row) => this.probandFormatter(value, row),
visible: this.gridCommons.isColumnVisible("probandId")
Expand All @@ -630,7 +636,7 @@ export default class ClinicalAnalysisGrid extends LitElement {
id: "disorderId",
title: "Clinical Condition / Panel",
field: "disorder",
halign: this._config.header.horizontalAlign,
halign: this.displayConfigDefault.header.horizontalAlign,
valign: "middle",
formatter: (value, row) => {
const panelHtml = row.panels?.length > 0 ? CatalogGridFormatter.panelFormatter(row.panels) : "-";
Expand All @@ -645,7 +651,7 @@ export default class ClinicalAnalysisGrid extends LitElement {
id: "interpretation",
title: "Interpretation",
field: "interpretation",
halign: this._config.header.horizontalAlign,
halign: this.displayConfigDefault.header.horizontalAlign,
valign: "middle",
formatter: (value, row) => this.interpretationFormatter(value, row),
visible: this.gridCommons.isColumnVisible("interpretation")
Expand All @@ -654,7 +660,7 @@ export default class ClinicalAnalysisGrid extends LitElement {
id: "status",
title: "Status",
field: "status",
halign: this._config.header.horizontalAlign,
halign: this.displayConfigDefault.header.horizontalAlign,
valign: "middle",
formatter: this.statusFormatter.bind(this),
events: {
Expand All @@ -668,7 +674,7 @@ export default class ClinicalAnalysisGrid extends LitElement {
title: "Priority",
field: "priority",
align: "center",
halign: this._config.header.horizontalAlign,
halign: this.displayConfigDefault.header.horizontalAlign,
valign: "middle",
formatter: this.priorityFormatter.bind(this),
events: {
Expand All @@ -682,15 +688,15 @@ export default class ClinicalAnalysisGrid extends LitElement {
title: "Analyst",
field: "analyst.id",
align: "center",
halign: this._config.header.horizontalAlign,
halign: this.displayConfigDefault.header.horizontalAlign,
valign: "middle",
visible: this.gridCommons.isColumnVisible("Analyst")
},
{
id: "dates",
title: "Due / Creation Date",
field: "Dates",
halign: this._config.header.horizontalAlign,
halign: this.displayConfigDefault.header.horizontalAlign,
valign: "middle",
formatter: (field, clinicalAnalysis) => {
const dueDateString = UtilsNew.dateFormatter(clinicalAnalysis.dueDate);
Expand All @@ -715,7 +721,7 @@ export default class ClinicalAnalysisGrid extends LitElement {
id: "actions",
title: "Actions",
field: "actions",
halign: this._config.header.horizontalAlign,
halign: this.displayConfigDefault.header.horizontalAlign,
valign: "middle",
formatter: (value, row) => {
const session = this.opencgaSession;
Expand Down Expand Up @@ -889,10 +895,6 @@ export default class ClinicalAnalysisGrid extends LitElement {
showSelectCheckbox: false,
multiSelection: false,
detailView: false,
header: {
horizontalAlign: "center",
verticalAlign: "bottom"
},

showToolbar: true,
showActions: true,
Expand Down
16 changes: 9 additions & 7 deletions src/webcomponents/cohort/cohort-grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ 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) {
Expand Down Expand Up @@ -298,23 +304,23 @@ export default class CohortGrid extends LitElement {
${cohort.name ? `<span class="help-block" style="margin: 5px 0">${cohort.name}</span>` : ""}
</div>`;
},
halign: this._config.header.horizontalAlign,
halign: this.displayConfigDefault.header.horizontalAlign,
visible: this.gridCommons.isColumnVisible("id")
},
{
id: "numSamples",
title: "Number of Samples",
field: "numSamples",
// formatter: (value, row) => row.numSamples ?? 0,
halign: this._config.header.horizontalAlign,
halign: this.displayConfigDefault.header.horizontalAlign,
visible: this.gridCommons.isColumnVisible("numSamples")
},
{
id: "creationDate",
title: "Creation Date",
field: "creationDate",
formatter: CatalogGridFormatter.dateFormatter,
halign: this._config.header.horizontalAlign,
halign: this.displayConfigDefault.header.horizontalAlign,
visible: this.gridCommons.isColumnVisible("creationDate")
},
];
Expand Down Expand Up @@ -470,10 +476,6 @@ export default class CohortGrid extends LitElement {
multiSelection: false,
showSelectCheckbox: false,
detailView: false,
header: {
horizontalAlign: "center",
verticalAlign: "bottom"
},

showToolbar: true,
showActions: true,
Expand Down
15 changes: 8 additions & 7 deletions src/webcomponents/disease-panel/disease-panel-gene-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,14 @@ export default class DiseasePanelGeneView extends LitElement {
this.genePanels = {};
this._prefix = UtilsNew.randomString(8);
this.gridId = this._prefix + "GenePanelBrowserGrid";
this.displayConfigDefault = {};
this._config = this.getDefaultConfig();
this.gridCommons = new GridCommons(this.gridId, this, this._config);
this.displayConfigDefault = {
header: {
horizontalAlign: "center",
verticalAlign: "bottom",
},
};
}

// connectedCallback() {
Expand Down Expand Up @@ -163,7 +168,7 @@ export default class DiseasePanelGeneView extends LitElement {
title: "Gene",
field: "name",
formatter: (value, row) => this.geneFormatter(row, this.opencgaSession),
halign: this._config.header.horizontalAlign
halign: this.displayConfigDefault.header.horizontalAlign
},
{
id: "modesOfInheritance",
Expand Down Expand Up @@ -200,7 +205,7 @@ export default class DiseasePanelGeneView extends LitElement {
return "-";
}
},
halign: this._config.header.horizontalAlign
halign: this.displayConfigDefault.header.horizontalAlign
},
{
id: "phenotypes",
Expand Down Expand Up @@ -261,10 +266,6 @@ export default class DiseasePanelGeneView extends LitElement {
detailView: false,
multiSelection: false,
showToolbar: false,
header: {
horizontalAlign: "center",
verticalAlign: "bottom"
}
};
}

Expand Down
18 changes: 10 additions & 8 deletions src/webcomponents/disease-panel/disease-panel-grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ export default class DiseasePanelGrid 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) {
Expand Down Expand Up @@ -374,7 +380,7 @@ export default class DiseasePanelGrid extends LitElement {
<div style="margin: 5px 0">${idLinkHtml}</div>
</div>`;
},
halign: this._config.header.horizontalAlign,
halign: this.displayConfigDefault.header.horizontalAlign,
visible: this.gridCommons.isColumnVisible("name")
},
// {
Expand All @@ -392,15 +398,15 @@ export default class DiseasePanelGrid extends LitElement {
// }
// return row?.id ?? "-";
// },
// halign: this._config.header.horizontalAlign,
// halign: this.displayConfigDefault.header.horizontalAlign,
// visible: this.gridCommons.isColumnVisible("id")
// },
{
id: "disorders",
title: "Disorders",
field: "disorders",
formatter: disorders => CatalogGridFormatter.disorderFormatter(disorders),
halign: this._config.header.horizontalAlign,
halign: this.displayConfigDefault.header.horizontalAlign,
visible: this.gridCommons.isColumnVisible("disorders")
},
{
Expand Down Expand Up @@ -455,7 +461,7 @@ export default class DiseasePanelGrid extends LitElement {
id: "actions",
title: "Actions",
field: "actions",
halign: this._config.header.horizontalAlign,
halign: this.displayConfigDefault.header.horizontalAlign,
formatter: (value, row) => `
<div class="dropdown" style="display: flex; justify-content: center;">
<button class="btn btn-default btn-sm dropdown-toggle" type="button" data-toggle="dropdown">
Expand Down Expand Up @@ -590,10 +596,6 @@ export default class DiseasePanelGrid extends LitElement {
showSelectCheckbox: false,
multiSelection: false,
detailView: false,
header: {
horizontalAlign: "center",
verticalAlign: "bottom"
},

showToolbar: true,
showActions: true,
Expand Down
15 changes: 8 additions & 7 deletions src/webcomponents/disease-panel/disease-panel-region-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,14 @@ export default class DiseasePanelRegionView extends LitElement {
this.regions = {};
this._prefix = UtilsNew.randomString(8);
this.gridId = this._prefix + "GenePanelBrowserGrid";
this.displayConfigDefault = {};
this._config = this.getDefaultConfig();
this.gridCommons = new GridCommons(this.gridId, this, this._config);
this.displayConfigDefault = {
header: {
horizontalAlign: "center",
verticalAlign: "bottom",
},
};
}

// connectedCallback() {
Expand Down Expand Up @@ -128,7 +133,7 @@ export default class DiseasePanelRegionView extends LitElement {
title: "Region",
field: "name",
formatter: (value, row) => `${row.id}`,
halign: this._config.header.horizontalAlign,
halign: this.displayConfigDefault.header.horizontalAlign,
},
{
id: "modesOfInheritance",
Expand Down Expand Up @@ -165,7 +170,7 @@ export default class DiseasePanelRegionView extends LitElement {
return "-";
}
},
halign: this._config.header.horizontalAlign,
halign: this.displayConfigDefault.header.horizontalAlign,
},
{
id: "phenotypes",
Expand Down Expand Up @@ -225,10 +230,6 @@ export default class DiseasePanelRegionView extends LitElement {
detailView: false,
multiSelection: false,
showToolbar: false,
header: {
horizontalAlign: "center",
verticalAlign: "bottom"
}
};
}

Expand Down
Loading

0 comments on commit 23b2ea2

Please sign in to comment.