Skip to content

Commit b38f664

Browse files
Monday usability improvements (#15376)
* pnpm * Description updates * Source description updates and version bumps * Version bumps * More description updates * Description update * Version number fixes * Adding status options and adjusting doc links * Parsing status options for columns * Adding options for all columns that have them available * Massive improvements to props supporting async options * Version bump * OAuth component version bumps * Adjusting options for 'get items by column value' * pnpm * temporarily adjusting imports * Adding optional chaining to avoid exceptions on empty lists * Remove debug * Re-adjusting imports and version bumps * Version and import adjustments * Reverting Monday OAuth changes --------- Co-authored-by: Leo Vu <vunguyenhung@outlook.com>
1 parent e2c69e8 commit b38f664

File tree

25 files changed

+259
-118
lines changed

25 files changed

+259
-118
lines changed

components/monday/actions/common/common-create-item.mjs

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import {
2+
capitalizeWord, getColumnOptions,
3+
} from "../../common/utils.mjs";
14
import monday from "../../monday.app.mjs";
25

36
export default {
@@ -11,7 +14,7 @@ export default {
1114
}),
1215
],
1316
type: "string[]",
14-
description: "Select columns to fill",
17+
description: "Select which item columns to set values for",
1518
reloadProps: true,
1619
},
1720
},
@@ -20,26 +23,32 @@ export default {
2023
if (!this.columns) {
2124
return props;
2225
}
26+
const columnData = await this.monday.listColumns({
27+
boardId: +this.boardId,
28+
});
2329
for (const column of this.columns) {
24-
let description;
25-
if (column === "status") {
26-
description = "Value for status. [Status Index Value Map](https://view.monday.com/1073554546-ad9f20a427a16e67ded630108994c11b?r=use1)";
27-
} else if (column === "person") {
28-
description = "The ID of the person/user to add to item";
30+
let description, options;
31+
options = getColumnOptions(columnData, column);
32+
if (column === "person") {
33+
description = "The ID of a person/user";
2934
} else if (column === "date4") {
30-
description = "Enter date of item in YYYY-MM-DD format. Eg. `2022-09-02`";
35+
description = "A date string in `YYYY-MM-DD` format, e.g. `2022-09-02`";
36+
} else if (options) {
37+
description = `Select a value from the list for column "${column}".`;
3138
} else {
32-
description = `Value for column ${column}. See the [Column Type Reference](https://developer.monday.com/api-reference/docs/column-types-reference) to learn more about entering column type values.`;
39+
description = `Value for column "${column}". See the [Column Type Reference](https://developer.monday.com/api-reference/reference/column-types-reference) to learn more about entering column type values.`;
3340
}
3441
props[column] = {
3542
type: "string",
36-
label: column,
43+
label: capitalizeWord(column),
3744
description,
45+
options,
3846
};
3947
}
4048
return props;
4149
},
4250
methods: {
51+
capitalizeWord,
4352
getEmailValue(value) {
4453
let email = value;
4554
if (typeof value === "string") {

components/monday/actions/create-board/create-board.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import monday from "../../monday.app.mjs";
44
export default {
55
key: "monday-create-board",
66
name: "Create Board",
7-
description: "Creates a new board. [See the documentation](https://api.developer.monday.com/docs/boards#create-a-board)",
7+
description: "Creates a new board. [See the documentation](https://developer.monday.com/api-reference/reference/boards#create-a-board)",
88
type: "action",
9-
version: "0.0.7",
9+
version: "0.0.8",
1010
props: {
1111
monday,
1212
boardName: {

components/monday/actions/create-column/create-column.mjs

Lines changed: 39 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import constants from "../../common/constants.mjs";
22
import monday from "../../monday.app.mjs";
3+
import { ConfigurationError } from "@pipedream/platform";
34

45
export default {
56
key: "monday-create-column",
67
name: "Create Column",
78
description: "Creates a column. [See the documentation](https://developer.monday.com/api-reference/reference/columns#create-a-column)",
89
type: "action",
9-
version: "0.0.8",
10+
version: "0.1.0",
1011
props: {
1112
monday,
1213
boardId: {
@@ -18,45 +19,63 @@ export default {
1819
title: {
1920
type: "string",
2021
label: "Title",
21-
description: "The new column's title.",
22+
description: "The title of the new column",
2223
},
2324
columnType: {
2425
type: "string",
2526
label: "Column Type",
26-
description: "The new column's title",
27+
description: "The type of the new column",
2728
options: constants.COLUMN_TYPE_OPTIONS,
2829
reloadProps: true,
2930
},
3031
description: {
3132
type: "string",
3233
label: "Description",
33-
description: "The column's description.",
34+
description: "The description of the new column",
3435
optional: true,
3536
},
3637
},
3738
async additionalProps() {
3839
const props = {};
39-
const defaults = {
40-
type: "string",
41-
label: "Defaults",
42-
description: "The new column's defaults. For use with column types `status` or `dropdown`. [See the documentation](https://developer.monday.com/api-reference/reference/columns#create-a-status-or-dropdown-column-with-custom-labels) for additional information.",
43-
optional: true,
44-
};
45-
if (this.columnType === "status") {
46-
props.defaults = {
47-
...defaults,
48-
default: "{\"labels\":{\"1\":\"Option1\",\"2\":\"Option2\",\"3\":\"Option3\",\"4\": \"Option4\"}}",
49-
};
50-
}
51-
if (this.columnType === "dropdown") {
40+
if ([
41+
"status",
42+
"dropdown",
43+
].includes(this.columnType)) {
5244
props.defaults = {
53-
...defaults,
54-
default: "{\"settings\":{\"labels\":[{\"id\":1,\"name\":\"Option1\"}, {\"id\":2,\"name\":\"Option2\"}, {\"id\":3,\"name\":\"Option3\"}]}}",
45+
type: "string",
46+
label: "Custom Labels (Defaults)",
47+
description: "The new column's custom labels (defaults). For use with column types `status` or `dropdown`. Should be an object in the format `{ \"1\": \"Technology\", \"2\": \"Marketing\" }` where each key is the label ID and each value is the label text. [See the documentation](https://developer.monday.com/api-reference/reference/columns#create-a-status-or-dropdown-column-with-custom-labels) for more information.",
48+
optional: true,
5549
};
5650
}
5751
return props;
5852
},
5953
async run({ $ }) {
54+
let { defaults } = this;
55+
if (defaults) {
56+
try {
57+
if (this.columnType === "status") {
58+
defaults = JSON.stringify({
59+
labels: JSON.parse(defaults),
60+
});
61+
} else if (this.columnType === "dropdown") {
62+
const obj = JSON.parse(defaults);
63+
defaults = JSON.stringify({
64+
settings: {
65+
labels: Object.entries(obj).map(([
66+
id,
67+
name,
68+
]) => ({
69+
id: Number(id),
70+
name,
71+
})),
72+
},
73+
});
74+
}
75+
} catch (err) {
76+
throw new ConfigurationError(`Error parsing \`Custom Labels\` as JSON: "${err}"`);
77+
}
78+
}
6079
const {
6180
data,
6281
errors,
@@ -66,11 +85,7 @@ export default {
6685
boardId: +this.boardId,
6786
title: this.title,
6887
columnType: this.columnType,
69-
defaults: this.defaults
70-
? typeof this.defaults !== "string"
71-
? JSON.stringify(this.defaults)
72-
: this.defaults
73-
: undefined,
88+
defaults,
7489
description: this.description,
7590
});
7691

components/monday/actions/create-group/create-group.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import monday from "../../monday.app.mjs";
33
export default {
44
key: "monday-create-group",
55
name: "Create Group",
6-
description: "Creates a new group in a specific board. [See the documentation](https://api.developer.monday.com/docs/groups-queries#create-a-group)",
6+
description: "Creates a new group in a specific board. [See the documentation](https://developer.monday.com/api-reference/reference/groups#create-a-group)",
77
type: "action",
8-
version: "0.0.8",
8+
version: "0.0.9",
99
props: {
1010
monday,
1111
boardId: {

components/monday/actions/create-item/create-item.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ export default {
66
...commonCreateItem,
77
key: "monday-create-item",
88
name: "Create Item",
9-
description: "Creates an item. [See the documentation](https://api.developer.monday.com/docs/items-queries#create-an-item)",
9+
description: "Creates an item. [See the documentation](https://developer.monday.com/api-reference/reference/items#create-an-item)",
1010
type: "action",
11-
version: "0.0.10",
11+
version: "0.1.0",
1212
props: {
1313
monday,
1414
boardId: {

components/monday/actions/create-subitem/create-subitem.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default {
88
name: "Create Subitem",
99
description: "Creates a subitem. [See the documentation](https://developer.monday.com/api-reference/reference/subitems#create-a-subitem)",
1010
type: "action",
11-
version: "0.0.3",
11+
version: "0.1.0",
1212
props: {
1313
monday,
1414
boardId: {
@@ -26,7 +26,7 @@ export default {
2626
}),
2727
],
2828
optional: false,
29-
description: "The parent item's unique identifier",
29+
description: "Select a parent item or provide an item ID",
3030
},
3131
itemName: {
3232
propDefinition: [

components/monday/actions/create-update/create-update.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
name: "Create an Update",
77
description: "Creates a new update. [See the documentation](https://developer.monday.com/api-reference/reference/updates#create-an-update)",
88
type: "action",
9-
version: "0.0.10",
9+
version: "0.0.11",
1010
props: {
1111
monday,
1212
updateBody: {
@@ -33,7 +33,7 @@ export default {
3333
},
3434
parentId: {
3535
label: "Parent Update ID",
36-
description: "The parent post identifier",
36+
description: "Select a parent update or provide an update ID",
3737
propDefinition: [
3838
monday,
3939
"updateId",

components/monday/actions/get-column-values/get-column-values.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ export default {
44
...common,
55
key: "monday-get-column-values",
66
name: "Get Column Values",
7-
description: "Return values of a specific column or columns for a board item. [See the documentation](https://developer.monday.com/api-reference/docs/column-values-v2)",
8-
version: "0.0.5",
7+
description: "Return values of specific column(s) for a board item. [See the documentation](https://developer.monday.com/api-reference/reference/column-values-v2)",
8+
version: "0.0.6",
99
type: "action",
1010
props: {
1111
...common.props,
@@ -29,7 +29,7 @@ export default {
2929
],
3030
type: "string[]",
3131
label: "Columns",
32-
description: "Return data from the specified column(s)",
32+
description: "Select the column(s) to return data from",
3333
optional: true,
3434
},
3535
},
@@ -49,7 +49,7 @@ export default {
4949
throw new Error(response.errors[0].message);
5050
}
5151

52-
$.export("$summary", `Successfully retrieved column values for item with ID ${this.itemId}.`);
52+
$.export("$summary", `Successfully retrieved column values for item with ID ${this.itemId}`);
5353

5454
return this.formatColumnValues(response.data.items);
5555
},

components/monday/actions/get-items-by-column-value/get-items-by-column-value.mjs

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
import { getColumnOptions } from "../../common/utils.mjs";
12
import common from "../common/column-values.mjs";
23

34
export default {
45
...common,
56
key: "monday-get-items-by-column-value",
67
name: "Get Items By Column Value",
7-
description: "Searches a column for items matching a value. [See the documentation](https://developer.monday.com/api-reference/docs/items-page-by-column-values)",
8-
version: "0.0.5",
8+
description: "Searches a column for items matching a value. [See the documentation](https://developer.monday.com/api-reference/reference/items-page-by-column-values)",
9+
version: "0.1.0",
910
type: "action",
1011
props: {
1112
...common.props,
@@ -18,12 +19,26 @@ export default {
1819
}),
1920
],
2021
description: "The column to search",
22+
reloadProps: true,
2123
},
22-
value: {
23-
type: "string",
24-
label: "Value",
25-
description: "The value to serach for. [See documentation](https://developer.monday.com/api-reference/docs/items-by-column-values#supported-limited-support-and-unsupported-columns) for additional information about column values.",
26-
},
24+
},
25+
async additionalProps() {
26+
const columnData = await this.monday.listColumns({
27+
boardId: +this.boardId,
28+
});
29+
30+
const options = getColumnOptions(columnData, this.columnId, true);
31+
32+
return {
33+
value: {
34+
type: "string",
35+
label: "Value",
36+
description: `The value to search for.${options
37+
? ""
38+
: " [See the documentation](https://developer.monday.com/api-reference/reference/items-page-by-column-values#supported-and-unsupported-columns) for additional information about column values"} `,
39+
options,
40+
},
41+
};
2742
},
2843
async run({ $ }) {
2944
const response = await this.monday.getItemsByColumnValue({

components/monday/actions/update-column-values/update-column-values.mjs

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,24 @@ import common from "../common/column-values.mjs";
22
import { axios } from "@pipedream/platform";
33
import fs from "fs";
44
import FormData from "form-data";
5+
import { getColumnOptions } from "../../common/utils.mjs";
56

67
export default {
78
...common,
89
key: "monday-update-column-values",
910
name: "Update Column Values",
10-
description: "Update multiple column values of an item. [See the documentation](https://developer.monday.com/api-reference/docs/columns#change-multiple-column-values)",
11-
version: "0.0.5",
11+
description: "Update multiple column values of an item. [See the documentation](https://developer.monday.com/api-reference/reference/columns#change-multiple-column-values)",
12+
version: "0.1.0",
1213
type: "action",
1314
props: {
1415
...common.props,
16+
updateInfoBox: {
17+
type: "alert",
18+
alertType: "info",
19+
content: "See the [Column types reference](https://developer.monday.com/api-reference/reference/column-types-reference) to find the proper data structures for supported column types",
20+
},
1521
boardId: {
1622
...common.props.boardId,
17-
description: "The board's unique identifier. See the [Column types reference](https://developer.monday.com/api-reference/docs/column-types-reference) to find the proper data structures for supported column types.",
1823
reloadProps: true,
1924
},
2025
itemId: {
@@ -30,17 +35,22 @@ export default {
3035
},
3136
async additionalProps() {
3237
const props = {};
33-
if (this.boardId) {
34-
const columns = await this.getColumns(this.boardId);
38+
const { boardId } = this;
39+
if (boardId) {
40+
const columns = await this.monday.listColumns({
41+
boardId: +boardId,
42+
});
3543
for (const column of columns) {
36-
props[column.id] = {
44+
const id = column.id;
45+
props[id] = {
3746
type: "string",
3847
label: column.title,
39-
description: `The value for column ${column.title}`,
48+
description: `The value for the "${column.title}" column (\`${id}\`)`,
4049
optional: true,
50+
options: getColumnOptions(columns, id),
4151
};
4252
if (column.type === "file") {
43-
props[column.id].description += ". The path to a file in the `/tmp` directory. [See the documentation on working with files](https://pipedream.com/docs/code/nodejs/working-with-files/#writing-a-file-to-tmp).";
53+
props[column.id].description += ". The path to a file in the `/tmp` directory. [See the documentation on working with files](https://pipedream.com/docs/code/nodejs/working-with-files/#writing-a-file-to-tmp)";
4454
}
4555
}
4656
}

0 commit comments

Comments
 (0)