@solidxai/core 0.1.10-beta.22 → 0.1.10-beta.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/info.command.d.ts.map +1 -1
- package/dist/commands/info.command.js +0 -2
- package/dist/commands/info.command.js.map +1 -1
- package/dist/controllers/dashboard-user-layout.controller.d.ts +43 -0
- package/dist/controllers/dashboard-user-layout.controller.d.ts.map +1 -0
- package/dist/controllers/{dashboard-variable.controller.js → dashboard-user-layout.controller.js} +30 -30
- package/dist/controllers/dashboard-user-layout.controller.js.map +1 -0
- package/dist/controllers/dashboard.controller.d.ts +12 -42
- package/dist/controllers/dashboard.controller.d.ts.map +1 -1
- package/dist/controllers/dashboard.controller.js +71 -141
- package/dist/controllers/dashboard.controller.js.map +1 -1
- package/dist/decorators/dashboard-widget-data-provider.decorator.d.ts +3 -0
- package/dist/decorators/dashboard-widget-data-provider.decorator.d.ts.map +1 -0
- package/dist/decorators/dashboard-widget-data-provider.decorator.js +8 -0
- package/dist/decorators/dashboard-widget-data-provider.decorator.js.map +1 -0
- package/dist/dtos/create-dashboard-user-layout.dto.d.ts +10 -0
- package/dist/dtos/create-dashboard-user-layout.dto.d.ts.map +1 -0
- package/dist/dtos/create-dashboard-user-layout.dto.js +66 -0
- package/dist/dtos/create-dashboard-user-layout.dto.js.map +1 -0
- package/dist/dtos/dashboard-variable-options-query.dto.d.ts +7 -0
- package/dist/dtos/dashboard-variable-options-query.dto.d.ts.map +1 -0
- package/dist/dtos/dashboard-variable-options-query.dto.js +40 -0
- package/dist/dtos/dashboard-variable-options-query.dto.js.map +1 -0
- package/dist/dtos/dashboard-widget-data-request.dto.d.ts +12 -0
- package/dist/dtos/dashboard-widget-data-request.dto.d.ts.map +1 -0
- package/dist/dtos/dashboard-widget-data-request.dto.js +65 -0
- package/dist/dtos/dashboard-widget-data-request.dto.js.map +1 -0
- package/dist/dtos/update-dashboard-user-layout.dto.d.ts +11 -0
- package/dist/dtos/update-dashboard-user-layout.dto.d.ts.map +1 -0
- package/dist/dtos/{update-dashboard-layout.dto.js → update-dashboard-user-layout.dto.js} +34 -16
- package/dist/dtos/update-dashboard-user-layout.dto.js.map +1 -0
- package/dist/entities/dashboard-user-layout.entity.d.ts +11 -0
- package/dist/entities/dashboard-user-layout.entity.d.ts.map +1 -0
- package/dist/entities/dashboard-user-layout.entity.js +52 -0
- package/dist/entities/dashboard-user-layout.entity.js.map +1 -0
- package/dist/helpers/module-metadata-helper.service.d.ts.map +1 -1
- package/dist/helpers/module-metadata-helper.service.js +15 -4
- package/dist/helpers/module-metadata-helper.service.js.map +1 -1
- package/dist/helpers/solid-registry.d.ts +5 -9
- package/dist/helpers/solid-registry.d.ts.map +1 -1
- package/dist/helpers/solid-registry.js +13 -28
- package/dist/helpers/solid-registry.js.map +1 -1
- package/dist/index.d.ts +21 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -5
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +24 -13
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/interfaces.js.map +1 -1
- package/dist/jobs/database/trigger-mcp-client-subscriber-database.service.d.ts +1 -3
- package/dist/jobs/database/trigger-mcp-client-subscriber-database.service.d.ts.map +1 -1
- package/dist/jobs/database/trigger-mcp-client-subscriber-database.service.js +2 -25
- package/dist/jobs/database/trigger-mcp-client-subscriber-database.service.js.map +1 -1
- package/dist/{repository/dashboard-layout.repository.d.ts → repositories/dashboard-user-layout.repository.d.ts} +5 -5
- package/dist/repositories/dashboard-user-layout.repository.d.ts.map +1 -0
- package/dist/{repository/dashboard-question-sql-dataset-config.repository.js → repositories/dashboard-user-layout.repository.js} +15 -10
- package/dist/repositories/dashboard-user-layout.repository.js.map +1 -0
- package/dist/seeders/module-metadata-seeder.service.d.ts +1 -6
- package/dist/seeders/module-metadata-seeder.service.d.ts.map +1 -1
- package/dist/seeders/module-metadata-seeder.service.js +1 -60
- package/dist/seeders/module-metadata-seeder.service.js.map +1 -1
- package/dist/seeders/seed-data/solid-core-metadata.json +6203 -6690
- package/dist/services/dashboard-providers/mq-dashboard-avg-elapsed-kpi-provider.service.d.ts +13 -0
- package/dist/services/dashboard-providers/mq-dashboard-avg-elapsed-kpi-provider.service.d.ts.map +1 -0
- package/dist/services/dashboard-providers/mq-dashboard-avg-elapsed-kpi-provider.service.js +55 -0
- package/dist/services/dashboard-providers/mq-dashboard-avg-elapsed-kpi-provider.service.js.map +1 -0
- package/dist/services/dashboard-providers/mq-dashboard-failed-messages-kpi-provider.service.d.ts +13 -0
- package/dist/services/dashboard-providers/mq-dashboard-failed-messages-kpi-provider.service.d.ts.map +1 -0
- package/dist/services/dashboard-providers/mq-dashboard-failed-messages-kpi-provider.service.js +52 -0
- package/dist/services/dashboard-providers/mq-dashboard-failed-messages-kpi-provider.service.js.map +1 -0
- package/dist/services/dashboard-providers/mq-dashboard-inflight-messages-kpi-provider.service.d.ts +13 -0
- package/dist/services/dashboard-providers/mq-dashboard-inflight-messages-kpi-provider.service.d.ts.map +1 -0
- package/dist/services/dashboard-providers/mq-dashboard-inflight-messages-kpi-provider.service.js +52 -0
- package/dist/services/dashboard-providers/mq-dashboard-inflight-messages-kpi-provider.service.js.map +1 -0
- package/dist/services/dashboard-providers/mq-dashboard-latency-trend-provider.service.d.ts +10 -0
- package/dist/services/dashboard-providers/mq-dashboard-latency-trend-provider.service.d.ts.map +1 -0
- package/dist/services/dashboard-providers/mq-dashboard-latency-trend-provider.service.js +62 -0
- package/dist/services/dashboard-providers/mq-dashboard-latency-trend-provider.service.js.map +1 -0
- package/dist/services/dashboard-providers/mq-dashboard-messages-over-time-provider.service.d.ts +10 -0
- package/dist/services/dashboard-providers/mq-dashboard-messages-over-time-provider.service.d.ts.map +1 -0
- package/dist/services/dashboard-providers/mq-dashboard-messages-over-time-provider.service.js +82 -0
- package/dist/services/dashboard-providers/mq-dashboard-messages-over-time-provider.service.js.map +1 -0
- package/dist/services/dashboard-providers/mq-dashboard-provider-utils.d.ts +17 -0
- package/dist/services/dashboard-providers/mq-dashboard-provider-utils.d.ts.map +1 -0
- package/dist/services/dashboard-providers/mq-dashboard-provider-utils.js +130 -0
- package/dist/services/dashboard-providers/mq-dashboard-provider-utils.js.map +1 -0
- package/dist/services/dashboard-providers/mq-dashboard-queue-sla-heatmap-provider.service.d.ts +37 -0
- package/dist/services/dashboard-providers/mq-dashboard-queue-sla-heatmap-provider.service.d.ts.map +1 -0
- package/dist/services/dashboard-providers/mq-dashboard-queue-sla-heatmap-provider.service.js +112 -0
- package/dist/services/dashboard-providers/mq-dashboard-queue-sla-heatmap-provider.service.js.map +1 -0
- package/dist/services/dashboard-providers/mq-dashboard-queue-wise-avg-elapsed-provider.service.d.ts +10 -0
- package/dist/services/dashboard-providers/mq-dashboard-queue-wise-avg-elapsed-provider.service.d.ts.map +1 -0
- package/dist/services/dashboard-providers/mq-dashboard-queue-wise-avg-elapsed-provider.service.js +57 -0
- package/dist/services/dashboard-providers/mq-dashboard-queue-wise-avg-elapsed-provider.service.js.map +1 -0
- package/dist/services/dashboard-providers/mq-dashboard-queue-wise-failures-provider.service.d.ts +10 -0
- package/dist/services/dashboard-providers/mq-dashboard-queue-wise-failures-provider.service.d.ts.map +1 -0
- package/dist/services/dashboard-providers/mq-dashboard-queue-wise-failures-provider.service.js +57 -0
- package/dist/services/dashboard-providers/mq-dashboard-queue-wise-failures-provider.service.js.map +1 -0
- package/dist/services/dashboard-providers/mq-dashboard-recent-failures-provider.service.d.ts +10 -0
- package/dist/services/dashboard-providers/mq-dashboard-recent-failures-provider.service.d.ts.map +1 -0
- package/dist/services/dashboard-providers/mq-dashboard-recent-failures-provider.service.js +100 -0
- package/dist/services/dashboard-providers/mq-dashboard-recent-failures-provider.service.js.map +1 -0
- package/dist/services/dashboard-providers/mq-dashboard-stage-distribution-provider.service.d.ts +10 -0
- package/dist/services/dashboard-providers/mq-dashboard-stage-distribution-provider.service.d.ts.map +1 -0
- package/dist/services/dashboard-providers/mq-dashboard-stage-distribution-provider.service.js +55 -0
- package/dist/services/dashboard-providers/mq-dashboard-stage-distribution-provider.service.js.map +1 -0
- package/dist/services/dashboard-providers/mq-dashboard-succeeded-messages-kpi-provider.service.d.ts +13 -0
- package/dist/services/dashboard-providers/mq-dashboard-succeeded-messages-kpi-provider.service.d.ts.map +1 -0
- package/dist/services/dashboard-providers/mq-dashboard-succeeded-messages-kpi-provider.service.js +52 -0
- package/dist/services/dashboard-providers/mq-dashboard-succeeded-messages-kpi-provider.service.js.map +1 -0
- package/dist/services/dashboard-providers/mq-dashboard-success-rate-kpi-provider.service.d.ts +15 -0
- package/dist/services/dashboard-providers/mq-dashboard-success-rate-kpi-provider.service.d.ts.map +1 -0
- package/dist/services/dashboard-providers/mq-dashboard-success-rate-kpi-provider.service.js +60 -0
- package/dist/services/dashboard-providers/mq-dashboard-success-rate-kpi-provider.service.js.map +1 -0
- package/dist/services/dashboard-providers/mq-dashboard-total-messages-kpi-provider.service.d.ts +13 -0
- package/dist/services/dashboard-providers/mq-dashboard-total-messages-kpi-provider.service.d.ts.map +1 -0
- package/dist/services/dashboard-providers/mq-dashboard-total-messages-kpi-provider.service.js +51 -0
- package/dist/services/dashboard-providers/mq-dashboard-total-messages-kpi-provider.service.js.map +1 -0
- package/dist/services/dashboard-runtime.service.d.ts +31 -0
- package/dist/services/dashboard-runtime.service.d.ts.map +1 -0
- package/dist/services/dashboard-runtime.service.js +408 -0
- package/dist/services/dashboard-runtime.service.js.map +1 -0
- package/dist/services/dashboard-user-layout.service.d.ts +12 -0
- package/dist/services/dashboard-user-layout.service.d.ts.map +1 -0
- package/dist/services/{dashboard-variable.service.js → dashboard-user-layout.service.js} +11 -12
- package/dist/services/dashboard-user-layout.service.js.map +1 -0
- package/dist/services/selection-providers/mq-dashboard-message-broker-variable-options-provider.service.d.ts +11 -0
- package/dist/services/selection-providers/mq-dashboard-message-broker-variable-options-provider.service.d.ts.map +1 -0
- package/dist/services/selection-providers/mq-dashboard-message-broker-variable-options-provider.service.js +59 -0
- package/dist/services/selection-providers/mq-dashboard-message-broker-variable-options-provider.service.js.map +1 -0
- package/dist/services/selection-providers/mq-dashboard-queue-name-variable-options-provider.service.d.ts +11 -0
- package/dist/services/selection-providers/mq-dashboard-queue-name-variable-options-provider.service.d.ts.map +1 -0
- package/dist/services/selection-providers/mq-dashboard-queue-name-variable-options-provider.service.js +60 -0
- package/dist/services/selection-providers/mq-dashboard-queue-name-variable-options-provider.service.js.map +1 -0
- package/dist/services/solid-introspect.service.d.ts +1 -2
- package/dist/services/solid-introspect.service.d.ts.map +1 -1
- package/dist/services/solid-introspect.service.js +12 -24
- package/dist/services/solid-introspect.service.js.map +1 -1
- package/dist/solid-core.module.d.ts.map +1 -1
- package/dist/solid-core.module.js +43 -66
- package/dist/solid-core.module.js.map +1 -1
- package/package.json +1 -1
- package/src/commands/info.command.ts +0 -2
- package/src/controllers/{dashboard-variable.controller.ts → dashboard-user-layout.controller.ts} +10 -10
- package/src/controllers/dashboard.controller.ts +70 -89
- package/src/decorators/dashboard-widget-data-provider.decorator.ts +6 -0
- package/src/dtos/create-dashboard-user-layout.dto.ts +41 -0
- package/src/dtos/dashboard-variable-options-query.dto.ts +20 -0
- package/src/dtos/dashboard-widget-data-request.dto.ts +34 -0
- package/src/dtos/update-dashboard-user-layout.dto.ts +45 -0
- package/src/entities/dashboard-user-layout.entity.ts +27 -0
- package/src/helpers/module-metadata-helper.service.ts +21 -6
- package/src/helpers/solid-registry.ts +15 -36
- package/src/index.ts +21 -5
- package/src/interfaces.ts +32 -19
- package/src/jobs/database/trigger-mcp-client-subscriber-database.service.ts +1 -34
- package/src/repositories/dashboard-user-layout.repository.ts +19 -0
- package/src/seeders/module-metadata-seeder.service.ts +0 -67
- package/src/seeders/seed-data/solid-core-metadata.json +6204 -6691
- package/src/services/dashboard-providers/README.md +603 -0
- package/src/services/dashboard-providers/mq-dashboard-avg-elapsed-kpi-provider.service.ts +49 -0
- package/src/services/dashboard-providers/mq-dashboard-failed-messages-kpi-provider.service.ts +45 -0
- package/src/services/dashboard-providers/mq-dashboard-inflight-messages-kpi-provider.service.ts +45 -0
- package/src/services/dashboard-providers/mq-dashboard-latency-trend-provider.service.ts +58 -0
- package/src/services/dashboard-providers/mq-dashboard-messages-over-time-provider.service.ts +79 -0
- package/src/services/dashboard-providers/mq-dashboard-provider-utils.ts +165 -0
- package/src/services/dashboard-providers/mq-dashboard-queue-sla-heatmap-provider.service.ts +155 -0
- package/src/services/dashboard-providers/mq-dashboard-queue-wise-avg-elapsed-provider.service.ts +51 -0
- package/src/services/dashboard-providers/mq-dashboard-queue-wise-failures-provider.service.ts +51 -0
- package/src/services/dashboard-providers/mq-dashboard-recent-failures-provider.service.ts +95 -0
- package/src/services/dashboard-providers/mq-dashboard-stage-distribution-provider.service.ts +49 -0
- package/src/services/dashboard-providers/mq-dashboard-succeeded-messages-kpi-provider.service.ts +45 -0
- package/src/services/dashboard-providers/mq-dashboard-success-rate-kpi-provider.service.ts +55 -0
- package/src/services/dashboard-providers/mq-dashboard-total-messages-kpi-provider.service.ts +44 -0
- package/src/services/dashboard-runtime.service.ts +488 -0
- package/src/services/dashboard-user-layout.service.ts +20 -0
- package/src/services/selection-providers/mq-dashboard-message-broker-variable-options-provider.service.ts +52 -0
- package/src/services/selection-providers/mq-dashboard-queue-name-variable-options-provider.service.ts +51 -0
- package/src/services/solid-introspect.service.ts +19 -34
- package/src/solid-core.module.ts +43 -72
- package/dist/controllers/dashboard-layout.controller.d.ts +0 -47
- package/dist/controllers/dashboard-layout.controller.d.ts.map +0 -1
- package/dist/controllers/dashboard-layout.controller.js +0 -204
- package/dist/controllers/dashboard-layout.controller.js.map +0 -1
- package/dist/controllers/dashboard-question-sql-dataset-config.controller.d.ts +0 -43
- package/dist/controllers/dashboard-question-sql-dataset-config.controller.d.ts.map +0 -1
- package/dist/controllers/dashboard-question-sql-dataset-config.controller.js +0 -179
- package/dist/controllers/dashboard-question-sql-dataset-config.controller.js.map +0 -1
- package/dist/controllers/dashboard-question.controller.d.ts +0 -45
- package/dist/controllers/dashboard-question.controller.d.ts.map +0 -1
- package/dist/controllers/dashboard-question.controller.js +0 -194
- package/dist/controllers/dashboard-question.controller.js.map +0 -1
- package/dist/controllers/dashboard-variable.controller.d.ts +0 -43
- package/dist/controllers/dashboard-variable.controller.d.ts.map +0 -1
- package/dist/controllers/dashboard-variable.controller.js.map +0 -1
- package/dist/decorators/dashboard-question-data-provider.decorator.d.ts +0 -3
- package/dist/decorators/dashboard-question-data-provider.decorator.d.ts.map +0 -1
- package/dist/decorators/dashboard-question-data-provider.decorator.js +0 -11
- package/dist/decorators/dashboard-question-data-provider.decorator.js.map +0 -1
- package/dist/decorators/dashboard-selection-provider.decorator.d.ts +0 -3
- package/dist/decorators/dashboard-selection-provider.decorator.d.ts.map +0 -1
- package/dist/decorators/dashboard-selection-provider.decorator.js +0 -11
- package/dist/decorators/dashboard-selection-provider.decorator.js.map +0 -1
- package/dist/dtos/create-dashboard-layout.dto.d.ts +0 -8
- package/dist/dtos/create-dashboard-layout.dto.d.ts.map +0 -1
- package/dist/dtos/create-dashboard-layout.dto.js +0 -53
- package/dist/dtos/create-dashboard-layout.dto.js.map +0 -1
- package/dist/dtos/create-dashboard-question-sql-dataset-config.dto.d.ts +0 -12
- package/dist/dtos/create-dashboard-question-sql-dataset-config.dto.d.ts.map +0 -1
- package/dist/dtos/create-dashboard-question-sql-dataset-config.dto.js +0 -77
- package/dist/dtos/create-dashboard-question-sql-dataset-config.dto.js.map +0 -1
- package/dist/dtos/create-dashboard-question.dto.d.ts +0 -17
- package/dist/dtos/create-dashboard-question.dto.d.ts.map +0 -1
- package/dist/dtos/create-dashboard-question.dto.js +0 -105
- package/dist/dtos/create-dashboard-question.dto.js.map +0 -1
- package/dist/dtos/create-dashboard-variable.dto.d.ts +0 -19
- package/dist/dtos/create-dashboard-variable.dto.d.ts.map +0 -1
- package/dist/dtos/create-dashboard-variable.dto.js +0 -103
- package/dist/dtos/create-dashboard-variable.dto.js.map +0 -1
- package/dist/dtos/create-dashboard.dto.d.ts +0 -17
- package/dist/dtos/create-dashboard.dto.d.ts.map +0 -1
- package/dist/dtos/create-dashboard.dto.js +0 -102
- package/dist/dtos/create-dashboard.dto.js.map +0 -1
- package/dist/dtos/dashboard-variable-selection-dynamic-query.dto.d.ts +0 -8
- package/dist/dtos/dashboard-variable-selection-dynamic-query.dto.d.ts.map +0 -1
- package/dist/dtos/dashboard-variable-selection-dynamic-query.dto.js +0 -52
- package/dist/dtos/dashboard-variable-selection-dynamic-query.dto.js.map +0 -1
- package/dist/dtos/update-dashboard-layout.dto.d.ts +0 -8
- package/dist/dtos/update-dashboard-layout.dto.d.ts.map +0 -1
- package/dist/dtos/update-dashboard-layout.dto.js.map +0 -1
- package/dist/dtos/update-dashboard-question-sql-dataset-config.dto.d.ts +0 -13
- package/dist/dtos/update-dashboard-question-sql-dataset-config.dto.d.ts.map +0 -1
- package/dist/dtos/update-dashboard-question-sql-dataset-config.dto.js +0 -86
- package/dist/dtos/update-dashboard-question-sql-dataset-config.dto.js.map +0 -1
- package/dist/dtos/update-dashboard-question.dto.d.ts +0 -18
- package/dist/dtos/update-dashboard-question.dto.d.ts.map +0 -1
- package/dist/dtos/update-dashboard-question.dto.js +0 -112
- package/dist/dtos/update-dashboard-question.dto.js.map +0 -1
- package/dist/dtos/update-dashboard-variable.dto.d.ts +0 -16
- package/dist/dtos/update-dashboard-variable.dto.d.ts.map +0 -1
- package/dist/dtos/update-dashboard-variable.dto.js +0 -101
- package/dist/dtos/update-dashboard-variable.dto.js.map +0 -1
- package/dist/dtos/update-dashboard.dto.d.ts +0 -18
- package/dist/dtos/update-dashboard.dto.d.ts.map +0 -1
- package/dist/dtos/update-dashboard.dto.js +0 -108
- package/dist/dtos/update-dashboard.dto.js.map +0 -1
- package/dist/entities/dashboard-layout.entity.d.ts +0 -9
- package/dist/entities/dashboard-layout.entity.d.ts.map +0 -1
- package/dist/entities/dashboard-layout.entity.js +0 -41
- package/dist/entities/dashboard-layout.entity.js.map +0 -1
- package/dist/entities/dashboard-question-sql-dataset-config.entity.d.ts +0 -14
- package/dist/entities/dashboard-question-sql-dataset-config.entity.d.ts.map +0 -1
- package/dist/entities/dashboard-question-sql-dataset-config.entity.js +0 -66
- package/dist/entities/dashboard-question-sql-dataset-config.entity.js.map +0 -1
- package/dist/entities/dashboard-question.entity.d.ts +0 -17
- package/dist/entities/dashboard-question.entity.d.ts.map +0 -1
- package/dist/entities/dashboard-question.entity.js +0 -77
- package/dist/entities/dashboard-question.entity.js.map +0 -1
- package/dist/entities/dashboard-variable.entity.d.ts +0 -16
- package/dist/entities/dashboard-variable.entity.d.ts.map +0 -1
- package/dist/entities/dashboard-variable.entity.js +0 -79
- package/dist/entities/dashboard-variable.entity.js.map +0 -1
- package/dist/entities/dashboard.entity.d.ts +0 -16
- package/dist/entities/dashboard.entity.d.ts.map +0 -1
- package/dist/entities/dashboard.entity.js +0 -64
- package/dist/entities/dashboard.entity.js.map +0 -1
- package/dist/mappers/dashboard-mapper.d.ts +0 -6
- package/dist/mappers/dashboard-mapper.d.ts.map +0 -1
- package/dist/mappers/dashboard-mapper.js +0 -62
- package/dist/mappers/dashboard-mapper.js.map +0 -1
- package/dist/repository/dashboard-layout.repository.d.ts.map +0 -1
- package/dist/repository/dashboard-layout.repository.js +0 -34
- package/dist/repository/dashboard-layout.repository.js.map +0 -1
- package/dist/repository/dashboard-question-sql-dataset-config.repository.d.ts +0 -12
- package/dist/repository/dashboard-question-sql-dataset-config.repository.d.ts.map +0 -1
- package/dist/repository/dashboard-question-sql-dataset-config.repository.js.map +0 -1
- package/dist/repository/dashboard-question.repository.d.ts +0 -12
- package/dist/repository/dashboard-question.repository.d.ts.map +0 -1
- package/dist/repository/dashboard-question.repository.js +0 -34
- package/dist/repository/dashboard-question.repository.js.map +0 -1
- package/dist/repository/dashboard-variable.repository.d.ts +0 -12
- package/dist/repository/dashboard-variable.repository.d.ts.map +0 -1
- package/dist/repository/dashboard-variable.repository.js +0 -34
- package/dist/repository/dashboard-variable.repository.js.map +0 -1
- package/dist/repository/dashboard.repository.d.ts +0 -13
- package/dist/repository/dashboard.repository.d.ts.map +0 -1
- package/dist/repository/dashboard.repository.js +0 -104
- package/dist/repository/dashboard.repository.js.map +0 -1
- package/dist/services/dashboard-layout.service.d.ts +0 -20
- package/dist/services/dashboard-layout.service.d.ts.map +0 -1
- package/dist/services/dashboard-layout.service.js +0 -120
- package/dist/services/dashboard-layout.service.js.map +0 -1
- package/dist/services/dashboard-question-sql-dataset-config.service.d.ts +0 -12
- package/dist/services/dashboard-question-sql-dataset-config.service.d.ts.map +0 -1
- package/dist/services/dashboard-question-sql-dataset-config.service.js +0 -38
- package/dist/services/dashboard-question-sql-dataset-config.service.js.map +0 -1
- package/dist/services/dashboard-question.service.d.ts +0 -23
- package/dist/services/dashboard-question.service.d.ts.map +0 -1
- package/dist/services/dashboard-question.service.js +0 -135
- package/dist/services/dashboard-question.service.js.map +0 -1
- package/dist/services/dashboard-selection-providers/dashboard-variable-sql-dynamic-provider.service.d.ts +0 -12
- package/dist/services/dashboard-selection-providers/dashboard-variable-sql-dynamic-provider.service.d.ts.map +0 -1
- package/dist/services/dashboard-selection-providers/dashboard-variable-sql-dynamic-provider.service.js +0 -55
- package/dist/services/dashboard-selection-providers/dashboard-variable-sql-dynamic-provider.service.js.map +0 -1
- package/dist/services/dashboard-selection-providers/dashboard-variable-test-dynamic-provider.service.d.ts +0 -11
- package/dist/services/dashboard-selection-providers/dashboard-variable-test-dynamic-provider.service.d.ts.map +0 -1
- package/dist/services/dashboard-selection-providers/dashboard-variable-test-dynamic-provider.service.js +0 -45
- package/dist/services/dashboard-selection-providers/dashboard-variable-test-dynamic-provider.service.js.map +0 -1
- package/dist/services/dashboard-variable.service.d.ts +0 -13
- package/dist/services/dashboard-variable.service.d.ts.map +0 -1
- package/dist/services/dashboard-variable.service.js.map +0 -1
- package/dist/services/dashboard.service.d.ts +0 -29
- package/dist/services/dashboard.service.d.ts.map +0 -1
- package/dist/services/dashboard.service.js +0 -171
- package/dist/services/dashboard.service.js.map +0 -1
- package/dist/services/genai/mcp-handlers/solid-add-question-to-dashboard-mcp-handler.service.d.ts +0 -12
- package/dist/services/genai/mcp-handlers/solid-add-question-to-dashboard-mcp-handler.service.d.ts.map +0 -1
- package/dist/services/genai/mcp-handlers/solid-add-question-to-dashboard-mcp-handler.service.js +0 -41
- package/dist/services/genai/mcp-handlers/solid-add-question-to-dashboard-mcp-handler.service.js.map +0 -1
- package/dist/services/genai/mcp-handlers/solid-add-variable-to-dashboard-mcp-handler.service.d.ts +0 -12
- package/dist/services/genai/mcp-handlers/solid-add-variable-to-dashboard-mcp-handler.service.d.ts.map +0 -1
- package/dist/services/genai/mcp-handlers/solid-add-variable-to-dashboard-mcp-handler.service.js +0 -42
- package/dist/services/genai/mcp-handlers/solid-add-variable-to-dashboard-mcp-handler.service.js.map +0 -1
- package/dist/services/genai/mcp-handlers/solid-create-dashboard-mcp-handler.service.d.ts +0 -25
- package/dist/services/genai/mcp-handlers/solid-create-dashboard-mcp-handler.service.d.ts.map +0 -1
- package/dist/services/genai/mcp-handlers/solid-create-dashboard-mcp-handler.service.js +0 -116
- package/dist/services/genai/mcp-handlers/solid-create-dashboard-mcp-handler.service.js.map +0 -1
- package/dist/services/genai/mcp-handlers/solid-create-dashboard-question-mcp-handler.service.d.ts +0 -12
- package/dist/services/genai/mcp-handlers/solid-create-dashboard-question-mcp-handler.service.d.ts.map +0 -1
- package/dist/services/genai/mcp-handlers/solid-create-dashboard-question-mcp-handler.service.js +0 -37
- package/dist/services/genai/mcp-handlers/solid-create-dashboard-question-mcp-handler.service.js.map +0 -1
- package/dist/services/genai/mcp-handlers/solid-create-dashboard-question-sql-dataset-config-mcp-handler.service.d.ts +0 -12
- package/dist/services/genai/mcp-handlers/solid-create-dashboard-question-sql-dataset-config-mcp-handler.service.d.ts.map +0 -1
- package/dist/services/genai/mcp-handlers/solid-create-dashboard-question-sql-dataset-config-mcp-handler.service.js +0 -38
- package/dist/services/genai/mcp-handlers/solid-create-dashboard-question-sql-dataset-config-mcp-handler.service.js.map +0 -1
- package/dist/services/genai/mcp-handlers/solid-create-dashboard-widget-mcp-handler.service.d.ts +0 -12
- package/dist/services/genai/mcp-handlers/solid-create-dashboard-widget-mcp-handler.service.d.ts.map +0 -1
- package/dist/services/genai/mcp-handlers/solid-create-dashboard-widget-mcp-handler.service.js +0 -38
- package/dist/services/genai/mcp-handlers/solid-create-dashboard-widget-mcp-handler.service.js.map +0 -1
- package/dist/services/question-data-providers/chartjs-sql-data-provider.service.d.ts +0 -34
- package/dist/services/question-data-providers/chartjs-sql-data-provider.service.d.ts.map +0 -1
- package/dist/services/question-data-providers/chartjs-sql-data-provider.service.js +0 -90
- package/dist/services/question-data-providers/chartjs-sql-data-provider.service.js.map +0 -1
- package/dist/services/question-data-providers/helpers.d.ts +0 -7
- package/dist/services/question-data-providers/helpers.d.ts.map +0 -1
- package/dist/services/question-data-providers/helpers.js +0 -25
- package/dist/services/question-data-providers/helpers.js.map +0 -1
- package/dist/services/question-data-providers/prime-react-datatable-sql-data-provider.service.d.ts +0 -14
- package/dist/services/question-data-providers/prime-react-datatable-sql-data-provider.service.d.ts.map +0 -1
- package/dist/services/question-data-providers/prime-react-datatable-sql-data-provider.service.js +0 -71
- package/dist/services/question-data-providers/prime-react-datatable-sql-data-provider.service.js.map +0 -1
- package/dist/services/question-data-providers/prime-react-meter-group-sql-data-provider.service.d.ts +0 -16
- package/dist/services/question-data-providers/prime-react-meter-group-sql-data-provider.service.d.ts.map +0 -1
- package/dist/services/question-data-providers/prime-react-meter-group-sql-data-provider.service.js +0 -93
- package/dist/services/question-data-providers/prime-react-meter-group-sql-data-provider.service.js.map +0 -1
- package/dist/services/selection-providers/list-of-dashboard-question-providers-selection-provider.service.d.ts +0 -11
- package/dist/services/selection-providers/list-of-dashboard-question-providers-selection-provider.service.d.ts.map +0 -1
- package/dist/services/selection-providers/list-of-dashboard-question-providers-selection-provider.service.js +0 -49
- package/dist/services/selection-providers/list-of-dashboard-question-providers-selection-provider.service.js.map +0 -1
- package/dist/services/selection-providers/list-of-dashboard-variable-providers-selection-provider.service.d.ts +0 -11
- package/dist/services/selection-providers/list-of-dashboard-variable-providers-selection-provider.service.d.ts.map +0 -1
- package/dist/services/selection-providers/list-of-dashboard-variable-providers-selection-provider.service.js +0 -47
- package/dist/services/selection-providers/list-of-dashboard-variable-providers-selection-provider.service.js.map +0 -1
- package/dist/services/sql-expression-resolver.service.d.ts +0 -12
- package/dist/services/sql-expression-resolver.service.d.ts.map +0 -1
- package/dist/services/sql-expression-resolver.service.js +0 -121
- package/dist/services/sql-expression-resolver.service.js.map +0 -1
- package/dist/subscribers/dashboard-question-sql-dataset-config.subscriber.d.ts +0 -16
- package/dist/subscribers/dashboard-question-sql-dataset-config.subscriber.d.ts.map +0 -1
- package/dist/subscribers/dashboard-question-sql-dataset-config.subscriber.js +0 -72
- package/dist/subscribers/dashboard-question-sql-dataset-config.subscriber.js.map +0 -1
- package/dist/subscribers/dashboard-question.subscriber.d.ts +0 -16
- package/dist/subscribers/dashboard-question.subscriber.d.ts.map +0 -1
- package/dist/subscribers/dashboard-question.subscriber.js +0 -72
- package/dist/subscribers/dashboard-question.subscriber.js.map +0 -1
- package/dist/subscribers/dashboard-variable.subscriber.d.ts +0 -16
- package/dist/subscribers/dashboard-variable.subscriber.d.ts.map +0 -1
- package/dist/subscribers/dashboard-variable.subscriber.js +0 -72
- package/dist/subscribers/dashboard-variable.subscriber.js.map +0 -1
- package/dist/subscribers/dashboard.subscriber.d.ts +0 -16
- package/dist/subscribers/dashboard.subscriber.d.ts.map +0 -1
- package/dist/subscribers/dashboard.subscriber.js +0 -71
- package/dist/subscribers/dashboard.subscriber.js.map +0 -1
- package/src/controllers/dashboard-layout.controller.ts +0 -106
- package/src/controllers/dashboard-question-sql-dataset-config.controller.ts +0 -93
- package/src/controllers/dashboard-question.controller.ts +0 -104
- package/src/decorators/dashboard-question-data-provider.decorator.ts +0 -7
- package/src/decorators/dashboard-selection-provider.decorator.ts +0 -7
- package/src/dtos/create-dashboard-layout.dto.ts +0 -31
- package/src/dtos/create-dashboard-question-sql-dataset-config.dto.ts +0 -42
- package/src/dtos/create-dashboard-question.dto.ts +0 -62
- package/src/dtos/create-dashboard-variable.dto.ts +0 -60
- package/src/dtos/create-dashboard.dto.ts +0 -61
- package/src/dtos/dashboard-variable-selection-dynamic-query.dto.ts +0 -29
- package/src/dtos/update-dashboard-layout.dto.ts +0 -30
- package/src/dtos/update-dashboard-question-sql-dataset-config.dto.ts +0 -49
- package/src/dtos/update-dashboard-question.dto.ts +0 -67
- package/src/dtos/update-dashboard-variable.dto.ts +0 -58
- package/src/dtos/update-dashboard.dto.ts +0 -65
- package/src/entities/dashboard-layout.entity.ts +0 -18
- package/src/entities/dashboard-question-sql-dataset-config.entity.ts +0 -37
- package/src/entities/dashboard-question.entity.ts +0 -46
- package/src/entities/dashboard-variable.entity.ts +0 -44
- package/src/entities/dashboard.entity.ts +0 -36
- package/src/mappers/dashboard-mapper.ts +0 -53
- package/src/repository/dashboard-layout.repository.ts +0 -17
- package/src/repository/dashboard-question-sql-dataset-config.repository.ts +0 -17
- package/src/repository/dashboard-question.repository.ts +0 -17
- package/src/repository/dashboard-variable.repository.ts +0 -17
- package/src/repository/dashboard.repository.ts +0 -101
- package/src/services/dashboard-layout.service.ts +0 -111
- package/src/services/dashboard-question-sql-dataset-config.service.ts +0 -25
- package/src/services/dashboard-question.service.ts +0 -150
- package/src/services/dashboard-selection-providers/dashboard-variable-sql-dynamic-provider.service.ts +0 -56
- package/src/services/dashboard-selection-providers/dashboard-variable-test-dynamic-provider.service.ts +0 -37
- package/src/services/dashboard-variable.service.ts +0 -27
- package/src/services/dashboard.service.ts +0 -148
- package/src/services/genai/mcp-handlers/solid-add-question-to-dashboard-mcp-handler.service.ts +0 -43
- package/src/services/genai/mcp-handlers/solid-add-variable-to-dashboard-mcp-handler.service.ts +0 -44
- package/src/services/genai/mcp-handlers/solid-create-dashboard-mcp-handler.service.ts +0 -114
- package/src/services/genai/mcp-handlers/solid-create-dashboard-question-mcp-handler.service.ts +0 -38
- package/src/services/genai/mcp-handlers/solid-create-dashboard-question-sql-dataset-config-mcp-handler.service.ts +0 -40
- package/src/services/genai/mcp-handlers/solid-create-dashboard-widget-mcp-handler.service.ts +0 -39
- package/src/services/question-data-providers/chartjs-sql-data-provider.service.ts +0 -121
- package/src/services/question-data-providers/helpers.ts +0 -30
- package/src/services/question-data-providers/prime-react-datatable-sql-data-provider.service.ts +0 -74
- package/src/services/question-data-providers/prime-react-meter-group-sql-data-provider.service.ts +0 -115
- package/src/services/selection-providers/list-of-dashboard-question-providers-selection-provider.service.ts +0 -44
- package/src/services/selection-providers/list-of-dashboard-variable-providers-selection-provider.service.ts +0 -41
- package/src/services/sql-expression-resolver.service.ts +0 -140
- package/src/subscribers/dashboard-question-sql-dataset-config.subscriber.ts +0 -61
- package/src/subscribers/dashboard-question.subscriber.ts +0 -62
- package/src/subscribers/dashboard-variable.subscriber.ts +0 -63
- package/src/subscribers/dashboard.subscriber.ts +0 -62
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { Injectable } from "@nestjs/common";
|
|
2
|
-
import { plainToInstance } from "class-transformer";
|
|
3
|
-
import { CreateDashboardDto } from "src/dtos/create-dashboard.dto";
|
|
4
|
-
import { UpdateMenuItemMetadataDto } from "src/dtos/update-menu-item-metadata.dto";
|
|
5
|
-
import { AiInteraction } from "src/entities/ai-interaction.entity";
|
|
6
|
-
import { Dashboard } from "src/entities/dashboard.entity";
|
|
7
|
-
import { IMcpToolResponseHandler } from "../../../interfaces";
|
|
8
|
-
import { ActionMetadataService } from "../../action-metadata.service";
|
|
9
|
-
import { DashboardService } from "../../dashboard.service";
|
|
10
|
-
import { MenuItemMetadataService } from "../../menu-item-metadata.service";
|
|
11
|
-
import { ModelMetadataService } from "../../model-metadata.service";
|
|
12
|
-
import { ModuleMetadataService } from "../../module-metadata.service";
|
|
13
|
-
import { RoleMetadataService } from "../../role-metadata.service";
|
|
14
|
-
|
|
15
|
-
@Injectable()
|
|
16
|
-
export class SolidCreateDashboardWithWidgetsMcpHandler implements IMcpToolResponseHandler {
|
|
17
|
-
|
|
18
|
-
constructor(
|
|
19
|
-
private readonly dashboardService: DashboardService,
|
|
20
|
-
private readonly actionMetadataService: ActionMetadataService,
|
|
21
|
-
private readonly menuItemMetadataService: MenuItemMetadataService,
|
|
22
|
-
private readonly moduleMetadataService: ModuleMetadataService,
|
|
23
|
-
private readonly modelMetadataService: ModelMetadataService,
|
|
24
|
-
private readonly roleService: RoleMetadataService, // Assuming roleService is a Mongoose model, adjust as necessary
|
|
25
|
-
) {
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
async apply(aiInteraction: AiInteraction) {
|
|
29
|
-
const escapedMessage = aiInteraction.message.replace(/\\'/g, "'");
|
|
30
|
-
const aiResponseMessage = JSON.parse(escapedMessage);
|
|
31
|
-
const { data } = aiResponseMessage;
|
|
32
|
-
const { schema } = data;
|
|
33
|
-
const { dashboardDto, dashboard } = await this.createDashboard(schema);
|
|
34
|
-
|
|
35
|
-
const { moduleUserKey, actionMetadataEntity } = await this.createActionMetadataEntry(dashboardDto, dashboard);
|
|
36
|
-
|
|
37
|
-
await this.createMenuItemEntry(dashboard, moduleUserKey, actionMetadataEntity);
|
|
38
|
-
|
|
39
|
-
// TODO: decide on some shape to return hre...
|
|
40
|
-
return {
|
|
41
|
-
seedingRequired: false,
|
|
42
|
-
serverRebooting: false,
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
private async createMenuItemEntry(dashboard: Dashboard, moduleUserKey: string, actionMetadataEntity: any) {
|
|
48
|
-
const menuData = {
|
|
49
|
-
displayName: dashboard.displayName || dashboard.name,
|
|
50
|
-
name: `${moduleUserKey}-${dashboard.name}-dashboard-menu-item`,
|
|
51
|
-
sequenceNumber: 1,
|
|
52
|
-
actionUserKey: actionMetadataEntity.name,
|
|
53
|
-
moduleUserKey: moduleUserKey,
|
|
54
|
-
parentMenuItemUserKey: '',
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const adminRole = await this.roleService.findRoleByName('Admin');
|
|
58
|
-
const specifiedRoles = menuData['roles'];
|
|
59
|
-
|
|
60
|
-
// If the developer has specified roles, then resolve them, making sure that admin role is also given.
|
|
61
|
-
const specifiedRoleObjects = [adminRole];
|
|
62
|
-
if (specifiedRoles) {
|
|
63
|
-
for (let i = 0; i < specifiedRoles.length; i++) {
|
|
64
|
-
const specifiedRole = specifiedRoles[i];
|
|
65
|
-
const specifiedRoleObject = await this.roleService.findRoleByName(specifiedRole);
|
|
66
|
-
if (!specifiedRoleObject) {
|
|
67
|
-
throw new Error(`Invalid role: (${specifiedRole}) specified against menu with display name ${menuData.displayName}.`);
|
|
68
|
-
}
|
|
69
|
-
specifiedRoleObjects.push(specifiedRoleObject);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
menuData['roles'] = specifiedRoleObjects;
|
|
74
|
-
menuData['action'] = await this.actionMetadataService.findOneByUserKey(menuData.actionUserKey);
|
|
75
|
-
menuData['module'] = await this.moduleMetadataService.findOneByUserKey(menuData.moduleUserKey);
|
|
76
|
-
|
|
77
|
-
if (menuData.parentMenuItemUserKey) {
|
|
78
|
-
menuData['parentMenuItem'] = await this.menuItemMetadataService.findOneByUserKey(menuData.parentMenuItemUserKey);
|
|
79
|
-
} else {
|
|
80
|
-
menuData['parentMenuItem'] = null;
|
|
81
|
-
}
|
|
82
|
-
await this.menuItemMetadataService.upsert(menuData as unknown as UpdateMenuItemMetadataDto);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
private async createActionMetadataEntry(dashboardDto: CreateDashboardDto, dashboard: Dashboard) {
|
|
86
|
-
const moduleUserKey = dashboardDto.moduleUserKey;
|
|
87
|
-
const actionMetadata = {
|
|
88
|
-
name: `${dashboard.name}-view`,
|
|
89
|
-
displayName: dashboard.displayName || dashboard.name,
|
|
90
|
-
type: 'custom',
|
|
91
|
-
domain: "{}",
|
|
92
|
-
context: "{}",
|
|
93
|
-
customComponent: `/admin/core/${moduleUserKey}/dashboards?dashboardName=${dashboard.name}`,
|
|
94
|
-
customIsModal: true,
|
|
95
|
-
serverEndpoint: '',
|
|
96
|
-
moduleUserKey: moduleUserKey,
|
|
97
|
-
modelUserKey: '',
|
|
98
|
-
viewUserKey: `${dashboard.name}-view`,
|
|
99
|
-
};
|
|
100
|
-
actionMetadata['module'] = await this.moduleMetadataService.findOneByUserKey(actionMetadata.moduleUserKey);
|
|
101
|
-
if (actionMetadata.modelUserKey) {
|
|
102
|
-
actionMetadata['model'] = await this.modelMetadataService.findOneByUserKey(actionMetadata.modelUserKey);
|
|
103
|
-
}
|
|
104
|
-
const actionMetadataEntity = await this.actionMetadataService.upsert(actionMetadata);
|
|
105
|
-
return { moduleUserKey, actionMetadataEntity };
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
private async createDashboard(aiResponseMessage: any) {
|
|
109
|
-
const dashboardDto = plainToInstance(CreateDashboardDto, aiResponseMessage);
|
|
110
|
-
dashboardDto['layoutJson'] = JSON.stringify(dashboardDto['layoutJson']);
|
|
111
|
-
const dashboard = await this.dashboardService.create(dashboardDto, []);
|
|
112
|
-
return { dashboardDto, dashboard };
|
|
113
|
-
}
|
|
114
|
-
}
|
package/src/services/genai/mcp-handlers/solid-create-dashboard-question-mcp-handler.service.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { Injectable } from "@nestjs/common";
|
|
2
|
-
import { plainToInstance } from "class-transformer";
|
|
3
|
-
import { CreateDashboardQuestionDto } from "src/dtos/create-dashboard-question.dto";
|
|
4
|
-
import { AiInteraction } from "src/entities/ai-interaction.entity";
|
|
5
|
-
import { IMcpToolResponseHandler } from "../../../interfaces";
|
|
6
|
-
import { DashboardQuestionService } from "../../dashboard-question.service";
|
|
7
|
-
|
|
8
|
-
@Injectable()
|
|
9
|
-
export class SolidCreateDashboardQuestionMcpHandler implements IMcpToolResponseHandler {
|
|
10
|
-
|
|
11
|
-
constructor(
|
|
12
|
-
private readonly dashboardQuestionService: DashboardQuestionService,
|
|
13
|
-
) {
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
async apply(aiInteraction: AiInteraction) {
|
|
17
|
-
const escapedMessage = aiInteraction.message.replace(/\\'/g, "'");
|
|
18
|
-
const aiResponseMessage = JSON.parse(escapedMessage);
|
|
19
|
-
|
|
20
|
-
//FIXME: Replace \' with ' in the response, since the AI response seems to contain \' which is invalid JSON.
|
|
21
|
-
// This is a workaround for now, until we find a better solution.
|
|
22
|
-
// const aiResponseMessageReplaced = aiResponseMessage['message'].replace(/\\'/g, "'");
|
|
23
|
-
// const dashboardUserKey = aiResponseMessageReplaced['dashboardUserKey'];
|
|
24
|
-
// if (!dashboardUserKey) {
|
|
25
|
-
// throw new Error("Dashboard User Key is required to create a Dashboard Question.");
|
|
26
|
-
// }
|
|
27
|
-
const dashboardQuestionDto = plainToInstance(CreateDashboardQuestionDto, aiResponseMessage);
|
|
28
|
-
|
|
29
|
-
const dashboardQuestion = await this.dashboardQuestionService.create(dashboardQuestionDto, []);
|
|
30
|
-
|
|
31
|
-
// TODO: decide on some shape to return hre...
|
|
32
|
-
return {
|
|
33
|
-
seedingRequired: false,
|
|
34
|
-
serverRebooting: false,
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Injectable } from "@nestjs/common";
|
|
2
|
-
import { plainToInstance } from "class-transformer";
|
|
3
|
-
import { AiInteraction } from "src/entities/ai-interaction.entity";
|
|
4
|
-
import { IMcpToolResponseHandler } from "../../../interfaces";
|
|
5
|
-
import { DashboardQuestionSqlDatasetConfigService } from "../../dashboard-question-sql-dataset-config.service";
|
|
6
|
-
import { CreateDashboardQuestionSqlDatasetConfigDto } from "src/dtos/create-dashboard-question-sql-dataset-config.dto";
|
|
7
|
-
|
|
8
|
-
@Injectable()
|
|
9
|
-
export class SolidCreateDashboardQuestionSqlDatasetConfigMcpHandler implements IMcpToolResponseHandler {
|
|
10
|
-
|
|
11
|
-
constructor(
|
|
12
|
-
private readonly dashboardQuestionSqlDatasetConfigService: DashboardQuestionSqlDatasetConfigService,
|
|
13
|
-
) {
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
async apply(aiInteraction: AiInteraction) {
|
|
17
|
-
// const aiResponse = JSON.parse(aiInteraction.message);
|
|
18
|
-
const escapedMessage = aiInteraction.message.replace(/\\'/g, "'");
|
|
19
|
-
const aiResponseMessage = JSON.parse(escapedMessage);
|
|
20
|
-
|
|
21
|
-
// FIXME: Replace \' with ' in the response, since the AI response seems to contain \' which is invalid JSON.
|
|
22
|
-
// This is a workaround for now, until we find a better solution.
|
|
23
|
-
// const aiResponseMessageReplaced = aiResponse['message'].replace(/\\'/g, "'");
|
|
24
|
-
// const dashboardUserKey = aiResponseMessageReplaced['dashboardUserKey'];
|
|
25
|
-
// if (!dashboardUserKey) {
|
|
26
|
-
// throw new Error("Dashboard User Key is required to create a Dashboard Question.");
|
|
27
|
-
// }
|
|
28
|
-
const dto = plainToInstance(CreateDashboardQuestionSqlDatasetConfigDto, aiResponseMessage);
|
|
29
|
-
dto['options'] = JSON.stringify(dto['options']);
|
|
30
|
-
|
|
31
|
-
const dashboardQuestion = await this.dashboardQuestionSqlDatasetConfigService.create(dto, []);
|
|
32
|
-
|
|
33
|
-
// TODO: decide on some shape to return hre...
|
|
34
|
-
return {
|
|
35
|
-
seedingRequired: false,
|
|
36
|
-
serverRebooting: false,
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
}
|
package/src/services/genai/mcp-handlers/solid-create-dashboard-widget-mcp-handler.service.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { Injectable } from "@nestjs/common";
|
|
2
|
-
import { plainToInstance } from "class-transformer";
|
|
3
|
-
import { CreateDashboardQuestionDto } from "src/dtos/create-dashboard-question.dto";
|
|
4
|
-
import { AiInteraction } from "src/entities/ai-interaction.entity";
|
|
5
|
-
import { IMcpToolResponseHandler } from "../../../interfaces";
|
|
6
|
-
import { DashboardQuestionService } from "../../dashboard-question.service";
|
|
7
|
-
|
|
8
|
-
@Injectable()
|
|
9
|
-
export class SolidCreateDashboardWidgetMcpHandler implements IMcpToolResponseHandler {
|
|
10
|
-
|
|
11
|
-
constructor(
|
|
12
|
-
private readonly dashboardQuestionService: DashboardQuestionService,
|
|
13
|
-
) {
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
async apply(aiInteraction: AiInteraction) {
|
|
17
|
-
const escapedMessage = aiInteraction.message.replace(/\\'/g, "'");
|
|
18
|
-
const aiResponseMessage = JSON.parse(escapedMessage);
|
|
19
|
-
|
|
20
|
-
//FIXME: Replace \' with ' in the response, since the AI response seems to contain \' which is invalid JSON.
|
|
21
|
-
// This is a workaround for now, until we find a better solution.
|
|
22
|
-
// const aiResponseMessageReplaced = aiResponseMessage['message'].replace(/\\'/g, "'");
|
|
23
|
-
// const dashboardUserKey = aiResponseMessageReplaced['dashboardUserKey'];
|
|
24
|
-
// if (!dashboardUserKey) {
|
|
25
|
-
// throw new Error("Dashboard User Key is required to create a Dashboard Question.");
|
|
26
|
-
// }
|
|
27
|
-
const dashboardQuestionDto = plainToInstance(CreateDashboardQuestionDto, aiResponseMessage);
|
|
28
|
-
dashboardQuestionDto['questionSqlDatasetConfigsCommand'] = "update";
|
|
29
|
-
|
|
30
|
-
const dashboardQuestion = await this.dashboardQuestionService.create(dashboardQuestionDto, []);
|
|
31
|
-
|
|
32
|
-
// TODO: decide on some shape to return hre...
|
|
33
|
-
return {
|
|
34
|
-
seedingRequired: false,
|
|
35
|
-
serverRebooting: false,
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { Injectable, Logger } from "@nestjs/common";
|
|
2
|
-
import { DashboardQuestionDataProvider } from "src/decorators/dashboard-question-data-provider.decorator";
|
|
3
|
-
import { DashboardQuestion } from "src/entities/dashboard-question.entity";
|
|
4
|
-
import { IDashboardQuestionDataProvider, QuestionSqlDataProviderContext } from "src/interfaces";
|
|
5
|
-
import { EntityManager } from "typeorm";
|
|
6
|
-
import { SqlExpressionResolverService } from "../sql-expression-resolver.service";
|
|
7
|
-
import { getKpi, getLabels } from "./helpers";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export enum SqlExpressionOperator {
|
|
11
|
-
EQUALS = '$equals',
|
|
12
|
-
NOT_EQUALS = '$notEquals',
|
|
13
|
-
CONTAINS = '$contains',
|
|
14
|
-
NOT_CONTAINS = '$notContains',
|
|
15
|
-
STARTS_WITH = '$startsWith',
|
|
16
|
-
ENDS_WITH = '$endsWith',
|
|
17
|
-
IN = '$in',
|
|
18
|
-
NOT_IN = '$notIn',
|
|
19
|
-
BETWEEN = '$between',
|
|
20
|
-
LT = '$lt',
|
|
21
|
-
LTE = '$lte',
|
|
22
|
-
GT = '$gt',
|
|
23
|
-
GTE = '$gte'
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface SqlExpression {
|
|
27
|
-
variableName: string; // The name of the variable in the SQL query
|
|
28
|
-
operator: SqlExpressionOperator; // The operator to use for the replacement (e.g., '=', '>', '<', etc.)
|
|
29
|
-
value: string[]; // The value to replace the variable with
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
@DashboardQuestionDataProvider()
|
|
33
|
-
@Injectable()
|
|
34
|
-
export class ChartJsSqlDataProvider implements IDashboardQuestionDataProvider<QuestionSqlDataProviderContext, any> {
|
|
35
|
-
private readonly logger = new Logger(ChartJsSqlDataProvider.name);
|
|
36
|
-
|
|
37
|
-
constructor(private readonly entityManager: EntityManager, private readonly sqlExpressionResolver: SqlExpressionResolverService) { }
|
|
38
|
-
|
|
39
|
-
help(): string {
|
|
40
|
-
return "Provides data for dashboard questions using a SQL dataset configuration. Configure your SQL dataset in the admin panel, then reference it in your dashboard question to fetch data.";
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
name(): string {
|
|
44
|
-
return "ChartJsSqlDataProvider";
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
async getData(question: DashboardQuestion, context?: QuestionSqlDataProviderContext): Promise<any> {
|
|
48
|
-
const expressions: SqlExpression[] = context?.expressions || [];
|
|
49
|
-
// TODO: put some validation to check if the results of each SQL in each dataset returns the same number of rows
|
|
50
|
-
|
|
51
|
-
// This is what we have to return.
|
|
52
|
-
// const data = {
|
|
53
|
-
// labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
|
|
54
|
-
// datasets: [
|
|
55
|
-
// {
|
|
56
|
-
// label: 'Dataset 1',
|
|
57
|
-
// data: labels.map(() => faker.number.int({ min: 0, max: 1000 })),
|
|
58
|
-
// backgroundColor: 'rgba(255, 99, 132, 0.5)',
|
|
59
|
-
// },
|
|
60
|
-
// {
|
|
61
|
-
// label: 'Dataset 2',
|
|
62
|
-
// data: labels.map(() => faker.number.int({ min: 0, max: 1000 })),
|
|
63
|
-
// backgroundColor: 'rgba(53, 162, 235, 0.5)',
|
|
64
|
-
// },
|
|
65
|
-
// {
|
|
66
|
-
// label: 'Dataset 3',
|
|
67
|
-
// data: labels.map(() => faker.number.int({ min: 0, max: 1000 })),
|
|
68
|
-
// backgroundColor: 'rgba(53, 235, 162, 0.5)',
|
|
69
|
-
// },
|
|
70
|
-
// ],
|
|
71
|
-
// };
|
|
72
|
-
|
|
73
|
-
// TODO: Load the set of labels by using a separate field on the question entity.
|
|
74
|
-
|
|
75
|
-
let datasetIdx = 0;
|
|
76
|
-
const datasets = [];
|
|
77
|
-
|
|
78
|
-
const labels: string[] = await getLabels(question, expressions, this.entityManager, this.sqlExpressionResolver);
|
|
79
|
-
const kpi: string = await getKpi(question, expressions, this.entityManager, this.sqlExpressionResolver);
|
|
80
|
-
|
|
81
|
-
// const question = context.question;
|
|
82
|
-
for (const questionSqlDatasetConfig of question.questionSqlDatasetConfigs) {
|
|
83
|
-
|
|
84
|
-
const sql = questionSqlDatasetConfig.sql;
|
|
85
|
-
if (!sql) {
|
|
86
|
-
throw new Error(`SQL dataset ${questionSqlDatasetConfig.datasetName} configuration does not contain a valid SQL query.`);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const sqlReplacementResult = this.sqlExpressionResolver.resolveSqlWithExpressions(sql, expressions || []);
|
|
90
|
-
this.logger.debug(`Final Sql query for dataset [${questionSqlDatasetConfig.datasetName}] is query=[${sqlReplacementResult.rawSql}]`);
|
|
91
|
-
this.logger.debug(`Final Sql query for dataset [${questionSqlDatasetConfig.datasetName}] is parameters=[${JSON.stringify(sqlReplacementResult.parameters)}]`);
|
|
92
|
-
const results = await this.entityManager.query(sqlReplacementResult.rawSql, sqlReplacementResult.parameters);
|
|
93
|
-
|
|
94
|
-
// Also for each data set we create the dataset object as is expected by ChartJs.
|
|
95
|
-
const data = [];
|
|
96
|
-
for (let i = 0; i < results.length; i++) {
|
|
97
|
-
const result = results[i];
|
|
98
|
-
data.push(result[questionSqlDatasetConfig.valueColumnName]);
|
|
99
|
-
}
|
|
100
|
-
datasets.push({
|
|
101
|
-
label: questionSqlDatasetConfig.datasetDisplayName,
|
|
102
|
-
data: data,
|
|
103
|
-
...JSON.parse(questionSqlDatasetConfig.options || '{}'),
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
datasetIdx++;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
return {
|
|
110
|
-
kpi,
|
|
111
|
-
visualizedAs: question.visualisedAs,
|
|
112
|
-
visualizationData: {
|
|
113
|
-
labels,
|
|
114
|
-
datasets
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { DashboardQuestion } from "src/entities/dashboard-question.entity";
|
|
2
|
-
import { EntityManager } from "typeorm";
|
|
3
|
-
import { SqlExpression } from "./chartjs-sql-data-provider.service";
|
|
4
|
-
import { SqlExpressionResolverService } from "../sql-expression-resolver.service";
|
|
5
|
-
|
|
6
|
-
export async function getLabels(question: DashboardQuestion, expressions: SqlExpression[], entityManager: EntityManager, sqlExpressionResolver: SqlExpressionResolverService): Promise<string[]> {
|
|
7
|
-
const sql = question.labelSql;
|
|
8
|
-
if (!sql) {
|
|
9
|
-
return [];
|
|
10
|
-
}
|
|
11
|
-
const sqlReplacementResult = sqlExpressionResolver.resolveSqlWithExpressions(sql, expressions || []);
|
|
12
|
-
|
|
13
|
-
const labelResults = await entityManager.query(sqlReplacementResult.rawSql, sqlReplacementResult.parameters);
|
|
14
|
-
|
|
15
|
-
// Assuming labelResults has a single row with a 'label' field
|
|
16
|
-
// Map the label results to the labels array
|
|
17
|
-
const labels: string[] = labelResults.map((result: { [x: string]: string; }) => result['label']);
|
|
18
|
-
return labels;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export async function getKpi(question: DashboardQuestion, expressions: SqlExpression[], entityManager: EntityManager, sqlExpressionResolver: SqlExpressionResolverService): Promise<string> {
|
|
22
|
-
const sql = question.kpiSql;
|
|
23
|
-
if (!sql) {
|
|
24
|
-
return "";
|
|
25
|
-
}
|
|
26
|
-
const sqlReplacementResult = sqlExpressionResolver.resolveSqlWithExpressions(sql, expressions || []);
|
|
27
|
-
const result = await entityManager.query(sqlReplacementResult.rawSql, sqlReplacementResult.parameters);
|
|
28
|
-
const kpiResult = result.pop();
|
|
29
|
-
return kpiResult?.kpi || "";
|
|
30
|
-
}
|
package/src/services/question-data-providers/prime-react-datatable-sql-data-provider.service.ts
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { Injectable } from "@nestjs/common";
|
|
2
|
-
import { DashboardQuestionDataProvider } from "src/decorators/dashboard-question-data-provider.decorator";
|
|
3
|
-
import { DashboardQuestion } from "src/entities/dashboard-question.entity";
|
|
4
|
-
import { IDashboardQuestionDataProvider, QuestionSqlDataProviderContext } from "src/interfaces";
|
|
5
|
-
import { EntityManager } from "typeorm";
|
|
6
|
-
import { SqlExpressionResolverService } from "../sql-expression-resolver.service";
|
|
7
|
-
import { Logger } from '@nestjs/common';
|
|
8
|
-
import { SqlExpression } from "./chartjs-sql-data-provider.service";
|
|
9
|
-
import { getKpi } from "./helpers";
|
|
10
|
-
|
|
11
|
-
@DashboardQuestionDataProvider()
|
|
12
|
-
@Injectable()
|
|
13
|
-
export class PrimeReactDatatableSqlDataProvider implements IDashboardQuestionDataProvider<QuestionSqlDataProviderContext, any> {
|
|
14
|
-
private readonly logger = new Logger(PrimeReactDatatableSqlDataProvider.name);
|
|
15
|
-
|
|
16
|
-
constructor(private readonly entityManager: EntityManager, private readonly sqlExpressionResolver: SqlExpressionResolverService) { }
|
|
17
|
-
|
|
18
|
-
help(): string {
|
|
19
|
-
return "Provides data for dashboard questions using a SQL dataset configuration. Configure your SQL dataset in the admin panel, then reference it in your dashboard question to fetch data.";
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
name(): string {
|
|
23
|
-
return "PrimeReactDatatableSqlDataProvider";
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
async getData(question: DashboardQuestion, context?: QuestionSqlDataProviderContext): Promise<any> {
|
|
27
|
-
const expressions: SqlExpression[] = context?.expressions || [];
|
|
28
|
-
|
|
29
|
-
// TODO: put some validation to check if the results of each SQL in each dataset returns the same number of rows
|
|
30
|
-
|
|
31
|
-
// Check the expected response for prime react data tables to understand what is going on here...
|
|
32
|
-
|
|
33
|
-
const kpi: string = await getKpi(question, expressions, this.entityManager, this.sqlExpressionResolver);
|
|
34
|
-
// TODO: Load the set of labels by using a separate field on the question entity.
|
|
35
|
-
const labelSql = question.labelSql;
|
|
36
|
-
const labelResults = await this.entityManager.query(labelSql);
|
|
37
|
-
const columns = [];
|
|
38
|
-
for (let i = 0; i < labelResults.length; i++) {
|
|
39
|
-
const labelResult = labelResults[i];
|
|
40
|
-
columns.push({
|
|
41
|
-
field: labelResult['field'],
|
|
42
|
-
header: labelResult['header'],
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Load the chart options as a JSON
|
|
47
|
-
// const chartOptions = JSON.parse(question.barChartLabelOptions || '{}');
|
|
48
|
-
|
|
49
|
-
const values = []
|
|
50
|
-
|
|
51
|
-
// For meter group we can assume that we only have one sql dataset config.
|
|
52
|
-
const questionSqlDatasetConfig = question.questionSqlDatasetConfigs[0];
|
|
53
|
-
|
|
54
|
-
const sql = questionSqlDatasetConfig.sql;
|
|
55
|
-
if (!sql) {
|
|
56
|
-
throw new Error(`SQL dataset ${questionSqlDatasetConfig.datasetName} configuration does not contain a valid SQL query.`);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const sqlReplacementResult = this.sqlExpressionResolver.resolveSqlWithExpressions(sql, expressions || []);
|
|
60
|
-
this.logger.debug(`Final Sql query for dataset [${questionSqlDatasetConfig.datasetName}] is query=[${sqlReplacementResult.rawSql}]`);
|
|
61
|
-
this.logger.debug(`Final Sql query for dataset [${questionSqlDatasetConfig.datasetName}] is parameters=[${JSON.stringify(sqlReplacementResult.parameters)}]`);
|
|
62
|
-
const results = await this.entityManager.query(sqlReplacementResult.rawSql, sqlReplacementResult.parameters);
|
|
63
|
-
|
|
64
|
-
return {
|
|
65
|
-
kpi,
|
|
66
|
-
visualisedAs: question.visualisedAs,
|
|
67
|
-
visualizationData: {
|
|
68
|
-
columns,
|
|
69
|
-
rows: results,
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
}
|
package/src/services/question-data-providers/prime-react-meter-group-sql-data-provider.service.ts
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { Injectable } from "@nestjs/common";
|
|
2
|
-
import { DashboardQuestionDataProvider } from "src/decorators/dashboard-question-data-provider.decorator";
|
|
3
|
-
import { DashboardQuestion } from "src/entities/dashboard-question.entity";
|
|
4
|
-
import { IDashboardQuestionDataProvider, QuestionSqlDataProviderContext } from "src/interfaces";
|
|
5
|
-
import { EntityManager } from "typeorm";
|
|
6
|
-
import { SqlExpressionResolverService } from "../sql-expression-resolver.service";
|
|
7
|
-
import { Logger } from '@nestjs/common';
|
|
8
|
-
import { SqlExpression } from "./chartjs-sql-data-provider.service";
|
|
9
|
-
import { getKpi } from "./helpers";
|
|
10
|
-
|
|
11
|
-
@DashboardQuestionDataProvider()
|
|
12
|
-
@Injectable()
|
|
13
|
-
export class PrimeReactMeterGroupSqlDataProvider implements IDashboardQuestionDataProvider<QuestionSqlDataProviderContext, any> {
|
|
14
|
-
private readonly logger = new Logger(PrimeReactMeterGroupSqlDataProvider.name);
|
|
15
|
-
|
|
16
|
-
constructor(private readonly entityManager: EntityManager, private readonly sqlExpressionResolver: SqlExpressionResolverService) { }
|
|
17
|
-
|
|
18
|
-
help(): string {
|
|
19
|
-
return "Provides data for dashboard questions using a SQL dataset configuration. Configure your SQL dataset in the admin panel, then reference it in your dashboard question to fetch data.";
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
name(): string {
|
|
23
|
-
return "PrimeReactMeterGroupSqlDataProvider";
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
hslToHex(h: number, s: number, l: number): string {
|
|
27
|
-
l /= 100;
|
|
28
|
-
s /= 100;
|
|
29
|
-
|
|
30
|
-
const k = (n: number) => (n + h / 30) % 12;
|
|
31
|
-
const a = s * Math.min(l, 1 - l);
|
|
32
|
-
const f = (n: number) =>
|
|
33
|
-
Math.round(255 * (l - a * Math.max(-1, Math.min(k(n) - 3, Math.min(9 - k(n), 1)))));
|
|
34
|
-
|
|
35
|
-
return `#${f(0).toString(16).padStart(2, '0')}${f(8).toString(16).padStart(2, '0')}${f(4)
|
|
36
|
-
.toString(16)
|
|
37
|
-
.padStart(2, '0')}`;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
generateDistinctColors(count: number): string[] {
|
|
41
|
-
const colors: string[] = [];
|
|
42
|
-
|
|
43
|
-
const hueStep = 360 / count;
|
|
44
|
-
const saturation = 65; // keep it vibrant
|
|
45
|
-
const lightness = 55; // balanced for both light/dark themes
|
|
46
|
-
|
|
47
|
-
for (let i = 0; i < count; i++) {
|
|
48
|
-
const hue = Math.round(i * hueStep);
|
|
49
|
-
colors.push(this.hslToHex(hue, saturation, lightness));
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return colors;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
async getData(question: DashboardQuestion, context?: QuestionSqlDataProviderContext): Promise<any> {
|
|
56
|
-
const expressions: SqlExpression[] = context?.expressions || [];
|
|
57
|
-
|
|
58
|
-
// TODO: put some validation to check if the results of each SQL in each dataset returns the same number of rows
|
|
59
|
-
|
|
60
|
-
// This is what we have to return.
|
|
61
|
-
// const values = [
|
|
62
|
-
// { label: 'Apps', color: '#34d399', value: 16 },
|
|
63
|
-
// { label: 'Messages', color: '#fbbf24', value: 8 },
|
|
64
|
-
// { label: 'Media', color: '#60a5fa', value: 24 },
|
|
65
|
-
// { label: 'System', color: '#c084fc', value: 10 }
|
|
66
|
-
// ];
|
|
67
|
-
|
|
68
|
-
// TODO: Load the set of labels by using a separate field on the question entity.
|
|
69
|
-
|
|
70
|
-
const kpi: string = await getKpi(question, expressions, this.entityManager, this.sqlExpressionResolver);
|
|
71
|
-
|
|
72
|
-
// Load the chart options as a JSON
|
|
73
|
-
const chartOptions = JSON.parse(question.chartOptions || '{}');
|
|
74
|
-
|
|
75
|
-
const values = []
|
|
76
|
-
|
|
77
|
-
// For meter group we can assume that we only have one sql dataset config.
|
|
78
|
-
const questionSqlDatasetConfig = question.questionSqlDatasetConfigs[0];
|
|
79
|
-
|
|
80
|
-
const sql = questionSqlDatasetConfig.sql;
|
|
81
|
-
if (!sql) {
|
|
82
|
-
throw new Error(`SQL dataset ${questionSqlDatasetConfig.datasetName} configuration does not contain a valid SQL query.`);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const sqlReplacementResult = this.sqlExpressionResolver.resolveSqlWithExpressions(sql, expressions || []);
|
|
86
|
-
this.logger.debug(`Final Sql query for dataset [${questionSqlDatasetConfig.datasetName}] is query=[${sqlReplacementResult.rawSql}]`);
|
|
87
|
-
this.logger.debug(`Final Sql query for dataset [${questionSqlDatasetConfig.datasetName}] is parameters=[${JSON.stringify(sqlReplacementResult.parameters)}]`);
|
|
88
|
-
const results = await this.entityManager.query(sqlReplacementResult.rawSql, sqlReplacementResult.parameters);
|
|
89
|
-
|
|
90
|
-
const colors = this.generateDistinctColors(results.length);
|
|
91
|
-
|
|
92
|
-
// Also for each data set we create the dataset object as is expected by ChartJs.
|
|
93
|
-
for (let i = 0; i < results.length; i++) {
|
|
94
|
-
const result = results[i];
|
|
95
|
-
|
|
96
|
-
const colorFromChartOptions = chartOptions?.colors?.[result[questionSqlDatasetConfig.labelColumnName]];
|
|
97
|
-
const color = typeof colorFromChartOptions === 'string' ? colorFromChartOptions : colors[i];
|
|
98
|
-
|
|
99
|
-
values.push({
|
|
100
|
-
label: result[questionSqlDatasetConfig.labelColumnName],
|
|
101
|
-
color: color,
|
|
102
|
-
value: result[questionSqlDatasetConfig.valueColumnName]
|
|
103
|
-
})
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
return {
|
|
107
|
-
kpi,
|
|
108
|
-
visualizedAs: question.visualisedAs,
|
|
109
|
-
visualizationData: {
|
|
110
|
-
dataset: values
|
|
111
|
-
},
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { Injectable } from "@nestjs/common";
|
|
2
|
-
import { SelectionProvider } from "src/decorators/selection-provider.decorator";
|
|
3
|
-
import { SolidRegistry } from "src/helpers/solid-registry";
|
|
4
|
-
import { IDashboardQuestionDataProvider, IDashboardVariableSelectionProvider, ISelectionProvider, ISelectionProviderContext, ISelectionProviderValues } from "../../interfaces";
|
|
5
|
-
import { SQL_DYNAMIC_PROVIDER_NAME } from "../dashboard.service";
|
|
6
|
-
import { CHARTJS_SQL_DATA_PROVIDER_NAME, INBUILT_SQL_DATA_PROVIDERS, PRIME_REACT_DATATABLE_SQL_DATA_PROVIDER_NAME, PRIME_REACT_METER_GROUP_SQL_DATA_PROVIDER_NAME } from "../dashboard-question.service";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
@SelectionProvider()
|
|
10
|
-
@Injectable()
|
|
11
|
-
export class ListOfDashboardQuestionProvidersSelectionProvider implements ISelectionProvider<ISelectionProviderContext> {
|
|
12
|
-
|
|
13
|
-
constructor(
|
|
14
|
-
private readonly solidRegistry: SolidRegistry,
|
|
15
|
-
) {
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
help(): string {
|
|
19
|
-
return "# Allows one to dynamically fetch all the dashboard providers that are registered in the system. ";
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
name(): string {
|
|
23
|
-
return 'ListOfDashboardQuestionProvidersSelectionProvider';
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
async value(optionValue: string, ctxt: ISelectionProviderContext): Promise<ISelectionProviderValues | any> {
|
|
27
|
-
const dashboardSelectionProvider: IDashboardQuestionDataProvider<any, any> | undefined = this.solidRegistry.getDashboardQuestionDataProviderInstance(optionValue);
|
|
28
|
-
if (!dashboardSelectionProvider) {
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return { label: dashboardSelectionProvider.name(), value: dashboardSelectionProvider.name() };
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
async values(query: string, ctxt: ISelectionProviderContext): Promise<readonly ISelectionProviderValues[]> {
|
|
36
|
-
const dashboardSelectionProviders = this.solidRegistry.getDashboardQuestionDataProviders()
|
|
37
|
-
//Exclude the SQL dynamic provider from the list, (since although it is a dashboard selection provider, it is not a valid option for the user to select)
|
|
38
|
-
return dashboardSelectionProviders
|
|
39
|
-
.filter(provider => !INBUILT_SQL_DATA_PROVIDERS.includes(provider.name()))
|
|
40
|
-
.map(i => {
|
|
41
|
-
return { label: i.name, value: i.name };
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Injectable } from "@nestjs/common";
|
|
2
|
-
import { SelectionProvider } from "src/decorators/selection-provider.decorator";
|
|
3
|
-
import { SolidRegistry } from "src/helpers/solid-registry";
|
|
4
|
-
import { IDashboardVariableSelectionProvider, ISelectionProvider, ISelectionProviderContext, ISelectionProviderValues } from "../../interfaces";
|
|
5
|
-
import { SQL_DYNAMIC_PROVIDER_NAME } from "../dashboard.service";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
@SelectionProvider()
|
|
9
|
-
@Injectable()
|
|
10
|
-
export class ListOfDashboardVariableProvidersSelectionProvider implements ISelectionProvider<ISelectionProviderContext> {
|
|
11
|
-
|
|
12
|
-
constructor(
|
|
13
|
-
private readonly solidRegistry: SolidRegistry,
|
|
14
|
-
) {
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
help(): string {
|
|
18
|
-
return "# Allows one to dynamically fetch all the dashboard providers that are registered in the system. ";
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
name(): string {
|
|
22
|
-
return 'ListOfDashboardVariableProvidersSelectionProvider';
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
async value(optionValue: string, ctxt: ISelectionProviderContext): Promise<ISelectionProviderValues | any> {
|
|
26
|
-
const dashboardSelectionProvider: IDashboardVariableSelectionProvider<ISelectionProviderContext> | undefined = this.solidRegistry.getDashboardVariableSelectionProviderInstance(optionValue);
|
|
27
|
-
if (!dashboardSelectionProvider) {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return { label: dashboardSelectionProvider.name(), value: dashboardSelectionProvider.name() };
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
async values(query: string, ctxt: ISelectionProviderContext): Promise<readonly ISelectionProviderValues[]> {
|
|
35
|
-
const dashboardSelectionProviders = this.solidRegistry.getDashboardVariableSelectionProviders()
|
|
36
|
-
//Exclude the SQL dynamic provider from the list, (since although it is a dashboard selection provider, it is not a valid option for the user to select)
|
|
37
|
-
return dashboardSelectionProviders.filter(i => (i.name !== SQL_DYNAMIC_PROVIDER_NAME)).map(i => {
|
|
38
|
-
return { label: i.name, value: i.name };
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
}
|