var entitySubType;
var $injector = widgetContext.$scope.$injector;
let customDialog = $injector.get(widgetContext.servicesMap
.get('customDialog'));
let entityService = $injector.get(widgetContext.servicesMap
.get('entityService'));
let assetService = $injector.get(widgetContext.servicesMap
.get('assetService'));
let deviceService = $injector.get(widgetContext.servicesMap
.get('deviceService'));
let attributeService = $injector.get(widgetContext
.servicesMap.get('attributeService'));
let entityRelationService = $injector.get(widgetContext
.servicesMap.get('entityRelationService'));
let dashboardData = '';
$injector.get(widgetContext.servicesMap.get(
'entityService')).getEntity(entityId.entityType,
entityId.id)
.subscribe(function(data) {
entitySubType = data.type
let currentUrl = widgetContext.dashboardService
.currentUrl;
var dashboardId = '';
console.log('currentUrl', currentUrl)
if (currentUrl && currentUrl.trim()) {
var splitedURL = currentUrl.split('/');
dashboardId = splitedURL[splitedURL.length - 1];
}
$injector.get(
widgetContext
.servicesMap.get('dashboardService'))
.getDashboard(dashboardId)
.subscribe(function(data) {
dashboardData = data;
console.log('dashboardService',
data)
var aliasObject = findObjectInfoByAlias(dashboardData.configuration
.entityAliases, 'truck-by-site');
console.log('aliasObject', aliasObject);
dashboardData.configuration
.entityAliases[
aliasObject.key
].filter.rootEntity.id =
entityId.id;
console.log('changedDashboard',
dashboardData);
$injector.get(
widgetContext
.servicesMap.get(
'dashboardService'))
.saveDashboard(dashboardData)
.subscribe(() => {
// refeshing page
$injector.get(
widgetContext
.servicesMap
.get(
'dashboardService'
))
.updateURL(
dashboardId);
});
});
updateDashboardStates('site_state');
});
function updateDashboardStates(statedId) {
widgetContext.rxjs.forkJoin([
entityRelationService
.findInfoByFrom(
entityId),
entityRelationService.findInfoByTo(
entityId),
attributeService
.getEntityAttributes(
entityId, 'SERVER_SCOPE'),
entityService.getEntity(entityId
.entityType,
entityId.id)
]).subscribe((entityInfo) => {
var stateParams = widgetContext
.stateController
.getStateParams();
// getting information for customization
console.log('entityInfo ========>',
entityInfo);
var entityRelations = [];
if (entityInfo[0] && entityInfo[0]
.length >
0) {
entityInfo[0].forEach((
data) => {
entityRelations
.push(data
.to);
})
console.log('entityRelations',
entityRelations)
}
stateParams = {
entityId: entityId,
entityName: entityName,
entityLabel: entityLabel,
attributes: {
status: entityRelations,
trucks: entityRelations
}
};
var stateNameFromEntity = entityName
.replace(/\s+/g, '_')
.toLowerCase();
console.log('stateParams ========>',
stateParams);
// widgetContext.stateController.openState(
// stateNameFromEntity,
// stateParams);
// widgetContext.stateController.pushAndOpenState([stateNameFromEntity]);
widgetContext.stateController
.updateState(
'',
stateParams);
});
}
function findObjectInfoByAlias(obj, aliasName) {
for (let [index, [key, value]] of Object.entries(Object.entries(obj))) {
if (value.alias === aliasName) {
return {
index: index,
key: key,
value: value
};
}
}
}
Last active
August 21, 2022 04:19
-
-
Save mustakim/fd2ae1537e3b8ddb2f58a9364ffacccc to your computer and use it in GitHub Desktop.
tesenso wiki
- System Administrator: sysadmin@thingsboard.org / sysadmin
- Tenant Administrator: tenant@thingsboard.org / tenant
- Customer User: customer@thingsboard.org / customer
- User groups
- Customer groups
- Asset groups
- Device groups
- Entity view groups
- Edge groups
- Dashboard groups
Group Generic Configs
- CREATE_GROUP Config
{
"additionalInfo": {"description": "string"}
"description": "string"
"name": "string"
"type": "EnumGroupType"
}
- GET_GROUP Config
{
"id": {
"entityType": "ENTITY_GROUP",
"id": "UUID"
},
"createdTime": "Epoch Time",
"type": "EnumGroupType",
"name": "string",
"ownerId": {
"entityType": "EnumEntityType",
"id": "UUID"
},
"additionalInfo": {
"description": "string"
},
"configuration": {
"columns": [
{
"type": "EnumType",
"key": "string",
"sortOrder": "DESC" | "ASC"
} ...
],
"settings": "object",
"actions": "object"
},
"ownerIds": [
{
"entityType": "EnumEntityType",
"id": "UUID"
}
],
"edgeGroupAll": "boolean",
"groupAll": "boolean"
}
Common API Endpoint
- POST -
/entityGroups
- CREATE_GROUP - GET_GROUP - GET -
/entityGroup/{group_id}
- GET_GROUP - DELETE -
/entityGroup/{group_id}
Group API Endpoints
- GET -
/entityGroups/{EnumGroupName}
- No Payload - list of GET_GROUP- ex: For User Group:
/entityGroups/USER
- ex: For User Group:
- System Administrator: sysadmin@thingsboard.org / sysadmin
- Tenant Administrator: tenant@thingsboard.org / tenant
- Customer User: customer@thingsboard.org / customer
- Java
- Maven
- Postgres
- Node
MNL - ThingsBoard UI NGX setup:
"float": "^1.0.2", "flot": "github:thingsboard/flot#0.9-work", "flot.curvedlines": "github:MichaelZinsmaier/CurvedLines#master", "ngx-flowchart": "github:thingsboard/ngx-flowchart#release/1.0.0",
URL from user home: Documents\Development\Projects\mnl-thingsboard-rnd
- server (build completed)
- core (build completed)
- integration-http (build completed)
- rule-engine (build completed)
- transport-http (build completed)
- core - for application
- integration-http
- rule-engine
- transport-http
- integration-mqtt - for MQTT service
- User groups
- Customer groups
- Asset groups
- Device groups
- Entity view groups
- Edge groups
- Dashboard groups
==> Generic Role:
- Each Role is related to one or more user group
- Each user group has only one owner
MQTT Client ID: integration-2bd96ac2-089c-61ee-0564-559e7f9bb12b Username: {"deviceName":"Sample Final device test","deviceType":"Custom Device Profile"}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment