@oneuptime/common 10.0.93 → 10.0.94

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.
Files changed (136) hide show
  1. package/Models/DatabaseModels/DockerResource.ts +497 -0
  2. package/Models/DatabaseModels/Index.ts +2 -0
  3. package/Models/DatabaseModels/Monitor.ts +83 -0
  4. package/Server/API/MonitorTemplateAPI.ts +182 -0
  5. package/Server/Infrastructure/Postgres/SchemaMigrations/1777933061000-MigrationName.ts +41 -0
  6. package/Server/Infrastructure/Postgres/SchemaMigrations/1777972687018-MigrationName.ts +69 -0
  7. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +4 -0
  8. package/Server/Services/BillingInvoiceService.ts +18 -29
  9. package/Server/Services/DockerResourceService.ts +310 -0
  10. package/Server/Services/MonitorTemplateService.ts +359 -0
  11. package/Types/Dashboard/DashboardComponentType.ts +13 -0
  12. package/Types/Dashboard/DashboardComponents/ComponentArgument.ts +16 -0
  13. package/Types/Dashboard/DashboardComponents/DashboardAlertListComponent.ts +4 -0
  14. package/Types/Dashboard/DashboardComponents/DashboardDockerContainerListComponent.ts +15 -0
  15. package/Types/Dashboard/DashboardComponents/DashboardDockerHostListComponent.ts +14 -0
  16. package/Types/Dashboard/DashboardComponents/DashboardDockerImageListComponent.ts +15 -0
  17. package/Types/Dashboard/DashboardComponents/DashboardDockerNetworkListComponent.ts +14 -0
  18. package/Types/Dashboard/DashboardComponents/DashboardDockerVolumeListComponent.ts +14 -0
  19. package/Types/Dashboard/DashboardComponents/DashboardIncidentListComponent.ts +4 -0
  20. package/Types/Dashboard/DashboardComponents/DashboardKubernetesCronJobListComponent.ts +15 -0
  21. package/Types/Dashboard/DashboardComponents/DashboardKubernetesDaemonSetListComponent.ts +15 -0
  22. package/Types/Dashboard/DashboardComponents/DashboardKubernetesDeploymentListComponent.ts +15 -0
  23. package/Types/Dashboard/DashboardComponents/DashboardKubernetesJobListComponent.ts +15 -0
  24. package/Types/Dashboard/DashboardComponents/DashboardKubernetesNamespaceListComponent.ts +14 -0
  25. package/Types/Dashboard/DashboardComponents/DashboardKubernetesNodeListComponent.ts +15 -0
  26. package/Types/Dashboard/DashboardComponents/DashboardKubernetesPodListComponent.ts +16 -0
  27. package/Types/Dashboard/DashboardComponents/DashboardKubernetesStatefulSetListComponent.ts +15 -0
  28. package/Types/Dashboard/DashboardComponents/DashboardMonitorListComponent.ts +3 -0
  29. package/Types/Docker/DockerInventoryExtractor.ts +343 -0
  30. package/Utils/Dashboard/Components/DashboardAlertListComponent.ts +47 -2
  31. package/Utils/Dashboard/Components/DashboardDockerContainerListComponent.ts +93 -0
  32. package/Utils/Dashboard/Components/DashboardDockerHostListComponent.ts +83 -0
  33. package/Utils/Dashboard/Components/DashboardDockerImageListComponent.ts +92 -0
  34. package/Utils/Dashboard/Components/DashboardDockerNetworkListComponent.ts +82 -0
  35. package/Utils/Dashboard/Components/DashboardDockerVolumeListComponent.ts +82 -0
  36. package/Utils/Dashboard/Components/DashboardIncidentListComponent.ts +47 -2
  37. package/Utils/Dashboard/Components/DashboardKubernetesCronJobListComponent.ts +36 -0
  38. package/Utils/Dashboard/Components/DashboardKubernetesDaemonSetListComponent.ts +36 -0
  39. package/Utils/Dashboard/Components/DashboardKubernetesDeploymentListComponent.ts +36 -0
  40. package/Utils/Dashboard/Components/DashboardKubernetesJobListComponent.ts +34 -0
  41. package/Utils/Dashboard/Components/DashboardKubernetesNamespaceListComponent.ts +36 -0
  42. package/Utils/Dashboard/Components/DashboardKubernetesNodeListComponent.ts +57 -0
  43. package/Utils/Dashboard/Components/DashboardKubernetesPodListComponent.ts +60 -0
  44. package/Utils/Dashboard/Components/DashboardKubernetesResourceListShared.ts +75 -0
  45. package/Utils/Dashboard/Components/DashboardKubernetesStatefulSetListComponent.ts +36 -0
  46. package/Utils/Dashboard/Components/DashboardMonitorListComponent.ts +59 -2
  47. package/Utils/Dashboard/Components/Index.ts +102 -0
  48. package/build/dist/Models/DatabaseModels/DockerResource.js +525 -0
  49. package/build/dist/Models/DatabaseModels/DockerResource.js.map +1 -0
  50. package/build/dist/Models/DatabaseModels/Index.js +2 -0
  51. package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
  52. package/build/dist/Models/DatabaseModels/Monitor.js +82 -0
  53. package/build/dist/Models/DatabaseModels/Monitor.js.map +1 -1
  54. package/build/dist/Server/API/MonitorTemplateAPI.js +108 -0
  55. package/build/dist/Server/API/MonitorTemplateAPI.js.map +1 -0
  56. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1777933061000-MigrationName.js +20 -0
  57. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1777933061000-MigrationName.js.map +1 -0
  58. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1777972687018-MigrationName.js +30 -0
  59. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1777972687018-MigrationName.js.map +1 -0
  60. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +4 -0
  61. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  62. package/build/dist/Server/Services/BillingInvoiceService.js +22 -25
  63. package/build/dist/Server/Services/BillingInvoiceService.js.map +1 -1
  64. package/build/dist/Server/Services/DockerResourceService.js +196 -0
  65. package/build/dist/Server/Services/DockerResourceService.js.map +1 -0
  66. package/build/dist/Server/Services/MonitorTemplateService.js +290 -0
  67. package/build/dist/Server/Services/MonitorTemplateService.js.map +1 -1
  68. package/build/dist/Types/Dashboard/DashboardComponentType.js +13 -0
  69. package/build/dist/Types/Dashboard/DashboardComponentType.js.map +1 -1
  70. package/build/dist/Types/Dashboard/DashboardComponents/ComponentArgument.js +15 -0
  71. package/build/dist/Types/Dashboard/DashboardComponents/ComponentArgument.js.map +1 -1
  72. package/build/dist/Types/Dashboard/DashboardComponents/DashboardDockerContainerListComponent.js +2 -0
  73. package/build/dist/Types/Dashboard/DashboardComponents/DashboardDockerContainerListComponent.js.map +1 -0
  74. package/build/dist/Types/Dashboard/DashboardComponents/DashboardDockerHostListComponent.js +2 -0
  75. package/build/dist/Types/Dashboard/DashboardComponents/DashboardDockerHostListComponent.js.map +1 -0
  76. package/build/dist/Types/Dashboard/DashboardComponents/DashboardDockerImageListComponent.js +2 -0
  77. package/build/dist/Types/Dashboard/DashboardComponents/DashboardDockerImageListComponent.js.map +1 -0
  78. package/build/dist/Types/Dashboard/DashboardComponents/DashboardDockerNetworkListComponent.js +2 -0
  79. package/build/dist/Types/Dashboard/DashboardComponents/DashboardDockerNetworkListComponent.js.map +1 -0
  80. package/build/dist/Types/Dashboard/DashboardComponents/DashboardDockerVolumeListComponent.js +2 -0
  81. package/build/dist/Types/Dashboard/DashboardComponents/DashboardDockerVolumeListComponent.js.map +1 -0
  82. package/build/dist/Types/Dashboard/DashboardComponents/DashboardKubernetesCronJobListComponent.js +2 -0
  83. package/build/dist/Types/Dashboard/DashboardComponents/DashboardKubernetesCronJobListComponent.js.map +1 -0
  84. package/build/dist/Types/Dashboard/DashboardComponents/DashboardKubernetesDaemonSetListComponent.js +2 -0
  85. package/build/dist/Types/Dashboard/DashboardComponents/DashboardKubernetesDaemonSetListComponent.js.map +1 -0
  86. package/build/dist/Types/Dashboard/DashboardComponents/DashboardKubernetesDeploymentListComponent.js +2 -0
  87. package/build/dist/Types/Dashboard/DashboardComponents/DashboardKubernetesDeploymentListComponent.js.map +1 -0
  88. package/build/dist/Types/Dashboard/DashboardComponents/DashboardKubernetesJobListComponent.js +2 -0
  89. package/build/dist/Types/Dashboard/DashboardComponents/DashboardKubernetesJobListComponent.js.map +1 -0
  90. package/build/dist/Types/Dashboard/DashboardComponents/DashboardKubernetesNamespaceListComponent.js +2 -0
  91. package/build/dist/Types/Dashboard/DashboardComponents/DashboardKubernetesNamespaceListComponent.js.map +1 -0
  92. package/build/dist/Types/Dashboard/DashboardComponents/DashboardKubernetesNodeListComponent.js +2 -0
  93. package/build/dist/Types/Dashboard/DashboardComponents/DashboardKubernetesNodeListComponent.js.map +1 -0
  94. package/build/dist/Types/Dashboard/DashboardComponents/DashboardKubernetesPodListComponent.js +2 -0
  95. package/build/dist/Types/Dashboard/DashboardComponents/DashboardKubernetesPodListComponent.js.map +1 -0
  96. package/build/dist/Types/Dashboard/DashboardComponents/DashboardKubernetesStatefulSetListComponent.js +2 -0
  97. package/build/dist/Types/Dashboard/DashboardComponents/DashboardKubernetesStatefulSetListComponent.js.map +1 -0
  98. package/build/dist/Types/Docker/DockerInventoryExtractor.js +293 -0
  99. package/build/dist/Types/Docker/DockerInventoryExtractor.js.map +1 -0
  100. package/build/dist/Utils/Dashboard/Components/DashboardAlertListComponent.js +43 -3
  101. package/build/dist/Utils/Dashboard/Components/DashboardAlertListComponent.js.map +1 -1
  102. package/build/dist/Utils/Dashboard/Components/DashboardDockerContainerListComponent.js +75 -0
  103. package/build/dist/Utils/Dashboard/Components/DashboardDockerContainerListComponent.js.map +1 -0
  104. package/build/dist/Utils/Dashboard/Components/DashboardDockerHostListComponent.js +69 -0
  105. package/build/dist/Utils/Dashboard/Components/DashboardDockerHostListComponent.js.map +1 -0
  106. package/build/dist/Utils/Dashboard/Components/DashboardDockerImageListComponent.js +75 -0
  107. package/build/dist/Utils/Dashboard/Components/DashboardDockerImageListComponent.js.map +1 -0
  108. package/build/dist/Utils/Dashboard/Components/DashboardDockerNetworkListComponent.js +66 -0
  109. package/build/dist/Utils/Dashboard/Components/DashboardDockerNetworkListComponent.js.map +1 -0
  110. package/build/dist/Utils/Dashboard/Components/DashboardDockerVolumeListComponent.js +66 -0
  111. package/build/dist/Utils/Dashboard/Components/DashboardDockerVolumeListComponent.js.map +1 -0
  112. package/build/dist/Utils/Dashboard/Components/DashboardIncidentListComponent.js +43 -3
  113. package/build/dist/Utils/Dashboard/Components/DashboardIncidentListComponent.js.map +1 -1
  114. package/build/dist/Utils/Dashboard/Components/DashboardKubernetesCronJobListComponent.js +29 -0
  115. package/build/dist/Utils/Dashboard/Components/DashboardKubernetesCronJobListComponent.js.map +1 -0
  116. package/build/dist/Utils/Dashboard/Components/DashboardKubernetesDaemonSetListComponent.js +29 -0
  117. package/build/dist/Utils/Dashboard/Components/DashboardKubernetesDaemonSetListComponent.js.map +1 -0
  118. package/build/dist/Utils/Dashboard/Components/DashboardKubernetesDeploymentListComponent.js +29 -0
  119. package/build/dist/Utils/Dashboard/Components/DashboardKubernetesDeploymentListComponent.js.map +1 -0
  120. package/build/dist/Utils/Dashboard/Components/DashboardKubernetesJobListComponent.js +29 -0
  121. package/build/dist/Utils/Dashboard/Components/DashboardKubernetesJobListComponent.js.map +1 -0
  122. package/build/dist/Utils/Dashboard/Components/DashboardKubernetesNamespaceListComponent.js +29 -0
  123. package/build/dist/Utils/Dashboard/Components/DashboardKubernetesNamespaceListComponent.js.map +1 -0
  124. package/build/dist/Utils/Dashboard/Components/DashboardKubernetesNodeListComponent.js +44 -0
  125. package/build/dist/Utils/Dashboard/Components/DashboardKubernetesNodeListComponent.js.map +1 -0
  126. package/build/dist/Utils/Dashboard/Components/DashboardKubernetesPodListComponent.js +47 -0
  127. package/build/dist/Utils/Dashboard/Components/DashboardKubernetesPodListComponent.js.map +1 -0
  128. package/build/dist/Utils/Dashboard/Components/DashboardKubernetesResourceListShared.js +55 -0
  129. package/build/dist/Utils/Dashboard/Components/DashboardKubernetesResourceListShared.js.map +1 -0
  130. package/build/dist/Utils/Dashboard/Components/DashboardKubernetesStatefulSetListComponent.js +29 -0
  131. package/build/dist/Utils/Dashboard/Components/DashboardKubernetesStatefulSetListComponent.js.map +1 -0
  132. package/build/dist/Utils/Dashboard/Components/DashboardMonitorListComponent.js +46 -3
  133. package/build/dist/Utils/Dashboard/Components/DashboardMonitorListComponent.js.map +1 -1
  134. package/build/dist/Utils/Dashboard/Components/Index.js +53 -0
  135. package/build/dist/Utils/Dashboard/Components/Index.js.map +1 -1
  136. package/package.json +1 -1
