From ef6b56e1da54a256f5101e407a2e7403703bb97d Mon Sep 17 00:00:00 2001 From: Dheeraj Bhatia Date: Tue, 19 Apr 2022 19:41:53 -0400 Subject: [PATCH 1/4] test instance changes and add serviceinfo to appinfo changes --- api/common.js | 9 ++++++--- api/models.js | 1 + bin/appinfo.js | 12 +++++++++--- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/api/common.js b/api/common.js index 643886c7..f33ed4c3 100644 --- a/api/common.js +++ b/api/common.js @@ -679,9 +679,12 @@ exports.compose_pub_datacite_metadata = function(pub) { exports.get_next_app_doi = function(cb) { //console.log("querying for next doi") db.Apps.find({}).select("doi").sort("-doi").limit(1).exec().then(recs=>{ - let rec = recs[0]; - let doi_tokens = rec.doi.split("."); - let num = parseInt(doi_tokens[doi_tokens.length-1])+1; + let num = 1; + if(recs.length) { + let rec = recs[0]; + let doi_tokens = rec.doi.split("."); + num = parseInt(doi_tokens[doi_tokens.length-1])+1; + } //console.debug("next doi token will be", num); cb(null, config.datacite.prefix+"app."+num); }).catch(cb); diff --git a/api/models.js b/api/models.js index 272de855..f8091297 100644 --- a/api/models.js +++ b/api/models.js @@ -699,6 +699,7 @@ var appSchema = mongoose.Schema({ ], examples: Number, //number of example workflows found + monthlyCounts: [Number] }, removed: { type: Boolean, default: false} , diff --git a/bin/appinfo.js b/bin/appinfo.js index df86f2dd..d75a5fb9 100755 --- a/bin/appinfo.js +++ b/bin/appinfo.js @@ -86,12 +86,14 @@ function handle_app(app, cb) { app.stats.runtime_mean = info.runtime_mean; app.stats.runtime_std = info.runtime_std; app.stats.requested = info.counts.requested, - + app.stats.monthlyCounts = info.monthlyCounts; + // console.log(app.stats.monthlyCounts,app.name); next(); }).catch(next); }, //cache example workflow + async ()=>{ const cachefname = "/tmp/example.app-"+app.id+".json"; //needs to match the path used in controller/app.js @@ -128,6 +130,7 @@ function handle_app(app, cb) { fs.writeFileSync(cachefname, JSON.stringify(subsetProvs)); app.stats.examples = subsetProvs.length; + // console.log(app.name,app.stats); app.markModified('stats'); }, @@ -154,8 +157,8 @@ function handle_app(app, cb) { name: resource.name, } }); - app.markModified('stats'); + app.markModified('stats'); common.update_appinfo(app, next); }).catch(next); }, @@ -163,7 +166,8 @@ function handle_app(app, cb) { //issue doi next=>{ if(app.doi) return next(); - logger.debug("minting doi"); + if(!config.datacite) return next(); + console.log("minting doi",app._id,app.doi); common.get_next_app_doi((err, doi)=>{ if(err) return next(err); app.doi = doi; @@ -178,6 +182,7 @@ function handle_app(app, cb) { //check doi next=>{ + if(!config.datacite) return next(); let url = "https://doi.org/"+app.doi; console.log("checking doi", url); //if(config.debug) url = "https://doi.org/10.25663/brainlife.app.448"; @@ -197,6 +202,7 @@ function handle_app(app, cb) { //now save the app next=>{ + console.log(app._id,app.stats); app.save(next); }, From d98e1ea96915487266b4342c07f40e02e88c9246 Mon Sep 17 00:00:00 2001 From: Dheeraj Bhatia Date: Thu, 21 Apr 2022 16:24:18 -0400 Subject: [PATCH 2/4] removed log statement --- bin/appinfo.js | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/appinfo.js b/bin/appinfo.js index d75a5fb9..d953ba7a 100755 --- a/bin/appinfo.js +++ b/bin/appinfo.js @@ -202,7 +202,6 @@ function handle_app(app, cb) { //now save the app next=>{ - console.log(app._id,app.stats); app.save(next); }, From 1fb8a06f985954f2bf160d06dca93ccaddb18b22 Mon Sep 17 00:00:00 2001 From: Dheeraj Date: Thu, 21 Apr 2022 18:57:39 -0400 Subject: [PATCH 3/4] added plotly graph --- ui/src/app.vue | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/ui/src/app.vue b/ui/src/app.vue index d54b5852..99bf707f 100644 --- a/ui/src/app.vue +++ b/ui/src/app.vue @@ -104,6 +104,11 @@ + +
+ +
+

@@ -399,7 +404,7 @@ export default { taskRecord, projectcard, exampleworkflow, - + ExportablePlotly: ()=>import('@/components/ExportablePlotly'), editor: ()=>import('vue2-ace-editor'), }, @@ -421,6 +426,8 @@ export default { {id: "recentJobs"}, {id: "example"}, ], + appStats: null, + statsLayout:null, tasks: [], //recent tasks submitted serviceinfo: null, @@ -521,11 +528,28 @@ export default { if(task.resource_id) this.resource_cache(task.resource_id, (err, resource)=>{ task._resource = resource; }); - }); + }); }).catch(console.error); this.$http.get(Vue.config.amaretti_api+'/service/info', {params: {service: this.app.github}}).then(res=>{ this.serviceinfo = res.data; + this.appStats = [{ + y : this.serviceinfo.monthlyCounts, + x: [], + type: "bar", + }]; + console.log(this.serviceinfo.monthlyCounts.length); + + this.serviceinfo.monthlyCounts.forEach(async(count,index)=>{ + if(!count) count = 0; + const startDate = new Date("01/01/2017"); + const dataDate = new Date(startDate.setMonth(startDate.getMonth()+index)); + this.appStats[0].x[index] = dataDate.toLocaleString('en-us',{month:'short', year:'numeric'}); + }) + this.statsLayout = { + height: 500, + width:500, + }; }).catch(console.error); } From a240aa085a337f8f28a090eda9f5fb14e6b4baa5 Mon Sep 17 00:00:00 2001 From: Dheeraj Date: Thu, 21 Apr 2022 19:01:27 -0400 Subject: [PATCH 4/4] removed whitespace --- ui/src/app.vue | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/ui/src/app.vue b/ui/src/app.vue index 99bf707f..01b5fab6 100644 --- a/ui/src/app.vue +++ b/ui/src/app.vue @@ -4,7 +4,7 @@

Private App

- The App you are trying access is a private App (belongs to a specific brainlife project). You must be logged in and also must be a member + The App you are trying access is a private App (belongs to a specific brainlife project). You must be logged in and also must be a member of the project to which this App belongs. Please contact the current maintainer of this App. @@ -14,7 +14,7 @@
- +