Skip to content

Commit d1aadd1

Browse files
committed
Adjustments to allow updating file metadata only
1 parent 177d045 commit d1aadd1

File tree

3 files changed

+30
-10
lines changed

3 files changed

+30
-10
lines changed

components/google_drive/actions/update-file/update-file.mjs

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ import {
33
toSingleLineString,
44
getFileStream,
55
} from "../../common/utils.mjs";
6-
import {
7-
additionalProps, useFileUrlOrPath,
8-
} from "../../common/filePathOrUrl.mjs";
6+
import { additionalProps } from "../../common/filePathOrUrl.mjs";
97

108
export default {
119
key: "google_drive-update-file",
@@ -16,7 +14,26 @@ export default {
1614
additionalProps,
1715
props: {
1816
googleDrive,
19-
useFileUrlOrPath,
17+
updateType: {
18+
type: "string",
19+
label: "Update Type",
20+
description: "Whether to update content or metadata only",
21+
options: [
22+
{
23+
label: "Upload content from File URL",
24+
value: "File URL",
25+
},
26+
{
27+
label: "Upload content from File Path",
28+
value: "File Path",
29+
},
30+
{
31+
label: "Update file metadata only",
32+
value: "File Metadata",
33+
},
34+
],
35+
reloadProps: true,
36+
},
2037
drive: {
2138
propDefinition: [
2239
googleDrive,

components/google_drive/actions/upload-file/upload-file.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
} from "../../common/utils.mjs";
77
import { GOOGLE_DRIVE_UPLOAD_TYPE_MULTIPART } from "../../common/constants.mjs";
88
import {
9-
additionalProps, useFileUrlOrPath,
9+
additionalProps, updateType,
1010
} from "../../common/filePathOrUrl.mjs";
1111

1212
export default {
@@ -18,7 +18,7 @@ export default {
1818
additionalProps,
1919
props: {
2020
googleDrive,
21-
useFileUrlOrPath,
21+
updateType,
2222
drive: {
2323
propDefinition: [
2424
googleDrive,

components/google_drive/common/filePathOrUrl.mjs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const useFileUrlOrPath = {
1+
export const updateType = {
22
type: "string",
33
label: "Use File URL or File Path",
44
description: "Whether to upload a file from a URL or from the `/tmp` folder",
@@ -10,14 +10,17 @@ export const useFileUrlOrPath = {
1010
};
1111

1212
export async function additionalProps(previousProps) {
13-
const { useFileUrlOrPath } = this;
13+
const { updateType } = this;
1414

15-
if (useFileUrlOrPath === "File URL") {
15+
if (updateType === "File URL") {
1616
previousProps.fileUrl.hidden = false;
1717
previousProps.filePath.hidden = true;
18-
} else if (useFileUrlOrPath === "File Path") {
18+
} else if (updateType === "File Path") {
1919
previousProps.fileUrl.hidden = true;
2020
previousProps.filePath.hidden = false;
21+
} else {
22+
previousProps.fileUrl.hidden = true;
23+
previousProps.filePath.hidden = true;
2124
}
2225

2326
return {};

0 commit comments

Comments
 (0)