Skip to content

Commit

Permalink
Table is now using dashboard to add Save As, Export and Generate func…
Browse files Browse the repository at this point in the history
…tionalities to it #16
  • Loading branch information
AdrianBZG committed Aug 1, 2018
1 parent 154229b commit 9545a46
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 18 deletions.
2 changes: 1 addition & 1 deletion public/javascripts/common.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/javascripts/genes-view.min.js

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

2 changes: 1 addition & 1 deletion public/javascripts/proteins-view.min.js

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

16 changes: 16 additions & 0 deletions public/stylesheets/hmb-style-main.css
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,22 @@ body.fixed-nav {
display: none;
}

.im-join-manager-button .btn {
display: none;
}

.im-filter-dialogue-button .btn {
display: none;
}

.im-column-manager-button .btn {
display: none;
}

.im-history .btn {
display: none;
}

.smaller {
font-size: 0.7rem;
}
Expand Down
39 changes: 35 additions & 4 deletions src/js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,33 @@ function getParticipant2SymbolsInClass() {
})
}

/**
* Method that returns a valid session API key for the current mine
*/
function getSessionToken() {
var tokenUrl = escapeMineURL(window.mineUrl);
var tokenKey = "";

if(tokenUrl.slice(-1) == "/") {
tokenUrl += "session";
} else {
tokenUrl += "/session";
}

// Get token
$.ajax({
'url': tokenUrl,
data: {},
async: false,
error: function(xhr, status) {},
success: function(data) {
tokenKey = data.token;
}
});

return tokenKey;
}

/**
* Method to get the different items inside a class (count per organism) in order to feed the sidebar
* @param {array} constraints: the constraints for the endpoint call
Expand Down Expand Up @@ -1253,8 +1280,12 @@ function fillMineSelector() {

// Instantiate the im-table with all the data available in Gene from HumanMine
var selector = '#dataTable';

$(selector).empty();

var service = {
root: escapeMineURL(window.mineUrl)
root: escapeMineURL(window.mineUrl),
token: getSessionToken()
};
var query = {
select: ['*'],
Expand All @@ -1269,7 +1300,7 @@ function fillMineSelector() {

imtables.configure('TableResults.CacheFactor', 20);

var imtable = imtables.loadTable(
var imtable = imtables.loadDash(
selector, {
"start": 0,
"size": 25
Expand All @@ -1281,13 +1312,13 @@ function fillMineSelector() {
function(table) {
//console.log('Table loaded', table);
//this .on listener will do something when someone interacts with the table.
table.on("rendered", function(changeDetail) {
table.children.table.on("rendered", function(changeDetail) {
console.log("Rendered table");
console.log(changeDetail);
updateElements(table.history.currentQuery.constraints, "PieChart");
});

window.imTable = table;
window.imTable = table.children.table;
},
function(error) {
console.error('Could not load table', error);
Expand Down
12 changes: 7 additions & 5 deletions src/js/genes-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ $(document).ready(function() {
document.title = window.currentClassView + " in HumanMine";
$("#proteinsButton").removeClass("btn-primary").addClass("btn-default");
$("#genesButton").removeClass("btn-default").addClass("btn-primary");
var mineUrl = window.mineUrl.replace(/COLON/g, ":").replace(/SLASH/g, "/");

// Instantiate the im-table with all the data available in Gene from HumanMine
var selector = '#dataTable';
var service = {
root: window.mineUrl.replace(/COLON/g, ":").replace(/SLASH/g, "/")
root: mineUrl,
token: getSessionToken()
};
var query = {
select: ['*'],
Expand All @@ -24,7 +26,7 @@ $(document).ready(function() {

imtables.configure('TableResults.CacheFactor', 20);

var imtable = imtables.loadTable(
var imtable = imtables.loadDash(
selector, {
"start": 0,
"size": 25
Expand All @@ -34,15 +36,15 @@ $(document).ready(function() {
}
).then(
function(table) {
//console.log('Table loaded', table);
console.log('Table loaded', table.children.table);
//this .on listener will do something when someone interacts with the table.
table.on("rendered", function(changeDetail) {
table.children.table.on("rendered", function(changeDetail) {
console.log("Rendered table");
console.log(changeDetail);
updateElements(table.history.currentQuery.constraints, "PieChart");
});

window.imTable = table;
window.imTable = table.children.table;
},
function(error) {
console.error('Could not load table', error);
Expand Down
12 changes: 7 additions & 5 deletions src/js/proteins-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ $(document).ready(function() {
document.title = window.currentClassView + " in HumanMine";
$("#genesButton").removeClass("btn-primary").addClass("btn-default");
$("#proteinsButton").removeClass("btn-default").addClass("btn-primary");
var mineUrl = window.mineUrl.replace(/COLON/g, ":").replace(/SLASH/g, "/");

// Instantiate the im-table with all the data available in Protein from HumanMine
var selector = '#dataTable';
var service = {
root: window.mineUrl.replace(/COLON/g, ":").replace(/SLASH/g, "/")
root: mineUrl,
token: getSessionToken()
};
var query = {
select: ['*'],
Expand All @@ -23,7 +25,7 @@ $(document).ready(function() {

imtables.configure('TableResults.CacheFactor', 20);

var imtable = imtables.loadTable(
var imtable = imtables.loadDash(
selector, {
"start": 0,
"size": 25
Expand All @@ -33,13 +35,13 @@ $(document).ready(function() {
}
).then(
function(table) {
console.log('Table loaded', table);
console.log('Table loaded', table.children.table);
//this .on listener will do something when someone interacts with the table.
table.on("all", function(changeDetail) {
table.children.table.on("all", function(changeDetail) {
updateElements(table.history.currentQuery.constraints, "PieChart");
});

window.imTable = table;
window.imTable = table.children.table;
},
function(error) {
console.error('Could not load table', error);
Expand Down
10 changes: 9 additions & 1 deletion src/scss/_global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -181,4 +181,12 @@ body.fixed-nav {
border-radius: 0px;
}

.im-empty-apology .alert .btn {display:none}
.im-empty-apology .alert .btn {display:none}

.im-join-manager-button .btn {display:none}

.im-filter-dialogue-button .btn {display:none}

.im-column-manager-button .btn {display:none}

.im-history .btn {display:none}

0 comments on commit 9545a46

Please sign in to comment.