@@ -12,6 +12,21 @@ export enum ComponentInputType {
12
12
  MetricsQueryConfigs = "MetricsQueryConfigs",
13
13
  LongText = "Long Text",
14
14
  Dropdown = "Dropdown",
15
+ MultiSelectDropdown = "MultiSelectDropdown",
16
+ EntityDropdown = "EntityDropdown",
17
+ EntityMultiSelectDropdown = "EntityMultiSelectDropdown",
18
+ }
19
+
20
+ export enum EntityFilterModelType {
21
+ IncidentSeverity = "IncidentSeverity",
22
+ AlertSeverity = "AlertSeverity",
23
+ IncidentState = "IncidentState",
24
+ AlertState = "AlertState",
25
+ MonitorStatus = "MonitorStatus",
26
+ Monitor = "Monitor",
27
+ Label = "Label",
28
+ KubernetesCluster = "KubernetesCluster",
29
+ DockerHost = "DockerHost",
15
30
  }
16
31
 
17
32
  export interface ComponentArgumentSection {
@@ -32,4 +47,5 @@ export interface ComponentArgument<T extends DashboardBaseComponent> {
32
47
  placeholder?: string | undefined;
33
48
  dropdownOptions?: Array<DropdownOption> | undefined;
34
49
  section?: ComponentArgumentSection | undefined;
50
+ entityFilterModelType?: EntityFilterModelType | undefined;
35
51
  }
@@ -9,5 +9,9 @@ export default interface DashboardAlertListComponent extends BaseComponent {
9
9
  title?: string | undefined;
10
10
  maxRows?: number | undefined;
11
11
  stateFilter?: string | undefined;
12
+ severityIds?: Array<string> | undefined;
13
+ stateIds?: Array<string> | undefined;
14
+ monitorIds?: Array<string> | undefined;
15
+ labelIds?: Array<string> | undefined;
12
16
  };
13
17
  }
