Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
eResearch
sails-hook-redbox-labarchives
Commits
c76f1c05
Commit
c76f1c05
authored
Feb 01, 2019
by
Moises Sacal
Browse files
added reducer for checking links for issue
#27
parent
ba3d887a
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
angular/labarchives/dist/main.bundle.js
View file @
c76f1c05
This diff is collapsed.
Click to expand it.
angular/labarchives/src/app/components/labarchives-list.component.ts
View file @
c76f1c05
...
...
@@ -67,7 +67,7 @@ export class LabarchivesListField extends FieldBase<any> {
return
{
id
:
nb
[
'
id
'
],
name
:
nb
[
'
name
'
],
isDefault
:
nb
[
'
is-default
'
][
'
_
'
]
==
'
true
'
?
this
.
defaultNotebookLabel
:
''
,
isDefault
:
nb
[
'
is-default
'
][
'
_
'
]
==
'
true
'
?
this
.
defaultNotebookLabel
:
''
,
rdmp
:
{
info
:
''
}
}
});
...
...
@@ -90,25 +90,26 @@ export class LabarchivesListField extends FieldBase<any> {
}
checkLinks
()
{
//this.workspaces[index]['linkedState'] == 'check'; // Possible values: linked, another, link
this
.
workspaces
.
map
((
w
,
index
)
=>
{
this
.
labarchivesService
.
checkLink
(
this
.
rdmp
,
w
[
'
id
'
])
.
then
((
response
)
=>
{
if
(
!
response
.
status
)
{
throw
new
Error
(
'
Error checking workspace
'
);
}
else
{
const
check
=
response
[
'
check
'
];
if
(
check
[
'
link
'
]
===
'
linked
'
)
{
this
.
workspaces
[
index
][
'
linkedState
'
]
=
'
linked
'
;
this
.
workspaces
.
reduce
((
promise
,
w
,
index
)
=>
{
return
promise
.
then
(()
=>
{
return
this
.
labarchivesService
.
checkLink
(
this
.
rdmp
,
w
[
'
id
'
])
.
then
((
response
)
=>
{
if
(
!
response
.
status
)
{
throw
new
Error
(
'
Error checking workspace
'
);
}
else
{
this
.
workspaces
[
index
][
'
linkedState
'
]
=
'
link
'
;
const
check
=
response
[
'
check
'
];
if
(
check
[
'
link
'
]
===
'
linked
'
)
{
this
.
workspaces
[
index
][
'
linkedState
'
]
=
'
linked
'
;
}
else
{
this
.
workspaces
[
index
][
'
linkedState
'
]
=
'
link
'
;
}
}
}
})
.
catch
((
error
)
=>
{
this
.
workspaces
[
index
][
'
linkedState
'
]
=
'
problem
'
;
});
});
}
)
.
catch
((
error
)
=>
{
this
.
workspaces
[
index
][
'
linkedState
'
]
=
'
problem
'
;
})
;
});
}
,
Promise
.
resolve
()
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment