Browse Source

UI: QUEUE_STATS for API usage

pull/10145/head
rusikv 3 years ago
parent
commit
a018cdf09a
  1. 94
      application/src/main/data/json/demo/dashboards/rule_engine_statistics.json
  2. 5
      ui-ngx/src/app/core/http/entity.service.ts
  3. 2
      ui-ngx/src/app/modules/home/components/profile/asset-profile.component.html
  4. 4
      ui-ngx/src/app/modules/home/components/profile/asset-profile.component.ts
  5. 9
      ui-ngx/src/app/modules/home/pages/asset-profile/asset-profiles-table-config.resolver.ts
  6. 2
      ui-ngx/src/app/shared/models/asset.models.ts
  7. 8
      ui-ngx/src/app/shared/models/entity-type.models.ts
  8. 10
      ui-ngx/src/app/shared/models/entity.models.ts
  9. 3
      ui-ngx/src/app/shared/models/query/query.models.ts
  10. 94
      ui-ngx/src/assets/dashboard/api_usage.json
  11. 6
      ui-ngx/src/assets/locale/locale.constant-en_US.json

94
application/src/main/data/json/demo/dashboards/rule_engine_statistics.json

@ -13,6 +13,7 @@
"datasources": [
{
"type": "entity",
"entityAliasId": "140f23dd-e3a0-ed98-6189-03c49d2d8018",
"dataKeys": [
{
"name": "successfulMsgs",
@ -105,7 +106,24 @@
"_hash": 0.49891007198715376
}
],
"entityAliasId": "26f9d890-9611-acd4-1cdb-e0a77fd0e7ba"
"latestDataKeys": [
{
"name": "queueName",
"type": "entityField",
"label": "Queue name",
"color": "#ffc107",
"settings": {},
"_hash": 0.019706324241253403
},
{
"name": "serviceId",
"type": "entityField",
"label": "Service Id",
"color": "#607d8b",
"settings": {},
"_hash": 0.6439850190675356
}
]
}
],
"timewindow": {
@ -190,6 +208,7 @@
"datasources": [
{
"type": "entity",
"entityAliasId": "140f23dd-e3a0-ed98-6189-03c49d2d8018",
"dataKeys": [
{
"name": "ruleEngineException",
@ -228,7 +247,54 @@
"_hash": 0.7255162989552142
}
],
"entityAliasId": "26f9d890-9611-acd4-1cdb-e0a77fd0e7ba"
"latestDataKeys": [
{
"name": "queueName",
"type": "entityField",
"label": "Queue name",
"color": "#ffc107",
"settings": {
"show": false,
"order": null,
"useCellStyleFunction": false,
"cellStyleFunction": "",
"useCellContentFunction": false,
"cellContentFunction": "",
"defaultColumnVisibility": "visible",
"columnSelectionToDisplay": "enabled"
},
"_hash": 0.15709042234841886,
"aggregationType": null,
"units": null,
"decimals": null,
"funcBody": null,
"usePostProcessing": null,
"postFuncBody": null
},
{
"name": "serviceId",
"type": "entityField",
"label": "Service Id",
"color": "#607d8b",
"settings": {
"show": false,
"order": null,
"useCellStyleFunction": false,
"cellStyleFunction": "",
"useCellContentFunction": false,
"cellContentFunction": "",
"defaultColumnVisibility": "visible",
"columnSelectionToDisplay": "enabled"
},
"_hash": 0.13037127418736705,
"aggregationType": null,
"units": null,
"decimals": null,
"funcBody": null,
"usePostProcessing": null,
"postFuncBody": null
}
]
}
],
"timewindow": {
@ -279,6 +345,7 @@
"datasources": [
{
"type": "entity",
"entityAliasId": "140f23dd-e3a0-ed98-6189-03c49d2d8018",
"dataKeys": [
{
"name": "timeoutMsgs",
@ -341,7 +408,24 @@
"_hash": 0.2679547062508352
}
],
"entityAliasId": "26f9d890-9611-acd4-1cdb-e0a77fd0e7ba"
"latestDataKeys": [
{
"name": "queueName",
"type": "entityField",
"label": "Queue name",
"color": "#f44336",
"settings": {},
"_hash": 0.009348067096302426
},
{
"name": "serviceId",
"type": "entityField",
"label": "Service Id",
"color": "#ffc107",
"settings": {},
"_hash": 0.4586005983243109
}
]
}
],
"timewindow": {
@ -463,8 +547,8 @@
}
},
"entityAliases": {
"26f9d890-9611-acd4-1cdb-e0a77fd0e7ba": {
"id": "26f9d890-9611-acd4-1cdb-e0a77fd0e7ba",
"140f23dd-e3a0-ed98-6189-03c49d2d8018": {
"id": "140f23dd-e3a0-ed98-6189-03c49d2d8018",
"alias": "TbServiceQueues",
"filter": {
"type": "entityType",

5
ui-ngx/src/app/core/http/entity.service.ts

@ -716,6 +716,7 @@ export class EntityService {
entityTypes.push(EntityType.CUSTOMER);
entityTypes.push(EntityType.USER);
entityTypes.push(EntityType.DASHBOARD);
entityTypes.push(EntityType.QUEUE_STATS);
if (authState.edgesSupportEnabled) {
entityTypes.push(EntityType.EDGE);
}
@ -795,6 +796,10 @@ export class EntityService {
case EntityType.API_USAGE_STATE:
entityFieldKeys.push(entityFields.name.keyName);
break;
case EntityType.QUEUE_STATS:
entityFieldKeys.push(entityFields.queueName.keyName);
entityFieldKeys.push(entityFields.serviceId.keyName);
break;
}
return query ? entityFieldKeys.filter((entityField) => entityField.toLowerCase().indexOf(query) === 0) : entityFieldKeys;
}

2
ui-ngx/src/app/modules/home/components/profile/asset-profile.component.html

@ -31,7 +31,7 @@
<button mat-raised-button color="primary"
[disabled]="(isLoading$ | async)"
(click)="onEntityAction($event, 'setDefault')"
[fxShow]="!isEdit && !entity?.default && entity?.name !== TB_SERVICE_QUEUE">
[fxShow]="!isEdit && !entity?.default">
{{'asset-profile.set-default' | translate }}
</button>
<button mat-raised-button color="primary"

4
ui-ngx/src/app/modules/home/components/profile/asset-profile.component.ts

@ -27,7 +27,7 @@ import { RuleChainId } from '@shared/models/id/rule-chain-id';
import { ServiceType } from '@shared/models/queue.models';
import { EntityId } from '@shared/models/id/entity-id';
import { DashboardId } from '@shared/models/id/dashboard-id';
import { AssetProfile, TB_SERVICE_QUEUE } from '@shared/models/asset.models';
import { AssetProfile } from '@shared/models/asset.models';
import { RuleChainType } from '@shared/models/rule-chain.models';
@Component({
@ -46,8 +46,6 @@ export class AssetProfileComponent extends EntityComponent<AssetProfile> {
edgeRuleChainType = RuleChainType.EDGE;
TB_SERVICE_QUEUE = TB_SERVICE_QUEUE;
assetProfileId: EntityId;
constructor(protected store: Store<AppState>,

9
ui-ngx/src/app/modules/home/pages/asset-profile/asset-profiles-table-config.resolver.ts

@ -31,7 +31,7 @@ import { DialogService } from '@core/services/dialog.service';
import { MatDialog } from '@angular/material/dialog';
import { ImportExportService } from '@shared/import-export/import-export.service';
import { HomeDialogsService } from '@home/dialogs/home-dialogs.service';
import { AssetProfile, TB_SERVICE_QUEUE } from '@shared/models/asset.models';
import { AssetProfile } from '@shared/models/asset.models';
import { AssetProfileService } from '@core/http/asset-profile.service';
import { AssetProfileComponent } from '@home/components/profile/asset-profile.component';
import { AssetProfileTabsComponent } from './asset-profile-tabs.component';
@ -78,7 +78,7 @@ export class AssetProfilesTableConfigResolver implements Resolve<EntityTableConf
{
name: this.translate.instant('asset-profile.set-default'),
icon: 'flag',
isEnabled: (assetProfile) => !assetProfile.default && TB_SERVICE_QUEUE !== assetProfile.name,
isEnabled: (assetProfile) => !assetProfile.default,
onAction: ($event, entity) => this.setDefaultAssetProfile($event, entity)
}
);
@ -94,9 +94,8 @@ export class AssetProfilesTableConfigResolver implements Resolve<EntityTableConf
this.config.saveEntity = assetProfile => this.assetProfileService.saveAssetProfile(assetProfile);
this.config.deleteEntity = id => this.assetProfileService.deleteAssetProfile(id.id);
this.config.onEntityAction = action => this.onAssetProfileAction(action);
this.config.deleteEnabled = (assetProfile) => assetProfile && !assetProfile.default && TB_SERVICE_QUEUE !== assetProfile.name;
this.config.entitySelectionEnabled = (assetProfile) => assetProfile && !assetProfile.default && TB_SERVICE_QUEUE !== assetProfile.name;
this.config.detailsReadonly = (assetProfile) => assetProfile && TB_SERVICE_QUEUE === assetProfile.name;
this.config.deleteEnabled = (assetProfile) => assetProfile && !assetProfile.default;
this.config.entitySelectionEnabled = (assetProfile) => assetProfile && !assetProfile.default;
this.config.addActionDescriptors = this.configureAddActions();
}

2
ui-ngx/src/app/shared/models/asset.models.ts

@ -24,8 +24,6 @@ import { RuleChainId } from '@shared/models/id/rule-chain-id';
import { DashboardId } from '@shared/models/id/dashboard-id';
import { EntityInfoData, HasTenantId } from '@shared/models/entity.models';
export const TB_SERVICE_QUEUE = 'TbServiceQueue';
export interface AssetProfile extends BaseData<AssetProfileId>, HasTenantId, ExportableEntity<AssetProfileId> {
tenantId?: TenantId;
name: string;

8
ui-ngx/src/app/shared/models/entity-type.models.ts

@ -39,6 +39,7 @@ export enum EntityType {
OTA_PACKAGE = 'OTA_PACKAGE',
RPC = 'RPC',
QUEUE = 'QUEUE',
QUEUE_STATS = 'QUEUE_STATS',
NOTIFICATION = 'NOTIFICATION',
NOTIFICATION_REQUEST = 'NOTIFICATION_REQUEST',
NOTIFICATION_RULE = 'NOTIFICATION_RULE',
@ -362,6 +363,13 @@ export const entityTypeTranslations = new Map<EntityType | AliasEntityType, Enti
selectedEntities: 'queue.selected-queues'
}
],
[
EntityType.QUEUE_STATS,
{
type: 'entity.type-queue-stats',
typePlural: 'entity.type-queues-stats'
}
],
[
EntityType.NOTIFICATION,
{

10
ui-ngx/src/app/shared/models/entity.models.ts

@ -161,6 +161,16 @@ export const entityFields: {[fieldName: string]: EntityField} = {
keyName: 'label',
name: 'entity-field.label',
value: 'label'
},
queueName: {
keyName: 'queueName',
name: 'entity-field.queue-name',
value: 'queueName'
},
serviceId: {
keyName: 'serviceId',
name: 'entity-field.service-id',
value: 'serviceId'
}
};

3
ui-ngx/src/app/shared/models/query/query.models.ts

@ -885,6 +885,9 @@ export function entityDataToEntityInfo(entityData: EntityData): EntityInfo {
} catch (e) {}
}
}
if (fields.queueName && fields.serviceId) {
entityInfo.name = fields.queueName.value + '_' + fields.serviceId.value;
}
}
return entityInfo;
}

94
ui-ngx/src/assets/dashboard/api_usage.json

@ -3637,6 +3637,7 @@
"datasources": [
{
"type": "entity",
"entityAliasId": "2e4c97b0-257a-a1b9-690c-141d9bf2ec6f",
"dataKeys": [
{
"name": "successfulMsgs",
@ -3729,7 +3730,24 @@
"_hash": 0.49891007198715376
}
],
"entityAliasId": "1fcc06b0-ba0d-11ee-8765-750128ef3ba9"
"latestDataKeys": [
{
"name": "queueName",
"type": "entityField",
"label": "Queue name",
"color": "#ffc107",
"settings": {},
"_hash": 0.11177210715294739
},
{
"name": "serviceId",
"type": "entityField",
"label": "Service Id",
"color": "#607d8b",
"settings": {},
"_hash": 0.0001434357629259697
}
]
}
],
"timewindow": {
@ -3818,6 +3836,7 @@
"datasources": [
{
"type": "entity",
"entityAliasId": "2e4c97b0-257a-a1b9-690c-141d9bf2ec6f",
"dataKeys": [
{
"name": "timeoutMsgs",
@ -3880,7 +3899,24 @@
"_hash": 0.2679547062508352
}
],
"entityAliasId": "1fcc06b0-ba0d-11ee-8765-750128ef3ba9"
"latestDataKeys": [
{
"name": "queueName",
"type": "entityField",
"label": "Queue name",
"color": "#f44336",
"settings": {},
"_hash": 0.20402776006381784
},
{
"name": "serviceId",
"type": "entityField",
"label": "Service Id",
"color": "#ffc107",
"settings": {},
"_hash": 0.3926008488095458
}
]
}
],
"timewindow": {
@ -3969,6 +4005,7 @@
"datasources": [
{
"type": "entity",
"entityAliasId": "2e4c97b0-257a-a1b9-690c-141d9bf2ec6f",
"dataKeys": [
{
"name": "ruleEngineException",
@ -4007,7 +4044,54 @@
"_hash": 0.7255162989552142
}
],
"entityAliasId": "1fcc06b0-ba0d-11ee-8765-750128ef3ba9"
"latestDataKeys": [
{
"name": "queueName",
"type": "entityField",
"label": "Queue name",
"color": "#ffc107",
"settings": {
"show": false,
"order": null,
"useCellStyleFunction": false,
"cellStyleFunction": "",
"useCellContentFunction": false,
"cellContentFunction": "",
"defaultColumnVisibility": "visible",
"columnSelectionToDisplay": "enabled"
},
"_hash": 0.5285486822242347,
"aggregationType": null,
"units": null,
"decimals": null,
"funcBody": null,
"usePostProcessing": null,
"postFuncBody": null
},
{
"name": "serviceId",
"type": "entityField",
"label": "Service Id",
"color": "#607d8b",
"settings": {
"show": false,
"order": null,
"useCellStyleFunction": false,
"cellStyleFunction": "",
"useCellContentFunction": false,
"cellContentFunction": "",
"defaultColumnVisibility": "visible",
"columnSelectionToDisplay": "enabled"
},
"_hash": 0.2512602689087131,
"aggregationType": null,
"units": null,
"decimals": null,
"funcBody": null,
"usePostProcessing": null,
"postFuncBody": null
}
]
}
],
"timewindow": {
@ -4880,8 +4964,8 @@
"resolveMultiple": false
}
},
"1fcc06b0-ba0d-11ee-8765-750128ef3ba9": {
"id": "1fcc06b0-ba0d-11ee-8765-750128ef3ba9",
"2e4c97b0-257a-a1b9-690c-141d9bf2ec6f": {
"id": "2e4c97b0-257a-a1b9-690c-141d9bf2ec6f",
"alias": "TbServiceQueues",
"filter": {
"type": "entityType",

6
ui-ngx/src/assets/locale/locale.constant-en_US.json

@ -2223,6 +2223,8 @@
"type-ota-package": "OTA package",
"type-rpc": "RPC",
"type-queue": "Queue",
"type-queue-stats": "Queue statistics",
"type-queues-stats": "Queues statistics",
"type-notification": "Notification",
"type-notification-rule": "Notification rule",
"type-notification-rules": "Notification rules",
@ -2250,7 +2252,9 @@
"address2": "Address 2",
"zip": "Zip",
"phone": "Phone",
"label": "Label"
"label": "Label",
"queue-name": "Queue name",
"service-id": "Service Id"
},
"entity-view": {
"entity-view": "Entity view",

Loading…
Cancel
Save