From 4c49ce67c1c4f272397ec99a79ee6297b1b183e2 Mon Sep 17 00:00:00 2001 From: Shams mosowi Date: Thu, 10 Sep 2020 16:57:58 +1000 Subject: [PATCH 1/6] fix email error log --- cloud_functions/functions/src/emailOnTrigger/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cloud_functions/functions/src/emailOnTrigger/index.ts b/cloud_functions/functions/src/emailOnTrigger/index.ts index 48671774..a2049b12 100644 --- a/cloud_functions/functions/src/emailOnTrigger/index.ts +++ b/cloud_functions/functions/src/emailOnTrigger/index.ts @@ -36,8 +36,9 @@ const emailOnCreate = (config: EmailOnTriggerConfig) => config.requiredFields, snapshotData ); - const to = await config.to(snapshotData, db); const from = await config.from(snapshotData, db); + const to = await config.to(snapshotData, db); + console.log(JSON.stringify({ to, from })); if (shouldSend && hasAllRequiredFields) { const msg = { @@ -62,7 +63,7 @@ const emailOnCreate = (config: EmailOnTriggerConfig) => return false; } } catch (error) { - console.warn(JSON.stringify(error.response.body)); + console.warn(JSON.stringify(error)); return false; } }); From 6f7ed83fd74853d719ea58980fd196b7062f1d00 Mon Sep 17 00:00:00 2001 From: Shams mosowi Date: Thu, 10 Sep 2020 17:31:39 +1000 Subject: [PATCH 2/6] emailTrigger logging --- cloud_functions/functions/src/emailOnTrigger/index.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cloud_functions/functions/src/emailOnTrigger/index.ts b/cloud_functions/functions/src/emailOnTrigger/index.ts index a2049b12..4f7da89d 100644 --- a/cloud_functions/functions/src/emailOnTrigger/index.ts +++ b/cloud_functions/functions/src/emailOnTrigger/index.ts @@ -55,15 +55,17 @@ const emailOnCreate = (config: EmailOnTriggerConfig) => categories: config.categories, attachments: snapshotData.attachments, }; + console.log(JSON.stringify(msg)); + const resp = await sendEmail(msg); console.log(JSON.stringify(resp)); - return true; + return resp; } else { console.log("requirements were not met"); return false; } } catch (error) { - console.warn(JSON.stringify(error)); + console.warn("Failed", JSON.stringify(error)); return false; } }); From bf74eb3547225d6b9ba891461a8bc7870047b862 Mon Sep 17 00:00:00 2001 From: Shams mosowi Date: Thu, 10 Sep 2020 18:16:12 +1000 Subject: [PATCH 3/6] FT_email:more logging --- cloud_functions/functions/src/emailOnTrigger/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cloud_functions/functions/src/emailOnTrigger/index.ts b/cloud_functions/functions/src/emailOnTrigger/index.ts index 4f7da89d..492fb914 100644 --- a/cloud_functions/functions/src/emailOnTrigger/index.ts +++ b/cloud_functions/functions/src/emailOnTrigger/index.ts @@ -39,7 +39,10 @@ const emailOnCreate = (config: EmailOnTriggerConfig) => const from = await config.from(snapshotData, db); const to = await config.to(snapshotData, db); - console.log(JSON.stringify({ to, from })); + console.log( + JSON.stringify({ to, from, hasAllRequiredFields, shouldSend }) + ); + if (shouldSend && hasAllRequiredFields) { const msg = { from, From ec7606aa823e697d5da28a44a2445ef53a41ff94 Mon Sep 17 00:00:00 2001 From: Sidney Alcantara Date: Fri, 11 Sep 2020 11:11:23 +1000 Subject: [PATCH 4/6] fix spawn npm on windows --- cli/src/lib/terminal.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cli/src/lib/terminal.js b/cli/src/lib/terminal.js index 64786947..7cb3dee3 100644 --- a/cli/src/lib/terminal.js +++ b/cli/src/lib/terminal.js @@ -111,7 +111,11 @@ module.exports.deployToFirebaseHosting = (projectId) => module.exports.startFiretableLocally = (dir = "firetable/www") => new Promise((resolve) => { - const child = spawn("npm", ["run", "serve"], { cwd: dir }); + const child = spawn( + /^win/.test(process.platform) ? "npm.cmd" : "npm", + ["run", "serve"], + { cwd: dir } + ); child.stdout.on("data", (data) => { const msg = data.toString(); const portRegex = /^INFO: Accepting connections at (http:\/\/[\w\.]+:\d+)/; From dc2399a5871fe5d27dce41a9f24a2be41204cd02 Mon Sep 17 00:00:00 2001 From: Sidney Alcantara Date: Fri, 11 Sep 2020 11:17:51 +1000 Subject: [PATCH 5/6] v1.0.2 --- cli/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/package.json b/cli/package.json index 99ca6ec4..44d01591 100644 --- a/cli/package.json +++ b/cli/package.json @@ -1,7 +1,7 @@ { "name": "firetable", "alias": "firetable-cli", - "version": "1.0.1", + "version": "1.0.2", "description": "CLI tool to simplify firetable deployment processes", "repository": "https://github.com/AntlerVC/firetable", "author": "Shams Mosowi", From 1ec921ee9948d9cdf28c391e55f95db56ce5b6a1 Mon Sep 17 00:00:00 2001 From: Shams mosowi Date: Fri, 11 Sep 2020 12:43:52 +1000 Subject: [PATCH 6/6] fix export all button --- www/src/components/Table/ExportCSV.tsx | 31 +++++++++++++------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/www/src/components/Table/ExportCSV.tsx b/www/src/components/Table/ExportCSV.tsx index 6b65a68a..8399c70e 100644 --- a/www/src/components/Table/ExportCSV.tsx +++ b/www/src/components/Table/ExportCSV.tsx @@ -72,7 +72,6 @@ const selectedColumnsReducer = (doc: any) => ( currentColumn: any ) => { const value = _get(doc, currentColumn.key); - console.log({ currentColumn }); switch (currentColumn.type) { case FieldType.multiSelect: return { @@ -92,17 +91,18 @@ const selectedColumnsReducer = (doc: any) => ( case FieldType.connectTable: return { ...accumulator, - [currentColumn.name]: value - ? value - .map((item: any) => - currentColumn.config.primaryKeys.reduce( - (labelAccumulator: string, currentKey: any) => - `${labelAccumulator} ${item.snapshot[currentKey]}`, - "" + [currentColumn.name]: + value && Array.isArray(value) + ? value + .map((item: any) => + currentColumn.config.primaryKeys.reduce( + (labelAccumulator: string, currentKey: any) => + `${labelAccumulator} ${item.snapshot[currentKey]}`, + "" + ) ) - ) - .join() - : "", + .join() + : "", }; case FieldType.checkbox: return { @@ -116,10 +116,11 @@ const selectedColumnsReducer = (doc: any) => ( ...accumulator, [currentColumn.name]: value ? value.toDate() : "", }; - case FieldType.last: case FieldType.action: - case FieldType.connectTable: - return accumulator; + return { + ...accumulator, + [currentColumn.name]: value && value.status ? value.status : "", + }; default: return { ...accumulator, @@ -227,7 +228,7 @@ export default function ExportCSV() {