mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
added artifact deployment support through UI
This commit is contained in:
parent
0999bb70a0
commit
b7566f4e4a
@ -93,7 +93,7 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe
|
||||
String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain();
|
||||
APIList apiList = storeClient.getApis().apisGet(MAX_API_PER_TAG, 0, tenantDomain, "tag:" + tag
|
||||
, CONTENT_TYPE, null);
|
||||
if (apiList.getList() != null && apiList.getList().size() == 0) {
|
||||
if (apiList.getList() == null || apiList.getList().size() == 0) {
|
||||
apiList = storeClient.getApis().apisGet(MAX_API_PER_TAG, 0
|
||||
, MultitenantConstants.SUPER_TENANT_DOMAIN_NAME, "tag:" + tag, CONTENT_TYPE, null);
|
||||
}
|
||||
|
||||
@ -109,14 +109,11 @@ public class APIPublisherLifecycleListener implements LifecycleListener {
|
||||
} catch (UserStoreException e) {
|
||||
log.error("Error while retrieving tenant admin user for the tenant domain"
|
||||
+ PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(), e);
|
||||
} catch (Throwable e) {
|
||||
// This is done to stop tomcat failure if a webapp failed to publish apis.
|
||||
log.error("Failed to Publish api from " + servletContext.getContextPath(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//TODO : Need to implemented, to merge API Definitions in cases where implementation of an API Lies in two classes
|
||||
private List<APIResourceConfiguration> mergeAPIDefinitions(List<APIResourceConfiguration> inputList) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -281,6 +281,11 @@
|
||||
<groupId>javax.ws.rs</groupId>
|
||||
<artifactId>javax.ws.rs-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.commons</groupId>
|
||||
<artifactId>org.wso2.carbon.application.mgt.stub</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
@ -39,6 +39,7 @@ import org.wso2.carbon.device.mgt.jaxrs.service.impl.util.InputValidationExcepti
|
||||
import org.wso2.carbon.policy.mgt.common.PolicyMonitoringTaskException;
|
||||
import org.wso2.carbon.policy.mgt.core.PolicyManagerService;
|
||||
import org.wso2.carbon.policy.mgt.core.task.TaskScheduleService;
|
||||
import org.wso2.carbon.registry.core.service.RegistryService;
|
||||
import org.wso2.carbon.user.api.AuthorizationManager;
|
||||
import org.wso2.carbon.user.api.UserRealm;
|
||||
import org.wso2.carbon.user.api.UserStoreException;
|
||||
@ -155,6 +156,18 @@ public class DeviceMgtAPIUtils {
|
||||
return realmService;
|
||||
}
|
||||
|
||||
public static RegistryService getRegistryService() {
|
||||
RegistryService registryService;
|
||||
PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
|
||||
registryService = (RegistryService) ctx.getOSGiService(RegistryService.class, null);
|
||||
if (registryService == null) {
|
||||
String msg = "registry service has not initialized.";
|
||||
log.error(msg);
|
||||
throw new IllegalStateException(msg);
|
||||
}
|
||||
return registryService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getting the current tenant's user realm
|
||||
*/
|
||||
|
||||
@ -39,6 +39,8 @@
|
||||
<ref bean="groupManagementAdminService"/>
|
||||
<ref bean="applicationManagementAdminService"/>
|
||||
<ref bean="deviceTypeManagementAdminService"/>
|
||||
<ref bean="deviceTypeManagementAdminService"/>
|
||||
<ref bean="deviceTypePublisherAdminServiceImpl"/>
|
||||
<ref bean="swaggerResource"/>
|
||||
</jaxrs:serviceBeans>
|
||||
<jaxrs:providers>
|
||||
@ -80,7 +82,9 @@
|
||||
<bean id="userManagementAdminService" class="org.wso2.carbon.device.mgt.jaxrs.service.impl.admin.UserManagementAdminServiceImpl"/>
|
||||
<bean id="deviceTypeManagementAdminService" class="org.wso2.carbon.device.mgt.jaxrs.service.impl.DeviceTypeManagementServiceImpl"/>
|
||||
<bean id="deviceAccessAuthorizationAdminService" class="org.wso2.carbon.device.mgt.jaxrs.service.impl.admin.DeviceAccessAuthorizationAdminServiceImpl"/>
|
||||
<bean id="jsonProvider" class="org.wso2.carbon.device.mgt.jaxrs.common.GsonMessageBodyHandler"/>
|
||||
<bean id="deviceTypePublisherAdminServiceImpl" class="org.wso2.carbon.device.mgt.jaxrs.service.impl.admin.DeviceTypePublisherAdminServiceImpl"/>
|
||||
|
||||
<bean id="jsonProvider" class="org.wso2.carbon.device.mgt.jaxrs.common.GsonMessageBodyHandler"/>
|
||||
|
||||
<!--<bean id="errorHandler" class="org.wso2.carbon.device.mgt.jaxrs.common.ErrorHandler"/>-->
|
||||
<cxf:bus>
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
"issuer" : "devicemgt",
|
||||
"appName" : "devicemgt",
|
||||
"identityProviderUrl" : "https://%iot.keymanager.host%:%iot.keymanager.https.port%/samlsso",
|
||||
"acs": "https://%iot.keymanager.host%:%iot.keymanager.https.port%/devicemgt/uuf/sso/acs",
|
||||
"acs": "https://%iot.manager.host%:%iot.manager.https.port%/devicemgt/uuf/sso/acs",
|
||||
"identityAlias": "wso2carbon",
|
||||
"responseSigningEnabled" : true,
|
||||
"validateAssertionValidityPeriod": true,
|
||||
|
||||
@ -175,7 +175,8 @@
|
||||
"perm:ios:remove-profile",
|
||||
"perm:ios:get-restrictions",
|
||||
"perm:ios:wipe-data",
|
||||
"perm:admin"
|
||||
"perm:admin",
|
||||
"perm:devicetype:deployment"
|
||||
],
|
||||
"isOAuthEnabled" : true,
|
||||
"backendRestEndpoints" : {
|
||||
|
||||
@ -32,9 +32,29 @@
|
||||
{{/if}}
|
||||
{{#if permissions.VIEW_DASHBOARD}}
|
||||
<li>
|
||||
<a href="/portal/t/{{currentUser.domain}}/dashboards/device-statistics-dashboard/">
|
||||
<a href="javascript:statisticLoad('/portal/t/{{currentUser.domain}}/dashboards/device-statistics-dashboard/')">
|
||||
<i class="fw fw-bar-chart"></i>Device Statistics
|
||||
</a>
|
||||
<div id="statistic-response-template" style="display: none">
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-6 col-centered">
|
||||
<h3>
|
||||
<span class="fw-stack">
|
||||
<i class="fw fw-circle-outline fw-stack-2x"></i>
|
||||
<i id="status-icon" class="fw fw-error fw-stack-1x"></i>
|
||||
</span>
|
||||
<br>
|
||||
</h3>
|
||||
<h4>
|
||||
<span id="title"></span>
|
||||
<br>
|
||||
</h4>
|
||||
<span id="description"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{{/if}}
|
||||
{{#if permissions.LIST_GROUPS}}
|
||||
|
||||
@ -20,7 +20,7 @@ var modalPopup = ".modal";
|
||||
var modalPopupContainer = modalPopup + " .modal-content";
|
||||
var modalPopupContent = modalPopup + " .modal-content";
|
||||
|
||||
var emmAdminBasePath = "/api/device-mgt/v1.0";
|
||||
var backendEndBasePath = "/api/device-mgt/v1.0";
|
||||
|
||||
/*
|
||||
* set popup maximum height function.
|
||||
@ -66,7 +66,7 @@ var updateNotificationCount = function (data, textStatus, jqXHR) {
|
||||
|
||||
function loadNotificationsPanel() {
|
||||
if ("true" == $("#right-sidebar").attr("is-authorized")) {
|
||||
var serviceURL = emmAdminBasePath + "/notifications?status=NEW";
|
||||
var serviceURL = backendEndBasePath + "/notifications?status=NEW";
|
||||
invokerUtil.get(serviceURL, updateNotificationCount, hideNotificationCount);
|
||||
loadNewNotifications();
|
||||
} else {
|
||||
@ -90,7 +90,7 @@ function loadNewNotifications() {
|
||||
var currentUser = notifications.data("currentUser");
|
||||
|
||||
$.template("notification-listing", notifications.attr("src"), function (template) {
|
||||
var serviceURL = emmAdminBasePath + "/notifications?status=NEW";
|
||||
var serviceURL = backendEndBasePath + "/notifications?status=NEW";
|
||||
|
||||
var successCallback = function (data, textStatus, jqXHR) {
|
||||
if (jqXHR.status == 200 && data) {
|
||||
@ -453,3 +453,44 @@ $(document).ready(function () {
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function statisticLoad(redirectUrl) {
|
||||
var contentType = "application/json";
|
||||
|
||||
var uri = backendEndBasePath + "/admin/devicetype/deploy/device_management/status";
|
||||
var defaultStatusClasses = "fw fw-stack-1x";
|
||||
var content = $("#statistic-response-template").find(".content");
|
||||
var title = content.find("#title");
|
||||
var statusIcon = content.find("#status-icon");
|
||||
|
||||
invokerUtil.get(uri, function (data, textStatus, jqXHR) {
|
||||
if (jqXHR.status == 204) {
|
||||
var urix = backendEndBasePath + "/admin/devicetype/deploy/device_management";
|
||||
var device = {};
|
||||
invokerUtil.post(urix, device, function (data) {
|
||||
title.html("Deploying statistic artifacts. Please wait...");
|
||||
statusIcon.attr("class", defaultStatusClasses + " fw-check");
|
||||
$(modalPopupContent).html(content.html());
|
||||
showPopup();
|
||||
setTimeout(function () {
|
||||
hidePopup();
|
||||
// location.reload(true);
|
||||
location.href = redirectUrl;
|
||||
}, 20000);
|
||||
|
||||
}, function (jqXHR) {
|
||||
title.html("Failed to deploy artifacts, Please contact administrator.");
|
||||
statusIcon.attr("class", defaultStatusClasses + " fw-error");
|
||||
$(modalPopupContent).html(content.html());
|
||||
showPopup();
|
||||
}, contentType);
|
||||
} else {
|
||||
location.href = redirectUrl;
|
||||
}
|
||||
}, function (jqXHR) {
|
||||
title.html("Failed to connect with server, Please contact administrator.");
|
||||
statusIcon.attr("class", defaultStatusClasses + " fw-error");
|
||||
$(modalPopupContent).html(content.html());
|
||||
showPopup();
|
||||
}, contentType);
|
||||
}
|
||||
|
||||
5
pom.xml
5
pom.xml
@ -1161,6 +1161,11 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.commons</groupId>
|
||||
<artifactId>org.wso2.carbon.application.mgt.stub</artifactId>
|
||||
<version>${carbon.commons.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.wso2.orbit.org.bouncycastle</groupId>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user