Skip to content
Snippets Groups Projects
Unverified Commit decf13f3 authored by Xiao Gui's avatar Xiao Gui
Browse files

fix: filter by message namespace

maint: update CI version
maint: remove deprecated use of cmpfactory
parent 7d75dfb9
No related branches found
No related tags found
No related merge requests found
......@@ -14,7 +14,7 @@ jobs:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - uses: actions/checkout@v3
# - uses: actions/setup-node@v1
# with:
# node-version: '16.x'
......@@ -25,7 +25,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js 16.x for lint
uses: actions/setup-node@v1
with:
......@@ -41,7 +41,7 @@ jobs:
NODE_ENV: test
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js 16.x
uses: actions/setup-node@v1
with:
......@@ -63,7 +63,7 @@ jobs:
NODE_ENV: test
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js 16.x
uses: actions/setup-node@v1
with:
......
......@@ -30,7 +30,7 @@ jobs:
build: [ 'local', 'prod' ]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: 'Set matomo env var'
# if matrix.build is local, only run if master or dev
if: ${{ !(matrix.build == 'local' && github.ref != 'refs/heads/master' && github.ref != 'refs/heads/dev') }}
......@@ -120,7 +120,7 @@ jobs:
needs: build-docker-img
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set env var
run: |
echo "Using github.ref: $GITHUB_REF"
......
......@@ -59,7 +59,7 @@ jobs:
failure-state: ${{ steps.failure-state-step.outputs.failure-state }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
ref: ${{ github.event.ref }}
......
......@@ -9,7 +9,7 @@ jobs:
hide_previous_if_exists:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
ref: 'master'
- uses: actions/github-script@v5
......@@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: 'Add checklist comment'
uses: actions/github-script@v5
with:
......
......@@ -24,7 +24,7 @@ jobs:
if: success()
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Create Release
id: create_release
uses: actions/create-release@v1
......
......@@ -9,7 +9,7 @@ jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: wei/git-sync@v3
with:
source_repo: ${GITHUB_REPOSITORY}
......
......@@ -13,3 +13,4 @@
- Pass messages to plugin API when not handled
- Fix lint
- Update CI
\ No newline at end of file
......@@ -9,10 +9,15 @@ import { TYPE as NMV_TYPE, processJsonLd as nmvProcess } from './nmvSwc/index'
import { TYPE as NATIVE_TYPE, processJsonLd as nativeProcess } from './native'
import { BoothVisitor, JRPCRequest, ListenerChannel } from "src/api/jsonrpc"
import { ApiService } from "src/api";
import { ApiBoothEvents } from "src/api/service";
import { ApiBoothEvents, namespace as apiNameSpace } from "src/api/service";
export const IAV_POSTMESSAGE_NAMESPACE = `ebrains:iav:`
const RECOGNISED_NAMESPACES = [
IAV_POSTMESSAGE_NAMESPACE,
apiNameSpace
]
export const MANAGED_METHODS = [
'openminds:nmv:loadSwc',
'openminds:nmv:unloadSwc'
......@@ -69,7 +74,11 @@ export class MessagingService {
window.addEventListener('message', async ({ data, origin, source }) => {
if (/^webpack/.test(data.type)) return
if (data === '') return
if (!data) return
const { method } = data
if (RECOGNISED_NAMESPACES.every(namespace => method.indexOf(namespace) !== 0)) {
return
}
const src = source as Window
const { id } = data
try {
......
import { ComponentPortal } from "@angular/cdk/portal";
import { ComponentFactory, ComponentFactoryResolver, ComponentRef, Injectable, Injector, ViewContainerRef } from "@angular/core";
import { ComponentRef, Injectable, Injector, ViewContainerRef } from "@angular/core";
import { RM_WIDGET } from "./constants";
import { WidgetPortal } from "./widgetPortal/widgetPortal.component";
......@@ -12,11 +12,6 @@ export class WidgetService {
public vcr: ViewContainerRef
private viewRefMap = new Map<WidgetPortal<unknown>, ComponentRef<WidgetPortal<unknown>>>()
private cf: ComponentFactory<WidgetPortal<unknown>>
constructor(cfr: ComponentFactoryResolver){
this.cf = cfr.resolveComponentFactory(WidgetPortal)
}
public addNewWidget<T>(Component: new (...arg: any) => T, injector: Injector): WidgetPortal<T> {
const inj = Injector.create({
......@@ -26,7 +21,8 @@ export class WidgetService {
}],
parent: injector
})
const widgetPortal = this.vcr.createComponent(this.cf, 0, inj) as ComponentRef<WidgetPortal<T>>
const widgetPortal = this.vcr.createComponent(WidgetPortal, {index: 0, injector: inj}) as ComponentRef<WidgetPortal<T>>
const cmpPortal = new ComponentPortal<T>(Component, this.vcr, inj)
this.viewRefMap.set(widgetPortal.instance, widgetPortal)
......
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