diff options
author | Idan Amit <ia096e@intl.att.com> | 2018-01-31 13:27:33 +0200 |
---|---|---|
committer | Michael Lando <ml636r@att.com> | 2018-01-31 14:35:13 +0000 |
commit | eedaaf983d731d0179916b3f3a8e4d3a0d80981b (patch) | |
tree | 066eb388f47ac15ef35c98aa74618b751da47ae6 /catalog-ui/src/app/ng2 | |
parent | 3b09e29e1e1cab9baf3b1380718a3c45126930bd (diff) |
Change designer to plugin in code
Changed all the use of the designer configuration in the code to be plugin
Change-Id: Id9792cbd4fb9385446780c28fb7fb5418772acf6
Issue-ID: SDC-974
Signed-off-by: Idan Amit <ia096e@intl.att.com>
Diffstat (limited to 'catalog-ui/src/app/ng2')
-rw-r--r-- | catalog-ui/src/app/ng2/app.module.ts | 10 | ||||
-rw-r--r-- | catalog-ui/src/app/ng2/components/layout/top-nav/top-nav.component.ts | 16 | ||||
-rw-r--r-- | catalog-ui/src/app/ng2/components/ui/designer/designer-frame.component.html | 5 | ||||
-rw-r--r-- | catalog-ui/src/app/ng2/components/ui/designer/designer-frame.component.ts | 38 | ||||
-rw-r--r-- | catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.html | 5 | ||||
-rw-r--r-- | catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.less (renamed from catalog-ui/src/app/ng2/components/ui/designer/designer-frame.component.less) | 4 | ||||
-rw-r--r-- | catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.ts | 38 | ||||
-rw-r--r-- | catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.module.ts (renamed from catalog-ui/src/app/ng2/components/ui/designer/designer-frame.module.ts) | 10 | ||||
-rw-r--r-- | catalog-ui/src/app/ng2/services/config.service.ts | 14 | ||||
-rw-r--r-- | catalog-ui/src/app/ng2/services/designers.service.ts | 17 | ||||
-rw-r--r-- | catalog-ui/src/app/ng2/services/plugins.service.ts | 17 |
11 files changed, 87 insertions, 87 deletions
diff --git a/catalog-ui/src/app/ng2/app.module.ts b/catalog-ui/src/app/ng2/app.module.ts index 5cf4d80075..a5a2fed18b 100644 --- a/catalog-ui/src/app/ng2/app.module.ts +++ b/catalog-ui/src/app/ng2/app.module.ts @@ -46,15 +46,15 @@ import {UserService} from "./services/user.service"; import {SdcConfig} from "./config/sdc-config.config"; 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"; +import {PluginFrameModule} from "./components/ui/plugin/plugin-frame.module"; +import {PluginsService} from "./services/plugins.service"; export const upgradeAdapter = new UpgradeAdapter(forwardRef(() => AppModule)); export function configServiceFactory(config:ConfigService) { return () => { config.loadValidationConfiguration(); - config.loadDesignersConfiguration(); + config.loadPluginsConfiguration(); } } @@ -75,7 +75,7 @@ export function configServiceFactory(config:ConfigService) { //We need to import them here since we use them in angular1 ConnectionWizardModule, PropertiesAssignmentModule, - DesignerFrameModule + PluginFrameModule ], exports: [], entryComponents: [], @@ -98,7 +98,7 @@ export function configServiceFactory(config:ConfigService) { SdcConfig, ComponentInstanceServiceNg2, TranslationServiceConfig, - DesignersService, + PluginsService, { provide: APP_INITIALIZER, useFactory: configServiceFactory, diff --git a/catalog-ui/src/app/ng2/components/layout/top-nav/top-nav.component.ts b/catalog-ui/src/app/ng2/components/layout/top-nav/top-nav.component.ts index 632b2be4cc..5e43fec680 100644 --- a/catalog-ui/src/app/ng2/components/layout/top-nav/top-nav.component.ts +++ b/catalog-ui/src/app/ng2/components/layout/top-nav/top-nav.component.ts @@ -24,7 +24,7 @@ import {MenuItemGroup, MenuItem} from "app/utils"; import {UserService} from "../../../services/user.service"; import {SdcConfigToken, ISdcConfig} from "../../../config/sdc-config.config"; import {TranslateService} from "../../../shared/translator/translate.service"; -import {DesignersConfiguration, Designer} from "app/models"; +import {PluginsConfiguration, Plugin} from "app/models"; declare const window:any; @@ -65,10 +65,10 @@ export class TopNavComponent { //set result to current state this.topLvlMenu.menuItems.every((item:MenuItem, index:number)=> { if (item.state === this.$state.current.name) { - if (this.$state.current.name === 'designers') { - const designerIdx = _.findIndex(DesignersConfiguration.designers, (designer: Designer) => designer.designerStateUrl === this.$state.params.path); - if (designerIdx !== -1) { - result = index + designerIdx; + if (this.$state.current.name === 'plugins') { + const pluginIdx = _.findIndex(PluginsConfiguration.plugins, (plugin: Plugin) => plugin.pluginStateUrl === this.$state.params.path); + if (pluginIdx !== -1) { + result = index + pluginIdx; return false; } } else { @@ -121,9 +121,9 @@ export class TopNavComponent { } }); - _.each(DesignersConfiguration.designers, (designer: Designer) => { - if (designer.designerDisplayOptions["top"]) { - tmpArray.push(new MenuItem(designer.designerDisplayOptions["top"].displayName, null, "designers", "goToState", {path: designer.designerStateUrl}, null)); + _.each(PluginsConfiguration.plugins, (plugin: Plugin) => { + if (plugin.pluginDisplayOptions["top"]) { + tmpArray.push(new MenuItem(plugin.pluginDisplayOptions["top"].displayName, null, "plugins", "goToState", {path: plugin.pluginStateUrl}, null)); } }) } diff --git a/catalog-ui/src/app/ng2/components/ui/designer/designer-frame.component.html b/catalog-ui/src/app/ng2/components/ui/designer/designer-frame.component.html deleted file mode 100644 index 752e49e218..0000000000 --- a/catalog-ui/src/app/ng2/components/ui/designer/designer-frame.component.html +++ /dev/null @@ -1,5 +0,0 @@ -<div class="designer-frame"> - <div class="w-sdc-main-container"> - <iframe class="designer-iframe" [src]="designerUrl | safeUrlSanitizer"></iframe> - </div> -</div> diff --git a/catalog-ui/src/app/ng2/components/ui/designer/designer-frame.component.ts b/catalog-ui/src/app/ng2/components/ui/designer/designer-frame.component.ts deleted file mode 100644 index b52696a287..0000000000 --- a/catalog-ui/src/app/ng2/components/ui/designer/designer-frame.component.ts +++ /dev/null @@ -1,38 +0,0 @@ -import {Component, OnInit, Input} from "@angular/core"; -import { URLSearchParams } from '@angular/http'; -import {Designer} from "app/models"; - -@Component({ - selector: 'designer-frame', - templateUrl: './designer-frame.component.html', - styleUrls:['designer-frame.component.less'] -}) - -export class DesignerFrameComponent implements OnInit { - - @Input() designer: Designer; - @Input() queryParams: Object; - designerUrl: string; - private urlSearchParams: URLSearchParams; - - constructor() { - this.urlSearchParams = new URLSearchParams(); - } - - ngOnInit(): void { - - this.designerUrl = this.designer.designerProtocol + "://" + - this.designer.designerHost + ":" + - this.designer.designerPort + - this.designer.designerPath; - - if (this.queryParams && !_.isEmpty(this.queryParams)) { - _.forOwn(this.queryParams, (value, key) => { - this.urlSearchParams.set(key, value); - }); - - this.designerUrl += '?'; - this.designerUrl += this.urlSearchParams.toString(); - } - } -} diff --git a/catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.html b/catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.html new file mode 100644 index 0000000000..fb90a1eb90 --- /dev/null +++ b/catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.html @@ -0,0 +1,5 @@ +<div class="plugin-frame"> + <div class="w-sdc-main-container"> + <iframe class="plugin-iframe" [src]="pluginUrl | safeUrlSanitizer"></iframe> + </div> +</div> diff --git a/catalog-ui/src/app/ng2/components/ui/designer/designer-frame.component.less b/catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.less index 4b9456b5b1..4234987072 100644 --- a/catalog-ui/src/app/ng2/components/ui/designer/designer-frame.component.less +++ b/catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.less @@ -1,6 +1,6 @@ -.designer-frame { +.plugin-frame { - .designer-iframe { + .plugin-iframe { width: 100%; height: 100%; border: none; diff --git a/catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.ts b/catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.ts new file mode 100644 index 0000000000..169cad0411 --- /dev/null +++ b/catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.ts @@ -0,0 +1,38 @@ +import {Component, OnInit, Input} from "@angular/core"; +import { URLSearchParams } from '@angular/http'; +import {Plugin} from "app/models"; + +@Component({ + selector: 'plugin-frame', + templateUrl: './plugin-frame.component.html', + styleUrls:['plugin-frame.component.less'] +}) + +export class PluginFrameComponent implements OnInit { + + @Input() plugin: Plugin; + @Input() queryParams: Object; + pluginUrl: string; + private urlSearchParams: URLSearchParams; + + constructor() { + this.urlSearchParams = new URLSearchParams(); + } + + ngOnInit(): void { + + this.pluginUrl = this.plugin.pluginProtocol + "://" + + this.plugin.pluginHost + ":" + + this.plugin.pluginPort + + this.plugin.pluginPath; + + if (this.queryParams && !_.isEmpty(this.queryParams)) { + _.forOwn(this.queryParams, (value, key) => { + this.urlSearchParams.set(key, value); + }); + + this.pluginUrl += '?'; + this.pluginUrl += this.urlSearchParams.toString(); + } + } +} diff --git a/catalog-ui/src/app/ng2/components/ui/designer/designer-frame.module.ts b/catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.module.ts index 1edf195230..81b99cc2d8 100644 --- a/catalog-ui/src/app/ng2/components/ui/designer/designer-frame.module.ts +++ b/catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.module.ts @@ -1,25 +1,25 @@ import {NgModule} from "@angular/core"; import { CommonModule } from '@angular/common'; -import {DesignerFrameComponent} from "./designer-frame.component"; +import {PluginFrameComponent} from "./plugin-frame.component"; import {LayoutModule} from "../../layout/layout.module"; import {GlobalPipesModule} from "../../../pipes/global-pipes.module"; @NgModule({ declarations: [ - DesignerFrameComponent + PluginFrameComponent ], imports: [ CommonModule, LayoutModule, GlobalPipesModule ], - entryComponents: [DesignerFrameComponent], + entryComponents: [PluginFrameComponent], exports: [ - DesignerFrameComponent + PluginFrameComponent ], providers: [] }) -export class DesignerFrameModule { +export class PluginFrameModule { } diff --git a/catalog-ui/src/app/ng2/services/config.service.ts b/catalog-ui/src/app/ng2/services/config.service.ts index 8675ea7d3d..053f2c7659 100644 --- a/catalog-ui/src/app/ng2/services/config.service.ts +++ b/catalog-ui/src/app/ng2/services/config.service.ts @@ -25,7 +25,7 @@ import { Injectable, Inject } from '@angular/core'; import { Http, Response } from '@angular/http'; import 'rxjs/add/operator/toPromise'; -import {IAppConfigurtaion, ValidationConfiguration, Validations, Designers, DesignersConfiguration} from "app/models"; +import {IAppConfigurtaion, ValidationConfiguration, Validations, Plugins, PluginsConfiguration} from "app/models"; import {IApi} from "app/models/app-config"; import {SdcConfigToken, ISdcConfig} from "../config/sdc-config.config"; @@ -69,15 +69,15 @@ export class ConfigService { return promise; } - loadDesignersConfiguration(): Promise<DesignersConfiguration> { - let url:string = this.api.no_proxy_root + this.api.GET_designers_configuration; + loadPluginsConfiguration(): Promise<PluginsConfiguration> { + let url:string = this.api.no_proxy_root + this.api.GET_plugins_configuration; let promise: Promise<any> = this.http.get(url).map((res: Response) => res.json()).toPromise(); - promise.then((designersData: Designers) => { - DesignersConfiguration.designers = designersData; + promise.then((pluginsData: Plugins) => { + PluginsConfiguration.plugins = pluginsData; }).catch((ex) => { - console.error("Error loading designers configuration from BE", ex); + console.error("Error loading plugins configuration from BE", ex); - DesignersConfiguration.designers = [] as Designers; + PluginsConfiguration.plugins = [] as Plugins; }); return promise; diff --git a/catalog-ui/src/app/ng2/services/designers.service.ts b/catalog-ui/src/app/ng2/services/designers.service.ts deleted file mode 100644 index 283b54b964..0000000000 --- a/catalog-ui/src/app/ng2/services/designers.service.ts +++ /dev/null @@ -1,17 +0,0 @@ -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]; - } -} diff --git a/catalog-ui/src/app/ng2/services/plugins.service.ts b/catalog-ui/src/app/ng2/services/plugins.service.ts new file mode 100644 index 0000000000..12432256d7 --- /dev/null +++ b/catalog-ui/src/app/ng2/services/plugins.service.ts @@ -0,0 +1,17 @@ +import { Injectable } from '@angular/core'; +import {Plugin, PluginsConfiguration} from "app/models"; + +@Injectable() +export class PluginsService { + + constructor() { + } + + public getPluginByStateUrl = (stateUrl: string) => { + let pluginKey: any = _.findKey(PluginsConfiguration.plugins, (pluginConfig: Plugin) =>{ + return pluginConfig.pluginStateUrl === stateUrl; + }); + + return PluginsConfiguration.plugins[pluginKey]; + } +} |