From bf8d9f05b1838bf7f1bbb803ab37bb239fdb3e8f Mon Sep 17 00:00:00 2001 From: Michael Lange Date: Tue, 10 Oct 2017 09:36:36 -0700 Subject: [PATCH] Mock namespaces in mirage --- ui/mirage/config.js | 4 ++-- ui/mirage/factories/job.js | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ui/mirage/config.js b/ui/mirage/config.js index f4a0bb502..6e0fce395 100644 --- a/ui/mirage/config.js +++ b/ui/mirage/config.js @@ -9,13 +9,13 @@ export function findLeader(schema) { } export default function() { - this.timing = 200; // delay for each request, automatically set to 0 during testing + this.timing = 0; // delay for each request, automatically set to 0 during testing this.namespace = 'v1'; this.get('/jobs', function({ jobs }) { const json = this.serialize(jobs.all()); - return json.map(job => filterKeys(job, 'TaskGroups')); + return json.map(job => filterKeys(job, 'TaskGroups', 'NamespaceID')); }); this.get('/job/:id'); diff --git a/ui/mirage/factories/job.js b/ui/mirage/factories/job.js index ec4d60acf..21d02a690 100644 --- a/ui/mirage/factories/job.js +++ b/ui/mirage/factories/job.js @@ -1,5 +1,5 @@ import { Factory, faker } from 'ember-cli-mirage'; -import { provide, provider } from '../utils'; +import { provide, provider, pickOne } from '../utils'; import { DATACENTERS } from '../common'; const JOB_PREFIXES = provide(5, faker.hacker.abbreviation); @@ -50,6 +50,7 @@ export default Factory.extend({ job.update({ taskGroupIds: groups.mapBy('id'), task_group_ids: groups.mapBy('id'), + namespaceId: server.db.namespaces.length && pickOne(server.db.namespaces).id, }); const jobSummary = server.create('job-summary', {