@@ -0,0 +1,15 @@
1
+ import ObjectID from "../../ObjectID";
2
+ import DashboardComponentType from "../DashboardComponentType";
3
+ import BaseComponent from "./DashboardBaseComponent";
4
+
5
+ export default interface DashboardDockerContainerListComponent
6
+ extends BaseComponent {
7
+ componentType: DashboardComponentType.DockerContainerList;
8
+ componentId: ObjectID;
9
+ arguments: {
10
+ title?: string | undefined;
11
+ maxRows?: number | undefined;
12
+ dockerHostIds?: Array<string> | undefined;
13
+ imageName?: string | undefined;
14
+ };
15
+ }
@@ -0,0 +1,14 @@
1
+ import ObjectID from "../../ObjectID";
2
+ import DashboardComponentType from "../DashboardComponentType";
3
+ import BaseComponent from "./DashboardBaseComponent";
4
+
5
+ export default interface DashboardDockerHostListComponent
6
+ extends BaseComponent {
7
+ componentType: DashboardComponentType.DockerHostList;
8
+ componentId: ObjectID;
9
+ arguments: {
10
+ title?: string | undefined;
11
+ maxRows?: number | undefined;
12
+ statusFilter?: string | undefined;
13
+ };
14
+ }
@@ -0,0 +1,15 @@
1
+ import ObjectID from "../../ObjectID";
2
+ import DashboardComponentType from "../DashboardComponentType";
3
+ import BaseComponent from "./DashboardBaseComponent";
4
+
5
+ export default interface DashboardDockerImageListComponent
6
+ extends BaseComponent {
7
+ componentType: DashboardComponentType.DockerImageList;
8
+ componentId: ObjectID;
9
+ arguments: {
10
+ title?: string | undefined;
11
+ maxRows?: number | undefined;
12
+ dockerHostIds?: Array<string> | undefined;
13
+ nameSearch?: string | undefined;
14
+ };
15
+ }
@@ -0,0 +1,14 @@
1
+ import ObjectID from "../../ObjectID";
2
+ import DashboardComponentType from "../DashboardComponentType";
3
+ import BaseComponent from "./DashboardBaseComponent";
4
+
5
+ export default interface DashboardDockerNetworkListComponent
6
+ extends BaseComponent {
7
+ componentType: DashboardComponentType.DockerNetworkList;
8
+ componentId: ObjectID;
9
+ arguments: {
10
+ title?: string | undefined;
11
+ maxRows?: number | undefined;
12
+ dockerHostIds?: Array<string> | undefined;
13
+ };
14
+ }
@@ -0,0 +1,14 @@
1
+ import ObjectID from "../../ObjectID";
2
+ import DashboardComponentType from "../DashboardComponentType";
3
+ import BaseComponent from "./DashboardBaseComponent";
4
+
5
+ export default interface DashboardDockerVolumeListComponent
6
+ extends BaseComponent {
7
+ componentType: DashboardComponentType.DockerVolumeList;
8
+ componentId: ObjectID;
9
+ arguments: {
10
+ title?: string | undefined;
11
+ maxRows?: number | undefined;
12
+ dockerHostIds?: Array<string> | undefined;
13
+ };
14
+ }
@@ -9,5 +9,9 @@ export default interface DashboardIncidentListComponent extends BaseComponent {
9
9
  title?: string | undefined;
10
10
  maxRows?: number | undefined;
11
11
  stateFilter?: string | undefined;
12
+ severityIds?: Array<string> | undefined;
13
+ stateIds?: Array<string> | undefined;
14
+ monitorIds?: Array<string> | undefined;
15
+ labelIds?: Array<string> | undefined;
12
16
  };
