|
1 | | -import { capitalizeWord } from "../../common/utils.mjs"; |
| 1 | +import { |
| 2 | + capitalizeWord, getColumnOptions, |
| 3 | +} from "../../common/utils.mjs"; |
2 | 4 | import monday from "../../monday.app.mjs"; |
3 | 5 |
|
4 | 6 | export default { |
@@ -26,30 +28,15 @@ export default { |
26 | 28 | }); |
27 | 29 | for (const column of this.columns) { |
28 | 30 | let description, options; |
29 | | - const columnOptions = columnData.find(({ id }) => id === column)?.settings_str; |
30 | | - if (columnOptions) { |
31 | | - try { |
32 | | - options = Object.entries(JSON.parse(columnOptions).labels).map(([ |
33 | | - value, |
34 | | - label, |
35 | | - ]) => ({ |
36 | | - label: label !== "" |
37 | | - ? label |
38 | | - : value, |
39 | | - value, |
40 | | - })); |
41 | | - } catch (err) { |
42 | | - console.log(`Error parsing options for column "${column}": ${err}`); |
43 | | - } |
44 | | - } |
45 | | - if (column.endsWith("status")) { |
46 | | - description = "A status value for the item. [See more about status values here](https://view.monday.com/1073554546-ad9f20a427a16e67ded630108994c11b?r=use1)."; |
47 | | - } else if (column === "person") { |
| 31 | + options = getColumnOptions(columnData, column); |
| 32 | + if (column === "person") { |
48 | 33 | description = "The ID of a person/user."; |
49 | 34 | } else if (column === "date4") { |
50 | 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}".`; |
51 | 38 | } else { |
52 | | - 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.`; |
| 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.`; |
53 | 40 | } |
54 | 41 | props[column] = { |
55 | 42 | type: "string", |
|
0 commit comments