Commit e57edcd0 authored by Moises Sacal's avatar Moises Sacal
Browse files

updating link with no permissions for issue #21

parent 1afe3e5e
...@@ -2,7 +2,7 @@ declare var module; ...@@ -2,7 +2,7 @@ declare var module;
declare var sails, Model; declare var sails, Model;
declare var _; declare var _;
import {Observable} from 'rxjs/Rx'; import {Observable} from 'rxjs';
import 'rxjs/add/operator/map'; import 'rxjs/add/operator/map';
declare var BrandingService, WorkspaceService, LabarchivesService; declare var BrandingService, WorkspaceService, LabarchivesService;
...@@ -161,9 +161,10 @@ export module Controllers { ...@@ -161,9 +161,10 @@ export module Controllers {
.flatMap(response => { .flatMap(response => {
sails.log.debug('insertNode'); sails.log.debug('insertNode');
sails.log.debug(response); sails.log.debug(response);
const tree = response['tree-tools']; if (response && response['tree-tools']) {
const node = tree['node']; const tree = response['tree-tools'];
metadataContent = ` const node = tree['node'];
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>
...@@ -171,11 +172,12 @@ export module Controllers { ...@@ -171,11 +172,12 @@ export module Controllers {
<p>Stash Id: ${workspace.oid}</p> <p>Stash Id: ${workspace.oid}</p>
</div> </div>
`; `;
const partType = 'text entry'; const partType = 'text entry';
const insertNode = LabarchivesService.addEntry( const insertNode = LabarchivesService.addEntry(
this.config.key, info['id'], nbId, node['tree-id'], partType, metadataContent this.config.key, info['id'], nbId, node['tree-id'], partType, metadataContent
); );
return Observable.fromPromise(insertNode); return Observable.fromPromise(insertNode);
} else return Observable.throwError(new Error('cannot insert node'));
}) })
.flatMap(response => { .flatMap(response => {
if (recordMetadata.workspaces) { if (recordMetadata.workspaces) {
......
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