13
17
  }
@@ -0,0 +1,15 @@
1
+ import ObjectID from "../../ObjectID";
2
+ import DashboardComponentType from "../DashboardComponentType";
3
+ import BaseComponent from "./DashboardBaseComponent";
4
+
5
+ export default interface DashboardKubernetesCronJobListComponent
6
+ extends BaseComponent {
7
+ componentType: DashboardComponentType.KubernetesCronJobList;
8
+ componentId: ObjectID;
9
+ arguments: {
10
+ title?: string | undefined;
11
+ maxRows?: number | undefined;
12
+ kubernetesClusterIds?: Array<string> | undefined;
13
+ namespaces?: string | undefined;
14
+ };
15
+ }
@@ -0,0 +1,15 @@
1
+ import ObjectID from "../../ObjectID";
2
+ import DashboardComponentType from "../DashboardComponentType";
3
+ import BaseComponent from "./DashboardBaseComponent";
4
+
5
+ export default interface DashboardKubernetesDaemonSetListComponent
6
+ extends BaseComponent {
7
+ componentType: DashboardComponentType.KubernetesDaemonSetList;
8
+ componentId: ObjectID;
9
+ arguments: {
10
+ title?: string | undefined;
11
+ maxRows?: number | undefined;
12
+ kubernetesClusterIds?: Array<string> | undefined;
13
+ namespaces?: string | undefined;
14
+ };
15
+ }
@@ -0,0 +1,15 @@
1
+ import ObjectID from "../../ObjectID";
2
+ import DashboardComponentType from "../DashboardComponentType";
3
+ import BaseComponent from "./DashboardBaseComponent";
4
+
5
+ export default interface DashboardKubernetesDeploymentListComponent
6
+ extends BaseComponent {
7
+ componentType: DashboardComponentType.KubernetesDeploymentList;
8
+ componentId: ObjectID;
9
+ arguments: {
10
+ title?: string | undefined;
11
+ maxRows?: number | undefined;
12
+ kubernetesClusterIds?: Array<string> | undefined;
13
+ namespaces?: string | undefined;
14
+ };
15
+ }
@@ -0,0 +1,15 @@
1
+ import ObjectID from "../../ObjectID";
2
+ import DashboardComponentType from "../DashboardComponentType";
3
+ import BaseComponent from "./DashboardBaseComponent";
4
+
5
+ export default interface DashboardKubernetesJobListComponent
6
+ extends BaseComponent {
7
+ componentType: DashboardComponentType.KubernetesJobList;
8
+ componentId: ObjectID;
9
+ arguments: {
10
+ title?: string | undefined;
11
+ maxRows?: number | undefined;
12
+ kubernetesClusterIds?: Array<string> | undefined;
13
+ namespaces?: string | undefined;
14
+ };
15
+ }
@@ -0,0 +1,14 @@
1
+ import ObjectID from "../../ObjectID";
2
+ import DashboardComponentType from "../DashboardComponentType";
3
+ import BaseComponent from "./DashboardBaseComponent";
4
+
5
+ export default interface DashboardKubernetesNamespaceListComponent
6
+ extends BaseComponent {
7
+ componentType: DashboardComponentType.KubernetesNamespaceList;
8
+ componentId: ObjectID;
9
+ arguments: {
10
+ title?: string | undefined;
11
+ maxRows?: number | undefined;
12
+ kubernetesClusterIds?: Array<string> | undefined;
13
+ };
14
+ }
@@ -0,0 +1,15 @@
1
+ import ObjectID from "../../ObjectID";
2
+ import DashboardComponentType from "../DashboardComponentType";
3
+ import BaseComponent from "./DashboardBaseComponent";
4
+
5
+ export default interface DashboardKubernetesNodeListComponent
6
+ extends BaseComponent {
7
+ componentType: DashboardComponentType.KubernetesNodeList;
8
+ componentId: ObjectID;
9
+ arguments: {
10
+ title?: string | undefined;
11
+ maxRows?: number | undefined;
12
+ kubernetesClusterIds?: Array<string> | undefined;
13
+ readinessFilter?: string | undefined;
14
+ };
15
+ }
@@ -0,0 +1,16 @@
1
+ import ObjectID from "../../ObjectID";
2
+ import DashboardComponentType from "../DashboardComponentType";
3
+ import BaseComponent from "./DashboardBaseComponent";
4
+
5
+ export default interface DashboardKubernetesPodListComponent
6
+ extends BaseComponent {
7
+ componentType: DashboardComponentType.KubernetesPodList;
8
+ componentId: ObjectID;
9
+ arguments: {
10
+ title?: string | undefined;
11
+ maxRows?: number | undefined;
12
+ kubernetesClusterIds?: Array<string> | undefined;
13
+ namespaces?: string | undefined;
14
+ podPhases?: Array<string> | undefined;
15
+ };
16
+ }
@@ -0,0 +1,15 @@
1
+ import ObjectID from "../../ObjectID";
2
+ import DashboardComponentType from "../DashboardComponentType";
3
+ import BaseComponent from "./DashboardBaseComponent";
4
+
5
+ export default interface DashboardKubernetesStatefulSetListComponent
6
+ extends BaseComponent {
7
+ componentType: DashboardComponentType.KubernetesStatefulSetList;
8
+ componentId: ObjectID;
9
+ arguments: {
10
+ title?: string | undefined;
11
+ maxRows?: number | undefined;
12
+ kubernetesClusterIds?: Array<string> | undefined;
13
+ namespaces?: string | undefined;
14
+ };
15
+ }
@@ -9,5 +9,8 @@ export default interface DashboardMonitorListComponent extends BaseComponent {
9
9
  title?: string | undefined;
10
10
  maxRows?: number | undefined;
11
11
  statusFilter?: string | undefined;
12
+ monitorStatusIds?: Array<string> | undefined;
13
+ monitorTypes?: Array<string> | undefined;
14
+ labelIds?: Array<string> | undefined;
12
15
  };
