diff --git a/Jenkinsfile b/Jenkinsfile
index c68517b..21561b4 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,6 +1,6 @@
node {
- def nodeBuilder = docker.image("node:8")
- nodeBuilder.pull()
+ def nodeBuilder = docker.image("node:8.11.3")
+ def emberBuilder = docker.image("danlynn/ember-cli:3.4.3")
// Test
try {
@@ -8,7 +8,7 @@ node {
checkout scm
}
- nodeBuilder.inside("-v ${env.WORKSPACE}/app:/var/www/html -u 0:0 --entrypoint=''") {
+ emberBuilder.inside("-v ${env.WORKSPACE}/app:/var/www/html -u 0:0 --entrypoint=''") {
stage('Build App') {
sh "cd /var/www/html && yarn"
}
diff --git a/app/app/controllers/display/list.js b/app/app/controllers/display/list.js
new file mode 100644
index 0000000..d630f31
--- /dev/null
+++ b/app/app/controllers/display/list.js
@@ -0,0 +1,4 @@
+import Controller from '@ember/controller';
+
+export default Controller.extend({
+});
diff --git a/app/app/gql/queries/submissions.graphql b/app/app/gql/queries/submissions.graphql
new file mode 100644
index 0000000..fd56ddc
--- /dev/null
+++ b/app/app/gql/queries/submissions.graphql
@@ -0,0 +1,10 @@
+query ListSubmissions {
+ submissions {
+ id
+ submitted
+ companyName
+ hash
+ name
+ email
+ }
+}
diff --git a/app/app/router.js b/app/app/router.js
index 6b0e02e..e309374 100644
--- a/app/app/router.js
+++ b/app/app/router.js
@@ -15,6 +15,7 @@ Router.map(function() {
this.route('review', { path: ':id' });
this.route('thanks');
});
+ this.route('list');
});
});
diff --git a/app/app/routes/display/list.js b/app/app/routes/display/list.js
new file mode 100644
index 0000000..c50f339
--- /dev/null
+++ b/app/app/routes/display/list.js
@@ -0,0 +1,21 @@
+import Route from '@ember/routing/route';
+import { RouteQueryManager } from 'ember-apollo-client';
+
+import query from 'cuf/gql/queries/submissions';
+
+export default Route.extend(RouteQueryManager, {
+ model() {
+ return this.get('apollo').watchQuery({ query, fetchPolicy: 'cache-and-network' }, 'submissions');
+ },
+ actions: {
+ loading(transition) {
+ const controller = this.controllerFor(this.get('routeName'));
+ controller.set('isLoading', true);
+ transition.promise.finally(() => setTimeout(() => controller.set('isLoading', false), 250));
+ },
+ refresh() {
+ this.refresh();
+ return false;
+ },
+ },
+});
diff --git a/app/app/templates/display/list.hbs b/app/app/templates/display/list.hbs
new file mode 100644
index 0000000..006e387
--- /dev/null
+++ b/app/app/templates/display/list.hbs
@@ -0,0 +1,50 @@
+
diff --git a/app/package.json b/app/package.json
index 9e7de8d..002acc0 100644
--- a/app/package.json
+++ b/app/package.json
@@ -37,6 +37,7 @@
"ember-cli-htmlbars-inline-precompile": "^1.0.3",
"ember-cli-inject-live-reload": "^1.8.2",
"ember-cli-jstree": "^1.0.12",
+ "ember-cli-moment-shim": "^3.7.1",
"ember-cli-qunit": "^4.3.2",
"ember-cli-sass": "^8.0.1",
"ember-cli-sri": "^2.1.1",
@@ -51,8 +52,10 @@
"ember-froala-editor": "^2.8.5",
"ember-load-initializers": "^1.1.0",
"ember-maybe-import-regenerator": "^0.1.6",
+ "ember-moment": "^7.8.0",
"ember-notify": "^5.3.0",
"ember-resolver": "^5.0.1",
+ "ember-route-action-helper": "^2.0.6",
"ember-source": "~3.4.0",
"ember-wormhole": "^0.5.5",
"eslint-plugin-ember": "^5.2.0",
diff --git a/app/yarn.lock b/app/yarn.lock
index fe7e36c..59fe40c 100644
--- a/app/yarn.lock
+++ b/app/yarn.lock
@@ -1988,7 +1988,7 @@ browserify-zlib@^0.2.0:
dependencies:
pako "~1.0.5"
-browserslist@^3.2.6:
+browserslist@^3.1.1, browserslist@^3.2.6:
version "3.2.8"
resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-3.2.8.tgz#b0005361d6471f0f5952797a76fc985f1f978fc6"
dependencies:
@@ -2864,7 +2864,7 @@ ember-cli-babel-plugin-helpers@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/ember-cli-babel-plugin-helpers/-/ember-cli-babel-plugin-helpers-1.0.0.tgz#19f3142a2272adb1cc61dfe0dce360e2909a0b07"
-ember-cli-babel@^6.0.0-beta.4, ember-cli-babel@^6.0.0-beta.7, ember-cli-babel@^6.10.0, ember-cli-babel@^6.11.0, ember-cli-babel@^6.12.0, ember-cli-babel@^6.16.0, ember-cli-babel@^6.17.0, ember-cli-babel@^6.3.0, ember-cli-babel@^6.6.0, ember-cli-babel@^6.8.0, ember-cli-babel@^6.8.1, ember-cli-babel@^6.8.2:
+ember-cli-babel@^6.0.0-beta.4, ember-cli-babel@^6.0.0-beta.7, ember-cli-babel@^6.10.0, ember-cli-babel@^6.11.0, ember-cli-babel@^6.12.0, ember-cli-babel@^6.16.0, ember-cli-babel@^6.17.0, ember-cli-babel@^6.3.0, ember-cli-babel@^6.6.0, ember-cli-babel@^6.7.2, ember-cli-babel@^6.8.0, ember-cli-babel@^6.8.1, ember-cli-babel@^6.8.2:
version "6.17.2"
resolved "https://registry.yarnpkg.com/ember-cli-babel/-/ember-cli-babel-6.17.2.tgz#f0d53d2fb95e70c15d8db84760d045f88f458f69"
dependencies:
@@ -2953,6 +2953,10 @@ ember-cli-htmlbars@^3.0.0:
json-stable-stringify "^1.0.0"
strip-bom "^3.0.0"
+ember-cli-import-polyfill@^0.2.0:
+ version "0.2.0"
+ resolved "https://registry.yarnpkg.com/ember-cli-import-polyfill/-/ember-cli-import-polyfill-0.2.0.tgz#c1a08a8affb45c97b675926272fe78cf4ca166f2"
+
ember-cli-inject-live-reload@^1.8.2:
version "1.8.2"
resolved "https://registry.yarnpkg.com/ember-cli-inject-live-reload/-/ember-cli-inject-live-reload-1.8.2.tgz#29f875ad921e9a1dec65d2d75018891972d240bc"
@@ -2982,6 +2986,21 @@ 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-moment-shim@^3.7.1:
+ version "3.7.1"
+ resolved "https://registry.yarnpkg.com/ember-cli-moment-shim/-/ember-cli-moment-shim-3.7.1.tgz#3ad691c5027c1f38a4890fe47d74b5224cc98e32"
+ dependencies:
+ broccoli-funnel "^2.0.0"
+ broccoli-merge-trees "^2.0.0"
+ broccoli-source "^1.1.0"
+ broccoli-stew "^1.5.0"
+ chalk "^1.1.3"
+ ember-cli-babel "^6.6.0"
+ ember-cli-import-polyfill "^0.2.0"
+ lodash.defaults "^4.2.0"
+ moment "^2.19.3"
+ moment-timezone "^0.5.13"
+
ember-cli-node-assets@^0.2.2:
version "0.2.2"
resolved "https://registry.yarnpkg.com/ember-cli-node-assets/-/ember-cli-node-assets-0.2.2.tgz#d2d55626e7cc6619f882d7fe55751f9266022708"
@@ -3247,6 +3266,12 @@ ember-export-application-global@^2.0.0:
dependencies:
ember-cli-babel "^6.0.0-beta.7"
+ember-factory-for-polyfill@^1.3.1:
+ version "1.3.1"
+ resolved "https://registry.yarnpkg.com/ember-factory-for-polyfill/-/ember-factory-for-polyfill-1.3.1.tgz#b446ed64916d293c847a4955240eb2c993b86eae"
+ dependencies:
+ ember-cli-version-checker "^2.1.0"
+
ember-fetch@^5.1.1:
version "5.1.3"
resolved "https://registry.yarnpkg.com/ember-fetch/-/ember-fetch-5.1.3.tgz#f649c60d523bf1949125a4c497751df3b0c9f587"
@@ -3304,6 +3329,13 @@ ember-get-config@^0.2.3:
broccoli-file-creator "^1.1.1"
ember-cli-babel "^6.3.0"
+ember-getowner-polyfill@^2.0.0, ember-getowner-polyfill@^2.0.1:
+ version "2.2.0"
+ resolved "https://registry.yarnpkg.com/ember-getowner-polyfill/-/ember-getowner-polyfill-2.2.0.tgz#38e7dccbcac69d5ec694000329ec0b2be651d2b2"
+ dependencies:
+ ember-cli-version-checker "^2.1.0"
+ ember-factory-for-polyfill "^1.3.1"
+
ember-inflector@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/ember-inflector/-/ember-inflector-3.0.0.tgz#7e1ee8aaa0fa773ba0905d8b7c0786354d890ee1"
@@ -3316,6 +3348,15 @@ ember-load-initializers@^1.1.0:
dependencies:
ember-cli-babel "^6.6.0"
+ember-macro-helpers@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/ember-macro-helpers/-/ember-macro-helpers-1.0.0.tgz#bdb875f5752814f3e0c886e2ed650f01cc302712"
+ dependencies:
+ ember-cli-babel "^6.6.0"
+ ember-cli-string-utils "^1.1.0"
+ ember-cli-test-info "^1.0.0"
+ ember-weakmap "^3.0.0"
+
ember-maybe-import-regenerator@^0.1.6:
version "0.1.6"
resolved "https://registry.yarnpkg.com/ember-maybe-import-regenerator/-/ember-maybe-import-regenerator-0.1.6.tgz#35d41828afa6d6a59bc0da3ce47f34c573d776ca"
@@ -3331,6 +3372,14 @@ ember-maybe-in-element@^0.1.3:
dependencies:
ember-cli-babel "^6.11.0"
+ember-moment@^7.8.0:
+ version "7.8.0"
+ resolved "https://registry.yarnpkg.com/ember-moment/-/ember-moment-7.8.0.tgz#12f33f786b9b8b08d7ca46314b8a59d38cc39048"
+ dependencies:
+ ember-cli-babel "^6.7.2"
+ ember-getowner-polyfill "^2.0.1"
+ ember-macro-helpers "^1.0.0"
+
ember-notify@^5.3.0:
version "5.3.0"
resolved "https://registry.yarnpkg.com/ember-notify/-/ember-notify-5.3.0.tgz#8f798b7e8bbb9cca2511a15c34838c1afdc53cf3"
@@ -3367,6 +3416,13 @@ ember-rfc176-data@^0.3.3, ember-rfc176-data@^0.3.5:
version "0.3.5"
resolved "https://registry.yarnpkg.com/ember-rfc176-data/-/ember-rfc176-data-0.3.5.tgz#f630e550572c81a5e5c7220f864c0f06eee9e977"
+ember-route-action-helper@^2.0.6:
+ version "2.0.6"
+ resolved "https://registry.yarnpkg.com/ember-route-action-helper/-/ember-route-action-helper-2.0.6.tgz#1d50454350d7112be326ab44058f06cf291d5fd9"
+ dependencies:
+ ember-cli-babel "^6.8.1"
+ ember-getowner-polyfill "^2.0.0"
+
ember-router-generator@^1.2.3:
version "1.2.3"
resolved "https://registry.yarnpkg.com/ember-router-generator/-/ember-router-generator-1.2.3.tgz#8ed2ca86ff323363120fc14278191e9e8f1315ee"
@@ -3403,6 +3459,14 @@ ember-template-lint@^1.0.0-beta.5:
resolve "^1.1.3"
strip-bom "^3.0.0"
+ember-weakmap@^3.0.0:
+ version "3.3.1"
+ resolved "https://registry.yarnpkg.com/ember-weakmap/-/ember-weakmap-3.3.1.tgz#5188b035f5bfb17397067ea635300ae4e1205e11"
+ dependencies:
+ browserslist "^3.1.1"
+ debug "^3.1.0"
+ ember-cli-babel "^6.6.0"
+
ember-wormhole@^0.5.5:
version "0.5.5"
resolved "https://registry.yarnpkg.com/ember-wormhole/-/ember-wormhole-0.5.5.tgz#db417ff748cb21e574cd5f233889897bc27096cb"
@@ -5319,6 +5383,10 @@ lodash.debounce@^4.0.8:
version "4.0.8"
resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"
+lodash.defaults@^4.2.0:
+ version "4.2.0"
+ resolved "https://registry.yarnpkg.com/lodash.defaults/-/lodash.defaults-4.2.0.tgz#d09178716ffea4dde9e5fb7b37f6f0802274580c"
+
lodash.defaults@~2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/lodash.defaults/-/lodash.defaults-2.3.0.tgz#a832b001f138f3bb9721c2819a2a7cc5ae21ed25"
@@ -5790,6 +5858,16 @@ mktemp@~0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/mktemp/-/mktemp-0.4.0.tgz#6d0515611c8a8c84e484aa2000129b98e981ff0b"
+moment-timezone@^0.5.13:
+ version "0.5.23"
+ resolved "https://registry.yarnpkg.com/moment-timezone/-/moment-timezone-0.5.23.tgz#7cbb00db2c14c71b19303cb47b0fb0a6d8651463"
+ dependencies:
+ moment ">= 2.9.0"
+
+"moment@>= 2.9.0", moment@^2.19.3:
+ version "2.22.2"
+ resolved "https://registry.yarnpkg.com/moment/-/moment-2.22.2.tgz#3c257f9839fc0e93ff53149632239eb90783ff66"
+
morgan@^1.9.0:
version "1.9.1"
resolved "https://registry.yarnpkg.com/morgan/-/morgan-1.9.1.tgz#0a8d16734a1d9afbc824b99df87e738e58e2da59"
diff --git a/graph/src/definitions/index.js b/graph/src/definitions/index.js
index b5feeed..17f48ed 100644
--- a/graph/src/definitions/index.js
+++ b/graph/src/definitions/index.js
@@ -9,6 +9,8 @@ module.exports = gql`
ping: String!
config: Configuration!
submission(id: String!): CompanyUpdateSubmission!
+ submissions: [CompanyUpdateSubmission!]!
+ submissionCount: Int!
}
type Mutation {
@@ -53,7 +55,9 @@ module.exports = gql`
submitted: Date!
reviewed: Boolean!
name: String!
+ hash: String!
email: String!
+ companyName: String
payload: String!
}
diff --git a/graph/src/mongodb.js b/graph/src/mongodb.js
index c7c4edd..4e8f7d4 100644
--- a/graph/src/mongodb.js
+++ b/graph/src/mongodb.js
@@ -13,4 +13,6 @@ module.exports = {
retrieve: id => client.db().collection('submission').findOne({ _id: new ObjectId(id) }),
insert: payload => client.db().collection('submission').insertOne(payload),
complete: id => client.db().collection('submission').updateOne({ _id: new ObjectId(id) }, { $set: { reviewed: true } }),
+ submissions: ({ reviewed = false } = { reviewed: false }) => client.db().collection('submission').find({ reviewed }).toArray(),
+ submissionCount: () => client.db().collection('submission').countDocuments({ reviewed: false }),
};
diff --git a/graph/src/resolvers/index.js b/graph/src/resolvers/index.js
index 7fd9177..0112add 100644
--- a/graph/src/resolvers/index.js
+++ b/graph/src/resolvers/index.js
@@ -1,10 +1,16 @@
const { DateType } = require('@limit0/graphql-custom-types');
const { GraphQLUpload } = require('apollo-server');
const uuid = require('uuid/v4');
-const { retrieve, insert, complete } = require('../mongodb');
const { notify, thank } = require('../mailer');
const env = require('../env');
const s3Client = require('../s3-client');
+const {
+ retrieve,
+ insert,
+ complete,
+ submissions,
+ submissionCount,
+} = require('../mongodb');
const {
PLATFORM_URI,
@@ -28,11 +34,14 @@ module.exports = {
id: ({ _id }) => _id.toString(),
submitted: ({ _id }) => _id.getTimestamp(),
payload: ({ payload }) => JSON.stringify(payload),
+ companyName: ({ payload: { name } }) => name,
},
Query: {
config: () => config,
submission: (_, { id }) => retrieve(id),
+ submissions: () => submissions(),
+ submissionCount: () => submissionCount(),
},
Mutation: {
company: async (_, { input }) => {