Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Drive actions improvements #11837

Merged
merged 36 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
ffcfe46
Download File improvements
GTFalcao May 2, 2024
e233443
Deprecating 'create file' and improving 'upload file'
GTFalcao May 2, 2024
9270584
Text improvements
GTFalcao May 2, 2024
3d734b4
text improvement
GTFalcao May 2, 2024
a5b1dda
text improvement
GTFalcao May 2, 2024
675e1c4
adjustments
GTFalcao May 2, 2024
27bf95e
Merge branch 'master' into google-drive-actions-improvements
GTFalcao May 2, 2024
ba54cb6
Delete File improvements
GTFalcao May 2, 2024
1c37905
Adding theme id async options
GTFalcao May 2, 2024
1740d69
adjustment
GTFalcao May 2, 2024
dbe7205
Get Shared Drive improvements
GTFalcao May 2, 2024
f08d13c
Improvements
GTFalcao May 2, 2024
ef08dda
Find Forms & Sheets improvements
GTFalcao May 2, 2024
9eb2014
Merge branch 'master' into google-drive-actions-improvements
GTFalcao May 6, 2024
97c0db1
Search Query improvements
GTFalcao May 6, 2024
8bddf4c
Forms label
GTFalcao May 6, 2024
311c651
Reusing query method and props
GTFalcao May 6, 2024
a186b8b
Description updates
GTFalcao May 6, 2024
cce03a9
find file - reusing common query stuff
GTFalcao May 6, 2024
82b414c
More search query improvements
GTFalcao May 6, 2024
f8cc1c6
Description adjustments
GTFalcao May 6, 2024
baa333f
Merge branch 'master' into google-drive-actions-improvements
GTFalcao May 6, 2024
acf2a47
Moving constants file to common
GTFalcao May 7, 2024
45e31d9
Merge branch 'master' into google-drive-actions-improvements
GTFalcao May 7, 2024
31601cd
Merge branch 'master' into google-drive-actions-improvements
GTFalcao May 7, 2024
c151584
Version bumps
GTFalcao May 7, 2024
37e0b76
Version bumps
GTFalcao May 7, 2024
40878cb
Merge branch 'master' into google-drive-actions-improvements
GTFalcao May 16, 2024
0e8b045
Find Spreadsheets bugfix
GTFalcao May 16, 2024
0d79210
Share File improvements and fixes
GTFalcao May 16, 2024
0038f10
Rename "share file" > "share file or folder"
GTFalcao May 16, 2024
af6715c
Summary improvement
GTFalcao May 16, 2024
ed8aa88
Merge branch 'master' into google-drive-actions-improvements
GTFalcao May 26, 2024
3232980
Merge branch 'master' into google-drive-actions-improvements
GTFalcao May 29, 2024
3dcd3bc
Merge branch 'master' into google-drive-actions-improvements
GTFalcao May 29, 2024
050d0a4
Version bump
GTFalcao May 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/albus/albus.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/bookingmood/bookingmood.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/bunnydoc/bunnydoc.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/cardinal/cardinal.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/docsgenflow/docsgenflow.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/documenterra/documenterra.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/eagle_doc/eagle_doc.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/genderize/genderize.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import {
GOOGLE_DRIVE_FOLDER_MIME_TYPE,
GOOGLE_DRIVE_GRANTEE_DOMAIN,
GOOGLE_DRIVE_GRANTEE_GROUP,
GOOGLE_DRIVE_GRANTEE_USER,
GOOGLE_DRIVE_ROLE_OPTIONS,
GOOGLE_DRIVE_ROLE_OPTION_FILEORGANIZER,
GOOGLE_DRIVE_ROLE_WRITER,
} from "../../common/constants.mjs";
import googleDrive from "../../google_drive.app.mjs";

