mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-11 16:05:47 +01:00
🐛 Fix missing shape and area for widgets in migrator
This commit is contained in:
@@ -55,7 +55,7 @@ export function migrateConfig(config: Config): ConfigType {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
config.services.forEach((service, index) => {
|
config.services.forEach((service) => {
|
||||||
const { category: categoryName } = service;
|
const { category: categoryName } = service;
|
||||||
|
|
||||||
if (!categoryName) {
|
if (!categoryName) {
|
||||||
@@ -96,24 +96,13 @@ const getConfigAndCreateIfNotExsists = (
|
|||||||
const category: CategoryType = {
|
const category: CategoryType = {
|
||||||
id: uuidv4(),
|
id: uuidv4(),
|
||||||
name: categoryName,
|
name: categoryName,
|
||||||
position: 0,
|
position: config.categories.length,
|
||||||
};
|
};
|
||||||
|
|
||||||
config.categories.push(category);
|
config.categories.push(category);
|
||||||
return category;
|
return category;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getShapeForColumnCount = (index: number, columnCount: number) => ({
|
|
||||||
location: {
|
|
||||||
x: index % columnCount,
|
|
||||||
y: Math.floor(index / columnCount),
|
|
||||||
},
|
|
||||||
size: {
|
|
||||||
width: 1,
|
|
||||||
height: 1,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const migrateService = (oldService: serviceItem, areaType: AreaType): AppType => ({
|
const migrateService = (oldService: serviceItem, areaType: AreaType): AppType => ({
|
||||||
id: uuidv4(),
|
id: uuidv4(),
|
||||||
name: oldService.name,
|
name: oldService.name,
|
||||||
@@ -160,6 +149,7 @@ const migrateModules = (config: Config): IWidget<string, any>[] => {
|
|||||||
id: 'default',
|
id: 'default',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
shape: {},
|
||||||
} as IBitTorrent;
|
} as IBitTorrent;
|
||||||
case 'weather':
|
case 'weather':
|
||||||
return {
|
return {
|
||||||
@@ -168,6 +158,13 @@ const migrateModules = (config: Config): IWidget<string, any>[] => {
|
|||||||
displayInFahrenheit: oldModule.options?.freedomunit?.value ?? false,
|
displayInFahrenheit: oldModule.options?.freedomunit?.value ?? false,
|
||||||
location: oldModule.options?.location?.value ?? 'Paris',
|
location: oldModule.options?.location?.value ?? 'Paris',
|
||||||
},
|
},
|
||||||
|
area: {
|
||||||
|
type: 'wrapper',
|
||||||
|
properties: {
|
||||||
|
id: 'default',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
shape: {},
|
||||||
} as IWeatherWidget;
|
} as IWeatherWidget;
|
||||||
case 'dashdot':
|
case 'dashdot':
|
||||||
case 'Dash.':
|
case 'Dash.':
|
||||||
@@ -180,6 +177,13 @@ const migrateModules = (config: Config): IWidget<string, any>[] => {
|
|||||||
useCompactView: oldModule.options?.useCompactView?.value ?? false,
|
useCompactView: oldModule.options?.useCompactView?.value ?? false,
|
||||||
graphs: oldModule.options?.graphs?.value ?? ['cpu', 'ram'],
|
graphs: oldModule.options?.graphs?.value ?? ['cpu', 'ram'],
|
||||||
},
|
},
|
||||||
|
area: {
|
||||||
|
type: 'wrapper',
|
||||||
|
properties: {
|
||||||
|
id: 'default',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
shape: {},
|
||||||
} as IDashDotTile;
|
} as IDashDotTile;
|
||||||
case 'date':
|
case 'date':
|
||||||
return {
|
return {
|
||||||
@@ -187,12 +191,26 @@ const migrateModules = (config: Config): IWidget<string, any>[] => {
|
|||||||
properties: {
|
properties: {
|
||||||
display24HourFormat: oldModule.options?.full?.value ?? true,
|
display24HourFormat: oldModule.options?.full?.value ?? true,
|
||||||
},
|
},
|
||||||
|
area: {
|
||||||
|
type: 'wrapper',
|
||||||
|
properties: {
|
||||||
|
id: 'default',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
shape: {},
|
||||||
} as IDateWidget;
|
} as IDateWidget;
|
||||||
case 'Download Speed':
|
case 'Download Speed':
|
||||||
case 'dlspeed':
|
case 'dlspeed':
|
||||||
return {
|
return {
|
||||||
id: uuidv4(),
|
id: uuidv4(),
|
||||||
properties: {},
|
properties: {},
|
||||||
|
area: {
|
||||||
|
type: 'wrapper',
|
||||||
|
properties: {
|
||||||
|
id: 'default',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
shape: {},
|
||||||
} as ITorrentNetworkTraffic;
|
} as ITorrentNetworkTraffic;
|
||||||
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.`);
|
||||||
|
|||||||
Reference in New Issue
Block a user