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();
List<Integer> deviceSubIds = new ArrayList<>();
List<String> subscribedEntities = new ArrayList<>();
if (SubsciptionType.USER.toString().equalsIgnoreCase(subType)) {
subscribedEntities = subscriptionDAO.getSubscribedUserNames(params, tenantId);
List<String> subscribedEntities = subscriptionDAO.getSubscribedUserNames(params, tenantId);
if (SubAction.INSTALL.toString().equalsIgnoreCase(action)) {
params.removeAll(subscribedEntities);
subscriptionDAO.addUserSubscriptions(tenantId, username, params, applicationReleaseId);
}
subscriptionDAO.updateSubscriptions(tenantId, username, subscribedEntities, applicationReleaseId, subType,
action);
} 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)) {
params.removeAll(subscribedEntities);
subscriptionDAO.addRoleSubscriptions(tenantId, username, params, applicationReleaseId);
}
subscriptionDAO.updateSubscriptions(tenantId, username, subscribedEntities, applicationReleaseId, subType,
action);
} 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)) {
params.removeAll(subscribedEntities);
subscriptionDAO.addGroupSubscriptions(tenantId, username, params, applicationReleaseId);
}
}
subscriptionDAO.updateSubscriptions(tenantId, username, subscribedEntities, applicationReleaseId, subType,
action);
}
for (Activity activity : activities) {
int operationId = Integer.parseInt(activity.getActivityId().split("ACTIVITY_")[1]);

@ -1,5 +1,5 @@
import React from "react";
import {Button, Modal, Tabs} from "antd";
import {Modal, Tabs} from "antd";
import UserInstall from "./UserInstall";
import GroupInstall from "./GroupInstall";
import RoleInstall from "./RoleInstall";

@ -130,7 +130,8 @@ class DeviceInstall extends React.Component {
//send request to the invoker
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 => {
if (res.status === 200) {
@ -147,7 +148,8 @@ class DeviceInstall extends React.Component {
if (error.hasOwnProperty("status") && error.response.status === 401) {
//todo display a popop with error
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 {
notification["error"]({
message: "There was a problem",
@ -185,7 +187,7 @@ class DeviceInstall extends React.Component {
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;
return (
<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
style={{paddingTop:20}}
columns={columns}
@ -212,7 +217,9 @@ class DeviceInstall extends React.Component {
scroll={{x: 1000}}
/>
<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>
);

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

Loading…
Cancel
Save