@oneuptime/common 8.0.5571 → 8.0.5573
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/Models/DatabaseModels/AlertFeed.ts +2 -0
- package/Models/DatabaseModels/AlertSeverity.ts +2 -0
- package/Models/DatabaseModels/AlertState.ts +2 -0
- package/Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel.ts +5 -0
- package/Models/DatabaseModels/IncidentSeverity.ts +2 -0
- package/Models/DatabaseModels/IncidentState.ts +2 -0
- package/Models/DatabaseModels/Label.ts +2 -0
- package/Models/DatabaseModels/MonitorStatus.ts +2 -0
- package/Models/DatabaseModels/ScheduledMaintenanceFeed.ts +2 -0
- package/Models/DatabaseModels/ScheduledMaintenanceState.ts +2 -0
- package/Models/DatabaseModels/ServiceCatalog.ts +2 -0
- package/Models/DatabaseModels/TelemetryService.ts +2 -0
- package/Server/Services/TeamMemberService.ts +6 -1
- package/Tests/UI/Components/Pill.test.tsx +8 -0
- package/Types/Color.ts +2 -2
- package/Types/Database/ColorField.ts +64 -0
- package/Types/Icon/IconProp.ts +1 -0
- package/UI/Components/Dropdown/Dropdown.tsx +503 -10
- package/UI/Components/Forms/ModelForm.tsx +63 -26
- package/UI/Components/Icon/Icon.tsx +4 -0
- package/UI/Components/Label/Label.tsx +50 -0
- package/UI/Components/Label/Labels.tsx +35 -0
- package/UI/Components/ModelTable/BaseModelTable.tsx +134 -6
- package/UI/Components/Page/Page.tsx +7 -23
- package/UI/Components/Pill/Pill.tsx +13 -3
- package/UI/Utils/Dropdown.ts +19 -1
- package/build/dist/Models/DatabaseModels/AlertFeed.js +2 -0
- package/build/dist/Models/DatabaseModels/AlertFeed.js.map +1 -1
- package/build/dist/Models/DatabaseModels/AlertSeverity.js +2 -0
- package/build/dist/Models/DatabaseModels/AlertSeverity.js.map +1 -1
- package/build/dist/Models/DatabaseModels/AlertState.js +2 -0
- package/build/dist/Models/DatabaseModels/AlertState.js.map +1 -1
- package/build/dist/Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel.js +4 -0
- package/build/dist/Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel.js.map +1 -1
- package/build/dist/Models/DatabaseModels/IncidentSeverity.js +2 -0
- package/build/dist/Models/DatabaseModels/IncidentSeverity.js.map +1 -1
- package/build/dist/Models/DatabaseModels/IncidentState.js +2 -0
- package/build/dist/Models/DatabaseModels/IncidentState.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Label.js +2 -0
- package/build/dist/Models/DatabaseModels/Label.js.map +1 -1
- package/build/dist/Models/DatabaseModels/MonitorStatus.js +2 -0
- package/build/dist/Models/DatabaseModels/MonitorStatus.js.map +1 -1
- package/build/dist/Models/DatabaseModels/ScheduledMaintenanceFeed.js +2 -0
- package/build/dist/Models/DatabaseModels/ScheduledMaintenanceFeed.js.map +1 -1
- package/build/dist/Models/DatabaseModels/ScheduledMaintenanceState.js +2 -0
- package/build/dist/Models/DatabaseModels/ScheduledMaintenanceState.js.map +1 -1
- package/build/dist/Models/DatabaseModels/ServiceCatalog.js +2 -0
- package/build/dist/Models/DatabaseModels/ServiceCatalog.js.map +1 -1
- package/build/dist/Models/DatabaseModels/TelemetryService.js +2 -0
- package/build/dist/Models/DatabaseModels/TelemetryService.js.map +1 -1
- package/build/dist/Server/Services/TeamMemberService.js +3 -1
- package/build/dist/Server/Services/TeamMemberService.js.map +1 -1
- package/build/dist/Tests/UI/Components/Pill.test.js +6 -0
- package/build/dist/Tests/UI/Components/Pill.test.js.map +1 -1
- package/build/dist/Types/Color.js +1 -1
- package/build/dist/Types/Color.js.map +1 -1
- package/build/dist/Types/Database/ColorField.js +27 -0
- package/build/dist/Types/Database/ColorField.js.map +1 -0
- package/build/dist/Types/Icon/IconProp.js +1 -0
- package/build/dist/Types/Icon/IconProp.js.map +1 -1
- package/build/dist/UI/Components/Dropdown/Dropdown.js +264 -8
- package/build/dist/UI/Components/Dropdown/Dropdown.js.map +1 -1
- package/build/dist/UI/Components/Forms/ModelForm.js +33 -10
- package/build/dist/UI/Components/Forms/ModelForm.js.map +1 -1
- package/build/dist/UI/Components/Icon/Icon.js +5 -0
- package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
- package/build/dist/UI/Components/Label/Label.js +32 -0
- package/build/dist/UI/Components/Label/Label.js.map +1 -0
- package/build/dist/UI/Components/Label/Labels.js +13 -0
- package/build/dist/UI/Components/Label/Labels.js.map +1 -0
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js +82 -6
- package/build/dist/UI/Components/ModelTable/BaseModelTable.js.map +1 -1
- package/build/dist/UI/Components/Page/Page.js +3 -14
- package/build/dist/UI/Components/Page/Page.js.map +1 -1
- package/build/dist/UI/Components/Pill/Pill.js +4 -4
- package/build/dist/UI/Components/Pill/Pill.js.map +1 -1
- package/build/dist/UI/Utils/Dropdown.js +11 -1
- package/build/dist/UI/Utils/Dropdown.js.map +1 -1
- package/package.json +1 -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";
|
|
@@ -203,6 +204,10 @@ export default class DatabaseBaseModel extends BaseEntity {
|
|
|
203
204
|
return new Columns(Object.keys(getTableColumns(this)));
|
|
204
205
|
}
|
|
205
206
|
|
|
207
|
+
public getFirstColorColumn(): string | null {
|
|
208
|
+
return getFirstColorFieldColumn(this);
|
|
209
|
+
}
|
|
210
|
+
|
|
206
211
|
public canQueryMultiTenant(): boolean {
|
|
207
212
|
return Boolean(this.isMultiTenantRequestAllowed);
|
|
208
213
|
}
|
|
@@ -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,
|
|
@@ -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",
|
|
@@ -345,7 +345,12 @@ export class TeamMemberService extends DatabaseService<TeamMember> {
|
|
|
345
345
|
},
|
|
346
346
|
});
|
|
347
347
|
|
|
348
|
-
|
|
348
|
+
// Skip the one-member guard when SCIM manages membership for the project.
|
|
349
|
+
const isSCIMEnabled: boolean = await this.isSCIMEnabled(
|
|
350
|
+
member.projectId!,
|
|
351
|
+
);
|
|
352
|
+
|
|
353
|
+
if (!isSCIMEnabled && membersInTeam.toNumber() <= 1) {
|
|
349
354
|
throw new BadDataException(
|
|
350
355
|
Errors.TeamMemberService.ONE_MEMBER_REQUIRED,
|
|
351
356
|
);
|
|
@@ -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;
|