Expand All @@ -14,10 +17,10 @@ import googleDrive from "../../google_drive.app.mjs";
*/
export default {
key: "google_drive-add-file-sharing-preference",
name: "Share File",
name: "Share File or Folder",
description:
"Add a [sharing permission](https://support.google.com/drive/answer/7166529) to the sharing preferences of a file or folder and provide a sharing URL. [See the documentation](https://developers.google.com/drive/api/v3/reference/permissions/create)",
version: "0.1.5",
version: "0.1.6",
type: "action",
props: {
googleDrive,
Expand All @@ -38,6 +41,7 @@ export default {
],
optional: false,
description: "The file or folder to share",
reloadProps: true,
},
type: {
propDefinition: [
Expand All @@ -47,16 +51,25 @@ export default {
reloadProps: true,
},
},
additionalProps() {
async additionalProps() {
const obj = {};
const {
fileOrFolderId, type,
} = this;
if (!fileOrFolderId || !type) return obj;

const { mimeType } = await this.googleDrive.getFile(this.fileOrFolderId, {
fields: "mimeType",
});

const emailAddress = {
type: "string",
label: "Email Address",
description:
"Enter the email address of the user that you'd like to share the file or folder with (e.g. `[email protected]`).",
};

switch (this.type) {
switch (type) {
case GOOGLE_DRIVE_GRANTEE_DOMAIN:
obj.domain = {
type: "string",
Expand All @@ -80,13 +93,22 @@ export default {
break;
}

const isFolder = mimeType === GOOGLE_DRIVE_FOLDER_MIME_TYPE;
const options = GOOGLE_DRIVE_ROLE_OPTIONS;

if (isFolder) {
const writerOpt = options.find(({ value }) => value === GOOGLE_DRIVE_ROLE_WRITER);
writerOpt.label = writerOpt.label.replace(/Writer/, "Contributor");
options.push(GOOGLE_DRIVE_ROLE_OPTION_FILEORGANIZER);
}

return {
...obj,
role: {
type: "string",
label: "Role",
description: "The role granted by this permission",
options: GOOGLE_DRIVE_ROLE_OPTIONS,
options,
},
};
},
Expand All @@ -107,9 +129,9 @@ export default {
const webViewLink = resp.webViewLink;
$.export(
"$summary",
`Successfully shared file "${resp.name}" with ${this.type} "${
this.emailAddress ?? this.domain ?? ""
}"`,
`Successfully shared file "${resp.name}" with ${type} "${
emailAddress ?? domain ?? ""
}" with role '${role}'`,
);
return webViewLink;
},
Expand Down
4 changes: 2 additions & 2 deletions components/google_drive/actions/copy-file/copy-file.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import googleDrive from "../../google_drive.app.mjs";
export default {
key: "google_drive-copy-file",
name: "Copy File",
description: "Create a copy of the specified file. [See the docs](https://developers.google.com/drive/api/v3/reference/files/copy) for more information",
version: "0.1.4",
description: "Create a copy of the specified file. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/copy) for more information",
version: "0.1.5",
type: "action",
props: {
googleDrive,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
key: "google_drive-create-file-from-template",
name: "Create New File From Template",
description: "Create a new Google Docs file from a template. Optionally include placeholders in the template document that will get replaced from this action. [See documentation](https://www.npmjs.com/package/google-docs-mustaches)",
version: "0.1.4",
version: "0.1.5",
type: "action",
props: {
googleDrive,
Expand All @@ -18,7 +18,7 @@ export default {
"fileId",
],
description:
"Select the template document you'd like to use as the template, or use a custom expression to reference a document ID from a previous step. Template documents should contain placeholders in the format {{xyz}}.",
"Select the template document you'd like to use as the template, or use a custom expression to reference a document ID from a previous step. Template documents should contain placeholders in the format `{{xyz}}`.",
},
folderId: {
propDefinition: [
Expand Down Expand Up @@ -49,7 +49,7 @@ export default {
replaceValues: {
type: "object",
label: "Replace text placeholders",
description: "Replace text placeholders in the document. Use the format {{xyz}} in the document but exclude the curly braces in the key. (eg. `{{myPlaceholder}}` in the document will be replaced by the value of the key `myPlaceholder` in the action.",
description: "Replace text placeholders in the document. Use the format `{{xyz}}` in the document but exclude the curly braces in the key. (eg. `{{myPlaceholder}}` in the document will be replaced by the value of the key `myPlaceholder` in the action.",
},
},
async run({ $ }) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { Readable } from "stream";
export default {
key: "google_drive-create-file-from-text",
name: "Create New File From Text",
description: "Create a new file from plain text. [See the docs](https://developers.google.com/drive/api/v3/reference/files/create) for more information",
version: "0.1.4",
description: "Create a new file from plain text. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/create) for more information",
version: "0.1.5",
type: "action",
props: {
googleDrive,
Expand Down Expand Up @@ -33,6 +33,7 @@ export default {
googleDrive,
"fileName",
],
label: "File Name",
description:
"The name of the file you want to create (e.g., `myFile.txt`)",
},
Expand Down