From eedaaf983d731d0179916b3f3a8e4d3a0d80981b Mon Sep 17 00:00:00 2001 From: Idan Amit Date: Wed, 31 Jan 2018 13:27:33 +0200 Subject: 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 --- catalog-ui/src/app/app.ts | 20 +++++----- catalog-ui/src/app/models.ts | 2 +- catalog-ui/src/app/models/app-config.ts | 2 +- catalog-ui/src/app/models/designers-config.ts | 21 ----------- catalog-ui/src/app/models/plugins-config.ts | 21 +++++++++++ catalog-ui/src/app/modules/service-module.ts | 4 +- catalog-ui/src/app/modules/view-model-module.ts | 8 ++-- catalog-ui/src/app/ng2/app.module.ts | 10 ++--- .../components/layout/top-nav/top-nav.component.ts | 16 ++++---- .../ui/designer/designer-frame.component.html | 5 --- .../ui/designer/designer-frame.component.less | 8 ---- .../ui/designer/designer-frame.component.ts | 38 ------------------- .../ui/designer/designer-frame.module.ts | 25 ------------- .../ui/plugin/plugin-frame.component.html | 5 +++ .../ui/plugin/plugin-frame.component.less | 8 ++++ .../components/ui/plugin/plugin-frame.component.ts | 38 +++++++++++++++++++ .../components/ui/plugin/plugin-frame.module.ts | 25 +++++++++++++ catalog-ui/src/app/ng2/services/config.service.ts | 14 +++---- .../src/app/ng2/services/designers.service.ts | 17 --------- catalog-ui/src/app/ng2/services/plugins.service.ts | 17 +++++++++ catalog-ui/src/app/utils/constants.ts | 2 +- .../view-models/designers/designers-view-model.ts | 40 -------------------- .../app/view-models/designers/designers-view.html | 7 ---- .../view-models/plugins/plugins-tab-view-model.ts | 40 ++++++++++++++++++++ .../app/view-models/plugins/plugins-tab-view.html | 7 ++++ .../tabs/designers/designers-tab-view-model.ts | 43 ---------------------- .../tabs/designers/designers-tab-view.html | 5 --- .../workspace/tabs/designers/designers-tab.less | 3 -- .../tabs/plugins/plugins-context-view-model.ts | 43 ++++++++++++++++++++++ .../tabs/plugins/plugins-context-view.html | 5 +++ .../workspace/tabs/plugins/plugins-tab.less | 3 ++ .../view-models/workspace/workspace-view-model.ts | 22 +++++------ .../app/view-models/workspace/workspace-view.html | 2 +- 33 files changed, 263 insertions(+), 263 deletions(-) delete mode 100644 catalog-ui/src/app/models/designers-config.ts create mode 100644 catalog-ui/src/app/models/plugins-config.ts delete mode 100644 catalog-ui/src/app/ng2/components/ui/designer/designer-frame.component.html delete mode 100644 catalog-ui/src/app/ng2/components/ui/designer/designer-frame.component.less delete mode 100644 catalog-ui/src/app/ng2/components/ui/designer/designer-frame.component.ts delete mode 100644 catalog-ui/src/app/ng2/components/ui/designer/designer-frame.module.ts create mode 100644 catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.html create mode 100644 catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.less create mode 100644 catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.ts create mode 100644 catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.module.ts delete mode 100644 catalog-ui/src/app/ng2/services/designers.service.ts create mode 100644 catalog-ui/src/app/ng2/services/plugins.service.ts delete mode 100644 catalog-ui/src/app/view-models/designers/designers-view-model.ts delete mode 100644 catalog-ui/src/app/view-models/designers/designers-view.html create mode 100644 catalog-ui/src/app/view-models/plugins/plugins-tab-view-model.ts create mode 100644 catalog-ui/src/app/view-models/plugins/plugins-tab-view.html delete mode 100644 catalog-ui/src/app/view-models/workspace/tabs/designers/designers-tab-view-model.ts delete mode 100644 catalog-ui/src/app/view-models/workspace/tabs/designers/designers-tab-view.html delete mode 100644 catalog-ui/src/app/view-models/workspace/tabs/designers/designers-tab.less create mode 100644 catalog-ui/src/app/view-models/workspace/tabs/plugins/plugins-context-view-model.ts create mode 100644 catalog-ui/src/app/view-models/workspace/tabs/plugins/plugins-context-view.html create mode 100644 catalog-ui/src/app/view-models/workspace/tabs/plugins/plugins-tab.less (limited to 'catalog-ui/src/app') diff --git a/catalog-ui/src/app/app.ts b/catalog-ui/src/app/app.ts index 8de2db97ff..d67f158ded 100644 --- a/catalog-ui/src/app/app.ts +++ b/catalog-ui/src/app/app.ts @@ -58,7 +58,7 @@ import {ComponentMetadata} from "./models/component-metadata"; import {Categories} from "./models/categories"; import {IUserProperties} from "./models/user"; import {SearchWithAutoCompleteComponent} from "./ng2/components/ui/search-with-autocomplete/search-with-autocomplete.component"; -import {DesignerFrameComponent} from "./ng2/components/ui/designer/designer-frame.component"; +import {PluginFrameComponent} from "./ng2/components/ui/plugin/plugin-frame.component"; let moduleName:string = 'sdcApp'; @@ -153,7 +153,7 @@ angular.module('sdcApp').directive('ng2SearchWithAutocomplete', inputs: ['searchPlaceholder', 'searchBarClass', 'autoCompleteValues'], outputs: ['searchChanged', 'searchButtonClicked'] }) as angular.IDirectiveFactory); -angular.module('sdcApp').directive('designerFrame', downgradeComponent( {component: DesignerFrameComponent, inputs: ['designer', 'queryParams']} ) as angular.IDirectiveFactory); +angular.module('sdcApp').directive('pluginFrame', downgradeComponent( {component: PluginFrameComponent, inputs: ['plugin', 'queryParams']} ) as angular.IDirectiveFactory); ng1appModule.config([ '$stateProvider', @@ -518,11 +518,11 @@ ng1appModule.config([ ); $stateProvider.state( - 'workspace.designers', { - url: 'designers/*path', + 'workspace.plugins', { + url: 'plugins/*path', parent: 'workspace', - templateUrl: './view-models/workspace/tabs/designers/designers-tab-view.html', - controller: viewModelsModuleName + '.DesignersTabViewModel' + templateUrl: './view-models/workspace/tabs/plugins/plugins-context-view.html', + controller: viewModelsModuleName + '.PluginsContextViewModel' } ); @@ -544,10 +544,10 @@ ng1appModule.config([ ); $stateProvider.state( - 'designers', { - url: '/designers/*path', - templateUrl: './view-models/designers/designers-view.html', - controller: viewModelsModuleName + '.DesignersViewModel' + 'plugins', { + url: '/plugins/*path', + templateUrl: './view-models/plugins/plugins-tab-view.html', + controller: viewModelsModuleName + '.PluginsTabViewModel' } ); diff --git a/catalog-ui/src/app/models.ts b/catalog-ui/src/app/models.ts index 4848fb5da2..ac26302c1f 100644 --- a/catalog-ui/src/app/models.ts +++ b/catalog-ui/src/app/models.ts @@ -26,7 +26,7 @@ export * from './models/activity'; export * from './models/additional-information'; export * from './models/app-config'; export * from './models/validation-config'; -export * from './models/designers-config'; +export * from './models/plugins-config'; export * from './models/artifacts'; export * from './models/aschema-property'; export * from './models/schema-attribute'; diff --git a/catalog-ui/src/app/models/app-config.ts b/catalog-ui/src/app/models/app-config.ts index 556603d4ab..1f6682f666 100644 --- a/catalog-ui/src/app/models/app-config.ts +++ b/catalog-ui/src/app/models/app-config.ts @@ -53,7 +53,7 @@ export interface IApi { GET_resource_artifact_types:string; GET_activity_log:string; GET_configuration_ui:string; - GET_designers_configuration:string; + GET_plugins_configuration:string; GET_service:string; GET_ecomp_menu_items:string; GET_service_validate_name:string; diff --git a/catalog-ui/src/app/models/designers-config.ts b/catalog-ui/src/app/models/designers-config.ts deleted file mode 100644 index b60e4204e7..0000000000 --- a/catalog-ui/src/app/models/designers-config.ts +++ /dev/null @@ -1,21 +0,0 @@ - -export class Designer { - designerId: string; - designerHost: string; - designerPort: string; - designerPath: string; - designerStateUrl: string; - designerProtocol: string; - designerDisplayOptions: Map; -} - -export class DesignerDisplayOptions { - displayName: string; - displayContext: Array; -} - -export type Designers = Array; - -export class DesignersConfiguration { - static designers: Designers; -} diff --git a/catalog-ui/src/app/models/plugins-config.ts b/catalog-ui/src/app/models/plugins-config.ts new file mode 100644 index 0000000000..18782ec891 --- /dev/null +++ b/catalog-ui/src/app/models/plugins-config.ts @@ -0,0 +1,21 @@ + +export class Plugin { + pluginId: string; + pluginHost: string; + pluginPort: string; + pluginPath: string; + pluginStateUrl: string; + pluginProtocol: string; + pluginDisplayOptions: Map; +} + +export class PluginDisplayOptions { + displayName: string; + displayContext: Array; +} + +export type Plugins = Array; + +export class PluginsConfiguration { + static plugins: Plugins; +} diff --git a/catalog-ui/src/app/modules/service-module.ts b/catalog-ui/src/app/modules/service-module.ts index c2ee61e69c..87a435df40 100644 --- a/catalog-ui/src/app/modules/service-module.ts +++ b/catalog-ui/src/app/modules/service-module.ts @@ -51,7 +51,7 @@ import {ServiceServiceNg2} from "../ng2/services/component-services/service.serv import {ConnectionWizardService} from "../ng2/pages/connection-wizard/connection-wizard.service"; import {ComponentInstanceServiceNg2} from "../ng2/services/component-instance-services/component-instance.service"; import {UserService as UserServiceNg2} from "../ng2/services/user.service"; -import {DesignersService} from "../ng2/services/designers.service"; +import {PluginsService} from "../ng2/services/plugins.service"; let moduleName:string = 'Sdc.Services'; let serviceModule:ng.IModule = angular.module(moduleName, []); @@ -96,4 +96,4 @@ serviceModule.factory('ModalServiceNg2', downgradeInjectable(ModalService)); serviceModule.factory('ConnectionWizardServiceNg2', downgradeInjectable(ConnectionWizardService)); serviceModule.factory('ComponentInstanceServiceNg2', downgradeInjectable(ComponentInstanceServiceNg2)); serviceModule.factory('UserServiceNg2', downgradeInjectable(UserServiceNg2)); -serviceModule.factory('DesignersService', downgradeInjectable(DesignersService)); +serviceModule.factory('PluginsService', downgradeInjectable(PluginsService)); diff --git a/catalog-ui/src/app/modules/view-model-module.ts b/catalog-ui/src/app/modules/view-model-module.ts index 321d039d66..a4f47ff9fc 100644 --- a/catalog-ui/src/app/modules/view-model-module.ts +++ b/catalog-ui/src/app/modules/view-model-module.ts @@ -73,8 +73,8 @@ import {InputFormViewModel} from "../view-models/forms/input-form/input-form-vie import {HierarchyViewModel} from "../view-models/tabs/hierarchy/hierarchy-view-model"; import {downgradeComponent} from "@angular/upgrade/static"; import {ConformanceLevelModalViewModel} from "../view-models/modals/conformance-level-modal/conformance-level-modal-view-model"; -import {DesignersViewModel} from "../view-models/designers/designers-view-model"; -import {DesignersTabViewModel} from "../view-models/workspace/tabs/designers/designers-tab-view-model"; +import {PluginsTabViewModel} from "../view-models/plugins/plugins-tab-view-model"; +import {PluginsContextViewModel} from "../view-models/workspace/tabs/plugins/plugins-context-view-model"; // import {NG2ExampleComponent} from "../ng2/view-ng2/ng2.example.component/ng2.example.component"; // import {upgradeAdapter} from "../ng2/app.module"; // import { UpgradeAdapter } from '@angular/upgrade'; @@ -137,8 +137,8 @@ viewModelModule .controller(moduleName + '.ServiceInputsViewModel', ServiceInputsViewModel) .controller(moduleName + '.ReqAndCapabilitiesViewModel', ReqAndCapabilitiesViewModel) .controller(moduleName + '.InputFormViewModel', InputFormViewModel) - .controller(moduleName + '.DesignersViewModel', DesignersViewModel) - .controller(moduleName + '.DesignersTabViewModel', DesignersTabViewModel) + .controller(moduleName + '.PluginsTabViewModel', PluginsTabViewModel) + .controller(moduleName + '.PluginsContextViewModel', PluginsContextViewModel) // // //TABS .controller(moduleName + '.HierarchyViewModel', HierarchyViewModel); 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 @@ -
-
- -
-
diff --git a/catalog-ui/src/app/ng2/components/ui/designer/designer-frame.component.less b/catalog-ui/src/app/ng2/components/ui/designer/designer-frame.component.less deleted file mode 100644 index 4b9456b5b1..0000000000 --- a/catalog-ui/src/app/ng2/components/ui/designer/designer-frame.component.less +++ /dev/null @@ -1,8 +0,0 @@ -.designer-frame { - - .designer-iframe { - width: 100%; - height: 100%; - border: none; - } -} 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/designer/designer-frame.module.ts b/catalog-ui/src/app/ng2/components/ui/designer/designer-frame.module.ts deleted file mode 100644 index 1edf195230..0000000000 --- a/catalog-ui/src/app/ng2/components/ui/designer/designer-frame.module.ts +++ /dev/null @@ -1,25 +0,0 @@ -import {NgModule} from "@angular/core"; -import { CommonModule } from '@angular/common'; -import {DesignerFrameComponent} from "./designer-frame.component"; -import {LayoutModule} from "../../layout/layout.module"; -import {GlobalPipesModule} from "../../../pipes/global-pipes.module"; - - -@NgModule({ - declarations: [ - DesignerFrameComponent - ], - imports: [ - CommonModule, - LayoutModule, - GlobalPipesModule - ], - entryComponents: [DesignerFrameComponent], - exports: [ - DesignerFrameComponent - ], - providers: [] -}) -export class DesignerFrameModule { - -} 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 @@ +
+
+ +
+
diff --git a/catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.less b/catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.less new file mode 100644 index 0000000000..4234987072 --- /dev/null +++ b/catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.less @@ -0,0 +1,8 @@ +.plugin-frame { + + .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/plugin/plugin-frame.module.ts b/catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.module.ts new file mode 100644 index 0000000000..81b99cc2d8 --- /dev/null +++ b/catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.module.ts @@ -0,0 +1,25 @@ +import {NgModule} from "@angular/core"; +import { CommonModule } from '@angular/common'; +import {PluginFrameComponent} from "./plugin-frame.component"; +import {LayoutModule} from "../../layout/layout.module"; +import {GlobalPipesModule} from "../../../pipes/global-pipes.module"; + + +@NgModule({ + declarations: [ + PluginFrameComponent + ], + imports: [ + CommonModule, + LayoutModule, + GlobalPipesModule + ], + entryComponents: [PluginFrameComponent], + exports: [ + PluginFrameComponent + ], + providers: [] +}) +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 { - let url:string = this.api.no_proxy_root + this.api.GET_designers_configuration; + loadPluginsConfiguration(): Promise { + let url:string = this.api.no_proxy_root + this.api.GET_plugins_configuration; let promise: Promise = 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]; + } +} diff --git a/catalog-ui/src/app/utils/constants.ts b/catalog-ui/src/app/utils/constants.ts index c04da62380..ea0848eee6 100644 --- a/catalog-ui/src/app/utils/constants.ts +++ b/catalog-ui/src/app/utils/constants.ts @@ -239,7 +239,7 @@ export class States { public static WORKSPACE_DISTRIBUTION = 'workspace.distribution'; public static WORKSPACE_PROPERTIES_ASSIGNMENT = 'workspace.properties_assignment'; public static WORKSPACE_REQUIREMENTS_AND_CAPABILITIES = 'workspace.reqAndCap'; - public static WORKSPACE_DESIGNERS = 'workspace.designers'; + public static WORKSPACE_PLUGINS = 'workspace.plugins'; public static WORKSPACE_NG2 = 'workspace.ng2'; } diff --git a/catalog-ui/src/app/view-models/designers/designers-view-model.ts b/catalog-ui/src/app/view-models/designers/designers-view-model.ts deleted file mode 100644 index b2545c8ba2..0000000000 --- a/catalog-ui/src/app/view-models/designers/designers-view-model.ts +++ /dev/null @@ -1,40 +0,0 @@ -import {Designer, IUserProperties} from "app/models"; -import {CacheService} from "app/services"; -import {DesignersService} from "../../ng2/services/designers.service"; - - -interface IDesignerViewModelScope extends ng.IScope { - designer: Designer - user: IUserProperties; - version: string; - queryParams: Object; -} - -export class DesignersViewModel { - static '$inject' = [ - '$scope', - '$stateParams', - 'Sdc.Services.CacheService', - 'DesignersService' - ]; - - constructor(private $scope:IDesignerViewModelScope, - private $stateParams:any, - private cacheService:CacheService, - private designersService:DesignersService) { - - this.initScope(); - } - - private initScope = ():void => { - this.$scope.designer = this.designersService.getDesignerByStateUrl(this.$stateParams.path); - - this.$scope.version = this.cacheService.get('version'); - - this.$scope.user = this.cacheService.get('user'); - - this.$scope.queryParams = { - userId: this.$scope.user.userId - }; - } -} diff --git a/catalog-ui/src/app/view-models/designers/designers-view.html b/catalog-ui/src/app/view-models/designers/designers-view.html deleted file mode 100644 index 9dcad66019..0000000000 --- a/catalog-ui/src/app/view-models/designers/designers-view.html +++ /dev/null @@ -1,7 +0,0 @@ -
- - - - - -
diff --git a/catalog-ui/src/app/view-models/plugins/plugins-tab-view-model.ts b/catalog-ui/src/app/view-models/plugins/plugins-tab-view-model.ts new file mode 100644 index 0000000000..ce098009f3 --- /dev/null +++ b/catalog-ui/src/app/view-models/plugins/plugins-tab-view-model.ts @@ -0,0 +1,40 @@ +import {Plugin, IUserProperties} from "app/models"; +import {CacheService} from "app/services"; +import {PluginsService} from "../../ng2/services/plugins.service"; + + +interface IPluginsTabViewModelScope extends ng.IScope { + plugin: Plugin + user: IUserProperties; + version: string; + queryParams: Object; +} + +export class PluginsTabViewModel { + static '$inject' = [ + '$scope', + '$stateParams', + 'Sdc.Services.CacheService', + 'PluginsService' + ]; + + constructor(private $scope:IPluginsTabViewModelScope, + private $stateParams:any, + private cacheService:CacheService, + private pluginsService:PluginsService) { + + this.initScope(); + } + + private initScope = ():void => { + this.$scope.plugin = this.pluginsService.getPluginByStateUrl(this.$stateParams.path); + + this.$scope.version = this.cacheService.get('version'); + + this.$scope.user = this.cacheService.get('user'); + + this.$scope.queryParams = { + userId: this.$scope.user.userId + }; + } +} diff --git a/catalog-ui/src/app/view-models/plugins/plugins-tab-view.html b/catalog-ui/src/app/view-models/plugins/plugins-tab-view.html new file mode 100644 index 0000000000..3695434463 --- /dev/null +++ b/catalog-ui/src/app/view-models/plugins/plugins-tab-view.html @@ -0,0 +1,7 @@ +
+ + + + + +
diff --git a/catalog-ui/src/app/view-models/workspace/tabs/designers/designers-tab-view-model.ts b/catalog-ui/src/app/view-models/workspace/tabs/designers/designers-tab-view-model.ts deleted file mode 100644 index e145188c00..0000000000 --- a/catalog-ui/src/app/view-models/workspace/tabs/designers/designers-tab-view-model.ts +++ /dev/null @@ -1,43 +0,0 @@ -import {Designer, IUserProperties} from "app/models"; -import {CacheService} from "app/services"; -import {DesignersService} from "../../../../ng2/services/designers.service"; -import {IWorkspaceViewModelScope} from "../../workspace-view-model"; - - -interface IDesignerTabViewModelScope extends IWorkspaceViewModelScope { - designer: Designer; - user:IUserProperties; - queryParams: Object; -} - -export class DesignersTabViewModel { - static '$inject' = [ - '$scope', - '$stateParams', - 'Sdc.Services.CacheService', - 'DesignersService' - ]; - - constructor(private $scope:IDesignerTabViewModelScope, - private $stateParams:any, - private cacheService:CacheService, - private designersService:DesignersService) { - - this.initScope(); - } - - private initScope = ():void => { - this.$scope.designer = this.designersService.getDesignerByStateUrl(this.$stateParams.path); - - this.$scope.user = this.cacheService.get('user'); - - this.$scope.queryParams = { - userId: this.$scope.user.userId, - contextType: this.$scope.component.componentType, - uuid: this.$scope.component.uuid, - lifecycleState: this.$scope.component.lifecycleState, - isOwner: this.$scope.component.lastUpdaterUserId === this.$scope.user.userId - }; - - } -} diff --git a/catalog-ui/src/app/view-models/workspace/tabs/designers/designers-tab-view.html b/catalog-ui/src/app/view-models/workspace/tabs/designers/designers-tab-view.html deleted file mode 100644 index 9af6ae7e30..0000000000 --- a/catalog-ui/src/app/view-models/workspace/tabs/designers/designers-tab-view.html +++ /dev/null @@ -1,5 +0,0 @@ -
- - - -
diff --git a/catalog-ui/src/app/view-models/workspace/tabs/designers/designers-tab.less b/catalog-ui/src/app/view-models/workspace/tabs/designers/designers-tab.less deleted file mode 100644 index c8626dc031..0000000000 --- a/catalog-ui/src/app/view-models/workspace/tabs/designers/designers-tab.less +++ /dev/null @@ -1,3 +0,0 @@ -.workspace-designers { - -} diff --git a/catalog-ui/src/app/view-models/workspace/tabs/plugins/plugins-context-view-model.ts b/catalog-ui/src/app/view-models/workspace/tabs/plugins/plugins-context-view-model.ts new file mode 100644 index 0000000000..76010b56f4 --- /dev/null +++ b/catalog-ui/src/app/view-models/workspace/tabs/plugins/plugins-context-view-model.ts @@ -0,0 +1,43 @@ +import {Plugin, IUserProperties} from "app/models"; +import {CacheService} from "app/services"; +import {PluginsService} from "../../../../ng2/services/plugins.service"; +import {IWorkspaceViewModelScope} from "../../workspace-view-model"; + + +interface IPluginsContextViewModelScope extends IWorkspaceViewModelScope { + plugin: Plugin; + user:IUserProperties; + queryParams: Object; +} + +export class PluginsContextViewModel { + static '$inject' = [ + '$scope', + '$stateParams', + 'Sdc.Services.CacheService', + 'PluginsService' + ]; + + constructor(private $scope:IPluginsContextViewModelScope, + private $stateParams:any, + private cacheService:CacheService, + private pluginsService:PluginsService) { + + this.initScope(); + } + + private initScope = ():void => { + this.$scope.plugin = this.pluginsService.getPluginByStateUrl(this.$stateParams.path); + + this.$scope.user = this.cacheService.get('user'); + + this.$scope.queryParams = { + userId: this.$scope.user.userId, + contextType: this.$scope.component.componentType, + uuid: this.$scope.component.uuid, + lifecycleState: this.$scope.component.lifecycleState, + isOwner: this.$scope.component.lastUpdaterUserId === this.$scope.user.userId + }; + + } +} diff --git a/catalog-ui/src/app/view-models/workspace/tabs/plugins/plugins-context-view.html b/catalog-ui/src/app/view-models/workspace/tabs/plugins/plugins-context-view.html new file mode 100644 index 0000000000..e155370ddd --- /dev/null +++ b/catalog-ui/src/app/view-models/workspace/tabs/plugins/plugins-context-view.html @@ -0,0 +1,5 @@ +
+ + + +
diff --git a/catalog-ui/src/app/view-models/workspace/tabs/plugins/plugins-tab.less b/catalog-ui/src/app/view-models/workspace/tabs/plugins/plugins-tab.less new file mode 100644 index 0000000000..7798e36af8 --- /dev/null +++ b/catalog-ui/src/app/view-models/workspace/tabs/plugins/plugins-tab.less @@ -0,0 +1,3 @@ +.workspace-plugins { + +} diff --git a/catalog-ui/src/app/view-models/workspace/workspace-view-model.ts b/catalog-ui/src/app/view-models/workspace/workspace-view-model.ts index 87d8367e5d..59dd2d8f00 100644 --- a/catalog-ui/src/app/view-models/workspace/workspace-view-model.ts +++ b/catalog-ui/src/app/view-models/workspace/workspace-view-model.ts @@ -22,7 +22,7 @@ * Created by obarda on 3/30/2016. */ 'use strict'; -import {IUserProperties, IAppMenu, Resource, Component, Designer, DesignersConfiguration, DesignerDisplayOptions} from "app/models"; +import {IUserProperties, IAppMenu, Resource, Component, Plugin, PluginsConfiguration, PluginDisplayOptions} from "app/models"; import { WorkspaceMode, ComponentFactory, ChangeLifecycleStateHandler, Role, ComponentState, MenuItemGroup, MenuHandler, MenuItem, ModalsHandler, States, EVENTS, CHANGE_COMPONENT_CSAR_VERSION_FLAG, ResourceType @@ -58,7 +58,7 @@ export interface IWorkspaceViewModelScope extends ng.IScope { changeVersion:any; isComposition:boolean; isDeployment:boolean; - isDesigners:boolean; + isPlugins:boolean; $state:ng.ui.IStateService; user:IUserProperties; thirdParty:boolean; @@ -629,8 +629,8 @@ export class WorkspaceViewModel { let selectedIndex = selectedItem ? this.$scope.leftBarTabs.menuItems.indexOf(selectedItem) : 0; - if (stateArray[1] === 'designers') { - selectedIndex += _.findIndex(DesignersConfiguration.designers, (designer: Designer) => designer.designerStateUrl === this.$state.params.path); + if (stateArray[1] === 'plugins') { + selectedIndex += _.findIndex(PluginsConfiguration.plugins, (plugin: Plugin) => plugin.pluginStateUrl === this.$state.params.path); } this.$scope.leftBarTabs.selectedIndex = selectedIndex; @@ -644,7 +644,7 @@ export class WorkspaceViewModel { if (newVal) { this.$scope.isComposition = (newVal.indexOf(States.WORKSPACE_COMPOSITION) > -1); this.$scope.isDeployment = newVal == States.WORKSPACE_DEPLOYMENT; - this.$scope.isDesigners = newVal == States.WORKSPACE_DESIGNERS; + this.$scope.isPlugins = newVal == States.WORKSPACE_PLUGINS; } }); @@ -719,18 +719,18 @@ export class WorkspaceViewModel { this.$scope.leftBarTabs = new MenuItemGroup(); const menuItemsObjects:Array = this.updateMenuItemByRole(this.sdcMenu.component_workspace_menu_option[this.$scope.component.getComponentSubType()], this.role); - // Only need to add designers to the menu if the current role is Designer + // Only need to add plugins to the menu if the current role is Designer if (this.role === "DESIGNER") { - _.each(DesignersConfiguration.designers, (designer: Designer) => { - if (designer.designerDisplayOptions["context"]) { - let displayOptions : DesignerDisplayOptions = designer.designerDisplayOptions["context"]; + _.each(PluginsConfiguration.plugins, (plugin: Plugin) => { + if (plugin.pluginDisplayOptions["context"]) { + let displayOptions : PluginDisplayOptions = plugin.pluginDisplayOptions["context"]; if (displayOptions.displayContext.indexOf(this.$scope.component.componentType) !== -1) { menuItemsObjects.push({ text: displayOptions.displayName, action: 'onMenuItemPressed', - state: 'workspace.designers', - params: {path: designer.designerStateUrl} + state: 'workspace.plugins', + params: {path: plugin.pluginStateUrl} }); } } diff --git a/catalog-ui/src/app/view-models/workspace/workspace-view.html b/catalog-ui/src/app/view-models/workspace/workspace-view.html index f076ba0ced..d724b8d058 100644 --- a/catalog-ui/src/app/view-models/workspace/workspace-view.html +++ b/catalog-ui/src/app/view-models/workspace/workspace-view.html @@ -70,7 +70,7 @@
-
+
{{getTabTitle()}}
-- cgit 1.2.3-korg