Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
siibra-explorer
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Xiao Gui
siibra-explorer
Commits
84d90b1b
Commit
84d90b1b
authored
5 years ago
by
Xiao Gui
Browse files
Options
Downloads
Patches
Plain Diff
bugfix: failing single plugin manifest does not fail all
parent
87157bf6
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/atlasViewer/atlasViewer.dataService.service.ts
+7
-34
7 additions, 34 deletions
src/atlasViewer/atlasViewer.dataService.service.ts
src/atlasViewer/atlasViewer.pluginService.service.ts
+40
-4
40 additions, 4 deletions
src/atlasViewer/atlasViewer.pluginService.service.ts
with
47 additions
and
38 deletions
src/atlasViewer/atlasViewer.dataService.service.ts
+
7
−
34
View file @
84d90b1b
import
{
Injectable
,
OnDestroy
}
from
"
@angular/core
"
;
import
{
Injectable
,
OnDestroy
}
from
"
@angular/core
"
;
import
{
Store
,
select
}
from
"
@ngrx/store
"
;
import
{
Store
}
from
"
@ngrx/store
"
;
import
{
ViewerStateInterface
,
FETCHED_TEMPLATE
,
DataEntry
,
FETCHED_DATAENTRIES
,
safeFilter
,
FETCHED_SPATIAL_DATA
,
UPDATE_SPATIAL_DATA
}
from
"
../services/stateStore.service
"
;
import
{
ViewerStateInterface
,
FETCHED_TEMPLATE
,
FETCHED_SPATIAL_DATA
,
UPDATE_SPATIAL_DATA
}
from
"
../services/stateStore.service
"
;
import
{
Subscription
,
combineLatest
}
from
"
rxjs
"
;
import
{
Subscription
}
from
"
rxjs
"
;
import
{
AtlasViewerConstantsServices
}
from
"
./atlasViewer.constantService.service
"
;
import
{
AtlasViewerConstantsServices
}
from
"
./atlasViewer.constantService.service
"
;
import
{
PluginManifest
}
from
"
./atlasViewer.pluginService.service
"
;
/**
* TODO move constructor into else where and deprecate ASAP
*/
@
Injectable
({
@
Injectable
({
providedIn
:
'
root
'
providedIn
:
'
root
'
...
@@ -11,36 +14,6 @@ import { PluginManifest } from "./atlasViewer.pluginService.service";
...
@@ -11,36 +14,6 @@ import { PluginManifest } from "./atlasViewer.pluginService.service";
export
class
AtlasViewerDataService
implements
OnDestroy
{
export
class
AtlasViewerDataService
implements
OnDestroy
{
private
subscriptions
:
Subscription
[]
=
[]
private
subscriptions
:
Subscription
[]
=
[]
/**
* TODO ensure
*/
public
promiseFetchedPluginManifests
:
Promise
<
PluginManifest
[]
>
=
new
Promise
((
resolve
,
reject
)
=>
{
Promise
.
all
([
PLUGINDEV
?
fetch
(
PLUGINDEV
).
then
(
res
=>
res
.
json
())
:
Promise
.
resolve
([]),
new
Promise
(
resolve
=>
{
fetch
(
`
${
this
.
constantService
.
backendUrl
}
plugins`
)
.
then
(
res
=>
res
.
json
())
.
then
(
arr
=>
Promise
.
all
(
arr
.
map
(
url
=>
fetch
(
url
).
then
(
res
=>
res
.
json
()))
))
.
then
(
resolve
)
.
catch
(
e
=>
{
resolve
([])
})
}),
Promise
.
all
(
BUNDLEDPLUGINS
.
filter
(
v
=>
typeof
v
===
'
string
'
)
.
map
(
v
=>
fetch
(
`res/plugin_examples/
${
v
}
/manifest.json`
).
then
(
res
=>
res
.
json
()))
)
.
then
(
arr
=>
arr
.
reduce
((
acc
,
curr
)
=>
acc
.
concat
(
curr
)
,[]))
])
.
then
(
arr
=>
resolve
(
[].
concat
(
arr
[
0
]).
concat
(
arr
[
1
])
))
.
catch
(
reject
)
})
constructor
(
constructor
(
private
store
:
Store
<
ViewerStateInterface
>
,
private
store
:
Store
<
ViewerStateInterface
>
,
...
...
This diff is collapsed.
Click to expand it.
src/atlasViewer/atlasViewer.pluginService.service.ts
+
40
−
4
View file @
84d90b1b
import
{
Injectable
,
ViewContainerRef
,
ComponentFactoryResolver
,
ComponentFactory
}
from
"
@angular/core
"
;
import
{
Injectable
,
ViewContainerRef
,
ComponentFactoryResolver
,
ComponentFactory
}
from
"
@angular/core
"
;
import
{
AtlasViewerDataService
}
from
"
./atlasViewer.dataService.service
"
;
import
{
PluginInitManifestInterface
,
ACTION_TYPES
}
from
"
src/services/state/pluginState.store
"
;
import
{
PluginInitManifestInterface
,
ACTION_TYPES
}
from
"
src/services/state/pluginState.store
"
;
import
{
isDefined
}
from
'
src/services/stateStore.service
'
import
{
isDefined
}
from
'
src/services/stateStore.service
'
import
{
AtlasViewerAPIServices
}
from
"
./atlasViewer.apiService.service
"
;
import
{
AtlasViewerAPIServices
}
from
"
./atlasViewer.apiService.service
"
;
...
@@ -11,6 +10,7 @@ import { interval } from "rxjs";
...
@@ -11,6 +10,7 @@ import { interval } from "rxjs";
import
{
take
,
takeUntil
}
from
"
rxjs/operators
"
;
import
{
take
,
takeUntil
}
from
"
rxjs/operators
"
;
import
{
Store
}
from
"
@ngrx/store
"
;
import
{
Store
}
from
"
@ngrx/store
"
;
import
{
WidgetUnit
}
from
"
./widgetUnit/widgetUnit.component
"
;
import
{
WidgetUnit
}
from
"
./widgetUnit/widgetUnit.component
"
;
import
{
AtlasViewerConstantsServices
}
from
"
./atlasViewer.constantService.service
"
;
@
Injectable
({
@
Injectable
({
providedIn
:
'
root
'
providedIn
:
'
root
'
...
@@ -25,7 +25,7 @@ export class PluginServices{
...
@@ -25,7 +25,7 @@ export class PluginServices{
constructor
(
constructor
(
private
apiService
:
AtlasViewerAPIServices
,
private
apiService
:
AtlasViewerAPIServices
,
private
atlasData
Service
:
AtlasViewer
Data
Service
,
private
constant
Service
:
AtlasViewer
Constants
Service
s
,
private
widgetService
:
WidgetServices
,
private
widgetService
:
WidgetServices
,
private
cfr
:
ComponentFactoryResolver
,
private
cfr
:
ComponentFactoryResolver
,
private
store
:
Store
<
PluginInitManifestInterface
>
private
store
:
Store
<
PluginInitManifestInterface
>
...
@@ -34,8 +34,44 @@ export class PluginServices{
...
@@ -34,8 +34,44 @@ export class PluginServices{
this
.
pluginUnitFactory
=
this
.
cfr
.
resolveComponentFactory
(
PluginUnit
)
this
.
pluginUnitFactory
=
this
.
cfr
.
resolveComponentFactory
(
PluginUnit
)
this
.
apiService
.
interactiveViewer
.
uiHandle
.
launchNewWidget
=
this
.
launchNewWidget
.
bind
(
this
)
this
.
apiService
.
interactiveViewer
.
uiHandle
.
launchNewWidget
=
this
.
launchNewWidget
.
bind
(
this
)
const
promiseFetchedPluginManifests
:
Promise
<
PluginManifest
[]
>
=
new
Promise
((
resolve
,
reject
)
=>
{
this
.
atlasDataService
.
promiseFetchedPluginManifests
Promise
.
all
([
/**
* PLUGINDEV should return an array of
*/
PLUGINDEV
?
fetch
(
PLUGINDEV
).
then
(
res
=>
res
.
json
())
:
Promise
.
resolve
([]),
new
Promise
(
resolve
=>
{
fetch
(
`
${
this
.
constantService
.
backendUrl
}
plugins`
)
.
then
(
res
=>
res
.
json
())
.
then
(
arr
=>
Promise
.
all
(
arr
.
map
(
url
=>
new
Promise
(
rs
=>
/**
* instead of failing all promises when fetching manifests, only fail those that fails to fetch
*/
fetch
(
url
).
then
(
res
=>
res
.
json
()).
then
(
rs
).
catch
(
e
=>
(
console
.
log
(
'
fetching manifest error
'
,
e
),
rs
(
null
))))
)
))
.
then
(
manifests
=>
resolve
(
manifests
.
filter
(
m
=>
!!
m
)
))
.
catch
(
e
=>
{
resolve
([])
})
}),
Promise
.
all
(
BUNDLEDPLUGINS
.
filter
(
v
=>
typeof
v
===
'
string
'
)
.
map
(
v
=>
fetch
(
`res/plugin_examples/
${
v
}
/manifest.json`
).
then
(
res
=>
res
.
json
()))
)
.
then
(
arr
=>
arr
.
reduce
((
acc
,
curr
)
=>
acc
.
concat
(
curr
)
,[]))
])
.
then
(
arr
=>
resolve
(
[].
concat
(
arr
[
0
]).
concat
(
arr
[
1
])
))
.
catch
(
reject
)
})
promiseFetchedPluginManifests
.
then
(
arr
=>
.
then
(
arr
=>
this
.
fetchedPluginManifests
=
arr
)
this
.
fetchedPluginManifests
=
arr
)
.
catch
(
console
.
error
)
.
catch
(
console
.
error
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment