Merge branch 'application-mgt-new' of gitlab.com:entgra/carbon-device-mgt into application-mgt-new

feature/appm-store/pbac
lasanthaDLPDS 5 years ago
commit b5a86d8e79

@ -562,13 +562,13 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
@Override @Override
public boolean updateApplication(ApplicationDTO applicationDTO, int tenantId) public boolean updateApplication(ApplicationDTO applicationDTO, int tenantId)
throws ApplicationManagementDAOException { throws ApplicationManagementDAOException {
String sql = "UPDATE AP_APP AP " + String sql = "UPDATE AP_APP " +
"SET " + "SET " +
"AP.NAME = ?, " + "NAME = ?, " +
"AP.DESCRIPTION = ?, " + "DESCRIPTION = ?, " +
"AP.SUB_TYPE = ?, " + "SUB_TYPE = ?, " +
"AP.CURRENCY = ? " + "CURRENCY = ? " +
"WHERE AP.ID = ? AND AP.TENANT_ID = ?"; "WHERE ID = ? AND TENANT_ID = ?";
try { try {
Connection conn = this.getDBConnection(); Connection conn = this.getDBConnection();
try (PreparedStatement stmt = conn.prepareStatement(sql)) { try (PreparedStatement stmt = conn.prepareStatement(sql)) {
@ -594,12 +594,12 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
@Override @Override
public void updateApplicationRating(String uuid, double rating, int tenantId) public void updateApplicationRating(String uuid, double rating, int tenantId)
throws ApplicationManagementDAOException { throws ApplicationManagementDAOException {
String sql = "UPDATE AP_APP AP " + String sql = "UPDATE AP_APP " +
"SET " + "SET " +
"AP.RATING = ? " + "RATING = ? " +
"WHERE " + "WHERE " +
"AP.ID = (SELECT AP_APP_ID FROM AP_APP_RELEASE WHERE UUID = ?) AND " + "ID = (SELECT AP_APP_ID FROM AP_APP_RELEASE WHERE UUID = ?) AND " +
"AP.TENANT_ID = ?"; "TENANT_ID = ?";
try { try {
Connection conn = this.getDBConnection(); Connection conn = this.getDBConnection();
try (PreparedStatement stmt = conn.prepareStatement(sql)) { try (PreparedStatement stmt = conn.prepareStatement(sql)) {
@ -1013,11 +1013,11 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
log.debug("Request received in DAO Layer to update a category."); log.debug("Request received in DAO Layer to update a category.");
} }
String sql = "UPDATE " + String sql = "UPDATE " +
"AP_APP_CATEGORY cat " + "AP_APP_CATEGORY " +
"SET cat.CATEGORY = ? " + "SET CATEGORY = ? " +
"WHERE " + "WHERE " +
"cat.ID = ? AND " + "ID = ? AND " +
"cat.TENANT_ID = ?"; "TENANT_ID = ?";
try { try {
Connection conn = this.getDBConnection(); Connection conn = this.getDBConnection();
try (PreparedStatement stmt = conn.prepareStatement(sql)) { try (PreparedStatement stmt = conn.prepareStatement(sql)) {
@ -1444,11 +1444,11 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
log.debug("Request received in DAO Layer to update a Tag."); log.debug("Request received in DAO Layer to update a Tag.");
} }
String sql = "UPDATE " + String sql = "UPDATE " +
"AP_APP_TAG tag " + "AP_APP_TAG " +
"SET tag.TAG = ? " + "SET TAG = ? " +
"WHERE " + "WHERE " +
"tag.ID = ? AND " + "ID = ? AND " +
"tag.TENANT_ID = ?"; "TENANT_ID = ?";
try { try {
Connection conn = this.getDBConnection(); Connection conn = this.getDBConnection();
try (PreparedStatement stmt = conn.prepareStatement(sql)) { try (PreparedStatement stmt = conn.prepareStatement(sql)) {

@ -107,13 +107,15 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
public void updateDeviceSubscription(String updateBy, List<Integer> deviceIds, public void updateDeviceSubscription(String updateBy, List<Integer> deviceIds,
String action, String actionTriggeredFrom, String installStatus, int releaseId, int tenantId) String action, String actionTriggeredFrom, String installStatus, int releaseId, int tenantId)
throws ApplicationManagementDAOException { throws ApplicationManagementDAOException {
boolean unsubscribed = false;
try { try {
String sql = "UPDATE AP_DEVICE_SUBSCRIPTION SET "; String sql = "UPDATE AP_DEVICE_SUBSCRIPTION SET ";
if (SubAction.UNINSTALL.toString().equalsIgnoreCase(action)) { if (SubAction.UNINSTALL.toString().equalsIgnoreCase(action)) {
sql += "UNSUBSCRIBED = true, UNSUBSCRIBED_BY = ?, UNSUBSCRIBED_TIMESTAMP = ?, "; sql += "UNSUBSCRIBED = ?, UNSUBSCRIBED_BY = ?, UNSUBSCRIBED_TIMESTAMP = ?, ";
unsubscribed = true;
} else if (SubAction.INSTALL.toString().equalsIgnoreCase(action)) { } else if (SubAction.INSTALL.toString().equalsIgnoreCase(action)) {
sql += "UNSUBSCRIBED = false, SUBSCRIBED_BY = ?, SUBSCRIBED_TIMESTAMP = ?, "; sql += "UNSUBSCRIBED = ?, SUBSCRIBED_BY = ?, SUBSCRIBED_TIMESTAMP = ?, ";
} else { } else {
String msg = "Found invalid action " + action + ". Hence can't construct the query."; String msg = "Found invalid action " + action + ". Hence can't construct the query.";
log.error(msg); log.error(msg);
@ -131,13 +133,14 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
Timestamp timestamp = new Timestamp(calendar.getTime().getTime()); Timestamp timestamp = new Timestamp(calendar.getTime().getTime());
for (Integer deviceId : deviceIds) { for (Integer deviceId : deviceIds) {
stmt.setString(1, updateBy); stmt.setBoolean(1, unsubscribed);
stmt.setTimestamp(2, timestamp); stmt.setString(2, updateBy);
stmt.setString(3, actionTriggeredFrom); stmt.setTimestamp(3, timestamp);
stmt.setString(4, installStatus); stmt.setString(4, actionTriggeredFrom);
stmt.setInt(5, deviceId); stmt.setString(5, installStatus);
stmt.setInt(6, releaseId); stmt.setInt(6, deviceId);
stmt.setInt(7, tenantId); stmt.setInt(7, releaseId);
stmt.setInt(8, tenantId);
stmt.addBatch(); stmt.addBatch();
} }
stmt.executeBatch(); stmt.executeBatch();
@ -433,7 +436,7 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
int index = 1; int index = 1;
List<String> subscribedUsers = new ArrayList<>(); List<String> subscribedUsers = new ArrayList<>();
StringJoiner joiner = new StringJoiner(",", StringJoiner joiner = new StringJoiner(",",
"SELECT US.USER_NAME AS USER " "SELECT US.USER_NAME AS USER_NAME "
+ "FROM AP_USER_SUBSCRIPTION US " + "FROM AP_USER_SUBSCRIPTION US "
+ "WHERE US.USER_NAME IN (", ") AND TENANT_ID = ?"); + "WHERE US.USER_NAME IN (", ") AND TENANT_ID = ?");
users.stream().map(ignored -> "?").forEach(joiner::add); users.stream().map(ignored -> "?").forEach(joiner::add);
@ -445,7 +448,7 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
ps.setInt(index, tenantId); ps.setInt(index, tenantId);
try (ResultSet rs = ps.executeQuery()) { try (ResultSet rs = ps.executeQuery()) {
while (rs.next()) { while (rs.next()) {
subscribedUsers.add(rs.getString("USER")); subscribedUsers.add(rs.getString("USER_NAME"));
} }
} }
} }
@ -513,7 +516,7 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
int index = 1; int index = 1;
List<String> subscribedUsers = new ArrayList<>(); List<String> subscribedUsers = new ArrayList<>();
StringJoiner joiner = new StringJoiner(",", StringJoiner joiner = new StringJoiner(",",
"SELECT GS.GROUP_NAME AS GROUP " "SELECT GS.GROUP_NAME AS GROUP_NAME "
+ "FROM AP_GROUP_SUBSCRIPTION GS " + "FROM AP_GROUP_SUBSCRIPTION GS "
+ "WHERE GS.GROUP_NAME IN (", ") AND TENANT_ID = ?"); + "WHERE GS.GROUP_NAME IN (", ") AND TENANT_ID = ?");
groups.stream().map(ignored -> "?").forEach(joiner::add); groups.stream().map(ignored -> "?").forEach(joiner::add);
@ -525,7 +528,7 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
ps.setInt(index, tenantId); ps.setInt(index, tenantId);
try (ResultSet rs = ps.executeQuery()) { try (ResultSet rs = ps.executeQuery()) {
while (rs.next()) { while (rs.next()) {
subscribedUsers.add(rs.getString("GROUP")); subscribedUsers.add(rs.getString("GROUP_NAME"));
} }
} }
} }
@ -554,7 +557,7 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
int index = 1; int index = 1;
List<Integer> subscribedDevices = new ArrayList<>(); List<Integer> subscribedDevices = new ArrayList<>();
StringJoiner joiner = new StringJoiner(",", StringJoiner joiner = new StringJoiner(",",
"SELECT DS.ID " "SELECT DS.ID AS DEVICE_SUBSCRIPTION_ID "
+ "FROM AP_DEVICE_SUBSCRIPTION DS " + "FROM AP_DEVICE_SUBSCRIPTION DS "
+ "WHERE DS.DM_DEVICE_ID IN (", ") AND AP_APP_RELEASE_ID = ? AND TENANT_ID = ?"); + "WHERE DS.DM_DEVICE_ID IN (", ") AND AP_APP_RELEASE_ID = ? AND TENANT_ID = ?");
deviceIds.stream().map(ignored -> "?").forEach(joiner::add); deviceIds.stream().map(ignored -> "?").forEach(joiner::add);
@ -567,7 +570,7 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
ps.setInt(index, tenantId); ps.setInt(index, tenantId);
try (ResultSet rs = ps.executeQuery()) { try (ResultSet rs = ps.executeQuery()) {
while (rs.next()) { while (rs.next()) {
subscribedDevices.add(rs.getInt("DM_DEVICE_ID")); subscribedDevices.add(rs.getInt("DEVICE_SUBSCRIPTION_ID"));
} }
} }
} }
@ -589,6 +592,7 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
String subType, String action) throws ApplicationManagementDAOException { String subType, String action) throws ApplicationManagementDAOException {
try { try {
Connection conn = this.getDBConnection(); Connection conn = this.getDBConnection();
boolean isUnsubscribed = false;
String sql = "UPDATE "; String sql = "UPDATE ";
if (SubscriptionType.USER.toString().equalsIgnoreCase(subType)) { if (SubscriptionType.USER.toString().equalsIgnoreCase(subType)) {
sql += "AP_USER_SUBSCRIPTION SET "; sql += "AP_USER_SUBSCRIPTION SET ";
@ -599,9 +603,10 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
} }
if (SubAction.UNINSTALL.toString().equalsIgnoreCase(action)) { if (SubAction.UNINSTALL.toString().equalsIgnoreCase(action)) {
sql += "UNSUBSCRIBED = true, UNSUBSCRIBED_BY = ?, UNSUBSCRIBED_TIMESTAMP = ? "; sql += "UNSUBSCRIBED = ?, UNSUBSCRIBED_BY = ?, UNSUBSCRIBED_TIMESTAMP = ? ";
isUnsubscribed = true;
} else { } else {
sql += "UNSUBSCRIBED = false, SUBSCRIBED_BY = ?, SUBSCRIBED_TIMESTAMP = ? "; sql += "UNSUBSCRIBED = ?, SUBSCRIBED_BY = ?, SUBSCRIBED_TIMESTAMP = ? ";
} }
if (SubscriptionType.USER.toString().equalsIgnoreCase(subType)) { if (SubscriptionType.USER.toString().equalsIgnoreCase(subType)) {
@ -618,11 +623,12 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
Timestamp timestamp = new Timestamp(calendar.getTime().getTime()); Timestamp timestamp = new Timestamp(calendar.getTime().getTime());
for (String username : paramList) { for (String username : paramList) {
stmt.setString(1, updateBy); stmt.setBoolean(1, isUnsubscribed);
stmt.setTimestamp(2, timestamp); stmt.setString(2, updateBy);
stmt.setString(3, username); stmt.setTimestamp(3, timestamp);
stmt.setInt(4, releaseId); stmt.setString(4, username);
stmt.setInt(5, tenantId); stmt.setInt(5, releaseId);
stmt.setInt(6, tenantId);
stmt.addBatch(); stmt.addBatch();
} }
stmt.executeBatch(); stmt.executeBatch();
@ -752,12 +758,12 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
@Override @Override
public boolean updateScheduledSubscription(int id, LocalDateTime scheduledAt, String scheduledBy) public boolean updateScheduledSubscription(int id, LocalDateTime scheduledAt, String scheduledBy)
throws ApplicationManagementDAOException { throws ApplicationManagementDAOException {
String sql = "UPDATE AP_SCHEDULED_SUBSCRIPTION AP " String sql = "UPDATE AP_SCHEDULED_SUBSCRIPTION "
+ "SET " + "SET "
+ "AP.SCHEDULED_AT = ?, " + "SCHEDULED_AT = ?, "
+ "AP.SCHEDULED_BY = ?, " + "SCHEDULED_BY = ?, "
+ "AP.SCHEDULED_TIMESTAMP = ? " + "SCHEDULED_TIMESTAMP = ? "
+ "WHERE AP.ID = ?"; + "WHERE ID = ?";
try { try {
Connection conn = this.getDBConnection(); Connection conn = this.getDBConnection();
try (PreparedStatement stmt = conn.prepareStatement(sql)) { try (PreparedStatement stmt = conn.prepareStatement(sql)) {
@ -783,9 +789,9 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
@Override @Override
public boolean deleteScheduledSubscription(List<Integer> subscriptionIdList) throws ApplicationManagementDAOException { public boolean deleteScheduledSubscription(List<Integer> subscriptionIdList) throws ApplicationManagementDAOException {
String sql = "UPDATE AP_SCHEDULED_SUBSCRIPTION AP " String sql = "UPDATE AP_SCHEDULED_SUBSCRIPTION "
+ "SET AP.DELETED = ? " + "SET DELETED = ? "
+ "WHERE AP.ID = ?"; + "WHERE ID = ?";
try { try {
Connection conn = this.getDBConnection(); Connection conn = this.getDBConnection();
try (PreparedStatement stmt = conn.prepareStatement(sql)) { try (PreparedStatement stmt = conn.prepareStatement(sql)) {
@ -813,9 +819,9 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
@Override @Override
public boolean updateScheduledSubscriptionStatus(int id, ExecutionStatus status) public boolean updateScheduledSubscriptionStatus(int id, ExecutionStatus status)
throws ApplicationManagementDAOException { throws ApplicationManagementDAOException {
String sql = "UPDATE AP_SCHEDULED_SUBSCRIPTION AP " String sql = "UPDATE AP_SCHEDULED_SUBSCRIPTION "
+ "SET AP.STATUS = ? " + "SET STATUS = ? "
+ "WHERE AP.ID = ?"; + "WHERE ID = ?";
try { try {
Connection conn = this.getDBConnection(); Connection conn = this.getDBConnection();
try (PreparedStatement stmt = conn.prepareStatement(sql)) { try (PreparedStatement stmt = conn.prepareStatement(sql)) {
@ -847,7 +853,7 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
Connection conn = this.getDBConnection(); Connection conn = this.getDBConnection();
List<String> subscribedUsers = new ArrayList<>(); List<String> subscribedUsers = new ArrayList<>();
String sql = "SELECT " String sql = "SELECT "
+ "US.USER_NAME AS USER " + "US.USER_NAME AS USER_NAME "
+ "FROM AP_USER_SUBSCRIPTION US " + "FROM AP_USER_SUBSCRIPTION US "
+ "WHERE " + "WHERE "
+ "AP_APP_RELEASE_ID = ? AND TENANT_ID = ? LIMIT ? OFFSET ?"; + "AP_APP_RELEASE_ID = ? AND TENANT_ID = ? LIMIT ? OFFSET ?";
@ -858,7 +864,7 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc
stmt.setInt(4, offsetValue); stmt.setInt(4, offsetValue);
try (ResultSet rs = stmt.executeQuery()) { try (ResultSet rs = stmt.executeQuery()) {
while (rs.next()) { while (rs.next()) {
subscribedUsers.add(rs.getString("USER")); subscribedUsers.add(rs.getString("USER_NAME"));
} }
} }
return subscribedUsers; return subscribedUsers;

@ -51,7 +51,7 @@ public class SQLServerSubscriptionDAOImpl extends GenericSubscriptionDAOImpl {
Connection conn = this.getDBConnection(); Connection conn = this.getDBConnection();
List<String> subscribedUsers = new ArrayList<>(); List<String> subscribedUsers = new ArrayList<>();
String sql = "SELECT " String sql = "SELECT "
+ "US.USER_NAME AS USER " + "US.USER_NAME AS USER_NAME "
+ "FROM AP_USER_SUBSCRIPTION US " + "FROM AP_USER_SUBSCRIPTION US "
+ "WHERE " + "WHERE "
+ "AP_APP_RELEASE_ID = ? AND TENANT_ID = ? ORDER BY US.ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; + "AP_APP_RELEASE_ID = ? AND TENANT_ID = ? ORDER BY US.ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY";
@ -62,7 +62,7 @@ public class SQLServerSubscriptionDAOImpl extends GenericSubscriptionDAOImpl {
stmt.setInt(4, limitValue); stmt.setInt(4, limitValue);
try (ResultSet rs = stmt.executeQuery()) { try (ResultSet rs = stmt.executeQuery()) {
while (rs.next()) { while (rs.next()) {
subscribedUsers.add(rs.getString("USER")); subscribedUsers.add(rs.getString("USER_NAME"));
} }
} }
return subscribedUsers; return subscribedUsers;

@ -17,7 +17,7 @@
*/ */
import React from "react"; import React from "react";
import {Divider, Row, Col, Typography, Button, Dropdown, notification, Menu, Icon} from "antd"; import {Divider, Row, Col, Typography, Button, Dropdown, notification, Menu, Icon, Spin} from "antd";
import "../../../App.css"; import "../../../App.css";
import ImgViewer from "../../apps/release/images/ImgViewer"; import ImgViewer from "../../apps/release/images/ImgViewer";
import StarRatings from "react-star-ratings"; import StarRatings from "react-star-ratings";
@ -126,17 +126,18 @@ class ReleaseView extends React.Component {
</Menu> </Menu>
); );
return ( return (
<div> <div>
<AppInstallModal <AppInstallModal
uuid={release.uuid} uuid={release.uuid}
loading={this.state.loading}
visible={this.state.appInstallModalVisible} visible={this.state.appInstallModalVisible}
deviceType={deviceType} deviceType={deviceType}
onClose={this.closeAppOperationModal} onClose={this.closeAppOperationModal}
onInstall={this.appOperation}/> onInstall={this.appOperation}/>
<AppUninstallModal <AppUninstallModal
uuid={release.uuid} uuid={release.uuid}
loading={this.state.loading}
visible={this.state.appUninstallModalVisible} visible={this.state.appUninstallModalVisible}
deviceType={deviceType} deviceType={deviceType}
onClose={this.closeAppOperationModal} onClose={this.closeAppOperationModal}

@ -17,7 +17,7 @@
*/ */
import React from "react"; import React from "react";
import {Modal, Tabs} from "antd"; import {Modal, Spin, Tabs} from "antd";
import UserInstall from "./UserInstall"; import UserInstall from "./UserInstall";
import GroupInstall from "./GroupInstall"; import GroupInstall from "./GroupInstall";
import RoleInstall from "./RoleInstall"; import RoleInstall from "./RoleInstall";
@ -29,6 +29,7 @@ class AppInstallModal extends React.Component{
state = { state = {
data: [] data: []
}; };
render() { render() {
const {deviceType} = this.props; const {deviceType} = this.props;
return ( return (
@ -37,8 +38,8 @@ class AppInstallModal extends React.Component{
title="Install App" title="Install App"
visible={this.props.visible} visible={this.props.visible}
onCancel={this.props.onClose} onCancel={this.props.onClose}
footer={null} footer={null}>
> <Spin spinning={this.props.loading}>
<Tabs defaultActiveKey="device"> <Tabs defaultActiveKey="device">
<TabPane tab="Device" key="device"> <TabPane tab="Device" key="device">
<DeviceInstall deviceType={deviceType} onInstall={this.props.onInstall}/> <DeviceInstall deviceType={deviceType} onInstall={this.props.onInstall}/>
@ -53,6 +54,7 @@ class AppInstallModal extends React.Component{
<GroupInstall onInstall={this.props.onInstall}/> <GroupInstall onInstall={this.props.onInstall}/>
</TabPane> </TabPane>
</Tabs> </Tabs>
</Spin>
</Modal> </Modal>
</div> </div>
); );

@ -16,7 +16,7 @@
* under the License. * under the License.
*/ */
import React from "react"; import React from "react";
import {Modal, Tabs} from "antd"; import {Modal, Spin, Tabs} from "antd";
import DeviceUninstall from "./DeviceUninstall"; import DeviceUninstall from "./DeviceUninstall";
import UserUninstall from "./UserUninstall"; import UserUninstall from "./UserUninstall";
import RoleUninstall from "./RoleUninstall"; import RoleUninstall from "./RoleUninstall";
@ -28,6 +28,7 @@ class AppUninstallModal extends React.Component{
state = { state = {
data: [] data: []
}; };
render() { render() {
const {deviceType} = this.props; const {deviceType} = this.props;
return ( return (
@ -36,11 +37,12 @@ class AppUninstallModal extends React.Component{
title="Uninstall App" title="Uninstall App"
visible={this.props.visible} visible={this.props.visible}
onCancel={this.props.onClose} onCancel={this.props.onClose}
footer={null} footer={null}>
> <Spin spinning={this.props.loading}>
<Tabs defaultActiveKey="device"> <Tabs defaultActiveKey="device">
<TabPane tab="Device" key="device"> <TabPane tab="Device" key="device">
<DeviceUninstall deviceType={deviceType} onUninstall={this.props.onUninstall} uuid={this.props.uuid}/> <DeviceUninstall deviceType={deviceType} onUninstall={this.props.onUninstall}
uuid={this.props.uuid}/>
</TabPane> </TabPane>
<TabPane tab="User" key="user"> <TabPane tab="User" key="user">
<UserUninstall onUninstall={this.props.onUninstall} uuid={this.props.uuid}/> <UserUninstall onUninstall={this.props.onUninstall} uuid={this.props.uuid}/>
@ -52,6 +54,7 @@ class AppUninstallModal extends React.Component{
<GroupUninstall onUninstall={this.props.onUninstall} uuid={this.props.uuid}/> <GroupUninstall onUninstall={this.props.onUninstall} uuid={this.props.uuid}/>
</TabPane> </TabPane>
</Tabs> </Tabs>
</Spin>
</Modal> </Modal>
</div> </div>
); );

@ -787,8 +787,8 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
" e1.DATE_OF_ENROLMENT, d.DESCRIPTION, d.NAME AS DEVICE_NAME, d.DEVICE_IDENTIFICATION, t.NAME " + " e1.DATE_OF_ENROLMENT, d.DESCRIPTION, d.NAME AS DEVICE_NAME, d.DEVICE_IDENTIFICATION, t.NAME " +
"AS DEVICE_TYPE FROM DM_DEVICE d, (SELECT e.OWNER, e.OWNERSHIP, e.ID AS ENROLMENT_ID, " + "AS DEVICE_TYPE FROM DM_DEVICE d, (SELECT e.OWNER, e.OWNERSHIP, e.ID AS ENROLMENT_ID, " +
"e.DEVICE_ID, e.STATUS, e.DATE_OF_LAST_UPDATE, e.DATE_OF_ENROLMENT FROM DM_ENROLMENT e WHERE " + "e.DEVICE_ID, e.STATUS, e.DATE_OF_LAST_UPDATE, e.DATE_OF_ENROLMENT FROM DM_ENROLMENT e WHERE " +
"e.TENANT_ID = ? AND LOWER(e.OWNER) = LOWER(?) ORDER BY e.DATE_OF_LAST_UPDATE DESC) e1, DM_DEVICE_TYPE t WHERE d.ID = e1.DEVICE_ID " + "e.TENANT_ID = ? AND LOWER(e.OWNER) = LOWER(?)) e1, DM_DEVICE_TYPE t WHERE d.ID = e1.DEVICE_ID " +
"AND t.ID = d.DEVICE_TYPE_ID"; "AND t.ID = d.DEVICE_TYPE_ID ORDER BY e1.DATE_OF_LAST_UPDATE DESC";
stmt = conn.prepareStatement(sql); stmt = conn.prepareStatement(sql);
stmt.setInt(1, tenantId); stmt.setInt(1, tenantId);
stmt.setString(2, username); stmt.setString(2, username);

@ -553,7 +553,7 @@ public class SQLServerDeviceDAOImpl extends AbstractDeviceDAOImpl {
isStatusProvided = true; isStatusProvided = true;
} }
query = query + " LIMIT ?,?"; query = query + " ORDER BY f.ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY";
try (PreparedStatement ps = conn.prepareStatement(query)) { try (PreparedStatement ps = conn.prepareStatement(query)) {

@ -74,6 +74,16 @@ var displayPolicy = function (policyPayloadObj) {
policyPayloadObj.correctiveActions.forEach(function (correctiveAction) { policyPayloadObj.correctiveActions.forEach(function (correctiveAction) {
if ("POLICY" === correctiveAction.actionType) { if ("POLICY" === correctiveAction.actionType) {
$("#corrective-action-type-policy-id").html(correctiveAction.policyId); $("#corrective-action-type-policy-id").html(correctiveAction.policyId);
var correctivePolicies = $("#logged-in-user").data("corrective-policies");
if (correctivePolicies) {
var i;
for (i = 0; i < correctivePolicies.length; i++) {
if (correctiveAction.policyId === correctivePolicies[i].id) {
$("#corrective-action-policy-id-missing-msg").addClass("hidden");
break;
}
}
}
return true; return true;
} }
}); });

@ -1,7 +1,8 @@
{{#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}}" data-iscloud="{{isCloud}}"></span> data-tenant-id="{{@user.tenantId}}" data-iscloud="{{isCloud}}"
data-corrective-policies="{{correctivePolicies}}"></span>
{{#defineZone "policy-profile-top"}} {{#defineZone "policy-profile-top"}}
<div class="row wr-device-board"> <div class="row wr-device-board">
<div class="col-lg-12 wr-secondary-bar"> <div class="col-lg-12 wr-secondary-bar">
@ -67,6 +68,16 @@
<td class="sorting_1" style="padding:10px 15px; width: 14%;">Policy ID</td> <td class="sorting_1" style="padding:10px 15px; width: 14%;">Policy ID</td>
<td id="corrective-action-type-policy-id" style="padding:10px 15px;"></td> <td id="corrective-action-type-policy-id" style="padding:10px 15px;"></td>
</tr> </tr>
<tr id="corrective-action-policy-id-missing-msg">
<td class="alert alert-danger" colspan="4" style="padding:10px 15px;">
<strong>
<i class="icon fw fw-error"></i>
Corrective policy having the above Policy ID has been updated to
a GENERAL policy or it has been deleted. Hence this policy will
not be applied till modified correctly.
</strong>
</td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>

@ -18,6 +18,8 @@
function onRequest(context) { function onRequest(context) {
var utility = require("/app/modules/utility.js").utility; var utility = require("/app/modules/utility.js").utility;
var policyModule = require("/app/modules/business-controllers/policy.js")["policyModule"];
var page = {}; var page = {};
var deviceType = request.getParameter("deviceType"); var deviceType = request.getParameter("deviceType");
var policyViewSrc = "/app/units/" + utility.getTenantedDeviceUnitName(deviceType, "policy-view"); var policyViewSrc = "/app/units/" + utility.getTenantedDeviceUnitName(deviceType, "policy-view");
@ -43,5 +45,7 @@ function onRequest(context) {
var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
page["isCloud"] = devicemgtProps.isCloud; page["isCloud"] = devicemgtProps.isCloud;
page["correctivePolicies"] = JSON.stringify(policyModule.getAllPoliciesByType("CORRECTIVE")["content"]);
return page; return page;
} }

@ -268,8 +268,7 @@ CREATE TABLE AP_SCHEDULED_SUBSCRIPTION(
ID INTEGER NOT NULL IDENTITY, ID INTEGER NOT NULL IDENTITY,
TASK_NAME VARCHAR(100) NOT NULL, TASK_NAME VARCHAR(100) NOT NULL,
APPLICATION_UUID VARCHAR(200) NOT NULL, APPLICATION_UUID VARCHAR(200) NOT NULL,
CONSTRAINT APPLICATION_UUID_CONSTRAINT UNIQUE(APPLICATION_UUID), SUBSCRIBER_LIST VARCHAR(MAX) NOT NULL,
SUBSCRIBER_LIST VARCHAR NOT NULL,
STATUS VARCHAR(15) NOT NULL, STATUS VARCHAR(15) NOT NULL,
SCHEDULED_AT DATETIME2(0) NOT NULL, SCHEDULED_AT DATETIME2(0) NOT NULL,
SCHEDULED_BY VARCHAR(100) NOT NULL, SCHEDULED_BY VARCHAR(100) NOT NULL,

Loading…
Cancel
Save