mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-11 16:05:47 +01:00
Add module migration
This commit is contained in:
@@ -5,9 +5,11 @@ import { AreaType } from '../../types/area';
|
|||||||
import { CategoryType } from '../../types/category';
|
import { CategoryType } from '../../types/category';
|
||||||
import { ConfigType } from '../../types/config';
|
import { ConfigType } from '../../types/config';
|
||||||
import { IBitTorrent } from '../../widgets/bitTorrent/BitTorrentTile';
|
import { IBitTorrent } from '../../widgets/bitTorrent/BitTorrentTile';
|
||||||
|
import { ICalendarWidget } from '../../widgets/calendar/CalendarTile';
|
||||||
import { IDashDotTile } from '../../widgets/dashDot/DashDotTile';
|
import { IDashDotTile } from '../../widgets/dashDot/DashDotTile';
|
||||||
import { IDateWidget } from '../../widgets/date/DateTile';
|
import { IDateWidget } from '../../widgets/date/DateTile';
|
||||||
import { ITorrentNetworkTraffic } from '../../widgets/torrentNetworkTraffic/TorrentNetworkTrafficTile';
|
import { ITorrentNetworkTraffic } from '../../widgets/torrentNetworkTraffic/TorrentNetworkTrafficTile';
|
||||||
|
import { IUsenetWidget } from '../../widgets/useNet/UseNetTile';
|
||||||
import { IWeatherWidget } from '../../widgets/weather/WeatherTile';
|
import { IWeatherWidget } from '../../widgets/weather/WeatherTile';
|
||||||
import { IWidget } from '../../widgets/widgets';
|
import { IWidget } from '../../widgets/widgets';
|
||||||
import { Config, serviceItem } from '../types';
|
import { Config, serviceItem } from '../types';
|
||||||
@@ -137,7 +139,7 @@ const migrateModules = (config: Config): IWidget<string, any>[] => {
|
|||||||
case 'torrent-status':
|
case 'torrent-status':
|
||||||
case 'Torrent':
|
case 'Torrent':
|
||||||
return {
|
return {
|
||||||
id: uuidv4(),
|
id: 'torrents-status',
|
||||||
properties: {
|
properties: {
|
||||||
refreshInterval: 10,
|
refreshInterval: 10,
|
||||||
displayCompletedTorrents: oldModule.options?.hideComplete?.value ?? false,
|
displayCompletedTorrents: oldModule.options?.hideComplete?.value ?? false,
|
||||||
@@ -153,7 +155,7 @@ const migrateModules = (config: Config): IWidget<string, any>[] => {
|
|||||||
} as IBitTorrent;
|
} as IBitTorrent;
|
||||||
case 'weather':
|
case 'weather':
|
||||||
return {
|
return {
|
||||||
id: uuidv4(),
|
id: 'weather',
|
||||||
properties: {
|
properties: {
|
||||||
displayInFahrenheit: oldModule.options?.freedomunit?.value ?? false,
|
displayInFahrenheit: oldModule.options?.freedomunit?.value ?? false,
|
||||||
location: oldModule.options?.location?.value ?? 'Paris',
|
location: oldModule.options?.location?.value ?? 'Paris',
|
||||||
@@ -169,7 +171,7 @@ const migrateModules = (config: Config): IWidget<string, any>[] => {
|
|||||||
case 'dashdot':
|
case 'dashdot':
|
||||||
case 'Dash.':
|
case 'Dash.':
|
||||||
return {
|
return {
|
||||||
id: uuidv4(),
|
id: 'dashdot',
|
||||||
properties: {
|
properties: {
|
||||||
url: oldModule.options?.url?.value ?? '',
|
url: oldModule.options?.url?.value ?? '',
|
||||||
cpuMultiView: oldModule.options?.cpuMultiView?.value ?? false,
|
cpuMultiView: oldModule.options?.cpuMultiView?.value ?? false,
|
||||||
@@ -187,7 +189,7 @@ const migrateModules = (config: Config): IWidget<string, any>[] => {
|
|||||||
} as IDashDotTile;
|
} as IDashDotTile;
|
||||||
case 'date':
|
case 'date':
|
||||||
return {
|
return {
|
||||||
id: uuidv4(),
|
id: 'date',
|
||||||
properties: {
|
properties: {
|
||||||
display24HourFormat: oldModule.options?.full?.value ?? true,
|
display24HourFormat: oldModule.options?.full?.value ?? true,
|
||||||
},
|
},
|
||||||
@@ -199,10 +201,9 @@ const migrateModules = (config: Config): IWidget<string, any>[] => {
|
|||||||
},
|
},
|
||||||
shape: {},
|
shape: {},
|
||||||
} as IDateWidget;
|
} as IDateWidget;
|
||||||
case 'Download Speed':
|
case 'Download Speed' || 'dlspeed':
|
||||||
case 'dlspeed':
|
|
||||||
return {
|
return {
|
||||||
id: uuidv4(),
|
id: 'dlspeed',
|
||||||
properties: {},
|
properties: {},
|
||||||
area: {
|
area: {
|
||||||
type: 'wrapper',
|
type: 'wrapper',
|
||||||
@@ -212,6 +213,30 @@ const migrateModules = (config: Config): IWidget<string, any>[] => {
|
|||||||
},
|
},
|
||||||
shape: {},
|
shape: {},
|
||||||
} as ITorrentNetworkTraffic;
|
} as ITorrentNetworkTraffic;
|
||||||
|
case 'calendar':
|
||||||
|
return {
|
||||||
|
id: 'calendar',
|
||||||
|
properties: {},
|
||||||
|
area: {
|
||||||
|
type: 'wrapper',
|
||||||
|
properties: {
|
||||||
|
id: 'default',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
shape: {},
|
||||||
|
} as ICalendarWidget;
|
||||||
|
case 'usenet':
|
||||||
|
return {
|
||||||
|
id: 'usenet',
|
||||||
|
properties: {},
|
||||||
|
area: {
|
||||||
|
type: 'wrapper',
|
||||||
|
properties: {
|
||||||
|
id: 'default',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
shape: {},
|
||||||
|
} as IUsenetWidget;
|
||||||
default:
|
default:
|
||||||
Consola.error(`Failed to map unknown module type ${moduleKey} to new type definitions.`);
|
Consola.error(`Failed to map unknown module type ${moduleKey} to new type definitions.`);
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user