From 1f300eb4fb0cfa8af5a96931465deb9809c5fbe5 Mon Sep 17 00:00:00 2001 From: Michael Lange Date: Thu, 12 Apr 2018 10:47:12 -0700 Subject: [PATCH 1/4] Make sure jobs and task groups have no spaces Faker hacker nouns can sometimes be two words. --- ui/mirage/factories/job.js | 2 +- ui/mirage/factories/task-group.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/mirage/factories/job.js b/ui/mirage/factories/job.js index c799d14ef..e8dc4b4b2 100644 --- a/ui/mirage/factories/job.js +++ b/ui/mirage/factories/job.js @@ -9,7 +9,7 @@ const JOB_STATUSES = ['pending', 'running', 'dead']; export default Factory.extend({ id: i => `job-${i}`, - name: i => `${faker.list.random(...JOB_PREFIXES)()}-${faker.hacker.noun()}-${i}`, + name: i => `${faker.list.random(...JOB_PREFIXES)()}-${faker.hacker.noun().dasherize()}-${i}`, groupsCount: () => faker.random.number({ min: 1, max: 5 }), diff --git a/ui/mirage/factories/task-group.js b/ui/mirage/factories/task-group.js index 6a12dc3e8..682da6ee4 100644 --- a/ui/mirage/factories/task-group.js +++ b/ui/mirage/factories/task-group.js @@ -3,7 +3,7 @@ import { Factory, faker } from 'ember-cli-mirage'; const DISK_RESERVATIONS = [200, 500, 1000, 2000, 5000, 10000, 100000]; export default Factory.extend({ - name: id => `${faker.hacker.noun()}-g-${id}`, + name: id => `${faker.hacker.noun().dasherize()}-g-${id}`, count: () => faker.random.number({ min: 1, max: 4 }), ephemeralDisk: () => ({ From 5223a3f81611646cf6ee37b587b7dd56c0fd5804 Mon Sep 17 00:00:00 2001 From: Michael Lange Date: Thu, 12 Apr 2018 12:56:06 -0700 Subject: [PATCH 2/4] Don't read properties off of null objects Somehow this controller code runs sometimes when the existing jobs are dematerializing. This makes this.get('model') and array of null --- ui/app/controllers/jobs/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/ui/app/controllers/jobs/index.js b/ui/app/controllers/jobs/index.js index 7dc8c170f..4df1f084c 100644 --- a/ui/app/controllers/jobs/index.js +++ b/ui/app/controllers/jobs/index.js @@ -40,6 +40,7 @@ export default Controller.extend(Sortable, Searchable, { const activeNamespace = this.get('system.activeNamespace.id') || 'default'; return this.get('model') + .compact() .filter(job => !hasNamespaces || job.get('namespace.id') === activeNamespace) .filter(job => !job.get('parent.content')); } From 9331a02e67dd7b53cf5d92ae8aecaffab92c5858 Mon Sep 17 00:00:00 2001 From: Michael Lange Date: Mon, 16 Apr 2018 10:23:43 -0700 Subject: [PATCH 3/4] Upgrade ember-cli-mirage --- ui/package.json | 2 +- ui/yarn.lock | 42 ++++++++++++++++++++++++++++++++++++++---- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/ui/package.json b/ui/package.json index 0518bd222..3ca526e16 100644 --- a/ui/package.json +++ b/ui/package.json @@ -39,7 +39,7 @@ "ember-cli-htmlbars": "^2.0.3", "ember-cli-htmlbars-inline-precompile": "^1.0.2", "ember-cli-inject-live-reload": "^1.4.1", - "ember-cli-mirage": "^0.4.1", + "ember-cli-mirage": "^0.4.3", "ember-cli-moment-shim": "^3.5.0", "ember-cli-qunit": "^4.2.1", "ember-cli-sass": "^7.1.2", diff --git a/ui/yarn.lock b/ui/yarn.lock index d3a032acb..7b9e912dc 100644 --- a/ui/yarn.lock +++ b/ui/yarn.lock @@ -183,6 +183,14 @@ app-root-path@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/app-root-path/-/app-root-path-2.0.1.tgz#cd62dcf8e4fd5a417efc664d2e5b10653c651b46" +applause@1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/applause/-/applause-1.2.2.tgz#a8468579e81f67397bb5634c29953bedcd0f56c0" + dependencies: + cson-parser "^1.1.0" + js-yaml "^3.3.0" + lodash "^3.10.0" + aproba@^1.0.3: version "1.1.2" resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.1.2.tgz#45c6629094de4e96f693ef7eab74ae079c240fc1" @@ -1445,7 +1453,7 @@ broccoli-middleware@^1.0.0: handlebars "^4.0.4" mime "^1.2.11" -broccoli-persistent-filter@^1.0.3, broccoli-persistent-filter@^1.1.5, broccoli-persistent-filter@^1.1.6, broccoli-persistent-filter@^1.4.0, broccoli-persistent-filter@^1.4.2, broccoli-persistent-filter@^1.4.3: +broccoli-persistent-filter@^1.0.3, broccoli-persistent-filter@^1.1.5, broccoli-persistent-filter@^1.1.6, broccoli-persistent-filter@^1.2.0, broccoli-persistent-filter@^1.4.0, broccoli-persistent-filter@^1.4.2, broccoli-persistent-filter@^1.4.3: version "1.4.3" resolved "https://registry.yarnpkg.com/broccoli-persistent-filter/-/broccoli-persistent-filter-1.4.3.tgz#3511bc52fc53740cda51621f58a28152d9911bc1" dependencies: @@ -1481,6 +1489,14 @@ broccoli-plugin@^1.0.0, broccoli-plugin@^1.1.0, broccoli-plugin@^1.2.0, broccoli rimraf "^2.3.4" symlink-or-copy "^1.1.8" +broccoli-replace@^0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/broccoli-replace/-/broccoli-replace-0.12.0.tgz#36460a984c45c61731638c53068b0ab12ea8fdb7" + dependencies: + applause "1.2.2" + broccoli-persistent-filter "^1.2.0" + minimatch "^3.0.0" + broccoli-rollup@^1.2.0: version "1.3.0" resolved "https://registry.yarnpkg.com/broccoli-rollup/-/broccoli-rollup-1.3.0.tgz#43a0a7798555bab54217009eb470a4ff5a056df0" @@ -2054,6 +2070,10 @@ code-point-at@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" +coffee-script@^1.10.0: + version "1.12.7" + resolved "https://registry.yarnpkg.com/coffee-script/-/coffee-script-1.12.7.tgz#c05dae0cb79591d05b3070a8433a98c9a89ccc53" + collection-visit@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0" @@ -2363,6 +2383,12 @@ crypto-random-string@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/crypto-random-string/-/crypto-random-string-1.0.0.tgz#a230f64f568310e1498009940790ec99545bca7e" +cson-parser@^1.1.0: + version "1.3.5" + resolved "https://registry.yarnpkg.com/cson-parser/-/cson-parser-1.3.5.tgz#7ec675e039145533bf2a6a856073f1599d9c2d24" + dependencies: + coffee-script "^1.10.0" + cssmin@0.3.x: version "0.3.2" resolved "https://registry.yarnpkg.com/cssmin/-/cssmin-0.3.2.tgz#ddce4c547b510ae0d594a8f1fbf8aaf8e2c5c00d" @@ -2865,12 +2891,13 @@ ember-cli-lodash-subset@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/ember-cli-lodash-subset/-/ember-cli-lodash-subset-2.0.1.tgz#20cb68a790fe0fde2488ddfd8efbb7df6fe766f2" -ember-cli-mirage@^0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/ember-cli-mirage/-/ember-cli-mirage-0.4.1.tgz#bfdfe61e5e74dc3881ed31f12112dae1a29f0d4c" +ember-cli-mirage@^0.4.3: + version "0.4.3" + resolved "https://registry.yarnpkg.com/ember-cli-mirage/-/ember-cli-mirage-0.4.3.tgz#81470c2b9cdb2b88661c56be6aacb928945a9b3b" dependencies: broccoli-funnel "^1.0.2" broccoli-merge-trees "^1.1.0" + broccoli-replace "^0.12.0" broccoli-stew "^1.5.0" chalk "^1.1.1" ember-cli-babel "^6.8.2" @@ -5102,6 +5129,13 @@ js-yaml@^3.2.5, js-yaml@^3.2.7, js-yaml@^3.6.1, js-yaml@^3.9.0, js-yaml@^3.9.1: argparse "^1.0.7" esprima "^4.0.0" +js-yaml@^3.3.0: + version "3.11.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.11.0.tgz#597c1a8bd57152f26d622ce4117851a51f5ebaef" + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + js-yaml@~3.6.0: version "3.6.1" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.6.1.tgz#6e5fe67d8b205ce4d22fad05b7781e8dadcc4b30" From b3c3548ccd4896870681cccf94b14345f42cdde8 Mon Sep 17 00:00:00 2001 From: Michael Lange Date: Tue, 17 Apr 2018 09:40:18 -0700 Subject: [PATCH 4/4] Track requests in test mode This is now necessary in mirage 0.4 --- ui/config/environment.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ui/config/environment.js b/ui/config/environment.js index a769944b9..fdceb4472 100644 --- a/ui/config/environment.js +++ b/ui/config/environment.js @@ -49,6 +49,10 @@ module.exports = function(environment) { ENV.browserify = { tests: true, }; + + ENV['ember-cli-mirage'] = { + trackRequests: true, + }; } if (environment === 'production') {