From 07471e9d55caa2ffd85a883f98c8af8691b191b1 Mon Sep 17 00:00:00 2001 From: Michael Lange Date: Fri, 20 Apr 2018 18:10:41 -0700 Subject: [PATCH] Move resource generation helper to a common place --- ui/mirage/data/generate-resources.js | 22 +++++++++++++++++ .../factories/client-allocation-stats.js | 24 +------------------ 2 files changed, 23 insertions(+), 23 deletions(-) create mode 100644 ui/mirage/data/generate-resources.js diff --git a/ui/mirage/data/generate-resources.js b/ui/mirage/data/generate-resources.js new file mode 100644 index 000000000..b4e07f696 --- /dev/null +++ b/ui/mirage/data/generate-resources.js @@ -0,0 +1,22 @@ +export default function generateResources() { + return { + CpuStats: { + Measured: ['Throttled Periods', 'Throttled Time', 'Percent'], + Percent: 0.14159538847117795, + SystemMode: 0, + ThrottledPeriods: 0, + ThrottledTime: 0, + TotalTicks: 300.256693934837093, + UserMode: 0, + }, + MemoryStats: { + Cache: 1744896, + KernelMaxUsage: 0, + KernelUsage: 0, + MaxUsage: 4710400, + Measured: ['RSS', 'Cache', 'Swap', 'Max Usage'], + RSS: 1486848009, + Swap: 0, + }, + }; +} diff --git a/ui/mirage/factories/client-allocation-stats.js b/ui/mirage/factories/client-allocation-stats.js index 379dc0a18..e4573ed08 100644 --- a/ui/mirage/factories/client-allocation-stats.js +++ b/ui/mirage/factories/client-allocation-stats.js @@ -1,4 +1,5 @@ import { Factory } from 'ember-cli-mirage'; +import generateResources from '../data/generate-resources'; export default Factory.extend({ resourceUsage: generateResources, @@ -17,26 +18,3 @@ export default Factory.extend({ return hash; }, }); - -function generateResources() { - return { - CpuStats: { - Measured: ['Throttled Periods', 'Throttled Time', 'Percent'], - Percent: 0.14159538847117795, - SystemMode: 0, - ThrottledPeriods: 0, - ThrottledTime: 0, - TotalTicks: 3.256693934837093, - UserMode: 0, - }, - MemoryStats: { - Cache: 1744896, - KernelMaxUsage: 0, - KernelUsage: 0, - MaxUsage: 4710400, - Measured: ['RSS', 'Cache', 'Swap', 'Max Usage'], - RSS: 1486848, - Swap: 0, - }, - }; -}