Merge remote-tracking branch 'upstream/master'

revert-70aa11f8
Megala 8 years ago
commit f9204add08

@ -1,81 +1,118 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.wso2.carbon.device.mgt.jaxrs.service.api;
import io.swagger.annotations.Api;
import org.wso2.carbon.apimgt.annotations.api.API;
import org.wso2.carbon.apimgt.annotations.api.Permission;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.QueryParam;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
//@Path("/dashboard")
//@Api(value = "Dashboard", description = "Dashboard related operations are described here.")
/**
* Device Analytics Dashboard related REST-APIs. This can be used to obtain device related analytics.
*/
@API(name = "Device Analytics Dashboard",
version = "1.0.0", context = "/api/device-mgt/v1.0/dashboard", tags = {"devicemgt_admin"})
@Path("/dashboard")
@Api(value = "Device Analytics Dashboard",
description = "Device Analytics Dashboard related information APIs are described here.")
@Produces(MediaType.APPLICATION_JSON)
@SuppressWarnings("NonJaxWsWebServices")
public interface Dashboard {
// String CONNECTIVITY_STATUS = "connectivity-status";
// String POTENTIAL_VULNERABILITY = "potential-vulnerability";
// String NON_COMPLIANT_FEATURE_CODE = "non-compliant-feature-code";
// String PLATFORM = "platform";
// String OWNERSHIP = "ownership";
// // Constants related to pagination
// String PAGINATION_ENABLED = "pagination-enabled";
// String START_INDEX = "start";
// String RESULT_COUNT = "length";
//
// @GET
// @Path("device-count-overview")
// Response getOverviewDeviceCounts();
//
// @GET
// @Path("device-counts-by-potential-vulnerabilities")
// Response getDeviceCountsByPotentialVulnerabilities();
//
// @GET
// @Path("non-compliant-device-counts-by-features")
// Response getNonCompliantDeviceCountsByFeatures(@QueryParam(START_INDEX) int startIndex,
// @QueryParam(RESULT_COUNT) int resultCount);
//
// @GET
// @Path("device-counts-by-groups")
// Response getDeviceCountsByGroups(@QueryParam(CONNECTIVITY_STATUS) String connectivityStatus,
// @QueryParam(POTENTIAL_VULNERABILITY) String potentialVulnerability,
// @QueryParam(PLATFORM) String platform,
// @QueryParam(OWNERSHIP) String ownership);
//
// @GET
// @Path("feature-non-compliant-device-counts-by-groups")
// Response getFeatureNonCompliantDeviceCountsByGroups(@QueryParam(NON_COMPLIANT_FEATURE_CODE) String nonCompliantFeatureCode,
// @QueryParam(PLATFORM) String platform,
// @QueryParam(OWNERSHIP) String ownership);
// @GET
// @Path("filtered-device-count-over-total")
// Response getFilteredDeviceCountOverTotal(@QueryParam(CONNECTIVITY_STATUS) String connectivityStatus,
// @QueryParam(POTENTIAL_VULNERABILITY) String potentialVulnerability,
// @QueryParam(PLATFORM) String platform,
// @QueryParam(OWNERSHIP) String ownership);
//
// @GET
// @Path("feature-non-compliant-device-count-over-total")
// Response getFeatureNonCompliantDeviceCountOverTotal(@QueryParam(NON_COMPLIANT_FEATURE_CODE) String nonCompliantFeatureCode,
// @QueryParam(PLATFORM) String platform,
// @QueryParam(OWNERSHIP) String ownership);
//
// @GET
// @Path("devices-with-details")
// Response getDevicesWithDetails(@QueryParam(CONNECTIVITY_STATUS) String connectivityStatus,
// @QueryParam(POTENTIAL_VULNERABILITY) String potentialVulnerability,
// @QueryParam(PLATFORM) String platform,
// @QueryParam(OWNERSHIP) String ownership,
// @QueryParam(PAGINATION_ENABLED) String paginationEnabled,
// @QueryParam(START_INDEX) int startIndex,
// @QueryParam(RESULT_COUNT) int resultCount);
//
// @GET
// @Path("feature-non-compliant-devices-with-details")
// Response getFeatureNonCompliantDevicesWithDetails(@QueryParam(NON_COMPLIANT_FEATURE_CODE) String nonCompliantFeatureCode,
// @QueryParam(PLATFORM) String platform,
// @QueryParam(OWNERSHIP) String ownership,
// @QueryParam(PAGINATION_ENABLED) String paginationEnabled,
// @QueryParam(START_INDEX) int startIndex,
// @QueryParam(RESULT_COUNT) int resultCount);
String CONNECTIVITY_STATUS = "connectivity-status";
String POTENTIAL_VULNERABILITY = "potential-vulnerability";
String NON_COMPLIANT_FEATURE_CODE = "non-compliant-feature-code";
String PLATFORM = "platform";
String OWNERSHIP = "ownership";
// Constants related to pagination
String PAGINATION_ENABLED = "pagination-enabled";
String START_INDEX = "start";
String RESULT_COUNT = "length";
@GET
@Path("device-count-overview")
@Permission(name = "View Dashboard", permission = "/device-mgt/dashboard/view")
Response getOverviewDeviceCounts();
@GET
@Path("device-counts-by-potential-vulnerabilities")
@Permission(name = "View Dashboard", permission = "/device-mgt/dashboard/view")
Response getDeviceCountsByPotentialVulnerabilities();
@GET
@Path("non-compliant-device-counts-by-features")
@Permission(name = "View Dashboard", permission = "/device-mgt/dashboard/view")
Response getNonCompliantDeviceCountsByFeatures(@QueryParam(START_INDEX) int startIndex,
@QueryParam(RESULT_COUNT) int resultCount);
@GET
@Path("device-counts-by-groups")
@Permission(name = "View Dashboard", permission = "/device-mgt/dashboard/view")
Response getDeviceCountsByGroups(@QueryParam(CONNECTIVITY_STATUS) String connectivityStatus,
@QueryParam(POTENTIAL_VULNERABILITY) String potentialVulnerability,
@QueryParam(PLATFORM) String platform,
@QueryParam(OWNERSHIP) String ownership);
@GET
@Path("feature-non-compliant-device-counts-by-groups")
@Permission(name = "View Dashboard", permission = "/device-mgt/dashboard/view")
Response getFeatureNonCompliantDeviceCountsByGroups(@QueryParam(NON_COMPLIANT_FEATURE_CODE) String nonCompliantFeatureCode,
@QueryParam(PLATFORM) String platform,
@QueryParam(OWNERSHIP) String ownership);
@GET
@Path("filtered-device-count-over-total")
@Permission(name = "View Dashboard", permission = "/device-mgt/dashboard/view")
Response getFilteredDeviceCountOverTotal(@QueryParam(CONNECTIVITY_STATUS) String connectivityStatus,
@QueryParam(POTENTIAL_VULNERABILITY) String potentialVulnerability,
@QueryParam(PLATFORM) String platform,
@QueryParam(OWNERSHIP) String ownership);
@GET
@Path("feature-non-compliant-device-count-over-total")
@Permission(name = "View Dashboard", permission = "/device-mgt/dashboard/view")
Response getFeatureNonCompliantDeviceCountOverTotal(@QueryParam(NON_COMPLIANT_FEATURE_CODE) String nonCompliantFeatureCode,
@QueryParam(PLATFORM) String platform,
@QueryParam(OWNERSHIP) String ownership);
@GET
@Path("devices-with-details")
@Permission(name = "View Dashboard", permission = "/device-mgt/dashboard/view")
Response getDevicesWithDetails(@QueryParam(CONNECTIVITY_STATUS) String connectivityStatus,
@QueryParam(POTENTIAL_VULNERABILITY) String potentialVulnerability,
@QueryParam(PLATFORM) String platform,
@QueryParam(OWNERSHIP) String ownership,
@QueryParam(PAGINATION_ENABLED) String paginationEnabled,
@QueryParam(START_INDEX) int startIndex,
@QueryParam(RESULT_COUNT) int resultCount);
@GET
@Path("feature-non-compliant-devices-with-details")
@Permission(name = "View Dashboard", permission = "/device-mgt/dashboard/view")
Response getFeatureNonCompliantDevicesWithDetails(@QueryParam(NON_COMPLIANT_FEATURE_CODE) String nonCompliantFeatureCode,
@QueryParam(PLATFORM) String platform,
@QueryParam(OWNERSHIP) String ownership,
@QueryParam(PAGINATION_ENABLED) String paginationEnabled,
@QueryParam(START_INDEX) int startIndex,
@QueryParam(RESULT_COUNT) int resultCount);
}

