mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-11 16:05:47 +01:00
✨ Add new types for integration configuration
This commit is contained in:
@@ -16,9 +16,13 @@ export interface ServiceType extends TileBaseType {
|
||||
behaviour: ServiceBehaviourType;
|
||||
network: ServiceNetworkType;
|
||||
appearance: ServiceAppearanceType;
|
||||
integration?: ServiceIntegrationType;
|
||||
integration?: ServiceIntegrationType | null;
|
||||
}
|
||||
|
||||
export type ConfigServiceType = Omit<ServiceType, 'integration'> & {
|
||||
integration?: ConfigServiceIntegrationType | null;
|
||||
};
|
||||
|
||||
interface ServiceBehaviourType {
|
||||
onClickUrl: string;
|
||||
isOpeningNewTab: boolean;
|
||||
@@ -33,7 +37,7 @@ interface ServiceAppearanceType {
|
||||
iconUrl: string;
|
||||
}
|
||||
|
||||
type IntegrationType =
|
||||
export type IntegrationType =
|
||||
| 'readarr'
|
||||
| 'radarr'
|
||||
| 'sonarr'
|
||||
@@ -51,12 +55,19 @@ export type ServiceIntegrationType = {
|
||||
properties: ServiceIntegrationPropertyType[];
|
||||
};
|
||||
|
||||
type ServiceIntegrationPropertyType = {
|
||||
export type ConfigServiceIntegrationType = Omit<ServiceIntegrationType, 'properties'> & {
|
||||
properties: ConfigServiceIntegrationPropertyType[];
|
||||
};
|
||||
|
||||
export type ServiceIntegrationPropertyType = {
|
||||
type: 'private' | 'public';
|
||||
field: IntegrationField;
|
||||
value?: string;
|
||||
value?: string | null;
|
||||
isDefined: boolean;
|
||||
};
|
||||
|
||||
type ConfigServiceIntegrationPropertyType = Omit<ServiceIntegrationPropertyType, 'isDefined'>;
|
||||
|
||||
export type IntegrationField = 'apiKey' | 'password' | 'username';
|
||||
|
||||
export const integrationFieldProperties: {
|
||||
@@ -76,6 +87,7 @@ export const integrationFieldProperties: {
|
||||
};
|
||||
|
||||
export type IntegrationFieldDefinitionType = {
|
||||
type: 'private' | 'public';
|
||||
icon: TablerIcon;
|
||||
iconUnset: TablerIcon;
|
||||
label: string;
|
||||
@@ -85,16 +97,19 @@ export const integrationFieldDefinitions: {
|
||||
[key in IntegrationField]: IntegrationFieldDefinitionType;
|
||||
} = {
|
||||
apiKey: {
|
||||
type: 'private',
|
||||
icon: IconKey,
|
||||
iconUnset: IconKeyOff,
|
||||
label: 'API Key',
|
||||
},
|
||||
username: {
|
||||
type: 'public',
|
||||
icon: IconUser,
|
||||
iconUnset: IconUserOff,
|
||||
label: 'Username',
|
||||
},
|
||||
password: {
|
||||
type: 'private',
|
||||
icon: IconPassword,
|
||||
iconUnset: IconLockOff,
|
||||
label: 'Password',
|
||||
|
||||
Reference in New Issue
Block a user