Skip to content

Commit 39f4fe3

Browse files
nbitonfranck-boullier
authored andcommitted
Report share (#530)
* feat: added user name to user role definition returned from func * feat: refactored code to new independent component UserSelectionBox * feat: refactored code for PdfIcon * chore: renamed prop * feat: report finalization refactor; pdf export; persistent file urls * feat: migration for sorting our all previous report snapshots versions * feat: publish for stored report snapshot html and pdf files * feat: report share screen- WIP: only download fully works * feat: added PDFCONVERT_LMBDA_URL env var for all necessary mentions * fix: download on FF * fix: lint error * feat: enforcing explicit download with the report title name * feat: handmade email tag input * feat: supercharged tag input (covers all thinkable bases) * feat: share report pdf email server code * feat: share report pdf email state wiring * feat: exposing userId on unit resolver for smarter selections * feat: quick refactor to allow sharing with users by id * feat: linkage for new reducer and epic * feat: catering to a scenario where the sender has no explicit unit role * fix: fixed layout issues with the report share email template * feat: triggering report sharing from UI * feat: success dialog for report sharing * feat: smarter failure error; tracking "sharedWith" on report snapshot * fix: reverted to sharing via BZ login so non MEFE users don't fail * feat: changed tag line for the report pdf sharing email
1 parent 8b0f431 commit 39f4fe3

27 files changed

+903
-165
lines changed

.env.sample

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ INVITE_LAMBDA_URL=<run the "invite" project on a separate port and place the url
33
APIENROLL_LAMBDA_URL=<run the "apienroll" project on a separate port and place the url here>
44
UNIT_CREATE_LAMBDA_URL=<run the "unit" project on a separate port and place the url here, add '/create' at the end>
55
PDFGEN_LAMBDA_URL=<point to a real lambda URL running this, for instance https://pdfgen.dev.unee-t.com>
6+
PDFCONVERT_LAMBDA_URL=<point to a real lambda URL running this, for instance https://prince.dev.unee-t.com>
67
MAIL_URL=<SMPT provider URL>
78
CLOUDINARY_URL=<retrieve by registering for a free account on Cloudinary (should end with /image/upload)>
89
CLOUDINARY_PRESET=<generate in your Cloudinary account (look into 'Unsigned Uploading')>

.meteor/packages

+1
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@ dburles:collection-helpers
3131
3232
percolate:migrations
3333
underscore
34+
email

app.json

+3
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@
4545
},
4646
"PDFGEN_LAMBDA_URL": {
4747
"required": true
48+
},
49+
"PDFCONVERT_LAMBDA_URL": {
50+
"required": true
4851
}
4952
},
5053
"formation": {

aws-env.demo

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export INVITE_LAMBDA_URL=https://invite.demo.unee-t.com
55
export UNIT_CREATE_LAMBDA_URL=https://unit.demo.unee-t.com/create
66
export APIENROLL_LAMBDA_URL=https://apienroll.demo.unee-t.com
77
export PDFGEN_LAMBDA_URL=https://pdfgen.demo.unee-t.com
8+
export PDFCONVERT_LAMBDA_URL=https://prince.demo.unee-t.com
89
export MONGO_PASSWORD=$(aws --profile uneet-demo ssm get-parameters --names MONGO_PASSWORD --with-decryption --query Parameters[0].Value --output text)
910
export MONGO_CONNECT=$(aws --profile uneet-demo ssm get-parameters --names MONGO_CONNECT --query Parameters[0].Value --output text)
1011

aws-env.dev

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export INVITE_LAMBDA_URL=https://invite.dev.unee-t.com
55
export UNIT_CREATE_LAMBDA_URL=https://unit.dev.unee-t.com/create
66
export APIENROLL_LAMBDA_URL=https://apienroll.dev.unee-t.com
77
export PDFGEN_LAMBDA_URL=https://pdfgen.dev.unee-t.com
8+
export PDFCONVERT_LAMBDA_URL=https://prince.dev.unee-t.com
89
export MONGO_PASSWORD=$(aws --profile uneet-dev ssm get-parameters --names MONGO_PASSWORD --with-decryption --query Parameters[0].Value --output text)
910
export MONGO_CONNECT=$(aws --profile uneet-dev ssm get-parameters --names MONGO_CONNECT --query Parameters[0].Value --output text)
1011
export CLOUDINARY_PRESET=$(aws --profile uneet-dev ssm get-parameters --names CLOUDINARY_PRESET --with-decryption --query Parameters[0].Value --output text)

aws-env.prod

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export INVITE_LAMBDA_URL=https://invite.unee-t.com
55
export UNIT_CREATE_LAMBDA_URL=https://unit.unee-t.com/create
66
export APIENROLL_LAMBDA_URL=https://apienroll.unee-t.com
77
export PDFGEN_LAMBDA_URL=https://pdfgen.unee-t.com
8+
export PDFCONVERT_LAMBDA_URL=https://prince.unee-t.com
89
export MONGO_PASSWORD=$(aws --profile uneet-prod ssm get-parameters --names MONGO_PASSWORD --with-decryption --query Parameters[0].Value --output text)
910
export MONGO_CONNECT=$(aws --profile uneet-prod ssm get-parameters --names MONGO_CONNECT --query Parameters[0].Value --output text)
1011
export CLOUDINARY_PRESET=$(aws --profile uneet-prod ssm get-parameters --names CLOUDINARY_PRESET --with-decryption --query Parameters[0].Value --output text)

imports/api/report-snapshots.js

+29-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
11
import { Mongo } from 'meteor/mongo'
2+
import { Meteor } from 'meteor/meteor'
3+
import { callAPI } from '../util/bugzilla-api'
24

3-
export default new Mongo.Collection('reportSnapshots')
5+
export const collectionName = 'reportSnapshots'
6+
7+
const ReportSnapshots = new Mongo.Collection(collectionName)
8+
if (Meteor.isServer) {
9+
Meteor.publish(`${collectionName}.byReportIdJustUrls`, function (reportId) {
10+
if (!this.userId) return
11+
const { bugzillaCreds: { apiKey } } = Meteor.users.findOne(this.userId)
12+
13+
// Calling BZ API to authorize the current user
14+
try {
15+
callAPI('get', `/rest/bug/${reportId}`, {api_key: apiKey}, false, true)
16+
} catch (e) {
17+
console.error(`Unauthorized access to report ${reportId}`)
18+
return
19+
}
20+
21+
return ReportSnapshots.find({'reportItem.id': parseInt(reportId)}, {
22+
fields: {
23+
previewUrl: 1,
24+
pdfUrl: 1,
25+
'reportItem.id': 1
26+
}
27+
})
28+
})
29+
}
30+
31+
export default ReportSnapshots

0 commit comments

Comments
 (0)