From a018cdf09a807d0237ac74587fca5e62169518de Mon Sep 17 00:00:00 2001 From: rusikv Date: Tue, 13 Feb 2024 13:01:39 +0200 Subject: [PATCH] UI: QUEUE_STATS for API usage --- .../dashboards/rule_engine_statistics.json | 94 ++++++++++++++++++- ui-ngx/src/app/core/http/entity.service.ts | 5 + .../profile/asset-profile.component.html | 2 +- .../profile/asset-profile.component.ts | 4 +- .../asset-profiles-table-config.resolver.ts | 9 +- ui-ngx/src/app/shared/models/asset.models.ts | 2 - .../app/shared/models/entity-type.models.ts | 8 ++ ui-ngx/src/app/shared/models/entity.models.ts | 10 ++ .../app/shared/models/query/query.models.ts | 3 + ui-ngx/src/assets/dashboard/api_usage.json | 94 ++++++++++++++++++- .../assets/locale/locale.constant-en_US.json | 6 +- 11 files changed, 215 insertions(+), 22 deletions(-) diff --git a/application/src/main/data/json/demo/dashboards/rule_engine_statistics.json b/application/src/main/data/json/demo/dashboards/rule_engine_statistics.json index 2a079fcd9d..576b1432ff 100644 --- a/application/src/main/data/json/demo/dashboards/rule_engine_statistics.json +++ b/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", diff --git a/ui-ngx/src/app/core/http/entity.service.ts b/ui-ngx/src/app/core/http/entity.service.ts index b29fd6c9a0..ce1c26f17d 100644 --- a/ui-ngx/src/app/core/http/entity.service.ts +++ b/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; } diff --git a/ui-ngx/src/app/modules/home/components/profile/asset-profile.component.html b/ui-ngx/src/app/modules/home/components/profile/asset-profile.component.html index 5bf94d5c86..67f3bcdf13 100644 --- a/ui-ngx/src/app/modules/home/components/profile/asset-profile.component.html +++ b/ui-ngx/src/app/modules/home/components/profile/asset-profile.component.html @@ -31,7 +31,7 @@