mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-23 15:49:10 +00:00
46 lines
1.3 KiB
TypeScript
46 lines
1.3 KiB
TypeScript
import { find, update, removeField } from '../util/db';
|
|
|
|
const statusPageCollection = 'statuspages';
|
|
|
|
async function run() {
|
|
const statusPages = await find(statusPageCollection, {
|
|
monitorIds: { $exists: true },
|
|
});
|
|
for (let i = 0; i < statusPages.length; i++) {
|
|
const statusPage = statusPages[i];
|
|
const monitors = [];
|
|
for (let j = 0; j < statusPage.monitorIds.length; j++) {
|
|
monitors.push({
|
|
monitor: statusPage.monitorIds[j],
|
|
description: '',
|
|
uptime: true,
|
|
memory: false,
|
|
cpu: false,
|
|
storage: false,
|
|
responseTime: false,
|
|
temperature: false,
|
|
runtime: false,
|
|
});
|
|
}
|
|
const colors = {
|
|
...statusPage.colors,
|
|
...{
|
|
strokeChart: { r: 0, g: 0, b: 0, a: 1 },
|
|
fillChart: { r: 226, g: 225, b: 242, a: 1 },
|
|
},
|
|
};
|
|
await update(
|
|
statusPageCollection,
|
|
{ _id: statusPage._id },
|
|
{ monitors, colors }
|
|
);
|
|
await removeField(
|
|
statusPageCollection,
|
|
{ _id: statusPage._id },
|
|
'monitorIds'
|
|
);
|
|
}
|
|
}
|
|
|
|
export default run;
|