diff options
45 files changed, 542 insertions, 542 deletions
diff --git a/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/DesignerStatusBL.java b/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/DesignerStatusBL.java deleted file mode 100644 index eb43df6c95..0000000000 --- a/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/DesignerStatusBL.java +++ /dev/null @@ -1,78 +0,0 @@ -package org.openecomp.sdc.fe.impl; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpHead; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.openecomp.sdc.fe.config.ConfigurationManager; -import org.openecomp.sdc.fe.config.DesignersConfiguration; -import org.openecomp.sdc.fe.config.DesignersConfiguration.Designer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; - -public class DesignerStatusBL { - - private static Logger log = LoggerFactory.getLogger(DesignerStatusBL.class.getName()); - private static Gson gson = new GsonBuilder().setPrettyPrinting().create(); - private CloseableHttpClient client = null; - - public DesignerStatusBL() { - this.client = HttpClients.createDefault(); - } - - public DesignerStatusBL(CloseableHttpClient client) { - this.client = client; - - } - - public String checkDesignerListAvailability() { - String result = null; - - DesignersConfiguration designersConfiguration = ConfigurationManager.getConfigurationManager() - .getDesignersConfiguration(); - - if (designersConfiguration == null || designersConfiguration.getDesignersList() == null) { - log.warn("Configuration of type {} was not found", DesignersConfiguration.class); - } else { - log.debug("The value returned from getConfig is {}", designersConfiguration); - - List<Designer> availableDesignersList = new ArrayList<>(); - - designersConfiguration.getDesignersList().forEach(value -> { - if (checkDesignerAvailability(value)) { - availableDesignersList.add(value); - } - - }); - result = gson.toJson(availableDesignersList); - } - return result; - } - - private boolean checkDesignerAvailability(Designer designer) { - - StringBuilder requestString = new StringBuilder(); - boolean result = false; - - requestString.append(designer.getDesignerProtocol()).append("://").append(designer.getDesignerHost()).append(":") - .append(designer.getDesignerPort()).append(designer.getDesignerPath()); - - HttpHead head = new HttpHead(requestString.toString()); - - try (CloseableHttpResponse response = this.client.execute(head)) { - result = response != null && response.getStatusLine().getStatusCode() == 200; - } catch (IOException e) { - log.debug("The designer {} is offline", designer); - } - - return result; - } - -} diff --git a/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/PluginStatusBL.java b/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/PluginStatusBL.java new file mode 100644 index 0000000000..dcd5eef491 --- /dev/null +++ b/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/PluginStatusBL.java @@ -0,0 +1,78 @@ +package org.openecomp.sdc.fe.impl; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpHead; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.openecomp.sdc.fe.config.ConfigurationManager; +import org.openecomp.sdc.fe.config.PluginsConfiguration; +import org.openecomp.sdc.fe.config.PluginsConfiguration.Plugin; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +public class PluginStatusBL { + + private static Logger log = LoggerFactory.getLogger(PluginStatusBL.class.getName()); + private static Gson gson = new GsonBuilder().setPrettyPrinting().create(); + private CloseableHttpClient client = null; + + public PluginStatusBL() { + this.client = HttpClients.createDefault(); + } + + public PluginStatusBL(CloseableHttpClient client) { + this.client = client; + + } + + public String checkPluginsListAvailability() { + String result = null; + + PluginsConfiguration pluginsConfiguration = ConfigurationManager.getConfigurationManager() + .getPluginsConfiguration(); + + if (pluginsConfiguration == null || pluginsConfiguration.getPluginsList() == null) { + log.warn("Configuration of type {} was not found", PluginsConfiguration.class); + } else { + log.debug("The value returned from getConfig is {}", pluginsConfiguration); + + List<Plugin> availablePluginsList = new ArrayList<>(); + + pluginsConfiguration.getPluginsList().forEach(value -> { + if (checkPluginAvailability(value)) { + availablePluginsList.add(value); + } + + }); + result = gson.toJson(availablePluginsList); + } + return result; + } + + private boolean checkPluginAvailability(Plugin plugin) { + + StringBuilder requestString = new StringBuilder(); + boolean result = false; + + requestString.append(plugin.getPluginProtocol()).append("://").append(plugin.getPluginHost()).append(":") + .append(plugin.getPluginPort()).append(plugin.getPluginPath()); + + HttpHead head = new HttpHead(requestString.toString()); + + try (CloseableHttpResponse response = this.client.execute(head)) { + result = response != null && response.getStatusLine().getStatusCode() == 200; + } catch (IOException e) { + log.debug("The plugin {} is offline", plugin); + } + + return result; + } + +} diff --git a/catalog-fe/src/main/java/org/openecomp/sdc/fe/listen/FEAppContextListener.java b/catalog-fe/src/main/java/org/openecomp/sdc/fe/listen/FEAppContextListener.java index ea67efbc7e..76190bc790 100644 --- a/catalog-fe/src/main/java/org/openecomp/sdc/fe/listen/FEAppContextListener.java +++ b/catalog-fe/src/main/java/org/openecomp/sdc/fe/listen/FEAppContextListener.java @@ -30,7 +30,7 @@ import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.impl.ExternalConfiguration; import org.openecomp.sdc.common.listener.AppContextListener; import org.openecomp.sdc.fe.config.ConfigurationManager; -import org.openecomp.sdc.fe.impl.DesignerStatusBL; +import org.openecomp.sdc.fe.impl.PluginStatusBL; import org.openecomp.sdc.fe.monitoring.FeMonitoringService; import org.openecomp.sdc.fe.servlets.HealthCheckService; import org.slf4j.Logger; @@ -50,8 +50,8 @@ public class FEAppContextListener extends AppContextListener implements ServletC ExternalConfiguration.getAppName()); context.getServletContext().setAttribute(Constants.CONFIGURATION_MANAGER_ATTR, configurationManager); - DesignerStatusBL dsbl = new DesignerStatusBL(); - context.getServletContext().setAttribute(Constants.DESIGNER_BL_COMPONENT, dsbl); + PluginStatusBL pbl = new PluginStatusBL(); + context.getServletContext().setAttribute(Constants.PLUGIN_BL_COMPONENT, pbl); // Health Check service HealthCheckService hcs = new HealthCheckService(context.getServletContext()); diff --git a/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/ConfigServlet.java b/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/ConfigServlet.java index ba37e94d10..cbe5c43a45 100644 --- a/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/ConfigServlet.java +++ b/catalog-fe/src/main/java/org/openecomp/sdc/fe/servlets/ConfigServlet.java @@ -39,7 +39,7 @@ import org.openecomp.sdc.common.api.ConfigurationSource; import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.servlets.BasicServlet; import org.openecomp.sdc.fe.config.Configuration; -import org.openecomp.sdc.fe.impl.DesignerStatusBL; +import org.openecomp.sdc.fe.impl.PluginStatusBL; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -115,16 +115,16 @@ public class ConfigServlet extends BasicServlet { } @GET - @Path("/ui/designers") + @Path("/ui/plugins") @Produces(MediaType.APPLICATION_JSON) - public Response getDesignersConfiguration(@Context final HttpServletRequest request) { + public Response getPluginsConfiguration(@Context final HttpServletRequest request) { String result = null; ServletContext context = request.getSession().getServletContext(); - DesignerStatusBL designerStatusBL = (DesignerStatusBL) context.getAttribute(Constants.DESIGNER_BL_COMPONENT); + PluginStatusBL pluginStatusBL = (PluginStatusBL) context.getAttribute(Constants.PLUGIN_BL_COMPONENT); - result = designerStatusBL.checkDesignerListAvailability(); + result = pluginStatusBL.checkPluginsListAvailability(); return Response.status(Status.OK).entity(result).build(); diff --git a/catalog-fe/src/main/resources/config/designers-configuration.yaml b/catalog-fe/src/main/resources/config/designers-configuration.yaml deleted file mode 100644 index f62a355589..0000000000 --- a/catalog-fe/src/main/resources/config/designers-configuration.yaml +++ /dev/null @@ -1,22 +0,0 @@ -designersList: - - designerId: DCAE - designerHost: localhost - designerPort: 8080 - designerPath: "/dcae" - designerStateUrl: "dcae" - designerProtocol: http - designerDisplayOptions: - context: - displayName: "Monitor" - displayContext: ["VF", "SERVICE"] - top: - displayName: "DCAE" - - designerId: WORKFLOW - designerHost: localhost - designerPort: 9527 - designerPath: "/" - designerStateUrl: "workflowDesigner" - designerProtocol: http - designerDisplayOptions: - top: - displayName: "WORKFLOW"
\ No newline at end of file diff --git a/catalog-fe/src/main/resources/config/plugins-configuration.yaml b/catalog-fe/src/main/resources/config/plugins-configuration.yaml new file mode 100644 index 0000000000..4193b506d2 --- /dev/null +++ b/catalog-fe/src/main/resources/config/plugins-configuration.yaml @@ -0,0 +1,22 @@ +pluginsList: + - pluginId: DCAE + pluginHost: localhost + pluginPort: 8080 + pluginPath: "/dcae" + pluginStateUrl: "dcae" + pluginProtocol: http + pluginDisplayOptions: + context: + displayName: "Monitor" + displayContext: ["VF", "SERVICE"] + top: + displayName: "DCAE" + - pluginId: WORKFLOW + pluginHost: localhost + pluginPort: 9527 + pluginPath: "/" + pluginStateUrl: "workflowDesigner" + pluginProtocol: http + pluginDisplayOptions: + top: + displayName: "WORKFLOW"
\ No newline at end of file diff --git a/catalog-fe/src/test/java/org/openecomp/sdc/fe/servlets/DesignerStatusBLTest.java b/catalog-fe/src/test/java/org/openecomp/sdc/fe/servlets/DesignerStatusBLTest.java deleted file mode 100644 index db0fd736ec..0000000000 --- a/catalog-fe/src/test/java/org/openecomp/sdc/fe/servlets/DesignerStatusBLTest.java +++ /dev/null @@ -1,107 +0,0 @@ -package org.openecomp.sdc.fe.servlets; - -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.when; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.apache.http.StatusLine; -import org.apache.http.client.ClientProtocolException; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpHead; -import org.apache.http.impl.client.CloseableHttpClient; -import org.junit.BeforeClass; -import org.junit.Test; -import org.mockito.Mockito; -import org.openecomp.sdc.fe.config.ConfigurationManager; -import org.openecomp.sdc.fe.config.DesignersConfiguration; -import org.openecomp.sdc.fe.config.DesignersConfiguration.Designer; -import org.openecomp.sdc.fe.impl.DesignerStatusBL; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; - -public class DesignerStatusBLTest { - - final static CloseableHttpClient httpClient = Mockito.mock(CloseableHttpClient.class); - DesignerStatusBL designerStatusBL = new DesignerStatusBL(httpClient); - private static Gson gson = new GsonBuilder().setPrettyPrinting().create(); - - final static ConfigurationManager configurationManager = Mockito.mock(ConfigurationManager.class); - final static DesignersConfiguration designersConfiguration = Mockito.mock(DesignersConfiguration.class); - final static Designer offlineDesigner = new Designer(); - final static Designer onlineDesigner = new Designer(); - final static CloseableHttpResponse httpResponse = Mockito.mock(CloseableHttpResponse.class); - final static StatusLine statusLine = Mockito.mock(StatusLine.class); - final static List<Designer> testDesignersList = new ArrayList<>(); - - final static String offlineDesignerDisplayName = "offlineDesigner"; - final static String offlineDesignerHost = "192.168.10.1"; - 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 String onlineDesignerPort = "2000"; - final static String onlineDesignerPath = "/online"; - final static String onlineDesignerProtocol = "http"; - - @BeforeClass - public static void beforeClass() { - ConfigurationManager.setTestInstance(configurationManager); - when(configurationManager.getDesignersConfiguration()).thenReturn(designersConfiguration); - - offlineDesigner.setDesignerId(offlineDesignerDisplayName); - offlineDesigner.setDesignerHost(offlineDesignerHost); - offlineDesigner.setDesignerPort(offlineDesignerPort); - offlineDesigner.setDesignerPath(offlineDesignerPath); - offlineDesigner.setDesignerProtocol(offlineDesignerProtocol); - - StringBuilder offlineRequestString = new StringBuilder(); - offlineRequestString.append(offlineDesignerProtocol).append("://").append(onlineDesignerHost).append(":") - .append(offlineDesignerPort).append(offlineDesignerPath); - - onlineDesigner.setDesignerId(onlineDesignerDisplayName); - onlineDesigner.setDesignerHost(onlineDesignerHost); - onlineDesigner.setDesignerPort(onlineDesignerPort); - onlineDesigner.setDesignerPath(onlineDesignerPath); - onlineDesigner.setDesignerProtocol(onlineDesignerProtocol); - - StringBuilder onlineRequestString = new StringBuilder(); - onlineRequestString.append(onlineDesignerProtocol).append("://").append(onlineDesignerHost).append(":") - .append(offlineDesignerPort).append(offlineDesignerPath); - - } - - @Test - public void TestOfflineDesignerNotBeingReturnedWhenCallingCheckDesignerListAvailability() throws ClientProtocolException, IOException { - testDesignersList.add(offlineDesigner); - when(designersConfiguration.getDesignersList()).thenReturn(testDesignersList); - - when(statusLine.getStatusCode()).thenReturn(404); - when(httpResponse.getStatusLine()).thenReturn(statusLine); - when(httpClient.execute(Mockito.any(HttpHead.class))).thenReturn(httpResponse); - - assertTrue(designerStatusBL.checkDesignerListAvailability().equals("[]")); - - } - - @Test - public void TestOnlineDesignerNotBeingReturnedWhenCallingCheckDesignerListAvailability() throws ClientProtocolException, IOException { - testDesignersList.add(onlineDesigner); - when(designersConfiguration.getDesignersList()).thenReturn(testDesignersList); - - when(statusLine.getStatusCode()).thenReturn(200); - when(httpResponse.getStatusLine()).thenReturn(statusLine); - when(httpClient.execute(Mockito.any())).thenReturn(httpResponse); - - String result = gson.toJson(testDesignersList); - - assertTrue(designerStatusBL.checkDesignerListAvailability().contains(result)); - - } - -} diff --git a/catalog-fe/src/test/java/org/openecomp/sdc/fe/servlets/PluginStatusBLTest.java b/catalog-fe/src/test/java/org/openecomp/sdc/fe/servlets/PluginStatusBLTest.java new file mode 100644 index 0000000000..8a796a4993 --- /dev/null +++ b/catalog-fe/src/test/java/org/openecomp/sdc/fe/servlets/PluginStatusBLTest.java @@ -0,0 +1,107 @@ +package org.openecomp.sdc.fe.servlets; + +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.when; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.apache.http.StatusLine; +import org.apache.http.client.ClientProtocolException; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpHead; +import org.apache.http.impl.client.CloseableHttpClient; +import org.junit.BeforeClass; +import org.junit.Test; +import org.mockito.Mockito; +import org.openecomp.sdc.fe.config.ConfigurationManager; +import org.openecomp.sdc.fe.config.PluginsConfiguration; +import org.openecomp.sdc.fe.config.PluginsConfiguration.Plugin; +import org.openecomp.sdc.fe.impl.PluginStatusBL; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +public class PluginStatusBLTest { + + final static CloseableHttpClient httpClient = Mockito.mock(CloseableHttpClient.class); + PluginStatusBL pluginStatusBL = new PluginStatusBL(httpClient); + private static Gson gson = new GsonBuilder().setPrettyPrinting().create(); + + final static ConfigurationManager configurationManager = Mockito.mock(ConfigurationManager.class); + final static PluginsConfiguration pluginsConfiguration = Mockito.mock(PluginsConfiguration.class); + final static Plugin offlinePlugin = new Plugin(); + final static Plugin onlinePlugin = new Plugin(); + final static CloseableHttpResponse httpResponse = Mockito.mock(CloseableHttpResponse.class); + final static StatusLine statusLine = Mockito.mock(StatusLine.class); + final static List<Plugin> testPluginsList = new ArrayList<>(); + + final static String offlinePluginsDisplayName = "offlinePlugin"; + final static String offlinePluginHost = "192.168.10.1"; + final static String offlinePluginPort = "1000"; + final static String offlinePluginPath = "/offline"; + final static String offlinePluginProtocol = "http"; + + final static String onlinePluginDisplayName = "onlinePlugin"; + final static String onlinePluginHost = "192.168.20.2"; + final static String onlinePluginPort = "2000"; + final static String onlinePluginPath = "/online"; + final static String onlinePluginProtocol = "http"; + + @BeforeClass + public static void beforeClass() { + ConfigurationManager.setTestInstance(configurationManager); + when(configurationManager.getPluginsConfiguration()).thenReturn(pluginsConfiguration); + + offlinePlugin.setPluginId(offlinePluginsDisplayName); + offlinePlugin.setPluginHost(offlinePluginHost); + offlinePlugin.setPluginPort(offlinePluginPort); + offlinePlugin.setPluginPath(offlinePluginPath); + offlinePlugin.setPluginProtocol(offlinePluginProtocol); + + StringBuilder offlineRequestString = new StringBuilder(); + offlineRequestString.append(offlinePluginProtocol).append("://").append(onlinePluginHost).append(":") + .append(offlinePluginPort).append(offlinePluginPath); + + onlinePlugin.setPluginId(onlinePluginDisplayName); + onlinePlugin.setPluginHost(onlinePluginHost); + onlinePlugin.setPluginPort(onlinePluginPort); + onlinePlugin.setPluginPath(onlinePluginPath); + onlinePlugin.setPluginProtocol(onlinePluginProtocol); + + StringBuilder onlineRequestString = new StringBuilder(); + onlineRequestString.append(onlinePluginProtocol).append("://").append(onlinePluginHost).append(":") + .append(offlinePluginPort).append(offlinePluginPath); + + } + + @Test + public void TestOfflinePluginNotBeingReturnedWhenCallingCheckPluginsListAvailability() throws ClientProtocolException, IOException { + testPluginsList.add(offlinePlugin); + when(pluginsConfiguration.getPluginsList()).thenReturn(testPluginsList); + + when(statusLine.getStatusCode()).thenReturn(404); + when(httpResponse.getStatusLine()).thenReturn(statusLine); + when(httpClient.execute(Mockito.any(HttpHead.class))).thenReturn(httpResponse); + + assertTrue(pluginStatusBL.checkPluginsListAvailability().equals("[]")); + + } + + @Test + public void TestOnlinePluginNotBeingReturnedWhenCallingCheckPluginsListAvailability() throws ClientProtocolException, IOException { + testPluginsList.add(onlinePlugin); + when(pluginsConfiguration.getPluginsList()).thenReturn(testPluginsList); + + when(statusLine.getStatusCode()).thenReturn(200); + when(httpResponse.getStatusLine()).thenReturn(statusLine); + when(httpClient.execute(Mockito.any())).thenReturn(httpResponse); + + String result = gson.toJson(testPluginsList); + + assertTrue(pluginStatusBL.checkPluginsListAvailability().contains(result)); + + } + +} diff --git a/catalog-ui/configurations/dev.js b/catalog-ui/configurations/dev.js index bde0d1e614..65d62c83e0 100644 --- a/catalog-ui/configurations/dev.js +++ b/catalog-ui/configurations/dev.js @@ -26,7 +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_plugins_configuration": "/config/ui/plugins", "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", 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<string, DesignerDisplayOptions>; -} - -export class DesignerDisplayOptions { - displayName: string; - displayContext: Array<string>; -} - -export type Designers = Array<Designer>; - -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<string, PluginDisplayOptions>; +} + +export class PluginDisplayOptions { + displayName: string; + displayContext: Array<string>; +} + +export type Plugins = Array<Plugin>; + +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 @@ -<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]; + } +} 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/plugins/plugins-tab-view-model.ts index b2545c8ba2..ce098009f3 100644 --- a/catalog-ui/src/app/view-models/designers/designers-view-model.ts +++ b/catalog-ui/src/app/view-models/plugins/plugins-tab-view-model.ts @@ -1,33 +1,33 @@ -import {Designer, IUserProperties} from "app/models"; +import {Plugin, IUserProperties} from "app/models"; import {CacheService} from "app/services"; -import {DesignersService} from "../../ng2/services/designers.service"; +import {PluginsService} from "../../ng2/services/plugins.service"; -interface IDesignerViewModelScope extends ng.IScope { - designer: Designer +interface IPluginsTabViewModelScope extends ng.IScope { + plugin: Plugin user: IUserProperties; version: string; queryParams: Object; } -export class DesignersViewModel { +export class PluginsTabViewModel { static '$inject' = [ '$scope', '$stateParams', 'Sdc.Services.CacheService', - 'DesignersService' + 'PluginsService' ]; - constructor(private $scope:IDesignerViewModelScope, + constructor(private $scope:IPluginsTabViewModelScope, private $stateParams:any, private cacheService:CacheService, - private designersService:DesignersService) { + private pluginsService:PluginsService) { this.initScope(); } private initScope = ():void => { - this.$scope.designer = this.designersService.getDesignerByStateUrl(this.$stateParams.path); + this.$scope.plugin = this.pluginsService.getPluginByStateUrl(this.$stateParams.path); this.$scope.version = this.cacheService.get('version'); diff --git a/catalog-ui/src/app/view-models/designers/designers-view.html b/catalog-ui/src/app/view-models/plugins/plugins-tab-view.html index 9dcad66019..3695434463 100644 --- a/catalog-ui/src/app/view-models/designers/designers-view.html +++ b/catalog-ui/src/app/view-models/plugins/plugins-tab-view.html @@ -2,6 +2,6 @@ <top-nav [version]="version" [hide-search]="true"></top-nav> - <designer-frame [designer]="designer" [query-params]="queryParams"></designer-frame> + <plugin-frame [plugin]="plugin" [query-params]="queryParams"></plugin-frame> </div> 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 @@ -<div class="workspace-designers"> - - <designer-frame [designer]="designer" [query-params]="queryParams"></designer-frame> - -</div> 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/designers/designers-tab-view-model.ts b/catalog-ui/src/app/view-models/workspace/tabs/plugins/plugins-context-view-model.ts index e145188c00..76010b56f4 100644 --- a/catalog-ui/src/app/view-models/workspace/tabs/designers/designers-tab-view-model.ts +++ b/catalog-ui/src/app/view-models/workspace/tabs/plugins/plugins-context-view-model.ts @@ -1,33 +1,33 @@ -import {Designer, IUserProperties} from "app/models"; +import {Plugin, IUserProperties} from "app/models"; import {CacheService} from "app/services"; -import {DesignersService} from "../../../../ng2/services/designers.service"; +import {PluginsService} from "../../../../ng2/services/plugins.service"; import {IWorkspaceViewModelScope} from "../../workspace-view-model"; -interface IDesignerTabViewModelScope extends IWorkspaceViewModelScope { - designer: Designer; +interface IPluginsContextViewModelScope extends IWorkspaceViewModelScope { + plugin: Plugin; user:IUserProperties; queryParams: Object; } -export class DesignersTabViewModel { +export class PluginsContextViewModel { static '$inject' = [ '$scope', '$stateParams', 'Sdc.Services.CacheService', - 'DesignersService' + 'PluginsService' ]; - constructor(private $scope:IDesignerTabViewModelScope, + constructor(private $scope:IPluginsContextViewModelScope, private $stateParams:any, private cacheService:CacheService, - private designersService:DesignersService) { + private pluginsService:PluginsService) { this.initScope(); } private initScope = ():void => { - this.$scope.designer = this.designersService.getDesignerByStateUrl(this.$stateParams.path); + this.$scope.plugin = this.pluginsService.getPluginByStateUrl(this.$stateParams.path); this.$scope.user = this.cacheService.get('user'); 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 @@ +<div class="workspace-plugins"> + + <plugin-frame [plugin]="plugin" [query-params]="queryParams"></plugin-frame> + +</div> 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<any> = 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 @@ </div> </div> <div class="w-sdc-main-container-body-content-wrapper"> - <div class="tab-title" data-ng-if="!isComposition && !isDeployment && !isDesigners"> + <div class="tab-title" data-ng-if="!isComposition && !isDeployment && !isPlugins"> {{getTabTitle()}} </div> <div class="w-sdc-main-container-body-content" data-ng-class="{'third-party':thirdParty}" data-ui-view></div> diff --git a/catalog-ui/webpack.server.js b/catalog-ui/webpack.server.js index e53d79f533..d9baf470d3 100644 --- a/catalog-ui/webpack.server.js +++ b/catalog-ui/webpack.server.js @@ -39,14 +39,14 @@ module.exports = function(env) { // Redirect all '/sdc1/feProxy/rest' to feHost middlewares.push( proxy(['/sdc1/feProxy/rest'],{ - target: 'http://localhost:' + fePort, + target: 'http://192.168.50.5:' + fePort, changeOrigin: true, secure: false })); middlewares.push( proxy(['/sdc1/rest'],{ - target: 'http://localhost:' + fePort, + target: 'http://192.168.50.5:' + fePort, changeOrigin: true, secure: false })); @@ -54,7 +54,7 @@ module.exports = function(env) { // Redirect dcae urls to feHost middlewares.push( proxy(['/dcae','/sdc1/feProxy/dcae-api'],{ - target: 'http://localhost:' + fePort, + target: 'http://192.168.50.5:' + fePort, changeOrigin: true, secure: false, onProxyRes: (proxyRes, req, res) => { @@ -68,7 +68,7 @@ module.exports = function(env) { // Redirect onboarding urls to feHost middlewares.push( proxy(['/onboarding','/sdc1/feProxy/onboarding-api'],{ - target: 'http://localhost:' + fePort, + target: 'http://192.168.50.5:' + fePort, changeOrigin: true, secure: false, onProxyRes: (proxyRes, req, res) => { diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/api/Constants.java b/common-app-api/src/main/java/org/openecomp/sdc/common/api/Constants.java index 839dc0bdd2..691b8ea159 100644 --- a/common-app-api/src/main/java/org/openecomp/sdc/common/api/Constants.java +++ b/common-app-api/src/main/java/org/openecomp/sdc/common/api/Constants.java @@ -141,6 +141,6 @@ public interface Constants { public static final String HC_COMPONENT_ON_BOARDING = "ON_BOARDING"; public static final String HC_COMPONENT_DCAE = "DCAE"; - //Designer BL - public static final String DESIGNER_BL_COMPONENT = "designerStatusBL"; + //Plugin BL + public static final String PLUGIN_BL_COMPONENT = "pluginStatusBL"; } diff --git a/common-app-api/src/main/java/org/openecomp/sdc/fe/config/ConfigurationManager.java b/common-app-api/src/main/java/org/openecomp/sdc/fe/config/ConfigurationManager.java index 807189dabb..0b19c6c910 100644 --- a/common-app-api/src/main/java/org/openecomp/sdc/fe/config/ConfigurationManager.java +++ b/common-app-api/src/main/java/org/openecomp/sdc/fe/config/ConfigurationManager.java @@ -53,7 +53,7 @@ public class ConfigurationManager implements FileChangeCallback, IEcompConfigura loadConfigurationClass(Configuration.class); loadConfigurationClass(RestConfigurationInfo.class); loadConfigurationClass(EcompErrorConfiguration.class); - loadConfigurationClass(DesignersConfiguration.class); + loadConfigurationClass(PluginsConfiguration.class); } @@ -92,11 +92,11 @@ public class ConfigurationManager implements FileChangeCallback, IEcompConfigura } - public DesignersConfiguration getDesignersConfiguration() { + public PluginsConfiguration getPluginsConfiguration() { - log.info("requested designers configuration and got this:{}", configurations.get(getKey(DesignersConfiguration.class))); + log.info("requested plugins configuration and got this:{}", configurations.get(getKey(PluginsConfiguration.class))); - return (DesignersConfiguration) configurations.get(getKey(DesignersConfiguration.class)); + return (PluginsConfiguration) configurations.get(getKey(PluginsConfiguration.class)); } public Configuration getConfigurationAndWatch(ConfigurationListener configurationListener) { diff --git a/common-app-api/src/main/java/org/openecomp/sdc/fe/config/DesignersConfiguration.java b/common-app-api/src/main/java/org/openecomp/sdc/fe/config/DesignersConfiguration.java deleted file mode 100644 index 31c4d4bc9a..0000000000 --- a/common-app-api/src/main/java/org/openecomp/sdc/fe/config/DesignersConfiguration.java +++ /dev/null @@ -1,118 +0,0 @@ -package org.openecomp.sdc.fe.config; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.openecomp.sdc.common.api.BasicConfiguration; - -public class DesignersConfiguration extends BasicConfiguration { - - private List<Designer> designersList; - - public List<Designer> getDesignersList() { - return designersList; - } - - public void setDesignersList(List<Designer> designersList) { - this.designersList = designersList; - } - - public DesignersConfiguration() { - this.designersList = new ArrayList<>(); - } - - public static class Designer { - - private String designerId; - private String designerHost; - private String designerPort; - private String designerPath; - private String designerStateUrl; - private String designerProtocol; - private Map<String, DesignerDisplayOptions> designerDisplayOptions; - - public Map<String, DesignerDisplayOptions> getDesignerDisplayOptions() { - return designerDisplayOptions; - } - - public void setDesignerDisplayOptions(Map<String, DesignerDisplayOptions> designerDisplayOptions) { - this.designerDisplayOptions = designerDisplayOptions; - } - - public String getDesignerStateUrl() { - return designerStateUrl; - } - - public void setDesignerStateUrl(String designerStateUrl) { - this.designerStateUrl = designerStateUrl; - } - - public String getDesignerProtocol() { - return designerProtocol; - } - - public void setDesignerProtocol(String designerProtocol) { - this.designerProtocol = designerProtocol; - } - - public String getDesignerId() { - return designerId; - } - - public void setDesignerId(String designerId) { - this.designerId = designerId; - } - - public String getDesignerHost() { - return designerHost; - } - - public void setDesignerHost(String designerHost) { - this.designerHost = designerHost; - } - - public String getDesignerPort() { - return designerPort; - } - - public void setDesignerPort(String designerPort) { - this.designerPort = designerPort; - } - - public String getDesignerPath() { - return designerPath; - } - - public void setDesignerPath(String designerPath) { - this.designerPath = designerPath; - } - - } - - public static class DesignerDisplayOptions { - - private String displayName; - private List<String> displayContext; - - public List<String> getDisplayContext() { - return displayContext; - } - - public void setDisplayContext(List<String> displayContext) { - this.displayContext = displayContext; - } - - public String getDisplayName() { - return displayName; - } - - public void setDisplayName(String displayName) { - this.displayName = displayName; - } - - } - -} - - diff --git a/common-app-api/src/main/java/org/openecomp/sdc/fe/config/PluginsConfiguration.java b/common-app-api/src/main/java/org/openecomp/sdc/fe/config/PluginsConfiguration.java new file mode 100644 index 0000000000..ae04b7a102 --- /dev/null +++ b/common-app-api/src/main/java/org/openecomp/sdc/fe/config/PluginsConfiguration.java @@ -0,0 +1,118 @@ +package org.openecomp.sdc.fe.config; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.openecomp.sdc.common.api.BasicConfiguration; + +public class PluginsConfiguration extends BasicConfiguration { + + private List<Plugin> pluginsList; + + public List<Plugin> getPluginsList() { + return pluginsList; + } + + public void setPluginsList(List<Plugin> pluginsList) { + this.pluginsList = pluginsList; + } + + public PluginsConfiguration() { + this.pluginsList = new ArrayList<>(); + } + + public static class Plugin { + + private String pluginId; + private String pluginHost; + private String pluginPort; + private String pluginPath; + private String pluginStateUrl; + private String pluginProtocol; + private Map<String, PluginDisplayOptions> pluginDisplayOptions; + + public Map<String, PluginDisplayOptions> getPluginDisplayOptions() { + return pluginDisplayOptions; + } + + public void setPluginDisplayOptions(Map<String, PluginDisplayOptions> pluginDisplayOptions) { + this.pluginDisplayOptions = pluginDisplayOptions; + } + + public String getPluginStateUrl() { + return pluginStateUrl; + } + + public void setPluginStateUrl(String pluginStateUrl) { + this.pluginStateUrl = pluginStateUrl; + } + + public String getPluginProtocol() { + return pluginProtocol; + } + + public void setPluginProtocol(String pluginProtocol) { + this.pluginProtocol = pluginProtocol; + } + + public String getPluginId() { + return pluginId; + } + + public void setPluginId(String pluginId) { + this.pluginId = pluginId; + } + + public String getPluginHost() { + return pluginHost; + } + + public void setPluginHost(String pluginHost) { + this.pluginHost = pluginHost; + } + + public String getPluginPort() { + return pluginPort; + } + + public void setPluginPort(String pluginPort) { + this.pluginPort = pluginPort; + } + + public String getPluginPath() { + return pluginPath; + } + + public void setPluginPath(String pluginPath) { + this.pluginPath = pluginPath; + } + + } + + public static class PluginDisplayOptions { + + private String displayName; + private List<String> displayContext; + + public List<String> getDisplayContext() { + return displayContext; + } + + public void setDisplayContext(List<String> displayContext) { + this.displayContext = displayContext; + } + + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + } + +} + + diff --git a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_2_setup_configuration.rb b/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_2_setup_configuration.rb index 8612b5f5f3..236bb467f7 100644 --- a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_2_setup_configuration.rb +++ b/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_2_setup_configuration.rb @@ -16,19 +16,19 @@ template "catalog-fe-config" do }) end -template "designers-fe-config" do - path "#{jetty_base}/config/catalog-fe/designers-configuration.yaml" - source "FE-designers-configuration.yaml.erb" +template "plugins-fe-config" do + path "#{jetty_base}/config/catalog-fe/plugins-configuration.yaml" + source "FE-plugins-configuration.yaml.erb" owner "jetty" group "jetty" mode "0755" variables({ - :dcae_protocol => node['Designers']['DCAE']['dcae_protocol'], - :dcae_host => node['Designers']['DCAE']['dcae_host'], - :dcae_port => node['Designers']['DCAE']['dcae_port'], - :workflow_protocol => node['Designers']['WORKFLOW']['workflow_protocol'], - :workflow_host => node['Designers']['WORKFLOW']['workflow_host'], - :workflow_port => node['Designers']['WORKFLOW']['workflow_port'], + :dcae_protocol => node['Plugins']['DCAE']['dcae_protocol'], + :dcae_host => node['Plugins']['DCAE']['dcae_host'], + :dcae_port => node['Plugins']['DCAE']['dcae_port'], + :workflow_protocol => node['Plugins']['WORKFLOW']['workflow_protocol'], + :workflow_host => node['Plugins']['WORKFLOW']['workflow_host'], + :workflow_port => node['Plugins']['WORKFLOW']['workflow_port'] }) end diff --git a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/FE-designers-configuration.yaml.erb b/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/FE-designers-configuration.yaml.erb deleted file mode 100644 index e5c170e55b..0000000000 --- a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/FE-designers-configuration.yaml.erb +++ /dev/null @@ -1,23 +0,0 @@ -designersList: - - designerId: DCAE - designerProtocol: <%= @dcae_protocol %> - designerHost: <%= @dcae_host %> - designerPort: <%= @dcae_port %> - designerPath: "/openoui/vnfmarket/#!/marketplace" - designerStateUrl: "dcae" - designerDisplayOptions: - context: - displayName: "Monitor" - displayContext: ["RESOURCE", "SERVICE"] - - designerId: WORKFLOW - designerProtocol: <%= @workflow_protocol %> - designerHost: <%= @workflow_host %> - designerPort: <%= @workflow_port %> - designerPath: "/" - designerStateUrl: "workflowDesigner" - designerDisplayOptions: - top: - displayName: "WORKFLOW" - context: - displayName: "Workflow Designer" - displayContext: ["RESOURCE"]
\ No newline at end of file diff --git a/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/FE-plugins-configuration.yaml.erb b/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/FE-plugins-configuration.yaml.erb new file mode 100644 index 0000000000..ab13d4f2ca --- /dev/null +++ b/sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/FE-plugins-configuration.yaml.erb @@ -0,0 +1,23 @@ +pluginsList: + - pluginId: DCAE + pluginProtocol: <%= @dcae_protocol %> + pluginHost: <%= @dcae_host %> + pluginPort: <%= @dcae_port %> + pluginPath: "/openoui/vnfmarket/#!/marketplace" + pluginStateUrl: "dcae" + pluginDisplayOptions: + context: + displayName: "Monitor" + displayContext: ["RESOURCE", "SERVICE"] + - pluginId: WORKFLOW + pluginProtocol: <%= @workflow_protocol %> + pluginHost: <%= @workflow_host %> + pluginPort: <%= @workflow_port %> + pluginPath: "/" + pluginStateUrl: "workflowDesigner" + pluginDisplayOptions: + top: + displayName: "WORKFLOW" + context: + displayName: "Workflow Designer" + displayContext: ["RESOURCE"]
\ No newline at end of file |