Skip to content

Commit

Permalink
Proper logging support #109
Browse files Browse the repository at this point in the history
  • Loading branch information
DevanshiDesai committed Jun 14, 2021
1 parent 16bdd78 commit c31f224
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 13 deletions.
6 changes: 6 additions & 0 deletions boolean-search/booleansearch.app.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ var setSourceForFilter;
headers[ERMrest.contextHeaderName].column = "Strength";
headers[ERMrest.contextHeaderName].referrer = { schema_table: "Gene_Expression:Specimen" };
headers[ERMrest.contextHeaderName].source = [{ "inbound": ["Gene_Expression", "Specimen_Expression_Specimen_fkey"] }, "Strength"];
var pcid= UriUtils.getQueryParams($window.location.href).pcid;
var ppid= UriUtils.getQueryParams($window.location.href).ppid;
if(pcid)
headers[ERMrest.contextHeaderName].pcid=pcid
if(ppid)
headers[ERMrest.contextHeaderName].ppid=ppid
return server.http.get(specExprUrl + "/Strength", { headers: headers }).then(function success(response) {
return response.data;
}).catch(function (err) {
Expand Down
11 changes: 7 additions & 4 deletions heatmap/heatmap.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,22 @@ var heatmapApp =
headInjector.setWindowName();
headerInfo.pid = MathUtils.uuid();
headerInfo.cid = "heatmap";
$rootScope.pid
var header = {
wid: $window.name,
cid: headerInfo.cid,
pid: headerInfo.pid,
action: "main",
schema_table: "Gene_Expression:Array_Data_view"
action: "model/read",
schema_table: "Gene_Expression:Array_Data_view",
catalog: UriUtils.getCatalogId()
};
ERMrest.resolve(ermrestURI, {cid: headerInfo.cid, pid: headerInfo.pid, wid: $window.name, action: "model/read"}).then(function getReference(reference) {
ERMrest.resolve(ermrestURI, header).then(function getReference(reference) {
verifyConfiguration(reference);
if (!$rootScope.configErrorsPresent) {
var sortBy = typeof heatmapConfig.data.sortBy !== "undefined" ? heatmapConfig.data.sortBy : [];
var ref = reference.sort(sortBy);
header['action']="main";
header["ppid"]=UriUtils.getQueryParams(location.href).ppid;
header["pcid"]=UriUtils.getQueryParams(location.href).pcid;
ref.read(1000, header).then(function getPage(page) {
readAll(page);
}).catch(function (error) {
Expand Down
7 changes: 6 additions & 1 deletion lineplot/lineplot.app.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,12 @@
uriWithFilters += "&recorded_time::leq::" + UriUtils.fixedEncodeURIComponent(end_x);
}
var uri = uriWithFilters + "/" + trace.x_col + "," + trace.y_col + "@sort(recorded_time)?limit=" + $rootScope.limit;
server.http.get(uri).then(function(response) {
if($rootScope.params["pcid"])
contextHeaderParams['pcid']=$rootScope.params["pcid"]
if($rootScope.params["ppid"])
contextHeaderParams['ppid']=$rootScope.params["ppid"]

server.http.get(uri, { headers: contextHeaderParams }).then(function(response) {
// console.log(response, response.headers('content-type'));
var layout = {
title: lineplotConfig.plot_title,
Expand Down
19 changes: 16 additions & 3 deletions plot/plot.app.js
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,14 @@
defer.resolve(plot_values);// TODO: figure out how to return an error to catch clause without breaking code
return defer.promise;
}

server.http.get(uri).then(function(response) {
var headers = {};
headers[ERMrest.contextHeaderName]=ConfigUtils.getContextHeaderParams();
if(UriUtils.getQueryParams($window.location.href).pcid)
headers[ERMrest.contextHeaderName].pcid=UriUtils.getQueryParams($window.location.href).pcid;
if(UriUtils.getQueryParams($window.location.href).ppid)
headers[ERMrest.contextHeaderName].ppid=UriUtils.getQueryParams($window.location.href).ppid;

server.http.get(uri,{ headers: headers}).then(function(response) {
var data = response.data;

// transform x data based on groupKey
Expand Down Expand Up @@ -626,7 +632,14 @@
} else {
plot.traces.forEach(function (trace) {
var uri = trace.uri;
server.http.get(uri).then(function(response) {
var headers = {};
headers[ERMrest.contextHeaderName]=ConfigUtils.getContextHeaderParams();
if(UriUtils.getQueryParams($window.location.href).pcid)
headers[ERMrest.contextHeaderName].pcid=UriUtils.getQueryParams($window.location.href).pcid;
if(UriUtils.getQueryParams($window.location.href).ppid)
headers[ERMrest.contextHeaderName].ppid=UriUtils.getQueryParams($window.location.href).ppid;

server.http.get(uri,{ headers: headers }).then(function(response) {
try {
var layout = getPlotlyLayout(plot);
var data = response.data;
Expand Down
19 changes: 14 additions & 5 deletions treeview/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
// console.log($);
// console.log(ERMrest);
// console.log(Q);
var urlParams=[];
var urlParamNames=[];

function uuid() {
// gets a string of a deterministic length of 4
Expand All @@ -14,14 +16,21 @@
return s4() + s4() + s4() + s4() + s4() + s4();
}
function getHeader(action, schemaTable, params) {
return ERMrest._certifyContextHeader({
var header={
wid: window.name,
pid: uuid(),
cid: "treeview",
action: action,
schema_table: schemaTable,
params: params
});
params: params,
}
if(action==="main"){
if(urlParams['pcid'])
header['pcid']=urlParams['pcid']
if(urlParams['ppid'])
header['ppid']=urlParams['ppid']
}
return ERMrest._certifyContextHeader(header);
}

if (!window.name) {
Expand All @@ -34,8 +43,8 @@
var showAnnotation, id_parameter, filterUrl, filterValue, columnName, parentAppExists, selected_option;
var annotated_term = "";
var annotated_terms = [],
urlParams = {}, // key/values from uri
urlParamNames = [], // keys defined in url
// urlParams = {}, // key/values from uri
// urlParamNames = [], // keys defined in url
queryParams = {}, // key/values from uri and defaults in config
queryParamNames = [], // keys defined in templating
requiredParams = []; // params that are required and are used for identification purposes
Expand Down

0 comments on commit c31f224

Please sign in to comment.