refactor(widgets): replace beszelSystem option with generic integrationSelect
This commit is contained in:
5 files changed
+62
-33
No files matched your search
@@ -60,6 +60,18 @@ interface DynamicSelectInput extends CommonInput<DynamicSelectOption | null> {
|
||||
};
|
||||
}
|
||||
|
||||
interface IntegrationSelectInput extends CommonInput<string> {
|
||||
clearable?: boolean;
|
||||
searchable?: boolean;
|
||||
useOptions: (
|
||||
integrationIds: string[],
|
||||
) => {
|
||||
data: { value: string; label: string }[];
|
||||
isPending: boolean;
|
||||
isError: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
interface NumberInput extends CommonInput<number> {
|
||||
validate: z.ZodNumber;
|
||||
step?: number;
|
||||
@@ -175,10 +187,13 @@ const optionsFactory = {
|
||||
defaultValue: "",
|
||||
withDescription: true,
|
||||
}),
|
||||
beszelSystem: () => ({
|
||||
type: "beszelSystem" as const,
|
||||
defaultValue: "",
|
||||
withDescription: true,
|
||||
integrationSelect: (input: IntegrationSelectInput) => ({
|
||||
type: "integrationSelect" as const,
|
||||
defaultValue: input.defaultValue ?? "",
|
||||
withDescription: input.withDescription ?? false,
|
||||
clearable: input.clearable ?? false,
|
||||
searchable: input.searchable ?? true,
|
||||
useOptions: input.useOptions,
|
||||
}),
|
||||
customWidgetSelect: (input?: CommonInput<string>) => ({
|
||||
type: "customWidgetSelect" as const,
|
||||
|
||||
Reference in new issue
Block a user