aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/FE-plugins-configuration.yaml.erb6
-rw-r--r--catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/PluginStatusBL.java23
-rw-r--r--catalog-fe/src/main/resources/config/plugins-configuration.yaml6
-rw-r--r--catalog-fe/src/test/java/org/openecomp/sdc/fe/servlets/PluginStatusBLTest.java36
-rw-r--r--catalog-ui/src/app/models/plugins-config.ts2
-rw-r--r--catalog-ui/src/app/view-models/plugins/plugins-tab-view-model.ts6
-rw-r--r--catalog-ui/src/app/view-models/plugins/plugins-tab-view.html5
-rw-r--r--catalog-ui/src/app/view-models/plugins/plugins-tab.less10
-rw-r--r--catalog-ui/src/app/view-models/workspace/tabs/plugins/plugins-context-view-model.ts8
-rw-r--r--catalog-ui/src/app/view-models/workspace/tabs/plugins/plugins-context-view.html3
-rw-r--r--catalog-ui/src/app/view-models/workspace/tabs/plugins/plugins-context.less8
-rw-r--r--catalog-ui/src/app/view-models/workspace/tabs/plugins/plugins-tab.less3
-rw-r--r--catalog-ui/src/assets/styles/app.less2
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/fe/config/PluginsConfiguration.java18
14 files changed, 103 insertions, 33 deletions
diff --git a/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/FE-plugins-configuration.yaml.erb b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/FE-plugins-configuration.yaml.erb
index a21a7abbe5..0da79733bd 100644
--- a/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/FE-plugins-configuration.yaml.erb
+++ b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/FE-plugins-configuration.yaml.erb
@@ -18,5 +18,7 @@ pluginsList:
displayRoles: ["DESIGNER", "TESTER"]
context:
displayName: "Workflow Designer"
- displayContext: ["VF"]
- displayRoles: ["DESIGNER", "TESTER"] \ No newline at end of file
+ displayContext: ["VF", "SERVICE"]
+ displayRoles: ["DESIGNER", "TESTER"]
+
+connectionTimeout: 1000
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 563dc22507..5ed4585e10 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
@@ -23,11 +23,13 @@ public class PluginStatusBL {
private static Logger log = LoggerFactory.getLogger(PluginStatusBL.class.getName());
private static Gson gson = new GsonBuilder().setPrettyPrinting().create();
private CloseableHttpClient client = null;
-
+ private PluginsConfiguration pluginsConfiguration = ConfigurationManager.getConfigurationManager().getPluginsConfiguration();
+ private Integer connectionTimeout;
+
public PluginStatusBL() {
this.client = HttpClients.createDefault();
}
-
+
public PluginStatusBL(CloseableHttpClient client) {
this.client = client;
@@ -36,21 +38,18 @@ public class PluginStatusBL {
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);
+ connectionTimeout = pluginsConfiguration.getConnectionTimeout();
List<Plugin> availablePluginsList = new ArrayList<>();
- pluginsConfiguration.getPluginsList().forEach(value -> {
- if (checkPluginAvailability(value)) {
- availablePluginsList.add(value);
- }
+ pluginsConfiguration.getPluginsList().forEach(plugin -> {
+ plugin.setOnline(checkPluginAvailability(plugin));
+ availablePluginsList.add(plugin);
});
result = gson.toJson(availablePluginsList);
}
@@ -62,9 +61,9 @@ public class PluginStatusBL {
HttpHead head = new HttpHead(plugin.getPluginDiscoveryUrl());
RequestConfig requestConfig = RequestConfig.custom()
- .setSocketTimeout(1000)
- .setConnectTimeout(1000)
- .setConnectionRequestTimeout(1000).build();
+ .setSocketTimeout(connectionTimeout)
+ .setConnectTimeout(connectionTimeout)
+ .setConnectionRequestTimeout(connectionTimeout).build();
head.setConfig(requestConfig);
diff --git a/catalog-fe/src/main/resources/config/plugins-configuration.yaml b/catalog-fe/src/main/resources/config/plugins-configuration.yaml
index 69598e0ebe..eb36945715 100644
--- a/catalog-fe/src/main/resources/config/plugins-configuration.yaml
+++ b/catalog-fe/src/main/resources/config/plugins-configuration.yaml
@@ -17,5 +17,7 @@ pluginsList:
displayName: "WORKFLOW"
context:
displayName: "Workflow Designer"
- displayContext: ["VF"]
- displayRoles: ["DESIGNER", "TESTER"] \ No newline at end of file
+ displayContext: ["VF", "SERVICE"]
+ displayRoles: ["DESIGNER", "TESTER"]
+
+connectionTimeout: 1000 \ 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 baef6858a3..25fef8968b 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
@@ -12,6 +12,7 @@ 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.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.mockito.Mockito;
@@ -35,7 +36,8 @@ public class PluginStatusBLTest {
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<>();
+ static List<Plugin> testPluginsList = new ArrayList<>();
+ static List<Plugin> assertPluginList = new ArrayList<>();
final static String offlinePluginsDisplayName = "offlinePlugin";
final static String offlinePluginDiscoveryPath = "http://192.168.10.1:1000/offline";
@@ -53,34 +55,50 @@ public class PluginStatusBLTest {
onlinePlugin.setPluginId(onlinePluginDisplayName);
onlinePlugin.setPluginDiscoveryUrl(onlinePluginDiscoveryPath);
-
+ }
+
+ @Before
+ public void beforeTest() {
+ testPluginsList = new ArrayList<>();
+ assertPluginList = new ArrayList<>();
}
@Test
- public void TestOfflinePluginNotBeingReturnedWhenCallingCheckPluginsListAvailability() throws ClientProtocolException, IOException {
+ public void TestOfflinePluginBeingReturnedWithIsOnlineValueFalse() 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);
+
+ offlinePlugin.setOnline(false);
+ assertPluginList.add(offlinePlugin);
+
+ String result = gson.toJson(assertPluginList);
+ String actualResult = pluginStatusBL.checkPluginsListAvailability();
+
+ System.out.println(result);
+ System.out.println(actualResult);
- assertTrue(pluginStatusBL.checkPluginsListAvailability().equals("[]"));
-
+ assertTrue(pluginStatusBL.checkPluginsListAvailability().equals(result));
}
@Test
- public void TestOnlinePluginNotBeingReturnedWhenCallingCheckPluginsListAvailability() throws ClientProtocolException, IOException {
+ public void TestOnlinePluginBeingReturnedWithIsOnlineValueTrue() 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);
+
+ onlinePlugin.setOnline(true);
+ assertPluginList.add(onlinePlugin);
+
+ String result = gson.toJson(assertPluginList);
- String result = gson.toJson(testPluginsList);
-
- assertTrue(pluginStatusBL.checkPluginsListAvailability().contains(result));
+ assertTrue(pluginStatusBL.checkPluginsListAvailability().equals(result));
}
diff --git a/catalog-ui/src/app/models/plugins-config.ts b/catalog-ui/src/app/models/plugins-config.ts
index 3f687a3af0..e69501abb4 100644
--- a/catalog-ui/src/app/models/plugins-config.ts
+++ b/catalog-ui/src/app/models/plugins-config.ts
@@ -5,6 +5,7 @@ export class Plugin {
pluginSourceUrl: string;
pluginStateUrl: string;
pluginDisplayOptions: Map<string, PluginDisplayOptions>;
+ isOnline: boolean;
}
export class PluginDisplayOptions {
@@ -17,4 +18,5 @@ export type Plugins = Array<Plugin>;
export class PluginsConfiguration {
static plugins: Plugins;
+ static connectionTimeout: boolean;
}
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 438cf4a60c..cb3f842648 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
@@ -30,11 +30,15 @@ export class PluginsTabViewModel {
}
private initScope = ():void => {
- this.$scope.isLoading = true;
this.$scope.plugin = this.pluginsService.getPluginByStateUrl(this.$stateParams.path);
this.$scope.version = this.cacheService.get('version');
this.$scope.user = this.cacheService.get('user');
+ // Don't show the loader if the plugin isn't online
+ if (this.$scope.plugin.isOnline) {
+ this.$scope.isLoading = true;
+ }
+
this.$scope.queryParams = {
userId: this.$scope.user.userId,
userRole: this.$scope.user.role,
diff --git a/catalog-ui/src/app/view-models/plugins/plugins-tab-view.html b/catalog-ui/src/app/view-models/plugins/plugins-tab-view.html
index bc404b46d1..6ee4855a4c 100644
--- a/catalog-ui/src/app/view-models/plugins/plugins-tab-view.html
+++ b/catalog-ui/src/app/view-models/plugins/plugins-tab-view.html
@@ -1,5 +1,6 @@
-<div class="sdc-catalog-container">
+<div class="sdc-catalog-container plugins-tab-container">
<loader display="isLoading"></loader>
<top-nav [version]="version" [hide-search]="true"></top-nav>
- <plugin-frame (on-loading-done)="onLoadingDone(plugin)" [plugin]="plugin" [query-params]="queryParams"></plugin-frame>
+ <plugin-frame data-ng-if="plugin.isOnline" (on-loading-done)="onLoadingDone(plugin)" [plugin]="plugin" [query-params]="queryParams"></plugin-frame>
+ <div class="offline-plugin-message" data-ng-if="!plugin.isOnline">The plugin {{plugin.pluginId}} is offline. Please try again later</div>
</div>
diff --git a/catalog-ui/src/app/view-models/plugins/plugins-tab.less b/catalog-ui/src/app/view-models/plugins/plugins-tab.less
new file mode 100644
index 0000000000..f821041436
--- /dev/null
+++ b/catalog-ui/src/app/view-models/plugins/plugins-tab.less
@@ -0,0 +1,10 @@
+.plugins-tab-container {
+
+ text-align: center;
+
+ .offline-plugin-message {
+ top: 50px;
+ position: relative;
+ display: inline-block;
+ }
+}
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 550fb84c10..3e0fb44cc8 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
@@ -9,6 +9,7 @@ interface IPluginsContextViewModelScope extends IWorkspaceViewModelScope {
user:IUserProperties;
queryParams: Object;
isLoading: boolean;
+ show: boolean;
onLoadingDone(plugin: Plugin): void;
}
@@ -30,10 +31,15 @@ export class PluginsContextViewModel {
}
private initScope = ():void => {
- this.$scope.isLoading = true;
+ this.$scope.show = false;
this.$scope.plugin = this.pluginsService.getPluginByStateUrl(this.$stateParams.path);
this.$scope.user = this.cacheService.get('user');
+ // Don't show loader if the plugin isn't online
+ if (this.$scope.plugin.isOnline) {
+ this.$scope.isLoading = true;
+ }
+
this.$scope.queryParams = {
userId: this.$scope.user.userId,
userRole: this.$scope.user.role,
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
index d70717a3ed..6c34749a28 100644
--- 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
@@ -1,4 +1,5 @@
<loader display="isLoading"></loader>
<div class="workspace-plugins">
- <plugin-frame (on-loading-done)="onLoadingDone(plugin)" [plugin]="plugin" [query-params]="queryParams"></plugin-frame>
+ <plugin-frame data-ng-if="plugin.isOnline" (on-loading-done)="onLoadingDone(plugin)" [plugin]="plugin" [query-params]="queryParams"></plugin-frame>
+ <div class="offline-plugin-message" data-ng-if="!plugin.isOnline">The plugin {{plugin.pluginId}} is offline. Please try again later</div>
</div>
diff --git a/catalog-ui/src/app/view-models/workspace/tabs/plugins/plugins-context.less b/catalog-ui/src/app/view-models/workspace/tabs/plugins/plugins-context.less
new file mode 100644
index 0000000000..dd0b751423
--- /dev/null
+++ b/catalog-ui/src/app/view-models/workspace/tabs/plugins/plugins-context.less
@@ -0,0 +1,8 @@
+.workspace-plugins {
+
+ text-align: center;
+
+ .offline-plugin-message {
+ display: inline-block;
+ }
+}
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
deleted file mode 100644
index 7798e36af8..0000000000
--- a/catalog-ui/src/app/view-models/workspace/tabs/plugins/plugins-tab.less
+++ /dev/null
@@ -1,3 +0,0 @@
-.workspace-plugins {
-
-}
diff --git a/catalog-ui/src/assets/styles/app.less b/catalog-ui/src/assets/styles/app.less
index f48fd864ef..6eabc7e756 100644
--- a/catalog-ui/src/assets/styles/app.less
+++ b/catalog-ui/src/assets/styles/app.less
@@ -93,6 +93,7 @@
@import '../../app/view-models/modals/onboarding-modal/onboarding-modal.less';
@import '../../app/view-models/modals/icons-modal/icons-modal-view.less';
@import '../../app/view-models/onboard-vendor/onboard-vendor.less';
+@import '../../app/view-models/plugins/plugins-tab.less';
@import '../../app/view-models/support/support.less';
@import '../../app/view-models/tabs/general-tab.less';
@import '../../app/view-models/tabs/hierarchy/hierarchy.less';
@@ -117,3 +118,4 @@
@import '../../app/view-models/workspace/tabs/req-and-capabilities/req-and-capabilities.less';
@import '../../app/view-models/workspace/tabs/tosca-artifacts/tosca-artifacts.less';
@import '../../app/view-models/workspace/workspace.less';
+@import '../../app/view-models/workspace/tabs/plugins/plugins-context.less';
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 7865abd3da..3dbf31ba18 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
@@ -9,6 +9,7 @@ import org.openecomp.sdc.common.api.BasicConfiguration;
public class PluginsConfiguration extends BasicConfiguration {
private List<Plugin> pluginsList;
+ private Integer connectionTimeout;
public List<Plugin> getPluginsList() {
return pluginsList;
@@ -18,6 +19,14 @@ public class PluginsConfiguration extends BasicConfiguration {
this.pluginsList = pluginsList;
}
+ public Integer getConnectionTimeout() {
+ return connectionTimeout;
+ }
+
+ public void setConnectionTimeout(Integer connectionTimeout) {
+ this.connectionTimeout = connectionTimeout;
+ }
+
public PluginsConfiguration() {
this.pluginsList = new ArrayList<>();
}
@@ -29,6 +38,7 @@ public class PluginsConfiguration extends BasicConfiguration {
private String pluginSourceUrl;
private String pluginStateUrl;
private Map<String, PluginDisplayOptions> pluginDisplayOptions;
+ private boolean isOnline;
public String getPluginId() {
return pluginId;
@@ -70,6 +80,14 @@ public class PluginsConfiguration extends BasicConfiguration {
this.pluginDisplayOptions = pluginDisplayOptions;
}
+ public boolean isOnline() {
+ return isOnline;
+ }
+
+ public void setOnline(boolean online) {
+ isOnline = online;
+ }
+
}
public static class PluginDisplayOptions {