final static String offlineDesignerDisplayName = "offlineDesigner";
final static String offlineDesignerHost = "192.168.10.1";
- final static int offlineDesignerPort = 1000;
+ final static String offlineDesignerPort = "1000";
final static String offlineDesignerPath = "/offline";
final static String offlineDesignerProtocol = "http";
final static String onlineDesignerDisplayName = "onlineDesigner";
final static String onlineDesignerHost = "192.168.20.2";
- final static int onlineDesignerPort = 2000;
+ final static String onlineDesignerPort = "2000";
final static String onlineDesignerPath = "/online";
final static String onlineDesignerProtocol = "http";
export class Designer {
designerId: string;
designerHost: string;
- designerPort: number;
+ designerPort: string;
designerPath: string;
designerStateUrl: string;
designerProtocol: string;
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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";
let moduleName:string = 'Sdc.Services';
let serviceModule:ng.IModule = angular.module(moduleName, []);
serviceModule.factory('ModalServiceNg2', downgradeInjectable(ModalService));
serviceModule.factory('ConnectionWizardServiceNg2', downgradeInjectable(ConnectionWizardService));
serviceModule.factory('ComponentInstanceServiceNg2', downgradeInjectable(ComponentInstanceServiceNg2));
-serviceModule.factory('UserServiceNg2', downgradeInjectable(UserServiceNg2));
\ No newline at end of file
+serviceModule.factory('UserServiceNg2', downgradeInjectable(UserServiceNg2));
+serviceModule.factory('DesignersService', downgradeInjectable(DesignersService));
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));
SdcConfig,
ComponentInstanceServiceNg2,
TranslationServiceConfig,
+ DesignersService,
{
provide: APP_INITIALIZER,
useFactory: configServiceFactory,
--- /dev/null
+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];
+ }
+}
-import {Designer, IUserProperties, DesignersConfiguration} from "app/models";
+import {Designer, IUserProperties} from "app/models";
import {CacheService} from "app/services";
import {MenuItemGroup} from "app/utils";
+import {DesignersService} from "../../ng2/services/designers.service";
interface IDesignerViewModelScope extends ng.IScope {
static '$inject' = [
'$scope',
'$stateParams',
- '$sce',
- 'Sdc.Services.CacheService'
+ 'Sdc.Services.CacheService',
+ 'DesignersService'
];
constructor(private $scope:IDesignerViewModelScope,
private $stateParams:any,
- private $sce:any,
- private cacheService:CacheService) {
+ private cacheService:CacheService,
+ private designersService:DesignersService) {
this.initScope();
}
private initScope = ():void => {
- // get the designer object by using the path parameter
- let designerKey: any = _.findKey(DesignersConfiguration.designers, (designerConfig: Designer) =>{
- return designerConfig.designerStateUrl === this.$stateParams.path;
- });
-
- this.$scope.designer = DesignersConfiguration.designers[designerKey];
+ this.$scope.designer = this.designersService.getDesignerByStateUrl(this.$stateParams.path);
this.$scope.version = this.cacheService.get('version');
this.$scope.topNavMenuModel = [];
-import {Designer, DesignersConfiguration} from "app/models";
+import {Designer} from "app/models";
+import {DesignersService} from "../../../../ng2/services/designers.service";
interface IDesignerTabViewModelScope extends ng.IScope {
export class DesignersTabViewModel {
static '$inject' = [
'$scope',
- '$stateParams'
+ '$stateParams',
+ 'DesignersService'
];
constructor(private $scope:IDesignerTabViewModelScope,
- private $stateParams:any) {
+ private $stateParams:any,
+ private designersService:DesignersService) {
this.initScope();
}
private initScope = ():void => {
- // get the designer object by using the path parameter
- let designerKey: any = _.findKey(DesignersConfiguration.designers, (designerConfig: Designer) =>{
- return designerConfig.designerStateUrl === this.$stateParams.path;
- });
-
- this.$scope.designer = DesignersConfiguration.designers[designerKey];
+ this.$scope.designer = this.designersService.getDesignerByStateUrl(this.$stateParams.path);
}
}
if (designer.designerDisplayOptions["context"]) {
let displayOptions : DesignerDisplayOptions = designer.designerDisplayOptions["context"];
- if (displayOptions.displayContext.indexOf(this.$scope.component.getComponentSubType()) !== -1) {
+ if (displayOptions.displayContext.indexOf(this.$scope.component.componentType) !== -1) {
menuItemsObjects.push({
text: displayOptions.displayName,
action: 'onMenuItemPressed',
private String designerId;
private String designerHost;
- private Integer designerPort;
+ private String designerPort;
private String designerPath;
private String designerStateUrl;
private String designerProtocol;
this.designerHost = designerHost;
}
- public Integer getDesignerPort() {
+ public String getDesignerPort() {
return designerPort;
}
- public void setDesignerPort(Integer designerPort) {
+ public void setDesignerPort(String designerPort) {
this.designerPort = designerPort;
}