CORD-772 Loading external app when a new XosComponent of that kind is created and injecting loaded components at boot
Change-Id: I4f70d3b1e48b63eab3b8f8d2ca3f5b049b468f4c
diff --git a/src/app/datasources/helpers/search.service.ts b/src/app/datasources/helpers/search.service.ts
index 8cd98a7..5565b2c 100644
--- a/src/app/datasources/helpers/search.service.ts
+++ b/src/app/datasources/helpers/search.service.ts
@@ -1,7 +1,7 @@
import * as _ from 'lodash';
import {IXosNavigationService} from '../../core/services/navigation';
import {IXosState} from '../../../index';
-import {IModelStoreService} from '../stores/model.store';
+import {IXosModelStoreService} from '../stores/model.store';
import {IXosConfigHelpersService} from '../../core/services/helpers/config.helpers';
export interface IXosSearchResult {
@@ -21,7 +21,7 @@
constructor (
private $rootScope: ng.IScope,
private NavigationService: IXosNavigationService,
- private ModelStore: IModelStoreService,
+ private ModelStore: IXosModelStoreService,
private ConfigHelpers: IXosConfigHelpersService
) {
this.$rootScope.$on('xos.core.modelSetup', () => {
diff --git a/src/app/datasources/stores/model.store.spec.ts b/src/app/datasources/stores/model.store.spec.ts
index a73e5ff..7173658 100644
--- a/src/app/datasources/stores/model.store.spec.ts
+++ b/src/app/datasources/stores/model.store.spec.ts
@@ -1,7 +1,7 @@
import * as angular from 'angular';
import 'angular-mocks';
import 'angular-resource';
-import {IModelStoreService, ModelStore} from './model.store';
+import {IXosModelStoreService, ModelStore} from './model.store';
import {Subject} from 'rxjs';
import {IWSEvent} from '../websocket/global';
import {StoreHelpers} from '../helpers/store.helpers';
@@ -9,7 +9,7 @@
import {ConfigHelpers} from '../../core/services/helpers/config.helpers';
import {AuthService} from '../rest/auth.rest';
-let service: IModelStoreService;
+let service: IXosModelStoreService;
let httpBackend: ng.IHttpBackendService;
let $scope;
let WebSocket;
@@ -55,7 +55,7 @@
});
beforeEach(angular.mock.inject((
- ModelStore: IModelStoreService,
+ ModelStore: IXosModelStoreService,
$httpBackend: ng.IHttpBackendService,
_$rootScope_: ng.IRootScopeService,
_WebSocket_: any
diff --git a/src/app/datasources/stores/model.store.ts b/src/app/datasources/stores/model.store.ts
index a070436..291e7c0 100644
--- a/src/app/datasources/stores/model.store.ts
+++ b/src/app/datasources/stores/model.store.ts
@@ -5,12 +5,12 @@
import {IXosResourceService} from '../rest/model.rest';
import {IStoreHelpersService} from '../helpers/store.helpers';
-export interface IModelStoreService {
+export interface IXosModelStoreService {
query(model: string): Observable<any>;
search(modelName: string): any[];
}
-export class ModelStore {
+export class ModelStore implements IXosModelStoreService {
static $inject = ['$log', 'WebSocket', 'StoreHelpers', 'ModelRest'];
private _collections: any; // NOTE contains a map of {model: BehaviourSubject}
constructor(
@@ -22,7 +22,7 @@
this._collections = {};
}
- public query(model: string) {
+ public query(model: string): Observable<any> {
// if there isn't already an observable for that item
if (!this._collections[model]) {
this._collections[model] = new BehaviorSubject([]); // NOTE maybe this can be created when we get response from the resource