aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIdan Amit <ia096e@intl.att.com>2018-01-31 18:57:31 +0200
committerMichael Lando <ml636r@att.com>2018-02-01 08:15:25 +0000
commit162f50777e13eebe3b27ec8364ee892be628f7b0 (patch)
treeebce6947b372a61827745e9985eef0ac3f144af2
parent3c9f4df71b978e92a6eeb6f22bc7535e749d11c2 (diff)
Align configuration for new design
Aligned the designers configuration according to the new design addition and changes Change-Id: Id08942b5a8adbac10bbe76bdd8a2a6f093ec8b46 Issue-ID: SDC-975 Signed-off-by: Idan Amit <ia096e@intl.att.com>
-rw-r--r--catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/PluginStatusBL.java7
-rw-r--r--catalog-fe/src/main/resources/config/plugins-configuration.yaml21
-rw-r--r--catalog-fe/src/test/java/org/openecomp/sdc/fe/servlets/PluginStatusBLTest.java28
-rw-r--r--catalog-ui/src/app/models/plugins-config.ts7
-rw-r--r--catalog-ui/src/app/ng2/components/layout/top-nav/top-nav.component.ts13
-rw-r--r--catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.ts5
-rw-r--r--catalog-ui/src/app/view-models/plugins/plugins-tab-view-model.ts4
-rw-r--r--catalog-ui/src/app/view-models/workspace/tabs/plugins/plugins-context-view-model.ts2
-rw-r--r--catalog-ui/src/app/view-models/workspace/workspace-view-model.ts30
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/fe/config/PluginsConfiguration.java81
-rw-r--r--sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_2_setup_configuration.rb10
-rw-r--r--sdc-os-chef/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/FE-plugins-configuration.yaml.erb24
12 files changed, 99 insertions, 133 deletions
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
index dcd5eef491..55e779078d 100644
--- 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
@@ -57,14 +57,9 @@ public class PluginStatusBL {
}
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());
+ HttpHead head = new HttpHead(plugin.getPluginDiscoveryUrl());
try (CloseableHttpResponse response = this.client.execute(head)) {
result = response != null && response.getStatusLine().getStatusCode() == 200;
diff --git a/catalog-fe/src/main/resources/config/plugins-configuration.yaml b/catalog-fe/src/main/resources/config/plugins-configuration.yaml
index 4193b506d2..69598e0ebe 100644
--- a/catalog-fe/src/main/resources/config/plugins-configuration.yaml
+++ b/catalog-fe/src/main/resources/config/plugins-configuration.yaml
@@ -1,22 +1,21 @@
pluginsList:
- pluginId: DCAE
- pluginHost: localhost
- pluginPort: 8080
- pluginPath: "/dcae"
+ pluginDiscoveryUrl: http://localhost:8702/dcae
+ pluginSourceUrl: http://localhost:8702/dcae
pluginStateUrl: "dcae"
- pluginProtocol: http
pluginDisplayOptions:
context:
displayName: "Monitor"
displayContext: ["VF", "SERVICE"]
- top:
- displayName: "DCAE"
+ displayRoles: ["DESIGNER"]
- pluginId: WORKFLOW
- pluginHost: localhost
- pluginPort: 9527
- pluginPath: "/"
+ pluginDiscoveryUrl: http://localhost:9527/
+ pluginSourceUrl: http://localhost:9527/
pluginStateUrl: "workflowDesigner"
- pluginProtocol: http
pluginDisplayOptions:
top:
- displayName: "WORKFLOW" \ No newline at end of file
+ displayName: "WORKFLOW"
+ context:
+ displayName: "Workflow Designer"
+ displayContext: ["VF"]
+ displayRoles: ["DESIGNER", "TESTER"] \ No newline at end of file
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
index 8a796a4993..baef6858a3 100644
--- 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
@@ -38,16 +38,10 @@ public class PluginStatusBLTest {
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 offlinePluginDiscoveryPath = "http://192.168.10.1:1000/offline";
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";
+ final static String onlinePluginDiscoveryPath = "http://192.168.10.1:2000/online";
@BeforeClass
public static void beforeClass() {
@@ -55,24 +49,10 @@ public class PluginStatusBLTest {
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);
+ offlinePlugin.setPluginDiscoveryUrl(offlinePluginDiscoveryPath);
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);
+ onlinePlugin.setPluginDiscoveryUrl(onlinePluginDiscoveryPath);
}
diff --git a/catalog-ui/src/app/models/plugins-config.ts b/catalog-ui/src/app/models/plugins-config.ts
index 18782ec891..3f687a3af0 100644
--- a/catalog-ui/src/app/models/plugins-config.ts
+++ b/catalog-ui/src/app/models/plugins-config.ts
@@ -1,17 +1,16 @@
export class Plugin {
pluginId: string;
- pluginHost: string;
- pluginPort: string;
- pluginPath: string;
+ pluginDiscoveryUrl: string;
+ pluginSourceUrl: string;
pluginStateUrl: string;
- pluginProtocol: string;
pluginDisplayOptions: Map<string, PluginDisplayOptions>;
}
export class PluginDisplayOptions {
displayName: string;
displayContext: Array<string>;
+ displayRoles: Array<string>;
}
export type Plugins = Array<Plugin>;
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 5e43fec680..b8b0e80861 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
@@ -120,14 +120,15 @@ export class TopNavComponent {
tmpArray.push(new MenuItem(hostedApp.navTitle, null, hostedApp.defaultState, "goToState", null, 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));
- }
- })
}
+ // Adding plugins to top-nav only if they can be displayed for the current connected user role
+ _.each(PluginsConfiguration.plugins, (plugin: Plugin) => {
+ if (plugin.pluginDisplayOptions["tab"] && (this.user && plugin.pluginDisplayOptions["tab"].displayRoles.includes(this.user.role))) {
+ tmpArray.push(new MenuItem(plugin.pluginDisplayOptions["tab"].displayName, null, "plugins", "goToState", {path: plugin.pluginStateUrl}, null));
+ }
+ });
+
this.topLvlMenu = new MenuItemGroup(0, tmpArray, true);
this.topLvlMenu.selectedIndex = isNaN(this.topLvlSelectedIndex) ? this._getTopLvlSelectedIndexByState() : this.topLvlSelectedIndex;
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
index 169cad0411..801dfa98fe 100644
--- 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
@@ -21,10 +21,7 @@ export class PluginFrameComponent implements OnInit {
ngOnInit(): void {
- this.pluginUrl = this.plugin.pluginProtocol + "://" +
- this.plugin.pluginHost + ":" +
- this.plugin.pluginPort +
- this.plugin.pluginPath;
+ this.pluginUrl = this.plugin.pluginSourceUrl;
if (this.queryParams && !_.isEmpty(this.queryParams)) {
_.forOwn(this.queryParams, (value, key) => {
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
index ce098009f3..d9dc40bdaf 100644
--- 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
@@ -34,7 +34,9 @@ export class PluginsTabViewModel {
this.$scope.user = this.cacheService.get('user');
this.$scope.queryParams = {
- userId: this.$scope.user.userId
+ userId: this.$scope.user.userId,
+ userRole: this.$scope.user.role,
+ displayType: "tab"
};
}
}
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
index 76010b56f4..ca8c269116 100644
--- 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
@@ -33,6 +33,8 @@ export class PluginsContextViewModel {
this.$scope.queryParams = {
userId: this.$scope.user.userId,
+ userRole: this.$scope.user.role,
+ displayType: "context",
contextType: this.$scope.component.componentType,
uuid: this.$scope.component.uuid,
lifecycleState: this.$scope.component.lifecycleState,
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 59dd2d8f00..0f9d7590c7 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
@@ -719,23 +719,21 @@ 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 plugins to the menu if the current role is Designer
- if (this.role === "DESIGNER") {
- _.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.plugins',
- params: {path: plugin.pluginStateUrl}
- });
- }
+ // Only adding plugins to the workspace if they can be displayed for the current user role
+ _.each(PluginsConfiguration.plugins, (plugin: Plugin) => {
+ if (plugin.pluginDisplayOptions["context"] && plugin.pluginDisplayOptions["context"].displayRoles.includes(this.role)) {
+ let displayOptions : PluginDisplayOptions = plugin.pluginDisplayOptions["context"];
+
+ if (displayOptions.displayContext.indexOf(this.$scope.component.getComponentSubType()) !== -1) {
+ menuItemsObjects.push({
+ text: displayOptions.displayName,
+ action: 'onMenuItemPressed',
+ state: 'workspace.plugins',
+ params: {path: plugin.pluginStateUrl}
+ });
}
- });
- }
+ }
+ });
this.$scope.leftBarTabs.menuItems = menuItemsObjects.map((item:MenuItem) => {
if (item.params) {
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
index ae04b7a102..7865abd3da 100644
--- 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
@@ -25,37 +25,11 @@ public class PluginsConfiguration extends BasicConfiguration {
public static class Plugin {
private String pluginId;
- private String pluginHost;
- private String pluginPort;
- private String pluginPath;
+ private String pluginDiscoveryUrl;
+ private String pluginSourceUrl;
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;
}
@@ -64,28 +38,36 @@ public class PluginsConfiguration extends BasicConfiguration {
this.pluginId = pluginId;
}
- public String getPluginHost() {
- return pluginHost;
+ public String getPluginDiscoveryUrl() {
+ return pluginDiscoveryUrl;
+ }
+
+ public void setPluginDiscoveryUrl(String pluginDiscoveryUrl) {
+ this.pluginDiscoveryUrl = pluginDiscoveryUrl;
+ }
+
+ public String getPluginSourceUrl() {
+ return pluginSourceUrl;
}
- public void setPluginHost(String pluginHost) {
- this.pluginHost = pluginHost;
+ public void setPluginSourceUrl(String pluginSourceUrl) {
+ this.pluginSourceUrl = pluginSourceUrl;
}
- public String getPluginPort() {
- return pluginPort;
+ public String getPluginStateUrl() {
+ return pluginStateUrl;
}
- public void setPluginPort(String pluginPort) {
- this.pluginPort = pluginPort;
+ public void setPluginStateUrl(String pluginStateUrl) {
+ this.pluginStateUrl = pluginStateUrl;
}
- public String getPluginPath() {
- return pluginPath;
+ public Map<String, PluginDisplayOptions> getPluginDisplayOptions() {
+ return pluginDisplayOptions;
}
- public void setPluginPath(String pluginPath) {
- this.pluginPath = pluginPath;
+ public void setPluginDisplayOptions(Map<String, PluginDisplayOptions> pluginDisplayOptions) {
+ this.pluginDisplayOptions = pluginDisplayOptions;
}
}
@@ -94,6 +76,15 @@ public class PluginsConfiguration extends BasicConfiguration {
private String displayName;
private List<String> displayContext;
+ private List<String> displayRoles;
+
+ public String getDisplayName() {
+ return displayName;
+ }
+
+ public void setDisplayName(String displayName) {
+ this.displayName = displayName;
+ }
public List<String> getDisplayContext() {
return displayContext;
@@ -103,14 +94,16 @@ public class PluginsConfiguration extends BasicConfiguration {
this.displayContext = displayContext;
}
- public String getDisplayName() {
- return displayName;
+ public List<String> getDisplayRoles() {
+ return displayRoles;
}
- public void setDisplayName(String displayName) {
- this.displayName = displayName;
+ public void setDisplayRoles(List<String> displayRoles) {
+ this.displayRoles = displayRoles;
}
+
+
}
}
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 236bb467f7..9e5953c394 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
@@ -23,12 +23,10 @@ template "plugins-fe-config" do
group "jetty"
mode "0755"
variables({
- :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']
+ :dcae_discovery_url => node['Plugins']['DCAE']['dcae_discovery_url'],
+ :dcae_source_url => node['Plugins']['DCAE']['dcae_source_url'],
+ :workflow_discovery_url => node['Plugins']['WORKFLOW']['workflow_discovery_url'],
+ :workflow_source_url => node['Plugins']['WORKFLOW']['workflow_source_url']
})
end
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
index ab13d4f2ca..0a3b15c92b 100644
--- 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
@@ -1,23 +1,25 @@
pluginsList:
- pluginId: DCAE
- pluginProtocol: <%= @dcae_protocol %>
- pluginHost: <%= @dcae_host %>
- pluginPort: <%= @dcae_port %>
- pluginPath: "/openoui/vnfmarket/#!/marketplace"
+ pluginDiscoveryUrl: <%= @dcae_discovery_url %>
+ pluginSourceUrl: <%= @dcae_source_url %>
pluginStateUrl: "dcae"
pluginDisplayOptions:
+ tab:
+ displayName: "DCAE"
+ displayRoles: ["TESTER"]
context:
displayName: "Monitor"
- displayContext: ["RESOURCE", "SERVICE"]
+ displayContext: ["VF", "SERVICE"]
+ displayRoles: ["DESIGNER"]
- pluginId: WORKFLOW
- pluginProtocol: <%= @workflow_protocol %>
- pluginHost: <%= @workflow_host %>
- pluginPort: <%= @workflow_port %>
- pluginPath: "/"
+ pluginDiscoveryUrl: <%= @workflow_discovery_url %>
+ pluginSourceUrl: <%= @workflow_source_url %>
pluginStateUrl: "workflowDesigner"
pluginDisplayOptions:
- top:
+ tab:
displayName: "WORKFLOW"
+ displayRoles: ["DESIGNER", "TESTER"]
context:
displayName: "Workflow Designer"
- displayContext: ["RESOURCE"] \ No newline at end of file
+ displayContext: ["VF"]
+ displayRoles: ["DESIGNER", "TESTER"] \ No newline at end of file