Skip to content

Commit

Permalink
From parameter option added to BYOR data convert (#818)
Browse files Browse the repository at this point in the history
* temp save

* temp save

* temp save

* tabs with multiple datatables implemented

* multi tab data tables completed

* Subsection type "api" added.

* field_page_mode issue resolved.

* BYOR a new option "sub to top" is added to "data convert" option

* Data convert "split" updated

* BYOR "data convert" option "from parameter" added.
  • Loading branch information
dkjang authored Dec 16, 2024
1 parent 3c101e6 commit 0ba4e54
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/utils/dataConvert.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@ let convertData = function (CONVERT, DATA, PHENOTYPE_MAP) {
return string.slice(0, -1)
}

let getParameterByName = function (name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, '\\$&');
var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, ' '));
}

let applyConvert = function (d, CONVERT, PHENOTYPE_MAP) {
let tempObj = {};

Expand All @@ -80,6 +90,15 @@ let convertData = function (CONVERT, DATA, PHENOTYPE_MAP) {
let cType = c.type;

switch (cType) {
case "from parameter":
let param = c["parameter"];

tempObj[c["field name"]] = getParameterByName(param);

d[c["field name"]] = tempObj[c["field name"]];

break;

case "sub to top":

let subList = d;
Expand Down

0 comments on commit 0ba4e54

Please sign in to comment.