13
16
  }
@@ -0,0 +1,343 @@
1
+ import OneUptimeDate from "../Date";
2
+ import { JSONObject } from "../JSON";
3
+ import { ParsedDockerResource } from "../../Server/Services/DockerResourceService";
4
+
5
+ /*
6
+ * ------------------------------------------------------------------
7
+ * DockerInventoryExtractor
8
+ * ------------------------------------------------------------------
9
+ *
10
+ * Parses a single inventory log record emitted by the OneUptime
11
+ * Docker Agent's snapshot script. The script polls the local Docker
12
+ * daemon every 5 minutes for containers / images / networks /
13
+ * volumes and emits one JSON object per line into a log file that
14
+ * the OTel filelog receiver forwards as an OTLP log.
15
+ *
16
+ * The agreed wire format is a JSON envelope:
17
+ *
18
+ * {
19
+ * "kind": "Container" | "Image" | "Network" | "Volume",
20
+ * "data": { ...native docker payload... }
21
+ * }
22
+ *
23
+ * The kind discriminator is set as a log record attribute by the
24
+ * agent's filelog operator chain, but we also keep it inside the
25
+ * envelope so the parser can sanity-check.
26
+ *
27
+ * Each kind has a small dedicated parser that pulls out the fields
28
+ * we promote to first-class columns on `DockerResource` (name,
29
+ * containerId, imageName, state, labels, creation timestamp). The
30
+ * full payload is *not* persisted — it lives on the original log
31
+ * record in ClickHouse if a user ever needs the raw blob.
32
+ *
33
+ * ------------------------------------------------------------------
34
+ */
35
+
36
+ export const INVENTORY_KIND_ATTRIBUTE: string = "oneuptime.docker.kind";
37
+
38
+ export const INVENTORIED_DOCKER_KINDS: ReadonlyArray<string> = [
39
+ "Container",
40
+ "Image",
41
+ "Network",
42
+ "Volume",
43
+ ];
44
+
45
+ const INVENTORIED_KIND_SET: Set<string> = new Set(
46
+ INVENTORIED_DOCKER_KINDS.map((k: string) => {
47
+ return k.toLowerCase();
48
+ }),
49
+ );
50
+
51
+ export function isInventoriedDockerKind(kind: string): boolean {
52
+ return INVENTORIED_KIND_SET.has(kind.toLowerCase());
53
+ }
54
+
55
+ /*
56
+ * Map a kind in any common form (lowercase plural, lowercase
57
+ * singular, or PascalCase) to the canonical PascalCase kind we store
58
+ * in the database. Returns null for anything we don't model.
59
+ */
60
+ export function canonicalDockerKind(raw: string): string | null {
61
+ const trimmed: string = (raw || "").trim().toLowerCase();
62
+ if (!trimmed) {
63
+ return null;
64
+ }
65
+ const map: Record<string, string> = {
66
+ container: "Container",
67
+ containers: "Container",
68
+ image: "Image",
69
+ images: "Image",
70
+ network: "Network",
71
+ networks: "Network",
72
+ volume: "Volume",
73
+ volumes: "Volume",
74
+ };
75
+ return map[trimmed] || null;
76
+ }
77
+
78
+ function parseLogBody(logBody: string): JSONObject | null {
79
+ try {
80
+ const parsed: unknown = JSON.parse(logBody);
81
+ if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
82
+ return parsed as JSONObject;
83
+ }
84
+ return null;
85
+ } catch {
86
+ return null;
87
+ }
88
+ }
89
+
90
+ function readString(obj: JSONObject, key: string): string | null {
91
+ const v: unknown = obj[key];
92
+ if (typeof v === "string" && v.trim().length > 0) {
93
+ return v.trim();
94
+ }
95
+ return null;
96
+ }
97
+
98
+ function readJSONObject(obj: JSONObject, key: string): JSONObject | null {
99
+ const v: unknown = obj[key];
100
+ if (v && typeof v === "object" && !Array.isArray(v)) {
101
+ return v as JSONObject;
102
+ }
103
+ return null;
104
+ }
105
+
106
+ function parseTimestamp(raw: string | null): Date | null {
107
+ if (!raw) {
108
+ return null;
109
+ }
110
+ try {
111
+ const d: Date = OneUptimeDate.fromString(raw);
112
+ if (isNaN(d.getTime())) {
113
+ return null;
114
+ }
115
+ return d;
116
+ } catch {
117
+ return null;
118
+ }
119
+ }
120
+
121
+ /*
122
+ * Container shape emitted by `docker container ls --format json` plus
123
+ * a few enrichments the agent script adds:
124
+ * { Id, Names, Image, State, Status, CreatedAt, Labels }
125
+ *
126
+ * Names from the Docker CLI is a slash-prefixed comma-joined string
127
+ * ("/web,/web-1"). We strip the leading slash and take the first
128
+ * entry — that's what `docker_stats` reports as `container.name` in
129
+ * metric attributes, so the row keys stay consistent across paths.
130
+ */
131
+ function parseContainer(
132
+ data: JSONObject,
133
+ lastSeenAt: Date,
134
+ ): ParsedDockerResource | null {
135
+ const rawNames: string | null = readString(data, "Names");
136
+ const rawName: string | null = readString(data, "Name");
137
+ const namesField: string = rawNames || rawName || "";
138
+ const firstName: string = namesField
139
+ .split(",")
140
+ .map((n: string) => {
141
+ return n.trim().replace(/^\//, "");
142
+ })
143
+ .filter((n: string) => {
144
+ return n.length > 0;
145
+ })[0]!;
146
+
147
+ if (!firstName) {
148
+ return null;
149
+ }
150
+
151
+ const idRaw: string | null = readString(data, "Id");
152
+ const containerId: string | null = idRaw ? idRaw.substring(0, 12) : null;
153
+ const imageName: string | null = readString(data, "Image");
154
+ const state: string | null = readString(data, "State");
155
+ const labels: JSONObject | null = readJSONObject(data, "Labels");
156
+ const created: Date | null = parseTimestamp(readString(data, "CreatedAt"));
157
+
158
+ return {
159
+ kind: "Container",
160
+ name: firstName,
161
+ containerId,
162
+ imageName,
163
+ state: state ? state.toLowerCase() : null,
164
+ labels,
165
+ resourceCreationTimestamp: created,
166
+ lastSeenAt,
167
+ };
168
+ }
169
+
170
+ /*
171
+ * Image shape from `docker image ls --format json`:
172
+ * { ID, Repository, Tag, CreatedAt, Labels }
173
+ *
174
+ * Name = Repository:Tag (matches what container.image.name emits).
175
+ * Skip dangling images (Repository=<none> with no tag) — they would
176
+ * collide on the unique key and are noise in a list view.
177
+ */
178
+ function parseImage(
179
+ data: JSONObject,
180
+ lastSeenAt: Date,
181
+ ): ParsedDockerResource | null {
182
+ const repository: string | null = readString(data, "Repository");
183
+ const tag: string | null = readString(data, "Tag");
184
+ const explicitName: string | null = readString(data, "Name");
185
+
186
+ let name: string | null = explicitName;
187
+ if (!name && repository && repository !== "<none>") {
188
+ name = tag && tag !== "<none>" ? `${repository}:${tag}` : repository;
189
+ }
190
+
191
+ if (!name) {
192
+ return null;
193
+ }
194
+
195
+ const idRaw: string | null = readString(data, "ID") || readString(data, "Id");
196
+ const containerId: string | null = idRaw
197
+ ? idRaw.replace(/^sha256:/, "").substring(0, 12)
198
+ : null;
199
+ const labels: JSONObject | null = readJSONObject(data, "Labels");
200
+ const created: Date | null = parseTimestamp(readString(data, "CreatedAt"));
201
+
202
+ return {
203
+ kind: "Image",
204
+ name,
205
+ containerId,
206
+ imageName: null,
207
+ state: null,
208
+ labels,
209
+ resourceCreationTimestamp: created,
210
+ lastSeenAt,
211
+ };
212
+ }
213
+
214
+ /*
215
+ * Network shape from `docker network ls --format json`:
216
+ * { ID, Name, Driver, Scope, CreatedAt, Labels }
217
+ */
218
+ function parseNetwork(
219
+ data: JSONObject,
220
+ lastSeenAt: Date,
221
+ ): ParsedDockerResource | null {
222
+ const name: string | null = readString(data, "Name");
223
+ if (!name) {
224
+ return null;
225
+ }
226
+ const idRaw: string | null = readString(data, "ID") || readString(data, "Id");
227
+ const driver: string | null = readString(data, "Driver");
228
+ const scope: string | null = readString(data, "Scope");
229
+ const labels: JSONObject | null = readJSONObject(data, "Labels");
230
+ const created: Date | null = parseTimestamp(readString(data, "CreatedAt"));
231
+
232
+ /*
233
+ * Driver and scope are surfaced in the State column in the widget
234
+ * (e.g. "bridge / local"). Encoded as "driver/scope" so we don't
235
+ * need a new column on the table.
236
+ */
237
+ const stateParts: Array<string> = [];
238
+ if (driver) {
239
+ stateParts.push(driver);
240
+ }
241
+ if (scope) {
242
+ stateParts.push(scope);
243
+ }
244
+
245
+ return {
246
+ kind: "Network",
247
+ name,
248
+ containerId: idRaw ? idRaw.substring(0, 12) : null,
249
+ imageName: null,
250
+ state: stateParts.length > 0 ? stateParts.join("/") : null,
251
+ labels,
252
+ resourceCreationTimestamp: created,
253
+ lastSeenAt,
254
+ };
255
+ }
256
+
257
+ /*
258
+ * Volume shape from `docker volume ls --format json`:
259
+ * { Name, Driver, Mountpoint, Scope, Labels, CreatedAt }
260
+ */
261
+ function parseVolume(
262
+ data: JSONObject,
263
+ lastSeenAt: Date,
264
+ ): ParsedDockerResource | null {
265
+ const name: string | null = readString(data, "Name");
266
+ if (!name) {
267
+ return null;
268
+ }
269
+ const driver: string | null = readString(data, "Driver");
270
+ const scope: string | null = readString(data, "Scope");
271
+ const labels: JSONObject | null = readJSONObject(data, "Labels");
272
+ const created: Date | null = parseTimestamp(readString(data, "CreatedAt"));
273
+
274
+ const stateParts: Array<string> = [];
275
+ if (driver) {
276
+ stateParts.push(driver);
277
+ }
278
+ if (scope) {
279
+ stateParts.push(scope);
280
+ }
281
+
282
+ return {
283
+ kind: "Volume",
284
+ name,
285
+ containerId: null,
286
+ imageName: null,
287
+ state: stateParts.length > 0 ? stateParts.join("/") : null,
288
+ labels,
289
+ resourceCreationTimestamp: created,
290
+ lastSeenAt,
291
+ };
292
+ }
293
+
294
+ export interface ExtractedDockerInventoryRecord {
295
+ resource: ParsedDockerResource;
296
+ }
297
+
298
+ /**
299
+ * Parse a single inventory log line. Returns null when the body is
300
+ * malformed or the kind is not modeled — callers should swallow nulls
301
+ * silently rather than fail the whole batch.
302
+ */
303
+ export function extractDockerInventoryResource(data: {
304
+ kind: string;
305
+ logBody: string;
306
+ lastSeenAt: Date;
307
+ }): ExtractedDockerInventoryRecord | null {
308
+ const canonical: string | null = canonicalDockerKind(data.kind);
309
+ if (!canonical) {
310
+ return null;
311
+ }
312
+
313
+ const body: JSONObject | null = parseLogBody(data.logBody);
314
+ if (!body) {
315
+ return null;
316
+ }
317
+
318
+ /*
319
+ * The agent wraps the native docker payload in `{ kind, data }`.
320
+ * Older snapshot lines or test inputs may be the raw payload — we
321
+ * accept either by pulling `data` if present, else using the body
322
+ * directly.
323
+ */
324
+ const inner: JSONObject =
325
+ (readJSONObject(body, "data") as JSONObject) || body;
326
+
327
+ let parsed: ParsedDockerResource | null = null;
328
+ if (canonical === "Container") {
329
+ parsed = parseContainer(inner, data.lastSeenAt);
330
+ } else if (canonical === "Image") {
331
+ parsed = parseImage(inner, data.lastSeenAt);
332
+ } else if (canonical === "Network") {
333
+ parsed = parseNetwork(inner, data.lastSeenAt);
334
+ } else if (canonical === "Volume") {
335
+ parsed = parseVolume(inner, data.lastSeenAt);
336
+ }
337
+
338
+ if (!parsed) {
339
+ return null;
340
+ }
341
+
342
+ return { resource: parsed };
343
+ }
@@ -6,6 +6,7 @@ import {
6
6
  ComponentArgument,
7
7
  ComponentArgumentSection,
8
8
  ComponentInputType,
9
+ EntityFilterModelType,
9
10
  } from "../../../Types/Dashboard/DashboardComponents/ComponentArgument";
10
11
  import DashboardComponentType from "../../../Types/Dashboard/DashboardComponentType";
11
12
 
@@ -67,8 +68,8 @@ export default class DashboardAlertListComponentUtil extends DashboardBaseCompon
67
68
  });
