Skip to content

Commit

Permalink
#863 separated options into User-Uploaded and Expression Database
Browse files Browse the repository at this point in the history
  • Loading branch information
Amelie1253 authored and dondi committed Feb 26, 2025
1 parent 702183d commit 8d8ca9e
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 18 deletions.
5 changes: 4 additions & 1 deletion web-client/public/js/grnstate.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ export const grnState = {
bottomDataset: undefined,
lastDataset: null,
bottomDataSameAsTop: true,
nodeColoringOptions: [],
nodeColoringOptions: {
workbookExpressions: [],
databaseExpressions: [],
},
ppiNodeColorWarningDisplayed: false,
},

Expand Down
54 changes: 37 additions & 17 deletions web-client/public/js/update-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -700,16 +700,17 @@ const resetDatasetDropdownMenus = (workbook) => {
</li>`;
};

grnState.nodeColoring.nodeColoringOptions = [];
for (var property in workbook.expression) {
grnState.nodeColoring.nodeColoringOptions.workbookExpressions = [];
grnState.nodeColoring.nodeColoringOptions.databaseExpressions = [];
for (var property in workbook.expression) {

Check failure on line 705 in web-client/public/js/update-app.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Expected indentation of 4 spaces but found 8
if (property.match(ENDS_IN_EXPRESSION_REGEXP)) {

Check failure on line 706 in web-client/public/js/update-app.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Expected indentation of 12 spaces but found 8
grnState.nodeColoring.nodeColoringOptions.push({value: property});
grnState.nodeColoring.nodeColoringOptions.workbookExpressions.push({value: property});
}
}

Check failure on line 709 in web-client/public/js/update-app.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Expected indentation of 8 spaces but found 4

// Add expression database options
grnState.database.expressionDatasets.forEach( option =>
grnState.nodeColoring.nodeColoringOptions.push({value: [option]}));
grnState.nodeColoring.nodeColoringOptions.databaseExpressions.push({value: [option]}));

$(BOTTOM_DATASET_SELECTION_SIDEBAR).append($("<option>")
.attr("value", "Same as Top Dataset").text("Same as Top Dataset"));
Expand All @@ -718,19 +719,38 @@ const resetDatasetDropdownMenus = (workbook) => {

// $(DATA_SET_SELECT).append($("<option>").attr("value", "Dahlquist").text("Dahlquist"));

grnState.nodeColoring.nodeColoringOptions.forEach(function (option) {
var shortenedSheetName = shortenExpressionSheetName(option.value);
$(TOP_DATASET_SELECTION_SIDEBAR).append($("<option>")
.addClass("dataset-option")
.attr("value", option.value).text(shortenedSheetName));
$(TOP_DATASET_SELECTION_MENU)
.append(createHTMLforDataset(option.value));
$(BOTTOM_DATASET_SELECTION_SIDEBAR).append($("<option>")
.addClass("dataset-option")
.attr("value", option.value).text(shortenedSheetName));
$(BOTTOM_DATASET_SELECTION_MENU)
.append(createHTMLforDataset(option.value));
});
const addOptionsToDropdown = (options, groupLabel) => {
let topOptgroup = $("<optgroup>").attr("label", groupLabel);
let bottomOptgroup = $("<optgroup>").attr("label", groupLabel);

Check failure on line 725 in web-client/public/js/update-app.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Trailing spaces not allowed
options.forEach(option => {
var shortenedSheetName = shortenExpressionSheetName(option.value);

Check failure on line 728 in web-client/public/js/update-app.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Trailing spaces not allowed
let topOption = $("<option>")
.addClass("dataset-option")
.attr("value", option.value).text(shortenedSheetName);

Check failure on line 732 in web-client/public/js/update-app.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Trailing spaces not allowed
let bottomOption = $("<option>")
.addClass("dataset-option")
.attr("value", option.value).text(shortenedSheetName);

Check failure on line 736 in web-client/public/js/update-app.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Trailing spaces not allowed
topOptgroup.append(topOption);
bottomOptgroup.append(bottomOption);

Check failure on line 739 in web-client/public/js/update-app.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Trailing spaces not allowed
$(TOP_DATASET_SELECTION_MENU).append(createHTMLforDataset(option.value));
$(BOTTOM_DATASET_SELECTION_MENU).append(createHTMLforDataset(option.value));
});

Check failure on line 743 in web-client/public/js/update-app.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Trailing spaces not allowed
$(TOP_DATASET_SELECTION_SIDEBAR).append(topOptgroup);
$(BOTTOM_DATASET_SELECTION_SIDEBAR).append(bottomOptgroup);
};

// Add Workbook Expressions
addOptionsToDropdown(grnState.nodeColoring.nodeColoringOptions.workbookExpressions, "User-Uploaded");

// Add Database Expressions
addOptionsToDropdown(grnState.nodeColoring.nodeColoringOptions.databaseExpressions, "Expression Database");


$("#topDatasetDropdownMenu li a span").first().addClass("glyphicon-ok");
$("#bottomDatasetDropdownMenu li a span").first().addClass("glyphicon-ok");
Expand Down

0 comments on commit 8d8ca9e

Please sign in to comment.