From 2c285722c35d8ee7fd6c9085c8e60f0fa87d5761 Mon Sep 17 00:00:00 2001 From: Idan Amit Date: Fri, 29 Dec 2017 09:40:43 +0200 Subject: SDC Designers Integration - Part 1 Finished first part of designers integration Added templated configuration file Added tests Change-Id: I76e8b413063b939e1eb58da4a5502c4b526168f2 Issue-ID: SDC-687 Signed-off-by: Idan Amit --- catalog-ui/configurations/dev.js | 2 ++ catalog-ui/src/app/models/app-config.ts | 6 ++++-- catalog-ui/src/app/ng2/app.module.ts | 9 +++++--- catalog-ui/src/app/ng2/services/config.service.ts | 26 +++++++++++++++++------ catalog-ui/webpack.server.js | 9 +++++++- 5 files changed, 40 insertions(+), 12 deletions(-) (limited to 'catalog-ui') diff --git a/catalog-ui/configurations/dev.js b/catalog-ui/configurations/dev.js index 8367963adf..bde0d1e614 100644 --- a/catalog-ui/configurations/dev.js +++ b/catalog-ui/configurations/dev.js @@ -26,6 +26,7 @@ const SDC_CONFIG = { "GET_resource_interface_artifact": "/v1/catalog/:type/:entityId/standard/:operation/artifacts/:id", "GET_resource_api_artifact": "/v1/catalog/:type/:entityId/artifacts/api/:id", "GET_configuration_ui": "/v1/configuration/ui", + "GET_designers_configuration": "/config/ui/designers", "GET_resource_validate_name": "/v1/catalog/resources/validate-name/:name", "GET_activity_log": "/v1/catalog/audit-records/:type/:id", "GET_service": "/v1/catalog/services/:id", @@ -46,6 +47,7 @@ const SDC_CONFIG = { "GET_lifecycle_state_CERTIFICATIONREQUEST":"lifecycleState/CERTIFICATIONREQUEST", "GET_lifecycle_state_UNDOCHECKOUT":"lifecycleState/UNDOCHECKOUT", "root": "/sdc1/feProxy/rest", + "no_proxy_root": "/sdc1/rest", "PUT_service": "/v1/catalog/services/:id/metadata", "GET_download_artifact": "/v1/catalog/", "GET_SDC_Version": "/version", diff --git a/catalog-ui/src/app/models/app-config.ts b/catalog-ui/src/app/models/app-config.ts index 40eb18b8b4..556603d4ab 100644 --- a/catalog-ui/src/app/models/app-config.ts +++ b/catalog-ui/src/app/models/app-config.ts @@ -7,9 +7,9 @@ * 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. @@ -53,6 +53,7 @@ export interface IApi { GET_resource_artifact_types:string; GET_activity_log:string; GET_configuration_ui:string; + GET_designers_configuration:string; GET_service:string; GET_ecomp_menu_items:string; GET_service_validate_name:string; @@ -71,6 +72,7 @@ export interface IApi { GET_lifecycle_state_CERTIFICATIONREQUEST:string; GET_lifecycle_state_UNDOCHECKOUT:string; root:string; + no_proxy_root:string; PUT_service:string; GET_download_artifact:string; GET_SDC_Version:string; diff --git a/catalog-ui/src/app/ng2/app.module.ts b/catalog-ui/src/app/ng2/app.module.ts index 291768a500..7108be93f9 100644 --- a/catalog-ui/src/app/ng2/app.module.ts +++ b/catalog-ui/src/app/ng2/app.module.ts @@ -7,9 +7,9 @@ * 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. @@ -50,7 +50,10 @@ import { TranslationServiceConfig } from "./config/translation.service.config"; export const upgradeAdapter = new UpgradeAdapter(forwardRef(() => AppModule)); export function configServiceFactory(config:ConfigService) { - return () => config.loadValidationConfiguration(); + return () => { + config.loadValidationConfiguration(); + config.loadDesignersConfiguration(); + } } diff --git a/catalog-ui/src/app/ng2/services/config.service.ts b/catalog-ui/src/app/ng2/services/config.service.ts index 9bb7b7a075..1c0ee18d33 100644 --- a/catalog-ui/src/app/ng2/services/config.service.ts +++ b/catalog-ui/src/app/ng2/services/config.service.ts @@ -7,9 +7,9 @@ * 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. @@ -26,6 +26,7 @@ import { Injectable, Inject } from '@angular/core'; import { Http, Response } from '@angular/http'; import 'rxjs/add/operator/toPromise'; import {IAppConfigurtaion, ValidationConfiguration, Validations} from "app/models"; +import {IApi} from "app/models/app-config"; import {SdcConfigToken, ISdcConfig} from "../config/sdc-config.config"; @Injectable() @@ -33,9 +34,11 @@ export class ConfigService { private baseUrl; public configuration: IAppConfigurtaion; + public api:IApi; constructor(private http: Http, @Inject(SdcConfigToken) private sdcConfig:ISdcConfig) { - this.baseUrl = this.sdcConfig.api.root + this.sdcConfig.api.component_api_root; + this.api = this.sdcConfig.api; + this.baseUrl = this.api.root + this.api.component_api_root; } loadValidationConfiguration(): Promise { @@ -45,7 +48,7 @@ export class ConfigService { ValidationConfiguration.validation = validationData; }).catch((ex) => { console.error('Error loading validation.json configuration file, using fallback data', ex); - + let fallback:Validations = { "propertyValue": { "max": 2500, @@ -58,12 +61,23 @@ export class ConfigService { "integer": "^(([-+]?\\d+)|([-+]?0x[0-9a-fA-F]+))$" } }; - + ValidationConfiguration.validation = fallback; - + }); return promise; } + loadDesignersConfiguration(): void { + let url:string = this.api.no_proxy_root + this.api.GET_designers_configuration; + let promise: Promise = this.http.get(url).map((res: Response) => res.json()).toPromise(); + + promise.then((config:any) => { + console.log(config); + }).catch((ex) => { + console.error('Error was:', ex); + }) + } + } diff --git a/catalog-ui/webpack.server.js b/catalog-ui/webpack.server.js index b8c79a6197..e53d79f533 100644 --- a/catalog-ui/webpack.server.js +++ b/catalog-ui/webpack.server.js @@ -44,6 +44,13 @@ module.exports = function(env) { secure: false })); + middlewares.push( + proxy(['/sdc1/rest'],{ + target: 'http://localhost:' + fePort, + changeOrigin: true, + secure: false + })); + // Redirect dcae urls to feHost middlewares.push( proxy(['/dcae','/sdc1/feProxy/dcae-api'],{ @@ -77,4 +84,4 @@ module.exports = function(env) { }; return ServerConfig; -} \ No newline at end of file +} -- cgit 1.2.3-korg