Display edge related entities on customer level
This commit is contained in:
parent
15f4a85dec
commit
2ec11b2af1
@ -415,7 +415,7 @@ public class AssetController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN')")
|
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
|
||||||
@RequestMapping(value = "/edge/{edgeId}/assets", params = {"limit"}, method = RequestMethod.GET)
|
@RequestMapping(value = "/edge/{edgeId}/assets", params = {"limit"}, method = RequestMethod.GET)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TimePageData<Asset> getEdgeAssets(
|
public TimePageData<Asset> getEdgeAssets(
|
||||||
@ -431,7 +431,16 @@ public class AssetController extends BaseController {
|
|||||||
EdgeId edgeId = new EdgeId(toUUID(strEdgeId));
|
EdgeId edgeId = new EdgeId(toUUID(strEdgeId));
|
||||||
checkEdgeId(edgeId, Operation.READ);
|
checkEdgeId(edgeId, Operation.READ);
|
||||||
TimePageLink pageLink = createPageLink(limit, startTime, endTime, ascOrder, offset);
|
TimePageLink pageLink = createPageLink(limit, startTime, endTime, ascOrder, offset);
|
||||||
return checkNotNull(assetService.findAssetsByTenantIdAndEdgeId(tenantId, edgeId, pageLink).get());
|
TimePageData<Asset> nonFilteredResult = assetService.findAssetsByTenantIdAndEdgeId(tenantId, edgeId, pageLink).get();
|
||||||
|
List<Asset> filteredAssets = nonFilteredResult.getData().stream().filter(asset -> {
|
||||||
|
try {
|
||||||
|
accessControlService.checkPermission(getCurrentUser(), Resource.ASSET, Operation.READ, asset.getId(), asset);
|
||||||
|
return true;
|
||||||
|
} catch (ThingsboardException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
return checkNotNull(new TimePageData<>(filteredAssets, nonFilteredResult.getNextPageLink(), nonFilteredResult.hasNext()));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw handleException(e);
|
throw handleException(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -50,6 +50,7 @@ import org.thingsboard.server.service.security.permission.Resource;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@TbCoreComponent
|
@TbCoreComponent
|
||||||
@ -554,7 +555,7 @@ public class DashboardController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('TENANT_ADMIN')")
|
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
|
||||||
@RequestMapping(value = "/edge/{edgeId}/dashboards", params = { "limit" }, method = RequestMethod.GET)
|
@RequestMapping(value = "/edge/{edgeId}/dashboards", params = { "limit" }, method = RequestMethod.GET)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TimePageData<DashboardInfo> getEdgeDashboards(
|
public TimePageData<DashboardInfo> getEdgeDashboards(
|
||||||
@ -570,7 +571,16 @@ public class DashboardController extends BaseController {
|
|||||||
EdgeId edgeId = new EdgeId(toUUID(strEdgeId));
|
EdgeId edgeId = new EdgeId(toUUID(strEdgeId));
|
||||||
checkEdgeId(edgeId, Operation.READ);
|
checkEdgeId(edgeId, Operation.READ);
|
||||||
TimePageLink pageLink = createPageLink(limit, startTime, endTime, ascOrder, offset);
|
TimePageLink pageLink = createPageLink(limit, startTime, endTime, ascOrder, offset);
|
||||||
return checkNotNull(dashboardService.findDashboardsByTenantIdAndEdgeId(tenantId, edgeId, pageLink).get());
|
TimePageData<DashboardInfo> nonFilteredResult = dashboardService.findDashboardsByTenantIdAndEdgeId(tenantId, edgeId, pageLink).get();
|
||||||
|
List<DashboardInfo> filteredDashboards = nonFilteredResult.getData().stream().filter(dashboard -> {
|
||||||
|
try {
|
||||||
|
accessControlService.checkPermission(getCurrentUser(), Resource.DASHBOARD, Operation.READ, dashboard.getId(), dashboard);
|
||||||
|
return true;
|
||||||
|
} catch (ThingsboardException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
return checkNotNull(new TimePageData<>(filteredDashboards, nonFilteredResult.getNextPageLink(), nonFilteredResult.hasNext()));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw handleException(e);
|
throw handleException(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -631,7 +631,7 @@ public class DeviceController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN')")
|
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
|
||||||
@RequestMapping(value = "/edge/{edgeId}/devices", params = {"limit"}, method = RequestMethod.GET)
|
@RequestMapping(value = "/edge/{edgeId}/devices", params = {"limit"}, method = RequestMethod.GET)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TimePageData<Device> getEdgeDevices(
|
public TimePageData<Device> getEdgeDevices(
|
||||||
@ -647,7 +647,16 @@ public class DeviceController extends BaseController {
|
|||||||
EdgeId edgeId = new EdgeId(toUUID(strEdgeId));
|
EdgeId edgeId = new EdgeId(toUUID(strEdgeId));
|
||||||
checkEdgeId(edgeId, Operation.READ);
|
checkEdgeId(edgeId, Operation.READ);
|
||||||
TimePageLink pageLink = createPageLink(limit, startTime, endTime, ascOrder, offset);
|
TimePageLink pageLink = createPageLink(limit, startTime, endTime, ascOrder, offset);
|
||||||
return checkNotNull(deviceService.findDevicesByTenantIdAndEdgeId(tenantId, edgeId, pageLink).get());
|
TimePageData<Device> nonFilteredResult = deviceService.findDevicesByTenantIdAndEdgeId(tenantId, edgeId, pageLink).get();
|
||||||
|
List<Device> filteredDevices = nonFilteredResult.getData().stream().filter(device -> {
|
||||||
|
try {
|
||||||
|
accessControlService.checkPermission(getCurrentUser(), Resource.DEVICE, Operation.READ, device.getId(), device);
|
||||||
|
return true;
|
||||||
|
} catch (ThingsboardException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
return checkNotNull(new TimePageData<>(filteredDevices, nonFilteredResult.getNextPageLink(), nonFilteredResult.hasNext()));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw handleException(e);
|
throw handleException(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -449,7 +449,7 @@ public class EntityViewController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN')")
|
@PreAuthorize("hasAnyAuthority('TENANT_ADMIN', 'CUSTOMER_USER')")
|
||||||
@RequestMapping(value = "/edge/{edgeId}/entityViews", params = {"limit"}, method = RequestMethod.GET)
|
@RequestMapping(value = "/edge/{edgeId}/entityViews", params = {"limit"}, method = RequestMethod.GET)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TimePageData<EntityView> getEdgeEntityViews(
|
public TimePageData<EntityView> getEdgeEntityViews(
|
||||||
@ -465,7 +465,16 @@ public class EntityViewController extends BaseController {
|
|||||||
EdgeId edgeId = new EdgeId(toUUID(strEdgeId));
|
EdgeId edgeId = new EdgeId(toUUID(strEdgeId));
|
||||||
checkEdgeId(edgeId, Operation.READ);
|
checkEdgeId(edgeId, Operation.READ);
|
||||||
TimePageLink pageLink = createPageLink(limit, startTime, endTime, ascOrder, offset);
|
TimePageLink pageLink = createPageLink(limit, startTime, endTime, ascOrder, offset);
|
||||||
return checkNotNull(entityViewService.findEntityViewsByTenantIdAndEdgeId(tenantId, edgeId, pageLink).get());
|
TimePageData<EntityView> nonFilteredResult = entityViewService.findEntityViewsByTenantIdAndEdgeId(tenantId, edgeId, pageLink).get();
|
||||||
|
List<EntityView> filteredEntityViews = nonFilteredResult.getData().stream().filter(entityView -> {
|
||||||
|
try {
|
||||||
|
accessControlService.checkPermission(getCurrentUser(), Resource.ENTITY_VIEW, Operation.READ, entityView.getId(), entityView);
|
||||||
|
return true;
|
||||||
|
} catch (ThingsboardException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
return checkNotNull(new TimePageData<>(filteredEntityViews, nonFilteredResult.getNextPageLink(), nonFilteredResult.hasNext()));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw handleException(e);
|
throw handleException(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -142,7 +142,11 @@ export function AssetController($rootScope, userService, assetService, customerS
|
|||||||
var user = userService.getCurrentUser();
|
var user = userService.getCurrentUser();
|
||||||
|
|
||||||
if (user.authority === 'CUSTOMER_USER') {
|
if (user.authority === 'CUSTOMER_USER') {
|
||||||
|
if (vm.assetsScope === 'edge') {
|
||||||
|
vm.assetsScope = 'edge_customer_user';
|
||||||
|
} else {
|
||||||
vm.assetsScope = 'customer_user';
|
vm.assetsScope = 'customer_user';
|
||||||
|
}
|
||||||
customerId = user.customerId;
|
customerId = user.customerId;
|
||||||
}
|
}
|
||||||
if (customerId) {
|
if (customerId) {
|
||||||
@ -323,10 +327,11 @@ export function AssetController($rootScope, userService, assetService, customerS
|
|||||||
}
|
}
|
||||||
vm.assetGridConfig.addItemActions = [];
|
vm.assetGridConfig.addItemActions = [];
|
||||||
|
|
||||||
} else if (vm.assetsScope === 'edge') {
|
} else if (vm.assetsScope === 'edge' || vm.assetsScope === 'edge_customer_user') {
|
||||||
fetchAssetsFunction = function (pageLink) {
|
fetchAssetsFunction = function (pageLink) {
|
||||||
return assetService.getEdgeAssets(edgeId, pageLink, null);
|
return assetService.getEdgeAssets(edgeId, pageLink, null);
|
||||||
};
|
};
|
||||||
|
if (vm.assetsScope === 'edge') {
|
||||||
deleteAssetFunction = function (assetId) {
|
deleteAssetFunction = function (assetId) {
|
||||||
return assetService.unassignAssetFromEdge(edgeId, assetId);
|
return assetService.unassignAssetFromEdge(edgeId, assetId);
|
||||||
};
|
};
|
||||||
@ -339,8 +344,12 @@ export function AssetController($rootScope, userService, assetService, customerS
|
|||||||
onAction: function ($event, item) {
|
onAction: function ($event, item) {
|
||||||
unassignFromEdge($event, item, false);
|
unassignFromEdge($event, item, false);
|
||||||
},
|
},
|
||||||
name: function() { return $translate.instant('action.unassign') },
|
name: function () {
|
||||||
details: function() { return $translate.instant('edge.unassign-from-edge') },
|
return $translate.instant('action.unassign')
|
||||||
|
},
|
||||||
|
details: function () {
|
||||||
|
return $translate.instant('edge.unassign-from-edge')
|
||||||
|
},
|
||||||
icon: "assignment_return"
|
icon: "assignment_return"
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -350,7 +359,9 @@ export function AssetController($rootScope, userService, assetService, customerS
|
|||||||
onAction: function ($event, items) {
|
onAction: function ($event, items) {
|
||||||
unassignAssetsFromEdge($event, items);
|
unassignAssetsFromEdge($event, items);
|
||||||
},
|
},
|
||||||
name: function() { return $translate.instant('asset.unassign-assets') },
|
name: function () {
|
||||||
|
return $translate.instant('asset.unassign-assets')
|
||||||
|
},
|
||||||
details: function (selectedCount) {
|
details: function (selectedCount) {
|
||||||
return $translate.instant('asset.unassign-assets-from-edge-action-title', {count: selectedCount}, "messageformat");
|
return $translate.instant('asset.unassign-assets-from-edge-action-title', {count: selectedCount}, "messageformat");
|
||||||
},
|
},
|
||||||
@ -362,12 +373,18 @@ export function AssetController($rootScope, userService, assetService, customerS
|
|||||||
onAction: function ($event) {
|
onAction: function ($event) {
|
||||||
addAssetsToEdge($event);
|
addAssetsToEdge($event);
|
||||||
},
|
},
|
||||||
name: function() { return $translate.instant('asset.assign-assets') },
|
name: function () {
|
||||||
details: function() { return $translate.instant('asset.assign-new-asset') },
|
return $translate.instant('asset.assign-assets')
|
||||||
|
},
|
||||||
|
details: function () {
|
||||||
|
return $translate.instant('asset.assign-new-asset')
|
||||||
|
},
|
||||||
icon: "add"
|
icon: "add"
|
||||||
};
|
};
|
||||||
|
} else if (vm.assetsScope === 'edge_customer_user') {
|
||||||
|
vm.assetGridConfig.addItemAction = {};
|
||||||
|
}
|
||||||
vm.assetGridConfig.addItemActions = [];
|
vm.assetGridConfig.addItemActions = [];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vm.assetGridConfig.refreshParamsFunc = refreshAssetsParamsFunction;
|
vm.assetGridConfig.refreshParamsFunc = refreshAssetsParamsFunction;
|
||||||
|
|||||||
@ -141,7 +141,11 @@ export function DashboardsController(userService, dashboardService, customerServ
|
|||||||
var user = userService.getCurrentUser();
|
var user = userService.getCurrentUser();
|
||||||
|
|
||||||
if (user.authority === 'CUSTOMER_USER') {
|
if (user.authority === 'CUSTOMER_USER') {
|
||||||
|
if (vm.dashboardsScope === 'edge') {
|
||||||
|
vm.dashboardsScope = 'edge_customer_user';
|
||||||
|
} else {
|
||||||
vm.dashboardsScope = 'customer_user';
|
vm.dashboardsScope = 'customer_user';
|
||||||
|
}
|
||||||
customerId = user.customerId;
|
customerId = user.customerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -381,10 +385,12 @@ export function DashboardsController(userService, dashboardService, customerServ
|
|||||||
} else if (vm.dashboardsScope === 'customer_user') {
|
} else if (vm.dashboardsScope === 'customer_user') {
|
||||||
vm.dashboardGridConfig.addItemAction = {};
|
vm.dashboardGridConfig.addItemAction = {};
|
||||||
}
|
}
|
||||||
} else if (vm.dashboardsScope === 'edge') {
|
} else if (vm.dashboardsScope === 'edge' || vm.dashboardsScope === 'edge_customer_user') {
|
||||||
fetchDashboardsFunction = function (pageLink) {
|
fetchDashboardsFunction = function (pageLink) {
|
||||||
return dashboardService.getEdgeDashboards(edgeId, pageLink, null);
|
return dashboardService.getEdgeDashboards(edgeId, pageLink, null);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (vm.dashboardsScope === 'edge') {
|
||||||
deleteDashboardFunction = function (dashboardId) {
|
deleteDashboardFunction = function (dashboardId) {
|
||||||
return dashboardService.unassignDashboardFromEdge(edgeId, dashboardId);
|
return dashboardService.unassignDashboardFromEdge(edgeId, dashboardId);
|
||||||
};
|
};
|
||||||
@ -397,8 +403,12 @@ export function DashboardsController(userService, dashboardService, customerServ
|
|||||||
onAction: function ($event, item) {
|
onAction: function ($event, item) {
|
||||||
exportDashboard($event, item);
|
exportDashboard($event, item);
|
||||||
},
|
},
|
||||||
name: function() { $translate.instant('action.export') },
|
name: function () {
|
||||||
details: function() { return $translate.instant('dashboard.export') },
|
$translate.instant('action.export')
|
||||||
|
},
|
||||||
|
details: function () {
|
||||||
|
return $translate.instant('dashboard.export')
|
||||||
|
},
|
||||||
icon: "file_download"
|
icon: "file_download"
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -408,8 +418,12 @@ export function DashboardsController(userService, dashboardService, customerServ
|
|||||||
onAction: function ($event, item) {
|
onAction: function ($event, item) {
|
||||||
unassignFromEdge($event, item, edgeId);
|
unassignFromEdge($event, item, edgeId);
|
||||||
},
|
},
|
||||||
name: function() { return $translate.instant('action.unassign') },
|
name: function () {
|
||||||
details: function() { return $translate.instant('edge.unassign-from-edge') },
|
return $translate.instant('action.unassign')
|
||||||
|
},
|
||||||
|
details: function () {
|
||||||
|
return $translate.instant('edge.unassign-from-edge')
|
||||||
|
},
|
||||||
icon: "assignment_return"
|
icon: "assignment_return"
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -419,7 +433,9 @@ export function DashboardsController(userService, dashboardService, customerServ
|
|||||||
onAction: function ($event, items) {
|
onAction: function ($event, items) {
|
||||||
unassignDashboardsFromEdge($event, items, edgeId);
|
unassignDashboardsFromEdge($event, items, edgeId);
|
||||||
},
|
},
|
||||||
name: function() { return $translate.instant('dashboard.unassign-dashboards') },
|
name: function () {
|
||||||
|
return $translate.instant('dashboard.unassign-dashboards')
|
||||||
|
},
|
||||||
details: function (selectedCount) {
|
details: function (selectedCount) {
|
||||||
return $translate.instant('dashboard.unassign-dashboards-from-edge-action-title', {count: selectedCount}, "messageformat");
|
return $translate.instant('dashboard.unassign-dashboards-from-edge-action-title', {count: selectedCount}, "messageformat");
|
||||||
},
|
},
|
||||||
@ -431,10 +447,18 @@ export function DashboardsController(userService, dashboardService, customerServ
|
|||||||
onAction: function ($event) {
|
onAction: function ($event) {
|
||||||
addDashboardsToEdge($event);
|
addDashboardsToEdge($event);
|
||||||
},
|
},
|
||||||
name: function() { return $translate.instant('dashboard.assign-dashboards') },
|
name: function () {
|
||||||
details: function() { return $translate.instant('dashboard.assign-new-dashboard') },
|
return $translate.instant('dashboard.assign-dashboards')
|
||||||
|
},
|
||||||
|
details: function () {
|
||||||
|
return $translate.instant('dashboard.assign-new-dashboard')
|
||||||
|
},
|
||||||
icon: "add"
|
icon: "add"
|
||||||
};
|
};
|
||||||
|
} else if (vm.dashboardsScope === 'edge_customer_user') {
|
||||||
|
vm.dashboardGridConfig.addItemAction = {};
|
||||||
|
vm.dashboardGridConfig.addItemActions = [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vm.dashboardGridConfig.refreshParamsFunc = refreshDashboardsParamsFunction;
|
vm.dashboardGridConfig.refreshParamsFunc = refreshDashboardsParamsFunction;
|
||||||
|
|||||||
@ -143,7 +143,11 @@ export function DeviceController($rootScope, userService, deviceService, custome
|
|||||||
var user = userService.getCurrentUser();
|
var user = userService.getCurrentUser();
|
||||||
|
|
||||||
if (user.authority === 'CUSTOMER_USER') {
|
if (user.authority === 'CUSTOMER_USER') {
|
||||||
|
if (vm.devicesScope === 'edge') {
|
||||||
|
vm.devicesScope = 'edge_customer_user';
|
||||||
|
} else {
|
||||||
vm.devicesScope = 'customer_user';
|
vm.devicesScope = 'customer_user';
|
||||||
|
}
|
||||||
customerId = user.customerId;
|
customerId = user.customerId;
|
||||||
}
|
}
|
||||||
if (customerId) {
|
if (customerId) {
|
||||||
@ -356,10 +360,12 @@ export function DeviceController($rootScope, userService, deviceService, custome
|
|||||||
}
|
}
|
||||||
vm.deviceGridConfig.addItemActions = [];
|
vm.deviceGridConfig.addItemActions = [];
|
||||||
|
|
||||||
} else if (vm.devicesScope === 'edge') {
|
} else if (vm.devicesScope === 'edge' || vm.devicesScope === 'edge_customer_user') {
|
||||||
fetchDevicesFunction = function (pageLink) {
|
fetchDevicesFunction = function (pageLink) {
|
||||||
return deviceService.getEdgeDevices(edgeId, pageLink, null);
|
return deviceService.getEdgeDevices(edgeId, pageLink, null);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (vm.devicesScope === 'edge') {
|
||||||
deleteDeviceFunction = function (deviceId) {
|
deleteDeviceFunction = function (deviceId) {
|
||||||
return deviceService.unassignDeviceFromEdge(edgeId, deviceId);
|
return deviceService.unassignDeviceFromEdge(edgeId, deviceId);
|
||||||
};
|
};
|
||||||
@ -399,6 +405,19 @@ export function DeviceController($rootScope, userService, deviceService, custome
|
|||||||
details: function() { return $translate.instant('device.assign-new-device') },
|
details: function() { return $translate.instant('device.assign-new-device') },
|
||||||
icon: "add"
|
icon: "add"
|
||||||
};
|
};
|
||||||
|
} else if (vm.devicesScope === 'edge_customer_user') {
|
||||||
|
deviceActionsList.push(
|
||||||
|
{
|
||||||
|
onAction: function ($event, item) {
|
||||||
|
manageCredentials($event, item);
|
||||||
|
},
|
||||||
|
name: function() { return $translate.instant('device.credentials') },
|
||||||
|
details: function() { return $translate.instant('device.view-credentials') },
|
||||||
|
icon: "security"
|
||||||
|
}
|
||||||
|
);
|
||||||
|
vm.deviceGridConfig.addItemAction = {};
|
||||||
|
}
|
||||||
vm.deviceGridConfig.addItemActions = [];
|
vm.deviceGridConfig.addItemActions = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -31,16 +31,16 @@
|
|||||||
</div>
|
</div>
|
||||||
<div layout="row">
|
<div layout="row">
|
||||||
<md-button ng-click="onManageEdgeAssets({event: $event})"
|
<md-button ng-click="onManageEdgeAssets({event: $event})"
|
||||||
ng-show="!isEdit && edgeScope === 'tenant'"
|
ng-show="!isEdit && (edgeScope === 'tenant' || edgeScope === 'customer_user')"
|
||||||
class="md-raised md-primary">{{ 'edge.assets' | translate }}</md-button>
|
class="md-raised md-primary">{{ 'edge.assets' | translate }}</md-button>
|
||||||
<md-button ng-click="onManageEdgeDevices({event: $event})"
|
<md-button ng-click="onManageEdgeDevices({event: $event})"
|
||||||
ng-show="!isEdit && edgeScope === 'tenant'"
|
ng-show="!isEdit && (edgeScope === 'tenant' || edgeScope === 'customer_user')"
|
||||||
class="md-raised md-primary">{{ 'edge.devices' | translate }}</md-button>
|
class="md-raised md-primary">{{ 'edge.devices' | translate }}</md-button>
|
||||||
<md-button ng-click="onManageEdgeEntityViews({event: $event})"
|
<md-button ng-click="onManageEdgeEntityViews({event: $event})"
|
||||||
ng-show="!isEdit && edgeScope === 'tenant'"
|
ng-show="!isEdit && (edgeScope === 'tenant' || edgeScope === 'customer_user')"
|
||||||
class="md-raised md-primary">{{ 'edge.entity-views' | translate }}</md-button>
|
class="md-raised md-primary">{{ 'edge.entity-views' | translate }}</md-button>
|
||||||
<md-button ng-click="onManageEdgeDashboards({event: $event})"
|
<md-button ng-click="onManageEdgeDashboards({event: $event})"
|
||||||
ng-show="!isEdit && edgeScope === 'tenant'"
|
ng-show="!isEdit && (edgeScope === 'tenant' || edgeScope === 'customer_user')"
|
||||||
class="md-raised md-primary">{{ 'edge.dashboards' | translate }}</md-button>
|
class="md-raised md-primary">{{ 'edge.dashboards' | translate }}</md-button>
|
||||||
<md-button ng-click="onManageEdgeRuleChains({event: $event})"
|
<md-button ng-click="onManageEdgeRuleChains({event: $event})"
|
||||||
ng-show="!isEdit && edgeScope === 'tenant'"
|
ng-show="!isEdit && edgeScope === 'tenant'"
|
||||||
|
|||||||
@ -399,9 +399,59 @@ export function EdgeController($rootScope, userService, edgeService, customerSer
|
|||||||
|
|
||||||
} else if (vm.edgesScope === 'customer_user') {
|
} else if (vm.edgesScope === 'customer_user') {
|
||||||
vm.edgeGridConfig.addItemAction = {};
|
vm.edgeGridConfig.addItemAction = {};
|
||||||
|
edgeActionsList.push(
|
||||||
|
{
|
||||||
|
onAction: function ($event, item) {
|
||||||
|
openEdgeAssets($event, item);
|
||||||
|
},
|
||||||
|
name: function() { return $translate.instant('asset.assets') },
|
||||||
|
details: function() {
|
||||||
|
return $translate.instant('edge.manage-edge-assets');
|
||||||
|
},
|
||||||
|
icon: "domain"
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
edgeActionsList.push(
|
||||||
|
{
|
||||||
|
onAction: function ($event, item) {
|
||||||
|
openEdgeDevices($event, item);
|
||||||
|
},
|
||||||
|
name: function() { return $translate.instant('device.devices') },
|
||||||
|
details: function() {
|
||||||
|
return $translate.instant('edge.manage-edge-devices');
|
||||||
|
},
|
||||||
|
icon: "devices_other"
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
edgeActionsList.push(
|
||||||
|
{
|
||||||
|
onAction: function ($event, item) {
|
||||||
|
openEdgeEntityViews($event, item);
|
||||||
|
},
|
||||||
|
name: function() { return $translate.instant('entity-view.entity-views') },
|
||||||
|
details: function() {
|
||||||
|
return $translate.instant('edge.manage-edge-entity-views');
|
||||||
|
},
|
||||||
|
icon: "view_quilt"
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
edgeActionsList.push(
|
||||||
|
{
|
||||||
|
onAction: function ($event, item) {
|
||||||
|
openEdgeDashboards($event, item);
|
||||||
|
},
|
||||||
|
name: function() { return $translate.instant('dashboard.dashboards') },
|
||||||
|
details: function() {
|
||||||
|
return $translate.instant('edge.manage-edge-dashboards');
|
||||||
|
},
|
||||||
|
icon: "dashboard"
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
vm.edgeGridConfig.addItemActions = [];
|
vm.edgeGridConfig.addItemActions = [];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vm.edgeGridConfig.refreshParamsFunc = refreshEdgesParamsFunction;
|
vm.edgeGridConfig.refreshParamsFunc = refreshEdgesParamsFunction;
|
||||||
|
|||||||
@ -55,7 +55,7 @@ export default function EdgeRoutes($stateProvider, types) {
|
|||||||
url: '/:edgeId/entityViews',
|
url: '/:edgeId/entityViews',
|
||||||
params: {'topIndex': 0},
|
params: {'topIndex': 0},
|
||||||
module: 'private',
|
module: 'private',
|
||||||
auth: ['TENANT_ADMIN'],
|
auth: ['TENANT_ADMIN', 'CUSTOMER_USER'],
|
||||||
views: {
|
views: {
|
||||||
"content@home": {
|
"content@home": {
|
||||||
templateUrl: entityViewsTemplate,
|
templateUrl: entityViewsTemplate,
|
||||||
@ -77,7 +77,7 @@ export default function EdgeRoutes($stateProvider, types) {
|
|||||||
url: '/:edgeId/devices',
|
url: '/:edgeId/devices',
|
||||||
params: {'topIndex': 0},
|
params: {'topIndex': 0},
|
||||||
module: 'private',
|
module: 'private',
|
||||||
auth: ['TENANT_ADMIN'],
|
auth: ['TENANT_ADMIN', 'CUSTOMER_USER'],
|
||||||
views: {
|
views: {
|
||||||
"content@home": {
|
"content@home": {
|
||||||
templateUrl: devicesTemplate,
|
templateUrl: devicesTemplate,
|
||||||
@ -99,7 +99,7 @@ export default function EdgeRoutes($stateProvider, types) {
|
|||||||
url: '/:edgeId/assets',
|
url: '/:edgeId/assets',
|
||||||
params: {'topIndex': 0},
|
params: {'topIndex': 0},
|
||||||
module: 'private',
|
module: 'private',
|
||||||
auth: ['TENANT_ADMIN'],
|
auth: ['TENANT_ADMIN', 'CUSTOMER_USER'],
|
||||||
views: {
|
views: {
|
||||||
"content@home": {
|
"content@home": {
|
||||||
templateUrl: assetsTemplate,
|
templateUrl: assetsTemplate,
|
||||||
@ -121,7 +121,7 @@ export default function EdgeRoutes($stateProvider, types) {
|
|||||||
url: '/:edgeId/dashboards',
|
url: '/:edgeId/dashboards',
|
||||||
params: {'topIndex': 0},
|
params: {'topIndex': 0},
|
||||||
module: 'private',
|
module: 'private',
|
||||||
auth: ['TENANT_ADMIN'],
|
auth: ['TENANT_ADMIN', 'CUSTOMER_USER'],
|
||||||
views: {
|
views: {
|
||||||
"content@home": {
|
"content@home": {
|
||||||
templateUrl: dashboardsTemplate,
|
templateUrl: dashboardsTemplate,
|
||||||
|
|||||||
@ -118,7 +118,11 @@ export function EntityViewController($rootScope, userService, entityViewService,
|
|||||||
var user = userService.getCurrentUser();
|
var user = userService.getCurrentUser();
|
||||||
|
|
||||||
if (user.authority === 'CUSTOMER_USER') {
|
if (user.authority === 'CUSTOMER_USER') {
|
||||||
|
if (vm.entityViewsScope === 'edge') {
|
||||||
|
vm.entityViewsScope = 'edge_customer_user';
|
||||||
|
} else {
|
||||||
vm.entityViewsScope = 'customer_user';
|
vm.entityViewsScope = 'customer_user';
|
||||||
|
}
|
||||||
customerId = user.customerId;
|
customerId = user.customerId;
|
||||||
}
|
}
|
||||||
if (customerId) {
|
if (customerId) {
|
||||||
@ -284,10 +288,12 @@ export function EntityViewController($rootScope, userService, entityViewService,
|
|||||||
} else if (vm.entityViewsScope === 'customer_user') {
|
} else if (vm.entityViewsScope === 'customer_user') {
|
||||||
vm.entityViewGridConfig.addItemAction = {};
|
vm.entityViewGridConfig.addItemAction = {};
|
||||||
}
|
}
|
||||||
} else if (vm.entityViewsScope === 'edge') {
|
} else if (vm.entityViewsScope === 'edge' || vm.entityViewsScope === 'edge_customer_user') {
|
||||||
fetchEntityViewsFunction = function (pageLink) {
|
fetchEntityViewsFunction = function (pageLink) {
|
||||||
return entityViewService.getEdgeEntityViews(edgeId, pageLink, null);
|
return entityViewService.getEdgeEntityViews(edgeId, pageLink, null);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (vm.entityViewsScope === 'edge') {
|
||||||
deleteEntityViewFunction = function (entityViewId) {
|
deleteEntityViewFunction = function (entityViewId) {
|
||||||
return entityViewService.unassignEntityViewFromEdge(edgeId, entityViewId);
|
return entityViewService.unassignEntityViewFromEdge(edgeId, entityViewId);
|
||||||
};
|
};
|
||||||
@ -299,8 +305,12 @@ export function EntityViewController($rootScope, userService, entityViewService,
|
|||||||
onAction: function ($event, item) {
|
onAction: function ($event, item) {
|
||||||
unassignFromEdge($event, item, false);
|
unassignFromEdge($event, item, false);
|
||||||
},
|
},
|
||||||
name: function() { return $translate.instant('action.unassign') },
|
name: function () {
|
||||||
details: function() { return $translate.instant('edge.unassign-from-edge') },
|
return $translate.instant('action.unassign')
|
||||||
|
},
|
||||||
|
details: function () {
|
||||||
|
return $translate.instant('edge.unassign-from-edge')
|
||||||
|
},
|
||||||
icon: "assignment_return"
|
icon: "assignment_return"
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -310,7 +320,9 @@ export function EntityViewController($rootScope, userService, entityViewService,
|
|||||||
onAction: function ($event, items) {
|
onAction: function ($event, items) {
|
||||||
unassignEntityViewsFromEdge($event, items);
|
unassignEntityViewsFromEdge($event, items);
|
||||||
},
|
},
|
||||||
name: function() { return $translate.instant('entity-view.unassign-entity-views') },
|
name: function () {
|
||||||
|
return $translate.instant('entity-view.unassign-entity-views')
|
||||||
|
},
|
||||||
details: function (selectedCount) {
|
details: function (selectedCount) {
|
||||||
return $translate.instant('entity-view.unassign-entity-views-from-edge-action-title', {count: selectedCount}, "messageformat");
|
return $translate.instant('entity-view.unassign-entity-views-from-edge-action-title', {count: selectedCount}, "messageformat");
|
||||||
},
|
},
|
||||||
@ -322,10 +334,17 @@ export function EntityViewController($rootScope, userService, entityViewService,
|
|||||||
onAction: function ($event) {
|
onAction: function ($event) {
|
||||||
addEntityViewsToEdge($event);
|
addEntityViewsToEdge($event);
|
||||||
},
|
},
|
||||||
name: function() { return $translate.instant('entity-view.assign-entity-views') },
|
name: function () {
|
||||||
details: function() { return $translate.instant('entity-view.assign-new-entity-view') },
|
return $translate.instant('entity-view.assign-entity-views')
|
||||||
|
},
|
||||||
|
details: function () {
|
||||||
|
return $translate.instant('entity-view.assign-new-entity-view')
|
||||||
|
},
|
||||||
icon: "add"
|
icon: "add"
|
||||||
};
|
};
|
||||||
|
} else if (vm.entityViewsScope === 'edge_customer_user') {
|
||||||
|
vm.entityViewGridConfig.addItemAction = {};
|
||||||
|
}
|
||||||
vm.entityViewGridConfig.addItemActions = [];
|
vm.entityViewGridConfig.addItemActions = [];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user