gpt-3.5-turbo-0301· openai
Suzhen/CodeChat
ant design icon. нужна иконка похожая на жесткий диск
- User
ant design icon. нужна иконка похожая на жесткий диск
- Assistant
Вот несколько иконок, похожих на жесткий диск, из библиотеки Ant Design:
<Icon type="hdd" /><Icon type="database" /><Icon type="server" />
- User
data: [ { key: 0, id: 0, host: 'ip-172-31-77-161', status: ['in', 'up'], deviceClass: 'SSD', PGs: 96, size: 32, flags: ['red', 'green', 'blue'], usage: 55, readBytes: 6, writeBytes: 6, readOps: 0.6, writeOps: 0.2 }] создай массив из 50 элементов по этому примеру. С учетом того что status, deviceClass везде одинаковый, usage не более 100, flags может быть либо red либо green либо blue, key и id должны совпадать
- Assistant
Это должно работать:
const data = Array.from({ length: 50 }, (_, i) => { const usage = Math.floor(Math.random() * 101); const flags = ['red', 'green', 'blue']; const randomIndex = Math.floor(Math.random() * flags.length); const status = ['in', 'up']; const size = Math.floor(Math.random() * 100) + 1; const PGs = Math.floor(Math.random() * 100) + 1; const readBytes = Math.floor(Math.random() * 10) + 1; const writeBytes = Math.floor(Math.random() * 10) + 1; const readOps = Math.floor(Math.random() * 10) / 10; const writeOps = Math.floor(Math.random() * 10) / 10; return { key: i, id: i, host: `ip-172-31-77-${i}`, status, deviceClass: 'SSD', PGs, size, flags: [flags[randomIndex]], usage, readBytes, writeBytes, readOps, writeOps, }; });В этом решении:
- Мы используем Array.from (), чтобы создать новый массив из 50 элементов.
- Мы используем Math.random (), чтобы сгенерировать случайные значения для
usage,flags,size,PGs,readBytes,writeBytes, , .