Add designer service
Fixed a bug in the configuration
Change-Id: I6a40bff70ed71d72d6b75104ffb1002d83ade1b2
Issue-ID: SDC-958
Signed-off-by: Idan Amit <ia096e@intl.att.com>
diff --git a/catalog-ui/src/app/ng2/app.module.ts b/catalog-ui/src/app/ng2/app.module.ts
index ecaa26e..5cf4d80 100644
--- a/catalog-ui/src/app/ng2/app.module.ts
+++ b/catalog-ui/src/app/ng2/app.module.ts
@@ -47,6 +47,7 @@
import { TranslateModule } from "./shared/translator/translate.module";
import { TranslationServiceConfig } from "./config/translation.service.config";
import {DesignerFrameModule} from "./components/ui/designer/designer-frame.module";
+import {DesignersService} from "./services/designers.service";
export const upgradeAdapter = new UpgradeAdapter(forwardRef(() => AppModule));
@@ -97,6 +98,7 @@
SdcConfig,
ComponentInstanceServiceNg2,
TranslationServiceConfig,
+ DesignersService,
{
provide: APP_INITIALIZER,
useFactory: configServiceFactory,
diff --git a/catalog-ui/src/app/ng2/services/designers.service.ts b/catalog-ui/src/app/ng2/services/designers.service.ts
new file mode 100644
index 0000000..283b54b
--- /dev/null
+++ b/catalog-ui/src/app/ng2/services/designers.service.ts
@@ -0,0 +1,17 @@
+import { Injectable } from '@angular/core';
+import {Designer, DesignersConfiguration} from "app/models";
+
+@Injectable()
+export class DesignersService {
+
+ constructor() {
+ }
+
+ public getDesignerByStateUrl = (stateUrl: string) => {
+ let designerKey: any = _.findKey(DesignersConfiguration.designers, (designerConfig: Designer) =>{
+ return designerConfig.designerStateUrl === stateUrl;
+ });
+
+ return DesignersConfiguration.designers[designerKey];
+ }
+}