Commit 932b7a8a authored by Moises Sacal's avatar Moises Sacal

fixed users notebooks when there is only one notebook

parent 6bf5d8f7
...@@ -86,7 +86,16 @@ var Controllers; ...@@ -86,7 +86,16 @@ var Controllers;
} }
}) })
.subscribe(response => { .subscribe(response => {
const notebooks = response['users']['notebooks']; let resNotebooks = response['users']['notebooks'];
let notebooks = { '$': { type: 'array' }, notebook: [] };
if (Array.isArray(resNotebooks['notebook'])) {
notebooks['notebook'] = resNotebooks['notebook'];
}
else {
if (resNotebooks['notebook']) {
notebooks['notebook'] = [resNotebooks['notebook']];
}
}
this.ajaxOk(req, res, null, { status: true, notebooks: notebooks, message: 'list' }); this.ajaxOk(req, res, null, { status: true, notebooks: notebooks, message: 'list' });
}, error => { }, error => {
sails.log.error('list: error'); sails.log.error('list: error');
...@@ -148,11 +157,11 @@ var Controllers; ...@@ -148,11 +157,11 @@ var Controllers;
const tree = response['tree-tools']; const tree = response['tree-tools'];
const node = tree['node']; const node = tree['node'];
metadataContent = ` metadataContent = `
<div id="${workspace.oid}"> <div id="${workspace.oid}">
<h1>UTS</h1> <h1>UTS</h1>
<h3>Workspace <strong>${nbName}</strong> is linked to:</h3> <h3>Workspace <strong>${nbName}</strong> is linked to:</h3>
<h2>Research Data Management Plan <a href="${this.config.brandingAndPortalUrl}/record/view/${rdmp}">${rdmpTitle}</a></h2> <h2>Research Data Management Plan <a href="${this.config.brandingAndPortalUrl}/record/view/${rdmp}">${rdmpTitle}</a></h2>
<p>Stash Id: ${workspace.oid}</p> <p>Stash Id: ${workspace.oid}</p>
</div> </div>
`; `;
const partType = 'text entry'; const partType = 'text entry';
......
...@@ -102,7 +102,15 @@ export module Controllers { ...@@ -102,7 +102,15 @@ export module Controllers {
} }
}) })
.subscribe(response => { .subscribe(response => {
const notebooks = response['users']['notebooks']; let resNotebooks = response['users']['notebooks'];
let notebooks = {'$': { type: 'array' }, notebook: []};
if(Array.isArray(resNotebooks['notebook'])) {
notebooks['notebook'] = resNotebooks['notebook'];
} else {
if(resNotebooks['notebook']){
notebooks['notebook'] = [resNotebooks['notebook']];
}
}
this.ajaxOk(req, res, null, {status: true, notebooks: notebooks, message: 'list'}); this.ajaxOk(req, res, null, {status: true, notebooks: notebooks, message: 'list'});
}, error => { }, error => {
sails.log.error('list: error'); sails.log.error('list: error');
...@@ -171,11 +179,11 @@ export module Controllers { ...@@ -171,11 +179,11 @@ export module Controllers {
const tree = response['tree-tools']; const tree = response['tree-tools'];
const node = tree['node']; const node = tree['node'];
metadataContent = ` metadataContent = `
<div id="${workspace.oid}"> <div id="${workspace.oid}">
<h1>UTS</h1> <h1>UTS</h1>
<h3>Workspace <strong>${nbName}</strong> is linked to:</h3> <h3>Workspace <strong>${nbName}</strong> is linked to:</h3>
<h2>Research Data Management Plan <a href="${this.config.brandingAndPortalUrl}/record/view/${rdmp}">${rdmpTitle}</a></h2> <h2>Research Data Management Plan <a href="${this.config.brandingAndPortalUrl}/record/view/${rdmp}">${rdmpTitle}</a></h2>
<p>Stash Id: ${workspace.oid}</p> <p>Stash Id: ${workspace.oid}</p>
</div> </div>
`; `;
const partType = 'text entry'; const partType = 'text entry';
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment