@oneuptime/common 8.0.5570 → 8.0.5572

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 (92) hide show
  1. package/Models/DatabaseModels/AlertFeed.ts +2 -0
  2. package/Models/DatabaseModels/AlertSeverity.ts +2 -0
  3. package/Models/DatabaseModels/AlertState.ts +2 -0
  4. package/Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel.ts +5 -5
  5. package/Models/DatabaseModels/IncidentSeverity.ts +2 -0
  6. package/Models/DatabaseModels/IncidentState.ts +2 -0
  7. package/Models/DatabaseModels/Label.ts +2 -0
  8. package/Models/DatabaseModels/MonitorStatus.ts +2 -0
  9. package/Models/DatabaseModels/Project.ts +16 -12
  10. package/Models/DatabaseModels/ScheduledMaintenanceFeed.ts +2 -0
  11. package/Models/DatabaseModels/ScheduledMaintenanceState.ts +2 -0
  12. package/Models/DatabaseModels/ServiceCatalog.ts +2 -0
  13. package/Models/DatabaseModels/TelemetryService.ts +2 -0
  14. package/Server/Infrastructure/Postgres/SchemaMigrations/1762554602716-MigrationName.ts +9 -8
  15. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +1 -1
  16. package/Tests/UI/Components/Pill.test.tsx +8 -0
  17. package/Types/Color.ts +2 -2
  18. package/Types/Database/ColorField.ts +64 -0
  19. package/Types/Icon/IconProp.ts +1 -0
  20. package/UI/Components/Dropdown/Dropdown.tsx +503 -10
  21. package/UI/Components/Forms/ModelForm.tsx +63 -26
  22. package/UI/Components/Icon/Icon.tsx +4 -0
  23. package/UI/Components/Label/Label.tsx +50 -0
  24. package/UI/Components/Label/Labels.tsx +35 -0
  25. package/UI/Components/ModelTable/BaseModelTable.tsx +134 -6
  26. package/UI/Components/Page/ModelPage.tsx +43 -4
  27. package/UI/Components/Page/Page.tsx +36 -5
  28. package/UI/Components/Pill/Pill.tsx +13 -3
  29. package/UI/Config.ts +1 -2
  30. package/UI/Utils/Dropdown.ts +19 -1
  31. package/build/dist/Models/DatabaseModels/AlertFeed.js +2 -0
  32. package/build/dist/Models/DatabaseModels/AlertFeed.js.map +1 -1
  33. package/build/dist/Models/DatabaseModels/AlertSeverity.js +2 -0
  34. package/build/dist/Models/DatabaseModels/AlertSeverity.js.map +1 -1
  35. package/build/dist/Models/DatabaseModels/AlertState.js +2 -0
  36. package/build/dist/Models/DatabaseModels/AlertState.js.map +1 -1
  37. package/build/dist/Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel.js +4 -3
  38. package/build/dist/Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel.js.map +1 -1
  39. package/build/dist/Models/DatabaseModels/IncidentSeverity.js +2 -0
  40. package/build/dist/Models/DatabaseModels/IncidentSeverity.js.map +1 -1
  41. package/build/dist/Models/DatabaseModels/IncidentState.js +2 -0
  42. package/build/dist/Models/DatabaseModels/IncidentState.js.map +1 -1
  43. package/build/dist/Models/DatabaseModels/Label.js +2 -0
  44. package/build/dist/Models/DatabaseModels/Label.js.map +1 -1
  45. package/build/dist/Models/DatabaseModels/MonitorStatus.js +2 -0
  46. package/build/dist/Models/DatabaseModels/MonitorStatus.js.map +1 -1
  47. package/build/dist/Models/DatabaseModels/Project.js +12 -12
  48. package/build/dist/Models/DatabaseModels/Project.js.map +1 -1
  49. package/build/dist/Models/DatabaseModels/ScheduledMaintenanceFeed.js +2 -0
  50. package/build/dist/Models/DatabaseModels/ScheduledMaintenanceFeed.js.map +1 -1
  51. package/build/dist/Models/DatabaseModels/ScheduledMaintenanceState.js +2 -0
  52. package/build/dist/Models/DatabaseModels/ScheduledMaintenanceState.js.map +1 -1
  53. package/build/dist/Models/DatabaseModels/ServiceCatalog.js +2 -0
  54. package/build/dist/Models/DatabaseModels/ServiceCatalog.js.map +1 -1
  55. package/build/dist/Models/DatabaseModels/TelemetryService.js +2 -0
  56. package/build/dist/Models/DatabaseModels/TelemetryService.js.map +1 -1
  57. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1762554602716-MigrationName.js +1 -1
  58. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1762554602716-MigrationName.js.map +1 -1
  59. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +1 -1
  60. package/build/dist/Tests/UI/Components/Pill.test.js +6 -0
  61. package/build/dist/Tests/UI/Components/Pill.test.js.map +1 -1
  62. package/build/dist/Types/Color.js +1 -1
  63. package/build/dist/Types/Color.js.map +1 -1
  64. package/build/dist/Types/Database/ColorField.js +27 -0
  65. package/build/dist/Types/Database/ColorField.js.map +1 -0
  66. package/build/dist/Types/Icon/IconProp.js +1 -0
  67. package/build/dist/Types/Icon/IconProp.js.map +1 -1
  68. package/build/dist/UI/Components/Dropdown/Dropdown.js +264 -8
  69. package/build/dist/UI/Components/Dropdown/Dropdown.js.map +1 -1
  70. package/build/dist/UI/Components/Forms/ModelForm.js +33 -10
  71. package/build/dist/UI/Components/Forms/ModelForm.js.map +1 -1
  72. package/build/dist/UI/Components/Icon/Icon.js +5 -0
  73. package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
  74. package/build/dist/UI/Components/Label/Label.js +32 -0
  75. package/build/dist/UI/Components/Label/Label.js.map +1 -0
  76. package/build/dist/UI/Components/Label/Labels.js +13 -0
  77. package/build/dist/UI/Components/Label/Labels.js.map +1 -0
  78. package/build/dist/UI/Components/ModelTable/BaseModelTable.js +82 -6
  79. package/build/dist/UI/Components/ModelTable/BaseModelTable.js.map +1 -1
  80. package/build/dist/UI/Components/Page/ModelPage.js +24 -4
  81. package/build/dist/UI/Components/Page/ModelPage.js.map +1 -1
  82. package/build/dist/UI/Components/Page/Page.js +18 -3
  83. package/build/dist/UI/Components/Page/Page.js.map +1 -1
  84. package/build/dist/UI/Components/Pill/Pill.js +4 -4
  85. package/build/dist/UI/Components/Pill/Pill.js.map +1 -1
  86. package/build/dist/UI/Config.js.map +1 -1
  87. package/build/dist/UI/Utils/Dropdown.js +11 -1
  88. package/build/dist/UI/Utils/Dropdown.js.map +1 -1
  89. package/package.json +1 -1
  90. package/Types/Database/LabelsColumn.ts +0 -7
  91. package/build/dist/Types/Database/LabelsColumn.js +0 -6
  92. package/build/dist/Types/Database/LabelsColumn.js.map +0 -1
@@ -10,6 +10,7 @@ import ColumnType from "../../Types/Database/ColumnType";
10
10
  import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
11
11
  import EnableDocumentation from "../../Types/Database/EnableDocumentation";
12
12
  import EnableWorkflow from "../../Types/Database/EnableWorkflow";
13
+ import ColorField from "../../Types/Database/ColorField";
13
14
  import TableColumn from "../../Types/Database/TableColumn";
14
15
  import TableColumnType from "../../Types/Database/TableColumnType";
15
16
  import TableMetadata from "../../Types/Database/TableMetadata";
@@ -418,6 +419,7 @@ export default class AlertFeed extends BaseModel {
418
419
  ],
419
420
  update: [],
420
421
  })
422
+ @ColorField()
421
423
  @TableColumn({
422
424
  type: TableColumnType.Color,
423
425
  required: true,
@@ -12,6 +12,7 @@ import ColumnType from "../../Types/Database/ColumnType";
12
12
  import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
13
13
  import EnableDocumentation from "../../Types/Database/EnableDocumentation";
14
14
  import EnableWorkflow from "../../Types/Database/EnableWorkflow";
15
+ import ColorField from "../../Types/Database/ColorField";
15
16
  import SlugifyColumn from "../../Types/Database/SlugifyColumn";
16
17
  import TableColumn from "../../Types/Database/TableColumn";
17
18
  import TableColumnType from "../../Types/Database/TableColumnType";
@@ -378,6 +379,7 @@ export default class AlertSeverity extends BaseModel {
378
379
  Permission.EditAlertSeverity,
379
380
  ],
380
381
  })
382
+ @ColorField()
381
383
  @TableColumn({
382
384
  title: "Color",
383
385
  required: true,
@@ -12,6 +12,7 @@ import ColumnType from "../../Types/Database/ColumnType";
12
12
  import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
13
13
  import EnableDocumentation from "../../Types/Database/EnableDocumentation";
14
14
  import EnableWorkflow from "../../Types/Database/EnableWorkflow";
15
+ import ColorField from "../../Types/Database/ColorField";
15
16
  import SlugifyColumn from "../../Types/Database/SlugifyColumn";
16
17
  import TableColumn from "../../Types/Database/TableColumn";
17
18
  import TableColumnType from "../../Types/Database/TableColumnType";
@@ -356,6 +357,7 @@ export default class AlertState extends BaseModel {
356
357
  Permission.EditAlertState,
357
358
  ],
358
359
  })
360
+ @ColorField()
359
361
  @TableColumn({
360
362
  title: "Color",
361
363
  required: true,
@@ -15,6 +15,7 @@ import TableColumn, {
15
15
  getTableColumns,
16
16
  } from "../../../Types/Database/TableColumn";
17
17
  import TableColumnType from "../../../Types/Database/TableColumnType";
18
+ import { getFirstColorFieldColumn } from "../../../Types/Database/ColorField";
18
19
  import Dictionary from "../../../Types/Dictionary";
19
20
  import Email from "../../../Types/Email";
20
21
  import BadDataException from "../../../Types/Exception/BadDataException";
@@ -123,7 +124,6 @@ export default class DatabaseBaseModel extends BaseEntity {
123
124
  public isMasterAdminApiDocs!: boolean;
124
125
 
125
126
  public currentUserCanAccessColumnBy!: string | null;
126
- public labelsColumn!: string | null;
127
127
  public slugifyColumn!: string | null;
128
128
  public saveSlugToColumn!: string | null;
129
129
  public singularName!: string | null;
@@ -204,6 +204,10 @@ export default class DatabaseBaseModel extends BaseEntity {
204
204
  return new Columns(Object.keys(getTableColumns(this)));
205
205
  }
206
206
 
207
+ public getFirstColorColumn(): string | null {
208
+ return getFirstColorFieldColumn(this);
209
+ }
210
+
207
211
  public canQueryMultiTenant(): boolean {
208
212
  return Boolean(this.isMultiTenantRequestAllowed);
209
213
  }
@@ -345,10 +349,6 @@ export default class DatabaseBaseModel extends BaseEntity {
345
349
  return this.currentUserCanAccessColumnBy;
346
350
  }
347
351
 
348
- public getLabelsColumn(): string | null {
349
- return this.labelsColumn;
350
- }
351
-
352
352
  public get id(): ObjectID | null {
353
353
  return this._id ? new ObjectID(this._id) : null;
354
354
  }
@@ -12,6 +12,7 @@ import ColumnType from "../../Types/Database/ColumnType";
12
12
  import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
13
13
  import EnableDocumentation from "../../Types/Database/EnableDocumentation";
14
14
  import EnableWorkflow from "../../Types/Database/EnableWorkflow";
15
+ import ColorField from "../../Types/Database/ColorField";
15
16
  import SlugifyColumn from "../../Types/Database/SlugifyColumn";
16
17
  import TableColumn from "../../Types/Database/TableColumn";
17
18
  import TableColumnType from "../../Types/Database/TableColumnType";
@@ -378,6 +379,7 @@ export default class IncidentSeverity extends BaseModel {
378
379
  Permission.EditIncidentSeverity,
379
380
  ],
380
381
  })
382
+ @ColorField()
381
383
  @TableColumn({
382
384
  title: "Color",
383
385
  required: true,
@@ -12,6 +12,7 @@ import ColumnType from "../../Types/Database/ColumnType";
12
12
  import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
13
13
  import EnableDocumentation from "../../Types/Database/EnableDocumentation";
14
14
  import EnableWorkflow from "../../Types/Database/EnableWorkflow";
15
+ import ColorField from "../../Types/Database/ColorField";
15
16
  import SlugifyColumn from "../../Types/Database/SlugifyColumn";
16
17
  import TableColumn from "../../Types/Database/TableColumn";
17
18
  import TableColumnType from "../../Types/Database/TableColumnType";
@@ -380,6 +381,7 @@ export default class IncidentState extends BaseModel {
380
381
  Permission.EditIncidentState,
381
382
  ],
382
383
  })
384
+ @ColorField()
383
385
  @TableColumn({
384
386
  title: "Color",
385
387
  required: true,
@@ -12,6 +12,7 @@ import ColumnType from "../../Types/Database/ColumnType";
12
12
  import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
13
13
  import EnableDocumentation from "../../Types/Database/EnableDocumentation";
14
14
  import EnableWorkflow from "../../Types/Database/EnableWorkflow";
15
+ import ColorField from "../../Types/Database/ColorField";
15
16
  import SlugifyColumn from "../../Types/Database/SlugifyColumn";
16
17
  import TableColumn from "../../Types/Database/TableColumn";
17
18
  import TableColumnType from "../../Types/Database/TableColumnType";
@@ -365,6 +366,7 @@ export default class Label extends AccessControlModel {
365
366
  Permission.EditProjectLabel,
366
367
  ],
367
368
  })
369
+ @ColorField()
368
370
  @TableColumn({
369
371
  title: "Color",
370
372
  required: true,
@@ -12,6 +12,7 @@ import ColumnType from "../../Types/Database/ColumnType";
12
12
  import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
13
13
  import EnableDocumentation from "../../Types/Database/EnableDocumentation";
14
14
  import EnableWorkflow from "../../Types/Database/EnableWorkflow";
15
+ import ColorField from "../../Types/Database/ColorField";
15
16
  import SlugifyColumn from "../../Types/Database/SlugifyColumn";
16
17
  import TableColumn from "../../Types/Database/TableColumn";
17
18
  import TableColumnType from "../../Types/Database/TableColumnType";
@@ -379,6 +380,7 @@ export default class MonitorStatus extends BaseModel {
379
380
  Permission.EditProjectMonitorStatus,
380
381
  ],
381
382
  })
383
+ @ColorField()
382
384
  @TableColumn({
383
385
  title: "Color",
384
386
  required: true,
@@ -704,8 +704,8 @@ export default class Project extends TenantModel {
704
704
  type: TableColumnType.Number,
705
705
  isDefaultValueColumn: true,
706
706
  required: true,
707
- title: "SMS or Call Current Balance",
708
- description: "Balance in USD for SMS or Call",
707
+ title: "SMS, Call, and WhatsApp Current Balance",
708
+ description: "Balance in USD for SMS, Call, and WhatsApp",
709
709
  defaultValue: 0,
710
710
  })
711
711
  @Column({
@@ -732,7 +732,7 @@ export default class Project extends TenantModel {
732
732
  isDefaultValueColumn: true,
733
733
  required: true,
734
734
  title: "Auto Recharge Amount",
735
- description: "Auto recharge amount in USD for SMS or Call",
735
+ description: "Auto recharge amount in USD for SMS, Call, and WhatsApp",
736
736
  defaultValue: 20,
737
737
  })
738
738
  @Column({
@@ -760,7 +760,7 @@ export default class Project extends TenantModel {
760
760
  required: true,
761
761
  title: "Auto Recharge when current balance falls to",
762
762
  description:
763
- "Auto recharge is triggered when current balance falls to this amount in USD for SMS or Call",
763
+ "Auto recharge is triggered when current balance falls to this amount in USD for SMS, Call, and WhatsApp",
764
764
  defaultValue: 10,
765
765
  })
766
766
  @Column({
@@ -868,8 +868,9 @@ export default class Project extends TenantModel {
868
868
  required: true,
869
869
  isDefaultValueColumn: true,
870
870
  type: TableColumnType.Boolean,
871
- title: "Enable auto recharge SMS or Call balance",
872
- description: "Enable auto recharge SMS or Call balance for this project.",
871
+ title: "Enable auto recharge for SMS, Call, and WhatsApp balance",
872
+ description:
873
+ "Enable auto recharge for SMS, Call, and WhatsApp balance for this project.",
873
874
  defaultValue: false,
874
875
  })
875
876
  @Column({
@@ -889,8 +890,9 @@ export default class Project extends TenantModel {
889
890
  isDefaultValueColumn: true,
890
891
  hideColumnInDocumentation: true,
891
892
  type: TableColumnType.Boolean,
892
- title: "Low Call and SMS Balance Notification Sent to Owners",
893
- description: "Low Call and SMS Balance Notification Sent to Owners",
893
+ title: "Low SMS, Call, and WhatsApp Balance Notification Sent to Owners",
894
+ description:
895
+ "Low SMS, Call, and WhatsApp Balance Notification Sent to Owners",
894
896
  defaultValue: false,
895
897
  })
896
898
  @Column({
@@ -910,9 +912,10 @@ export default class Project extends TenantModel {
910
912
  isDefaultValueColumn: true,
911
913
  type: TableColumnType.Boolean,
912
914
  hideColumnInDocumentation: true,
913
- title: "Failed Call and SMS Balance Charge Notification Sent to Owners",
915
+ title:
916
+ "Failed SMS, Call, and WhatsApp Balance Charge Notification Sent to Owners",
914
917
  description:
915
- "Failed Call and SMS Balance Charge Notification Sent to Owners",
918
+ "Failed SMS, Call, and WhatsApp Balance Charge Notification Sent to Owners",
916
919
  defaultValue: false,
917
920
  })
918
921
  @Column({
@@ -933,8 +936,9 @@ export default class Project extends TenantModel {
933
936
  isDefaultValueColumn: true,
934
937
  hideColumnInDocumentation: true,
935
938
  type: TableColumnType.Boolean,
936
- title: "Not Enabled SMS or Call Notification Sent to Owners",
937
- description: "Not Enabled SMS or Call Notification Sent to Owners",
939
+ title: "Not Enabled SMS, Call, or WhatsApp Notification Sent to Owners",
940
+ description:
941
+ "Not Enabled SMS, Call, or WhatsApp Notification Sent to Owners",
938
942
  defaultValue: false,
939
943
  })
940
944
  @Column({
@@ -10,6 +10,7 @@ import ColumnType from "../../Types/Database/ColumnType";
10
10
  import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
11
11
  import EnableDocumentation from "../../Types/Database/EnableDocumentation";
12
12
  import EnableWorkflow from "../../Types/Database/EnableWorkflow";
13
+ import ColorField from "../../Types/Database/ColorField";
13
14
  import TableColumn from "../../Types/Database/TableColumn";
14
15
  import TableColumnType from "../../Types/Database/TableColumnType";
15
16
  import TableMetadata from "../../Types/Database/TableMetadata";
@@ -422,6 +423,7 @@ export default class ScheduledMaintenanceFeed extends BaseModel {
422
423
  ],
423
424
  update: [],
424
425
  })
426
+ @ColorField()
425
427
  @TableColumn({
426
428
  type: TableColumnType.Color,
427
429
  required: true,
@@ -12,6 +12,7 @@ import ColumnType from "../../Types/Database/ColumnType";
12
12
  import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
13
13
  import EnableDocumentation from "../../Types/Database/EnableDocumentation";
14
14
  import EnableWorkflow from "../../Types/Database/EnableWorkflow";
15
+ import ColorField from "../../Types/Database/ColorField";
15
16
  import SlugifyColumn from "../../Types/Database/SlugifyColumn";
16
17
  import TableColumn from "../../Types/Database/TableColumn";
17
18
  import TableColumnType from "../../Types/Database/TableColumnType";
@@ -380,6 +381,7 @@ export default class ScheduledMaintenanceState extends BaseModel {
380
381
  Permission.EditScheduledMaintenanceState,
381
382
  ],
382
383
  })
384
+ @ColorField()
383
385
  @TableColumn({
384
386
  title: "Color",
385
387
  required: true,
@@ -14,6 +14,7 @@ import ColumnType from "../../Types/Database/ColumnType";
14
14
  import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
15
15
  import EnableDocumentation from "../../Types/Database/EnableDocumentation";
16
16
  import EnableWorkflow from "../../Types/Database/EnableWorkflow";
17
+ import ColorField from "../../Types/Database/ColorField";
17
18
  import SlugifyColumn from "../../Types/Database/SlugifyColumn";
18
19
  import TableColumn from "../../Types/Database/TableColumn";
19
20
  import TableColumnType from "../../Types/Database/TableColumnType";
@@ -448,6 +449,7 @@ export default class ServiceCatalog extends BaseModel {
448
449
  Permission.EditServiceCatalog,
449
450
  ],
450
451
  })
452
+ @ColorField()
451
453
  @TableColumn({
452
454
  type: TableColumnType.Color,
453
455
  title: "Service Color",
@@ -12,6 +12,7 @@ import ColumnType from "../../Types/Database/ColumnType";
12
12
  import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
13
13
  import EnableDocumentation from "../../Types/Database/EnableDocumentation";
14
14
  import EnableWorkflow from "../../Types/Database/EnableWorkflow";
15
+ import ColorField from "../../Types/Database/ColorField";
15
16
  import SlugifyColumn from "../../Types/Database/SlugifyColumn";
16
17
  import TableColumn from "../../Types/Database/TableColumn";
17
18
  import TableColumnType from "../../Types/Database/TableColumnType";
@@ -505,6 +506,7 @@ export default class TelemetryService extends BaseModel {
505
506
  Permission.EditTelemetryService,
506
507
  ],
507
508
  })
509
+ @ColorField()
508
510
  @TableColumn({
509
511
  type: TableColumnType.Color,
510
512
  title: "Service Color",
@@ -1,14 +1,15 @@
1
1
  import { MigrationInterface, QueryRunner } from "typeorm";
2
2
 
3
3
  export class MigrationName1762554602716 implements MigrationInterface {
4
- public name = 'MigrationName1762554602716'
4
+ public name = "MigrationName1762554602716";
5
5
 
6
- public async up(queryRunner: QueryRunner): Promise<void> {
7
- await queryRunner.query(`ALTER TABLE "User" DROP COLUMN "jwtRefreshToken"`);
8
- }
9
-
10
- public async down(queryRunner: QueryRunner): Promise<void> {
11
- await queryRunner.query(`ALTER TABLE "User" ADD "jwtRefreshToken" character varying(100)`);
12
- }
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(`ALTER TABLE "User" DROP COLUMN "jwtRefreshToken"`);
8
+ }
13
9
 
10
+ public async down(queryRunner: QueryRunner): Promise<void> {
11
+ await queryRunner.query(
12
+ `ALTER TABLE "User" ADD "jwtRefreshToken" character varying(100)`,
13
+ );
14
+ }
14
15
  }
@@ -365,5 +365,5 @@ export default [
365
365
  MigrationName1761232578396,
366
366
  MigrationName1761834523183,
367
367
  MigrationName1762181014879,
368
- MigrationName1762554602716
368
+ MigrationName1762554602716,
369
369
  ];
@@ -2,6 +2,7 @@ import Pill, { PillSize } from "../../../UI/Components/Pill/Pill";
2
2
  import "@testing-library/jest-dom/extend-expect";
3
3
  import { render, screen } from "@testing-library/react";
4
4
  import Color from "../../../Types/Color";
5
+ import IconProp from "../../../Types/Icon/IconProp";
5
6
  import * as React from "react";
6
7
  import { describe, expect, test } from "@jest/globals";
7
8
 
@@ -46,4 +47,11 @@ describe("<Pill />", () => {
46
47
  render(<Pill text="Love" color={color} size={PillSize.ExtraLarge} />);
47
48
  expect(screen.getByTestId("pill")).toHaveStyle("backgroundColor: #786598");
48
49
  });
50
+ test("renders icon when provided", () => {
51
+ const color: Color = new Color("#807149");
52
+ const { container } = render(
53
+ <Pill text="Love" color={color} icon={IconProp.Label} />,
54
+ );
55
+ expect(container.querySelector('[role="icon"]')).not.toBeNull();
56
+ });
49
57
  });
package/Types/Color.ts CHANGED
@@ -19,9 +19,9 @@ export default class Color extends DatabaseProperty {
19
19
  this._color = v;
20
20
  }
21
21
 
22
- public constructor(color: string) {
22
+ public constructor(color: string | Color) {
23
23
  super();
24
- this.color = color;
24
+ this.color = color.toString();
25
25
  }
26
26
 
27
27
  public override toString(): string {
@@ -0,0 +1,64 @@
1
+ import type BaseModel from "../../Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel";
2
+ import { ReflectionMetadataType } from "../Reflection";
3
+ import "reflect-metadata";
4
+
5
+ const colorFieldSymbol: symbol = Symbol("ColorField");
6
+
7
+ type ColorFieldColumnsFunction = <T extends BaseModel>(
8
+ target: T,
9
+ ) => Array<string>;
10
+
11
+ type FirstColorFieldColumnFunction = <T extends BaseModel>(
12
+ target: T,
13
+ ) => string | null;
14
+
15
+ type IsColorFieldColumnFunction = <T extends BaseModel>(
16
+ target: T,
17
+ propertyKey: string,
18
+ ) => boolean;
19
+
20
+ const ColorField: () => ReflectionMetadataType = () => {
21
+ return Reflect.metadata(colorFieldSymbol, true);
22
+ };
23
+
24
+ export const isColorFieldColumn: IsColorFieldColumnFunction = <
25
+ T extends BaseModel,
26
+ >(
27
+ target: T,
28
+ propertyKey: string,
29
+ ): boolean => {
30
+ return Boolean(Reflect.getMetadata(colorFieldSymbol, target, propertyKey));
31
+ };
32
+
33
+ export const getColorFieldColumns: ColorFieldColumnsFunction = <
34
+ T extends BaseModel,
35
+ >(
36
+ target: T,
37
+ ): Array<string> => {
38
+ const columns: Array<string> = [];
39
+ const keys: Array<string> = Object.keys(target);
40
+
41
+ for (const key of keys) {
42
+ if (isColorFieldColumn(target, key)) {
43
+ columns.push(key);
44
+ }
45
+ }
46
+
47
+ return columns;
48
+ };
49
+
50
+ export const getFirstColorFieldColumn: FirstColorFieldColumnFunction = <
51
+ T extends BaseModel,
52
+ >(
53
+ target: T,
54
+ ): string | null => {
55
+ const columns: Array<string> = getColorFieldColumns(target);
56
+
57
+ if (columns.length === 0) {
58
+ return null;
59
+ }
60
+
61
+ return columns[0] as string;
62
+ };
63
+
64
+ export default ColorField;
@@ -98,6 +98,7 @@ enum IconProp {
98
98
  False = "False",
99
99
  Text = "Text",
100
100
  Circle = "Circle",
101
+ EmptyCircle = "EmptyCircle",
101
102
  Webhook = "Webhook",
102
103
  SendMessage = "SendMessage",
103
104
  ExternalLink = "ExternalLink",