@ -51,7 +51,12 @@ if (uriMatcher.match("/{context}/api/operation/paginate")) {
} else {
response["status"] = restAPIResponse["status"];
if (restAPIResponse["responseText"]) {
response["content"] = parse(restAPIResponse["responseText"]);
var responseText = "";
try {
response["content"] = parse(restAPIResponse["responseText"]);
} catch (e) {
responseText = restAPIResponse["responseText"];
}
}
}
}

@ -45,12 +45,13 @@ var invokers = function () {
* If the token pair is not set in the session, this will return null.
*/
privateMethods.getAccessToken = function () {
var tokenPair = session.get(constants["TOKEN_PAIR"]);
if (tokenPair) {
return parse(tokenPair)["accessToken"];
} else {
return null;
if (session) {
var tokenPair = session.get(constants["TOKEN_PAIR"]);
if (tokenPair) {
return parse(tokenPair)["accessToken"];
}
}
return null;
};
/**
@ -80,7 +81,7 @@ var invokers = function () {
if (devicemgtProps["isOAuthEnabled"]) {
var accessToken = privateMethods.getAccessToken();
if (!accessToken) {
if (accessToken == null) {
userModule.logout(function () {
response.sendRedirect(devicemgtProps["appContext"] + "login");
});

@ -35,16 +35,26 @@
<div class="row no-gutter">
<div class="wr-hidden-operations-nav col-lg-4">
<a id="generalConfigLink" href="javascript:void(0)" onclick="showAdvanceOperation('general', this)" class="selected">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-settings fw-stack-2x"></i>
</span>
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-settings fw-stack-2x"></i>
<span class="fw-stack fw-move-right fw-move-bottom">
<i class="fw fw-circle fw-stack-2x fw-stroke fw-inverse"></i>
<i class="fw fw-circle fw-stack-2x"></i>
<i class="fw fw-mobile fw-stack-1x fw-inverse"></i>
</span>
</span>
General Configurations
</a>
{{#each deviceTypes}}
<a id="{{name}}ConfigLink" href="javascript:void(0)" onclick="showAdvanceOperation('{{name}}', this)">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-settings fw-stack-2x"></i>
</span>
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-settings fw-stack-2x"></i>
<span class="fw-stack fw-move-right fw-move-bottom">
<i class="fw fw-circle fw-stack-2x fw-stroke fw-inverse"></i>
<i class="fw fw-circle fw-stack-2x"></i>
<i class="fw fw-{{name}} fw-stack-1x fw-inverse"></i>
</span>
</span>
{{label}} Configurations
</a>
{{/each}}
@ -79,9 +89,7 @@
placeholder="[ Required Field ]">
</div>
<div class="wr-input-control wr-btn-grp">
<button id="save-general-btn" class="wr-btn">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Save&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</button>
<button id="save-general-btn" class="wr-btn">Save</button>
</div>
</div>
</div>
@ -107,12 +115,8 @@
<b>"Exit"</b> to complete the process and go back to the dashboard.
<hr/>
<button class="wr-btn"
onclick="window.location.href='{{@app.context}}/platform-configuration'">Go
back
to
configurations
</button>
<button class="wr-btn" onclick="window.location.href='{{@app.context}}'">&nbsp;&nbsp;&nbsp;&nbsp;Exit&nbsp;&nbsp;&nbsp;&nbsp;</button>
onclick="window.location.href='{{@app.context}}/platform-configuration'">Go back to configurations</button>
<button class="wr-btn" onclick="window.location.href='{{@app.context}}'">Exit</button>
</div>
</div>
<!-- /content -->

@ -16,10 +16,6 @@
* under the License.
*/
.wr-content {
padding-left: 33px;
padding-right: 33px;
}
.wr-input-control .helper {
font-weight: 100;

@ -167,7 +167,7 @@ pre {
position: absolute;
right: 0;
height: 10000px;
width: 60px;
width: 20px;
}
body.inverse .fade-edge:after {
@ -181,7 +181,7 @@ body.inverse .fade-edge:after {
position: absolute;
right: 0;
height: 10000px;
width: 60px;
width: 20px;
}
.visible-block {
@ -4552,6 +4552,15 @@ a.wr-side-panel-toggle-btn.selected {
background: #f4f4f4;
}
.wr-advance-operations .wr-hidden-operations-nav a.selected span span > i{
color: #526A84;
}
.wr-advance-operations .wr-hidden-operations-nav a.selected span span > i.fw.fw-circle.fw-stack-2x{
color: #fff;
}
.wr-advance-operations .wr-hidden-operations-nav a.selected span span > i.fw.fw-circle.fw-stack-2x.fw-stroke.fw-inverse{
color: #526A84;
}
.wr-advance-operations .wr-hidden-operations-nav a.selected, .wr-hidden-operations .wr-hidden-operations-nav a.selected:hover {
color: #ffffff;
background: #526A84;
@ -5515,7 +5524,7 @@ ul.listing li.grouped-input ul.grouped-child-input.disabled {
position: absolute;
right: 0;
height: 10000px;
width: 60px;
width: 20px;
}
body.inverse .fade-edge:after {
content: "";
@ -5528,7 +5537,7 @@ body.inverse .fade-edge:after {
position: absolute;
right: 0;
height: 10000px;
width: 60px;
width: 20px;
}
/* ========================================================================
@ -5752,7 +5761,7 @@ body.inverse .fade-edge:after {
position: absolute;
right: 0;
height: 10000px;
width: 60px;
width: 20px;
}
.table.table-selectable > tbody > tr:hover {
cursor: pointer;
@ -6495,3 +6504,6 @@ select > option:hover {
/*background:url('http://cdn-sg1.pgimgs.com/images/pg/close-button.png') no-repeat center center;*/
}
.label-bold{
font-weight:400;
}

Loading…
Cancel
Save