Merge pull request #688 from amalhub/master

Cherry-pick from Cloud 3.1.0
4.x.x
Kamidu Sachith Punchihewa 8 years ago committed by GitHub
commit b766925fc5

@ -46,7 +46,7 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe
private static final int MAX_API_PER_TAG = 200; private static final int MAX_API_PER_TAG = 200;
private static final String APP_TIER_TYPE = "application"; private static final String APP_TIER_TYPE = "application";
private static final Map<String, String> tiersMap = new HashMap<>(); private static final Map<String, String> tiersMap = new HashMap<>();
private static final int MAX_ATTEMPTS = 10; private static final int MAX_ATTEMPTS = 20;
@Override @Override
public void removeAPIApplication(String applicationName, String username) throws APIManagerException { public void removeAPIApplication(String applicationName, String username) throws APIManagerException {
@ -76,8 +76,9 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe
String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext() String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext()
.getTenantDomain(); .getTenantDomain();
String tiersLoadedForTenant = tiersMap.get(tenantDomain); String tiersLoadedForTenant = tiersMap.get(tenantDomain);
if (tiersLoadedForTenant == null) { if (tiersLoadedForTenant == null) {
int tierStatus = 0; boolean tierLoaded = false;
int attempts = 0; int attempts = 0;
do { do {
try { try {
@ -85,9 +86,8 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe
.tiersTierLevelTierNameGet(ApiApplicationConstants.DEFAULT_TIER, APP_TIER_TYPE, .tiersTierLevelTierNameGet(ApiApplicationConstants.DEFAULT_TIER, APP_TIER_TYPE,
tenantDomain, CONTENT_TYPE, null, null); tenantDomain, CONTENT_TYPE, null, null);
tiersMap.put(tenantDomain, "exist"); tiersMap.put(tenantDomain, "exist");
tierStatus = 200; tierLoaded = true;
} catch (FeignException e) { } catch (FeignException e) {
tierStatus = e.status();
attempts++; attempts++;
try { try {
Thread.sleep(500); Thread.sleep(500);
@ -95,7 +95,7 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe
log.warn("Interrupted the waiting for tier availability."); log.warn("Interrupted the waiting for tier availability.");
} }
} }
} while (tierStatus == 500 && attempts < MAX_ATTEMPTS); } while ((!tierLoaded) && attempts < MAX_ATTEMPTS);
} }
ApplicationList applicationList = storeClient.getApplications() ApplicationList applicationList = storeClient.getApplications()

@ -65,8 +65,7 @@ public class DeviceTypeManagerService implements DeviceManagementService {
this.operationMonitoringConfigs = new OperationMonitoringTaskConfig(); this.operationMonitoringConfigs = new OperationMonitoringTaskConfig();
this.setOperationMonitoringConfig(deviceTypeConfiguration); this.setOperationMonitoringConfig(deviceTypeConfiguration);
this.setInitialOperationConfig(deviceTypeConfiguration); this.setInitialOperationConfig(deviceTypeConfiguration);
if (deviceTypeConfiguration.getPolicyMonitoring() != null && deviceTypeConfiguration.getPolicyMonitoring() if (deviceTypeConfiguration.getPolicyMonitoring() != null ) {
.isEnabled()) {
this.policyMonitoringManager = new DefaultPolicyMonitoringManager(); this.policyMonitoringManager = new DefaultPolicyMonitoringManager();
} }
} }

@ -1,7 +1,7 @@
{ {
"Logo": { "Logo": {
"name": "Cloud", "name": "Cloud",
"url": "https://<%= @cloudmgt_host %>/cloudmgt", "url": "https://cloudmgt.cloud.wso2.com/cloudmgt",
"target": "_parent" "target": "_parent"
}, },
"Main": { "Main": {
@ -12,75 +12,21 @@
"target": "_parent", "target": "_parent",
"dropDown": { "dropDown": {
"Organization": { "Organization": {
"url": "https://<%= @cloudmgt_host %>/cloudmgt/site/pages/organization.jag", "url": "https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/organization.jag",
"icon": "fw fw-organization", "icon": "fw fw-organization",
"dropDown": "false", "dropDown": "false",
"target": "_self" "target": "_self"
}, },
"Members": { "Members": {
"url": "https://<%= @cloudmgt_host %>/cloudmgt/site/pages/user.jag", "url": "https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/user.jag",
"icon": "fa fa-users", "icon": "fa fa-users",
"dropDown": "false", "dropDown": "false",
"target": "_self" "target": "_self"
} }
} }
}, },
"Account": {
"url": "https://<%= @cloudmgt_host %>/cloudmgt/site/pages/account-summary.jag",
"icon": "fw fw-resource",
"isAdminOnly": true,
"target": "_blank",
"dropDown": {
"Upgrade Now": {
"url": "https://<%= @cloudmgt_host %>/cloudmgt/site/pages/payment-plans.jag?cloud-type=api_cloud",
"icon": "fw fw-export",
"target": "_self"
},
"Monetization": {
"url": "https://<%= @cloudmgt_host %>/cloudmgt/site/pages/monetization-dashboard.jag",
"icon": "fa fa-money fa-lg",
"dropDown": "false",
"target": "_self"
},
"Request Extension": {
"url": "https://<%= @cloudmgt_host %>/cloudmgt/site/pages/contact-us.jag?cloud-type=api_cloud&request-extension=true",
"icon": "fw fw-mail",
"target": "_blank"
},
"Usage data": {
"url": "https://<%= @cloudmgt_host %>/cloudmgt/site/pages/tenant-usage.jag?cloud-type=api_cloud",
"icon": "fw fw-bar-chart",
"target": "_self"
}
}
},
"Configure": {
"url": "none",
"icon": "fw fw-settings",
"isAdminOnly": true,
"dropDown": {
"Admin Dashboard": {
"id": "admin-dashboard",
"url": "https://<%= @apimpublisher_host %>/admin-dashboard/",
"icon": "fw fw-user",
"target": "_self"
},
"Custom URL": {
"id": "custom-url",
"url": "https://<%= @cloudmgt_host %>/cloudmgt/site/pages/custom_url.jag",
"icon": "fw fw-uri",
"target": "_self"
},
"API Store Access": {
"id": "custom-url",
"url": "https://<%= @cloudmgt_host %>/cloudmgt/site/pages/selfSignup.jag",
"icon": "fw fw-store",
"target": "_self"
}
}
},
"Support": { "Support": {
"url": "https://<%= @cloudmgt_host %>/cloudmgt/site/pages/contact-us.jag", "url": "https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/contact-us.jag",
"icon": "fw fw-mail", "icon": "fw fw-mail",
"isAdminOnly": false, "isAdminOnly": false,
"target": "_self", "target": "_self",
@ -91,29 +37,11 @@
"icon": "fw fw-document", "icon": "fw fw-document",
"isAdminOnly": false, "isAdminOnly": false,
"dropDown": { "dropDown": {
"API Cloud": {
"id": "api_cloud",
"url": "https://docs.wso2.com/display/APICloud/WSO2+API+Cloud+Documentation",
"icon": "fw fw-api",
"target": "_blank"
},
"Integration Cloud": {
"id": "integration_cloud",
"url": "https://docs.wso2.com/display/IntegrationCloud/WSO2+Integration+Cloud+Documentation",
"icon": "fw fw-application",
"target": "_blank"
},
"Device Cloud": { "Device Cloud": {
"id": "device_cloud", "id": "device_cloud",
"url": "https://docs.wso2.com/display/DeviceCloud/WSO2+Device+Cloud+Documentation", "url": "https://docs.wso2.com/display/DeviceCloud/WSO2+Device+Cloud+Documentation",
"icon": "fw fw-mobile", "icon": "fw fw-mobile",
"target": "_self" "target": "_self"
},
"API Cloud Walkthrough": {
"id": "api_cloud_walkthrough",
"url": "https://<%= @apimpublisher_host %>/publisher?interactiveTutorial=true",
"icon": "fw fw-document",
"target": "_self"
} }
} }
} }
@ -123,19 +51,19 @@
"icon": "fw fw-user", "icon": "fw fw-user",
"dropDown": { "dropDown": {
"Profile": { "Profile": {
"url": "https://<%= @cloudmgt_host %>/cloudmgt/site/pages/user-profile.jag", "url": "https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/user-profile.jag",
"icon": "fw fw-user", "icon": "fw fw-user",
"dropDown": "true", "dropDown": "true",
"target": "_self" "target": "_self"
}, },
"Change Password": { "Change Password": {
"url": "https://<%= @cloudmgt_host %>/cloudmgt/site/pages/change-password.jag", "url": "https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/change-password.jag",
"icon": "fw fw-lock", "icon": "fw fw-lock",
"dropDown": "true", "dropDown": "true",
"target": "_self" "target": "_self"
}, },
"Logout": { "Logout": {
"url": "https://<%= @apimpublisher_host %>/publisher/site/pages/logout.jag", "url": "https://api.cloud.wso2.com/publisher/site/pages/logout.jag",
"icon": "fw fw-sign-out", "icon": "fw fw-sign-out",
"dropDown": "true", "dropDown": "true",
"target": "_self" "target": "_self"
@ -146,50 +74,36 @@
"Clouds": { "Clouds": {
"API Cloud": { "API Cloud": {
"id": "api_cloud", "id": "api_cloud",
"url": "https://<%= @apimpublisher_host %>/publisher", "url": "https://api.cloud.wso2.com/publisher",
"icon": "fw fw-api fw-3x", "icon": "fw fw-api fw-3x",
"dropDown": "true", "dropDown": "true",
"target": "_self" "target": "_self"
}, },
"Integration Cloud": { "Integration Cloud": {
"id": "integration_cloud", "id": "integration_cloud",
"url": "https://milestones.appfactory.wso2.com:9443/appmgt", "url": "https://integration.cloud.wso2.com/appmgt",
"icon": "fa fa-cubes fw-3x", "icon": "fw fw-service fw-3x",
"dropDown": "true", "dropDown": "true",
"target": "_self" "target": "_self"
}, },
"Identity Cloud": { "Identity Cloud": {
"id": "integration_cloud", "id": "integration_cloud",
"url": "https://identity.cloudlocal.wso2.com:9443/admin", "url": "https://identity.cloud.wso2.com/admin",
"icon": "fw fw-security fw-3x", "icon": "fw fw-security fw-3x",
"dropDown": "true", "dropDown": "true",
"target": "_self" "target": "_self"
},
"App Cloud": {
"id": "app_cloud",
"url": "https://<%= @appcloud_host %>/appmgt",
"icon": "fw fw-application fw-3x",
"dropDown": "true",
"target": "_self"
},
"Device Cloud": {
"id": "device_cloud",
"url": "https://<%= @mgt_hostname %>/devicemgt",
"icon": "fw fw-mobile fw-3x",
"dropDown": "true",
"target": "_self"
} }
}, },
"Actions": { "Actions": {
"Organization": { "Organization": {
"url": "https://<%= @cloudmgt_host %>/cloudmgt/site/pages/organization.jag", "url": "https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/organization.jag",
"icon": "fw fw-organization fw-3x", "icon": "fw fw-organization fw-3x",
"dropDown": "true", "dropDown": "true",
"target": "_self" "target": "_self"
}, },
"Members": { "Members": {
"url": "https://<%= @cloudmgt_host %>/cloudmgt/site/pages/user.jag", "url": "https://cloudmgt.cloud.wso2.com/cloudmgt/site/pages/user.jag",
"icon": "fa fa-users fw-3x", "icon": "fa fa-users fa-3x",
"dropDown": "true", "dropDown": "true",
"target": "_self" "target": "_self"
} }

@ -81,11 +81,25 @@ var operationModule = function () {
publicMethods.getControlOperations = function (deviceType) { publicMethods.getControlOperations = function (deviceType) {
var operations = privateMethods.getOperationsFromFeatures(deviceType, "operation"); var operations = privateMethods.getOperationsFromFeatures(deviceType, "operation");
var features = utility.getDeviceTypeConfig(deviceType).deviceType.features;
for (var op in operations) { for (var op in operations) {
var iconIdentifier = operations[op].operation; var iconIdentifier = operations[op].operation;
var icon = utility.getOperationIcon(deviceType, iconIdentifier); if (features && features[iconIdentifier]) {
var icon = features[iconIdentifier].icon;
if (icon) { if (icon) {
operations[op]["icon"] = icon; operations[op]["iconFont"] = icon;
} else if (iconPath) {
var iconPath = utility.getOperationIcon(deviceType, iconIdentifier);
operations[op]["icon"] = iconPath;
}
var formParams = features[iconIdentifier].formParams;
if (formParams) {
operations[op]["uiParams"] = formParams;
}
// var icon = utility.getOperationIcon(deviceType, iconIdentifier);
// if (icon) {
// log.error("icon found : " + icon );
// operations[op]["icon"] = icon;
} }
} }
return operations; return operations;

@ -288,6 +288,9 @@ function loadDevices(searchType, searchParam) {
case 'REMOVED' : case 'REMOVED' :
html = '<span><i class="fw fw-delete icon-danger"></i> Removed</span>'; html = '<span><i class="fw fw-delete icon-danger"></i> Removed</span>';
break; break;
case 'UNREACHABLE' :
html = '<span><i class="fw fw-warning icon-warning"></i> Unreachable</span>';
break;
} }
return html; return html;
} }
@ -461,11 +464,11 @@ function loadDevices(searchType, searchParam) {
attachDeviceEvents(); attachDeviceEvents();
if ($('.advance-search').length < 1) { // if ($('.advance-search').length < 1) {
$(this).closest('.dataTables_wrapper').find('div[id$=_filter] input') // $(this).closest('.dataTables_wrapper').find('div[id$=_filter] input')
.after('<a href="' + context + '/devices/search"' + // .after('<a href="' + context + '/devices/search"' +
' class="advance-search add-padding-3x">Advance Search</a>'); // ' class="advance-search add-padding-3x">Advance Search</a>');
} // }
}, { }, {
"placeholder": "Search By Device Name", "placeholder": "Search By Device Name",

@ -1,7 +1,7 @@
{{#zone "content"}} {{#zone "content"}}
{{#if isAuthorized}} {{#if isAuthorized}}
<span id="logged-in-user" class="hidden" data-username="{{user.username}}" data-domain="{{user.domain}}" <span id="logged-in-user" class="hidden" data-username="{{user.username}}" data-domain="{{user.domain}}"
data-tenant-id="{{user.tenantId}}"></span> data-tenant-id="{{user.tenantId}}" data-iscloud="{{isCloud}}"></span>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">

@ -74,6 +74,8 @@ function onRequest(context) {
types["roles"] = roles["content"]; types["roles"] = roles["content"];
} }
types["groups"] = groupModule.getGroups(); types["groups"] = groupModule.getGroups();
var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
types["isCloud"] = devicemgtProps.isCloud;
return types; return types;
} }

@ -146,7 +146,7 @@ stepForwardFrom["policy-platform"] = function (actionButton) {
if (policyOperationsTemplateSrc) { if (policyOperationsTemplateSrc) {
$.template(policyOperationsTemplateCacheKey, context + policyOperationsTemplateSrc, function (template) { $.template(policyOperationsTemplateCacheKey, context + policyOperationsTemplateSrc, function (template) {
var content = template(); var content = template({"iscloud" : $("#logged-in-user").data("iscloud")});
$("#device-type-policy-operations").html(content).removeClass("hidden"); $("#device-type-policy-operations").html(content).removeClass("hidden");
$(".policy-platform").addClass("hidden"); $(".policy-platform").addClass("hidden");
}); });

Loading…
Cancel
Save