Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#863 Separated options into user-uploaded and expression database #1179

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 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 Expand Up @@ -148,4 +151,7 @@ export const grnState = {

// Viewport Size Parameter
viewportSize: VIEWPORT_INIT,

// Demo Dropdown Selection
demoDropdownValue: null,
};
3 changes: 3 additions & 0 deletions web-client/public/js/setup-load-and-import-handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@
if (selected === demoClass) {
loadDemo(demoPath, demoClass, demoName);
}
grnState.demoDropdownValue = selected;
});
};

Expand Down Expand Up @@ -227,12 +228,14 @@
}
grnState.name = name;
grnState.workbook = workbook;
grnState.demoDropdownValue = null;
// Reset the node coloring dataset selection
grnState.nodeColoring.topDataset = grnState.defaultDataset;
grnState.nodeColoring.bottomDataset = grnState.defaultDataset;
grnState.annotateLinks();
disableUpload(false);
updateApp(grnState);
reloader = () => responseCustomWorkbookData(grnState, queryURL, name);

Check failure on line 239 in web-client/public/js/setup-load-and-import-handlers.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Trailing spaces not allowed

Check failure on line 239 in web-client/public/js/setup-load-and-import-handlers.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Trailing spaces not allowed
});
};
63 changes: 46 additions & 17 deletions web-client/public/js/update-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,11 @@
}
};

const resetDemoDropdown = () =>{
$("#demoSourceDropdown option").removeAttr("selected");
$("#demoSourceDropdown").val("none");
};

const checkWorkbookModeSettings = () => {
const hasExpression = hasExpressionData(grnState.workbook.expression);

Expand Down Expand Up @@ -700,16 +705,17 @@
</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 710 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

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

View workflow job for this annotation

GitHub Actions / build (20.x)

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

Check failure on line 711 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

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

View workflow job for this annotation

GitHub Actions / build (20.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 714 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

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

View workflow job for this annotation

GitHub Actions / build (20.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 +724,38 @@

// $(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 730 in web-client/public/js/update-app.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Trailing spaces not allowed

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

View workflow job for this annotation

GitHub Actions / build (20.x)

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

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

View workflow job for this annotation

GitHub Actions / build (18.x)

Trailing spaces not allowed

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

View workflow job for this annotation

GitHub Actions / build (20.x)

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

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

View workflow job for this annotation

GitHub Actions / build (18.x)

Trailing spaces not allowed

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

View workflow job for this annotation

GitHub Actions / build (20.x)

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

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

View workflow job for this annotation

GitHub Actions / build (18.x)

Trailing spaces not allowed

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

View workflow job for this annotation

GitHub Actions / build (20.x)

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

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

View workflow job for this annotation

GitHub Actions / build (18.x)

Trailing spaces not allowed

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

View workflow job for this annotation

GitHub Actions / build (20.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 748 in web-client/public/js/update-app.js

View workflow job for this annotation

GitHub Actions / build (18.x)

Trailing spaces not allowed

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

View workflow job for this annotation

GitHub Actions / build (20.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 Expand Up @@ -822,6 +847,10 @@
grnState.nodeColoringEnabled = false;
}
}
if (!(grnState.demoDropdownValue)){
resetDemoDropdown();
}

refreshApp();

// Rare exception to the MVC cycle: right now we have no way of knowing whether the workbook has changed
Expand Down
Loading