Improve app subscription flow

feature/appm-store/pbac
lasanthaDLPDS 5 years ago
parent e8aa337d86
commit 86fb8b16ef

@ -335,29 +335,31 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
ConnectionManagerUtil.beginDBTransaction(); ConnectionManagerUtil.beginDBTransaction();
List<Integer> deviceSubIds = new ArrayList<>(); List<Integer> deviceSubIds = new ArrayList<>();
List<String> subscribedEntities = new ArrayList<>();
if (SubsciptionType.USER.toString().equalsIgnoreCase(subType)) { if (SubsciptionType.USER.toString().equalsIgnoreCase(subType)) {
subscribedEntities = subscriptionDAO.getSubscribedUserNames(params, tenantId); List<String> subscribedEntities = subscriptionDAO.getSubscribedUserNames(params, tenantId);
if (SubAction.INSTALL.toString().equalsIgnoreCase(action)) { if (SubAction.INSTALL.toString().equalsIgnoreCase(action)) {
params.removeAll(subscribedEntities); params.removeAll(subscribedEntities);
subscriptionDAO.addUserSubscriptions(tenantId, username, params, applicationReleaseId); subscriptionDAO.addUserSubscriptions(tenantId, username, params, applicationReleaseId);
} }
subscriptionDAO.updateSubscriptions(tenantId, username, subscribedEntities, applicationReleaseId, subType,
action);
} else if (SubsciptionType.ROLE.toString().equalsIgnoreCase(subType)) { } else if (SubsciptionType.ROLE.toString().equalsIgnoreCase(subType)) {
subscribedEntities = subscriptionDAO.getSubscribedRoleNames(params, tenantId); List<String> subscribedEntities = subscriptionDAO.getSubscribedRoleNames(params, tenantId);
if (SubAction.INSTALL.toString().equalsIgnoreCase(action)) { if (SubAction.INSTALL.toString().equalsIgnoreCase(action)) {
params.removeAll(subscribedEntities); params.removeAll(subscribedEntities);
subscriptionDAO.addRoleSubscriptions(tenantId, username, params, applicationReleaseId); subscriptionDAO.addRoleSubscriptions(tenantId, username, params, applicationReleaseId);
} }
subscriptionDAO.updateSubscriptions(tenantId, username, subscribedEntities, applicationReleaseId, subType,
action);
} else if (SubsciptionType.GROUP.toString().equalsIgnoreCase(subType)) { } else if (SubsciptionType.GROUP.toString().equalsIgnoreCase(subType)) {
subscribedEntities = subscriptionDAO.getSubscribedGroupNames(params, tenantId); List<String> subscribedEntities = subscriptionDAO.getSubscribedGroupNames(params, tenantId);
if (SubAction.INSTALL.toString().equalsIgnoreCase(action)) { if (SubAction.INSTALL.toString().equalsIgnoreCase(action)) {
params.removeAll(subscribedEntities); params.removeAll(subscribedEntities);
subscriptionDAO.addGroupSubscriptions(tenantId, username, params, applicationReleaseId); subscriptionDAO.addGroupSubscriptions(tenantId, username, params, applicationReleaseId);
} }
subscriptionDAO.updateSubscriptions(tenantId, username, subscribedEntities, applicationReleaseId, subType,
action);
} }
subscriptionDAO.updateSubscriptions(tenantId, username, subscribedEntities, applicationReleaseId, subType,
action);
for (Activity activity : activities) { for (Activity activity : activities) {
int operationId = Integer.parseInt(activity.getActivityId().split("ACTIVITY_")[1]); int operationId = Integer.parseInt(activity.getActivityId().split("ACTIVITY_")[1]);

@ -1,5 +1,5 @@
import React from "react"; import React from "react";
import {Button, Modal, Tabs} from "antd"; import {Modal, 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";

@ -130,7 +130,8 @@ class DeviceInstall extends React.Component {
//send request to the invoker //send request to the invoker
axios.get( axios.get(
config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.deviceMgt+"/devices?" + encodedExtraParams, config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort
+ config.serverConfig.invoker.uri + config.serverConfig.invoker.deviceMgt+"/devices?" + encodedExtraParams,
).then(res => { ).then(res => {
if (res.status === 200) { if (res.status === 200) {
@ -147,7 +148,8 @@ class DeviceInstall extends React.Component {
if (error.hasOwnProperty("status") && error.response.status === 401) { if (error.hasOwnProperty("status") && error.response.status === 401) {
//todo display a popop with error //todo display a popop with error
message.error('You are not logged in'); message.error('You are not logged in');
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + '/store/login'; window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':'
+ config.serverConfig.httpsPort + '/store/login';
} else { } else {
notification["error"]({ notification["error"]({
message: "There was a problem", message: "There was a problem",
@ -185,7 +187,7 @@ class DeviceInstall extends React.Component {
type: device.type type: device.type
}); });
}); });
this.props.onInstall("device", payload); this.props.onInstall("devices", payload);
}; };
@ -193,7 +195,10 @@ class DeviceInstall extends React.Component {
const {data,pagination,loading,selectedRows} = this.state; const {data,pagination,loading,selectedRows} = this.state;
return ( return (
<div> <div>
<Text>Start installing the application for one or more users by entering the corresponding user name. Select install to automatically start downloading the application for the respective user/users. </Text> <Text>
Start installing the application for one or more users by entering the corresponding user name.
Select install to automatically start downloading the application for the respective user/users.
</Text>
<Table <Table
style={{paddingTop:20}} style={{paddingTop:20}}
columns={columns} columns={columns}
@ -212,11 +217,13 @@ class DeviceInstall extends React.Component {
scroll={{x: 1000}} scroll={{x: 1000}}
/> />
<div style={{paddingTop: 10, textAlign: "right"}}> <div style={{paddingTop: 10, textAlign: "right"}}>
<Button disabled={selectedRows.length===0} htmlType="button" type="primary" onClick={this.install}>Install</Button> <Button disabled={selectedRows.length===0} htmlType="button" type="primary" onClick={this.install}>
Install
</Button>
</div> </div>
</div> </div>
); );
} }
} }
export default DeviceInstall; export default DeviceInstall;

@ -183,4 +183,8 @@
<MinRatingValue>1</MinRatingValue> <MinRatingValue>1</MinRatingValue>
<MaxRatingValue>10</MaxRatingValue> <MaxRatingValue>10</MaxRatingValue>
</RatingConfig> </RatingConfig>
<MDMConfig>
<Config name="AppDownloadURLHost">https</Config>
</MDMConfig>
</ApplicationManagementConfiguration> </ApplicationManagementConfiguration>

Loading…
Cancel
Save