68
69
 
69
70
  componentArguments.push({
70
- name: "State",
71
- description: "Filter alerts by lifecycle state",
71
+ name: "Lifecycle State",
72
+ description: "Quick filter by lifecycle state",
72
73
  required: false,
73
74
  type: ComponentInputType.Dropdown,
74
75
  id: "stateFilter",
@@ -81,6 +82,50 @@ export default class DashboardAlertListComponentUtil extends DashboardBaseCompon
81
82
  ],
82
83
  });
83
84
 
85
+ componentArguments.push({
86
+ name: "Severity",
87
+ description: "Show only alerts matching the selected severities",
88
+ required: false,
89
+ type: ComponentInputType.EntityMultiSelectDropdown,
90
+ id: "severityIds",
91
+ placeholder: "All severities",
92
+ section: FiltersSection,
93
+ entityFilterModelType: EntityFilterModelType.AlertSeverity,
94
+ });
95
+
96
+ componentArguments.push({
97
+ name: "State",
98
+ description: "Show only alerts in the selected states",
99
+ required: false,
100
+ type: ComponentInputType.EntityMultiSelectDropdown,
101
+ id: "stateIds",
102
+ placeholder: "All states",
103
+ section: FiltersSection,
104
+ entityFilterModelType: EntityFilterModelType.AlertState,
105
+ });
106
+
107
+ componentArguments.push({
108
+ name: "Monitors",
109
+ description: "Show only alerts linked to the selected monitors",
110
+ required: false,
111
+ type: ComponentInputType.EntityMultiSelectDropdown,
112
+ id: "monitorIds",
113
+ placeholder: "All monitors",
114
+ section: FiltersSection,
115
+ entityFilterModelType: EntityFilterModelType.Monitor,
116
+ });
117
+
118
+ componentArguments.push({
119
+ name: "Labels",
120
+ description: "Show only alerts tagged with the selected labels",
121
+ required: false,
122
+ type: ComponentInputType.EntityMultiSelectDropdown,
123
+ id: "labelIds",
124
+ placeholder: "All labels",
125
+ section: FiltersSection,
126
+ entityFilterModelType: EntityFilterModelType.Label,
127
+ });
128
+
84
129
  return componentArguments;
85
130
  }
86
131
  }